summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libfaad/analysis.h4
-rw-r--r--src/libfaad/bits.c4
-rw-r--r--src/libfaad/bits.h4
-rw-r--r--src/libfaad/cfft.c641
-rw-r--r--src/libfaad/cfft.h25
-rw-r--r--src/libfaad/cfft_tab.h4
-rw-r--r--src/libfaad/common.c11
-rw-r--r--src/libfaad/common.h12
-rw-r--r--src/libfaad/decoder.c15
-rw-r--r--src/libfaad/decoder.h8
-rw-r--r--src/libfaad/diff_to_faad2_cvs.patch18
-rw-r--r--src/libfaad/drc.c4
-rw-r--r--src/libfaad/drc.h4
-rw-r--r--src/libfaad/error.c9
-rw-r--r--src/libfaad/error.h4
-rw-r--r--src/libfaad/filtbank.c78
-rw-r--r--src/libfaad/filtbank.h4
-rw-r--r--src/libfaad/fixed.h4
-rw-r--r--src/libfaad/hcr.c5
-rw-r--r--src/libfaad/huffman.c49
-rw-r--r--src/libfaad/huffman.h17
-rw-r--r--src/libfaad/ic_predict.c4
-rw-r--r--src/libfaad/ic_predict.h4
-rw-r--r--src/libfaad/iq_table.h4
-rw-r--r--src/libfaad/is.c17
-rw-r--r--src/libfaad/is.h4
-rw-r--r--src/libfaad/kbd_win.h4
-rw-r--r--src/libfaad/lt_predict.c13
-rw-r--r--src/libfaad/lt_predict.h7
-rw-r--r--src/libfaad/mdct.c8
-rw-r--r--src/libfaad/mdct.h4
-rw-r--r--src/libfaad/mp4.c4
-rw-r--r--src/libfaad/mp4.h4
-rw-r--r--src/libfaad/ms.c6
-rw-r--r--src/libfaad/ms.h4
-rw-r--r--src/libfaad/output.h7
-rw-r--r--src/libfaad/pns.c9
-rw-r--r--src/libfaad/pns.h8
-rw-r--r--src/libfaad/pulse.c4
-rw-r--r--src/libfaad/pulse.h4
-rw-r--r--src/libfaad/rvlc.c25
-rw-r--r--src/libfaad/rvlc.h16
-rw-r--r--src/libfaad/sbr_dct.c4
-rw-r--r--src/libfaad/sbr_dct.h4
-rw-r--r--src/libfaad/sbr_dec.c8
-rw-r--r--src/libfaad/sbr_dec.h4
-rw-r--r--src/libfaad/sbr_e_nf.c96
-rw-r--r--src/libfaad/sbr_e_nf.h4
-rw-r--r--src/libfaad/sbr_fbt.c8
-rw-r--r--src/libfaad/sbr_fbt.h5
-rw-r--r--src/libfaad/sbr_hfadj.c21
-rw-r--r--src/libfaad/sbr_hfadj.h18
-rw-r--r--src/libfaad/sbr_hfgen.c28
-rw-r--r--src/libfaad/sbr_hfgen.h16
-rw-r--r--src/libfaad/sbr_huff.c6
-rw-r--r--src/libfaad/sbr_huff.h4
-rw-r--r--src/libfaad/sbr_noise.h7
-rw-r--r--src/libfaad/sbr_qmf.c63
-rw-r--r--src/libfaad/sbr_qmf.h10
-rw-r--r--src/libfaad/sbr_qmf_c.h7
-rw-r--r--src/libfaad/sbr_syntax.c17
-rw-r--r--src/libfaad/sbr_syntax.h12
-rw-r--r--src/libfaad/sbr_tf_grid.c17
-rw-r--r--src/libfaad/sbr_tf_grid.h8
-rw-r--r--src/libfaad/sine_win.h4
-rw-r--r--src/libfaad/specrec.c37
-rw-r--r--src/libfaad/specrec.h6
-rw-r--r--src/libfaad/ssr.c4
-rw-r--r--src/libfaad/ssr.h4
-rw-r--r--src/libfaad/ssr_fb.c4
-rw-r--r--src/libfaad/ssr_ipqf.c4
-rw-r--r--src/libfaad/structs.h5
-rw-r--r--src/libfaad/syntax.c69
-rw-r--r--src/libfaad/syntax.h49
-rw-r--r--src/libfaad/tns.c14
-rw-r--r--src/libfaad/tns.h11
76 files changed, 926 insertions, 736 deletions
diff --git a/src/libfaad/analysis.h b/src/libfaad/analysis.h
index 2cfd05d50..5afbce414 100644
--- a/src/libfaad/analysis.h
+++ b/src/libfaad/analysis.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: analysis.h,v 1.3 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: analysis.h,v 1.4 2004/01/11 15:44:04 mroi Exp $
**/
#ifndef __ANALYSIS_H__
diff --git a/src/libfaad/bits.c b/src/libfaad/bits.c
index ea0b8a78c..2ec31a930 100644
--- a/src/libfaad/bits.c
+++ b/src/libfaad/bits.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: bits.c,v 1.5 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: bits.c,v 1.6 2004/01/11 15:44:04 mroi Exp $
**/
#include "common.h"
diff --git a/src/libfaad/bits.h b/src/libfaad/bits.h
index 2760ad022..18f1c2a3f 100644
--- a/src/libfaad/bits.h
+++ b/src/libfaad/bits.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: bits.h,v 1.5 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: bits.h,v 1.6 2004/01/11 15:44:04 mroi Exp $
**/
#ifndef __BITS_H__
diff --git a/src/libfaad/cfft.c b/src/libfaad/cfft.c
index bbdfc36df..fa858303c 100644
--- a/src/libfaad/cfft.c
+++ b/src/libfaad/cfft.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: cfft.c,v 1.7 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: cfft.c,v 1.8 2004/01/11 15:44:04 mroi Exp $
**/
/*
@@ -43,84 +43,115 @@
#include "cfft_tab.h"
+/* static function declarations */
+#ifdef USE_SSE
+static void passf2pos_sse(const uint16_t l1, const complex_t *cc,
+ complex_t *ch, const complex_t *wa);
+static void passf2pos_sse_ido(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+ complex_t *ch, const complex_t *wa);
+static void passf4pos_sse_ido(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch,
+ const complex_t *wa1, const complex_t *wa2, const complex_t *wa3);
+#endif
+static void passf2pos(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+ complex_t *ch, const complex_t *wa);
+static void passf2neg(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+ complex_t *ch, const complex_t *wa);
+static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+ complex_t *ch, const complex_t *wa1, const complex_t *wa2, const int8_t isign);
+static void passf4pos(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch,
+ const complex_t *wa1, const complex_t *wa2, const complex_t *wa3);
+static void passf4neg(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch,
+ const complex_t *wa1, const complex_t *wa2, const complex_t *wa3);
+static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch,
+ const complex_t *wa1, const complex_t *wa2, const complex_t *wa3,
+ const complex_t *wa4, const int8_t isign);
+INLINE void cfftf1(uint16_t n, complex_t *c, complex_t *ch,
+ const uint16_t *ifac, const complex_t *wa, const int8_t isign);
+static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac);
+
+
/*----------------------------------------------------------------------
passf2, passf3, passf4, passf5. Complex FFT passes fwd and bwd.
----------------------------------------------------------------------*/
-#ifdef USE_SSE
-static void passf2pos_sse(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+#if 0 //def USE_SSE
+static void passf2pos_sse(const uint16_t l1, const complex_t *cc,
complex_t *ch, const complex_t *wa)
{
- uint16_t i, k, ah, ac;
+ uint16_t k, ah, ac;
- if (ido == 1)
+ for (k = 0; k < l1; k++)
{
- for (k = 0; k < l1; k++)
- {
- ah = 2*k;
- ac = 4*k;
+ ah = 2*k;
+ ac = 4*k;
- RE(ch[ah]) = RE(cc[ac]) + RE(cc[ac+1]);
- IM(ch[ah]) = IM(cc[ac]) + IM(cc[ac+1]);
+ RE(ch[ah]) = RE(cc[ac]) + RE(cc[ac+1]);
+ IM(ch[ah]) = IM(cc[ac]) + IM(cc[ac+1]);
- RE(ch[ah+l1]) = RE(cc[ac]) - RE(cc[ac+1]);
- IM(ch[ah+l1]) = IM(cc[ac]) - IM(cc[ac+1]);
- }
- } else {
- for (k = 0; k < l1; k++)
+ RE(ch[ah+l1]) = RE(cc[ac]) - RE(cc[ac+1]);
+ IM(ch[ah+l1]) = IM(cc[ac]) - IM(cc[ac+1]);
+ }
+}
+
+static void passf2pos_sse_ido(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+ complex_t *ch, const complex_t *wa)
+{
+ uint16_t i, k, ah, ac;
+
+ for (k = 0; k < l1; k++)
+ {
+ ah = k*ido;
+ ac = 2*k*ido;
+
+ for (i = 0; i < ido; i+=4)
{
- ah = k*ido;
- ac = 2*k*ido;
+ __m128 m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14;
+ __m128 m15, m16, m17, m18, m19, m20, m21, m22, m23, m24;
+ __m128 w1, w2, w3, w4;
- for (i = 0; i < ido; i+=4)
- {
- __m128 m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14;
- __m128 m15, m16, m17, m18, m19, m20, m21, m22, m23, m24;
- __m128 w1, w2, w3, w4;
+ m1 = _mm_load_ps(&RE(cc[ac+i]));
+ m2 = _mm_load_ps(&RE(cc[ac+ido+i]));
+ m5 = _mm_load_ps(&RE(cc[ac+i+2]));
+ m6 = _mm_load_ps(&RE(cc[ac+ido+i+2]));
+ w1 = _mm_load_ps(&RE(wa[i]));
+ w3 = _mm_load_ps(&RE(wa[i+2]));
- m1 = _mm_load_ps(&RE(cc[ac+i]));
- m2 = _mm_load_ps(&RE(cc[ac+ido+i]));
- m5 = _mm_load_ps(&RE(cc[ac+i+2]));
- m6 = _mm_load_ps(&RE(cc[ac+ido+i+2]));
- w1 = _mm_load_ps(&RE(wa[i]));
- w3 = _mm_load_ps(&RE(wa[i+2]));
+ m3 = _mm_add_ps(m1, m2);
+ m15 = _mm_add_ps(m5, m6);
- m3 = _mm_add_ps(m1, m2);
- m15 = _mm_add_ps(m5, m6);
+ m4 = _mm_sub_ps(m1, m2);
+ m16 = _mm_sub_ps(m5, m6);
- m4 = _mm_sub_ps(m1, m2);
- m16 = _mm_sub_ps(m5, m6);
+ _mm_store_ps(&RE(ch[ah+i]), m3);
+ _mm_store_ps(&RE(ch[ah+i+2]), m15);
- _mm_store_ps(&RE(ch[ah+i]), m3);
- _mm_store_ps(&RE(ch[ah+i+2]), m15);
- w2 = _mm_shuffle_ps(w1, w1, _MM_SHUFFLE(2, 3, 0, 1));
- w4 = _mm_shuffle_ps(w3, w3, _MM_SHUFFLE(2, 3, 0, 1));
+ w2 = _mm_shuffle_ps(w1, w1, _MM_SHUFFLE(2, 3, 0, 1));
+ w4 = _mm_shuffle_ps(w3, w3, _MM_SHUFFLE(2, 3, 0, 1));
- m7 = _mm_mul_ps(m4, w1);
- m17 = _mm_mul_ps(m16, w3);
- m8 = _mm_mul_ps(m4, w2);
- m18 = _mm_mul_ps(m16, w4);
+ m7 = _mm_mul_ps(m4, w1);
+ m17 = _mm_mul_ps(m16, w3);
+ m8 = _mm_mul_ps(m4, w2);
+ m18 = _mm_mul_ps(m16, w4);
- m9 = _mm_shuffle_ps(m7, m8, _MM_SHUFFLE(2, 0, 2, 0));
- m19 = _mm_shuffle_ps(m17, m18, _MM_SHUFFLE(2, 0, 2, 0));
- m10 = _mm_shuffle_ps(m7, m8, _MM_SHUFFLE(3, 1, 3, 1));
- m20 = _mm_shuffle_ps(m17, m18, _MM_SHUFFLE(3, 1, 3, 1));
+ m9 = _mm_shuffle_ps(m7, m8, _MM_SHUFFLE(2, 0, 2, 0));
+ m19 = _mm_shuffle_ps(m17, m18, _MM_SHUFFLE(2, 0, 2, 0));
+ m10 = _mm_shuffle_ps(m7, m8, _MM_SHUFFLE(3, 1, 3, 1));
+ m20 = _mm_shuffle_ps(m17, m18, _MM_SHUFFLE(3, 1, 3, 1));
- m11 = _mm_add_ps(m9, m10);
- m21 = _mm_add_ps(m19, m20);
- m12 = _mm_sub_ps(m9, m10);
- m22 = _mm_sub_ps(m19, m20);
+ m11 = _mm_add_ps(m9, m10);
+ m21 = _mm_add_ps(m19, m20);
+ m12 = _mm_sub_ps(m9, m10);
+ m22 = _mm_sub_ps(m19, m20);
- m13 = _mm_shuffle_ps(m11, m11, _MM_SHUFFLE(0, 0, 3, 2));
- m23 = _mm_shuffle_ps(m21, m21, _MM_SHUFFLE(0, 0, 3, 2));
+ m13 = _mm_shuffle_ps(m11, m11, _MM_SHUFFLE(0, 0, 3, 2));
+ m23 = _mm_shuffle_ps(m21, m21, _MM_SHUFFLE(0, 0, 3, 2));
- m14 = _mm_unpacklo_ps(m12, m13);
- m24 = _mm_unpacklo_ps(m22, m23);
+ m14 = _mm_unpacklo_ps(m12, m13);
+ m24 = _mm_unpacklo_ps(m22, m23);
- _mm_store_ps(&RE(ch[ah+i+l1*ido]), m14);
- _mm_store_ps(&RE(ch[ah+i+2+l1*ido]), m24);
- }
+ _mm_store_ps(&RE(ch[ah+i+l1*ido]), m14);
+ _mm_store_ps(&RE(ch[ah+i+2+l1*ido]), m24);
}
}
}
@@ -159,8 +190,13 @@ static void passf2pos(const uint16_t ido, const uint16_t l1, const complex_t *cc
IM(ch[ah+i]) = IM(cc[ac+i]) + IM(cc[ac+i+ido]);
IM(t2) = IM(cc[ac+i]) - IM(cc[ac+i+ido]);
+#if 1
ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]),
IM(t2), RE(t2), RE(wa[i]), IM(wa[i]));
+#else
+ ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]),
+ RE(t2), IM(t2), RE(wa[i]), IM(wa[i]));
+#endif
}
}
}
@@ -199,8 +235,13 @@ static void passf2neg(const uint16_t ido, const uint16_t l1, const complex_t *cc
IM(ch[ah+i]) = IM(cc[ac+i]) + IM(cc[ac+i+ido]);
IM(t2) = IM(cc[ac+i]) - IM(cc[ac+i+ido]);
+#if 1
ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]),
RE(t2), IM(t2), RE(wa[i]), IM(wa[i]));
+#else
+ ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]),
+ IM(t2), RE(t2), RE(wa[i]), IM(wa[i]));
+#endif
}
}
}
@@ -290,10 +331,17 @@ static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc,
RE(d3) = RE(c2) + IM(c3);
IM(d2) = IM(c2) + RE(c3);
+#if 1
ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]),
IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]),
IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
+#else
+ ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]),
+ RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
+ ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]),
+ RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
+#endif
}
}
} else {
@@ -320,10 +368,17 @@ static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc,
RE(d3) = RE(c2) - IM(c3);
IM(d2) = IM(c2) - RE(c3);
+#if 1
ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]),
RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]),
RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
+#else
+ ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]),
+ IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
+ ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]),
+ IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
+#endif
}
}
}
@@ -331,158 +386,213 @@ static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc,
}
#ifdef USE_SSE
-static void passf4pos_sse(const uint16_t ido, const uint16_t l1, const complex_t *cc,
- complex_t *ch, const complex_t *wa1, const complex_t *wa2,
- const complex_t *wa3)
+ALIGN static const int32_t negate[4] = { 0x0, 0x0, 0x0, 0x80000000 };
+
+__declspec(naked) static void passf4pos_sse(const uint16_t l1, const complex_t *cc,
+ complex_t *ch, const complex_t *wa1, const complex_t *wa2,
+ const complex_t *wa3)
+{
+ __asm {
+ push ebx
+ mov ebx, esp
+ and esp, -16
+ push edi
+ push esi
+ sub esp, 8
+ movzx edi, WORD PTR [ebx+8]
+
+ movaps xmm1, XMMWORD PTR negate
+
+ test edi, edi
+ jle l1_is_zero
+
+ lea esi, DWORD PTR [edi+edi]
+ add esi, esi
+ sub esi, edi
+ add esi, esi
+ add esi, esi
+ add esi, esi
+ mov eax, DWORD PTR [ebx+16]
+ add esi, eax
+ lea ecx, DWORD PTR [edi+edi]
+ add ecx, ecx
+ add ecx, ecx
+ add ecx, ecx
+ add ecx, eax
+ lea edx, DWORD PTR [edi+edi]
+ add edx, edx
+ add edx, edx
+ add edx, eax
+ xor eax, eax
+ mov DWORD PTR [esp], ebp
+ mov ebp, DWORD PTR [ebx+12]
+
+fftloop:
+ lea edi, DWORD PTR [eax+eax]
+ add edi, edi
+ movaps xmm2, XMMWORD PTR [ebp+edi*8]
+ movaps xmm0, XMMWORD PTR [ebp+edi*8+16]
+ movaps xmm7, XMMWORD PTR [ebp+edi*8+32]
+ movaps xmm5, XMMWORD PTR [ebp+edi*8+48]
+ movaps xmm6, xmm2
+ addps xmm6, xmm0
+ movaps xmm4, xmm1
+ xorps xmm4, xmm7
+ movaps xmm3, xmm1
+ xorps xmm3, xmm5
+ xorps xmm2, xmm1
+ xorps xmm0, xmm1
+ addps xmm7, xmm5
+ subps xmm2, xmm0
+ movaps xmm0, xmm6
+ shufps xmm0, xmm7, 68
+ subps xmm4, xmm3
+ shufps xmm6, xmm7, 238
+ movaps xmm5, xmm2
+ shufps xmm5, xmm4, 68
+ movaps xmm3, xmm0
+ addps xmm3, xmm6
+ shufps xmm2, xmm4, 187
+ subps xmm0, xmm6
+ movaps xmm4, xmm5
+ addps xmm4, xmm2
+ mov edi, DWORD PTR [ebx+16]
+ movaps XMMWORD PTR [edi+eax*8], xmm3
+ subps xmm5, xmm2
+ movaps XMMWORD PTR [edx+eax*8], xmm4
+ movaps XMMWORD PTR [ecx+eax*8], xmm0
+ movaps XMMWORD PTR [esi+eax*8], xmm5
+ add eax, 2
+ movzx eax, ax
+ movzx edi, WORD PTR [ebx+8]
+ cmp eax, edi
+ jl fftloop
+
+ mov ebp, DWORD PTR [esp]
+
+l1_is_zero:
+
+ add esp, 8
+ pop esi
+ pop edi
+ mov esp, ebx
+ pop ebx
+ ret
+ }
+}
+#endif
+
+#if 0
+static void passf4pos_sse_ido(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+ complex_t *ch, const complex_t *wa1, const complex_t *wa2,
+ const complex_t *wa3)
{
uint16_t i, k, ac, ah;
- if (ido == 1)
+ for (k = 0; k < l1; k++)
{
- for (k = 0; k < l1; k+=2)
- {
- __m128 m1, m2, m3, m4, m5, m6, m7, m8, m9, m10;
- __m128 n1, n2, n3, n4, n5, n6, n7, n8, n9, n10;
- __m128 neg1 = _mm_set_ps(-1.0, 1.0, 1.0, 1.0);
+ ac = 4*k*ido;
+ ah = k*ido;
- m1 = _mm_load_ps(&RE(cc[4*k]));
- m2 = _mm_load_ps(&RE(cc[4*k+2]));
- n1 = _mm_load_ps(&RE(cc[4*k+4]));
- n2 = _mm_load_ps(&RE(cc[4*k+6]));
+ for (i = 0; i < ido; i+=2)
+ {
+ __m128 m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15, m16;
+ __m128 n1, n2, n3, n4, n5, n6, n7, n8, n9, m17, m18, m19, m20, m21, m22, m23;
+ __m128 w1, w2, w3, w4, w5, w6, m24, m25, m26, m27, m28, m29, m30;
+ __m128 neg1 = _mm_set_ps(-1.0, 1.0, -1.0, 1.0);
+ m1 = _mm_load_ps(&RE(cc[ac+i]));
+ m2 = _mm_load_ps(&RE(cc[ac+i+2*ido]));
m3 = _mm_add_ps(m1, m2);
+ m4 = _mm_sub_ps(m1, m2);
- n4 = _mm_mul_ps(neg1, n1);
- n5 = _mm_mul_ps(neg1, n2);
- m4 = _mm_mul_ps(neg1, m1);
- m5 = _mm_mul_ps(neg1, m2);
-
+ n1 = _mm_load_ps(&RE(cc[ac+i+ido]));
+ n2 = _mm_load_ps(&RE(cc[ac+i+3*ido]));
n3 = _mm_add_ps(n1, n2);
- m6 = _mm_sub_ps(m4, m5);
- m7 = _mm_shuffle_ps(m3, n3, _MM_SHUFFLE(1, 0, 1, 0));
+ n4 = _mm_mul_ps(neg1, n1);
+ n5 = _mm_mul_ps(neg1, n2);
n6 = _mm_sub_ps(n4, n5);
- m8 = _mm_shuffle_ps(m3, n3, _MM_SHUFFLE(3, 2, 3, 2));
- n7 = _mm_shuffle_ps(m6, n6, _MM_SHUFFLE(1, 0, 1, 0));
- m9 = _mm_add_ps(m7, m8);
- n8 = _mm_shuffle_ps(m6, n6, _MM_SHUFFLE(2, 3, 2, 3));
+ m5 = _mm_add_ps(m3, n3);
- m10 = _mm_sub_ps(m7, m8);
- n9 = _mm_add_ps(n7, n8);
+ n7 = _mm_shuffle_ps(n6, n6, _MM_SHUFFLE(2, 3, 0, 1));
+ n8 = _mm_add_ps(m4, n7);
- _mm_store_ps(&RE(ch[k]), m9);
- n10 = _mm_sub_ps(n7, n8);
- _mm_store_ps(&RE(ch[k+l1]), n9);
- _mm_store_ps(&RE(ch[k+2*l1]), m10);
- _mm_store_ps(&RE(ch[k+3*l1]), n10);
- }
- } else {
- for (k = 0; k < l1; k++)
- {
- ac = 4*k*ido;
- ah = k*ido;
+ m6 = _mm_sub_ps(m3, n3);
+ n9 = _mm_sub_ps(m4, n7);
- for (i = 0; i < ido; i+=2)
- {
- __m128 m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15, m16;
- __m128 n1, n2, n3, n4, n5, n6, n7, n8, n9, m17, m18, m19, m20, m21, m22, m23;
- __m128 w1, w2, w3, w4, w5, w6, m24, m25, m26, m27, m28, m29, m30;
- __m128 neg1 = _mm_set_ps(-1.0, 1.0, -1.0, 1.0);
-
- m1 = _mm_load_ps(&RE(cc[ac+i]));
- m2 = _mm_load_ps(&RE(cc[ac+i+2*ido]));
- m3 = _mm_add_ps(m1, m2);
- m4 = _mm_sub_ps(m1, m2);
-
- n1 = _mm_load_ps(&RE(cc[ac+i+ido]));
- n2 = _mm_load_ps(&RE(cc[ac+i+3*ido]));
- n3 = _mm_add_ps(n1, n2);
-
- n4 = _mm_mul_ps(neg1, n1);
- n5 = _mm_mul_ps(neg1, n2);
- n6 = _mm_sub_ps(n4, n5);
-
- m5 = _mm_add_ps(m3, n3);
-
- n7 = _mm_shuffle_ps(n6, n6, _MM_SHUFFLE(2, 3, 0, 1));
- n8 = _mm_add_ps(m4, n7);
-
- m6 = _mm_sub_ps(m3, n3);
- n9 = _mm_sub_ps(m4, n7);
-
- _mm_store_ps(&RE(ch[ah+i]), m5);
+ _mm_store_ps(&RE(ch[ah+i]), m5);
#if 0
- static INLINE void ComplexMult(real_t *y1, real_t *y2,
- real_t x1, real_t x2, real_t c1, real_t c2)
- {
- *y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
- *y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
- }
-
- m7.0 = RE(c2)*RE(wa1[i])
- m7.1 = IM(c2)*IM(wa1[i])
- m7.2 = RE(c6)*RE(wa1[i+1])
- m7.3 = IM(c6)*IM(wa1[i+1])
-
- m8.0 = RE(c2)*IM(wa1[i])
- m8.1 = IM(c2)*RE(wa1[i])
- m8.2 = RE(c6)*IM(wa1[i+1])
- m8.3 = IM(c6)*RE(wa1[i+1])
-
- RE(0) = m7.0 - m7.1
- IM(0) = m8.0 + m8.1
- RE(1) = m7.2 - m7.3
- IM(1) = m8.2 + m8.3
-
-////
- RE(0) = RE(c2)*RE(wa1[i]) - IM(c2)*IM(wa1[i])
- IM(0) = RE(c2)*IM(wa1[i]) + IM(c2)*RE(wa1[i])
- RE(1) = RE(c6)*RE(wa1[i+1]) - IM(c6)*IM(wa1[i+1])
- IM(1) = RE(c6)*IM(wa1[i+1]) + IM(c6)*RE(wa1[i+1])
+ static INLINE void ComplexMult(real_t *y1, real_t *y2,
+ real_t x1, real_t x2, real_t c1, real_t c2)
+ {
+ *y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
+ *y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
+ }
+
+ m7.0 = RE(c2)*RE(wa1[i])
+ m7.1 = IM(c2)*IM(wa1[i])
+ m7.2 = RE(c6)*RE(wa1[i+1])
+ m7.3 = IM(c6)*IM(wa1[i+1])
+
+ m8.0 = RE(c2)*IM(wa1[i])
+ m8.1 = IM(c2)*RE(wa1[i])
+ m8.2 = RE(c6)*IM(wa1[i+1])
+ m8.3 = IM(c6)*RE(wa1[i+1])
+
+ RE(0) = m7.0 - m7.1
+ IM(0) = m8.0 + m8.1
+ RE(1) = m7.2 - m7.3
+ IM(1) = m8.2 + m8.3
+
+ ////
+ RE(0) = RE(c2)*RE(wa1[i]) - IM(c2)*IM(wa1[i])
+ IM(0) = RE(c2)*IM(wa1[i]) + IM(c2)*RE(wa1[i])
+ RE(1) = RE(c6)*RE(wa1[i+1]) - IM(c6)*IM(wa1[i+1])
+ IM(1) = RE(c6)*IM(wa1[i+1]) + IM(c6)*RE(wa1[i+1])
#endif
- w1 = _mm_load_ps(&RE(wa1[i]));
- w3 = _mm_load_ps(&RE(wa2[i]));
- w5 = _mm_load_ps(&RE(wa3[i]));
-
- w2 = _mm_shuffle_ps(w1, w1, _MM_SHUFFLE(2, 3, 0, 1));
- w4 = _mm_shuffle_ps(w3, w3, _MM_SHUFFLE(2, 3, 0, 1));
- w6 = _mm_shuffle_ps(w5, w5, _MM_SHUFFLE(2, 3, 0, 1));
-
- m7 = _mm_mul_ps(n8, w1);
- m15 = _mm_mul_ps(m6, w3);
- m23 = _mm_mul_ps(n9, w5);
- m8 = _mm_mul_ps(n8, w2);
- m16 = _mm_mul_ps(m6, w4);
- m24 = _mm_mul_ps(n9, w6);
-
- m9 = _mm_shuffle_ps(m7, m8, _MM_SHUFFLE(2, 0, 2, 0));
- m17 = _mm_shuffle_ps(m15, m16, _MM_SHUFFLE(2, 0, 2, 0));
- m25 = _mm_shuffle_ps(m23, m24, _MM_SHUFFLE(2, 0, 2, 0));
- m10 = _mm_shuffle_ps(m7, m8, _MM_SHUFFLE(3, 1, 3, 1));
- m18 = _mm_shuffle_ps(m15, m16, _MM_SHUFFLE(3, 1, 3, 1));
- m26 = _mm_shuffle_ps(m23, m24, _MM_SHUFFLE(3, 1, 3, 1));
-
- m11 = _mm_add_ps(m9, m10);
- m19 = _mm_add_ps(m17, m18);
- m27 = _mm_add_ps(m25, m26);
- m12 = _mm_sub_ps(m9, m10);
- m20 = _mm_sub_ps(m17, m18);
- m28 = _mm_sub_ps(m25, m26);
-
- m13 = _mm_shuffle_ps(m11, m11, _MM_SHUFFLE(0, 0, 3, 2));
- m21 = _mm_shuffle_ps(m19, m19, _MM_SHUFFLE(0, 0, 3, 2));
- m29 = _mm_shuffle_ps(m27, m27, _MM_SHUFFLE(0, 0, 3, 2));
- m14 = _mm_unpacklo_ps(m12, m13);
- m22 = _mm_unpacklo_ps(m20, m21);
- m30 = _mm_unpacklo_ps(m28, m29);
-
- _mm_store_ps(&RE(ch[ah+i+l1*ido]), m14);
- _mm_store_ps(&RE(ch[ah+i+2*l1*ido]), m22);
- _mm_store_ps(&RE(ch[ah+i+3*l1*ido]), m30);
- }
+ w1 = _mm_load_ps(&RE(wa1[i]));
+ w3 = _mm_load_ps(&RE(wa2[i]));
+ w5 = _mm_load_ps(&RE(wa3[i]));
+
+ w2 = _mm_shuffle_ps(w1, w1, _MM_SHUFFLE(2, 3, 0, 1));
+ w4 = _mm_shuffle_ps(w3, w3, _MM_SHUFFLE(2, 3, 0, 1));
+ w6 = _mm_shuffle_ps(w5, w5, _MM_SHUFFLE(2, 3, 0, 1));
+
+ m7 = _mm_mul_ps(n8, w1);
+ m15 = _mm_mul_ps(m6, w3);
+ m23 = _mm_mul_ps(n9, w5);
+ m8 = _mm_mul_ps(n8, w2);
+ m16 = _mm_mul_ps(m6, w4);
+ m24 = _mm_mul_ps(n9, w6);
+
+ m9 = _mm_shuffle_ps(m7, m8, _MM_SHUFFLE(2, 0, 2, 0));
+ m17 = _mm_shuffle_ps(m15, m16, _MM_SHUFFLE(2, 0, 2, 0));
+ m25 = _mm_shuffle_ps(m23, m24, _MM_SHUFFLE(2, 0, 2, 0));
+ m10 = _mm_shuffle_ps(m7, m8, _MM_SHUFFLE(3, 1, 3, 1));
+ m18 = _mm_shuffle_ps(m15, m16, _MM_SHUFFLE(3, 1, 3, 1));
+ m26 = _mm_shuffle_ps(m23, m24, _MM_SHUFFLE(3, 1, 3, 1));
+
+ m11 = _mm_add_ps(m9, m10);
+ m19 = _mm_add_ps(m17, m18);
+ m27 = _mm_add_ps(m25, m26);
+ m12 = _mm_sub_ps(m9, m10);
+ m20 = _mm_sub_ps(m17, m18);
+ m28 = _mm_sub_ps(m25, m26);
+
+ m13 = _mm_shuffle_ps(m11, m11, _MM_SHUFFLE(0, 0, 3, 2));
+ m21 = _mm_shuffle_ps(m19, m19, _MM_SHUFFLE(0, 0, 3, 2));
+ m29 = _mm_shuffle_ps(m27, m27, _MM_SHUFFLE(0, 0, 3, 2));
+ m14 = _mm_unpacklo_ps(m12, m13);
+ m22 = _mm_unpacklo_ps(m20, m21);
+ m30 = _mm_unpacklo_ps(m28, m29);
+
+ _mm_store_ps(&RE(ch[ah+i+l1*ido]), m14);
+ _mm_store_ps(&RE(ch[ah+i+2*l1*ido]), m22);
+ _mm_store_ps(&RE(ch[ah+i+3*l1*ido]), m30);
}
}
}
@@ -555,12 +665,21 @@ static void passf4pos(const uint16_t ido, const uint16_t l1, const complex_t *cc
IM(ch[ah+i]) = IM(t2) + IM(t3);
IM(c3) = IM(t2) - IM(t3);
+#if 1
ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]),
IM(c2), RE(c2), RE(wa1[i]), IM(wa1[i]));
ComplexMult(&IM(ch[ah+i+2*l1*ido]), &RE(ch[ah+i+2*l1*ido]),
IM(c3), RE(c3), RE(wa2[i]), IM(wa2[i]));
ComplexMult(&IM(ch[ah+i+3*l1*ido]), &RE(ch[ah+i+3*l1*ido]),
IM(c4), RE(c4), RE(wa3[i]), IM(wa3[i]));
+#else
+ ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]),
+ RE(c2), IM(c2), RE(wa1[i]), IM(wa1[i]));
+ ComplexMult(&RE(ch[ah+i+2*l1*ido]), &IM(ch[ah+i+2*l1*ido]),
+ RE(c3), IM(c3), RE(wa2[i]), IM(wa2[i]));
+ ComplexMult(&RE(ch[ah+i+3*l1*ido]), &IM(ch[ah+i+3*l1*ido]),
+ RE(c4), IM(c4), RE(wa3[i]), IM(wa3[i]));
+#endif
}
}
}
@@ -633,12 +752,21 @@ static void passf4neg(const uint16_t ido, const uint16_t l1, const complex_t *cc
IM(ch[ah+i]) = IM(t2) + IM(t3);
IM(c3) = IM(t2) - IM(t3);
+#if 1
ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]),
RE(c2), IM(c2), RE(wa1[i]), IM(wa1[i]));
ComplexMult(&RE(ch[ah+i+2*l1*ido]), &IM(ch[ah+i+2*l1*ido]),
RE(c3), IM(c3), RE(wa2[i]), IM(wa2[i]));
ComplexMult(&RE(ch[ah+i+3*l1*ido]), &IM(ch[ah+i+3*l1*ido]),
RE(c4), IM(c4), RE(wa3[i]), IM(wa3[i]));
+#else
+ ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]),
+ IM(c2), RE(c2), RE(wa1[i]), IM(wa1[i]));
+ ComplexMult(&IM(ch[ah+i+2*l1*ido]), &RE(ch[ah+i+2*l1*ido]),
+ IM(c3), RE(c3), RE(wa2[i]), IM(wa2[i]));
+ ComplexMult(&IM(ch[ah+i+3*l1*ido]), &RE(ch[ah+i+3*l1*ido]),
+ IM(c4), RE(c4), RE(wa3[i]), IM(wa3[i]));
+#endif
}
}
}
@@ -774,6 +902,7 @@ static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc,
RE(d3) = RE(c3) - IM(c4);
IM(d4) = IM(c3) - RE(c4);
+#if 1
ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]),
IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]),
@@ -782,6 +911,16 @@ static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc,
IM(d4), RE(d4), RE(wa3[i]), IM(wa3[i]));
ComplexMult(&IM(ch[ah+4*l1*ido]), &RE(ch[ah+4*l1*ido]),
IM(d5), RE(d5), RE(wa4[i]), IM(wa4[i]));
+#else
+ ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]),
+ RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
+ ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]),
+ RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
+ ComplexMult(&RE(ch[ah+3*l1*ido]), &IM(ch[ah+3*l1*ido]),
+ RE(d4), IM(d4), RE(wa3[i]), IM(wa3[i]));
+ ComplexMult(&RE(ch[ah+4*l1*ido]), &IM(ch[ah+4*l1*ido]),
+ RE(d5), IM(d5), RE(wa4[i]), IM(wa4[i]));
+#endif
}
}
} else {
@@ -823,6 +962,7 @@ static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc,
RE(d3) = RE(c3) + IM(c4);
IM(d4) = IM(c3) + RE(c4);
+#if 1
ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]),
RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]),
@@ -831,6 +971,16 @@ static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc,
RE(d4), IM(d4), RE(wa3[i]), IM(wa3[i]));
ComplexMult(&RE(ch[ah+4*l1*ido]), &IM(ch[ah+4*l1*ido]),
RE(d5), IM(d5), RE(wa4[i]), IM(wa4[i]));
+#else
+ ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]),
+ IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
+ ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]),
+ IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
+ ComplexMult(&IM(ch[ah+3*l1*ido]), &RE(ch[ah+3*l1*ido]),
+ IM(d4), RE(d4), RE(wa3[i]), IM(wa3[i]));
+ ComplexMult(&IM(ch[ah+4*l1*ido]), &RE(ch[ah+4*l1*ido]),
+ IM(d5), RE(d5), RE(wa4[i]), IM(wa4[i]));
+#endif
}
}
}
@@ -843,8 +993,12 @@ static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc,
----------------------------------------------------------------------*/
#ifdef USE_SSE
-INLINE void cfftf1pos_sse(uint16_t n, complex_t *c, complex_t *ch,
- const uint16_t *ifac, const complex_t *wa, const int8_t isign)
+
+#define CONV(A,B,C) ( (A<<2) | ((B & 0x1)<<1) | ((C==1)&0x1) )
+
+static INLINE void cfftf1pos_sse(uint16_t n, complex_t *c, complex_t *ch,
+ const uint16_t *ifac, const complex_t *wa,
+ const int8_t isign)
{
uint16_t i;
uint16_t k1, l1, l2;
@@ -862,51 +1016,62 @@ INLINE void cfftf1pos_sse(uint16_t n, complex_t *c, complex_t *ch,
ido = n / l2;
idl1 = ido*l1;
- switch (ip)
- {
- case 4:
- ix2 = iw + ido;
- ix3 = ix2 + ido;
-
- if (na == 0)
- passf4pos_sse((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3]);
- else
- passf4pos_sse((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3]);
+ ix2 = iw + ido;
+ ix3 = ix2 + ido;
+ ix4 = ix3 + ido;
- na = 1 - na;
+ switch (CONV(ip,na,ido))
+ {
+ case CONV(4,0,0):
+ //passf4pos_sse_ido((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3]);
+ passf4pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3]);
break;
- case 2:
- if (na == 0)
- passf2pos_sse((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw]);
- else
- passf2pos_sse((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw]);
-
- na = 1 - na;
+ case CONV(4,0,1):
+ passf4pos_sse((const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3]);
break;
- case 3:
- ix2 = iw + ido;
-
- if (na == 0)
- passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], isign);
- else
- passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], isign);
-
- na = 1 - na;
+ case CONV(4,1,0):
+ passf4pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3]);
+ //passf4pos_sse_ido((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3]);
break;
- case 5:
- ix2 = iw + ido;
- ix3 = ix2 + ido;
- ix4 = ix3 + ido;
-
- if (na == 0)
- passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
- else
- passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
-
- na = 1 - na;
+ case CONV(4,1,1):
+ passf4pos_sse((const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3]);
+ break;
+ case CONV(2,0,0):
+ passf2pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw]);
+ //passf2pos_sse_ido((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw]);
+ break;
+ case CONV(2,0,1):
+ passf2pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw]);
+ //passf2pos_sse((const uint16_t)l1, (const complex_t*)c, ch, &wa[iw]);
+ break;
+ case CONV(2,1,0):
+ passf2pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw]);
+ //passf2pos_sse_ido((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw]);
+ break;
+ case CONV(2,1,1):
+ passf2pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw]);
+ //passf2pos_sse((const uint16_t)l1, (const complex_t*)ch, c, &wa[iw]);
+ break;
+ case CONV(3,0,0):
+ case CONV(3,0,1):
+ passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], isign);
+ break;
+ case CONV(3,1,0):
+ case CONV(3,1,1):
+ passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], isign);
+ break;
+ case CONV(5,0,0):
+ case CONV(5,0,1):
+ passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
+ break;
+ case CONV(5,1,0):
+ case CONV(5,1,1):
+ passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
break;
}
+ na = 1 - na;
+
l1 = l2;
iw += (ip-1) * ido;
}
@@ -922,8 +1087,9 @@ INLINE void cfftf1pos_sse(uint16_t n, complex_t *c, complex_t *ch,
}
#endif
-INLINE void cfftf1pos(uint16_t n, complex_t *c, complex_t *ch,
- const uint16_t *ifac, const complex_t *wa, const int8_t isign)
+static INLINE void cfftf1pos(uint16_t n, complex_t *c, complex_t *ch,
+ const uint16_t *ifac, const complex_t *wa,
+ const int8_t isign)
{
uint16_t i;
uint16_t k1, l1, l2;
@@ -1000,8 +1166,9 @@ INLINE void cfftf1pos(uint16_t n, complex_t *c, complex_t *ch,
}
}
-INLINE void cfftf1neg(uint16_t n, complex_t *c, complex_t *ch,
- const uint16_t *ifac, const complex_t *wa, const int8_t isign)
+static INLINE void cfftf1neg(uint16_t n, complex_t *c, complex_t *ch,
+ const uint16_t *ifac, const complex_t *wa,
+ const int8_t isign)
{
uint16_t i;
uint16_t k1, l1, l2;
@@ -1104,7 +1271,7 @@ static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac)
uint16_t i1, k1, l1, l2;
uint16_t ld, ii, ip;
#endif
- uint16_t ntry, i, j;
+ uint16_t ntry = 0, i, j;
uint16_t ib;
uint16_t nf, nl, nq, nr;
@@ -1174,7 +1341,11 @@ startloop:
fi++;
arg = fi * argld;
RE(wa[i]) = (real_t)cos(arg);
+#if 1
IM(wa[i]) = (real_t)sin(arg);
+#else
+ IM(wa[i]) = (real_t)-sin(arg);
+#endif
}
if (ip > 5)
diff --git a/src/libfaad/cfft.h b/src/libfaad/cfft.h
index 74c42a91a..7c5b0fb8e 100644
--- a/src/libfaad/cfft.h
+++ b/src/libfaad/cfft.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: cfft.h,v 1.5 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: cfft.h,v 1.6 2004/01/11 15:44:04 mroi Exp $
**/
#ifndef __CFFT_H__
@@ -46,30 +46,9 @@ void cfftb(cfft_info *cfft, complex_t *c);
cfft_info *cffti(uint16_t n);
void cfftu(cfft_info *cfft);
-
#ifdef USE_SSE
void cfftb_sse(cfft_info *cfft, complex_t *c);
-static void passf2pos_sse(const uint16_t ido, const uint16_t l1, const complex_t *cc,
- complex_t *ch, const complex_t *wa);
-static void passf4pos_sse(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch,
- const complex_t *wa1, const complex_t *wa2, const complex_t *wa3);
#endif
-static void passf2pos(const uint16_t ido, const uint16_t l1, const complex_t *cc,
- complex_t *ch, const complex_t *wa);
-static void passf2neg(const uint16_t ido, const uint16_t l1, const complex_t *cc,
- complex_t *ch, const complex_t *wa);
-static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc,
- complex_t *ch, const complex_t *wa1, const complex_t *wa2, const int8_t isign);
-static void passf4pos(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch,
- const complex_t *wa1, const complex_t *wa2, const complex_t *wa3);
-static void passf4neg(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch,
- const complex_t *wa1, const complex_t *wa2, const complex_t *wa3);
-static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch,
- const complex_t *wa1, const complex_t *wa2, const complex_t *wa3,
- const complex_t *wa4, const int8_t isign);
-INLINE void cfftf1(uint16_t n, complex_t *c, complex_t *ch,
- const uint16_t *ifac, const complex_t *wa, const int8_t isign);
-static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac);
#ifdef __cplusplus
diff --git a/src/libfaad/cfft_tab.h b/src/libfaad/cfft_tab.h
index dabc0dcc3..5492040e1 100644
--- a/src/libfaad/cfft_tab.h
+++ b/src/libfaad/cfft_tab.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: cfft_tab.h,v 1.2 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: cfft_tab.h,v 1.3 2004/01/11 15:44:04 mroi Exp $
**/
#ifndef __CFFT_TAB_H__
diff --git a/src/libfaad/common.c b/src/libfaad/common.c
index 3df232482..a5135a05f 100644
--- a/src/libfaad/common.c
+++ b/src/libfaad/common.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: common.c,v 1.4 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: common.c,v 1.5 2004/01/11 15:44:04 mroi Exp $
**/
/* just some common functions that could be used anywhere */
@@ -34,7 +34,7 @@
#include "syntax.h"
#ifdef USE_SSE
-__declspec(naked) static int32_t __fastcall test_cpuid()
+__declspec(naked) static int32_t __fastcall test_cpuid(void)
{
__asm
{
@@ -233,7 +233,7 @@ int8_t can_decode_ot(const uint8_t object_type)
/* common malloc function */
void *faad_malloc(int32_t size)
{
-#ifdef _WIN32
+#if 0 // defined(_WIN32) && !defined(_WIN32_WCE)
return _aligned_malloc(size, 16);
#else
return malloc(size);
@@ -243,7 +243,7 @@ void *faad_malloc(int32_t size)
/* common free function */
void faad_free(void *b)
{
-#ifdef _WIN32
+#if 0 // defined(_WIN32) && !defined(_WIN32_WCE)
_aligned_free(b);
#else
free(b);
@@ -293,7 +293,6 @@ static uint32_t __r2 = 1;
*/
uint32_t random_int(void)
{
- static const uint32_t rnd_seed = 16428320;
uint32_t t1, t2, t3, t4;
t3 = t1 = __r1; t4 = t2 = __r2; // Parity calculation is done via table lookup, this is also available
diff --git a/src/libfaad/common.h b/src/libfaad/common.h
index aa40ebe0a..577f54368 100644
--- a/src/libfaad/common.h
+++ b/src/libfaad/common.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: common.h,v 1.9 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: common.h,v 1.10 2004/01/11 15:44:04 mroi Exp $
**/
#ifndef __COMMON_H__
@@ -33,7 +33,7 @@ extern "C" {
#endif
#define INLINE __inline
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(_WIN32_WCE)
#define ALIGN __declspec(align(16))
#else
#define ALIGN
@@ -120,7 +120,7 @@ extern "C" {
#if ((defined(_WIN32) && !defined(_WIN32_WCE)) /* || ((__GNUC__ >= 3) && defined(__i386__)) */ )
#ifndef FIXED_POINT
/* includes <xmmintrin.h> to enable SSE intrinsics */
-#define USE_SSE
+//#define USE_SSE
#endif
#endif
@@ -289,6 +289,7 @@ char *strchr(), *strrchr();
*y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
}
+
#ifndef HAVE_LRINTF
#ifdef _WIN32
#define HAS_LRINTF
@@ -318,6 +319,7 @@ char *strchr(), *strrchr();
#endif
#endif
+
#ifdef __ICL /* only Intel C compiler has fmath ??? */
#include <mathf.h>
@@ -379,7 +381,7 @@ typedef real_t complex_t[2];
/* common functions */
-uint8_t cpu_has_sse();
+uint8_t cpu_has_sse(void);
uint32_t random_int(void);
uint8_t get_sr_index(const uint32_t samplerate);
uint8_t max_pred_sfb(const uint8_t sr_index);
diff --git a/src/libfaad/decoder.c b/src/libfaad/decoder.c
index 8c824ff3d..09358adf4 100644
--- a/src/libfaad/decoder.c
+++ b/src/libfaad/decoder.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: decoder.c,v 1.6 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: decoder.c,v 1.7 2004/01/11 15:44:04 mroi Exp $
**/
#include "common.h"
@@ -54,7 +54,7 @@ int8_t* FAADAPI faacDecGetErrorMessage(uint8_t errcode)
return err_msg[errcode];
}
-uint32_t FAADAPI faacDecGetCapabilities()
+uint32_t FAADAPI faacDecGetCapabilities(void)
{
uint32_t cap = 0;
@@ -80,7 +80,7 @@ uint32_t FAADAPI faacDecGetCapabilities()
return cap;
}
-faacDecHandle FAADAPI faacDecOpen()
+faacDecHandle FAADAPI faacDecOpen(void)
{
uint8_t i;
faacDecHandle hDecoder = NULL;
@@ -256,7 +256,7 @@ int32_t FAADAPI faacDecInit(faacDecHandle hDecoder, uint8_t *buffer,
#ifdef SBR_DEC
/* implicit signalling */
- if (*samplerate <= 24000)
+ if (*samplerate <= 24000 && !(hDecoder->config.dontUpSampleImplicitSBR))
{
*samplerate *= 2;
hDecoder->forceUpSampling = 1;
@@ -324,7 +324,10 @@ int8_t FAADAPI faacDecInit2(faacDecHandle hDecoder, uint8_t *pBuffer,
#endif
#ifdef SBR_DEC
hDecoder->sbr_present_flag = mp4ASC.sbr_present_flag;
- hDecoder->forceUpSampling = mp4ASC.forceUpSampling;
+ if (hDecoder->config.dontUpSampleImplicitSBR == 0)
+ hDecoder->forceUpSampling = mp4ASC.forceUpSampling;
+ else
+ hDecoder->forceUpSampling = 0;
/* AAC core decoder samplerate is 2 times as low */
if (hDecoder->sbr_present_flag == 1 || hDecoder->forceUpSampling == 1)
diff --git a/src/libfaad/decoder.h b/src/libfaad/decoder.h
index 9973d69cb..0196777ac 100644
--- a/src/libfaad/decoder.h
+++ b/src/libfaad/decoder.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: decoder.h,v 1.5 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: decoder.h,v 1.6 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __DECODER_H__
@@ -78,9 +78,9 @@ extern "C" {
int8_t* FAADAPI faacDecGetErrorMessage(uint8_t errcode);
-uint32_t FAADAPI faacDecGetCapabilities();
+uint32_t FAADAPI faacDecGetCapabilities(void);
-faacDecHandle FAADAPI faacDecOpen();
+faacDecHandle FAADAPI faacDecOpen(void);
faacDecConfigurationPtr FAADAPI faacDecGetCurrentConfiguration(faacDecHandle hDecoder);
diff --git a/src/libfaad/diff_to_faad2_cvs.patch b/src/libfaad/diff_to_faad2_cvs.patch
new file mode 100644
index 000000000..86dc8aa69
--- /dev/null
+++ b/src/libfaad/diff_to_faad2_cvs.patch
@@ -0,0 +1,18 @@
+--- common.h.old 2004-01-10 22:45:44.000000000 +0100
++++ common.h 2004-01-10 22:46:20.000000000 +0100
+@@ -290,6 +290,7 @@
+ }
+
+
++#ifndef HAVE_LRINTF
+ #ifdef _WIN32
+ #define HAS_LRINTF
+ static INLINE int lrintf(float f)
+@@ -316,6 +317,7 @@
+ return i;
+ }
+ #endif
++#endif
+
+
+ #ifdef __ICL /* only Intel C compiler has fmath ??? */
diff --git a/src/libfaad/drc.c b/src/libfaad/drc.c
index 9482d984f..b8089ca18 100644
--- a/src/libfaad/drc.c
+++ b/src/libfaad/drc.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: drc.c,v 1.3 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: drc.c,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#include "common.h"
diff --git a/src/libfaad/drc.h b/src/libfaad/drc.h
index 137566c54..b9f666f78 100644
--- a/src/libfaad/drc.h
+++ b/src/libfaad/drc.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: drc.h,v 1.3 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: drc.h,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __DRC_H__
diff --git a/src/libfaad/error.c b/src/libfaad/error.c
index 84943f100..43af74fe7 100644
--- a/src/libfaad/error.c
+++ b/src/libfaad/error.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,13 +22,13 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: error.c,v 1.4 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: error.c,v 1.5 2004/01/11 15:44:05 mroi Exp $
**/
#include "common.h"
#include "error.h"
-extern int8_t *err_msg[] = {
+int8_t *err_msg[] = {
"No error",
"Gain control not yet implemented",
"Pulse coding not allowed in short blocks",
@@ -48,4 +48,5 @@ extern int8_t *err_msg[] = {
"Maximum number of scalefactor bands exceeded",
"Quantised value out of range",
"LTP lag out of range"
-}; \ No newline at end of file
+};
+
diff --git a/src/libfaad/error.h b/src/libfaad/error.h
index fb6780361..d25fb1026 100644
--- a/src/libfaad/error.h
+++ b/src/libfaad/error.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: error.h,v 1.3 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: error.h,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __ERROR_H__
diff --git a/src/libfaad/filtbank.c b/src/libfaad/filtbank.c
index 28187172f..1ec45ac77 100644
--- a/src/libfaad/filtbank.c
+++ b/src/libfaad/filtbank.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: filtbank.c,v 1.6 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: filtbank.c,v 1.7 2004/01/11 15:44:05 mroi Exp $
**/
#include "common.h"
@@ -120,7 +120,7 @@ void filter_bank_end(fb_info *fb)
static INLINE void imdct_long(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len)
{
#ifdef LD_DEC
- mdct_info *mdct;
+ mdct_info *mdct = NULL;
switch (len)
{
@@ -144,7 +144,7 @@ static INLINE void imdct_long(fb_info *fb, real_t *in_data, real_t *out_data, ui
static INLINE void imdct_long_sse(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len)
{
#ifdef LD_DEC
- mdct_info *mdct;
+ mdct_info *mdct = NULL;
switch (len)
{
@@ -168,7 +168,7 @@ static INLINE void imdct_long_sse(fb_info *fb, real_t *in_data, real_t *out_data
#ifdef LTP_DEC
static INLINE void mdct(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len)
{
- mdct_info *mdct;
+ mdct_info *mdct = NULL;
switch (len)
{
@@ -199,10 +199,10 @@ void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
int16_t i;
ALIGN real_t transf_buf[2*1024] = {0};
- const real_t *window_long;
- const real_t *window_long_prev;
- const real_t *window_short;
- const real_t *window_short_prev;
+ const real_t *window_long = NULL;
+ const real_t *window_long_prev = NULL;
+ const real_t *window_short = NULL;
+ const real_t *window_short_prev = NULL;
uint16_t nlong = frame_len;
uint16_t nshort = frame_len/8;
@@ -323,10 +323,10 @@ void ifilter_bank_sse(fb_info *fb, uint8_t window_sequence, uint8_t window_shape
int16_t i;
ALIGN real_t transf_buf[2*1024] = {0};
- const real_t *window_long;
- const real_t *window_long_prev;
- const real_t *window_short;
- const real_t *window_short_prev;
+ const real_t *window_long = NULL;
+ const real_t *window_long_prev = NULL;
+ const real_t *window_short = NULL;
+ const real_t *window_short_prev = NULL;
uint16_t nlong = frame_len;
uint16_t nshort = frame_len/8;
@@ -359,26 +359,22 @@ void ifilter_bank_sse(fb_info *fb, uint8_t window_sequence, uint8_t window_shape
imdct_long_sse(fb, freq_in, transf_buf, 2*nlong);
for (i = 0; i < nlong; i+=4)
{
- __m128 m1 = _mm_load_ps(&transf_buf[i]);
- __m128 m2 = _mm_load_ps(&window_long_prev[i]);
- __m128 m3 = _mm_load_ps(&time_out[nlong+i]);
+ __m128 m1, m2, m3, m4, m5, m6, m7, m8;
- __m128 m4 = _mm_mul_ps(m1, m2);
- m4 = _mm_add_ps(m4, m3);
+ m1 = _mm_load_ps(&transf_buf[i]);
+ m2 = _mm_load_ps(&window_long_prev[i]);
+ m6 = _mm_load_ps(&window_long[nlong-4-i]);
+ m3 = _mm_load_ps(&time_out[nlong+i]);
+ m5 = _mm_load_ps(&transf_buf[nlong+i]);
- _mm_store_ps(&time_out[i], m4);
- }
- for (i = 0; i < nlong; i+=4)
- {
- __m128 m1 = _mm_load_ps(&transf_buf[nlong+i]);
- __m128 m2 = _mm_load_ps(&window_long[nlong-4-i]);
- __m128 m3, m4;
-
- m3 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 1, 2, 3));
+ m4 = _mm_mul_ps(m1, m2);
+ m7 = _mm_shuffle_ps(m6, m6, _MM_SHUFFLE(0, 1, 2, 3));
- m4 = _mm_mul_ps(m1, m3);
+ m4 = _mm_add_ps(m4, m3);
+ m8 = _mm_mul_ps(m5, m7);
- _mm_store_ps(&time_out[nlong+i], m4);
+ _mm_store_ps(&time_out[i], m4);
+ _mm_store_ps(&time_out[nlong+i], m8);
}
break;
@@ -420,14 +416,14 @@ void ifilter_bank_sse(fb_info *fb, uint8_t window_sequence, uint8_t window_shape
break;
case EIGHT_SHORT_SEQUENCE:
- faad_imdct_sse(fb->mdct256, freq_in+0*nshort, transf_buf+2*nshort*0);
- faad_imdct_sse(fb->mdct256, freq_in+1*nshort, transf_buf+2*nshort*1);
- faad_imdct_sse(fb->mdct256, freq_in+2*nshort, transf_buf+2*nshort*2);
- faad_imdct_sse(fb->mdct256, freq_in+3*nshort, transf_buf+2*nshort*3);
- faad_imdct_sse(fb->mdct256, freq_in+4*nshort, transf_buf+2*nshort*4);
- faad_imdct_sse(fb->mdct256, freq_in+5*nshort, transf_buf+2*nshort*5);
- faad_imdct_sse(fb->mdct256, freq_in+6*nshort, transf_buf+2*nshort*6);
- faad_imdct_sse(fb->mdct256, freq_in+7*nshort, transf_buf+2*nshort*7);
+ faad_imdct_sse(fb->mdct256, &freq_in[0*nshort], &transf_buf[2*nshort*0]);
+ faad_imdct_sse(fb->mdct256, &freq_in[1*nshort], &transf_buf[2*nshort*1]);
+ faad_imdct_sse(fb->mdct256, &freq_in[2*nshort], &transf_buf[2*nshort*2]);
+ faad_imdct_sse(fb->mdct256, &freq_in[3*nshort], &transf_buf[2*nshort*3]);
+ faad_imdct_sse(fb->mdct256, &freq_in[4*nshort], &transf_buf[2*nshort*4]);
+ faad_imdct_sse(fb->mdct256, &freq_in[5*nshort], &transf_buf[2*nshort*5]);
+ faad_imdct_sse(fb->mdct256, &freq_in[6*nshort], &transf_buf[2*nshort*6]);
+ faad_imdct_sse(fb->mdct256, &freq_in[7*nshort], &transf_buf[2*nshort*7]);
for (i = 0; i < nflat_ls; i+=4)
{
__m128 m1 = _mm_load_ps(&time_out[nlong+i]);
@@ -657,10 +653,10 @@ void filter_bank_ltp(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
int16_t i;
ALIGN real_t windowed_buf[2*1024] = {0};
- const real_t *window_long;
- const real_t *window_long_prev;
- const real_t *window_short;
- const real_t *window_short_prev;
+ const real_t *window_long = NULL;
+ const real_t *window_long_prev = NULL;
+ const real_t *window_short = NULL;
+ const real_t *window_short_prev = NULL;
uint16_t nlong = frame_len;
uint16_t nshort = frame_len/8;
diff --git a/src/libfaad/filtbank.h b/src/libfaad/filtbank.h
index 60e25e840..9688d90ed 100644
--- a/src/libfaad/filtbank.h
+++ b/src/libfaad/filtbank.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: filtbank.h,v 1.3 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: filtbank.h,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __FILTBANK_H__
diff --git a/src/libfaad/fixed.h b/src/libfaad/fixed.h
index 65897d166..8a5ac238a 100644
--- a/src/libfaad/fixed.h
+++ b/src/libfaad/fixed.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: fixed.h,v 1.3 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: fixed.h,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __FIXED_H__
diff --git a/src/libfaad/hcr.c b/src/libfaad/hcr.c
index 4b59e205b..010958fee 100644
--- a/src/libfaad/hcr.c
+++ b/src/libfaad/hcr.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2002 A. Kurpiers
+** Copyright (C) 2002-2004 A. Kurpiers
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: hcr.c,v 1.3 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: hcr.c,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#include "common.h"
@@ -153,7 +153,6 @@ uint8_t reordered_spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile
bits_t Segment[ 512 ];
uint8_t PCW_decoded=0;
- uint16_t segment_index=0, codeword_index=0;
uint16_t nshort = hDecoder->frameLength/8;
diff --git a/src/libfaad/huffman.c b/src/libfaad/huffman.c
index 5ec920976..9986e1472 100644
--- a/src/libfaad/huffman.c
+++ b/src/libfaad/huffman.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: huffman.c,v 1.1 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: huffman.c,v 1.2 2004/01/11 15:44:05 mroi Exp $
**/
#include "common.h"
@@ -38,6 +38,20 @@
#include "codebook/hcb.h"
+/* static function declarations */
+static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len);
+static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp);
+static uint8_t huffman_2step_quad(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp);
+static int16_t huffman_codebook(uint8_t i);
+
+
int8_t huffman_scale_factor(bitfile *ld)
{
uint16_t offset = 0;
@@ -104,10 +118,20 @@ static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len)
}
}
+#ifdef _WIN32
+static INLINE uint32_t bsr(uint32_t bits)
+{
+ __asm
+ {
+ bsr eax, dword ptr [bits]
+ }
+}
+#endif
+
static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp)
{
uint8_t neg, i;
- int16_t j;
+ int32_t j;
int32_t off;
if (sp < 0)
@@ -116,11 +140,12 @@ static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp)
return sp;
neg = 1;
} else {
- if(sp != 16)
+ if (sp != 16)
return sp;
neg = 0;
}
+#ifndef _WIN32
for (i = 4; ; i++)
{
if (faad_get1bit(ld
@@ -129,11 +154,22 @@ static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp)
break;
}
}
+#else
+ /* maximum quantised value is 8192,
+ * so the maximum number of bits for 1 value is log[2](8192)=13
+ * minimum bits used when escape is present is 4 bits
+ * this leaves a maximum of 9 bits to be read at this point
+ */
+ j = faad_showbits(ld, 9) | 0xFFFFFE00;
+ i = 12 - bsr(~j);
+ faad_getbits(ld, i-3
+ DEBUGVAR(1,6,"huffman_getescape(): escape size"));
+#endif
off = faad_getbits(ld, i
DEBUGVAR(1,9,"huffman_getescape(): escape"));
- j = off + (1<<i);
+ j = off | (1<<i);
if (neg)
j = -j;
@@ -216,7 +252,7 @@ static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp)
return 0;
}
-static huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp)
+static uint8_t huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp)
{
uint8_t err = huffman_2step_pair(cb, ld, sp);
huffman_sign_bits(ld, sp, PAIR_LEN);
@@ -357,7 +393,6 @@ int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp)
uint16_t offset = 0;
uint8_t extra_bits;
uint8_t i;
- uint8_t save_cb = cb;
switch (cb)
diff --git a/src/libfaad/huffman.h b/src/libfaad/huffman.h
index 35b8b72f2..8a51fb8f6 100644
--- a/src/libfaad/huffman.h
+++ b/src/libfaad/huffman.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: huffman.h,v 1.3 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: huffman.h,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __HUFFMAN_H__
@@ -32,19 +32,6 @@
extern "C" {
#endif
-
-static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len);
-static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp);
-static uint8_t huffman_2step_quad(uint8_t cb, bitfile *ld, int16_t *sp);
-static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp);
-static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp);
-static huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp);
-static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp);
-static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp);
-static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp);
-static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp);
-static int16_t huffman_codebook(uint8_t i);
-
int8_t huffman_scale_factor(bitfile *ld);
uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp);
#ifdef ERROR_RESILIENCE
diff --git a/src/libfaad/ic_predict.c b/src/libfaad/ic_predict.c
index 31ae5d668..446183a26 100644
--- a/src/libfaad/ic_predict.c
+++ b/src/libfaad/ic_predict.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: ic_predict.c,v 1.3 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: ic_predict.c,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#include "common.h"
diff --git a/src/libfaad/ic_predict.h b/src/libfaad/ic_predict.h
index 9d7a9d8e2..fc99b5879 100644
--- a/src/libfaad/ic_predict.h
+++ b/src/libfaad/ic_predict.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: ic_predict.h,v 1.3 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: ic_predict.h,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#ifdef MAIN_DEC
diff --git a/src/libfaad/iq_table.h b/src/libfaad/iq_table.h
index 33b2dd75a..b3ae6bb2b 100644
--- a/src/libfaad/iq_table.h
+++ b/src/libfaad/iq_table.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: iq_table.h,v 1.2 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: iq_table.h,v 1.3 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef IQ_TABLE_H__
diff --git a/src/libfaad/is.c b/src/libfaad/is.c
index 3437d712a..f410ef107 100644
--- a/src/libfaad/is.c
+++ b/src/libfaad/is.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: is.c,v 1.3 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: is.c,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#include "common.h"
@@ -47,7 +47,7 @@ void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
uint16_t frame_len)
{
uint8_t g, sfb, b;
- uint16_t i, k;
+ uint16_t i;
#ifndef FIXED_POINT
real_t scale;
#else
@@ -84,18 +84,17 @@ void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
do not touch left channel */
for (i = icsr->swb_offset[sfb]; i < icsr->swb_offset[sfb+1]; i++)
{
- k = (group*nshort)+i;
#ifndef FIXED_POINT
- r_spec[k] = MUL_R(l_spec[k], scale);
+ r_spec[(group*nshort)+i] = MUL_R(l_spec[(group*nshort)+i], scale);
#else
if (exp < 0)
- r_spec[k] = l_spec[k] << -exp;
+ r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] << -exp;
else
- r_spec[k] = l_spec[k] >> exp;
- r_spec[k] = MUL_C(r_spec[k], pow05_table[frac + 3]);
+ r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] >> exp;
+ r_spec[(group*nshort)+i] = MUL_C(r_spec[(group*nshort)+i], pow05_table[frac + 3]);
#endif
if (is_intensity(icsr, g, sfb) != invert_intensity(ics, g, sfb))
- r_spec[k] = -r_spec[k];
+ r_spec[(group*nshort)+i] = -r_spec[(group*nshort)+i];
}
}
}
diff --git a/src/libfaad/is.h b/src/libfaad/is.h
index dfa963013..3548a1090 100644
--- a/src/libfaad/is.h
+++ b/src/libfaad/is.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: is.h,v 1.3 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: is.h,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __IS_H__
diff --git a/src/libfaad/kbd_win.h b/src/libfaad/kbd_win.h
index c3a148522..957b8ba1b 100644
--- a/src/libfaad/kbd_win.h
+++ b/src/libfaad/kbd_win.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: kbd_win.h,v 1.3 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: kbd_win.h,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __KBD_WIN_H__
diff --git a/src/libfaad/lt_predict.c b/src/libfaad/lt_predict.c
index c81a62def..388d841c3 100644
--- a/src/libfaad/lt_predict.c
+++ b/src/libfaad/lt_predict.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: lt_predict.c,v 1.3 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: lt_predict.c,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
@@ -37,6 +37,11 @@
#include "filtbank.h"
#include "tns.h"
+
+/* static function declarations */
+static int16_t real_to_int16(real_t sig_in);
+
+
/* check if the object type is an object type that can have LTP */
uint8_t is_ltp_ot(uint8_t object_type)
{
@@ -128,7 +133,7 @@ void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec,
}
#ifdef FIXED_POINT
-INLINE int16_t real_to_int16(real_t sig_in)
+static INLINE int16_t real_to_int16(real_t sig_in)
{
if (sig_in >= 0)
{
@@ -144,7 +149,7 @@ INLINE int16_t real_to_int16(real_t sig_in)
return (sig_in >> REAL_BITS);
}
#else
-INLINE int16_t real_to_int16(real_t sig_in)
+static INLINE int16_t real_to_int16(real_t sig_in)
{
if (sig_in >= 0)
{
diff --git a/src/libfaad/lt_predict.h b/src/libfaad/lt_predict.h
index 7900605e8..963ab1a8e 100644
--- a/src/libfaad/lt_predict.h
+++ b/src/libfaad/lt_predict.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: lt_predict.h,v 1.3 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: lt_predict.h,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#ifdef LTP_DEC
@@ -55,9 +55,6 @@ void lt_update_state(int16_t *lt_pred_stat,
uint16_t frame_len,
uint8_t object_type);
-
-static int16_t real_to_int16(real_t sig_in);
-
#ifdef __cplusplus
}
#endif
diff --git a/src/libfaad/mdct.c b/src/libfaad/mdct.c
index 6c4d3edd7..afa27b990 100644
--- a/src/libfaad/mdct.c
+++ b/src/libfaad/mdct.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: mdct.c,v 1.7 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: mdct.c,v 1.8 2004/01/11 15:44:05 mroi Exp $
**/
/*
@@ -119,7 +119,8 @@ real_t const_tab[][5] =
};
#endif
-uint8_t map_N_to_idx(uint16_t N)
+#ifdef FIXED_POINT
+static uint8_t map_N_to_idx(uint16_t N)
{
/* gives an index into const_tab above */
/* for normal AAC deocding (eg. no scalable profile) only */
@@ -139,6 +140,7 @@ uint8_t map_N_to_idx(uint16_t N)
}
return 0;
}
+#endif
mdct_info *faad_mdct_init(uint16_t N)
{
diff --git a/src/libfaad/mdct.h b/src/libfaad/mdct.h
index 4aa2cdd25..435269137 100644
--- a/src/libfaad/mdct.h
+++ b/src/libfaad/mdct.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: mdct.h,v 1.4 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: mdct.h,v 1.5 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __MDCT_H__
diff --git a/src/libfaad/mp4.c b/src/libfaad/mp4.c
index b09495fb3..e931e965e 100644
--- a/src/libfaad/mp4.c
+++ b/src/libfaad/mp4.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: mp4.c,v 1.5 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: mp4.c,v 1.6 2004/01/11 15:44:05 mroi Exp $
**/
#include "common.h"
diff --git a/src/libfaad/mp4.h b/src/libfaad/mp4.h
index 7ec94d81e..dfbfcd8c6 100644
--- a/src/libfaad/mp4.h
+++ b/src/libfaad/mp4.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: mp4.h,v 1.4 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: mp4.h,v 1.5 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __MP4_H__
diff --git a/src/libfaad/ms.c b/src/libfaad/ms.c
index 22d4de134..f53340167 100644
--- a/src/libfaad/ms.c
+++ b/src/libfaad/ms.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: ms.c,v 1.3 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: ms.c,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#include "common.h"
@@ -49,7 +49,7 @@ void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
{
for (b = 0; b < ics->window_group_length[g]; b++)
{
- for(sfb = 0; sfb < ics->max_sfb; sfb++)
+ for (sfb = 0; sfb < ics->max_sfb; sfb++)
{
/* If intensity stereo coding or noise substitution is on
for a particular scalefactor band, no M/S stereo decoding
diff --git a/src/libfaad/ms.h b/src/libfaad/ms.h
index 5ece4efaf..e728f0436 100644
--- a/src/libfaad/ms.h
+++ b/src/libfaad/ms.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: ms.h,v 1.3 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: ms.h,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __MS_H__
diff --git a/src/libfaad/output.h b/src/libfaad/output.h
index 967ba5ade..953dbe638 100644
--- a/src/libfaad/output.h
+++ b/src/libfaad/output.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: output.h,v 1.3 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: output.h,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __OUTPUT_H__
@@ -39,9 +39,6 @@ void* output_to_PCM(faacDecHandle hDecoder,
uint16_t frame_len,
uint8_t format);
-static int64_t dither_output(uint8_t dithering, uint8_t shapingtype,
- uint16_t i, double Sum, uint8_t k);
-
#ifdef __cplusplus
}
#endif
diff --git a/src/libfaad/pns.c b/src/libfaad/pns.c
index 911b9cdb0..1802e439f 100644
--- a/src/libfaad/pns.c
+++ b/src/libfaad/pns.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: pns.c,v 1.4 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: pns.c,v 1.5 2004/01/11 15:44:05 mroi Exp $
**/
#include "common.h"
@@ -31,6 +31,11 @@
#include "pns.h"
+/* static function declarations */
+static void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size,
+ uint8_t sub);
+
+
#ifdef FIXED_POINT
#define DIV(A, B) (((int64_t)A << REAL_BITS)/B)
diff --git a/src/libfaad/pns.h b/src/libfaad/pns.h
index 32a757ea7..23557587b 100644
--- a/src/libfaad/pns.h
+++ b/src/libfaad/pns.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: pns.h,v 1.3 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: pns.h,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __PNS_H__
@@ -42,10 +42,6 @@ void pns_decode(ic_stream *ics_left, ic_stream *ics_right,
real_t *spec_left, real_t *spec_right, uint16_t frame_len,
uint8_t channel_pair, uint8_t object_type);
-static INLINE int32_t random2();
-static void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size,
- uint8_t sub);
-
static INLINE uint8_t is_noise(ic_stream *ics, uint8_t group, uint8_t sfb)
{
if (ics->sfb_cb[group][sfb] == NOISE_HCB)
diff --git a/src/libfaad/pulse.c b/src/libfaad/pulse.c
index 3c33708eb..c11ee802d 100644
--- a/src/libfaad/pulse.c
+++ b/src/libfaad/pulse.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: pulse.c,v 1.4 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: pulse.c,v 1.5 2004/01/11 15:44:05 mroi Exp $
**/
#include "common.h"
diff --git a/src/libfaad/pulse.h b/src/libfaad/pulse.h
index 671a0e9b9..d64625101 100644
--- a/src/libfaad/pulse.h
+++ b/src/libfaad/pulse.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: pulse.h,v 1.4 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: pulse.h,v 1.5 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __PULSE_H__
diff --git a/src/libfaad/rvlc.c b/src/libfaad/rvlc.c
index 59034b6df..22aa8b0ca 100644
--- a/src/libfaad/rvlc.c
+++ b/src/libfaad/rvlc.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: rvlc.c,v 1.3 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: rvlc.c,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
/* RVLC scalefactor decoding
@@ -52,6 +52,22 @@
//#define PRINT_RVLC
+/* static function declarations */
+static uint8_t rvlc_decode_sf_forward(ic_stream *ics,
+ bitfile *ld_sf,
+ bitfile *ld_esc,
+ uint8_t *is_used);
+#if 0
+static uint8_t rvlc_decode_sf_reverse(ic_stream *ics,
+ bitfile *ld_sf,
+ bitfile *ld_esc,
+ uint8_t is_used);
+#endif
+static int8_t rvlc_huffman_sf(bitfile *ld_sf, bitfile *ld_esc,
+ int8_t direction);
+static int8_t rvlc_huffman_esc(bitfile *ld_esc, int8_t direction);
+
+
uint8_t rvlc_scale_factor_data(ic_stream *ics, bitfile *ld)
{
uint8_t bits = 9;
@@ -235,6 +251,7 @@ static uint8_t rvlc_decode_sf_forward(ic_stream *ics, bitfile *ld_sf, bitfile *l
return 0;
}
+#if 0 // not used right now, doesn't work correctly yet
static uint8_t rvlc_decode_sf_reverse(ic_stream *ics, bitfile *ld_sf, bitfile *ld_esc,
uint8_t intensity_used)
{
@@ -337,6 +354,7 @@ static uint8_t rvlc_decode_sf_reverse(ic_stream *ics, bitfile *ld_sf, bitfile *l
return 0;
}
+#endif
/* index == 99 means not allowed codeword */
static rvlc_huff_table book_rvlc[] = {
@@ -508,4 +526,5 @@ static int8_t rvlc_huffman_esc(bitfile *ld,
return h->index;
}
-#endif \ No newline at end of file
+#endif
+
diff --git a/src/libfaad/rvlc.h b/src/libfaad/rvlc.h
index 4720dd6c0..65ea6721f 100644
--- a/src/libfaad/rvlc.h
+++ b/src/libfaad/rvlc.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: rvlc.h,v 1.2 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: rvlc.h,v 1.3 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __RVLC_SCF_H__
@@ -46,18 +46,6 @@ typedef struct
uint8_t rvlc_scale_factor_data(ic_stream *ics, bitfile *ld);
uint8_t rvlc_decode_scale_factors(ic_stream *ics, bitfile *ld);
-static uint8_t rvlc_decode_sf_forward(ic_stream *ics,
- bitfile *ld_sf,
- bitfile *ld_esc,
- uint8_t *is_used);
-static uint8_t rvlc_decode_sf_reverse(ic_stream *ics,
- bitfile *ld_sf,
- bitfile *ld_esc,
- uint8_t is_used);
-static int8_t rvlc_huffman_sf(bitfile *ld_sf, bitfile *ld_esc,
- int8_t direction);
-static int8_t rvlc_huffman_esc(bitfile *ld_esc, int8_t direction);
-
#ifdef __cplusplus
}
diff --git a/src/libfaad/sbr_dct.c b/src/libfaad/sbr_dct.c
index 8e1559367..f21f27e40 100644
--- a/src/libfaad/sbr_dct.c
+++ b/src/libfaad/sbr_dct.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_dct.c,v 1.1 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: sbr_dct.c,v 1.2 2004/01/11 15:44:05 mroi Exp $
**/
#include "common.h"
diff --git a/src/libfaad/sbr_dct.h b/src/libfaad/sbr_dct.h
index 5dcd5d5f2..3dace8251 100644
--- a/src/libfaad/sbr_dct.h
+++ b/src/libfaad/sbr_dct.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_dct.h,v 1.1 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: sbr_dct.h,v 1.2 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __SBR_DCT_H__
diff --git a/src/libfaad/sbr_dec.c b/src/libfaad/sbr_dec.c
index 625ff857d..edbc62548 100644
--- a/src/libfaad/sbr_dec.c
+++ b/src/libfaad/sbr_dec.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_dec.c,v 1.3 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: sbr_dec.c,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
@@ -41,6 +41,8 @@
#include "sbr_hfgen.h"
#include "sbr_hfadj.h"
+/* static function declarations */
+static void sbr_save_prev_data(sbr_info *sbr, uint8_t ch);
sbr_info *sbrDecodeInit(uint16_t framelength
#ifdef DRM
@@ -113,7 +115,7 @@ void sbrDecodeEnd(sbr_info *sbr)
}
}
-void sbr_save_prev_data(sbr_info *sbr, uint8_t ch)
+static void sbr_save_prev_data(sbr_info *sbr, uint8_t ch)
{
uint8_t i;
diff --git a/src/libfaad/sbr_dec.h b/src/libfaad/sbr_dec.h
index db3ba0ecd..38734afc3 100644
--- a/src/libfaad/sbr_dec.h
+++ b/src/libfaad/sbr_dec.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_dec.h,v 1.3 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: sbr_dec.h,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __SBR_DEC_H__
diff --git a/src/libfaad/sbr_e_nf.c b/src/libfaad/sbr_e_nf.c
index 730eb258f..ac25abc55 100644
--- a/src/libfaad/sbr_e_nf.c
+++ b/src/libfaad/sbr_e_nf.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_e_nf.c,v 1.1 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: sbr_e_nf.c,v 1.2 2004/01/11 15:44:05 mroi Exp $
**/
#include "common.h"
@@ -53,39 +53,39 @@ ALIGN static const real_t pow2deq[] = {
REAL_CONST(0.0078125), REAL_CONST(0.015625),
REAL_CONST(0.03125), REAL_CONST(0.0625),
REAL_CONST(0.125), REAL_CONST(0.25),
- REAL_CONST(0.5), REAL_CONST(1),
- REAL_CONST(2), REAL_CONST(4),
- REAL_CONST(8), REAL_CONST(16),
- REAL_CONST(32), REAL_CONST(64),
- REAL_CONST(128), REAL_CONST(256),
- REAL_CONST(512), REAL_CONST(1024),
- REAL_CONST(2048), REAL_CONST(4096),
- REAL_CONST(8192), REAL_CONST(16384),
- REAL_CONST(32768), REAL_CONST(65536),
- REAL_CONST(131072), REAL_CONST(262144),
- REAL_CONST(524288), REAL_CONST(1048576),
- REAL_CONST(2097152), REAL_CONST(4194304),
- REAL_CONST(8388608), REAL_CONST(16777216),
- REAL_CONST(33554432), REAL_CONST(67108864),
- REAL_CONST(134217728), REAL_CONST(268435456),
- REAL_CONST(536870912), REAL_CONST(1073741824),
- REAL_CONST(2147483648), REAL_CONST(4294967296),
- REAL_CONST(8589934592), REAL_CONST(17179869184),
- REAL_CONST(34359738368), REAL_CONST(68719476736),
- REAL_CONST(137438953472), REAL_CONST(274877906944),
- REAL_CONST(549755813888), REAL_CONST(1099511627776),
- REAL_CONST(2199023255552), REAL_CONST(4398046511104),
- REAL_CONST(8796093022208), REAL_CONST(17592186044416),
- REAL_CONST(35184372088832), REAL_CONST(70368744177664),
- REAL_CONST(140737488355328), REAL_CONST(281474976710656),
- REAL_CONST(562949953421312), REAL_CONST(1125899906842624),
- REAL_CONST(2251799813685248), REAL_CONST(4503599627370496),
- REAL_CONST(9007199254740992), REAL_CONST(18014398509481984),
- REAL_CONST(36028797018963968), REAL_CONST(72057594037927936),
- REAL_CONST(144115188075855870), REAL_CONST(288230376151711740),
- REAL_CONST(576460752303423490), REAL_CONST(1152921504606847000),
- REAL_CONST(2305843009213694000), REAL_CONST(4611686018427387900),
- REAL_CONST(9223372036854775800), REAL_CONST(1.8446744073709552E+019),
+ REAL_CONST(0.5), REAL_CONST(1.0),
+ REAL_CONST(2.0), REAL_CONST(4.0),
+ REAL_CONST(8.0), REAL_CONST(16.0),
+ REAL_CONST(32.0), REAL_CONST(64.0),
+ REAL_CONST(128.0), REAL_CONST(256.0),
+ REAL_CONST(512.0), REAL_CONST(1024.0),
+ REAL_CONST(2048.0), REAL_CONST(4096.0),
+ REAL_CONST(8192.0), REAL_CONST(16384.0),
+ REAL_CONST(32768.0), REAL_CONST(65536.0),
+ REAL_CONST(131072.0), REAL_CONST(262144.0),
+ REAL_CONST(524288.0), REAL_CONST(1048576.0),
+ REAL_CONST(2097152.0), REAL_CONST(4194304.0),
+ REAL_CONST(8388608.0), REAL_CONST(16777216.0),
+ REAL_CONST(33554432.0), REAL_CONST(67108864.0),
+ REAL_CONST(134217728.0), REAL_CONST(268435456.0),
+ REAL_CONST(536870912.0), REAL_CONST(1073741824.0),
+ REAL_CONST(2147483648.0), REAL_CONST(4294967296.0),
+ REAL_CONST(8589934592.0), REAL_CONST(17179869184.0),
+ REAL_CONST(34359738368.0), REAL_CONST(68719476736.0),
+ REAL_CONST(137438953472.0), REAL_CONST(274877906944.0),
+ REAL_CONST(549755813888.0), REAL_CONST(1099511627776.0),
+ REAL_CONST(2199023255552.0), REAL_CONST(4398046511104.0),
+ REAL_CONST(8796093022208.0), REAL_CONST(17592186044416.0),
+ REAL_CONST(35184372088832.0), REAL_CONST(70368744177664.0),
+ REAL_CONST(140737488355328.0), REAL_CONST(281474976710656.0),
+ REAL_CONST(562949953421312.0), REAL_CONST(1125899906842624.0),
+ REAL_CONST(2251799813685248.0), REAL_CONST(4503599627370496.0),
+ REAL_CONST(9007199254740992.0), REAL_CONST(18014398509481984.0),
+ REAL_CONST(36028797018963968.0), REAL_CONST(72057594037927936.0),
+ REAL_CONST(144115188075855870.0), REAL_CONST(288230376151711740.0),
+ REAL_CONST(576460752303423490.0), REAL_CONST(1152921504606847000.0),
+ REAL_CONST(2305843009213694000.0), REAL_CONST(4611686018427387900.0),
+ REAL_CONST(9223372036854775800.0), REAL_CONST(1.8446744073709552E+019),
REAL_CONST(3.6893488147419103E+019), REAL_CONST(7.3786976294838206E+019),
REAL_CONST(1.4757395258967641E+020), REAL_CONST(2.9514790517935283E+020),
REAL_CONST(5.9029581035870565E+020), REAL_CONST(1.1805916207174113E+021),
@@ -256,11 +256,7 @@ void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch)
/* +6 for the *64 and -10 for the /32 in the synthesis QMF
* since this is a energy value: (x/32)^2 = (x^2)/1024
*/
- exp = (sbr->E[ch][k][l] >> amp) + 6
-#ifdef FIXED_POINT
- - 10
-#endif
- ;
+ exp = (sbr->E[ch][k][l] >> amp) + 6;
if ((exp < -P2_TABLE_OFFSET) || (exp > P2_TABLE_MAX))
{
@@ -287,11 +283,7 @@ void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch)
sbr->Q_orig[ch][k][l] = 0;
} else {
exp = NOISE_FLOOR_OFFSET - sbr->Q[ch][k][l];
-#ifdef FIXED_POINT
- sbr->Q_orig[ch][k][l] = pow2deq_q[exp + P2Q_TABLE_OFFSET];
-#else
sbr->Q_orig[ch][k][l] = pow2deq[exp + P2_TABLE_OFFSET];
-#endif
}
}
}
@@ -311,11 +303,8 @@ void unmap_envelope_noise(sbr_info *sbr)
for (k = 0; k < sbr->n[sbr->f[0][l]]; k++)
{
/* +6: * 64 ; +1: * 2 ; -10: /1024 QMF */
- exp0 = (sbr->E[0][k][l] >> amp0) + 7
-#ifdef FIXED_POINT
- - 10
-#endif
- ;
+ exp0 = (sbr->E[0][k][l] >> amp0) + 7;
+
/* UN_MAP removed: (x / 4096) same as (x >> 12) */
/* E[1] is always even so no need for compensating the divide by 2 with
* an extra multiplication
@@ -334,11 +323,7 @@ void unmap_envelope_noise(sbr_info *sbr)
/* FIXED POINT TODO: E_orig: INTEGER!! */
sbr->E_orig[1][k][l] = MUL_F(tmp, pow2deq_rcp[exp1 + P2_TABLE_RCP_OFFSET]);
-#ifdef FIXED_POINT
sbr->E_orig[0][k][l] = MUL_R(sbr->E_orig[1][k][l], pow2deq[exp1 + P2_TABLE_OFFSET]);
-#else
- sbr->E_orig[0][k][l] = MUL_R(sbr->E_orig[1][k][l], pow2deq[exp1 + P2_TABLE_OFFSET]);
-#endif
}
}
}
@@ -355,13 +340,8 @@ void unmap_envelope_noise(sbr_info *sbr)
exp0 = NOISE_FLOOR_OFFSET - sbr->Q[0][k][l] + 1;
exp1 = sbr->Q[1][k][l] - 12;
-#ifdef FIXED_POINT
- sbr->Q_orig[1][k][l] = MUL_F(pow2deq_q[exp0 + P2Q_TABLE_OFFSET], pow2deq_rcp[exp1 + P2_TABLE_RCP_OFFSET]);
- sbr->Q_orig[0][k][l] = MUL_R(sbr->Q_orig[1][k][l], pow2deq_q[exp1 + P2Q_TABLE_OFFSET]);
-#else
sbr->Q_orig[1][k][l] = MUL_F(pow2deq[exp0 + P2_TABLE_OFFSET], pow2deq_rcp[exp1 + P2_TABLE_RCP_OFFSET]);
sbr->Q_orig[0][k][l] = MUL_R(sbr->Q_orig[1][k][l], pow2deq[exp1 + P2_TABLE_OFFSET]);
-#endif
}
}
}
diff --git a/src/libfaad/sbr_e_nf.h b/src/libfaad/sbr_e_nf.h
index 3e0ce399e..b6b411a23 100644
--- a/src/libfaad/sbr_e_nf.h
+++ b/src/libfaad/sbr_e_nf.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_e_nf.h,v 1.1 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: sbr_e_nf.h,v 1.2 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __SBR_E_NF_H__
diff --git a/src/libfaad/sbr_fbt.c b/src/libfaad/sbr_fbt.c
index 88a2b29f2..b18536b69 100644
--- a/src/libfaad/sbr_fbt.c
+++ b/src/libfaad/sbr_fbt.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_fbt.c,v 1.1 2003/12/30 02:00:10 miguelfreitas Exp $
+** $Id: sbr_fbt.c,v 1.2 2004/01/11 15:44:05 mroi Exp $
**/
/* Calculate frequency band tables */
@@ -37,6 +37,10 @@
#include "sbr_syntax.h"
#include "sbr_fbt.h"
+/* static function declarations */
+static int32_t find_bands(uint8_t warp, uint8_t bands, uint8_t a0, uint8_t a1);
+
+
/* calculate the start QMF channel for the master frequency band table */
/* parameter is also called k0 */
uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode,
diff --git a/src/libfaad/sbr_fbt.h b/src/libfaad/sbr_fbt.h
index 627bf6d42..3da8593f8 100644
--- a/src/libfaad/sbr_fbt.h
+++ b/src/libfaad/sbr_fbt.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_fbt.h,v 1.1 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: sbr_fbt.h,v 1.2 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __SBR_FBT_H__
@@ -32,7 +32,6 @@
extern "C" {
#endif
-static int32_t find_bands(uint8_t warp, uint8_t bands, uint8_t a0, uint8_t a1);
uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode,
uint32_t sample_rate);
uint8_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate,
diff --git a/src/libfaad/sbr_hfadj.c b/src/libfaad/sbr_hfadj.c
index 7dd53f3e0..5e0faab93 100644
--- a/src/libfaad/sbr_hfadj.c
+++ b/src/libfaad/sbr_hfadj.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_hfadj.c,v 1.1 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: sbr_hfadj.c,v 1.2 2004/01/11 15:44:05 mroi Exp $
**/
/* High Frequency adjustment */
@@ -37,13 +37,27 @@
#include "sbr_noise.h"
+
+/* static function delcarations */
+static void map_noise_data(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch);
+static void map_sinusoids(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch);
+static void estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj,
+ qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch);
+static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch);
+#ifdef SBR_LOW_POWER
+static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch);
+static void aliasing_reduction(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch);
+#endif
+static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj, qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch);
+
+
void hf_adjustment(sbr_info *sbr, qmf_t Xsbr[MAX_NTSRHFG][64]
#ifdef SBR_LOW_POWER
,real_t *deg /* aliasing degree */
#endif
,uint8_t ch)
{
- ALIGN sbr_hfadj_info adj = {0};
+ ALIGN sbr_hfadj_info adj = {{{0}}};
map_noise_data(sbr, &adj, ch);
map_sinusoids(sbr, &adj, ch);
@@ -267,6 +281,7 @@ static void estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj,
#define ONE (1)
+
static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
{
static real_t limGain[] = { 0.5, 1.0, 2.0, 1e10 };
diff --git a/src/libfaad/sbr_hfadj.h b/src/libfaad/sbr_hfadj.h
index 762306ac7..90a6f58bf 100644
--- a/src/libfaad/sbr_hfadj.h
+++ b/src/libfaad/sbr_hfadj.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_hfadj.h,v 1.1 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: sbr_hfadj.h,v 1.2 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __SBR_HFADJ_H__
@@ -53,20 +53,6 @@ void hf_adjustment(sbr_info *sbr, qmf_t Xsbr[MAX_NTSRHFG][64]
,uint8_t ch);
-static void map_envelope_data(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch);
-static void map_noise_data(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch);
-static void map_sinusoids(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch);
-static void estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj,
- qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch);
-static void additional_component_levels(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch);
-static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch);
-#ifdef SBR_LOW_POWER
-static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch);
-static void aliasing_reduction(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch);
-#endif
-static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj, qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch);
-
-
#ifdef __cplusplus
}
#endif
diff --git a/src/libfaad/sbr_hfgen.c b/src/libfaad/sbr_hfgen.c
index ed5f4135f..588d693df 100644
--- a/src/libfaad/sbr_hfgen.c
+++ b/src/libfaad/sbr_hfgen.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_hfgen.c,v 1.1 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: sbr_hfgen.c,v 1.2 2004/01/11 15:44:05 mroi Exp $
**/
/* High Frequency generation */
@@ -36,7 +36,22 @@
#include "sbr_hfgen.h"
#include "sbr_fbt.h"
-void hf_generation(sbr_info *sbr, const qmf_t Xlow[MAX_NTSRHFG][32],
+
+/* static function declarations */
+static void calc_prediction_coef(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][32],
+ complex_t *alpha_0, complex_t *alpha_1
+#ifdef SBR_LOW_POWER
+ , real_t *rxx
+#endif
+ );
+#ifdef SBR_LOW_POWER
+static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg);
+#endif
+static void calc_chirp_factors(sbr_info *sbr, uint8_t ch);
+static void patch_construction(sbr_info *sbr);
+
+
+void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][32],
qmf_t Xhigh[MAX_NTSRHFG][64]
#ifdef SBR_LOW_POWER
,real_t *deg
@@ -172,7 +187,7 @@ typedef struct
#ifdef SBR_LOW_POWER
static void auto_correlation(sbr_info *sbr, acorr_coef *ac,
- const qmf_t buffer[MAX_NTSRHFG][32],
+ qmf_t buffer[MAX_NTSRHFG][32],
uint8_t bd, uint8_t len)
{
real_t r01 = 0, r02 = 0, r11 = 0;
@@ -180,6 +195,7 @@ static void auto_correlation(sbr_info *sbr, acorr_coef *ac,
uint8_t offset = sbr->tHFAdj;
const real_t rel = 1 / (1 + 1e-6f);
+
for (j = offset; j < len + offset; j++)
{
r01 += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-1][bd]);
@@ -199,7 +215,7 @@ static void auto_correlation(sbr_info *sbr, acorr_coef *ac,
ac->det = MUL_R(RE(ac->r11), RE(ac->r22)) - MUL_C(MUL_R(RE(ac->r12), RE(ac->r12)), rel);
}
#else
-static void auto_correlation(sbr_info *sbr, acorr_coef *ac, const qmf_t buffer[MAX_NTSRHFG][32],
+static void auto_correlation(sbr_info *sbr, acorr_coef *ac, qmf_t buffer[MAX_NTSRHFG][32],
uint8_t bd, uint8_t len)
{
real_t r01r = 0, r01i = 0, r02r = 0, r02i = 0, r11r = 0;
@@ -243,7 +259,7 @@ static void auto_correlation(sbr_info *sbr, acorr_coef *ac, const qmf_t buffer[M
#endif
/* calculate linear prediction coefficients using the covariance method */
-static void calc_prediction_coef(sbr_info *sbr, const qmf_t Xlow[MAX_NTSRHFG][32],
+static void calc_prediction_coef(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][32],
complex_t *alpha_0, complex_t *alpha_1
#ifdef SBR_LOW_POWER
, real_t *rxx
diff --git a/src/libfaad/sbr_hfgen.h b/src/libfaad/sbr_hfgen.h
index d398e26ef..d5ace4ccc 100644
--- a/src/libfaad/sbr_hfgen.h
+++ b/src/libfaad/sbr_hfgen.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_hfgen.h,v 1.1 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: sbr_hfgen.h,v 1.2 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __SBR_HFGEN_H__
@@ -32,23 +32,13 @@
extern "C" {
#endif
-void hf_generation(sbr_info *sbr, const qmf_t Xlow[MAX_NTSRHFG][32],
+void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][32],
qmf_t Xhigh[MAX_NTSRHFG][64]
#ifdef SBR_LOW_POWER
,real_t *deg
#endif
,uint8_t ch);
-static void calc_prediction_coef(sbr_info *sbr, const qmf_t Xlow[MAX_NTSRHFG][32],
- complex_t *alpha_0, complex_t *alpha_1
-#ifdef SBR_LOW_POWER
- , real_t *rxx
-#endif
- );
-static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg);
-static void calc_chirp_factors(sbr_info *sbr, uint8_t ch);
-static void patch_construction(sbr_info *sbr);
-
#ifdef __cplusplus
}
#endif
diff --git a/src/libfaad/sbr_huff.c b/src/libfaad/sbr_huff.c
index 1c786bd3c..3fd043f3b 100644
--- a/src/libfaad/sbr_huff.c
+++ b/src/libfaad/sbr_huff.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_huff.c,v 1.3 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: sbr_huff.c,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#include "common.h"
@@ -220,7 +220,7 @@ static const int8_t t_huffman_noise_bal_3_0dB[24][2] = {
};
-INLINE int16_t sbr_huff_dec(bitfile *ld, sbr_huff_tab t_huff)
+static INLINE int16_t sbr_huff_dec(bitfile *ld, sbr_huff_tab t_huff)
{
uint8_t bit;
int16_t index = 0;
diff --git a/src/libfaad/sbr_huff.h b/src/libfaad/sbr_huff.h
index 00646b36d..2830c311f 100644
--- a/src/libfaad/sbr_huff.h
+++ b/src/libfaad/sbr_huff.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_huff.h,v 1.3 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: sbr_huff.h,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __SBR_HUFF_H__
diff --git a/src/libfaad/sbr_noise.h b/src/libfaad/sbr_noise.h
index 3b6ffb645..f49df7481 100644
--- a/src/libfaad/sbr_noise.h
+++ b/src/libfaad/sbr_noise.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_noise.h,v 1.1 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: sbr_noise.h,v 1.2 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __SBR_NOISE_H__
@@ -557,4 +557,5 @@ ALIGN static const complex_t V[] = {
#ifdef __cplusplus
#endif
-#endif \ No newline at end of file
+#endif
+
diff --git a/src/libfaad/sbr_qmf.c b/src/libfaad/sbr_qmf.c
index fb7623b3f..bc4b6c18a 100644
--- a/src/libfaad/sbr_qmf.c
+++ b/src/libfaad/sbr_qmf.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_qmf.c,v 1.3 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: sbr_qmf.c,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#include "common.h"
@@ -82,7 +82,11 @@ void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input,
/* add new samples to input buffer x */
for (n = 32 - 1; n >= 0; n--)
{
+#ifdef FIXED_POINT
+ qmfa->x[n] = (input[in++]) >> 5;
+#else
qmfa->x[n] = input[in++];
+#endif
}
/* window and summation to create array u */
@@ -109,7 +113,11 @@ void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input,
{
if (n < kx)
{
+#ifdef FIXED_POINT
+ QMF_RE(X[l + offset][n]) = u[n] << 1;
+#else
QMF_RE(X[l + offset][n]) = 2. * u[n];
+#endif
} else {
QMF_RE(X[l + offset][n]) = 0;
}
@@ -129,8 +137,13 @@ void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input,
{
if (n < kx)
{
+#ifdef FIXED_POINT
+ QMF_RE(X[l + offset][n]) = y[n] << 1;
+ QMF_IM(X[l + offset][n]) = -y[63-n] << 1;
+#else
QMF_RE(X[l + offset][n]) = 2. * y[n];
QMF_IM(X[l + offset][n]) = -2. * y[63-n];
+#endif
} else {
QMF_RE(X[l + offset][n]) = 0;
QMF_IM(X[l + offset][n]) = 0;
@@ -184,7 +197,7 @@ void qmfs_end(qmfs_info *qmfs)
}
#ifdef SBR_LOW_POWER
-void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, const qmf_t X[MAX_NTSRHFG][64],
+void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
real_t *output)
{
ALIGN real_t x[64];
@@ -210,7 +223,11 @@ void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, const qmf_t X[MAX_NTSR
/* calculate 128 samples */
for (k = 0; k < 64; k++)
{
+#ifdef FIXED_POINT
+ x[k] = QMF_RE(X[l][k]);
+#else
x[k] = QMF_RE(X[l][k]) / 32.;
+#endif
}
for (n = 0; n < 32; n++)
@@ -266,37 +283,7 @@ void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, const qmf_t X[MAX_NTSR
}
}
-void DST2(real_t *in, real_t *out, int32_t len)
-{
- int r, i;
-
- for (r = 1; r <= len; r++)
- {
- double sum = 0;
- for (i = 1; i <= len; i++)
- {
- sum += in[i-1] * sin(((real_t)r)*((real_t)i-0.5)*M_PI/(real_t)len);
- }
- out[r-1] = (real_t)sum;
- }
-}
-
-void DCT2(real_t *in, real_t *out, int32_t len)
-{
- int r, i;
-
- for (r = 0; r < len; r++)
- {
- double sum = 0;
- for (i = 0; i < len; i++)
- {
- sum += in[i] * cos(((real_t)r)*((real_t)i+0.5)*M_PI/(real_t)len);
- }
- out[r] = (real_t)sum;
- }
-}
-
-void sbr_qmf_synthesis_64_sse(sbr_info *sbr, qmfs_info *qmfs, const qmf_t X[MAX_NTSRHFG][64],
+void sbr_qmf_synthesis_64_sse(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
real_t *output)
{
ALIGN real_t x[64];
@@ -322,7 +309,11 @@ void sbr_qmf_synthesis_64_sse(sbr_info *sbr, qmfs_info *qmfs, const qmf_t X[MAX_
/* calculate 128 samples */
for (k = 0; k < 64; k++)
{
+#ifdef FIXED_POINT
+ x[k] = QMF_RE(X[l][k]);
+#else
x[k] = QMF_RE(X[l][k]) / 32.;
+#endif
}
for (n = 0; n < 32; n++)
@@ -379,7 +370,7 @@ void sbr_qmf_synthesis_64_sse(sbr_info *sbr, qmfs_info *qmfs, const qmf_t X[MAX_
}
}
#else
-void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, const qmf_t X[MAX_NTSRHFG][64],
+void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
real_t *output)
{
ALIGN real_t x1[64], x2[64];
@@ -459,7 +450,7 @@ void memmove_sse_576(real_t *out, const real_t *in)
}
}
-void sbr_qmf_synthesis_64_sse(sbr_info *sbr, qmfs_info *qmfs, const qmf_t X[MAX_NTSRHFG][64],
+void sbr_qmf_synthesis_64_sse(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
real_t *output)
{
ALIGN real_t x1[64], x2[64];
diff --git a/src/libfaad/sbr_qmf.h b/src/libfaad/sbr_qmf.h
index 9835d6139..7e7266c45 100644
--- a/src/libfaad/sbr_qmf.h
+++ b/src/libfaad/sbr_qmf.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_qmf.h,v 1.3 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: sbr_qmf.h,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __SBR_QMF_H__
@@ -39,12 +39,10 @@ void qmfs_end(qmfs_info *qmfs);
void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input,
qmf_t X[MAX_NTSRHFG][32], uint8_t offset, uint8_t kx);
-void sbr_qmf_synthesis_32(qmfs_info *qmfs, const qmf_t *X,
- real_t *output);
-void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, const qmf_t X[MAX_NTSRHFG][64],
+void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
real_t *output);
#ifdef USE_SSE
-void sbr_qmf_synthesis_64_sse(sbr_info *sbr, qmfs_info *qmfs, const qmf_t X[MAX_NTSRHFG][64],
+void sbr_qmf_synthesis_64_sse(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
real_t *output);
#endif
diff --git a/src/libfaad/sbr_qmf_c.h b/src/libfaad/sbr_qmf_c.h
index b02cbcd37..4b6c09b8d 100644
--- a/src/libfaad/sbr_qmf_c.h
+++ b/src/libfaad/sbr_qmf_c.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_qmf_c.h,v 1.1 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: sbr_qmf_c.h,v 1.2 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __SBR_QMF_C_H__
@@ -361,4 +361,5 @@ ALIGN static const real_t qmf_c[640] = {
FRAC_CONST(-0.00056176925738), FRAC_CONST(-0.00055252865047)
};
-#endif \ No newline at end of file
+#endif
+
diff --git a/src/libfaad/sbr_syntax.c b/src/libfaad/sbr_syntax.c
index f24aff986..e8cdceff5 100644
--- a/src/libfaad/sbr_syntax.c
+++ b/src/libfaad/sbr_syntax.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_syntax.c,v 1.3 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: sbr_syntax.c,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#include "common.h"
@@ -39,6 +39,17 @@
#include "bits.h"
#include "analysis.h"
+/* static function declarations */
+static void sbr_header(bitfile *ld, sbr_info *sbr);
+static uint8_t sbr_data(bitfile *ld, sbr_info *sbr);
+static uint8_t sbr_single_channel_element(bitfile *ld, sbr_info *sbr);
+static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr);
+static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch);
+static void sbr_dtdf(bitfile *ld, sbr_info *sbr, uint8_t ch);
+static void invf_mode(bitfile *ld, sbr_info *sbr, uint8_t ch);
+static void sinusoidal_coding(bitfile *ld, sbr_info *sbr, uint8_t ch);
+
+
static void sbr_reset(sbr_info *sbr)
{
#if 0
@@ -484,7 +495,7 @@ static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch)
{
uint8_t i, env, rel, result;
uint8_t bs_abs_bord, bs_abs_bord_1;
- uint8_t bs_num_env;
+ uint8_t bs_num_env = 0;
sbr->bs_frame_class[ch] = (uint8_t)faad_getbits(ld, 2
DEBUGVAR(1,248,"sbr_grid(): bs_frame_class"));
diff --git a/src/libfaad/sbr_syntax.h b/src/libfaad/sbr_syntax.h
index cf254ea0a..d3509edbb 100644
--- a/src/libfaad/sbr_syntax.h
+++ b/src/libfaad/sbr_syntax.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_syntax.h,v 1.3 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: sbr_syntax.h,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __SBR_SYNTAX_H__
@@ -56,14 +56,6 @@ extern "C" {
uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr);
-static void sbr_header(bitfile *ld, sbr_info *sbr);
-static uint8_t sbr_data(bitfile *ld, sbr_info *sbr);
-static uint8_t sbr_single_channel_element(bitfile *ld, sbr_info *sbr);
-static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr);
-static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch);
-static void sbr_dtdf(bitfile *ld, sbr_info *sbr, uint8_t ch);
-static void invf_mode(bitfile *ld, sbr_info *sbr, uint8_t ch);
-static void sinusoidal_coding(bitfile *ld, sbr_info *sbr, uint8_t ch);
#ifdef __cplusplus
}
diff --git a/src/libfaad/sbr_tf_grid.c b/src/libfaad/sbr_tf_grid.c
index 977c92cd2..3c0de19fc 100644
--- a/src/libfaad/sbr_tf_grid.c
+++ b/src/libfaad/sbr_tf_grid.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_tf_grid.c,v 1.1 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: sbr_tf_grid.c,v 1.2 2004/01/11 15:44:05 mroi Exp $
**/
/* Time/Frequency grid */
@@ -37,6 +37,15 @@
#include "sbr_syntax.h"
#include "sbr_tf_grid.h"
+
+/* static function declarations */
+#if 0
+static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l);
+static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l);
+#endif
+static uint8_t middleBorder(sbr_info *sbr, uint8_t ch);
+
+
uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch)
{
uint8_t l, border, temp;
@@ -155,6 +164,7 @@ void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch)
}
}
+#if 0
static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l)
{
uint8_t i;
@@ -209,10 +219,11 @@ static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l)
return 0;
}
+#endif
static uint8_t middleBorder(sbr_info *sbr, uint8_t ch)
{
- int8_t retval;
+ int8_t retval = 0;
switch (sbr->bs_frame_class[ch])
{
diff --git a/src/libfaad/sbr_tf_grid.h b/src/libfaad/sbr_tf_grid.h
index f166a3edc..771b2116a 100644
--- a/src/libfaad/sbr_tf_grid.h
+++ b/src/libfaad/sbr_tf_grid.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sbr_tf_grid.h,v 1.1 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: sbr_tf_grid.h,v 1.2 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __SBR_TF_GRID_H__
@@ -36,10 +36,6 @@ extern "C" {
uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch);
void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch);
-static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l);
-static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l);
-static uint8_t middleBorder(sbr_info *sbr, uint8_t ch);
-
#ifdef __cplusplus
}
diff --git a/src/libfaad/sine_win.h b/src/libfaad/sine_win.h
index 807190633..993bab2cd 100644
--- a/src/libfaad/sine_win.h
+++ b/src/libfaad/sine_win.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: sine_win.h,v 1.2 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: sine_win.h,v 1.3 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __SINE_WIN_H__
diff --git a/src/libfaad/specrec.c b/src/libfaad/specrec.c
index a509c69e1..588d79656 100644
--- a/src/libfaad/specrec.c
+++ b/src/libfaad/specrec.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: specrec.c,v 1.4 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: specrec.c,v 1.5 2004/01/11 15:44:05 mroi Exp $
**/
/*
@@ -52,6 +52,11 @@
#endif
+/* static function declarations */
+static void quant_to_spec(ic_stream *ics, real_t *spec_data, uint16_t frame_len);
+static uint8_t inverse_quantization(real_t *x_invquant, const int16_t *x_quant, const uint16_t frame_len);
+
+
#ifdef LD_DEC
ALIGN static const uint8_t num_swb_512_window[] =
{
@@ -511,7 +516,7 @@ static uint8_t inverse_quantization(real_t *x_invquant, const int16_t *x_quant,
uint8_t error = 0; /* Init error flag */
const real_t *tab = iq_table;
- for(i = 0; i < frame_len; i+=4)
+ for (i = 0; i < frame_len; i+=4)
{
x_invquant[i] = iquant(x_quant[i], tab, &error);
x_invquant[i+1] = iquant(x_quant[i+1], tab, &error);
@@ -532,19 +537,19 @@ ALIGN static const real_t pow2sf_tab[] = {
0.0009765625, 0.001953125, 0.00390625,
0.0078125, 0.015625, 0.03125,
0.0625, 0.125, 0.25,
- 0.5, 1, 2,
- 4, 8, 16, 32,
- 64, 128, 256,
- 512, 1024, 2048,
- 4096, 8192, 16384,
- 32768, 65536, 131072,
- 262144, 524288, 1048576,
- 2097152, 4194304, 8388608,
- 16777216, 33554432, 67108864,
- 134217728, 268435456, 536870912,
- 1073741824, 2147483648, 4294967296,
- 8589934592, 17179869184, 34359738368,
- 68719476736, 137438953472, 274877906944
+ 0.5, 1.0, 2.0,
+ 4.0, 8.0, 16.0, 32.0,
+ 64.0, 128.0, 256.0,
+ 512.0, 1024.0, 2048.0,
+ 4096.0, 8192.0, 16384.0,
+ 32768.0, 65536.0, 131072.0,
+ 262144.0, 524288.0, 1048576.0,
+ 2097152.0, 4194304.0, 8388608.0,
+ 16777216.0, 33554432.0, 67108864.0,
+ 134217728.0, 268435456.0, 536870912.0,
+ 1073741824.0, 2147483648.0, 4294967296.0,
+ 8589934592.0, 17179869184.0, 34359738368.0,
+ 68719476736.0, 137438953472.0, 274877906944.0
};
#endif
diff --git a/src/libfaad/specrec.h b/src/libfaad/specrec.h
index cf3fe222a..06b08f12b 100644
--- a/src/libfaad/specrec.h
+++ b/src/libfaad/specrec.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: specrec.h,v 1.3 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: specrec.h,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __SPECREC_H__
@@ -35,8 +35,6 @@ extern "C" {
#include "syntax.h"
uint8_t window_grouping_info(faacDecHandle hDecoder, ic_stream *ics);
-static void quant_to_spec(ic_stream *ics, real_t *spec_data, uint16_t frame_len);
-static uint8_t inverse_quantization(real_t *x_invquant, const int16_t *x_quant, const uint16_t frame_len);
void apply_scalefactors(faacDecHandle hDecoder, ic_stream *ics, real_t *x_invquant,
uint16_t frame_len);
#ifdef USE_SSE
diff --git a/src/libfaad/ssr.c b/src/libfaad/ssr.c
index dccd36964..dab7504ac 100644
--- a/src/libfaad/ssr.c
+++ b/src/libfaad/ssr.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: ssr.c,v 1.2 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: ssr.c,v 1.3 2004/01/11 15:44:05 mroi Exp $
**/
#include "common.h"
diff --git a/src/libfaad/ssr.h b/src/libfaad/ssr.h
index 6f4bfe997..cc635a3a3 100644
--- a/src/libfaad/ssr.h
+++ b/src/libfaad/ssr.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: ssr.h,v 1.2 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: ssr.h,v 1.3 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __SSR_H__
diff --git a/src/libfaad/ssr_fb.c b/src/libfaad/ssr_fb.c
index 8a73c1810..27fc655d3 100644
--- a/src/libfaad/ssr_fb.c
+++ b/src/libfaad/ssr_fb.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: ssr_fb.c,v 1.2 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: ssr_fb.c,v 1.3 2004/01/11 15:44:05 mroi Exp $
**/
#include "common.h"
diff --git a/src/libfaad/ssr_ipqf.c b/src/libfaad/ssr_ipqf.c
index 6ca22bc4a..c771775e1 100644
--- a/src/libfaad/ssr_ipqf.c
+++ b/src/libfaad/ssr_ipqf.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: ssr_ipqf.c,v 1.2 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: ssr_ipqf.c,v 1.3 2004/01/11 15:44:05 mroi Exp $
**/
#include "common.h"
diff --git a/src/libfaad/structs.h b/src/libfaad/structs.h
index 6afef3390..e0888f3ac 100644
--- a/src/libfaad/structs.h
+++ b/src/libfaad/structs.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: structs.h,v 1.3 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: structs.h,v 1.4 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __STRUCTS_H__
@@ -333,6 +333,7 @@ typedef struct faacDecConfiguration
uint8_t outputFormat;
uint8_t downMatrix;
uint8_t useOldADTSFormat;
+ uint8_t dontUpSampleImplicitSBR;
} faacDecConfiguration, *faacDecConfigurationPtr;
typedef struct faacDecFrameInfo
diff --git a/src/libfaad/syntax.c b/src/libfaad/syntax.c
index dda0f02de..e5e85bc80 100644
--- a/src/libfaad/syntax.c
+++ b/src/libfaad/syntax.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: syntax.c,v 1.5 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: syntax.c,v 1.6 2004/01/11 15:44:05 mroi Exp $
**/
/*
@@ -51,6 +51,48 @@
#endif
+/* static function declarations */
+static uint8_t single_lfe_channel_element(faacDecHandle hDecoder, bitfile *ld,
+ uint8_t channel, uint8_t *tag);
+static uint8_t channel_pair_element(faacDecHandle hDecoder, bitfile *ld,
+ uint8_t channel, uint8_t *tag);
+#ifdef COUPLING_DEC
+static uint8_t coupling_channel_element(faacDecHandle hDecoder, bitfile *ld);
+#endif
+static uint16_t data_stream_element(faacDecHandle hDecoder, bitfile *ld);
+static uint8_t program_config_element(program_config *pce, bitfile *ld);
+static uint8_t fill_element(faacDecHandle hDecoder, bitfile *ld, drc_info *drc
+#ifdef SBR_DEC
+ ,uint8_t sbr_ele
+#endif
+ );
+static uint8_t individual_channel_stream(faacDecHandle hDecoder, element *ele,
+ bitfile *ld, ic_stream *ics, uint8_t scal_flag,
+ int16_t *spec_data);
+static uint8_t ics_info(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld,
+ uint8_t common_window);
+static uint8_t section_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld);
+static uint8_t scale_factor_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld);
+#ifdef SSR_DEC
+static void gain_control_data(bitfile *ld, ic_stream *ics);
+#endif
+static uint8_t spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld,
+ int16_t *spectral_data);
+static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count);
+static uint8_t pulse_data(ic_stream *ics, pulse_info *pul, bitfile *ld);
+static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld);
+static uint8_t ltp_data(faacDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld);
+static uint8_t adts_fixed_header(adts_header *adts, bitfile *ld);
+static void adts_variable_header(adts_header *adts, bitfile *ld);
+static void adts_error_check(adts_header *adts, bitfile *ld);
+static uint8_t dynamic_range_info(bitfile *ld, drc_info *drc);
+static uint8_t excluded_channels(bitfile *ld, drc_info *drc);
+#ifdef SCALABLE_DEC
+static int8_t aac_scalable_main_header(faacDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2,
+ bitfile *ld, uint8_t this_layer_stereo);
+#endif
+
+
/* Table 4.4.1 */
int8_t GASpecificConfig(bitfile *ld, mp4AudioSpecificConfig *mp4ASC,
program_config *pce_out)
@@ -869,7 +911,7 @@ static uint16_t data_stream_element(faacDecHandle hDecoder, bitfile *ld)
for (i = 0; i < count; i++)
{
- uint8_t data = (uint8_t)faad_getbits(ld, LEN_BYTE
+ faad_getbits(ld, LEN_BYTE
DEBUGVAR(1,64,"data_stream_element(): data_stream_byte"));
}
@@ -1687,8 +1729,7 @@ static uint8_t spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld
{
int8_t i;
uint8_t g;
- int16_t *sp;
- uint16_t k, p = 0;
+ uint16_t inc, k, p = 0;
uint8_t groups = 0;
uint8_t sect_cb;
uint8_t result;
@@ -1698,9 +1739,6 @@ static uint8_t spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld
int64_t count = faad_get_ts();
#endif
- sp = spectral_data;
- /*memset(sp, 0, hDecoder->frameLength*sizeof(int16_t));*/
-
for(g = 0; g < ics->num_window_groups; g++)
{
p = groups*nshort;
@@ -1709,6 +1747,8 @@ static uint8_t spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld
{
sect_cb = ics->sect_cb[g][i];
+ inc = (sect_cb >= FIRST_PAIR_HCB) ? 2 : 4;
+
switch (sect_cb)
{
case ZERO_HCB:
@@ -1720,18 +1760,11 @@ static uint8_t spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld
break;
default:
for (k = ics->sect_sfb_offset[g][ics->sect_start[g][i]];
- k < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; k += 4)
+ k < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; k += inc)
{
- sp = spectral_data + p;
-
- if ((result = huffman_spectral_data(sect_cb, ld, sp)) > 0)
+ if ((result = huffman_spectral_data(sect_cb, ld, &spectral_data[p])) > 0)
return result;
- if (sect_cb >= FIRST_PAIR_HCB)
- {
- if ((result = huffman_spectral_data(sect_cb, ld, sp+2)) > 0)
- return result;
- }
- p += 4;
+ p += inc;
}
break;
}
diff --git a/src/libfaad/syntax.h b/src/libfaad/syntax.h
index 4dccee529..20c742f35 100644
--- a/src/libfaad/syntax.h
+++ b/src/libfaad/syntax.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: syntax.h,v 1.6 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: syntax.h,v 1.7 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __SYNTAX_H__
@@ -115,51 +115,10 @@ void decode_cpe(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld,
uint8_t id_syn_ele);
void raw_data_block(faacDecHandle hDecoder, faacDecFrameInfo *hInfo,
bitfile *ld, program_config *pce, drc_info *drc);
+uint8_t reordered_spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld,
+ int16_t *spectral_data);
-/* static functions */
-static uint8_t single_lfe_channel_element(faacDecHandle hDecoder, bitfile *ld,
- uint8_t channel, uint8_t *tag);
-static uint8_t channel_pair_element(faacDecHandle hDecoder, bitfile *ld,
- uint8_t channel, uint8_t *tag);
-#ifdef COUPLING_DEC
-static uint8_t coupling_channel_element(faacDecHandle hDecoder, bitfile *ld);
-#endif
-static uint16_t data_stream_element(faacDecHandle hDecoder, bitfile *ld);
-static uint8_t program_config_element(program_config *pce, bitfile *ld);
-static uint8_t fill_element(faacDecHandle hDecoder, bitfile *ld, drc_info *drc
-#ifdef SBR_DEC
- ,uint8_t sbr_ele
-#endif
- );
-static uint8_t individual_channel_stream(faacDecHandle hDecoder, element *ele,
- bitfile *ld, ic_stream *ics, uint8_t scal_flag,
- int16_t *spec_data);
-static uint8_t ics_info(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld,
- uint8_t common_window);
-static uint8_t section_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld);
-static uint8_t scale_factor_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld);
-static void gain_control_data(bitfile *ld, ic_stream *ics);
-static uint8_t spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld,
- int16_t *spectral_data);
-static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count);
-#ifdef ERROR_RESILIENCE
-uint8_t reordered_spectral_data(faacDecHandle hDecoder, ic_stream *ics,
- bitfile *ld, int16_t *spectral_data);
-#endif
-static uint8_t pulse_data(ic_stream *ics, pulse_info *pul, bitfile *ld);
-static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld);
-static uint8_t ltp_data(faacDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld);
-static uint8_t adts_fixed_header(adts_header *adts, bitfile *ld);
-static void adts_variable_header(adts_header *adts, bitfile *ld);
-static void adts_error_check(adts_header *adts, bitfile *ld);
-static uint8_t dynamic_range_info(bitfile *ld, drc_info *drc);
-static uint8_t excluded_channels(bitfile *ld, drc_info *drc);
-#ifdef SCALABLE_DEC
-static int8_t aac_scalable_main_header(faacDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2,
- bitfile *ld, uint8_t this_layer_stereo);
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/src/libfaad/tns.c b/src/libfaad/tns.c
index 1d03c726c..65bef7c33 100644
--- a/src/libfaad/tns.c
+++ b/src/libfaad/tns.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: tns.c,v 1.4 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: tns.c,v 1.5 2004/01/11 15:44:05 mroi Exp $
**/
#include "common.h"
@@ -31,6 +31,16 @@
#include "syntax.h"
#include "tns.h"
+
+/* static function declarations */
+static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_compress,
+ uint8_t *coef, real_t *a);
+static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc,
+ uint8_t order);
+static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc,
+ uint8_t order);
+
+
#ifdef _MSC_VER
#pragma warning(disable:4305)
#pragma warning(disable:4244)
diff --git a/src/libfaad/tns.h b/src/libfaad/tns.h
index 30aef676f..ebae23890 100644
--- a/src/libfaad/tns.h
+++ b/src/libfaad/tns.h
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: tns.h,v 1.4 2003/12/30 02:00:11 miguelfreitas Exp $
+** $Id: tns.h,v 1.5 2004/01/11 15:44:05 mroi Exp $
**/
#ifndef __TNS_H__
@@ -41,13 +41,6 @@ void tns_decode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index,
void tns_encode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index,
uint8_t object_type, real_t *spec, uint16_t frame_len);
-static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_compress,
- uint8_t *coef, real_t *a);
-static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc,
- uint8_t order);
-static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc,
- uint8_t order);
-
#ifdef __cplusplus
}