changeset 1021:1e6c0a3f2d15 trunk

[svn] - 2.1 beta
author nenolod
date Wed, 10 May 2006 14:44:20 -0700
parents d70514b3b436
children 0b03a1d25c44
files Plugins/Input/aac/libfaad2/Makefile.in Plugins/Input/aac/libfaad2/analysis.h Plugins/Input/aac/libfaad2/bits.c Plugins/Input/aac/libfaad2/bits.h Plugins/Input/aac/libfaad2/cfft.c Plugins/Input/aac/libfaad2/cfft.h Plugins/Input/aac/libfaad2/cfft_tab.h Plugins/Input/aac/libfaad2/common.c Plugins/Input/aac/libfaad2/common.h Plugins/Input/aac/libfaad2/decoder.c Plugins/Input/aac/libfaad2/decoder.h Plugins/Input/aac/libfaad2/drc.c Plugins/Input/aac/libfaad2/drc.h Plugins/Input/aac/libfaad2/error.c Plugins/Input/aac/libfaad2/error.h Plugins/Input/aac/libfaad2/filtbank.c Plugins/Input/aac/libfaad2/filtbank.h Plugins/Input/aac/libfaad2/fixed.h Plugins/Input/aac/libfaad2/hcr.c Plugins/Input/aac/libfaad2/huffman.c Plugins/Input/aac/libfaad2/huffman.h Plugins/Input/aac/libfaad2/ic_predict.h Plugins/Input/aac/libfaad2/iq_table.h Plugins/Input/aac/libfaad2/is.c Plugins/Input/aac/libfaad2/is.h Plugins/Input/aac/libfaad2/kbd_win.h Plugins/Input/aac/libfaad2/lt_predict.c Plugins/Input/aac/libfaad2/lt_predict.h Plugins/Input/aac/libfaad2/mdct.c Plugins/Input/aac/libfaad2/mdct.h Plugins/Input/aac/libfaad2/mp4.c Plugins/Input/aac/libfaad2/mp4.h Plugins/Input/aac/libfaad2/ms.c Plugins/Input/aac/libfaad2/ms.h Plugins/Input/aac/libfaad2/output.c Plugins/Input/aac/libfaad2/output.h Plugins/Input/aac/libfaad2/pns.c Plugins/Input/aac/libfaad2/pns.h Plugins/Input/aac/libfaad2/pulse.c Plugins/Input/aac/libfaad2/pulse.h Plugins/Input/aac/libfaad2/rvlc.c Plugins/Input/aac/libfaad2/rvlc.h Plugins/Input/aac/libfaad2/sbr_dct.c Plugins/Input/aac/libfaad2/sbr_dct.h Plugins/Input/aac/libfaad2/sbr_dec.c Plugins/Input/aac/libfaad2/sbr_dec.h Plugins/Input/aac/libfaad2/sbr_e_nf.c Plugins/Input/aac/libfaad2/sbr_e_nf.h Plugins/Input/aac/libfaad2/sbr_fbt.c Plugins/Input/aac/libfaad2/sbr_fbt.h Plugins/Input/aac/libfaad2/sbr_hfadj.c Plugins/Input/aac/libfaad2/sbr_hfadj.h Plugins/Input/aac/libfaad2/sbr_hfgen.c Plugins/Input/aac/libfaad2/sbr_hfgen.h Plugins/Input/aac/libfaad2/sbr_huff.c Plugins/Input/aac/libfaad2/sbr_huff.h Plugins/Input/aac/libfaad2/sbr_noise.h Plugins/Input/aac/libfaad2/sbr_qmf.c Plugins/Input/aac/libfaad2/sbr_qmf.h Plugins/Input/aac/libfaad2/sbr_qmf_c.h Plugins/Input/aac/libfaad2/sbr_syntax.c Plugins/Input/aac/libfaad2/sbr_syntax.h Plugins/Input/aac/libfaad2/sbr_tf_grid.c Plugins/Input/aac/libfaad2/sbr_tf_grid.h Plugins/Input/aac/libfaad2/sine_win.h Plugins/Input/aac/libfaad2/specrec.c Plugins/Input/aac/libfaad2/specrec.h Plugins/Input/aac/libfaad2/ssr.c Plugins/Input/aac/libfaad2/ssr.h Plugins/Input/aac/libfaad2/ssr_fb.c Plugins/Input/aac/libfaad2/ssr_fb.h Plugins/Input/aac/libfaad2/ssr_ipqf.c Plugins/Input/aac/libfaad2/ssr_ipqf.h Plugins/Input/aac/libfaad2/ssr_win.h Plugins/Input/aac/libfaad2/structs.h Plugins/Input/aac/libfaad2/syntax.c Plugins/Input/aac/libfaad2/syntax.h Plugins/Input/aac/libfaad2/tns.c Plugins/Input/aac/libfaad2/tns.h
diffstat 79 files changed, 14150 insertions(+), 5964 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Input/aac/libfaad2/Makefile.in	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/Makefile.in	Wed May 10 14:44:20 2006 -0700
@@ -17,3 +17,6 @@
 	sbr_huff.c sbr_qmf.c sbr_syntax.c sbr_tf_grid.c sbr_dec.c
 
 OBJECTS = ${SOURCES:.c=.o}
+
+libfaad.a: $(OBJECTS)
+	$(AR) cq $@ $(OBJECTS)
--- a/Plugins/Input/aac/libfaad2/analysis.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/analysis.h	Wed May 10 14:44:20 2006 -0700
@@ -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.11 2004/01/05 14:05:11 menno Exp $
+** $Id: analysis.h,v 1.14 2004/09/04 14:56:27 menno Exp $
 **/
 
 #ifndef __ANALYSIS_H__
--- a/Plugins/Input/aac/libfaad2/bits.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/bits.c	Wed May 10 14:44:20 2006 -0700
@@ -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.36 2004/01/28 19:17:24 menno Exp $
+** $Id: bits.c,v 1.39 2004/09/04 14:56:27 menno Exp $
 **/
 
 #include "common.h"
--- a/Plugins/Input/aac/libfaad2/bits.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/bits.h	Wed May 10 14:44:20 2006 -0700
@@ -1,19 +1,19 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
 ** 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
 ** the Free Software Foundation; either version 2 of the License, or
 ** (at your option) any later version.
-** 
+**
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ** GNU General Public License for more details.
-** 
+**
 ** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software 
+** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
 ** Any non-GPL usage of this software or parts of this software is strictly
@@ -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.36 2004/02/04 20:07:24 menno Exp $
+** $Id: bits.h,v 1.40 2004/09/04 14:56:27 menno Exp $
 **/
 
 #ifndef __BITS_H__
@@ -56,9 +56,9 @@
 } bitfile;
 
 
-#if defined (_WIN32) && !defined(_WIN32_WCE)
+#if defined (_WIN32) && !defined(_WIN32_WCE) && !defined(__MINGW32__)
 #define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax
-#elif defined(LINUX) || defined(DJGPP)
+#elif defined(LINUX) || defined(DJGPP) || defined(__MINGW32__)
 #define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) )
 #else
 #define BSWAP(a) \
@@ -317,7 +317,7 @@
     /* bit input */
     uint32_t bufa;
     uint32_t bufb;
-    int8_t len; 
+    int8_t len;
 } bits_t;
 
 
@@ -331,7 +331,7 @@
         if (ld->len >= bits)
             return ((ld->bufa >> (ld->len - bits)) & (0xFFFFFFFF >> (32 - bits)));
         else
-            return ((ld->bufa << (bits - ld->len)) & (0xFFFFFFFF >> (32 - bits)));        
+            return ((ld->bufa << (bits - ld->len)) & (0xFFFFFFFF >> (32 - bits)));
     } else {
         if ((ld->len - bits) < 32)
         {
--- a/Plugins/Input/aac/libfaad2/cfft.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/cfft.c	Wed May 10 14:44:20 2006 -0700
@@ -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.24 2004/01/05 14:47:27 menno Exp $
+** $Id: cfft.c,v 1.30 2004/09/08 09:43:11 gcp Exp $
 **/
 
 /*
@@ -44,14 +44,6 @@
 
 
 /* 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,
@@ -74,89 +66,6 @@
    passf2, passf3, passf4, passf5. Complex FFT passes fwd and bwd.
   ----------------------------------------------------------------------*/
 
-#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 k, ah, ac;
-
-    for (k = 0; k < l1; 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+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)
-        {
-            __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]));
-
-            m3 = _mm_add_ps(m1, m2);
-            m15 = _mm_add_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);
-
-
-            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);
-
-            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);
-
-            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);
-
-            _mm_store_ps(&RE(ch[ah+i+l1*ido]), m14);
-            _mm_store_ps(&RE(ch[ah+i+2+l1*ido]), m24);
-        }
-    }
-}
-#endif
-
 static void passf2pos(const uint16_t ido, const uint16_t l1, const complex_t *cc,
                       complex_t *ch, const complex_t *wa)
 {
@@ -385,218 +294,6 @@
     }
 }
 
-#ifdef USE_SSE
-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;
-
-    for (k = 0; k < l1; k++)
-    {
-        ac = 4*k*ido;
-        ah = k*ido;
-
-        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);
-
-#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])
-#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);
-        }
-    }
-}
-#endif
 
 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,
@@ -992,101 +689,6 @@
    cfftf1, cfftf, cfftb, cffti1, cffti. Complex FFTs.
   ----------------------------------------------------------------------*/
 
-#ifdef USE_SSE
-
-#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;
-    uint16_t na, nf, ip, iw, ix2, ix3, ix4, ido, idl1;
-
-    nf = ifac[1];
-    na = 0;
-    l1 = 1;
-    iw = 0;
-
-    for (k1 = 2; k1 <= nf+1; k1++)
-    {
-        ip = ifac[k1];
-        l2 = ip*l1;
-        ido = n / l2;
-        idl1 = ido*l1;
-
-        ix2 = iw + ido;
-        ix3 = ix2 + ido;
-        ix4 = ix3 + ido;
-
-        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 CONV(4,0,1):
-            passf4pos_sse((const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3]);
-            break;
-        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 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;
-    }
-
-    if (na == 0)
-        return;
-
-    for (i = 0; i < n; i++)
-    {
-        RE(c[i]) = RE(ch[i]);
-        IM(c[i]) = IM(ch[i]);
-    }
-}
-#endif
-
 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)
@@ -1255,13 +857,6 @@
     cfftf1pos(cfft->n, c, cfft->work, (const uint16_t*)cfft->ifac, (const complex_t*)cfft->tab, +1);
 }
 
-#ifdef USE_SSE
-void cfftb_sse(cfft_info *cfft, complex_t *c)
-{
-    cfftf1pos_sse(cfft->n, c, cfft->work, (const uint16_t*)cfft->ifac, (const complex_t*)cfft->tab, +1);
-}
-#endif
-
 static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac)
 {
     static uint16_t ntryh[4] = {3, 4, 2, 5};
@@ -1375,19 +970,20 @@
 
     switch (n)
     {
-    case 64: cfft->tab = cfft_tab_64; break;
-    case 512: cfft->tab = cfft_tab_512; break;
+    case 64: cfft->tab = (complex_t*)cfft_tab_64; break;
+    case 512: cfft->tab = (complex_t*)cfft_tab_512; break;
 #ifdef LD_DEC
-    case 256: cfft->tab = cfft_tab_256; break;
+    case 256: cfft->tab = (complex_t*)cfft_tab_256; break;
 #endif
 
 #ifdef ALLOW_SMALL_FRAMELENGTH
-    case 60: cfft->tab = cfft_tab_60; break;
-    case 480: cfft->tab = cfft_tab_480; break;
+    case 60: cfft->tab = (complex_t*)cfft_tab_60; break;
+    case 480: cfft->tab = (complex_t*)cfft_tab_480; break;
 #ifdef LD_DEC
-    case 240: cfft->tab = cfft_tab_240; break;
+    case 240: cfft->tab = (complex_t*)cfft_tab_240; break;
 #endif
 #endif
+    case 128: cfft->tab = (complex_t*)cfft_tab_128; break;
     }
 #endif
 
--- a/Plugins/Input/aac/libfaad2/cfft.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/cfft.h	Wed May 10 14:44:20 2006 -0700
@@ -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.16 2004/01/05 14:05:11 menno Exp $
+** $Id: cfft.h,v 1.20 2004/09/08 09:43:11 gcp Exp $
 **/
 
 #ifndef __CFFT_H__
@@ -46,10 +46,6 @@
 cfft_info *cffti(uint16_t n);
 void cfftu(cfft_info *cfft);
 
-#ifdef USE_SSE
-void cfftb_sse(cfft_info *cfft, complex_t *c);
-#endif
-
 
 #ifdef __cplusplus
 }
--- a/Plugins/Input/aac/libfaad2/cfft_tab.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/cfft_tab.h	Wed May 10 14:44:20 2006 -0700
@@ -1,19 +1,19 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
 ** 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
 ** the Free Software Foundation; either version 2 of the License, or
 ** (at your option) any later version.
-** 
+**
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ** GNU General Public License for more details.
-** 
+**
 ** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software 
+** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
 ** Any non-GPL usage of this software or parts of this software is strictly
@@ -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.12 2004/01/05 14:05:11 menno Exp $
+** $Id: cfft_tab.h,v 1.17 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __CFFT_TAB_H__
@@ -1680,6 +1680,138 @@
 
 #endif
 
+ALIGN static const complex_t cfft_tab_128[] =
+{
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
+    { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+    { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+    { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+    { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
+    { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+    { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+    { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+    { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
+    { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+    { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
+    { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+    { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
+    { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+    { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+    { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+    { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
+    { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+    { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
+    { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+    { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
+    { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
+    { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) },
+    { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+    { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) },
+    { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) },
+    { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) },
+    { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) },
+    { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+    { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) },
+    { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+    { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
+    { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) },
+    { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) },
+    { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) },
+    { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) },
+    { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+    { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) },
+    { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) },
+    { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) },
+    { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+    { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
+    { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) },
+    { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) },
+    { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+    { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) },
+    { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) },
+    { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+    { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+    { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+    { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+    { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+    { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+    { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+    { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+    { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+    { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+    { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
+    { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+    { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
+    { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+    { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
+    { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
+    { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) }
+};
+
 #endif
 
 #ifdef __cplusplus
--- a/Plugins/Input/aac/libfaad2/common.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/common.c	Wed May 10 14:44:20 2006 -0700
@@ -1,19 +1,19 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
 ** 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
 ** the Free Software Foundation; either version 2 of the License, or
 ** (at your option) any later version.
-** 
+**
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ** GNU General Public License for more details.
-** 
+**
 ** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software 
+** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
 ** Any non-GPL usage of this software or parts of this software is strictly
@@ -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.15 2004/01/05 14:05:11 menno Exp $
+** $Id: common.c,v 1.22 2004/09/08 09:43:11 gcp Exp $
 **/
 
 /* just some common functions that could be used anywhere */
@@ -33,67 +33,6 @@
 #include <stdlib.h>
 #include "syntax.h"
 
-#ifdef USE_SSE
-__declspec(naked) static int32_t __fastcall test_cpuid(void)
-{
-    __asm
-    {
-        pushf
-        pop eax
-        mov ecx,eax
-        xor eax,(1<<21)
-        push eax
-        popf
-        pushf
-        pop eax
-        push ecx
-        popf
-        cmp eax,ecx
-        mov eax,0
-        setne al
-        ret
-    }
-}
-
-__declspec(naked) static void __fastcall run_cpuid(int32_t param, int32_t out[4])
-{
-    __asm
-    {
-        pushad
-        push edx
-        mov eax,ecx
-        cpuid
-        pop edi
-        mov [edi+0],eax
-        mov [edi+4],ebx
-        mov [edi+8],ecx
-        mov [edi+12],edx
-        popad
-        ret
-    }
-}
-
-uint8_t cpu_has_sse()
-{
-    int32_t features[4];
-
-    if (test_cpuid())
-    {
-        run_cpuid(1, features);
-    }
-
-    /* check for SSE */
-    if (features[3] & 0x02000000)
-        return 1;
-
-    return 0;
-}
-#else
-uint8_t cpu_has_sse()
-{
-    return 0;
-}
-#endif
 
 /* Returns the sample rate index based on the samplerate */
 uint8_t get_sr_index(const uint32_t samplerate)
@@ -146,7 +85,7 @@
 uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type,
                     const uint8_t is_short)
 {
-    /* entry for each sampling rate	
+    /* entry for each sampling rate
      * 1    Main/LC long window
      * 2    Main/LC short window
      * 3    SSR long window
@@ -230,14 +169,13 @@
     return -1;
 }
 
-/* common malloc function */
-void *faad_malloc(int32_t size)
+void *faad_malloc(size_t size)
 {
 #if 0 // defined(_WIN32) && !defined(_WIN32_WCE)
     return _aligned_malloc(size, 16);
-#else
+#else   // #ifdef 0
     return malloc(size);
-#endif
+#endif  // #ifdef 0
 }
 
 /* common free function */
@@ -247,18 +185,18 @@
     _aligned_free(b);
 #else
     free(b);
+}
 #endif
-}
 
 static const  uint8_t    Parity [256] = {  // parity
-	0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
-	1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
-	1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
-	0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
-	1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
-	0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
-	0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
-	1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0
+    0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
+    1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
+    1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
+    0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
+    1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
+    0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
+    0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
+    1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0
 };
 
 static uint32_t  __r1 = 1;
@@ -293,12 +231,289 @@
  */
 uint32_t random_int(void)
 {
-	uint32_t  t1, t2, t3, t4;
+    uint32_t  t1, t2, t3, t4;
+
+    t3   = t1 = __r1;   t4   = t2 = __r2;       // Parity calculation is done via table lookup, this is also available
+    t1  &= 0xF5;        t2 >>= 25;              // on CPUs without parity, can be implemented in C and avoid unpredictable
+    t1   = Parity [t1]; t2  &= 0x63;            // jumps and slow rotate through the carry flag operations.
+    t1 <<= 31;          t2   = Parity [t2];
+
+    return (__r1 = (t3 >> 1) | t1 ) ^ (__r2 = (t4 + t4) | t2 );
+}
+
+uint32_t ones32(uint32_t x)
+{
+    x -= ((x >> 1) & 0x55555555);
+    x = (((x >> 2) & 0x33333333) + (x & 0x33333333));
+    x = (((x >> 4) + x) & 0x0f0f0f0f);
+    x += (x >> 8);
+    x += (x >> 16);
+
+    return (x & 0x0000003f);
+}
+
+uint32_t floor_log2(uint32_t x)
+{
+#if 1
+    x |= (x >> 1);
+    x |= (x >> 2);
+    x |= (x >> 4);
+    x |= (x >> 8);
+    x |= (x >> 16);
+
+    return (ones32(x) - 1);
+#else
+    uint32_t count = 0;
+
+    while (x >>= 1)
+        count++;
+
+    return count;
+#endif
+}
+
+/* returns position of first bit that is not 0 from msb,
+ * starting count at lsb */
+uint32_t wl_min_lzc(uint32_t x)
+{
+#if 1
+    x |= (x >> 1);
+    x |= (x >> 2);
+    x |= (x >> 4);
+    x |= (x >> 8);
+    x |= (x >> 16);
+
+    return (ones32(x));
+#else
+    uint32_t count = 0;
+
+    while (x >>= 1)
+        count++;
+
+    return (count + 1);
+#endif
+}
+
+#ifdef FIXED_POINT
+
+#define TABLE_BITS 6
+/* just take the maximum number of bits for interpolation */
+#define INTERP_BITS (REAL_BITS-TABLE_BITS)
+
+static const real_t pow2_tab[] = {
+    REAL_CONST(1.000000000000000), REAL_CONST(1.010889286051701), REAL_CONST(1.021897148654117),
+    REAL_CONST(1.033024879021228), REAL_CONST(1.044273782427414), REAL_CONST(1.055645178360557),
+    REAL_CONST(1.067140400676824), REAL_CONST(1.078760797757120), REAL_CONST(1.090507732665258),
+    REAL_CONST(1.102382583307841), REAL_CONST(1.114386742595892), REAL_CONST(1.126521618608242),
+    REAL_CONST(1.138788634756692), REAL_CONST(1.151189229952983), REAL_CONST(1.163724858777578),
+    REAL_CONST(1.176396991650281), REAL_CONST(1.189207115002721), REAL_CONST(1.202156731452703),
+    REAL_CONST(1.215247359980469), REAL_CONST(1.228480536106870), REAL_CONST(1.241857812073484),
+    REAL_CONST(1.255380757024691), REAL_CONST(1.269050957191733), REAL_CONST(1.282870016078778),
+    REAL_CONST(1.296839554651010), REAL_CONST(1.310961211524764), REAL_CONST(1.325236643159741),
+    REAL_CONST(1.339667524053303), REAL_CONST(1.354255546936893), REAL_CONST(1.369002422974591),
+    REAL_CONST(1.383909881963832), REAL_CONST(1.398979672538311), REAL_CONST(1.414213562373095),
+    REAL_CONST(1.429613338391970), REAL_CONST(1.445180806977047), REAL_CONST(1.460917794180647),
+    REAL_CONST(1.476826145939499), REAL_CONST(1.492907728291265), REAL_CONST(1.509164427593423),
+    REAL_CONST(1.525598150744538), REAL_CONST(1.542210825407941), REAL_CONST(1.559004400237837),
+    REAL_CONST(1.575980845107887), REAL_CONST(1.593142151342267), REAL_CONST(1.610490331949254),
+    REAL_CONST(1.628027421857348), REAL_CONST(1.645755478153965), REAL_CONST(1.663676580326736),
+    REAL_CONST(1.681792830507429), REAL_CONST(1.700106353718524), REAL_CONST(1.718619298122478),
+    REAL_CONST(1.737333835273706), REAL_CONST(1.756252160373300), REAL_CONST(1.775376492526521),
+    REAL_CONST(1.794709075003107), REAL_CONST(1.814252175500399), REAL_CONST(1.834008086409342),
+    REAL_CONST(1.853979125083386), REAL_CONST(1.874167634110300), REAL_CONST(1.894575981586966),
+    REAL_CONST(1.915206561397147), REAL_CONST(1.936061793492294), REAL_CONST(1.957144124175400),
+    REAL_CONST(1.978456026387951), REAL_CONST(2.000000000000000)
+};
+
+static const real_t log2_tab[] = {
+    REAL_CONST(0.000000000000000), REAL_CONST(0.022367813028455), REAL_CONST(0.044394119358453),
+    REAL_CONST(0.066089190457772), REAL_CONST(0.087462841250339), REAL_CONST(0.108524456778169),
+    REAL_CONST(0.129283016944966), REAL_CONST(0.149747119504682), REAL_CONST(0.169925001442312),
+    REAL_CONST(0.189824558880017), REAL_CONST(0.209453365628950), REAL_CONST(0.228818690495881),
+    REAL_CONST(0.247927513443585), REAL_CONST(0.266786540694901), REAL_CONST(0.285402218862248),
+    REAL_CONST(0.303780748177103), REAL_CONST(0.321928094887362), REAL_CONST(0.339850002884625),
+    REAL_CONST(0.357552004618084), REAL_CONST(0.375039431346925), REAL_CONST(0.392317422778760),
+    REAL_CONST(0.409390936137702), REAL_CONST(0.426264754702098), REAL_CONST(0.442943495848728),
+    REAL_CONST(0.459431618637297), REAL_CONST(0.475733430966398), REAL_CONST(0.491853096329675),
+    REAL_CONST(0.507794640198696), REAL_CONST(0.523561956057013), REAL_CONST(0.539158811108031),
+    REAL_CONST(0.554588851677637), REAL_CONST(0.569855608330948), REAL_CONST(0.584962500721156),
+    REAL_CONST(0.599912842187128), REAL_CONST(0.614709844115208), REAL_CONST(0.629356620079610),
+    REAL_CONST(0.643856189774725), REAL_CONST(0.658211482751795), REAL_CONST(0.672425341971496),
+    REAL_CONST(0.686500527183218), REAL_CONST(0.700439718141092), REAL_CONST(0.714245517666123),
+    REAL_CONST(0.727920454563199), REAL_CONST(0.741466986401147), REAL_CONST(0.754887502163469),
+    REAL_CONST(0.768184324776926), REAL_CONST(0.781359713524660), REAL_CONST(0.794415866350106),
+    REAL_CONST(0.807354922057604), REAL_CONST(0.820178962415188), REAL_CONST(0.832890014164742),
+    REAL_CONST(0.845490050944375), REAL_CONST(0.857980995127572), REAL_CONST(0.870364719583405),
+    REAL_CONST(0.882643049361841), REAL_CONST(0.894817763307943), REAL_CONST(0.906890595608519),
+    REAL_CONST(0.918863237274595), REAL_CONST(0.930737337562886), REAL_CONST(0.942514505339240),
+    REAL_CONST(0.954196310386875), REAL_CONST(0.965784284662087), REAL_CONST(0.977279923499917),
+    REAL_CONST(0.988684686772166), REAL_CONST(1.000000000000000)
+};
+
+real_t pow2_fix(real_t val)
+{
+    uint32_t x1, x2;
+    uint32_t errcorr;
+    uint32_t index_frac;
+    real_t retval;
+    int32_t whole = (val >> REAL_BITS);
+
+    /* rest = [0..1] */
+    int32_t rest = val - (whole << REAL_BITS);
+
+    /* index into pow2_tab */
+    int32_t index = rest >> (REAL_BITS-TABLE_BITS);
+
+
+    if (val == 0)
+        return (1<<REAL_BITS);
+
+    /* leave INTERP_BITS bits */
+    index_frac = rest >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
+    index_frac = index_frac & ((1<<INTERP_BITS)-1);
 
-	t3   = t1 = __r1;   t4   = t2 = __r2;       // Parity calculation is done via table lookup, this is also available
-	t1  &= 0xF5;        t2 >>= 25;              // on CPUs without parity, can be implemented in C and avoid unpredictable
-	t1   = Parity [t1]; t2  &= 0x63;            // jumps and slow rotate through the carry flag operations.
-	t1 <<= 31;          t2   = Parity [t2];
+    if (whole > 0)
+    {
+        retval = 1 << whole;
+    } else {
+        retval = REAL_CONST(1) >> -whole;
+    }
+
+    x1 = pow2_tab[index & ((1<<TABLE_BITS)-1)];
+    x2 = pow2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
+    errcorr = ( (index_frac*(x2-x1))) >> INTERP_BITS;
+
+    if (whole > 0)
+    {
+        retval = retval * (errcorr + x1);
+    } else {
+        retval = MUL_R(retval, (errcorr + x1));
+    }
+
+    return retval;
+}
+
+int32_t pow2_int(real_t val)
+{
+    uint32_t x1, x2;
+    uint32_t errcorr;
+    uint32_t index_frac;
+    real_t retval;
+    int32_t whole = (val >> REAL_BITS);
+
+    /* rest = [0..1] */
+    int32_t rest = val - (whole << REAL_BITS);
+
+    /* index into pow2_tab */
+    int32_t index = rest >> (REAL_BITS-TABLE_BITS);
+
+
+    if (val == 0)
+        return 1;
+
+    /* leave INTERP_BITS bits */
+    index_frac = rest >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
+    index_frac = index_frac & ((1<<INTERP_BITS)-1);
+
+    if (whole > 0)
+        retval = 1 << whole;
+    else
+        retval = 0;
+
+    x1 = pow2_tab[index & ((1<<TABLE_BITS)-1)];
+    x2 = pow2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
+    errcorr = ( (index_frac*(x2-x1))) >> INTERP_BITS;
+
+    retval = MUL_R(retval, (errcorr + x1));
+
+    return retval;
+}
+
+/* ld(x) = ld(x*y/y) = ld(x/y) + ld(y), with y=2^N and [1 <= (x/y) < 2] */
+int32_t log2_int(uint32_t val)
+{
+    uint32_t frac;
+    uint32_t whole = (val);
+    int32_t exp = 0;
+    uint32_t index;
+    uint32_t index_frac;
+    uint32_t x1, x2;
+    uint32_t errcorr;
+
+    /* error */
+    if (val == 0)
+        return -10000;
 
-	return (__r1 = (t3 >> 1) | t1 ) ^ (__r2 = (t4 + t4) | t2 );
+    exp = floor_log2(val);
+    exp -= REAL_BITS;
+
+    /* frac = [1..2] */
+    if (exp >= 0)
+        frac = val >> exp;
+    else
+        frac = val << -exp;
+
+    /* index in the log2 table */
+    index = frac >> (REAL_BITS-TABLE_BITS);
+
+    /* leftover part for linear interpolation */
+    index_frac = frac & ((1<<(REAL_BITS-TABLE_BITS))-1);
+
+    /* leave INTERP_BITS bits */
+    index_frac = index_frac >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
+
+    x1 = log2_tab[index & ((1<<TABLE_BITS)-1)];
+    x2 = log2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
+
+    /* linear interpolation */
+    /* retval = exp + ((index_frac)*x2 + (1-index_frac)*x1) */
+
+    errcorr = (index_frac * (x2-x1)) >> INTERP_BITS;
+
+    return ((exp+REAL_BITS) << REAL_BITS) + errcorr + x1;
 }
+
+/* ld(x) = ld(x*y/y) = ld(x/y) + ld(y), with y=2^N and [1 <= (x/y) < 2] */
+real_t log2_fix(uint32_t val)
+{
+    uint32_t frac;
+    uint32_t whole = (val >> REAL_BITS);
+    int8_t exp = 0;
+    uint32_t index;
+    uint32_t index_frac;
+    uint32_t x1, x2;
+    uint32_t errcorr;
+
+    /* error */
+    if (val == 0)
+        return -100000;
+
+    exp = floor_log2(val);
+    exp -= REAL_BITS;
+
+    /* frac = [1..2] */
+    if (exp >= 0)
+        frac = val >> exp;
+    else
+        frac = val << -exp;
+
+    /* index in the log2 table */
+    index = frac >> (REAL_BITS-TABLE_BITS);
+
+    /* leftover part for linear interpolation */
+    index_frac = frac & ((1<<(REAL_BITS-TABLE_BITS))-1);
+
+    /* leave INTERP_BITS bits */
+    index_frac = index_frac >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
+
+    x1 = log2_tab[index & ((1<<TABLE_BITS)-1)];
+    x2 = log2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
+
+    /* linear interpolation */
+    /* retval = exp + ((index_frac)*x2 + (1-index_frac)*x1) */
+
+    errcorr = (index_frac * (x2-x1)) >> INTERP_BITS;
+
+    return (exp << REAL_BITS) + errcorr + x1;
+}
+#endif
--- a/Plugins/Input/aac/libfaad2/common.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/common.h	Wed May 10 14:44:20 2006 -0700
@@ -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.50 2004/02/06 12:55:24 menno Exp $
+** $Id: common.h,v 1.65 2004/09/08 09:43:11 gcp Exp $
 **/
 
 #ifndef __COMMON_H__
@@ -32,8 +32,12 @@
 extern "C" {
 #endif
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #define INLINE __inline
-#if defined(_WIN32) && !defined(_WIN32_WCE)
+#if 0 //defined(_WIN32) && !defined(_WIN32_WCE)
 #define ALIGN __declspec(align(16))
 #else
 #define ALIGN
@@ -52,6 +56,10 @@
 /* #define USE_DOUBLE_PRECISION */
 /* use fixed point reals */
 //#define FIXED_POINT
+//#define BIG_IQ_TABLE
+
+/* Use if target platform has address generators with autoincrement */
+//#define PREFER_POINTERS
 
 #ifdef _WIN32_WCE
 #define FIXED_POINT
@@ -88,9 +96,10 @@
 #define ALLOW_SMALL_FRAMELENGTH
 
 
-// Define LC_ONLY_DECODER if you want a pure AAC LC decoder (independant of SBR_DEC)
+// Define LC_ONLY_DECODER if you want a pure AAC LC decoder (independant of SBR_DEC and PS_DEC)
 //#define LC_ONLY_DECODER
 #ifdef LC_ONLY_DECODER
+  #undef LD_DEC
   #undef LTP_DEC
   #undef MAIN_DEC
   #undef SSR_DEC
@@ -101,19 +110,13 @@
 
 #define SBR_DEC
 //#define SBR_LOW_POWER
-//#define PS_DEC
+#define PS_DEC
 
-/* FIXED POINT: No MAIN decoding, no SBR decoding */
+/* FIXED POINT: No MAIN decoding */
 #ifdef FIXED_POINT
 # ifdef MAIN_DEC
 #  undef MAIN_DEC
 # endif
-//# ifndef SBR_LOW_POWER
-//#  define SBR_LOW_POWER
-//# endif
-# ifdef SBR_DEC
-#  undef SBR_DEC
-# endif
 #endif // FIXED_POINT
 
 #ifdef DRM
@@ -122,17 +125,13 @@
 # endif
 #endif
 
-#if ((defined(_WIN32) && !defined(_WIN32_WCE)) /* || ((__GNUC__ >= 3) && defined(__i386__)) */ )
-#ifndef FIXED_POINT
-/* includes <xmmintrin.h> to enable SSE intrinsics */
-//#define USE_SSE
-#endif
-#endif
 
 #ifdef FIXED_POINT
-#define SBR_DIV(A, B) (((int64_t)A << REAL_BITS)/B)
+#define DIV_R(A, B) (((int64_t)A << REAL_BITS)/B)
+#define DIV_C(A, B) (((int64_t)A << COEF_BITS)/B)
 #else
-#define SBR_DIV(A, B) ((A)/(B))
+#define DIV_R(A, B) ((A)/(B))
+#define DIV_C(A, B) ((A)/(B))
 #endif
 
 #ifndef SBR_LOW_POWER
@@ -148,8 +147,9 @@
 
 /* END COMPILE TIME DEFINITIONS */
 
-#if defined(_WIN32)
+#if defined(_WIN32) && !defined(__MINGW32__)
 
+#include <stdlib.h>
 
 typedef unsigned __int64 uint64_t;
 typedef unsigned __int32 uint32_t;
@@ -164,10 +164,6 @@
 
 #else
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
-
 #include <stdio.h>
 #if HAVE_SYS_TYPES_H
 # include <sys/types.h>
@@ -268,22 +264,20 @@
 
   #define REAL_CONST(A) ((real_t)(A))
   #define COEF_CONST(A) ((real_t)(A))
+  #define Q2_CONST(A) ((real_t)(A))
   #define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */
 
 #else /* Normal floating point operation */
 
   typedef float real_t;
 
-#ifdef USE_SSE
-# include <xmmintrin.h>
-#endif
-
   #define MUL_R(A,B) ((A)*(B))
   #define MUL_C(A,B) ((A)*(B))
   #define MUL_F(A,B) ((A)*(B))
 
   #define REAL_CONST(A) ((real_t)(A))
   #define COEF_CONST(A) ((real_t)(A))
+  #define Q2_CONST(A) ((real_t)(A))
   #define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */
 
   /* Complex multiplication */
@@ -357,6 +351,16 @@
 /* common functions */
 uint8_t cpu_has_sse(void);
 uint32_t random_int(void);
+uint32_t ones32(uint32_t x);
+uint32_t floor_log2(uint32_t x);
+uint32_t wl_min_lzc(uint32_t x);
+#ifdef FIXED_POINT
+#define LOG2_MIN_INF REAL_CONST(-10000)
+int32_t log2_int(uint32_t val);
+int32_t log2_fix(uint32_t val);
+int32_t pow2_int(real_t val);
+real_t pow2_fix(real_t val);
+#endif
 uint8_t get_sr_index(const uint32_t samplerate);
 uint8_t max_pred_sfb(const uint8_t sr_index);
 uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type,
@@ -364,7 +368,7 @@
 uint32_t get_sample_rate(const uint8_t sr_index);
 int8_t can_decode_ot(const uint8_t object_type);
 
-void *faad_malloc(int32_t size);
+void *faad_malloc(size_t size);
 void faad_free(void *b);
 
 //#define PROFILE
--- a/Plugins/Input/aac/libfaad2/decoder.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/decoder.c	Wed May 10 14:44:20 2006 -0700
@@ -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.94 2004/02/04 20:07:24 menno Exp $
+** $Id: decoder.c,v 1.107 2004/09/08 09:43:11 gcp Exp $
 **/
 
 #include "common.h"
@@ -50,14 +50,21 @@
 uint16_t dbg_count;
 #endif
 
-int8_t* FAADAPI faacDecGetErrorMessage(uint8_t errcode)
+/* static function declarations */
+static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
+                              uint8_t *buffer, uint32_t buffer_size,
+                              void **sample_buffer, uint32_t sample_buffer_size);
+static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo);
+
+
+char* NEAACDECAPI NeAACDecGetErrorMessage(uint8_t errcode)
 {
     if (errcode >= NUM_ERROR_MESSAGES)
         return NULL;
     return err_msg[errcode];
 }
 
-uint32_t FAADAPI faacDecGetCapabilities(void)
+uint32_t NEAACDECAPI NeAACDecGetCapabilities(void)
 {
     uint32_t cap = 0;
 
@@ -83,15 +90,15 @@
     return cap;
 }
 
-faacDecHandle FAADAPI faacDecOpen(void)
+NeAACDecHandle NEAACDECAPI NeAACDecOpen(void)
 {
     uint8_t i;
-    faacDecHandle hDecoder = NULL;
+    NeAACDecHandle hDecoder = NULL;
 
-    if ((hDecoder = (faacDecHandle)faad_malloc(sizeof(faacDecStruct))) == NULL)
+    if ((hDecoder = (NeAACDecHandle)faad_malloc(sizeof(NeAACDecStruct))) == NULL)
         return NULL;
 
-    memset(hDecoder, 0, sizeof(faacDecStruct));
+    memset(hDecoder, 0, sizeof(NeAACDecStruct));
 
     hDecoder->config.outputFormat  = FAAD_FMT_16BIT;
     hDecoder->config.defObjectType = MAIN;
@@ -136,23 +143,14 @@
 
     hDecoder->drc = drc_init(REAL_CONST(1.0), REAL_CONST(1.0));
 
-#ifdef USE_SSE
-    if (cpu_has_sse())
-    {
-        hDecoder->apply_sf_func = apply_scalefactors_sse;
-    } else {
-        hDecoder->apply_sf_func = apply_scalefactors;
-    }
-#endif
-
     return hDecoder;
 }
 
-faacDecConfigurationPtr FAADAPI faacDecGetCurrentConfiguration(faacDecHandle hDecoder)
+NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder)
 {
     if (hDecoder)
     {
-        faacDecConfigurationPtr config = &(hDecoder->config);
+        NeAACDecConfigurationPtr config = &(hDecoder->config);
 
         return config;
     }
@@ -160,8 +158,8 @@
     return NULL;
 }
 
-uint8_t FAADAPI faacDecSetConfiguration(faacDecHandle hDecoder,
-                                    faacDecConfigurationPtr config)
+uint8_t NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
+                                             NeAACDecConfigurationPtr config)
 {
     if (hDecoder && config)
     {
@@ -176,12 +174,18 @@
         hDecoder->config.defSampleRate = config->defSampleRate;
 
         /* check output format */
-        if ((config->outputFormat < 1) || (config->outputFormat > 9))
+#ifdef FIXED_POINT
+        if ((config->outputFormat < 1) || (config->outputFormat > 4))
             return 0;
+#else
+        if ((config->outputFormat < 1) || (config->outputFormat > 5))
+            return 0;
+#endif
         hDecoder->config.outputFormat = config->outputFormat;
 
         if (config->downMatrix > 1)
-            hDecoder->config.downMatrix = config->downMatrix;
+            return 0;
+        hDecoder->config.downMatrix = config->downMatrix;
 
         /* OK */
         return 1;
@@ -190,9 +194,9 @@
     return 0;
 }
 
-int32_t FAADAPI faacDecInit(faacDecHandle hDecoder, uint8_t *buffer,
-                            uint32_t buffer_size,
-                            uint32_t *samplerate, uint8_t *channels)
+int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder, uint8_t *buffer,
+                                 uint32_t buffer_size,
+                                 uint32_t *samplerate, uint8_t *channels)
 {
     uint32_t bits = 0;
     bitfile ld;
@@ -255,12 +259,23 @@
     }
     hDecoder->channelConfiguration = *channels;
 
+#if (defined(PS_DEC) || defined(DRM_PS))
+    /* check if we have a mono file */
+    if (*channels == 1)
+    {
+        /* upMatrix to 2 channels for implicit signalling of PS */
+        *channels = 2;
+    }
+#endif
+
 #ifdef SBR_DEC
     /* implicit signalling */
     if (*samplerate <= 24000 && !(hDecoder->config.dontUpSampleImplicitSBR))
     {
         *samplerate *= 2;
         hDecoder->forceUpSampling = 1;
+    } else if (*samplerate > 24000 && !(hDecoder->config.dontUpSampleImplicitSBR)) {
+        hDecoder->downSampledSBR = 1;
     }
 #endif
 
@@ -284,9 +299,9 @@
 }
 
 /* Init the library using a DecoderSpecificInfo */
-int8_t FAADAPI faacDecInit2(faacDecHandle hDecoder, uint8_t *pBuffer,
-                            uint32_t SizeOfDecoderSpecificInfo,
-                            uint32_t *samplerate, uint8_t *channels)
+int8_t NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, uint8_t *pBuffer,
+                                 uint32_t SizeOfDecoderSpecificInfo,
+                                 uint32_t *samplerate, uint8_t *channels)
 {
     int8_t rc;
     mp4AudioSpecificConfig mp4ASC;
@@ -316,6 +331,14 @@
         *channels = hDecoder->pce.channels;
         hDecoder->pce_set = 1;
     }
+#if (defined(PS_DEC) || defined(DRM_PS))
+    /* check if we have a mono file */
+    if (*channels == 1)
+    {
+        /* upMatrix to 2 channels for implicit signalling of PS */
+        *channels = 2;
+    }
+#endif
     hDecoder->sf_index = mp4ASC.samplingFrequencyIndex;
     hDecoder->object_type = mp4ASC.objectTypeIndex;
 #ifdef ERROR_RESILIENCE
@@ -325,13 +348,14 @@
 #endif
 #ifdef SBR_DEC
     hDecoder->sbr_present_flag = mp4ASC.sbr_present_flag;
+    hDecoder->downSampledSBR = mp4ASC.downSampledSBR;
     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)
+    if (((hDecoder->sbr_present_flag == 1)&&(!hDecoder->downSampledSBR)) || hDecoder->forceUpSampling == 1)
     {
         hDecoder->sf_index = get_sr_index(mp4ASC.samplingFrequency / 2);
     }
@@ -366,100 +390,48 @@
 }
 
 #ifdef DRM
-int8_t FAADAPI faacDecInitDRM(faacDecHandle hDecoder, uint32_t samplerate,
-                              uint8_t channels)
+int8_t NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, uint32_t samplerate,
+                                   uint8_t channels)
 {
-    uint8_t i;
-
     if (hDecoder == NULL)
         return 1; /* error */
 
+    NeAACDecClose(*hDecoder);
+
+    *hDecoder = NeAACDecOpen();
+
     /* Special object type defined for DRM */
-    hDecoder->config.defObjectType = DRM_ER_LC;
+    (*hDecoder)->config.defObjectType = DRM_ER_LC;
 
-    hDecoder->config.defSampleRate = samplerate;
+    (*hDecoder)->config.defSampleRate = samplerate;
 #ifdef ERROR_RESILIENCE // This shoudl always be defined for DRM
-    hDecoder->aacSectionDataResilienceFlag = 1; /* VCB11 */
-    hDecoder->aacScalefactorDataResilienceFlag = 0; /* no RVLC */
-    hDecoder->aacSpectralDataResilienceFlag = 1; /* HCR */
+    (*hDecoder)->aacSectionDataResilienceFlag = 1; /* VCB11 */
+    (*hDecoder)->aacScalefactorDataResilienceFlag = 0; /* no RVLC */
+    (*hDecoder)->aacSpectralDataResilienceFlag = 1; /* HCR */
 #endif
-    hDecoder->frameLength = 960;
-    hDecoder->sf_index = get_sr_index(hDecoder->config.defSampleRate);
-    hDecoder->object_type = hDecoder->config.defObjectType;
+    (*hDecoder)->frameLength = 960;
+    (*hDecoder)->sf_index = get_sr_index((*hDecoder)->config.defSampleRate);
+    (*hDecoder)->object_type = (*hDecoder)->config.defObjectType;
 
     if ((channels == DRMCH_STEREO) || (channels == DRMCH_SBR_STEREO))
-        hDecoder->channelConfiguration = 2;
+        (*hDecoder)->channelConfiguration = 2;
     else
-        hDecoder->channelConfiguration = 1;
+        (*hDecoder)->channelConfiguration = 1;
 
 #ifdef SBR_DEC
-    if (channels == DRMCH_SBR_LC_STEREO)
-        hDecoder->lcstereo_flag = 1;
-    else
-        hDecoder->lcstereo_flag = 0;
-
     if ((channels == DRMCH_MONO) || (channels == DRMCH_STEREO))
-        hDecoder->sbr_present_flag = 0;
+        (*hDecoder)->sbr_present_flag = 0;
     else
-        hDecoder->sbr_present_flag = 1;
-
-    /* Reset sbr for new initialization */
-    sbrDecodeEnd(hDecoder->sbr[0]);
-    hDecoder->sbr[0] = NULL;
-#endif
-
-    if (hDecoder->fb) filter_bank_end(hDecoder->fb);
-    hDecoder->fb = NULL;
-
-    /* Take care of buffers */
-    if (hDecoder->sample_buffer) faad_free(hDecoder->sample_buffer);
-    hDecoder->sample_buffer = NULL;
-    hDecoder->alloced_channels = 0;
-
-    for (i = 0; i < MAX_CHANNELS; i++)
-    {
-        hDecoder->window_shape_prev[i] = 0;
+        (*hDecoder)->sbr_present_flag = 1;    
+#endif        
 
-        if (hDecoder->time_out[i]) faad_free(hDecoder->time_out[i]);
-        hDecoder->time_out[i] = NULL;
-        if (hDecoder->fb_intermed[i]) faad_free(hDecoder->fb_intermed[i]);
-        hDecoder->fb_intermed[i] = NULL;
-#ifdef SSR_DEC
-        if (hDecoder->ssr_overlap[i]) faad_free(hDecoder->ssr_overlap[i]);
-        hDecoder->ssr_overlap[i] = NULL;
-        if (hDecoder->prev_fmd[i]) faad_free(hDecoder->prev_fmd[i]);
-        hDecoder->prev_fmd[i] = NULL;
-#endif
-#ifdef MAIN_DEC
-        if (hDecoder->pred_stat[i]) faad_free(hDecoder->pred_stat[i]);
-        hDecoder->pred_stat[i] = NULL;
-#endif
-#ifdef LTP_DEC
-        hDecoder->ltp_lag[i] = 0;
-        if (hDecoder->lt_pred_stat[i]) faad_free(hDecoder->lt_pred_stat[i]);
-        hDecoder->lt_pred_stat[i] = NULL;
-#endif
-    }
-
-    for (i = 0; i < MAX_SYNTAX_ELEMENTS; i++)
-    {
-#ifdef SBR_DEC
-        if (hDecoder->sbr[i])
-            sbrDecodeEnd(hDecoder->sbr[i]);
-
-        hDecoder->sbr_alloced[i] = 0;
-#endif
-        hDecoder->element_alloced[i] = 0;
-        hDecoder->element_output_channels[i] = 0;
-    }
-
-    hDecoder->fb = filter_bank_init(hDecoder->frameLength);
+    (*hDecoder)->fb = filter_bank_init((*hDecoder)->frameLength);
 
     return 0;
 }
 #endif
 
-void FAADAPI faacDecClose(faacDecHandle hDecoder)
+void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder)
 {
     uint8_t i;
 
@@ -512,7 +484,7 @@
     if (hDecoder) faad_free(hDecoder);
 }
 
-void FAADAPI faacDecPostSeekReset(faacDecHandle hDecoder, int32_t frame)
+void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, int32_t frame)
 {
     if (hDecoder)
     {
@@ -523,7 +495,7 @@
     }
 }
 
-static void create_channel_config(faacDecHandle hDecoder, faacDecFrameInfo *hInfo)
+static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo)
 {
     hInfo->num_front_channels = 0;
     hInfo->num_side_channels = 0;
@@ -728,9 +700,31 @@
     }
 }
 
-void* FAADAPI faacDecDecode(faacDecHandle hDecoder,
-                            faacDecFrameInfo *hInfo,
-                            uint8_t *buffer, uint32_t buffer_size)
+void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
+                                 NeAACDecFrameInfo *hInfo,
+                                 uint8_t *buffer, uint32_t buffer_size)
+{
+    return aac_frame_decode(hDecoder, hInfo, buffer, buffer_size, NULL, 0);
+}
+
+void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
+                                  NeAACDecFrameInfo *hInfo,
+                                  uint8_t *buffer, uint32_t buffer_size,
+                                  void **sample_buffer, uint32_t sample_buffer_size)
+{
+    if ((sample_buffer == NULL) || (sample_buffer_size == 0))
+    {
+        hInfo->error = 27;
+        return NULL;
+    }
+
+    return aac_frame_decode(hDecoder, hInfo, buffer, buffer_size,
+        sample_buffer, sample_buffer_size);
+}
+
+static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
+                              uint8_t *buffer, uint32_t buffer_size,
+                              void **sample_buffer2, uint32_t sample_buffer_size)
 {
     uint8_t channels = 0;
     uint8_t output_channels = 0;
@@ -749,27 +743,49 @@
         return NULL;
     }
 
+#if 0
+    printf("%d\n", buffer_size*8);
+#endif
+
     frame_len = hDecoder->frameLength;
 
 
-    memset(hInfo, 0, sizeof(faacDecFrameInfo));
+    memset(hInfo, 0, sizeof(NeAACDecFrameInfo));
     memset(hDecoder->internal_channel, 0, MAX_CHANNELS*sizeof(hDecoder->internal_channel[0]));
 
     /* initialize the bitstream */
     faad_initbits(&ld, buffer, buffer_size);
 
+#if 0
+    {
+        int i;
+        for (i = 0; i < ((buffer_size+3)>>2); i++)
+        {
+            uint8_t *buf;
+            uint32_t temp = 0;
+            buf = faad_getbitbuffer(&ld, 32);
+            //temp = getdword((void*)buf);
+            temp = *((uint32_t*)buf);
+            printf("0x%.8X\n", temp);
+            free(buf);
+        }
+        faad_endbits(&ld);
+        faad_initbits(&ld, buffer, buffer_size);
+    }
+#endif
+
 #ifdef DRM
     if (hDecoder->object_type == DRM_ER_LC)
     {
         /* We do not support stereo right now */
-        if (hDecoder->channelConfiguration == 2)
+        if (0) //(hDecoder->channelConfiguration == 2)
         {
             hInfo->error = 8; // Throw CRC error
             goto error;
         }
 
         faad_getbits(&ld, 8
-            DEBUGVAR(1,1,"faacDecDecode(): skip CRC"));
+            DEBUGVAR(1,1,"NeAACDecDecode(): skip CRC"));
     }
 #endif
 
@@ -829,7 +845,7 @@
 
     if (!hDecoder->adts_header_present && !hDecoder->adif_header_present)
     {
-        if (channels != hDecoder->channelConfiguration)
+        if (hDecoder->channelConfiguration == 0)
             hDecoder->channelConfiguration = channels;
 
         if (channels == 8) /* 7.1 */
@@ -846,6 +862,17 @@
         output_channels = channels;
     }
 
+#if (defined(PS_DEC) || defined(DRM_PS))
+    hDecoder->upMatrix = 0;
+    /* check if we have a mono file */
+    if (output_channels == 1)
+    {
+        /* upMatrix to 2 channels for implicit signalling of PS */
+        hDecoder->upMatrix = 1;
+        output_channels = 2;
+    }
+#endif
+
     /* Make a channel configuration based on either a PCE or a channelConfiguration */
     create_channel_config(hDecoder, hInfo);
 
@@ -865,6 +892,9 @@
         hInfo->header_type = ADIF;
     if (hDecoder->adts_header_present)
         hInfo->header_type = ADTS;
+#if (defined(PS_DEC) || defined(DRM_PS))
+    hInfo->ps = hDecoder->ps_used_global;
+#endif
 
     /* check if frame has channel elements */
     if (channels == 0)
@@ -883,17 +913,32 @@
         };
         uint8_t stride = str[hDecoder->config.outputFormat-1];
 #ifdef SBR_DEC
-        if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+        if (((hDecoder->sbr_present_flag == 1)&&(!hDecoder->downSampledSBR)) || (hDecoder->forceUpSampling == 1))
+        {
             stride = 2 * stride;
+        }
 #endif
-        if (hDecoder->sample_buffer)
-            faad_free(hDecoder->sample_buffer);
-        hDecoder->sample_buffer = NULL;
-        hDecoder->sample_buffer = faad_malloc(frame_len*output_channels*stride);
+        /* check if we want to use internal sample_buffer */
+        if (sample_buffer_size == 0)
+        {
+            if (hDecoder->sample_buffer)
+                faad_free(hDecoder->sample_buffer);
+            hDecoder->sample_buffer = NULL;
+            hDecoder->sample_buffer = faad_malloc(frame_len*output_channels*stride);
+        } else if (sample_buffer_size < frame_len*output_channels*stride) {
+            /* provided sample buffer is not big enough */
+            hInfo->error = 27;
+            return NULL;
+        }
         hDecoder->alloced_channels = output_channels;
     }
 
-    sample_buffer = hDecoder->sample_buffer;
+    if (sample_buffer_size == 0)
+    {
+        sample_buffer = hDecoder->sample_buffer;
+    } else {
+        sample_buffer = *sample_buffer2;
+    }
 
 #ifdef SBR_DEC
     if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
@@ -901,9 +946,12 @@
         uint8_t ele;
 
         /* this data is different when SBR is used or when the data is upsampled */
-        frame_len *= 2;
-        hInfo->samples *= 2;
-        hInfo->samplerate *= 2;
+        if (!hDecoder->downSampledSBR)
+        {
+            frame_len *= 2;
+            hInfo->samples *= 2;
+            hInfo->samplerate *= 2;
+        }
 
         /* check if every element was provided with SBR data */
         for (ele = 0; ele < hDecoder->fr_ch_ele; ele++)
@@ -923,6 +971,10 @@
         } else {
             hInfo->sbr = NO_SBR_UPSAMPLED;
         }
+        if (hDecoder->downSampledSBR)
+        {
+            hInfo->sbr = SBR_DOWNSAMPLED;
+        }
     }
 #endif
 
--- a/Plugins/Input/aac/libfaad2/decoder.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/decoder.h	Wed May 10 14:44:20 2006 -0700
@@ -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.35 2004/01/05 14:05:11 menno Exp $
+** $Id: decoder.h,v 1.44 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __DECODER_H__
@@ -34,28 +34,22 @@
 
 #ifdef _WIN32
   #pragma pack(push, 8)
-  #ifndef FAADAPI
-    #define FAADAPI __cdecl
+  #ifndef NEAACDECAPI
+    #define NEAACDECAPI __cdecl
   #endif
 #else
-  #ifndef FAADAPI
-    #define FAADAPI
+  #ifndef NEAACDECAPI
+    #define NEAACDECAPI
   #endif
 #endif
 
-#include "bits.h"
-#include "syntax.h"
-#include "drc.h"
-#include "specrec.h"
-#include "filtbank.h"
-#include "ic_predict.h"
-
 
 /* library output formats */
 #define FAAD_FMT_16BIT  1
 #define FAAD_FMT_24BIT  2
 #define FAAD_FMT_32BIT  3
 #define FAAD_FMT_FLOAT  4
+#define FAAD_FMT_FIXED  FAAD_FMT_FLOAT
 #define FAAD_FMT_DOUBLE 5
 
 #define LC_DEC_CAP            (1<<0)
@@ -76,41 +70,46 @@
 #define LFE_CHANNEL          (9)
 #define UNKNOWN_CHANNEL      (0)
 
-int8_t* FAADAPI faacDecGetErrorMessage(uint8_t errcode);
+char* NEAACDECAPI NeAACDecGetErrorMessage(uint8_t errcode);
 
-uint32_t FAADAPI faacDecGetCapabilities(void);
+uint32_t NEAACDECAPI NeAACDecGetCapabilities(void);
 
-faacDecHandle FAADAPI faacDecOpen(void);
+NeAACDecHandle NEAACDECAPI NeAACDecOpen(void);
 
-faacDecConfigurationPtr FAADAPI faacDecGetCurrentConfiguration(faacDecHandle hDecoder);
+NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder);
 
-uint8_t FAADAPI faacDecSetConfiguration(faacDecHandle hDecoder,
-                                    faacDecConfigurationPtr config);
+uint8_t NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
+                                             NeAACDecConfigurationPtr config);
 
 /* Init the library based on info from the AAC file (ADTS/ADIF) */
-int32_t FAADAPI faacDecInit(faacDecHandle hDecoder,
-                            uint8_t *buffer,
-                            uint32_t buffer_size,
-                            uint32_t *samplerate,
-                            uint8_t *channels);
+int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder,
+                                 uint8_t *buffer,
+                                 uint32_t buffer_size,
+                                 uint32_t *samplerate,
+                                 uint8_t *channels);
 
 /* Init the library using a DecoderSpecificInfo */
-int8_t FAADAPI faacDecInit2(faacDecHandle hDecoder, uint8_t *pBuffer,
-                         uint32_t SizeOfDecoderSpecificInfo,
-                         uint32_t *samplerate, uint8_t *channels);
+int8_t NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, uint8_t *pBuffer,
+                                 uint32_t SizeOfDecoderSpecificInfo,
+                                 uint32_t *samplerate, uint8_t *channels);
 
 /* Init the library for DRM */
-int8_t FAADAPI faacDecInitDRM(faacDecHandle hDecoder, uint32_t samplerate,
-                              uint8_t channels);
+int8_t NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, uint32_t samplerate,
+                                   uint8_t channels);
 
-void FAADAPI faacDecClose(faacDecHandle hDecoder);
+void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder);
+
+void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, int32_t frame);
 
-void FAADAPI faacDecPostSeekReset(faacDecHandle hDecoder, int32_t frame);
+void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
+                                 NeAACDecFrameInfo *hInfo,
+                                 uint8_t *buffer,
+                                 uint32_t buffer_size);
 
-void* FAADAPI faacDecDecode(faacDecHandle hDecoder,
-                            faacDecFrameInfo *hInfo,
-                            uint8_t *buffer,
-                            uint32_t buffer_size);
+void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
+                                  NeAACDecFrameInfo *hInfo,
+                                  uint8_t *buffer, uint32_t buffer_size,
+                                  void **sample_buffer, uint32_t sample_buffer_size);
 
 #ifdef _WIN32
   #pragma pack(pop)
--- a/Plugins/Input/aac/libfaad2/drc.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/drc.c	Wed May 10 14:44:20 2006 -0700
@@ -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.21 2004/01/05 14:05:11 menno Exp $
+** $Id: drc.c,v 1.24 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
--- a/Plugins/Input/aac/libfaad2/drc.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/drc.h	Wed May 10 14:44:20 2006 -0700
@@ -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.15 2004/01/05 14:05:11 menno Exp $
+** $Id: drc.h,v 1.18 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __DRC_H__
--- a/Plugins/Input/aac/libfaad2/error.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/error.c	Wed May 10 14:44:20 2006 -0700
@@ -22,18 +22,18 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: error.c,v 1.21 2004/01/28 19:17:25 menno Exp $
+** $Id: error.c,v 1.28 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
 #include "error.h"
 
-int8_t *err_msg[] = {
+char *err_msg[] = {
     "No error",
     "Gain control not yet implemented",
     "Pulse coding not allowed in short blocks",
     "Invalid huffman codebook",
-    "Negative scalefactor found, should be impossible",
+    "Scalefactor out of range",
     "Unable to find ADTS syncword",
     "Channel coupling not yet implemented",
     "Channel configuration not allowed in error resilient frame",
@@ -54,6 +54,8 @@
     "Error in program_config_element",
     "First SBR frame is not the same as first AAC frame",
     "Unexpected fill element with SBR data",
-    "Not all elements were provided with SBR data"
+    "Not all elements were provided with SBR data",
+    "LTP decoding not available",
+    "Output data buffer too small"
 };
 
--- a/Plugins/Input/aac/libfaad2/error.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/error.h	Wed May 10 14:44:20 2006 -0700
@@ -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.16 2004/01/28 19:17:25 menno Exp $
+** $Id: error.h,v 1.22 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __ERROR_H__
@@ -32,8 +32,8 @@
 extern "C" {
 #endif
 
-#define NUM_ERROR_MESSAGES 26
-extern int8_t *err_msg[];
+#define NUM_ERROR_MESSAGES 28
+extern char *err_msg[];
 
 #ifdef __cplusplus
 }
--- a/Plugins/Input/aac/libfaad2/filtbank.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/filtbank.c	Wed May 10 14:44:20 2006 -0700
@@ -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.35 2004/01/13 14:24:10 menno Exp $
+** $Id: filtbank.c,v 1.41 2004/09/08 09:43:11 gcp Exp $
 **/
 
 #include "common.h"
@@ -87,15 +87,6 @@
     }
 #endif
 
-#ifdef USE_SSE
-    if (cpu_has_sse())
-    {
-        fb->if_func = ifilter_bank_sse;
-    } else {
-        fb->if_func = ifilter_bank;
-    }
-#endif
-
     return fb;
 }
 
@@ -140,30 +131,6 @@
 #endif
 }
 
-#ifdef USE_SSE
-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 = NULL;
-
-    switch (len)
-    {
-    case 2048:
-    case 1920:
-        mdct = fb->mdct2048;
-        break;
-    case 1024:
-    case 960:
-        mdct = fb->mdct1024;
-        break;
-    }
-
-    faad_imdct_sse(mdct, in_data, out_data);
-#else
-    faad_imdct_sse(fb->mdct2048, in_data, out_data);
-#endif
-}
-#endif
 
 #ifdef LTP_DEC
 static INLINE void mdct(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len)
@@ -215,134 +182,7 @@
     int64_t count = faad_get_ts();
 #endif
 
-#ifdef LD_DEC
-    if (object_type == LD)
-    {
-        window_long       = fb->ld_window[window_shape];
-        window_long_prev  = fb->ld_window[window_shape_prev];
-    } else {
-#endif
-        window_long       = fb->long_window[window_shape];
-        window_long_prev  = fb->long_window[window_shape_prev];
-        window_short      = fb->short_window[window_shape];
-        window_short_prev = fb->short_window[window_shape_prev];
-#ifdef LD_DEC
-    }
-#endif
-
-
-    switch (window_sequence)
-    {
-    case ONLY_LONG_SEQUENCE:
-        imdct_long(fb, freq_in, transf_buf, 2*nlong);
-        for (i = 0; i < nlong; i+=4)
-        {
-            time_out[i]   = overlap[i]   + MUL_F(transf_buf[i],window_long_prev[i]);
-            time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]);
-            time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]);
-            time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]);
-        }
-        for (i = 0; i < nlong; i+=4)
-        {
-            overlap[i]   = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]);
-            overlap[i+1] = MUL_F(transf_buf[nlong+i+1],window_long[nlong-2-i]);
-            overlap[i+2] = MUL_F(transf_buf[nlong+i+2],window_long[nlong-3-i]);
-            overlap[i+3] = MUL_F(transf_buf[nlong+i+3],window_long[nlong-4-i]);
-        }
-        break;
-
-    case LONG_START_SEQUENCE:
-        imdct_long(fb, freq_in, transf_buf, 2*nlong);
-        for (i = 0; i < nlong; i+=4)
-        {
-            time_out[i]   = overlap[i]   + MUL_F(transf_buf[i],window_long_prev[i]);
-            time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]);
-            time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]);
-            time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]);
-        }
-        for (i = 0; i < nflat_ls; i++)
-            overlap[i] = transf_buf[nlong+i];
-        for (i = 0; i < nshort; i++)
-            overlap[nflat_ls+i] = MUL_F(transf_buf[nlong+nflat_ls+i],window_short[nshort-i-1]);
-        for (i = 0; i < nflat_ls; i++)
-            overlap[nflat_ls+nshort+i] = 0;
-        break;
-
-    case EIGHT_SHORT_SEQUENCE:
-        faad_imdct(fb->mdct256, freq_in+0*nshort, transf_buf+2*nshort*0);
-        faad_imdct(fb->mdct256, freq_in+1*nshort, transf_buf+2*nshort*1);
-        faad_imdct(fb->mdct256, freq_in+2*nshort, transf_buf+2*nshort*2);
-        faad_imdct(fb->mdct256, freq_in+3*nshort, transf_buf+2*nshort*3);
-        faad_imdct(fb->mdct256, freq_in+4*nshort, transf_buf+2*nshort*4);
-        faad_imdct(fb->mdct256, freq_in+5*nshort, transf_buf+2*nshort*5);
-        faad_imdct(fb->mdct256, freq_in+6*nshort, transf_buf+2*nshort*6);
-        faad_imdct(fb->mdct256, freq_in+7*nshort, transf_buf+2*nshort*7);
-        for (i = 0; i < nflat_ls; i++)
-            time_out[i] = overlap[i];
-        for(i = 0; i < nshort; i++)
-        {
-            time_out[nflat_ls+         i] = overlap[nflat_ls+         i] + MUL_F(transf_buf[nshort*0+i],window_short_prev[i]);
-            time_out[nflat_ls+1*nshort+i] = overlap[nflat_ls+nshort*1+i] + MUL_F(transf_buf[nshort*1+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*2+i],window_short[i]);
-            time_out[nflat_ls+2*nshort+i] = overlap[nflat_ls+nshort*2+i] + MUL_F(transf_buf[nshort*3+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*4+i],window_short[i]);
-            time_out[nflat_ls+3*nshort+i] = overlap[nflat_ls+nshort*3+i] + MUL_F(transf_buf[nshort*5+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*6+i],window_short[i]);
-            if (i < trans)
-                time_out[nflat_ls+4*nshort+i] = overlap[nflat_ls+nshort*4+i] + MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]);
-        }
-        for(i = 0; i < nshort; i++)
-        {
-            if (i >= trans)
-                overlap[nflat_ls+4*nshort+i-nlong] = MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]);
-            overlap[nflat_ls+5*nshort+i-nlong] = MUL_F(transf_buf[nshort*9+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*10+i],window_short[i]);
-            overlap[nflat_ls+6*nshort+i-nlong] = MUL_F(transf_buf[nshort*11+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*12+i],window_short[i]);
-            overlap[nflat_ls+7*nshort+i-nlong] = MUL_F(transf_buf[nshort*13+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*14+i],window_short[i]);
-            overlap[nflat_ls+8*nshort+i-nlong] = MUL_F(transf_buf[nshort*15+i],window_short[nshort-1-i]);
-        }
-        for (i = 0; i < nflat_ls; i++)
-            overlap[nflat_ls+nshort+i] = 0;
-        break;
-
-    case LONG_STOP_SEQUENCE:
-        imdct_long(fb, freq_in, transf_buf, 2*nlong);
-        for (i = 0; i < nflat_ls; i++)
-            time_out[i] = overlap[i];
-        for (i = 0; i < nshort; i++)
-            time_out[nflat_ls+i] = overlap[nflat_ls+i] + MUL_F(transf_buf[nflat_ls+i],window_short_prev[i]);
-        for (i = 0; i < nflat_ls; i++)
-            time_out[nflat_ls+nshort+i] = overlap[nflat_ls+nshort+i] + transf_buf[nflat_ls+nshort+i];
-        for (i = 0; i < nlong; i++)
-            overlap[i] = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]);
-		break;
-    }
-
-#ifdef PROFILE
-    count = faad_get_ts() - count;
-    fb->cycles += count;
-#endif
-}
-
-#ifdef USE_SSE
-void ifilter_bank_sse(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
-                      uint8_t window_shape_prev, real_t *freq_in,
-                      real_t *time_out, uint8_t object_type, uint16_t frame_len)
-{
-    int16_t i;
-    ALIGN real_t transf_buf[2*1024] = {0};
-
-    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;
-    uint16_t trans = nshort/2;
-
-    uint16_t nflat_ls = (nlong-nshort)/2;
-
-#ifdef PROFILE
-    int64_t count = faad_get_ts();
-#endif
-
+    /* select windows of current frame and previous frame (Sine or KBD) */
 #ifdef LD_DEC
     if (object_type == LD)
     {
@@ -358,296 +198,137 @@
     }
 #endif
 
+#if 0
+    for (i = 0; i < 1024; i++)
+    {
+        printf("%d\n", freq_in[i]);
+    }
+#endif
+
+#if 0
+    printf("%d %d\n", window_sequence, window_shape);
+#endif
+
     switch (window_sequence)
     {
     case ONLY_LONG_SEQUENCE:
-        imdct_long_sse(fb, freq_in, transf_buf, 2*nlong);
+        /* perform iMDCT */
+        imdct_long(fb, freq_in, transf_buf, 2*nlong);
+
+        /* add second half output of previous frame to windowed output of current frame */
         for (i = 0; i < nlong; i+=4)
         {
-            __m128 m1, m2, m3, m4, m5, m6, m7, m8;
-
-            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]);
+            time_out[i]   = overlap[i]   + MUL_F(transf_buf[i],window_long_prev[i]);
+            time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]);
+            time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]);
+            time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]);
+        }
 
-            m4 = _mm_mul_ps(m1, m2);
-            m7 = _mm_shuffle_ps(m6, m6, _MM_SHUFFLE(0, 1, 2, 3));
-
-            m4 = _mm_add_ps(m4, m3);
-            m8 = _mm_mul_ps(m5, m7);
-
-            _mm_store_ps(&time_out[i], m4);
-            _mm_store_ps(&time_out[nlong+i], m8);
+        /* window the second half and save as overlap for next frame */
+        for (i = 0; i < nlong; i+=4)
+        {
+            overlap[i]   = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]);
+            overlap[i+1] = MUL_F(transf_buf[nlong+i+1],window_long[nlong-2-i]);
+            overlap[i+2] = MUL_F(transf_buf[nlong+i+2],window_long[nlong-3-i]);
+            overlap[i+3] = MUL_F(transf_buf[nlong+i+3],window_long[nlong-4-i]);
         }
         break;
 
     case LONG_START_SEQUENCE:
-        imdct_long_sse(fb, freq_in, transf_buf, 2*nlong);
+        /* perform iMDCT */
+        imdct_long(fb, freq_in, transf_buf, 2*nlong);
+
+        /* add second half output of previous frame to windowed output of current frame */
         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 m4 = _mm_mul_ps(m1, m2);
-            m4 = _mm_add_ps(m4, m3);
-
-            _mm_store_ps(&time_out[i], m4);
-        }
-        for (i = 0; i < nflat_ls; i+=4)
-        {
-            __m128 m1 = _mm_load_ps(&transf_buf[nlong+i]);
-            _mm_store_ps(&time_out[nlong+i], m1);
+            time_out[i]   = overlap[i]   + MUL_F(transf_buf[i],window_long_prev[i]);
+            time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]);
+            time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]);
+            time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]);
         }
-        for (i = 0; i < nshort; i+=4)
-        {
-            __m128 m1 = _mm_load_ps(&transf_buf[nlong+nflat_ls+i]);
-            __m128 m2 = _mm_load_ps(&window_short[nshort-4-i]);
-            __m128 m3, m4;
 
-            m3 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 1, 2, 3));
-
-            m4 = _mm_mul_ps(m1, m3);
-
-            _mm_store_ps(&time_out[nlong+nflat_ls+i], m4);
-        }
-        for (i = 0; i < nflat_ls; i+=4)
-        {
-            __m128 m1 = _mm_setzero_ps();
-            _mm_store_ps(&time_out[nlong+nflat_ls+nshort+i], m1);
-        }
+        /* window the second half and save as overlap for next frame */
+        /* construct second half window using padding with 1's and 0's */
+        for (i = 0; i < nflat_ls; i++)
+            overlap[i] = transf_buf[nlong+i];
+        for (i = 0; i < nshort; i++)
+            overlap[nflat_ls+i] = MUL_F(transf_buf[nlong+nflat_ls+i],window_short[nshort-i-1]);
+        for (i = 0; i < nflat_ls; i++)
+            overlap[nflat_ls+nshort+i] = 0;
         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]);
-        for (i = 0; i < nflat_ls; i+=4)
-        {
-            __m128 m1 = _mm_load_ps(&time_out[nlong+i]);
-            _mm_store_ps(&time_out[i], m1);
-        }
-        for (i = 0; i < nshort; i+=4)
-        {
-            __m128 m1 = _mm_load_ps(&transf_buf[nshort*0+i]);
-            __m128 m2 = _mm_load_ps(&window_short_prev[i]);
-            __m128 m3 = _mm_load_ps(&time_out[nlong+nflat_ls+i]);
-
-            __m128 m4 = _mm_mul_ps(m1, m2);
-            m4 = _mm_add_ps(m4, m3);
-
-            _mm_store_ps(&time_out[nflat_ls+i], m4);
-        }
-        for (i = 0; i < nshort; i+=4)
-        {
-            __m128 m1, m2, m3, m4, m5, m6, m7, m8;
-            m1 = _mm_load_ps(&transf_buf[nshort*1+i]);
-            m2 = _mm_load_ps(&window_short[nshort-4-i]);
-            m3 = _mm_load_ps(&time_out[nlong+nflat_ls+nshort*1+i]);
-            m6 = _mm_load_ps(&transf_buf[nshort*2+i]);
-            m7 = _mm_load_ps(&window_short[i]);
-
-            m5 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 1, 2, 3));
-
-            m4 = _mm_mul_ps(m1, m5);
-            m8 = _mm_mul_ps(m6, m7);
-            m4 = _mm_add_ps(m4, m3);
-            m4 = _mm_add_ps(m4, m8);
-
-            _mm_store_ps(&time_out[nflat_ls+1*nshort+i], m4);
-        }
-        for (i = 0; i < nshort; i+=4)
-        {
-            __m128 m1, m2, m3, m4, m5, m6, m7, m8;
-            m1 = _mm_load_ps(&transf_buf[nshort*3+i]);
-            m2 = _mm_load_ps(&window_short[nshort-4-i]);
-            m3 = _mm_load_ps(&time_out[nlong+nflat_ls+nshort*2+i]);
-            m6 = _mm_load_ps(&transf_buf[nshort*4+i]);
-            m7 = _mm_load_ps(&window_short[i]);
-
-            m5 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 1, 2, 3));
-
-            m4 = _mm_mul_ps(m1, m5);
-            m8 = _mm_mul_ps(m6, m7);
-            m4 = _mm_add_ps(m4, m3);
-            m4 = _mm_add_ps(m4, m8);
-
-            _mm_store_ps(&time_out[nflat_ls+2*nshort+i], m4);
-        }
-        for (i = 0; i < nshort; i+=4)
-        {
-            __m128 m1, m2, m3, m4, m5, m6, m7, m8;
-            m1 = _mm_load_ps(&transf_buf[nshort*5+i]);
-            m2 = _mm_load_ps(&window_short[nshort-4-i]);
-            m3 = _mm_load_ps(&time_out[nlong+nflat_ls+nshort*3+i]);
-            m6 = _mm_load_ps(&transf_buf[nshort*6+i]);
-            m7 = _mm_load_ps(&window_short[i]);
-
-            m5 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 1, 2, 3));
-
-            m4 = _mm_mul_ps(m1, m5);
-            m8 = _mm_mul_ps(m6, m7);
-            m4 = _mm_add_ps(m4, m3);
-            m4 = _mm_add_ps(m4, m8);
-
-            _mm_store_ps(&time_out[nflat_ls+3*nshort+i], m4);
-        }
-        for(i = 0; i < trans; i+=4)
-        {
-            __m128 m1, m2, m3, m4, m5, m6, m7, m8;
-            m1 = _mm_load_ps(&transf_buf[nshort*7+i]);
-            m2 = _mm_load_ps(&window_short[nshort-4-i]);
-            m3 = _mm_load_ps(&time_out[nlong+nflat_ls+nshort*4+i]);
-            m6 = _mm_load_ps(&transf_buf[nshort*8+i]);
-            m7 = _mm_load_ps(&window_short[i]);
-
-            m5 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 1, 2, 3));
+        /* perform iMDCT for each short block */
+        faad_imdct(fb->mdct256, freq_in+0*nshort, transf_buf+2*nshort*0);
+        faad_imdct(fb->mdct256, freq_in+1*nshort, transf_buf+2*nshort*1);
+        faad_imdct(fb->mdct256, freq_in+2*nshort, transf_buf+2*nshort*2);
+        faad_imdct(fb->mdct256, freq_in+3*nshort, transf_buf+2*nshort*3);
+        faad_imdct(fb->mdct256, freq_in+4*nshort, transf_buf+2*nshort*4);
+        faad_imdct(fb->mdct256, freq_in+5*nshort, transf_buf+2*nshort*5);
+        faad_imdct(fb->mdct256, freq_in+6*nshort, transf_buf+2*nshort*6);
+        faad_imdct(fb->mdct256, freq_in+7*nshort, transf_buf+2*nshort*7);
 
-            m4 = _mm_mul_ps(m1, m5);
-            m8 = _mm_mul_ps(m6, m7);
-            m4 = _mm_add_ps(m4, m3);
-            m4 = _mm_add_ps(m4, m8);
-
-            _mm_store_ps(&time_out[nflat_ls+4*nshort+i], m4);
-        }
-        for (i = trans; i < nshort; i+=4)
-        {
-            __m128 m1, m2, m3, m4, m5, m6, m7, m8;
-            m1 = _mm_load_ps(&transf_buf[nshort*7+i]);
-            m2 = _mm_load_ps(&window_short[nshort-4-i]);
-            m6 = _mm_load_ps(&transf_buf[nshort*8+i]);
-            m7 = _mm_load_ps(&window_short[i]);
-
-            m5 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 1, 2, 3));
-
-            m4 = _mm_mul_ps(m1, m5);
-            m8 = _mm_mul_ps(m6, m7);
-            m3 = _mm_add_ps(m4, m8);
-
-            _mm_store_ps(&time_out[nflat_ls+4*nshort+i], m3);
-        }
-        for (i = 0; i < nshort; i+=4)
-        {
-            __m128 m1, m2, m3, m4, m5, m6, m7, m8;
-            m1 = _mm_load_ps(&transf_buf[nshort*9+i]);
-            m2 = _mm_load_ps(&window_short[nshort-4-i]);
-            m6 = _mm_load_ps(&transf_buf[nshort*10+i]);
-            m7 = _mm_load_ps(&window_short[i]);
-
-            m5 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 1, 2, 3));
-
-            m4 = _mm_mul_ps(m1, m5);
-            m8 = _mm_mul_ps(m6, m7);
-            m3 = _mm_add_ps(m4, m8);
-
-            _mm_store_ps(&time_out[nflat_ls+5*nshort+i], m3);
-        }
-        for (i = 0; i < nshort; i+=4)
+        /* add second half output of previous frame to windowed output of current frame */
+        for (i = 0; i < nflat_ls; i++)
+            time_out[i] = overlap[i];
+        for(i = 0; i < nshort; i++)
         {
-            __m128 m1, m2, m3, m4, m5, m6, m7, m8;
-            m1 = _mm_load_ps(&transf_buf[nshort*11+i]);
-            m2 = _mm_load_ps(&window_short[nshort-4-i]);
-            m6 = _mm_load_ps(&transf_buf[nshort*12+i]);
-            m7 = _mm_load_ps(&window_short[i]);
-
-            m5 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 1, 2, 3));
-
-            m4 = _mm_mul_ps(m1, m5);
-            m8 = _mm_mul_ps(m6, m7);
-            m3 = _mm_add_ps(m4, m8);
-
-            _mm_store_ps(&time_out[nflat_ls+6*nshort+i], m3);
+            time_out[nflat_ls+         i] = overlap[nflat_ls+         i] + MUL_F(transf_buf[nshort*0+i],window_short_prev[i]);
+            time_out[nflat_ls+1*nshort+i] = overlap[nflat_ls+nshort*1+i] + MUL_F(transf_buf[nshort*1+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*2+i],window_short[i]);
+            time_out[nflat_ls+2*nshort+i] = overlap[nflat_ls+nshort*2+i] + MUL_F(transf_buf[nshort*3+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*4+i],window_short[i]);
+            time_out[nflat_ls+3*nshort+i] = overlap[nflat_ls+nshort*3+i] + MUL_F(transf_buf[nshort*5+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*6+i],window_short[i]);
+            if (i < trans)
+                time_out[nflat_ls+4*nshort+i] = overlap[nflat_ls+nshort*4+i] + MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]);
         }
-        for (i = 0; i < nshort; i+=4)
-        {
-            __m128 m1, m2, m3, m4, m5, m6, m7, m8;
-            m1 = _mm_load_ps(&transf_buf[nshort*13+i]);
-            m2 = _mm_load_ps(&window_short[nshort-4-i]);
-            m6 = _mm_load_ps(&transf_buf[nshort*14+i]);
-            m7 = _mm_load_ps(&window_short[i]);
-
-            m5 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 1, 2, 3));
 
-            m4 = _mm_mul_ps(m1, m5);
-            m8 = _mm_mul_ps(m6, m7);
-            m3 = _mm_add_ps(m4, m8);
-
-            _mm_store_ps(&time_out[nflat_ls+7*nshort+i], m3);
-        }
-        for (i = 0; i < nshort; i+=4)
+        /* window the second half and save as overlap for next frame */
+        for(i = 0; i < nshort; i++)
         {
-            __m128 m1, m2, m3, m5;
-            m1 = _mm_load_ps(&transf_buf[nshort*15+i]);
-            m2 = _mm_load_ps(&window_short[nshort-4-i]);
-
-            m5 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 1, 2, 3));
-
-            m3 = _mm_mul_ps(m1, m5);
-
-            _mm_store_ps(&time_out[nflat_ls+8*nshort+i], m3);
+            if (i >= trans)
+                overlap[nflat_ls+4*nshort+i-nlong] = MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]);
+            overlap[nflat_ls+5*nshort+i-nlong] = MUL_F(transf_buf[nshort*9+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*10+i],window_short[i]);
+            overlap[nflat_ls+6*nshort+i-nlong] = MUL_F(transf_buf[nshort*11+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*12+i],window_short[i]);
+            overlap[nflat_ls+7*nshort+i-nlong] = MUL_F(transf_buf[nshort*13+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*14+i],window_short[i]);
+            overlap[nflat_ls+8*nshort+i-nlong] = MUL_F(transf_buf[nshort*15+i],window_short[nshort-1-i]);
         }
-        for (i = 0; i < nflat_ls; i+=4)
-        {
-            __m128 m1 = _mm_setzero_ps();
-            _mm_store_ps(&time_out[nlong+nflat_ls+nshort+i], m1);
-        }
+        for (i = 0; i < nflat_ls; i++)
+            overlap[nflat_ls+nshort+i] = 0;
         break;
 
     case LONG_STOP_SEQUENCE:
-        imdct_long_sse(fb, freq_in, transf_buf, 2*nlong);
-        for (i = 0; i < nflat_ls; i+=4)
-        {
-            __m128 m1 = _mm_load_ps(&time_out[nlong+i]);
-            _mm_store_ps(&time_out[i], m1);
-        }
-        for (i = 0; i < nshort; i+=4)
-        {
-            __m128 m1 = _mm_load_ps(&transf_buf[nflat_ls+i]);
-            __m128 m2 = _mm_load_ps(&window_short_prev[i]);
-            __m128 m3 = _mm_load_ps(&time_out[nlong+nflat_ls+i]);
-
-            __m128 m4 = _mm_mul_ps(m1, m2);
-            m4 = _mm_add_ps(m4, m3);
+        /* perform iMDCT */
+        imdct_long(fb, freq_in, transf_buf, 2*nlong);
 
-            _mm_store_ps(&time_out[nflat_ls+i], m4);
-        }
-        for (i = 0; i < nflat_ls; i+=4)
-        {
-            __m128 m1 = _mm_load_ps(&transf_buf[nflat_ls+nshort+i]);
-            __m128 m2 = _mm_load_ps(&time_out[nlong+nflat_ls+nshort+i]);
-
-            __m128 m3 = _mm_add_ps(m1, m2);
+        /* add second half output of previous frame to windowed output of current frame */
+        /* construct first half window using padding with 1's and 0's */
+        for (i = 0; i < nflat_ls; i++)
+            time_out[i] = overlap[i];
+        for (i = 0; i < nshort; i++)
+            time_out[nflat_ls+i] = overlap[nflat_ls+i] + MUL_F(transf_buf[nflat_ls+i],window_short_prev[i]);
+        for (i = 0; i < nflat_ls; i++)
+            time_out[nflat_ls+nshort+i] = overlap[nflat_ls+nshort+i] + transf_buf[nflat_ls+nshort+i];
 
-            _mm_store_ps(&time_out[nflat_ls+nshort+i], m3);
-        }
-        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, m3);
-
-            _mm_store_ps(&time_out[nlong+i], m4);
-        }
+        /* window the second half and save as overlap for next frame */
+        for (i = 0; i < nlong; i++)
+            overlap[i] = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]);
 		break;
     }
 
+#if 0
+    for (i = 0; i < 1024; i++)
+    {
+        printf("%d\n", time_out[i]);
+        //printf("0x%.8X\n", time_out[i]);
+    }
+#endif
+
+
 #ifdef PROFILE
     count = faad_get_ts() - count;
     fb->cycles += count;
 #endif
 }
-#endif
+
 
 #ifdef LTP_DEC
 /* only works for LTP -> no overlapping, no short blocks */
--- a/Plugins/Input/aac/libfaad2/filtbank.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/filtbank.h	Wed May 10 14:44:20 2006 -0700
@@ -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.20 2004/01/13 14:24:10 menno Exp $
+** $Id: filtbank.h,v 1.23 2004/09/08 09:43:11 gcp Exp $
 **/
 
 #ifndef __FILTBANK_H__
@@ -52,12 +52,6 @@
                   real_t *time_out, real_t *overlap,
                   uint8_t object_type, uint16_t frame_len);
 
-#ifdef USE_SSE
-void ifilter_bank_sse(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
-                      uint8_t window_shape_prev, real_t *freq_in,
-                      real_t *time_out, uint8_t object_type, uint16_t frame_len);
-#endif
-
 #ifdef __cplusplus
 }
 #endif
--- a/Plugins/Input/aac/libfaad2/fixed.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/fixed.h	Wed May 10 14:44:20 2006 -0700
@@ -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.18 2004/01/28 19:17:25 menno Exp $
+** $Id: fixed.h,v 1.26 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __FIXED_H__
@@ -32,7 +32,7 @@
 extern "C" {
 #endif
 
-#ifdef _WIN32_WCE
+#if defined(_WIN32_WCE) && defined(_ARM_)
 #include <cmnintrin.h>
 #endif
 
@@ -53,6 +53,11 @@
 #define REAL_CONST(A) (((A) >= 0) ? ((real_t)((A)*(REAL_PRECISION)+0.5)) : ((real_t)((A)*(REAL_PRECISION)-0.5)))
 #define COEF_CONST(A) (((A) >= 0) ? ((real_t)((A)*(COEF_PRECISION)+0.5)) : ((real_t)((A)*(COEF_PRECISION)-0.5)))
 #define FRAC_CONST(A) (((A) == 1.00) ? ((real_t)FRAC_MAX) : (((A) >= 0) ? ((real_t)((A)*(FRAC_PRECISION)+0.5)) : ((real_t)((A)*(FRAC_PRECISION)-0.5))))
+//#define FRAC_CONST(A) (((A) >= 0) ? ((real_t)((A)*(FRAC_PRECISION)+0.5)) : ((real_t)((A)*(FRAC_PRECISION)-0.5)))
+
+#define Q2_BITS 22
+#define Q2_PRECISION (1 << Q2_BITS)
+#define Q2_CONST(A) (((A) >= 0) ? ((real_t)((A)*(Q2_PRECISION)+0.5)) : ((real_t)((A)*(Q2_PRECISION)-0.5)))
 
 #if defined(_WIN32) && !defined(_WIN32_WCE)
 
@@ -76,6 +81,34 @@
     }
 }
 
+static INLINE real_t MUL_Q2(real_t A, real_t B)
+{
+    _asm {
+        mov eax,A
+        imul B
+        shrd eax,edx,Q2_BITS
+    }
+}
+
+static INLINE real_t MUL_SHIFT6(real_t A, real_t B)
+{
+    _asm {
+        mov eax,A
+        imul B
+        shrd eax,edx,6
+    }
+}
+
+static INLINE real_t MUL_SHIFT23(real_t A, real_t B)
+{
+    _asm {
+        mov eax,A
+        imul B
+        shrd eax,edx,23
+    }
+}
+
+#if 1
 static INLINE real_t _MulHigh(real_t A, real_t B)
 {
     _asm {
@@ -98,6 +131,24 @@
     *y1 = (_MulHigh(x1, c1) + _MulHigh(x2, c2))<<(FRAC_SIZE-FRAC_BITS);
     *y2 = (_MulHigh(x2, c1) - _MulHigh(x1, c2))<<(FRAC_SIZE-FRAC_BITS);
 }
+#else
+static INLINE real_t MUL_F(real_t A, real_t B)
+{
+    _asm {
+        mov eax,A
+        imul B
+        shrd eax,edx,FRAC_BITS
+    }
+}
+
+/* Complex multiplication */
+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);
+}
+#endif
 
 #elif defined(__GNUC__) && defined (__arm__)
 
@@ -127,6 +178,21 @@
     return arm_mul(A, B, COEF_BITS);
 }
 
+static INLINE real_t MUL_Q2(real_t A, real_t B)
+{
+    return arm_mul(A, B, Q2_BITS);
+}
+
+static INLINE real_t MUL_SHIFT6(real_t A, real_t B)
+{
+    return arm_mul(A, B, 6);
+}
+
+static INLINE real_t MUL_SHIFT23(real_t A, real_t B)
+{
+    return arm_mul(A, B, 23);
+}
+
 static INLINE real_t _MulHigh(real_t x, real_t y)
 {
     uint32_t __lo;
@@ -167,16 +233,19 @@
   /* multiply with coef shift */
   #define MUL_C(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (COEF_BITS-1))) >> COEF_BITS)
   /* multiply with fractional shift */
-#ifndef _WIN32_WCE
-  #define _MulHigh(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_SIZE-1))) >> FRAC_SIZE)
-  #define MUL_F(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_BITS-1))) >> FRAC_BITS)
-#else
+#if defined(_WIN32_WCE) && defined(_ARM_)
   /* eVC for PocketPC has an intrinsic function that returns only the high 32 bits of a 32x32 bit multiply */
   static INLINE real_t MUL_F(real_t A, real_t B)
   {
       return _MulHigh(A,B) << (32-FRAC_BITS);
   }
+#else
+  #define _MulHigh(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_SIZE-1))) >> FRAC_SIZE)
+  #define MUL_F(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_BITS-1))) >> FRAC_BITS)
 #endif
+  #define MUL_Q2(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (Q2_BITS-1))) >> Q2_BITS)
+  #define MUL_SHIFT6(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (6-1))) >> 6)
+  #define MUL_SHIFT23(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (23-1))) >> 23)
 
 /* Complex multiplication */
 static INLINE void ComplexMult(real_t *y1, real_t *y2,
--- a/Plugins/Input/aac/libfaad2/hcr.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/hcr.c	Wed May 10 14:44:20 2006 -0700
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2002-2004 A. Kurpiers
+** Copyright (C) 2004 G.C. Pascutto, 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: hcr.c,v 1.13 2004/01/05 14:05:11 menno Exp $
+** $Id: hcr.c,v 1.18 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -31,295 +31,337 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "syntax.h"
 #include "specrec.h"
-#include "bits.h"
-#include "pulse.h"
-#include "analysis.h"
-#include "bits.h"
 #include "huffman.h"
 
-/* Implements the HCR11 tool as described in ISO/IEC 14496-3/Amd.1, 8.5.3.3 */
+/* ISO/IEC 14496-3/Amd.1 
+ * 8.5.3.3: Huffman Codeword Reordering for AAC spectral data (HCR) 
+ *
+ * HCR devides the spectral data in known fixed size segments, and 
+ * sorts it by the importance of the data. The importance is firstly 
+ * the (lower) position in the spectrum, and secondly the largest 
+ * value in the used codebook. 
+ * The most important data is written at the start of each segment
+ * (at known positions), the remaining data is interleaved inbetween, 
+ * with the writing direction alternating.
+ * Data length is not increased.
+*/
 
 #ifdef ERROR_RESILIENCE
 
-/* rewind len (max. 32) bits so that the MSB becomes LSB */
+/* 8.5.3.3.1 Pre-sorting */
+
+#define NUM_CB      6
+#define NUM_CB_ER   22
+#define MAX_CB      32
+#define VCB11_FIRST 16
+#define VCB11_LAST  31
 
-static uint32_t rewind_word( uint32_t W, uint8_t len)
-{
-    uint8_t i;
-    uint32_t tmp_W=0;
+static const uint8_t PreSortCB_STD[NUM_CB] = 
+    { 11, 9, 7, 5, 3, 1};
+
+static const uint8_t PreSortCB_ER[NUM_CB_ER] = 
+    { 11, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 9, 7, 5, 3, 1};
+
+/* 8.5.3.3.2 Derivation of segment width */
+
+static const uint8_t maxCwLen[MAX_CB] = {0, 11, 9, 20, 16, 13, 11, 14, 12, 17, 14, 49,
+    0, 0, 0, 0, 14, 17, 21, 21, 25, 25, 29, 29, 29, 29, 33, 33, 33, 37, 37, 41};
+
+#define segmentWidth(cb)    min(maxCwLen[cb], ics->length_of_longest_codeword)
 
-    for ( i=0; i<len; i++ )
-    {
-        tmp_W<<=1;
-        if (W & (1<<i)) tmp_W |= 1;
-    }
-    return tmp_W;
+/* bit-twiddling helpers */
+static const uint8_t  S[] = {1, 2, 4, 8, 16};    
+static const uint32_t B[] = {0x55555555, 0x33333333, 0x0F0F0F0F, 0x00FF00FF, 0x0000FFFF};
+
+typedef struct
+{
+    uint8_t     cb;
+    uint8_t     decoded;
+    uint16_t	sp_offset;
+    bits_t      bits;
+} codeword_t;
+
+/* rewind and reverse */
+/* 32 bit version */
+static uint32_t rewrev_word(uint32_t v, const uint8_t len)
+{  
+    /* 32 bit reverse */
+    v = ((v >> S[0]) & B[0]) | ((v << S[0]) & ~B[0]); 
+    v = ((v >> S[1]) & B[1]) | ((v << S[1]) & ~B[1]); 
+    v = ((v >> S[2]) & B[2]) | ((v << S[2]) & ~B[2]); 
+    v = ((v >> S[3]) & B[3]) | ((v << S[3]) & ~B[3]);
+    v = ((v >> S[4]) & B[4]) | ((v << S[4]) & ~B[4]);
+
+    /* shift off low bits */
+    v >>= (32 - len);
+
+    return v;
 }
 
-static void rewind_lword( uint32_t *highW, uint32_t *lowW, uint8_t len)
-{
-    uint32_t tmp_lW=0;
-
-    if (len > 32)
+/* 64 bit version */
+static void rewrev_lword(uint32_t *hi, uint32_t *lo, const uint8_t len)
+{   
+    if (len <= 32) {
+        *hi = 0;
+        *lo = rewrev_word(*lo, len);
+    } else
     {
-        tmp_lW = rewind_word( (*highW << (64-len)) | (*lowW >> (len-32)), 32);
-        *highW = rewind_word( *lowW << (64-len) , 32);
-        *lowW = tmp_lW;
-    } else {
-        *highW = 0;
-        *lowW = rewind_word( *lowW, len);
-    }
-}    
+        uint32_t t = *hi, v = *lo;
 
-/* Takes a codeword as stored in r, rewinds the remaining bits and stores it back */
-static void rewind_bits(bits_t * r)
-{
-    uint32_t hw, lw;
-
-    if (r->len == 0) return;
+        /* double 32 bit reverse */
+        v = ((v >> S[0]) & B[0]) | ((v << S[0]) & ~B[0]); 
+        t = ((t >> S[0]) & B[0]) | ((t << S[0]) & ~B[0]); 
+        v = ((v >> S[1]) & B[1]) | ((v << S[1]) & ~B[1]); 
+        t = ((t >> S[1]) & B[1]) | ((t << S[1]) & ~B[1]); 
+        v = ((v >> S[2]) & B[2]) | ((v << S[2]) & ~B[2]); 
+        t = ((t >> S[2]) & B[2]) | ((t << S[2]) & ~B[2]); 
+        v = ((v >> S[3]) & B[3]) | ((v << S[3]) & ~B[3]);
+        t = ((t >> S[3]) & B[3]) | ((t << S[3]) & ~B[3]);
+        v = ((v >> S[4]) & B[4]) | ((v << S[4]) & ~B[4]);                
+        t = ((t >> S[4]) & B[4]) | ((t << S[4]) & ~B[4]);
 
-    if (r->len >32)
-    {
-        lw = r->bufa;
-        hw = r->bufb & (0xFFFFFFFF >> (64 - r->len));
-        rewind_lword( &hw, &lw, r->len );
-        r->bufa = lw;
-        r->bufb = hw;
-
-    } else {
-        lw = showbits_hcr(r, r->len );
-        r->bufa = rewind_word( lw, r->len);
-        r->bufb = 0;
+        /* last 32<>32 bit swap is implicit below */
+        
+        /* shift off low bits (this is really only one 64 bit shift) */
+        *lo = (t >> (64 - len)) | (v << (len - 32));
+        *hi = v >> (64 - len);          
     }
 }
 
-/* takes codewords from a and b, concatenate them and store them in b */
-static void concat_bits( bits_t * a, bits_t * b)
+
+/* bits_t version */
+static void rewrev_bits(bits_t *bits)
 {
-    uint32_t	hwa, lwa, hwb, lwb;
+    if (bits->len == 0) return;
+    rewrev_lword(&bits->bufb, &bits->bufa,  bits->len);
+}
+
+
+/* merge bits of a to b */
+static void concat_bits(bits_t *b, bits_t *a)
+{
+    uint32_t bl, bh, al, ah;
 
     if (a->len == 0) return;
 
-    if (a->len >32)
+    al = a->bufa;
+    ah = a->bufb;
+    
+    if (b->len > 32)
     {
-        lwa = a->bufa;
-        hwa = a->bufb & (0xFFFFFFFF >> (64 - a->len));
+        /* maskoff superfluous high b bits */
+        bl = b->bufa;
+        bh = b->bufb & ((1 << (b->len-32)) - 1);
+        /* left shift a b->len bits */
+        ah = al << (b->len - 32);
+        al = 0;
     } else {
-        lwa = showbits_hcr(a, a->len );
-        hwa = 0;
-    }
-    if (b->len >=32) {
-        lwb = b->bufa;
-        hwb = (b->bufb & (0xFFFFFFFF >> (64 - b->len)) ) | ( lwa << (b->len - 32));
-    } else {
-        lwb = showbits_hcr(b, b->len ) | (lwa << (b->len));
-        hwb = (lwa >> (32 - b->len)) | (hwa << (b->len));
+        bl = b->bufa & ((1 << (b->len)) - 1);
+        bh = 0;   
+        ah = (ah << (b->len)) | (al >> (32 - b->len));
+        al = al << b->len;
     }
 
-    b->bufa = lwb;
-    b->bufb = hwb;
+    /* merge */
+    b->bufa = bl | al;
+    b->bufb = bh | ah;
+
     b->len += a->len;
 }
+     
+uint8_t is_good_cb(uint8_t this_CB, uint8_t this_sec_CB)
+{
+    /* only want spectral data CB's */
+    if ((this_sec_CB > ZERO_HCB && this_sec_CB <= ESC_HCB) || (this_sec_CB >= VCB11_FIRST && this_sec_CB <= VCB11_LAST))
+    {
+        if (this_CB < ESC_HCB)
+        {
+            /* normal codebook pairs */
+            return ((this_sec_CB == this_CB) || (this_sec_CB == this_CB + 1));
+        } else
+        {
+            /* escape codebook */
+            return (this_sec_CB == this_CB);
+        }
+    }
+    return 0;
+}
+                    
+void read_segment(bits_t *segment, uint8_t segwidth, bitfile *ld)
+{
+    segment->len = segwidth;
+
+     if (segwidth > 32)
+     {
+        segment->bufb = faad_getbits(ld, segwidth - 32);        
+        segment->bufa = faad_getbits(ld, 32);        
+
+    } else {
+        segment->bufa = faad_getbits(ld, segwidth);
+        segment->bufb = 0;        
+    }    
+}
 
-/* 8.5.3.3.1 */
-
-static const uint8_t PresortedCodebook_VCB11[] = { 11, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 9, 7, 5, 3, 1};
-static const uint8_t PresortedCodebook[] = { 11, 9, 7, 5, 3, 1};
-
-static const uint8_t maxCwLen[32] = {0, 11, 9, 20, 16, 13, 11, 14, 12, 17, 14, 49,
-    0, 0, 0, 0, 14, 17, 21, 21, 25, 25, 29, 29, 29, 29, 33, 33, 33, 37, 37, 41};
-
-typedef struct
+void fill_in_codeword(codeword_t *codeword, uint16_t index, uint16_t sp, uint8_t cb)
 {
-    bits_t		bits;
-    uint8_t		decoded;
-    uint16_t	sp_offset;
-    uint8_t		cb;
-} codeword_state;
+    codeword[index].sp_offset = sp;
+    codeword[index].cb = cb;
+    codeword[index].decoded = 0;
+    codeword[index].bits.len = 0;
+}
 
+uint8_t reordered_spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, 
+                                bitfile *ld, int16_t *spectral_data)
+{   
+    uint16_t PCWs_done;
+    uint16_t numberOfSegments, numberOfSets, numberOfCodewords;  
 
-#define segmentWidth( codebook )	min( maxCwLen[codebook], ics->length_of_longest_codeword )
-     
-uint8_t reordered_spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld,
-                                int16_t *spectral_data)
-{
+    codeword_t codeword[512];
+    bits_t segment[512];
+
     uint16_t sp_offset[8];
-    uint16_t g,i, presort;
-    uint16_t NrCodeWords=0, numberOfSegments=0, BitsRead=0;
-    uint8_t numberOfSets, set;
-    codeword_state Codewords[ 1024 ];	// FIXME max length? PCWs are not stored, so index is Codewordnr - numberOfSegments!, maybe malloc()?
-    bits_t	Segment[ 512 ];
-
-    uint8_t PCW_decoded=0;
-    uint16_t nshort = hDecoder->frameLength/8;
-
-
-    /*memset (spectral_data, 0, hDecoder->frameLength*sizeof(uint16_t));*/
+    uint16_t g, i, sortloop, set, bitsread;
+    uint8_t w_idx, sfb, this_CB, last_CB, this_sec_CB; 
+    
+    const uint16_t nshort = hDecoder->frameLength/8;
+    const uint16_t sp_data_len = ics->length_of_reordered_spectral_data;
+    
+    const uint8_t *PreSortCb;
 
-    if (ics->length_of_reordered_spectral_data == 0)
-        return 0; /* nothing to do */
+    /* no data (e.g. silence) */
+    if (sp_data_len == 0)
+        return 0;
 
-    /* if we have a corrupted bitstream this can happen... */
-    if ((ics->length_of_longest_codeword == 0) ||
-        (ics->length_of_reordered_spectral_data <
-        ics->length_of_longest_codeword) ||
-        (ics->max_sfb == 0))
-    {
-        return 10; /* this is not good... */
-    }
-
-    /* store the offset into the spectral data for all the window groups because we can't do it later */
+    /* since there is spectral data, at least one codeword has nonzero length */
+    if (ics->length_of_longest_codeword == 0)
+        return 10;
+    
+    if (sp_data_len < ics->length_of_longest_codeword)
+        return 10; 
 
     sp_offset[0] = 0;
-    for (g=1; g < ics->num_window_groups; g++)
+    for (g = 1; g < ics->num_window_groups; g++)
     {
         sp_offset[g] = sp_offset[g-1] + nshort*ics->window_group_length[g-1];
     }
 
-    /* All data is sorted according to the codebook used */        
-    for (presort = 0; presort < (hDecoder->aacSectionDataResilienceFlag ? 22 : 6); presort++)
-    {
-        uint8_t sfb;
-
-        /* next codebook that has to be processed according to presorting */
-        uint8_t nextCB = hDecoder->aacSectionDataResilienceFlag ? PresortedCodebook_VCB11[ presort ] : PresortedCodebook[ presort ];
+    PCWs_done = 0;
+    numberOfSegments = 0;
+    numberOfCodewords = 0;
+    bitsread = 0;
 
-        /* Data belonging to the same spectral unit and having the same codebook comes in consecutive codewords.
-           This is done by scanning all sfbs for possible codewords. For sfbs with more than 4 elements this has to be
-           repeated */
-
-        for (sfb=0; sfb<ics->max_sfb; sfb ++)
+    /* VCB11 code books in use */
+    if (hDecoder->aacSectionDataResilienceFlag)
+    {
+        PreSortCb = PreSortCB_ER;
+        last_CB = NUM_CB_ER;
+    } else
+    {
+        PreSortCb = PreSortCB_STD;
+        last_CB = NUM_CB;
+    }
+ 
+    /* step 1: decode PCW's (set 0), and stuff data in easier-to-use format */
+    for (sortloop = 0; sortloop < last_CB; sortloop++)
+    {
+        /* select codebook to process this pass */
+        this_CB = PreSortCb[sortloop];
+        
+        /* loop over sfbs */
+        for (sfb = 0; sfb < ics->max_sfb; sfb++)
         {
-            uint8_t sect_cb, w;
-
-            for (w=0; w< (ics->swb_offset[sfb+1] - ics->swb_offset[sfb]); w+=4)
+            /* loop over all in this sfb, 4 lines per loop */
+            for (w_idx = 0; 4*w_idx < (ics->swb_offset[sfb+1] - ics->swb_offset[sfb]); w_idx++)
             {
                 for(g = 0; g < ics->num_window_groups; g++)
                 {
                     for (i = 0; i < ics->num_sec[g]; i++)
                     {
-                        sect_cb = ics->sect_cb[g][i];
-
-                        if (
-                            /* process only sections that are due now */
-                            (( sect_cb == nextCB ) || (( nextCB < ESC_HCB ) && ( sect_cb == nextCB+1)) ) &&
-
-                            /* process only sfb's that are due now */
-                            ((ics->sect_start[g][i] <= sfb) && (ics->sect_end[g][i] > sfb))
-                            )
-                        {
-                            if ((sect_cb != ZERO_HCB) &&
-                                (sect_cb != NOISE_HCB) &&
-                                (sect_cb != INTENSITY_HCB) &&
-                                (sect_cb != INTENSITY_HCB2))
+                        /* check whether sfb used here is the one we want to process */
+                        if ((ics->sect_start[g][i] <= sfb) && (ics->sect_end[g][i] > sfb))
+                        {                            
+                            /* check whether codebook used here is the one we want to process */
+                            this_sec_CB = ics->sect_cb[g][i];
+                 
+                            if (is_good_cb(this_CB, this_sec_CB))                              
                             {
-                                uint8_t inc = (sect_cb < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN;
-                                uint16_t k;
-
-                                uint32_t	hw, lw;
-
-                                for  (k=0; (k < (4/inc)*ics->window_group_length[g]) &&
-                                    ( (k+w*ics->window_group_length[g]/inc) < (ics->sect_sfb_offset[g][sfb+1] - ics->sect_sfb_offset[g][sfb])); k++)
-                                {
-                                    uint16_t sp = sp_offset[g] + ics->sect_sfb_offset[g][sfb] + inc*(k+w*ics->window_group_length[g]/inc);
+                                /* precalculate some stuff */
+                                uint16_t sect_sfb_size = ics->sect_sfb_offset[g][sfb+1] - ics->sect_sfb_offset[g][sfb];
+                                uint8_t inc = (this_sec_CB < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN;
+                                uint16_t group_cws_count = (4*ics->window_group_length[g])/inc;
+                                uint8_t segwidth = segmentWidth(this_sec_CB);
+                                uint16_t cws;                                
 
-                                    if (!PCW_decoded)
-                                    {
-                                        /* if we haven't yet read until the end of the buffer, we can directly decode the so-called PCWs */
-                                        if ((BitsRead + segmentWidth( sect_cb ))<= ics->length_of_reordered_spectral_data)
-                                        {
-                                            Segment[ numberOfSegments ].len = segmentWidth( sect_cb );
+                                /* read codewords until end of sfb or end of window group (shouldn't only 1 trigger?) */                                 
+                                for (cws = 0; (cws < group_cws_count) && ((cws + w_idx*group_cws_count) < sect_sfb_size); cws++)
+                                {
+                                    uint16_t sp = sp_offset[g] + ics->sect_sfb_offset[g][sfb] + inc * (cws + w_idx*group_cws_count);                                   
 
-                                            if (segmentWidth( sect_cb ) > 32)
-                                            {
-                                                Segment[ numberOfSegments ].bufb = faad_showbits(ld, segmentWidth( sect_cb ) - 32);
-                                                faad_flushbits(ld, segmentWidth( sect_cb) - 32);
-                                                Segment[ numberOfSegments ].bufa = faad_showbits(ld, 32),
-                                                    faad_flushbits(ld, 32 );
+                                    /* read and decode PCW */
+                                    if (!PCWs_done)
+                                    {         
+                                        /* read in normal segments */
+                                        if (bitsread + segwidth <= sp_data_len)
+                                        {                                            
+                                            read_segment(&segment[numberOfSegments], segwidth, ld);                          
+                                            bitsread += segwidth;
+                                            
+                                            huffman_spectral_data_2(this_sec_CB, &segment[numberOfSegments], &spectral_data[sp]);                                            
 
-                                            } else {
-                                                Segment[ numberOfSegments ].bufa = faad_showbits(ld,  segmentWidth( sect_cb ));
-                                                Segment[ numberOfSegments ].bufb = 0;
-                                                faad_flushbits(ld, segmentWidth( sect_cb) );
-                                            }
-
-                                            huffman_spectral_data_2(sect_cb, &Segment[ numberOfSegments ], &spectral_data[sp]);
-
-                                            BitsRead += segmentWidth( sect_cb );
-
-                                            /* skip to next segment, but store left bits in new buffer */
-                                            rewind_bits( &Segment[ numberOfSegments ]);
+                                            /* keep leftover bits */
+                                            rewrev_bits(&segment[numberOfSegments]);
 
                                             numberOfSegments++;
                                         } else {
-
-                                            /* the last segment is extended until length_of_reordered_spectral_data */
-
-                                            if (BitsRead < ics->length_of_reordered_spectral_data)
-                                            {
-
-                                                uint8_t additional_bits = (ics->length_of_reordered_spectral_data - BitsRead);
+                                            /* remaining stuff after last segment, we unfortunately couldn't read
+                                               this in earlier because it might not fit in 64 bits. since we already
+                                               decoded (and removed) the PCW it is now guaranteed to fit */
+                                            if (bitsread < sp_data_len)
+                                            {                                                
+                                                const uint8_t additional_bits = sp_data_len - bitsread;                                               
 
-                                                if ( additional_bits > 32)
-                                                {
-                                                    hw = faad_showbits(ld, additional_bits - 32);
-                                                    faad_flushbits(ld, additional_bits - 32);
-                                                    lw = faad_showbits(ld, 32);
-                                                    faad_flushbits(ld, 32 );
-                                                } else {
-                                                    lw = faad_showbits(ld, additional_bits);
-                                                    hw = 0;
-                                                    faad_flushbits(ld, additional_bits );
-                                                }
-                                                rewind_lword( &hw, &lw, additional_bits + Segment[ numberOfSegments-1 ].len );
-                                                if (Segment[ numberOfSegments-1 ].len > 32)
+                                                read_segment(&segment[numberOfSegments], additional_bits, ld);                                                
+                                                segment[numberOfSegments].len += segment[numberOfSegments-1].len;
+                                                rewrev_bits(&segment[numberOfSegments]);                                               
+
+                                                if (segment[numberOfSegments-1].len > 32)
                                                 {
-                                                    Segment[ numberOfSegments-1 ].bufb = hw + 
-                                                        showbits_hcr(&Segment[ numberOfSegments-1 ], Segment[ numberOfSegments-1 ].len - 32);
-                                                    Segment[ numberOfSegments-1 ].bufa = lw + 
-                                                        showbits_hcr(&Segment[ numberOfSegments-1 ], 32);
+                                                    segment[numberOfSegments-1].bufb = segment[numberOfSegments].bufb + 
+                                                        showbits_hcr(&segment[numberOfSegments-1], segment[numberOfSegments-1].len - 32);
+                                                    segment[numberOfSegments-1].bufa = segment[numberOfSegments].bufa + 
+                                                        showbits_hcr(&segment[numberOfSegments-1], 32);
                                                 } else {
-                                                    Segment[ numberOfSegments-1 ].bufa = lw + 
-                                                        showbits_hcr(&Segment[ numberOfSegments-1 ], Segment[ numberOfSegments-1 ].len);
-                                                    Segment[ numberOfSegments-1 ].bufb = hw;
-                                                }
-                                                Segment[ numberOfSegments-1 ].len += additional_bits;
+                                                    segment[numberOfSegments-1].bufa = segment[numberOfSegments].bufa + 
+                                                        showbits_hcr(&segment[numberOfSegments-1], segment[numberOfSegments-1].len);
+                                                    segment[numberOfSegments-1].bufb = segment[numberOfSegments].bufb;
+                                                }                                                
+                                                segment[numberOfSegments-1].len += additional_bits;
                                             }
-                                            BitsRead = ics->length_of_reordered_spectral_data;
-                                            PCW_decoded = 1;
+                                            bitsread = sp_data_len;
+                                            PCWs_done = 1;
 
-                                            Codewords[ 0 ].sp_offset = sp;
-                                            Codewords[ 0 ].cb = sect_cb;
-                                            Codewords[ 0 ].decoded = 0;
-                                            Codewords[ 0 ].bits.len = 0;
+                                            fill_in_codeword(codeword, 0, sp, this_sec_CB);                                            
                                         }
-                                    } else {
-                                        Codewords[ NrCodeWords - numberOfSegments ].sp_offset = sp;
-                                        Codewords[ NrCodeWords - numberOfSegments ].cb = sect_cb;
-                                        Codewords[ NrCodeWords - numberOfSegments ].decoded = 0;
-                                        Codewords[ NrCodeWords - numberOfSegments ].bits.len = 0;
-
-                                    } /* PCW decoded */
-                                    NrCodeWords++;
-                                } /* of k */
+                                    } else {    
+                                        fill_in_codeword(codeword, numberOfCodewords - numberOfSegments, sp, this_sec_CB);                                         
+                                    }
+                                    numberOfCodewords++;
+                                }                             
                             }
                         }
-                    } /* of i */
-                 } /* of g */
-             } /* of w */
-         } /* of sfb */
-    } /* of presort */
+                    } 
+                 } 
+             }
+         }
+    }
 
-    /* Avoid divide by zero */
     if (numberOfSegments == 0)
-        return 10; /* this is not good... */
+        return 10; 
 
-    numberOfSets = NrCodeWords / numberOfSegments;     
+    numberOfSets = numberOfCodewords / numberOfSegments;     
 
-    /* second step: decode nonPCWs */
-
+    /* step 2: decode nonPCWs */
     for (set = 1; set <= numberOfSets; set++)
     {
         uint16_t trial;
@@ -327,85 +369,40 @@
         for (trial = 0; trial < numberOfSegments; trial++)
         {
             uint16_t codewordBase;
-            uint16_t set_decoded=numberOfSegments;
-
-            if (set == numberOfSets)
-                set_decoded = NrCodeWords - set*numberOfSegments;	/* last set is shorter than the rest */
 
             for (codewordBase = 0; codewordBase < numberOfSegments; codewordBase++)
             {
-                uint16_t segment_index = (trial + codewordBase) % numberOfSegments;
-                uint16_t codeword_index = codewordBase + set*numberOfSegments - numberOfSegments;
-
-                if ((codeword_index + numberOfSegments) >= NrCodeWords)
-                    break;
-                if (!Codewords[ codeword_index ].decoded)
-                {
-                    if ( Segment[ segment_index ].len > 0)
-                    {
-                        uint8_t tmplen;
+                const uint16_t segment_idx = (trial + codewordBase) % numberOfSegments;
+                const uint16_t codeword_idx = codewordBase + set*numberOfSegments - numberOfSegments;
 
-                        if (Codewords[ codeword_index ].bits.len != 0)
-                        {
-                            /* on the first trial the data is only stored in Segment[], not in Codewords[]. 
-                               On next trials first collect the data stored for this codeword and
-                               concatenate the new data from Segment[] */
+                /* data up */
+                if (codeword_idx >= numberOfCodewords - numberOfSegments) break;
 
-                            concat_bits( &Codewords[ codeword_index ].bits, &Segment[ segment_index ]);                            
-                            /* Now everthing is stored in Segment[] */
-                        }
-                        tmplen = Segment[ segment_index ].len;
-                        if ( huffman_spectral_data_2(Codewords[ codeword_index ].cb, &Segment[ segment_index ],
-                            &spectral_data[ Codewords[ codeword_index ].sp_offset ]) >=0)
-                        {
-                            /* CW did fit into segment */
-
-                            Codewords[ codeword_index ].decoded = 1;
-                            set_decoded--;
-                        } else {
-
-                            /* CW did not fit, so store for later use */
+                if (!codeword[codeword_idx].decoded && segment[segment_idx].len > 0)
+                {
+                    uint8_t tmplen;
 
-                            Codewords[ codeword_index ].bits.len = tmplen;
-                            Codewords[ codeword_index ].bits.bufa = Segment[ segment_index ].bufa;
-                            Codewords[ codeword_index ].bits.bufb = Segment[ segment_index ].bufb;
-                        }
-                    }                        
-                }
-            } /* of codewordBase */
-
-            if (set_decoded == 0) break;	/* no undecoded codewords left in this set */
-
-        } /* of trial */
+                    if (codeword[codeword_idx].bits.len != 0)                   
+                        concat_bits(&segment[segment_idx], &codeword[codeword_idx].bits);                            
+                    
+                    tmplen = segment[segment_idx].len;
 
-        /* rewind all bits in remaining segments with len>0 */
-        for (i=0; i < numberOfSegments; i++)
-            rewind_bits( &Segment[ i ] );
-    }
-
-#if 0
-    {
-        int i, r=0, c=0;
-        for (i=0; i< numberOfSegments; i++)
-            r += Segment[ i ].len;
-        if (r != 0)
-        {
-            printf("reordered_spectral_data: %d bits remaining!\n", r);
-        }
-        for (i=0; i< NrCodeWords - numberOfSegments; i++)
-        {
-            if (Codewords[ i ].decoded == 0)
-            {
-                c++;
+                    if (huffman_spectral_data_2(codeword[codeword_idx].cb, &segment[segment_idx],
+                                               &spectral_data[codeword[codeword_idx].sp_offset]) >= 0)
+                    {
+                        codeword[codeword_idx].decoded = 1;
+                    } else 
+                    {   
+                        codeword[codeword_idx].bits = segment[segment_idx];
+                        codeword[codeword_idx].bits.len = tmplen;                        
+                    }
+                                            
+                }
             }
         }
-        if (c != 0)
-        {
-            printf("reordered_spectral_data: %d Undecoded Codewords remaining!\n",c );
-        }
-        if ((r !=0) || (c!=0))	return 10;
+        for (i = 0; i < numberOfSegments; i++)
+            rewrev_bits(&segment[i]);
     }
-#endif
 
     return 0;
 }
--- a/Plugins/Input/aac/libfaad2/huffman.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/huffman.c	Wed May 10 14:44:20 2006 -0700
@@ -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.18 2004/02/04 19:55:02 menno Exp $
+** $Id: huffman.c,v 1.22 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -50,6 +50,7 @@
 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);
+static void vcb11_check_LAV(uint8_t cb, int16_t *sp);
 
 int8_t huffman_scale_factor(bitfile *ld)
 {
@@ -120,8 +121,8 @@
 static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp)
 {
     uint8_t neg, i;
-    int32_t j;
-	int32_t off;
+    int16_t j;
+	int16_t off;
 
     if (sp < 0)
     {
@@ -143,7 +144,7 @@
         }
     }
 
-    off = faad_getbits(ld, i
+    off = (int16_t)faad_getbits(ld, i
         DEBUGVAR(1,9,"huffman_getescape(): escape"));
 
     j = off | (1<<i);
@@ -310,6 +311,26 @@
     else        return (int16_t)data & 0xFFFF;
 }
 
+static void vcb11_check_LAV(uint8_t cb, int16_t *sp)
+{
+    static const uint16_t vcb11_LAV_tab[] = {
+        16, 31, 47, 63, 95, 127, 159, 191, 223,
+        255, 319, 383, 511, 767, 1023, 2047
+    };
+    uint16_t max = 0;
+
+    if (cb < 16 || cb > 31)
+        return;
+
+    max = vcb11_LAV_tab[cb - 16];
+
+    if ((abs(sp[0]) > max) || (abs(sp[1]) > max))
+    {
+        sp[0] = 0;
+        sp[1] = 0;
+    }
+}
+
 uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp)
 {
     switch (cb)
@@ -336,18 +357,28 @@
         sp[0] = huffman_codebook(0); sp[1] = huffman_codebook(1); 
         return err; }
     case 11:
-#ifdef ERROR_RESILIENCE
-    /* VCB11 uses codebook 11 */
-    case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23:
-    case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31:
-        /* TODO: If ER is used, some extra error checking should be done */
-#endif
     {
         uint8_t err = huffman_2step_pair_sign(11, ld, sp);
         sp[0] = huffman_getescape(ld, sp[0]);
         sp[1] = huffman_getescape(ld, sp[1]);
         return err;
     }
+#ifdef ERROR_RESILIENCE
+    /* VCB11 uses codebook 11 */
+    case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23:
+    case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31:
+    {
+        uint8_t err = huffman_2step_pair_sign(11, ld, sp);
+        sp[0] = huffman_getescape(ld, sp[0]);
+        sp[1] = huffman_getescape(ld, sp[1]);
+
+        /* check LAV (Largest Absolute Value) */
+        /* this finds errors in the ESCAPE signal */
+        vcb11_check_LAV(cb, sp);
+
+        return err;
+    }
+#endif
     default:
         /* Non existent codebook number, something went wrong */
         return 11;
@@ -369,7 +400,7 @@
     uint32_t cw;
     uint16_t offset = 0;
     uint8_t extra_bits;
-    uint8_t i;
+    uint8_t i, vcb11 = 0;
 
 
     switch (cb)
@@ -406,9 +437,12 @@
     case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23:
     case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31:
 
-        /* TODO: If ER is used, some extra error checking should be done */
         if (cb >= 16)
+        {
+            /* store the virtual codebook */
+            vcb11 = cb;
             cb = 11;
+        }
             
         cw = showbits_hcr(ld, hcbN[cb]);
         offset = hcb_table[cb][cw].offset;
@@ -463,8 +497,8 @@
     }
 
 	/* decode sign bits */
-    if (unsigned_cb[cb]) {
-
+    if (unsigned_cb[cb])
+    {
         for(i = 0; i < ((cb < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN); i++)
         {
             if(sp[i])
@@ -500,13 +534,20 @@
                     if (b == 0)
                         break;
                 }
-// TODO: here we would need to test "off" if VCB11 is used!
+
                 if (getbits_hcr(ld, i, &off))
                     return -1;
                 j = off + (1<<i);
                 sp[k] = (int16_t)((neg) ? -j : j);
             }
         }
+
+        if (vcb11 != 0)
+        {
+            /* check LAV (Largest Absolute Value) */
+            /* this finds errors in the ESCAPE signal */
+            vcb11_check_LAV(vcb11, sp);
+        }
     }    
     return ld->len;
 }
--- a/Plugins/Input/aac/libfaad2/huffman.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/huffman.h	Wed May 10 14:44:20 2006 -0700
@@ -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.21 2004/01/05 14:05:12 menno Exp $
+** $Id: huffman.h,v 1.24 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __HUFFMAN_H__
--- a/Plugins/Input/aac/libfaad2/ic_predict.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/ic_predict.h	Wed May 10 14:44:20 2006 -0700
@@ -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.16 2004/01/05 14:05:12 menno Exp $
+** $Id: ic_predict.h,v 1.19 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifdef MAIN_DEC
--- a/Plugins/Input/aac/libfaad2/iq_table.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/iq_table.h	Wed May 10 14:44:20 2006 -0700
@@ -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.12 2004/01/05 14:05:12 menno Exp $
+** $Id: iq_table.h,v 1.16 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef IQ_TABLE_H__
@@ -8243,7 +8243,11 @@
 
 #else
 
+#ifdef BIG_IQ_TABLE
+#define IQ_TABLE_SIZE  8192
+#else
 #define IQ_TABLE_SIZE  1026
+#endif
 
 ALIGN static const real_t iq_table[IQ_TABLE_SIZE] =
 {
@@ -9273,6 +9277,7174 @@
     REAL_CONST(10307.836270711066/8.0),
     REAL_CONST(10321.273240738796/8.0),
     REAL_CONST(10334.71458549278/8.0)
+#ifdef BIG_IQ_TABLE
+   ,REAL_CONST(10348.160302127204/8.0),
+    REAL_CONST(10361.610387800878/8.0),
+    REAL_CONST(10375.064839677221/8.0),
+    REAL_CONST(10388.523654924258/8.0),
+    REAL_CONST(10401.986830714593/8.0),
+    REAL_CONST(10415.454364225412/8.0),
+    REAL_CONST(10428.926252638465/8.0),
+    REAL_CONST(10442.402493140049/8.0),
+    REAL_CONST(10455.883082921007/8.0),
+    REAL_CONST(10469.368019176709/8.0),
+    REAL_CONST(10482.85729910704/8.0),
+    REAL_CONST(10496.350919916393/8.0),
+    REAL_CONST(10509.848878813653/8.0),
+    REAL_CONST(10523.351173012188/8.0),
+    REAL_CONST(10536.857799729838/8.0),
+    REAL_CONST(10550.3687561889/8.0),
+    REAL_CONST(10563.884039616123/8.0),
+    REAL_CONST(10577.403647242685/8.0),
+    REAL_CONST(10590.927576304197/8.0),
+    REAL_CONST(10604.455824040679/8.0),
+    REAL_CONST(10617.988387696556/8.0),
+    REAL_CONST(10631.525264520642/8.0),
+    REAL_CONST(10645.066451766135/8.0),
+    REAL_CONST(10658.611946690598/8.0),
+    REAL_CONST(10672.161746555956/8.0),
+    REAL_CONST(10685.715848628475/8.0),
+    REAL_CONST(10699.274250178762/8.0),
+    REAL_CONST(10712.836948481747/8.0),
+    REAL_CONST(10726.403940816675/8.0),
+    REAL_CONST(10739.975224467091/8.0),
+    REAL_CONST(10753.550796720834/8.0),
+    REAL_CONST(10767.130654870027/8.0),
+    REAL_CONST(10780.714796211059/8.0),
+    REAL_CONST(10794.303218044579/8.0),
+    REAL_CONST(10807.895917675487/8.0),
+    REAL_CONST(10821.492892412922/8.0),
+    REAL_CONST(10835.094139570248/8.0),
+    REAL_CONST(10848.699656465047/8.0),
+    REAL_CONST(10862.309440419107/8.0),
+    REAL_CONST(10875.923488758415/8.0),
+    REAL_CONST(10889.541798813138/8.0),
+    REAL_CONST(10903.16436791762/8.0),
+    REAL_CONST(10916.791193410372/8.0),
+    REAL_CONST(10930.422272634056/8.0),
+    REAL_CONST(10944.05760293548/8.0),
+    REAL_CONST(10957.697181665582/8.0),
+    REAL_CONST(10971.341006179427/8.0),
+    REAL_CONST(10984.98907383619/8.0),
+    REAL_CONST(10998.641381999149/8.0),
+    REAL_CONST(11012.297928035676/8.0),
+    REAL_CONST(11025.958709317223/8.0),
+    REAL_CONST(11039.623723219316/8.0),
+    REAL_CONST(11053.292967121541/8.0),
+    REAL_CONST(11066.966438407539/8.0),
+    REAL_CONST(11080.64413446499/8.0),
+    REAL_CONST(11094.326052685608/8.0),
+    REAL_CONST(11108.012190465128/8.0),
+    REAL_CONST(11121.702545203296/8.0),
+    REAL_CONST(11135.397114303863/8.0),
+    REAL_CONST(11149.095895174571/8.0),
+    REAL_CONST(11162.798885227143/8.0),
+    REAL_CONST(11176.506081877278/8.0),
+    REAL_CONST(11190.217482544635/8.0),
+    REAL_CONST(11203.933084652828/8.0),
+    REAL_CONST(11217.652885629415/8.0),
+    REAL_CONST(11231.376882905886/8.0),
+    REAL_CONST(11245.105073917659/8.0),
+    REAL_CONST(11258.837456104062/8.0),
+    REAL_CONST(11272.574026908333/8.0),
+    REAL_CONST(11286.314783777601/8.0),
+    REAL_CONST(11300.059724162888/8.0),
+    REAL_CONST(11313.808845519083/8.0),
+    REAL_CONST(11327.562145304952/8.0),
+    REAL_CONST(11341.319620983111/8.0),
+    REAL_CONST(11355.081270020033/8.0),
+    REAL_CONST(11368.847089886023/8.0),
+    REAL_CONST(11382.617078055218/8.0),
+    REAL_CONST(11396.391232005579/8.0),
+    REAL_CONST(11410.169549218874/8.0),
+    REAL_CONST(11423.952027180676/8.0),
+    REAL_CONST(11437.738663380349/8.0),
+    REAL_CONST(11451.529455311042/8.0),
+    REAL_CONST(11465.324400469679/8.0),
+    REAL_CONST(11479.123496356951/8.0),
+    REAL_CONST(11492.926740477304/8.0),
+    REAL_CONST(11506.734130338931/8.0),
+    REAL_CONST(11520.545663453764/8.0),
+    REAL_CONST(11534.361337337466/8.0),
+    REAL_CONST(11548.181149509423/8.0),
+    REAL_CONST(11562.005097492724/8.0),
+    REAL_CONST(11575.83317881417/8.0),
+    REAL_CONST(11589.665391004253/8.0),
+    REAL_CONST(11603.501731597149/8.0),
+    REAL_CONST(11617.342198130715/8.0),
+    REAL_CONST(11631.186788146468/8.0),
+    REAL_CONST(11645.035499189589/8.0),
+    REAL_CONST(11658.888328808911/8.0),
+    REAL_CONST(11672.745274556904/8.0),
+    REAL_CONST(11686.606333989675/8.0),
+    REAL_CONST(11700.471504666955/8.0),
+    REAL_CONST(11714.340784152086/8.0),
+    REAL_CONST(11728.214170012021/8.0),
+    REAL_CONST(11742.091659817312/8.0),
+    REAL_CONST(11755.973251142101/8.0),
+    REAL_CONST(11769.858941564111/8.0),
+    REAL_CONST(11783.748728664636/8.0),
+    REAL_CONST(11797.642610028539/8.0),
+    REAL_CONST(11811.540583244237/8.0),
+    REAL_CONST(11825.442645903697/8.0),
+    REAL_CONST(11839.34879560242/8.0),
+    REAL_CONST(11853.259029939445/8.0),
+    REAL_CONST(11867.173346517333/8.0),
+    REAL_CONST(11881.091742942155/8.0),
+    REAL_CONST(11895.014216823492/8.0),
+    REAL_CONST(11908.940765774427/8.0),
+    REAL_CONST(11922.871387411526/8.0),
+    REAL_CONST(11936.806079354839/8.0),
+    REAL_CONST(11950.744839227897/8.0),
+    REAL_CONST(11964.687664657684/8.0),
+    REAL_CONST(11978.634553274653/8.0),
+    REAL_CONST(11992.585502712702/8.0),
+    REAL_CONST(12006.540510609168/8.0),
+    REAL_CONST(12020.499574604828/8.0),
+    REAL_CONST(12034.462692343877/8.0),
+    REAL_CONST(12048.429861473938/8.0),
+    REAL_CONST(12062.401079646032/8.0),
+    REAL_CONST(12076.376344514589/8.0),
+    REAL_CONST(12090.355653737433/8.0),
+    REAL_CONST(12104.339004975769/8.0),
+    REAL_CONST(12118.326395894188/8.0),
+    REAL_CONST(12132.317824160644/8.0),
+    REAL_CONST(12146.313287446457/8.0),
+    REAL_CONST(12160.312783426305/8.0),
+    REAL_CONST(12174.316309778205/8.0),
+    REAL_CONST(12188.323864183525/8.0),
+    REAL_CONST(12202.335444326955/8.0),
+    REAL_CONST(12216.351047896511/8.0),
+    REAL_CONST(12230.370672583531/8.0),
+    REAL_CONST(12244.394316082657/8.0),
+    REAL_CONST(12258.421976091831/8.0),
+    REAL_CONST(12272.453650312296/8.0),
+    REAL_CONST(12286.489336448574/8.0),
+    REAL_CONST(12300.529032208471/8.0),
+    REAL_CONST(12314.572735303058/8.0),
+    REAL_CONST(12328.620443446678/8.0),
+    REAL_CONST(12342.672154356922/8.0),
+    REAL_CONST(12356.727865754638/8.0),
+    REAL_CONST(12370.787575363909/8.0),
+    REAL_CONST(12384.851280912055/8.0),
+    REAL_CONST(12398.918980129623/8.0),
+    REAL_CONST(12412.990670750381/8.0),
+    REAL_CONST(12427.066350511306/8.0),
+    REAL_CONST(12441.146017152583/8.0),
+    REAL_CONST(12455.229668417589/8.0),
+    REAL_CONST(12469.317302052901/8.0),
+    REAL_CONST(12483.40891580827/8.0),
+    REAL_CONST(12497.50450743663/8.0),
+    REAL_CONST(12511.604074694078/8.0),
+    REAL_CONST(12525.707615339878/8.0),
+    REAL_CONST(12539.815127136444/8.0),
+    REAL_CONST(12553.926607849342/8.0),
+    REAL_CONST(12568.042055247275/8.0),
+    REAL_CONST(12582.161467102082/8.0),
+    REAL_CONST(12596.284841188726/8.0),
+    REAL_CONST(12610.41217528529/8.0),
+    REAL_CONST(12624.543467172971/8.0),
+    REAL_CONST(12638.678714636069/8.0),
+    REAL_CONST(12652.817915461985/8.0),
+    REAL_CONST(12666.961067441209/8.0),
+    REAL_CONST(12681.108168367316/8.0),
+    REAL_CONST(12695.259216036962/8.0),
+    REAL_CONST(12709.414208249869/8.0),
+    REAL_CONST(12723.573142808827/8.0),
+    REAL_CONST(12737.736017519681/8.0),
+    REAL_CONST(12751.902830191326/8.0),
+    REAL_CONST(12766.073578635704/8.0),
+    REAL_CONST(12780.248260667788/8.0),
+    REAL_CONST(12794.426874105588/8.0),
+    REAL_CONST(12808.609416770132/8.0),
+    REAL_CONST(12822.795886485468/8.0),
+    REAL_CONST(12836.986281078653/8.0),
+    REAL_CONST(12851.180598379744/8.0),
+    REAL_CONST(12865.378836221802/8.0),
+    REAL_CONST(12879.580992440871/8.0),
+    REAL_CONST(12893.787064875984/8.0),
+    REAL_CONST(12907.997051369144/8.0),
+    REAL_CONST(12922.210949765335/8.0),
+    REAL_CONST(12936.428757912496/8.0),
+    REAL_CONST(12950.650473661524/8.0),
+    REAL_CONST(12964.876094866273/8.0),
+    REAL_CONST(12979.105619383534/8.0),
+    REAL_CONST(12993.339045073039/8.0),
+    REAL_CONST(13007.576369797454/8.0),
+    REAL_CONST(13021.817591422368/8.0),
+    REAL_CONST(13036.062707816285/8.0),
+    REAL_CONST(13050.311716850629/8.0),
+    REAL_CONST(13064.564616399723/8.0),
+    REAL_CONST(13078.821404340792/8.0),
+    REAL_CONST(13093.082078553954/8.0),
+    REAL_CONST(13107.346636922217/8.0),
+    REAL_CONST(13121.615077331464/8.0),
+    REAL_CONST(13135.887397670458/8.0),
+    REAL_CONST(13150.163595830827/8.0),
+    REAL_CONST(13164.44366970706/8.0),
+    REAL_CONST(13178.727617196502/8.0),
+    REAL_CONST(13193.015436199352/8.0),
+    REAL_CONST(13207.307124618648/8.0),
+    REAL_CONST(13221.602680360265/8.0),
+    REAL_CONST(13235.902101332911/8.0),
+    REAL_CONST(13250.205385448118/8.0),
+    REAL_CONST(13264.512530620239/8.0),
+    REAL_CONST(13278.823534766434/8.0),
+    REAL_CONST(13293.138395806676/8.0),
+    REAL_CONST(13307.457111663734/8.0),
+    REAL_CONST(13321.779680263176/8.0),
+    REAL_CONST(13336.106099533356/8.0),
+    REAL_CONST(13350.436367405409/8.0),
+    REAL_CONST(13364.77048181325/8.0),
+    REAL_CONST(13379.108440693562/8.0),
+    REAL_CONST(13393.450241985796/8.0),
+    REAL_CONST(13407.795883632158/8.0),
+    REAL_CONST(13422.145363577607/8.0),
+    REAL_CONST(13436.498679769853/8.0),
+    REAL_CONST(13450.855830159346/8.0),
+    REAL_CONST(13465.216812699266/8.0),
+    REAL_CONST(13479.581625345529/8.0),
+    REAL_CONST(13493.950266056772/8.0),
+    REAL_CONST(13508.32273279435/8.0),
+    REAL_CONST(13522.699023522329/8.0),
+    REAL_CONST(13537.079136207483/8.0),
+    REAL_CONST(13551.463068819286/8.0),
+    REAL_CONST(13565.850819329906/8.0),
+    REAL_CONST(13580.2423857142/8.0),
+    REAL_CONST(13594.63776594971/8.0),
+    REAL_CONST(13609.036958016657/8.0),
+    REAL_CONST(13623.439959897927/8.0),
+    REAL_CONST(13637.846769579081/8.0),
+    REAL_CONST(13652.257385048335/8.0),
+    REAL_CONST(13666.67180429656/8.0),
+    REAL_CONST(13681.090025317284/8.0),
+    REAL_CONST(13695.512046106669/8.0),
+    REAL_CONST(13709.937864663521/8.0),
+    REAL_CONST(13724.367478989278/8.0),
+    REAL_CONST(13738.800887088004/8.0),
+    REAL_CONST(13753.238086966385/8.0),
+    REAL_CONST(13767.679076633727/8.0),
+    REAL_CONST(13782.123854101939/8.0),
+    REAL_CONST(13796.572417385545/8.0),
+    REAL_CONST(13811.024764501659/8.0),
+    REAL_CONST(13825.480893469998/8.0),
+    REAL_CONST(13839.94080231286/8.0),
+    REAL_CONST(13854.404489055134/8.0),
+    REAL_CONST(13868.871951724283/8.0),
+    REAL_CONST(13883.34318835034/8.0),
+    REAL_CONST(13897.818196965914/8.0),
+    REAL_CONST(13912.296975606168/8.0),
+    REAL_CONST(13926.779522308825/8.0),
+    REAL_CONST(13941.26583511416/8.0),
+    REAL_CONST(13955.755912064991/8.0),
+    REAL_CONST(13970.249751206682/8.0),
+    REAL_CONST(13984.747350587126/8.0),
+    REAL_CONST(13999.248708256751/8.0),
+    REAL_CONST(14013.753822268511/8.0),
+    REAL_CONST(14028.262690677873/8.0),
+    REAL_CONST(14042.775311542828/8.0),
+    REAL_CONST(14057.291682923867/8.0),
+    REAL_CONST(14071.811802883994/8.0),
+    REAL_CONST(14086.335669488704/8.0),
+    REAL_CONST(14100.863280805994/8.0),
+    REAL_CONST(14115.394634906341/8.0),
+    REAL_CONST(14129.92972986271/8.0),
+    REAL_CONST(14144.468563750548/8.0),
+    REAL_CONST(14159.01113464777/8.0),
+    REAL_CONST(14173.55744063476/8.0),
+    REAL_CONST(14188.107479794369/8.0),
+    REAL_CONST(14202.661250211901/8.0),
+    REAL_CONST(14217.218749975118/8.0),
+    REAL_CONST(14231.779977174227/8.0),
+    REAL_CONST(14246.344929901879/8.0),
+    REAL_CONST(14260.913606253163/8.0),
+    REAL_CONST(14275.486004325601/8.0),
+    REAL_CONST(14290.062122219146/8.0),
+    REAL_CONST(14304.641958036171/8.0),
+    REAL_CONST(14319.225509881464/8.0),
+    REAL_CONST(14333.812775862236/8.0),
+    REAL_CONST(14348.403754088098/8.0),
+    REAL_CONST(14362.998442671067/8.0),
+    REAL_CONST(14377.59683972556/8.0),
+    REAL_CONST(14392.198943368388/8.0),
+    REAL_CONST(14406.804751718748/8.0),
+    REAL_CONST(14421.414262898223/8.0),
+    REAL_CONST(14436.027475030774/8.0),
+    REAL_CONST(14450.64438624274/8.0),
+    REAL_CONST(14465.264994662828/8.0),
+    REAL_CONST(14479.889298422106/8.0),
+    REAL_CONST(14494.517295654005/8.0),
+    REAL_CONST(14509.148984494313/8.0),
+    REAL_CONST(14523.784363081166/8.0),
+    REAL_CONST(14538.423429555049/8.0),
+    REAL_CONST(14553.066182058781/8.0),
+    REAL_CONST(14567.712618737527/8.0),
+    REAL_CONST(14582.362737738777/8.0),
+    REAL_CONST(14597.016537212348/8.0),
+    REAL_CONST(14611.674015310382/8.0),
+    REAL_CONST(14626.33517018734/8.0),
+    REAL_CONST(14640.999999999993/8.0),
+    REAL_CONST(14655.668502907418/8.0),
+    REAL_CONST(14670.340677071003/8.0),
+    REAL_CONST(14685.016520654426/8.0),
+    REAL_CONST(14699.696031823671/8.0),
+    REAL_CONST(14714.379208746999/8.0),
+    REAL_CONST(14729.066049594967/8.0),
+    REAL_CONST(14743.756552540408/8.0),
+    REAL_CONST(14758.45071575843/8.0),
+    REAL_CONST(14773.148537426418/8.0),
+    REAL_CONST(14787.850015724018/8.0),
+    REAL_CONST(14802.555148833142/8.0),
+    REAL_CONST(14817.263934937961/8.0),
+    REAL_CONST(14831.976372224897/8.0),
+    REAL_CONST(14846.692458882624/8.0),
+    REAL_CONST(14861.41219310206/8.0),
+    REAL_CONST(14876.135573076363/8.0),
+    REAL_CONST(14890.862597000923/8.0),
+    REAL_CONST(14905.593263073371/8.0),
+    REAL_CONST(14920.327569493558/8.0),
+    REAL_CONST(14935.065514463557/8.0),
+    REAL_CONST(14949.807096187662/8.0),
+    REAL_CONST(14964.552312872382/8.0),
+    REAL_CONST(14979.301162726431/8.0),
+    REAL_CONST(14994.053643960735/8.0),
+    REAL_CONST(15008.809754788414/8.0),
+    REAL_CONST(15023.569493424788/8.0),
+    REAL_CONST(15038.332858087369/8.0),
+    REAL_CONST(15053.099846995858/8.0),
+    REAL_CONST(15067.870458372134/8.0),
+    REAL_CONST(15082.644690440264/8.0),
+    REAL_CONST(15097.422541426484/8.0),
+    REAL_CONST(15112.204009559202/8.0),
+    REAL_CONST(15126.989093068994/8.0),
+    REAL_CONST(15141.777790188597/8.0),
+    REAL_CONST(15156.570099152905/8.0),
+    REAL_CONST(15171.366018198967/8.0),
+    REAL_CONST(15186.165545565986/8.0),
+    REAL_CONST(15200.968679495301/8.0),
+    REAL_CONST(15215.775418230402/8.0),
+    REAL_CONST(15230.585760016909/8.0),
+    REAL_CONST(15245.399703102579/8.0),
+    REAL_CONST(15260.217245737298/8.0),
+    REAL_CONST(15275.038386173073/8.0),
+    REAL_CONST(15289.863122664035/8.0),
+    REAL_CONST(15304.691453466432/8.0),
+    REAL_CONST(15319.523376838621/8.0),
+    REAL_CONST(15334.358891041069/8.0),
+    REAL_CONST(15349.197994336346/8.0),
+    REAL_CONST(15364.040684989128/8.0),
+    REAL_CONST(15378.886961266177/8.0),
+    REAL_CONST(15393.736821436356/8.0),
+    REAL_CONST(15408.590263770609/8.0),
+    REAL_CONST(15423.447286541972/8.0),
+    REAL_CONST(15438.307888025554/8.0),
+    REAL_CONST(15453.172066498542/8.0),
+    REAL_CONST(15468.039820240196/8.0),
+    REAL_CONST(15482.91114753184/8.0),
+    REAL_CONST(15497.786046656869/8.0),
+    REAL_CONST(15512.664515900733/8.0),
+    REAL_CONST(15527.546553550939/8.0),
+    REAL_CONST(15542.432157897045/8.0),
+    REAL_CONST(15557.32132723066/8.0),
+    REAL_CONST(15572.214059845435/8.0),
+    REAL_CONST(15587.110354037064/8.0),
+    REAL_CONST(15602.010208103273/8.0),
+    REAL_CONST(15616.913620343823/8.0),
+    REAL_CONST(15631.820589060506/8.0),
+    REAL_CONST(15646.731112557136/8.0),
+    REAL_CONST(15661.645189139546/8.0),
+    REAL_CONST(15676.562817115593/8.0),
+    REAL_CONST(15691.483994795139/8.0),
+    REAL_CONST(15706.408720490062/8.0),
+    REAL_CONST(15721.336992514242/8.0),
+    REAL_CONST(15736.268809183561/8.0),
+    REAL_CONST(15751.204168815901/8.0),
+    REAL_CONST(15766.143069731135/8.0),
+    REAL_CONST(15781.085510251132/8.0),
+    REAL_CONST(15796.03148869974/8.0),
+    REAL_CONST(15810.981003402798/8.0),
+    REAL_CONST(15825.934052688119/8.0),
+    REAL_CONST(15840.890634885489/8.0),
+    REAL_CONST(15855.850748326673/8.0),
+    REAL_CONST(15870.814391345401/8.0),
+    REAL_CONST(15885.781562277361/8.0),
+    REAL_CONST(15900.752259460214/8.0),
+    REAL_CONST(15915.726481233565/8.0),
+    REAL_CONST(15930.704225938984/8.0),
+    REAL_CONST(15945.685491919978/8.0),
+    REAL_CONST(15960.670277522009/8.0),
+    REAL_CONST(15975.658581092481/8.0),
+    REAL_CONST(15990.65040098073/8.0),
+    REAL_CONST(16005.645735538035/8.0),
+    REAL_CONST(16020.644583117599/8.0),
+    REAL_CONST(16035.646942074556/8.0),
+    REAL_CONST(16050.652810765967/8.0),
+    REAL_CONST(16065.662187550806/8.0),
+    REAL_CONST(16080.675070789974/8.0),
+    REAL_CONST(16095.691458846273/8.0),
+    REAL_CONST(16110.711350084424/8.0),
+    REAL_CONST(16125.734742871053/8.0),
+    REAL_CONST(16140.761635574685/8.0),
+    REAL_CONST(16155.792026565747/8.0),
+    REAL_CONST(16170.825914216561/8.0),
+    REAL_CONST(16185.863296901338/8.0),
+    REAL_CONST(16200.904172996183/8.0),
+    REAL_CONST(16215.948540879079/8.0),
+    REAL_CONST(16230.996398929899/8.0),
+    REAL_CONST(16246.047745530386/8.0),
+    REAL_CONST(16261.102579064163/8.0),
+    REAL_CONST(16276.160897916721/8.0),
+    REAL_CONST(16291.22270047542/8.0),
+    REAL_CONST(16306.287985129484/8.0),
+    REAL_CONST(16321.356750269995/8.0),
+    REAL_CONST(16336.428994289896/8.0),
+    REAL_CONST(16351.504715583982/8.0),
+    REAL_CONST(16366.5839125489/8.0),
+    REAL_CONST(16381.666583583141/8.0),
+    REAL_CONST(16396.752727087041/8.0),
+    REAL_CONST(16411.842341462776/8.0),
+    REAL_CONST(16426.935425114363/8.0),
+    REAL_CONST(16442.031976447644/8.0),
+    REAL_CONST(16457.131993870298/8.0),
+    REAL_CONST(16472.235475791829/8.0),
+    REAL_CONST(16487.342420623561/8.0),
+    REAL_CONST(16502.452826778641/8.0),
+    REAL_CONST(16517.566692672033/8.0),
+    REAL_CONST(16532.684016720516/8.0),
+    REAL_CONST(16547.804797342676/8.0),
+    REAL_CONST(16562.929032958902/8.0),
+    REAL_CONST(16578.056721991394/8.0),
+    REAL_CONST(16593.18786286415/8.0),
+    REAL_CONST(16608.322454002962/8.0),
+    REAL_CONST(16623.460493835417/8.0),
+    REAL_CONST(16638.601980790896/8.0),
+    REAL_CONST(16653.746913300558/8.0),
+    REAL_CONST(16668.895289797354/8.0),
+    REAL_CONST(16684.047108716015/8.0),
+    REAL_CONST(16699.202368493046/8.0),
+    REAL_CONST(16714.361067566726/8.0),
+    REAL_CONST(16729.523204377107/8.0),
+    REAL_CONST(16744.688777366009/8.0),
+    REAL_CONST(16759.857784977012/8.0),
+    REAL_CONST(16775.030225655464/8.0),
+    REAL_CONST(16790.206097848466/8.0),
+    REAL_CONST(16805.385400004874/8.0),
+    REAL_CONST(16820.568130575302/8.0),
+    REAL_CONST(16835.754288012104/8.0),
+    REAL_CONST(16850.943870769381/8.0),
+    REAL_CONST(16866.136877302983/8.0),
+    REAL_CONST(16881.333306070494/8.0),
+    REAL_CONST(16896.53315553123/8.0),
+    REAL_CONST(16911.736424146249/8.0),
+    REAL_CONST(16926.943110378332/8.0),
+    REAL_CONST(16942.153212691992/8.0),
+    REAL_CONST(16957.366729553454/8.0),
+    REAL_CONST(16972.583659430682/8.0),
+    REAL_CONST(16987.804000793338/8.0),
+    REAL_CONST(17003.027752112816/8.0),
+    REAL_CONST(17018.254911862205/8.0),
+    REAL_CONST(17033.485478516312/8.0),
+    REAL_CONST(17048.719450551645/8.0),
+    REAL_CONST(17063.956826446421/8.0),
+    REAL_CONST(17079.197604680547/8.0),
+    REAL_CONST(17094.44178373563/8.0),
+    REAL_CONST(17109.689362094967/8.0),
+    REAL_CONST(17124.940338243552/8.0),
+    REAL_CONST(17140.194710668064/8.0),
+    REAL_CONST(17155.452477856852/8.0),
+    REAL_CONST(17170.713638299967/8.0),
+    REAL_CONST(17185.978190489128/8.0),
+    REAL_CONST(17201.246132917724/8.0),
+    REAL_CONST(17216.517464080825/8.0),
+    REAL_CONST(17231.792182475165/8.0),
+    REAL_CONST(17247.070286599141/8.0),
+    REAL_CONST(17262.351774952826/8.0),
+    REAL_CONST(17277.636646037936/8.0),
+    REAL_CONST(17292.924898357855/8.0),
+    REAL_CONST(17308.216530417623/8.0),
+    REAL_CONST(17323.511540723921/8.0),
+    REAL_CONST(17338.809927785089/8.0),
+    REAL_CONST(17354.111690111105/8.0),
+    REAL_CONST(17369.416826213594/8.0),
+    REAL_CONST(17384.725334605821/8.0),
+    REAL_CONST(17400.037213802683/8.0),
+    REAL_CONST(17415.352462320716/8.0),
+    REAL_CONST(17430.67107867809/8.0),
+    REAL_CONST(17445.993061394587/8.0),
+    REAL_CONST(17461.318408991636/8.0),
+    REAL_CONST(17476.647119992274/8.0),
+    REAL_CONST(17491.979192921168/8.0),
+    REAL_CONST(17507.314626304586/8.0),
+    REAL_CONST(17522.653418670423/8.0),
+    REAL_CONST(17537.995568548187/8.0),
+    REAL_CONST(17553.341074468986/8.0),
+    REAL_CONST(17568.689934965536/8.0),
+    REAL_CONST(17584.042148572156/8.0),
+    REAL_CONST(17599.397713824768/8.0),
+    REAL_CONST(17614.75662926089/8.0),
+    REAL_CONST(17630.118893419625/8.0),
+    REAL_CONST(17645.484504841683/8.0),
+    REAL_CONST(17660.853462069354/8.0),
+    REAL_CONST(17676.225763646511/8.0),
+    REAL_CONST(17691.601408118619/8.0),
+    REAL_CONST(17706.980394032718/8.0),
+    REAL_CONST(17722.362719937424/8.0),
+    REAL_CONST(17737.748384382936/8.0),
+    REAL_CONST(17753.137385921014/8.0),
+    REAL_CONST(17768.529723104999/8.0),
+    REAL_CONST(17783.92539448979/8.0),
+    REAL_CONST(17799.324398631856/8.0),
+    REAL_CONST(17814.726734089225/8.0),
+    REAL_CONST(17830.13239942148/8.0),
+    REAL_CONST(17845.541393189767/8.0),
+    REAL_CONST(17860.95371395678/8.0),
+    REAL_CONST(17876.369360286772/8.0),
+    REAL_CONST(17891.788330745527/8.0),
+    REAL_CONST(17907.210623900395/8.0),
+    REAL_CONST(17922.636238320254/8.0),
+    REAL_CONST(17938.065172575527/8.0),
+    REAL_CONST(17953.497425238176/8.0),
+    REAL_CONST(17968.932994881692/8.0),
+    REAL_CONST(17984.371880081104/8.0),
+    REAL_CONST(17999.814079412972/8.0),
+    REAL_CONST(18015.259591455371/8.0),
+    REAL_CONST(18030.708414787914/8.0),
+    REAL_CONST(18046.160547991731/8.0),
+    REAL_CONST(18061.615989649465/8.0),
+    REAL_CONST(18077.074738345284/8.0),
+    REAL_CONST(18092.536792664861/8.0),
+    REAL_CONST(18108.002151195393/8.0),
+    REAL_CONST(18123.470812525571/8.0),
+    REAL_CONST(18138.942775245599/8.0),
+    REAL_CONST(18154.418037947191/8.0),
+    REAL_CONST(18169.896599223546/8.0),
+    REAL_CONST(18185.37845766938/8.0),
+    REAL_CONST(18200.863611880886/8.0),
+    REAL_CONST(18216.352060455767/8.0),
+    REAL_CONST(18231.843801993204/8.0),
+    REAL_CONST(18247.338835093873/8.0),
+    REAL_CONST(18262.837158359936/8.0),
+    REAL_CONST(18278.338770395032/8.0),
+    REAL_CONST(18293.84366980429/8.0),
+    REAL_CONST(18309.351855194309/8.0),
+    REAL_CONST(18324.863325173166/8.0),
+    REAL_CONST(18340.378078350412/8.0),
+    REAL_CONST(18355.896113337069/8.0),
+    REAL_CONST(18371.417428745623/8.0),
+    REAL_CONST(18386.942023190033/8.0),
+    REAL_CONST(18402.469895285718/8.0),
+    REAL_CONST(18418.00104364955/8.0),
+    REAL_CONST(18433.53546689987/8.0),
+    REAL_CONST(18449.073163656474/8.0),
+    REAL_CONST(18464.614132540602/8.0),
+    REAL_CONST(18480.158372174956/8.0),
+    REAL_CONST(18495.705881183676/8.0),
+    REAL_CONST(18511.256658192357/8.0),
+    REAL_CONST(18526.810701828035/8.0),
+    REAL_CONST(18542.368010719183/8.0),
+    REAL_CONST(18557.928583495715/8.0),
+    REAL_CONST(18573.492418788985/8.0),
+    REAL_CONST(18589.059515231773/8.0),
+    REAL_CONST(18604.629871458303/8.0),
+    REAL_CONST(18620.203486104212/8.0),
+    REAL_CONST(18635.78035780658/8.0),
+    REAL_CONST(18651.360485203899/8.0),
+    REAL_CONST(18666.943866936086/8.0),
+    REAL_CONST(18682.53050164448/8.0),
+    REAL_CONST(18698.120387971841/8.0),
+    REAL_CONST(18713.713524562332/8.0),
+    REAL_CONST(18729.30991006154/8.0),
+    REAL_CONST(18744.909543116457/8.0),
+    REAL_CONST(18760.512422375479/8.0),
+    REAL_CONST(18776.118546488418/8.0),
+    REAL_CONST(18791.727914106479/8.0),
+    REAL_CONST(18807.340523882274/8.0),
+    REAL_CONST(18822.95637446981/8.0),
+    REAL_CONST(18838.575464524489/8.0),
+    REAL_CONST(18854.197792703111/8.0),
+    REAL_CONST(18869.823357663863/8.0),
+    REAL_CONST(18885.452158066328/8.0),
+    REAL_CONST(18901.08419257147/8.0),
+    REAL_CONST(18916.719459841639/8.0),
+    REAL_CONST(18932.357958540564/8.0),
+    REAL_CONST(18947.999687333362/8.0),
+    REAL_CONST(18963.644644886521/8.0),
+    REAL_CONST(18979.292829867907/8.0),
+    REAL_CONST(18994.944240946759/8.0),
+    REAL_CONST(19010.598876793687/8.0),
+    REAL_CONST(19026.256736080668/8.0),
+    REAL_CONST(19041.917817481048/8.0),
+    REAL_CONST(19057.582119669532/8.0),
+    REAL_CONST(19073.2496413222/8.0),
+    REAL_CONST(19088.920381116473/8.0),
+    REAL_CONST(19104.594337731145/8.0),
+    REAL_CONST(19120.271509846356/8.0),
+    REAL_CONST(19135.951896143604/8.0),
+    REAL_CONST(19151.635495305738/8.0),
+    REAL_CONST(19167.322306016948/8.0),
+    REAL_CONST(19183.012326962784/8.0),
+    REAL_CONST(19198.705556830122/8.0),
+    REAL_CONST(19214.401994307198/8.0),
+    REAL_CONST(19230.101638083579/8.0),
+    REAL_CONST(19245.804486850167/8.0),
+    REAL_CONST(19261.510539299208/8.0),
+    REAL_CONST(19277.219794124274/8.0),
+    REAL_CONST(19292.932250020265/8.0),
+    REAL_CONST(19308.647905683421/8.0),
+    REAL_CONST(19324.366759811302/8.0),
+    REAL_CONST(19340.088811102793/8.0),
+    REAL_CONST(19355.8140582581/8.0),
+    REAL_CONST(19371.542499978754/8.0),
+    REAL_CONST(19387.2741349676/8.0),
+    REAL_CONST(19403.008961928797/8.0),
+    REAL_CONST(19418.746979567823/8.0),
+    REAL_CONST(19434.488186591469/8.0),
+    REAL_CONST(19450.232581707827/8.0),
+    REAL_CONST(19465.980163626304/8.0),
+    REAL_CONST(19481.730931057613/8.0),
+    REAL_CONST(19497.484882713761/8.0),
+    REAL_CONST(19513.242017308068/8.0),
+    REAL_CONST(19529.002333555141/8.0),
+    REAL_CONST(19544.765830170898/8.0),
+    REAL_CONST(19560.532505872539/8.0),
+    REAL_CONST(19576.302359378566/8.0),
+    REAL_CONST(19592.075389408761/8.0),
+    REAL_CONST(19607.851594684209/8.0),
+    REAL_CONST(19623.630973927269/8.0),
+    REAL_CONST(19639.41352586159/8.0),
+    REAL_CONST(19655.199249212103/8.0),
+    REAL_CONST(19670.988142705017/8.0),
+    REAL_CONST(19686.780205067826/8.0),
+    REAL_CONST(19702.575435029288/8.0),
+    REAL_CONST(19718.373831319448/8.0),
+    REAL_CONST(19734.175392669615/8.0),
+    REAL_CONST(19749.980117812371/8.0),
+    REAL_CONST(19765.788005481569/8.0),
+    REAL_CONST(19781.599054412323/8.0),
+    REAL_CONST(19797.413263341008/8.0),
+    REAL_CONST(19813.230631005274/8.0),
+    REAL_CONST(19829.051156144014/8.0),
+    REAL_CONST(19844.874837497395/8.0),
+    REAL_CONST(19860.701673806827/8.0),
+    REAL_CONST(19876.531663814985/8.0),
+    REAL_CONST(19892.364806265789/8.0),
+    REAL_CONST(19908.201099904403/8.0),
+    REAL_CONST(19924.040543477258/8.0),
+    REAL_CONST(19939.883135732012/8.0),
+    REAL_CONST(19955.728875417579/8.0),
+    REAL_CONST(19971.577761284105/8.0),
+    REAL_CONST(19987.429792082985/8.0),
+    REAL_CONST(20003.284966566847/8.0),
+    REAL_CONST(20019.14328348956/8.0),
+    REAL_CONST(20035.004741606219/8.0),
+    REAL_CONST(20050.869339673161/8.0),
+    REAL_CONST(20066.737076447946/8.0),
+    REAL_CONST(20082.607950689362/8.0),
+    REAL_CONST(20098.481961157428/8.0),
+    REAL_CONST(20114.359106613385/8.0),
+    REAL_CONST(20130.239385819699/8.0),
+    REAL_CONST(20146.122797540058/8.0),
+    REAL_CONST(20162.009340539353/8.0),
+    REAL_CONST(20177.899013583716/8.0),
+    REAL_CONST(20193.791815440476/8.0),
+    REAL_CONST(20209.687744878182/8.0),
+    REAL_CONST(20225.586800666591/8.0),
+    REAL_CONST(20241.488981576669/8.0),
+    REAL_CONST(20257.394286380597/8.0),
+    REAL_CONST(20273.302713851754/8.0),
+    REAL_CONST(20289.214262764715/8.0),
+    REAL_CONST(20305.128931895277/8.0),
+    REAL_CONST(20321.046720020415/8.0),
+    REAL_CONST(20336.967625918318/8.0),
+    REAL_CONST(20352.891648368361/8.0),
+    REAL_CONST(20368.818786151114/8.0),
+    REAL_CONST(20384.749038048347/8.0),
+    REAL_CONST(20400.682402843009/8.0),
+    REAL_CONST(20416.618879319249/8.0),
+    REAL_CONST(20432.558466262391/8.0),
+    REAL_CONST(20448.501162458953/8.0),
+    REAL_CONST(20464.446966696629/8.0),
+    REAL_CONST(20480.395877764302/8.0),
+    REAL_CONST(20496.347894452025/8.0),
+    REAL_CONST(20512.303015551031/8.0),
+    REAL_CONST(20528.261239853735/8.0),
+    REAL_CONST(20544.22256615372/8.0),
+    REAL_CONST(20560.186993245738/8.0),
+    REAL_CONST(20576.15451992572/8.0),
+    REAL_CONST(20592.125144990758/8.0),
+    REAL_CONST(20608.098867239107/8.0),
+    REAL_CONST(20624.075685470198/8.0),
+    REAL_CONST(20640.055598484618/8.0),
+    REAL_CONST(20656.038605084115/8.0),
+    REAL_CONST(20672.024704071595/8.0),
+    REAL_CONST(20688.013894251126/8.0),
+    REAL_CONST(20704.006174427926/8.0),
+    REAL_CONST(20720.001543408373/8.0),
+    REAL_CONST(20735.999999999989/8.0),
+    REAL_CONST(20752.001543011454/8.0),
+    REAL_CONST(20768.006171252597/8.0),
+    REAL_CONST(20784.013883534382/8.0),
+    REAL_CONST(20800.024678668931/8.0),
+    REAL_CONST(20816.038555469506/8.0),
+    REAL_CONST(20832.055512750507/8.0),
+    REAL_CONST(20848.075549327474/8.0),
+    REAL_CONST(20864.098664017085/8.0),
+    REAL_CONST(20880.124855637161/8.0),
+    REAL_CONST(20896.154123006647/8.0),
+    REAL_CONST(20912.186464945626/8.0),
+    REAL_CONST(20928.221880275312/8.0),
+    REAL_CONST(20944.260367818049/8.0),
+    REAL_CONST(20960.301926397311/8.0),
+    REAL_CONST(20976.346554837684/8.0),
+    REAL_CONST(20992.394251964895/8.0),
+    REAL_CONST(21008.445016605787/8.0),
+    REAL_CONST(21024.498847588318/8.0),
+    REAL_CONST(21040.555743741574/8.0),
+    REAL_CONST(21056.615703895754/8.0),
+    REAL_CONST(21072.678726882168/8.0),
+    REAL_CONST(21088.744811533252/8.0),
+    REAL_CONST(21104.813956682538/8.0),
+    REAL_CONST(21120.886161164683/8.0),
+    REAL_CONST(21136.961423815443/8.0),
+    REAL_CONST(21153.039743471683/8.0),
+    REAL_CONST(21169.121118971379/8.0),
+    REAL_CONST(21185.205549153605/8.0),
+    REAL_CONST(21201.293032858535/8.0),
+    REAL_CONST(21217.383568927453/8.0),
+    REAL_CONST(21233.477156202731/8.0),
+    REAL_CONST(21249.573793527841/8.0),
+    REAL_CONST(21265.673479747358/8.0),
+    REAL_CONST(21281.776213706937/8.0),
+    REAL_CONST(21297.881994253334/8.0),
+    REAL_CONST(21313.990820234398/8.0),
+    REAL_CONST(21330.102690499054/8.0),
+    REAL_CONST(21346.21760389733/8.0),
+    REAL_CONST(21362.335559280327/8.0),
+    REAL_CONST(21378.456555500241/8.0),
+    REAL_CONST(21394.580591410333/8.0),
+    REAL_CONST(21410.707665864964/8.0),
+    REAL_CONST(21426.83777771956/8.0),
+    REAL_CONST(21442.970925830628/8.0),
+    REAL_CONST(21459.107109055756/8.0),
+    REAL_CONST(21475.246326253604/8.0),
+    REAL_CONST(21491.388576283895/8.0),
+    REAL_CONST(21507.533858007431/8.0),
+    REAL_CONST(21523.682170286087/8.0),
+    REAL_CONST(21539.833511982797/8.0),
+    REAL_CONST(21555.987881961566/8.0),
+    REAL_CONST(21572.145279087465/8.0),
+    REAL_CONST(21588.305702226615/8.0),
+    REAL_CONST(21604.469150246216/8.0),
+    REAL_CONST(21620.635622014521/8.0),
+    REAL_CONST(21636.805116400832/8.0),
+    REAL_CONST(21652.977632275521/8.0),
+    REAL_CONST(21669.153168510009/8.0),
+    REAL_CONST(21685.331723976764/8.0),
+    REAL_CONST(21701.513297549318/8.0),
+    REAL_CONST(21717.697888102244/8.0),
+    REAL_CONST(21733.885494511167/8.0),
+    REAL_CONST(21750.076115652759/8.0),
+    REAL_CONST(21766.269750404736/8.0),
+    REAL_CONST(21782.466397645861/8.0),
+    REAL_CONST(21798.666056255934/8.0),
+    REAL_CONST(21814.868725115801/8.0),
+    REAL_CONST(21831.074403107345/8.0),
+    REAL_CONST(21847.283089113484/8.0),
+    REAL_CONST(21863.494782018177/8.0),
+    REAL_CONST(21879.709480706417/8.0),
+    REAL_CONST(21895.927184064229/8.0),
+    REAL_CONST(21912.147890978667/8.0),
+    REAL_CONST(21928.371600337818/8.0),
+    REAL_CONST(21944.598311030797/8.0),
+    REAL_CONST(21960.828021947746/8.0),
+    REAL_CONST(21977.060731979829/8.0),
+    REAL_CONST(21993.296440019243/8.0),
+    REAL_CONST(22009.535144959198/8.0),
+    REAL_CONST(22025.77684569393/8.0),
+    REAL_CONST(22042.021541118691/8.0),
+    REAL_CONST(22058.269230129757/8.0),
+    REAL_CONST(22074.519911624411/8.0),
+    REAL_CONST(22090.773584500959/8.0),
+    REAL_CONST(22107.030247658717/8.0),
+    REAL_CONST(22123.289899998013/8.0),
+    REAL_CONST(22139.552540420187/8.0),
+    REAL_CONST(22155.818167827587/8.0),
+    REAL_CONST(22172.086781123569/8.0),
+    REAL_CONST(22188.358379212495/8.0),
+    REAL_CONST(22204.632960999726/8.0),
+    REAL_CONST(22220.910525391639/8.0),
+    REAL_CONST(22237.191071295601/8.0),
+    REAL_CONST(22253.474597619981/8.0),
+    REAL_CONST(22269.761103274148/8.0),
+    REAL_CONST(22286.050587168469/8.0),
+    REAL_CONST(22302.343048214312/8.0),
+    REAL_CONST(22318.638485324027/8.0),
+    REAL_CONST(22334.936897410968/8.0),
+    REAL_CONST(22351.23828338947/8.0),
+    REAL_CONST(22367.542642174871/8.0),
+    REAL_CONST(22383.849972683485/8.0),
+    REAL_CONST(22400.160273832618/8.0),
+    REAL_CONST(22416.473544540564/8.0),
+    REAL_CONST(22432.789783726603/8.0),
+    REAL_CONST(22449.108990310986/8.0),
+    REAL_CONST(22465.431163214958/8.0),
+    REAL_CONST(22481.75630136074/8.0),
+    REAL_CONST(22498.084403671528/8.0),
+    REAL_CONST(22514.415469071497/8.0),
+    REAL_CONST(22530.749496485802/8.0),
+    REAL_CONST(22547.086484840562/8.0),
+    REAL_CONST(22563.426433062879/8.0),
+    REAL_CONST(22579.769340080824/8.0),
+    REAL_CONST(22596.115204823436/8.0),
+    REAL_CONST(22612.464026220721/8.0),
+    REAL_CONST(22628.815803203655/8.0),
+    REAL_CONST(22645.170534704179/8.0),
+    REAL_CONST(22661.5282196552/8.0),
+    REAL_CONST(22677.888856990587/8.0),
+    REAL_CONST(22694.252445645168/8.0),
+    REAL_CONST(22710.618984554734/8.0),
+    REAL_CONST(22726.988472656034/8.0),
+    REAL_CONST(22743.360908886778/8.0),
+    REAL_CONST(22759.736292185622/8.0),
+    REAL_CONST(22776.114621492186/8.0),
+    REAL_CONST(22792.495895747044/8.0),
+    REAL_CONST(22808.880113891719/8.0),
+    REAL_CONST(22825.267274868678/8.0),
+    REAL_CONST(22841.657377621348/8.0),
+    REAL_CONST(22858.050421094096/8.0),
+    REAL_CONST(22874.446404232243/8.0),
+    REAL_CONST(22890.845325982053/8.0),
+    REAL_CONST(22907.247185290722/8.0),
+    REAL_CONST(22923.651981106406/8.0),
+    REAL_CONST(22940.059712378195/8.0),
+    REAL_CONST(22956.470378056114/8.0),
+    REAL_CONST(22972.883977091129/8.0),
+    REAL_CONST(22989.300508435153/8.0),
+    REAL_CONST(23005.719971041017/8.0),
+    REAL_CONST(23022.142363862498/8.0),
+    REAL_CONST(23038.567685854305/8.0),
+    REAL_CONST(23054.995935972078/8.0),
+    REAL_CONST(23071.427113172387/8.0),
+    REAL_CONST(23087.86121641273/8.0),
+    REAL_CONST(23104.298244651531/8.0),
+    REAL_CONST(23120.738196848146/8.0),
+    REAL_CONST(23137.181071962848/8.0),
+    REAL_CONST(23153.626868956846/8.0),
+    REAL_CONST(23170.075586792263/8.0),
+    REAL_CONST(23186.527224432142/8.0),
+    REAL_CONST(23202.981780840448/8.0),
+    REAL_CONST(23219.439254982066/8.0),
+    REAL_CONST(23235.899645822796/8.0),
+    REAL_CONST(23252.362952329357/8.0),
+    REAL_CONST(23268.829173469378/8.0),
+    REAL_CONST(23285.298308211408/8.0),
+    REAL_CONST(23301.770355524899/8.0),
+    REAL_CONST(23318.245314380223/8.0),
+    REAL_CONST(23334.723183748658/8.0),
+    REAL_CONST(23351.203962602387/8.0),
+    REAL_CONST(23367.687649914504/8.0),
+    REAL_CONST(23384.174244659007/8.0),
+    REAL_CONST(23400.663745810798/8.0),
+    REAL_CONST(23417.15615234568/8.0),
+    REAL_CONST(23433.651463240367/8.0),
+    REAL_CONST(23450.149677472462/8.0),
+    REAL_CONST(23466.650794020472/8.0),
+    REAL_CONST(23483.154811863806/8.0),
+    REAL_CONST(23499.661729982763/8.0),
+    REAL_CONST(23516.171547358543/8.0),
+    REAL_CONST(23532.684262973235/8.0),
+    REAL_CONST(23549.199875809823/8.0),
+    REAL_CONST(23565.718384852185/8.0),
+    REAL_CONST(23582.239789085092/8.0),
+    REAL_CONST(23598.764087494197/8.0),
+    REAL_CONST(23615.291279066041/8.0),
+    REAL_CONST(23631.821362788058/8.0),
+    REAL_CONST(23648.354337648565/8.0),
+    REAL_CONST(23664.890202636761/8.0),
+    REAL_CONST(23681.428956742733/8.0),
+    REAL_CONST(23697.970598957443/8.0),
+    REAL_CONST(23714.515128272738/8.0),
+    REAL_CONST(23731.062543681343/8.0),
+    REAL_CONST(23747.612844176863/8.0),
+    REAL_CONST(23764.166028753778/8.0),
+    REAL_CONST(23780.72209640744/8.0),
+    REAL_CONST(23797.281046134085/8.0),
+    REAL_CONST(23813.842876930816/8.0),
+    REAL_CONST(23830.407587795606/8.0),
+    REAL_CONST(23846.975177727301/8.0),
+    REAL_CONST(23863.545645725622/8.0),
+    REAL_CONST(23880.11899079115/8.0),
+    REAL_CONST(23896.695211925336/8.0),
+    REAL_CONST(23913.274308130498/8.0),
+    REAL_CONST(23929.856278409821/8.0),
+    REAL_CONST(23946.441121767348/8.0),
+    REAL_CONST(23963.028837207989/8.0),
+    REAL_CONST(23979.619423737513/8.0),
+    REAL_CONST(23996.212880362549/8.0),
+    REAL_CONST(24012.809206090584/8.0),
+    REAL_CONST(24029.408399929966/8.0),
+    REAL_CONST(24046.010460889898/8.0),
+    REAL_CONST(24062.615387980433/8.0),
+    REAL_CONST(24079.223180212492/8.0),
+    REAL_CONST(24095.833836597827/8.0),
+    REAL_CONST(24112.447356149063/8.0),
+    REAL_CONST(24129.063737879667/8.0),
+    REAL_CONST(24145.682980803951/8.0),
+    REAL_CONST(24162.305083937081/8.0),
+    REAL_CONST(24178.930046295067/8.0),
+    REAL_CONST(24195.557866894767/8.0),
+    REAL_CONST(24212.188544753884/8.0),
+    REAL_CONST(24228.822078890964/8.0),
+    REAL_CONST(24245.458468325389/8.0),
+    REAL_CONST(24262.097712077397/8.0),
+    REAL_CONST(24278.739809168052/8.0),
+    REAL_CONST(24295.384758619261/8.0),
+    REAL_CONST(24312.032559453768/8.0),
+    REAL_CONST(24328.683210695162/8.0),
+    REAL_CONST(24345.336711367858/8.0),
+    REAL_CONST(24361.993060497109/8.0),
+    REAL_CONST(24378.652257108995/8.0),
+    REAL_CONST(24395.314300230442/8.0),
+    REAL_CONST(24411.979188889192/8.0),
+    REAL_CONST(24428.646922113825/8.0),
+    REAL_CONST(24445.317498933746/8.0),
+    REAL_CONST(24461.990918379193/8.0),
+    REAL_CONST(24478.667179481225/8.0),
+    REAL_CONST(24495.346281271726/8.0),
+    REAL_CONST(24512.028222783407/8.0),
+    REAL_CONST(24528.713003049801/8.0),
+    REAL_CONST(24545.400621105266/8.0),
+    REAL_CONST(24562.091075984976/8.0),
+    REAL_CONST(24578.784366724925/8.0),
+    REAL_CONST(24595.480492361927/8.0),
+    REAL_CONST(24612.179451933614/8.0),
+    REAL_CONST(24628.881244478438/8.0),
+    REAL_CONST(24645.585869035654/8.0),
+    REAL_CONST(24662.293324645343/8.0),
+    REAL_CONST(24679.003610348394/8.0),
+    REAL_CONST(24695.716725186514/8.0),
+    REAL_CONST(24712.432668202211/8.0),
+    REAL_CONST(24729.151438438807/8.0),
+    REAL_CONST(24745.873034940436/8.0),
+    REAL_CONST(24762.597456752032/8.0),
+    REAL_CONST(24779.324702919344/8.0),
+    REAL_CONST(24796.054772488926/8.0),
+    REAL_CONST(24812.787664508123/8.0),
+    REAL_CONST(24829.5233780251/8.0),
+    REAL_CONST(24846.261912088819/8.0),
+    REAL_CONST(24863.003265749034/8.0),
+    REAL_CONST(24879.747438056307/8.0),
+    REAL_CONST(24896.494428062004/8.0),
+    REAL_CONST(24913.244234818278/8.0),
+    REAL_CONST(24929.996857378079/8.0),
+    REAL_CONST(24946.752294795166/8.0),
+    REAL_CONST(24963.510546124078/8.0),
+    REAL_CONST(24980.271610420157/8.0),
+    REAL_CONST(24997.035486739525/8.0),
+    REAL_CONST(25013.802174139113/8.0),
+    REAL_CONST(25030.571671676629/8.0),
+    REAL_CONST(25047.343978410572/8.0),
+    REAL_CONST(25064.119093400237/8.0),
+    REAL_CONST(25080.897015705697/8.0),
+    REAL_CONST(25097.677744387816/8.0),
+    REAL_CONST(25114.461278508239/8.0),
+    REAL_CONST(25131.2476171294/8.0),
+    REAL_CONST(25148.036759314517/8.0),
+    REAL_CONST(25164.828704127583/8.0),
+    REAL_CONST(25181.623450633375/8.0),
+    REAL_CONST(25198.42099789745/8.0),
+    REAL_CONST(25215.221344986145/8.0),
+    REAL_CONST(25232.024490966574/8.0),
+    REAL_CONST(25248.830434906627/8.0),
+    REAL_CONST(25265.639175874974/8.0),
+    REAL_CONST(25282.450712941049/8.0),
+    REAL_CONST(25299.265045175071/8.0),
+    REAL_CONST(25316.082171648024/8.0),
+    REAL_CONST(25332.902091431668/8.0),
+    REAL_CONST(25349.724803598532/8.0),
+    REAL_CONST(25366.550307221914/8.0),
+    REAL_CONST(25383.378601375884/8.0),
+    REAL_CONST(25400.209685135269/8.0),
+    REAL_CONST(25417.043557575678/8.0),
+    REAL_CONST(25433.880217773472/8.0),
+    REAL_CONST(25450.719664805783/8.0),
+    REAL_CONST(25467.561897750507/8.0),
+    REAL_CONST(25484.406915686297/8.0),
+    REAL_CONST(25501.254717692573/8.0),
+    REAL_CONST(25518.105302849512/8.0),
+    REAL_CONST(25534.958670238051/8.0),
+    REAL_CONST(25551.814818939893/8.0),
+    REAL_CONST(25568.67374803748/8.0),
+    REAL_CONST(25585.535456614027/8.0),
+    REAL_CONST(25602.399943753502/8.0),
+    REAL_CONST(25619.267208540619/8.0),
+    REAL_CONST(25636.137250060852/8.0),
+    REAL_CONST(25653.010067400432/8.0),
+    REAL_CONST(25669.885659646327/8.0),
+    REAL_CONST(25686.76402588627/8.0),
+    REAL_CONST(25703.645165208734/8.0),
+    REAL_CONST(25720.529076702944/8.0),
+    REAL_CONST(25737.415759458876/8.0),
+    REAL_CONST(25754.305212567244/8.0),
+    REAL_CONST(25771.197435119517/8.0),
+    REAL_CONST(25788.092426207899/8.0),
+    REAL_CONST(25804.990184925344/8.0),
+    REAL_CONST(25821.890710365547/8.0),
+    REAL_CONST(25838.794001622944/8.0),
+    REAL_CONST(25855.700057792714/8.0),
+    REAL_CONST(25872.608877970775/8.0),
+    REAL_CONST(25889.520461253778/8.0),
+    REAL_CONST(25906.434806739118/8.0),
+    REAL_CONST(25923.351913524923/8.0),
+    REAL_CONST(25940.271780710063/8.0),
+    REAL_CONST(25957.194407394138/8.0),
+    REAL_CONST(25974.11979267748/8.0),
+    REAL_CONST(25991.047935661154/8.0),
+    REAL_CONST(26007.978835446964/8.0),
+    REAL_CONST(26024.912491137442/8.0),
+    REAL_CONST(26041.848901835841/8.0),
+    REAL_CONST(26058.788066646157/8.0),
+    REAL_CONST(26075.729984673108/8.0),
+    REAL_CONST(26092.674655022136/8.0),
+    REAL_CONST(26109.622076799409/8.0),
+    REAL_CONST(26126.572249111829/8.0),
+    REAL_CONST(26143.525171067016/8.0),
+    REAL_CONST(26160.480841773315/8.0),
+    REAL_CONST(26177.43926033979/8.0),
+    REAL_CONST(26194.400425876229/8.0),
+    REAL_CONST(26211.364337493149/8.0),
+    REAL_CONST(26228.330994301767/8.0),
+    REAL_CONST(26245.30039541404/8.0),
+    REAL_CONST(26262.272539942627/8.0),
+    REAL_CONST(26279.247427000919/8.0),
+    REAL_CONST(26296.225055703002/8.0),
+    REAL_CONST(26313.205425163702/8.0),
+    REAL_CONST(26330.188534498539/8.0),
+    REAL_CONST(26347.174382823756/8.0),
+    REAL_CONST(26364.162969256304/8.0),
+    REAL_CONST(26381.154292913852/8.0),
+    REAL_CONST(26398.148352914774/8.0),
+    REAL_CONST(26415.145148378149/8.0),
+    REAL_CONST(26432.144678423778/8.0),
+    REAL_CONST(26449.146942172156/8.0),
+    REAL_CONST(26466.151938744493/8.0),
+    REAL_CONST(26483.159667262702/8.0),
+    REAL_CONST(26500.170126849403/8.0),
+    REAL_CONST(26517.183316627921/8.0),
+    REAL_CONST(26534.199235722277/8.0),
+    REAL_CONST(26551.217883257199/8.0),
+    REAL_CONST(26568.239258358124/8.0),
+    REAL_CONST(26585.263360151173/8.0),
+    REAL_CONST(26602.290187763181/8.0),
+    REAL_CONST(26619.319740321676/8.0),
+    REAL_CONST(26636.352016954883/8.0),
+    REAL_CONST(26653.387016791727/8.0),
+    REAL_CONST(26670.424738961825/8.0),
+    REAL_CONST(26687.465182595493/8.0),
+    REAL_CONST(26704.508346823739/8.0),
+    REAL_CONST(26721.554230778267/8.0),
+    REAL_CONST(26738.602833591467/8.0),
+    REAL_CONST(26755.65415439643/8.0),
+    REAL_CONST(26772.708192326929/8.0),
+    REAL_CONST(26789.764946517433/8.0),
+    REAL_CONST(26806.824416103096/8.0),
+    REAL_CONST(26823.886600219761/8.0),
+    REAL_CONST(26840.95149800396/8.0),
+    REAL_CONST(26858.019108592915/8.0),
+    REAL_CONST(26875.089431124517/8.0),
+    REAL_CONST(26892.162464737365/8.0),
+    REAL_CONST(26909.238208570721/8.0),
+    REAL_CONST(26926.316661764544/8.0),
+    REAL_CONST(26943.397823459472/8.0),
+    REAL_CONST(26960.481692796813/8.0),
+    REAL_CONST(26977.568268918571/8.0),
+    REAL_CONST(26994.657550967422/8.0),
+    REAL_CONST(27011.749538086722/8.0),
+    REAL_CONST(27028.844229420498/8.0),
+    REAL_CONST(27045.941624113464/8.0),
+    REAL_CONST(27063.041721311005/8.0),
+    REAL_CONST(27080.144520159181/8.0),
+    REAL_CONST(27097.250019804727/8.0),
+    REAL_CONST(27114.35821939505/8.0),
+    REAL_CONST(27131.469118078236/8.0),
+    REAL_CONST(27148.582715003027/8.0),
+    REAL_CONST(27165.699009318858/8.0),
+    REAL_CONST(27182.818000175819/8.0),
+    REAL_CONST(27199.939686724665/8.0),
+    REAL_CONST(27217.064068116837/8.0),
+    REAL_CONST(27234.191143504428/8.0),
+    REAL_CONST(27251.320912040203/8.0),
+    REAL_CONST(27268.453372877593/8.0),
+    REAL_CONST(27285.588525170693/8.0),
+    REAL_CONST(27302.726368074269/8.0),
+    REAL_CONST(27319.866900743735/8.0),
+    REAL_CONST(27337.010122335181/8.0),
+    REAL_CONST(27354.156032005358/8.0),
+    REAL_CONST(27371.304628911668/8.0),
+    REAL_CONST(27388.455912212183/8.0),
+    REAL_CONST(27405.609881065626/8.0),
+    REAL_CONST(27422.766534631384/8.0),
+    REAL_CONST(27439.925872069507/8.0),
+    REAL_CONST(27457.087892540683/8.0),
+    REAL_CONST(27474.252595206275/8.0),
+    REAL_CONST(27491.419979228293/8.0),
+    REAL_CONST(27508.5900437694/8.0),
+    REAL_CONST(27525.762787992917/8.0),
+    REAL_CONST(27542.93821106281/8.0),
+    REAL_CONST(27560.116312143706/8.0),
+    REAL_CONST(27577.297090400876/8.0),
+    REAL_CONST(27594.480545000242/8.0),
+    REAL_CONST(27611.666675108383/8.0),
+    REAL_CONST(27628.855479892518/8.0),
+    REAL_CONST(27646.046958520514/8.0),
+    REAL_CONST(27663.241110160889/8.0),
+    REAL_CONST(27680.437933982801/8.0),
+    REAL_CONST(27697.637429156068/8.0),
+    REAL_CONST(27714.839594851132/8.0),
+    REAL_CONST(27732.04443023909/8.0),
+    REAL_CONST(27749.251934491687/8.0),
+    REAL_CONST(27766.462106781299/8.0),
+    REAL_CONST(27783.674946280949/8.0),
+    REAL_CONST(27800.890452164302/8.0),
+    REAL_CONST(27818.108623605654/8.0),
+    REAL_CONST(27835.329459779954/8.0),
+    REAL_CONST(27852.55295986278/8.0),
+    REAL_CONST(27869.779123030345/8.0),
+    REAL_CONST(27887.007948459504/8.0),
+    REAL_CONST(27904.239435327745/8.0),
+    REAL_CONST(27921.473582813196/8.0),
+    REAL_CONST(27938.710390094613/8.0),
+    REAL_CONST(27955.949856351392/8.0),
+    REAL_CONST(27973.19198076355/8.0),
+    REAL_CONST(27990.436762511745/8.0),
+    REAL_CONST(28007.684200777272/8.0),
+    REAL_CONST(28024.934294742041/8.0),
+    REAL_CONST(28042.187043588601/8.0),
+    REAL_CONST(28059.442446500128/8.0),
+    REAL_CONST(28076.700502660427/8.0),
+    REAL_CONST(28093.961211253929/8.0),
+    REAL_CONST(28111.224571465693/8.0),
+    REAL_CONST(28128.490582481401/8.0),
+    REAL_CONST(28145.759243487362/8.0),
+    REAL_CONST(28163.030553670509/8.0),
+    REAL_CONST(28180.304512218394/8.0),
+    REAL_CONST(28197.581118319198/8.0),
+    REAL_CONST(28214.860371161725/8.0),
+    REAL_CONST(28232.14226993539/8.0),
+    REAL_CONST(28249.42681383024/8.0),
+    REAL_CONST(28266.71400203693/8.0),
+    REAL_CONST(28284.003833746745/8.0),
+    REAL_CONST(28301.296308151585/8.0),
+    REAL_CONST(28318.591424443959/8.0),
+    REAL_CONST(28335.889181817001/8.0),
+    REAL_CONST(28353.189579464462/8.0),
+    REAL_CONST(28370.492616580705/8.0),
+    REAL_CONST(28387.798292360701/8.0),
+    REAL_CONST(28405.106606000048/8.0),
+    REAL_CONST(28422.417556694945/8.0),
+    REAL_CONST(28439.731143642206/8.0),
+    REAL_CONST(28457.047366039264/8.0),
+    REAL_CONST(28474.366223084147/8.0),
+    REAL_CONST(28491.687713975512/8.0),
+    REAL_CONST(28509.011837912611/8.0),
+    REAL_CONST(28526.338594095305/8.0),
+    REAL_CONST(28543.667981724069/8.0),
+    REAL_CONST(28560.999999999982/8.0),
+    REAL_CONST(28578.334648124732/8.0),
+    REAL_CONST(28595.671925300605/8.0),
+    REAL_CONST(28613.011830730498/8.0),
+    REAL_CONST(28630.354363617909/8.0),
+    REAL_CONST(28647.699523166943/8.0),
+    REAL_CONST(28665.0473085823/8.0),
+    REAL_CONST(28682.397719069289/8.0),
+    REAL_CONST(28699.750753833818/8.0),
+    REAL_CONST(28717.10641208239/8.0),
+    REAL_CONST(28734.464693022121/8.0),
+    REAL_CONST(28751.825595860708/8.0),
+    REAL_CONST(28769.189119806462/8.0),
+    REAL_CONST(28786.55526406828/8.0),
+    REAL_CONST(28803.924027855664/8.0),
+    REAL_CONST(28821.295410378701/8.0),
+    REAL_CONST(28838.669410848088/8.0),
+    REAL_CONST(28856.046028475103/8.0),
+    REAL_CONST(28873.425262471628/8.0),
+    REAL_CONST(28890.80711205013/8.0),
+    REAL_CONST(28908.191576423673/8.0),
+    REAL_CONST(28925.578654805915/8.0),
+    REAL_CONST(28942.968346411097/8.0),
+    REAL_CONST(28960.360650454055/8.0),
+    REAL_CONST(28977.755566150216/8.0),
+    REAL_CONST(28995.153092715591/8.0),
+    REAL_CONST(29012.553229366786/8.0),
+    REAL_CONST(29029.955975320987/8.0),
+    REAL_CONST(29047.361329795975/8.0),
+    REAL_CONST(29064.769292010107/8.0),
+    REAL_CONST(29082.179861182336/8.0),
+    REAL_CONST(29099.593036532187/8.0),
+    REAL_CONST(29117.00881727978/8.0),
+    REAL_CONST(29134.427202645813/8.0),
+    REAL_CONST(29151.848191851568/8.0),
+    REAL_CONST(29169.271784118911/8.0),
+    REAL_CONST(29186.697978670283/8.0),
+    REAL_CONST(29204.126774728706/8.0),
+    REAL_CONST(29221.55817151779/8.0),
+    REAL_CONST(29238.992168261717/8.0),
+    REAL_CONST(29256.42876418525/8.0),
+    REAL_CONST(29273.867958513725/8.0),
+    REAL_CONST(29291.309750473058/8.0),
+    REAL_CONST(29308.754139289747/8.0),
+    REAL_CONST(29326.201124190855/8.0),
+    REAL_CONST(29343.65070440403/8.0),
+    REAL_CONST(29361.102879157483/8.0),
+    REAL_CONST(29378.557647680012/8.0),
+    REAL_CONST(29396.015009200975/8.0),
+    REAL_CONST(29413.474962950309/8.0),
+    REAL_CONST(29430.937508158524/8.0),
+    REAL_CONST(29448.402644056692/8.0),
+    REAL_CONST(29465.870369876469/8.0),
+    REAL_CONST(29483.340684850071/8.0),
+    REAL_CONST(29500.81358821028/8.0),
+    REAL_CONST(29518.289079190454/8.0),
+    REAL_CONST(29535.767157024511/8.0),
+    REAL_CONST(29553.247820946945/8.0),
+    REAL_CONST(29570.731070192807/8.0),
+    REAL_CONST(29588.216903997723/8.0),
+    REAL_CONST(29605.70532159787/8.0),
+    REAL_CONST(29623.19632223/8.0),
+    REAL_CONST(29640.689905131429/8.0),
+    REAL_CONST(29658.186069540028/8.0),
+    REAL_CONST(29675.684814694236/8.0),
+    REAL_CONST(29693.186139833047/8.0),
+    REAL_CONST(29710.690044196028/8.0),
+    REAL_CONST(29728.196527023298/8.0),
+    REAL_CONST(29745.705587555527/8.0),
+    REAL_CONST(29763.217225033964/8.0),
+    REAL_CONST(29780.731438700397/8.0),
+    REAL_CONST(29798.248227797183/8.0),
+    REAL_CONST(29815.76759156723/8.0),
+    REAL_CONST(29833.289529254005/8.0),
+    REAL_CONST(29850.81404010153/8.0),
+    REAL_CONST(29868.341123354381/8.0),
+    REAL_CONST(29885.870778257693/8.0),
+    REAL_CONST(29903.403004057145/8.0),
+    REAL_CONST(29920.937799998974/8.0),
+    REAL_CONST(29938.475165329975/8.0),
+    REAL_CONST(29956.015099297485/8.0),
+    REAL_CONST(29973.557601149394/8.0),
+    REAL_CONST(29991.102670134147/8.0),
+    REAL_CONST(30008.650305500738/8.0),
+    REAL_CONST(30026.200506498706/8.0),
+    REAL_CONST(30043.753272378144/8.0),
+    REAL_CONST(30061.308602389683/8.0),
+    REAL_CONST(30078.866495784507/8.0),
+    REAL_CONST(30096.426951814352/8.0),
+    REAL_CONST(30113.989969731494/8.0),
+    REAL_CONST(30131.55554878875/8.0),
+    REAL_CONST(30149.123688239491/8.0),
+    REAL_CONST(30166.694387337629/8.0),
+    REAL_CONST(30184.267645337608/8.0),
+    REAL_CONST(30201.843461494434/8.0),
+    REAL_CONST(30219.42183506364/8.0),
+    REAL_CONST(30237.002765301309/8.0),
+    REAL_CONST(30254.586251464058/8.0),
+    REAL_CONST(30272.172292809046/8.0),
+    REAL_CONST(30289.760888593977/8.0),
+    REAL_CONST(30307.35203807709/8.0),
+    REAL_CONST(30324.94574051716/8.0),
+    REAL_CONST(30342.541995173502/8.0),
+    REAL_CONST(30360.140801305966/8.0),
+    REAL_CONST(30377.742158174944/8.0),
+    REAL_CONST(30395.346065041358/8.0),
+    REAL_CONST(30412.952521166666/8.0),
+    REAL_CONST(30430.561525812864/8.0),
+    REAL_CONST(30448.173078242475/8.0),
+    REAL_CONST(30465.787177718561/8.0),
+    REAL_CONST(30483.403823504719/8.0),
+    REAL_CONST(30501.02301486507/8.0),
+    REAL_CONST(30518.644751064272/8.0),
+    REAL_CONST(30536.269031367516/8.0),
+    REAL_CONST(30553.895855040515/8.0),
+    REAL_CONST(30571.525221349519/8.0),
+    REAL_CONST(30589.157129561307/8.0),
+    REAL_CONST(30606.791578943175/8.0),
+    REAL_CONST(30624.428568762964/8.0),
+    REAL_CONST(30642.06809828903/8.0),
+    REAL_CONST(30659.710166790261/8.0),
+    REAL_CONST(30677.35477353607/8.0),
+    REAL_CONST(30695.001917796391/8.0),
+    REAL_CONST(30712.651598841687/8.0),
+    REAL_CONST(30730.303815942945/8.0),
+    REAL_CONST(30747.958568371676/8.0),
+    REAL_CONST(30765.615855399912/8.0),
+    REAL_CONST(30783.275676300211/8.0),
+    REAL_CONST(30800.938030345646/8.0),
+    REAL_CONST(30818.602916809814/8.0),
+    REAL_CONST(30836.270334966837/8.0),
+    REAL_CONST(30853.940284091354/8.0),
+    REAL_CONST(30871.612763458521/8.0),
+    REAL_CONST(30889.287772344011/8.0),
+    REAL_CONST(30906.965310024025/8.0),
+    REAL_CONST(30924.645375775272/8.0),
+    REAL_CONST(30942.327968874983/8.0),
+    REAL_CONST(30960.013088600903/8.0),
+    REAL_CONST(30977.700734231294/8.0),
+    REAL_CONST(30995.390905044929/8.0),
+    REAL_CONST(31013.083600321101/8.0),
+    REAL_CONST(31030.778819339619/8.0),
+    REAL_CONST(31048.476561380798/8.0),
+    REAL_CONST(31066.17682572547/8.0),
+    REAL_CONST(31083.879611654978/8.0),
+    REAL_CONST(31101.584918451179/8.0),
+    REAL_CONST(31119.29274539644/8.0),
+    REAL_CONST(31137.003091773637/8.0),
+    REAL_CONST(31154.715956866155/8.0),
+    REAL_CONST(31172.431339957893/8.0),
+    REAL_CONST(31190.14924033326/8.0),
+    REAL_CONST(31207.869657277162/8.0),
+    REAL_CONST(31225.592590075023/8.0),
+    REAL_CONST(31243.318038012771/8.0),
+    REAL_CONST(31261.046000376838/8.0),
+    REAL_CONST(31278.776476454172/8.0),
+    REAL_CONST(31296.50946553221/8.0),
+    REAL_CONST(31314.24496689891/8.0),
+    REAL_CONST(31331.98297984272/8.0),
+    REAL_CONST(31349.7235036526/8.0),
+    REAL_CONST(31367.466537618013/8.0),
+    REAL_CONST(31385.212081028923/8.0),
+    REAL_CONST(31402.960133175795/8.0),
+    REAL_CONST(31420.710693349596/8.0),
+    REAL_CONST(31438.463760841791/8.0),
+    REAL_CONST(31456.219334944351/8.0),
+    REAL_CONST(31473.977414949743/8.0),
+    REAL_CONST(31491.738000150934/8.0),
+    REAL_CONST(31509.501089841389/8.0),
+    REAL_CONST(31527.266683315069/8.0),
+    REAL_CONST(31545.034779866437/8.0),
+    REAL_CONST(31562.80537879045/8.0),
+    REAL_CONST(31580.578479382562/8.0),
+    REAL_CONST(31598.35408093872/8.0),
+    REAL_CONST(31616.132182755369/8.0),
+    REAL_CONST(31633.91278412945/8.0),
+    REAL_CONST(31651.695884358396/8.0),
+    REAL_CONST(31669.481482740131/8.0),
+    REAL_CONST(31687.269578573076/8.0),
+    REAL_CONST(31705.060171156143/8.0),
+    REAL_CONST(31722.853259788735/8.0),
+    REAL_CONST(31740.648843770748/8.0),
+    REAL_CONST(31758.446922402567/8.0),
+    REAL_CONST(31776.247494985066/8.0),
+    REAL_CONST(31794.050560819614/8.0),
+    REAL_CONST(31811.85611920806/8.0),
+    REAL_CONST(31829.664169452753/8.0),
+    REAL_CONST(31847.474710856521/8.0),
+    REAL_CONST(31865.287742722685/8.0),
+    REAL_CONST(31883.103264355046/8.0),
+    REAL_CONST(31900.921275057899/8.0),
+    REAL_CONST(31918.741774136019/8.0),
+    REAL_CONST(31936.564760894671/8.0),
+    REAL_CONST(31954.390234639599/8.0),
+    REAL_CONST(31972.21819467704/8.0),
+    REAL_CONST(31990.048640313704/8.0),
+    REAL_CONST(32007.881570856793/8.0),
+    REAL_CONST(32025.716985613984/8.0),
+    REAL_CONST(32043.554883893445/8.0),
+    REAL_CONST(32061.395265003815/8.0),
+    REAL_CONST(32079.238128254223/8.0),
+    REAL_CONST(32097.083472954269/8.0),
+    REAL_CONST(32114.931298414049/8.0),
+    REAL_CONST(32132.781603944117/8.0),
+    REAL_CONST(32150.634388855524/8.0),
+    REAL_CONST(32168.48965245979/8.0),
+    REAL_CONST(32186.347394068915/8.0),
+    REAL_CONST(32204.207612995371/8.0),
+    REAL_CONST(32222.07030855212/8.0),
+    REAL_CONST(32239.935480052583/8.0),
+    REAL_CONST(32257.803126810672/8.0),
+    REAL_CONST(32275.673248140767/8.0),
+    REAL_CONST(32293.545843357719/8.0),
+    REAL_CONST(32311.420911776862/8.0),
+    REAL_CONST(32329.298452713996/8.0),
+    REAL_CONST(32347.178465485395/8.0),
+    REAL_CONST(32365.060949407813/8.0),
+    REAL_CONST(32382.945903798463/8.0),
+    REAL_CONST(32400.83332797504/8.0),
+    REAL_CONST(32418.723221255706/8.0),
+    REAL_CONST(32436.615582959093/8.0),
+    REAL_CONST(32454.510412404306/8.0),
+    REAL_CONST(32472.407708910916/8.0),
+    REAL_CONST(32490.307471798966/8.0),
+    REAL_CONST(32508.209700388961/8.0),
+    REAL_CONST(32526.114394001877/8.0),
+    REAL_CONST(32544.021551959166/8.0),
+    REAL_CONST(32561.931173582732/8.0),
+    REAL_CONST(32579.843258194956/8.0),
+    REAL_CONST(32597.757805118679/8.0),
+    REAL_CONST(32615.674813677211/8.0),
+    REAL_CONST(32633.594283194328/8.0),
+    REAL_CONST(32651.516212994258/8.0),
+    REAL_CONST(32669.440602401712/8.0),
+    REAL_CONST(32687.367450741847/8.0),
+    REAL_CONST(32705.296757340297/8.0),
+    REAL_CONST(32723.228521523146/8.0),
+    REAL_CONST(32741.162742616943/8.0),
+    REAL_CONST(32759.099419948703/8.0),
+    REAL_CONST(32777.038552845901/8.0),
+    REAL_CONST(32794.980140636464/8.0),
+    REAL_CONST(32812.924182648792/8.0),
+    REAL_CONST(32830.87067821173/8.0),
+    REAL_CONST(32848.819626654593/8.0),
+    REAL_CONST(32866.77102730715/8.0),
+    REAL_CONST(32884.724879499619/8.0),
+    REAL_CONST(32902.681182562686/8.0),
+    REAL_CONST(32920.639935827494/8.0),
+    REAL_CONST(32938.601138625643/8.0),
+    REAL_CONST(32956.56479028918/8.0),
+    REAL_CONST(32974.530890150607/8.0),
+    REAL_CONST(32992.499437542894/8.0),
+    REAL_CONST(33010.470431799447/8.0),
+    REAL_CONST(33028.443872254145/8.0),
+    REAL_CONST(33046.419758241311/8.0),
+    REAL_CONST(33064.39808909571/8.0),
+    REAL_CONST(33082.378864152583/8.0),
+    REAL_CONST(33100.36208274759/8.0),
+    REAL_CONST(33118.347744216881/8.0),
+    REAL_CONST(33136.335847897026/8.0),
+    REAL_CONST(33154.326393125062/8.0),
+    REAL_CONST(33172.31937923847/8.0),
+    REAL_CONST(33190.314805575174/8.0),
+    REAL_CONST(33208.312671473555/8.0),
+    REAL_CONST(33226.312976272442/8.0),
+    REAL_CONST(33244.315719311111/8.0),
+    REAL_CONST(33262.320899929284/8.0),
+    REAL_CONST(33280.328517467125/8.0),
+    REAL_CONST(33298.33857126526/8.0),
+    REAL_CONST(33316.351060664747/8.0),
+    REAL_CONST(33334.365985007091/8.0),
+    REAL_CONST(33352.383343634239/8.0),
+    REAL_CONST(33370.403135888591/8.0),
+    REAL_CONST(33388.42536111299/8.0),
+    REAL_CONST(33406.450018650721/8.0),
+    REAL_CONST(33424.477107845501/8.0),
+    REAL_CONST(33442.506628041512/8.0),
+    REAL_CONST(33460.53857858335/8.0),
+    REAL_CONST(33478.572958816083/8.0),
+    REAL_CONST(33496.609768085189/8.0),
+    REAL_CONST(33514.649005736617/8.0),
+    REAL_CONST(33532.690671116739/8.0),
+    REAL_CONST(33550.734763572356/8.0),
+    REAL_CONST(33568.781282450735/8.0),
+    REAL_CONST(33586.830227099563/8.0),
+    REAL_CONST(33604.881596866973/8.0),
+    REAL_CONST(33622.935391101528/8.0),
+    REAL_CONST(33640.991609152239/8.0),
+    REAL_CONST(33659.050250368542/8.0),
+    REAL_CONST(33677.111314100322/8.0),
+    REAL_CONST(33695.174799697881/8.0),
+    REAL_CONST(33713.240706511984/8.0),
+    REAL_CONST(33731.309033893805/8.0),
+    REAL_CONST(33749.37978119497/8.0),
+    REAL_CONST(33767.452947767531/8.0),
+    REAL_CONST(33785.528532963974/8.0),
+    REAL_CONST(33803.606536137209/8.0),
+    REAL_CONST(33821.686956640602/8.0),
+    REAL_CONST(33839.769793827938/8.0),
+    REAL_CONST(33857.855047053425/8.0),
+    REAL_CONST(33875.942715671707/8.0),
+    REAL_CONST(33894.032799037872/8.0),
+    REAL_CONST(33912.125296507431/8.0),
+    REAL_CONST(33930.220207436316/8.0),
+    REAL_CONST(33948.317531180888/8.0),
+    REAL_CONST(33966.417267097961/8.0),
+    REAL_CONST(33984.519414544746/8.0),
+    REAL_CONST(34002.623972878901/8.0),
+    REAL_CONST(34020.730941458511/8.0),
+    REAL_CONST(34038.840319642077/8.0),
+    REAL_CONST(34056.952106788536/8.0),
+    REAL_CONST(34075.066302257255/8.0),
+    REAL_CONST(34093.182905408015/8.0),
+    REAL_CONST(34111.301915601027/8.0),
+    REAL_CONST(34129.42333219693/8.0),
+    REAL_CONST(34147.547154556785/8.0),
+    REAL_CONST(34165.673382042078/8.0),
+    REAL_CONST(34183.80201401472/8.0),
+    REAL_CONST(34201.933049837033/8.0),
+    REAL_CONST(34220.06648887178/8.0),
+    REAL_CONST(34238.202330482141/8.0),
+    REAL_CONST(34256.340574031703/8.0),
+    REAL_CONST(34274.481218884495/8.0),
+    REAL_CONST(34292.624264404949/8.0),
+    REAL_CONST(34310.769709957938/8.0),
+    REAL_CONST(34328.91755490873/8.0),
+    REAL_CONST(34347.067798623029/8.0),
+    REAL_CONST(34365.220440466954/8.0),
+    REAL_CONST(34383.375479807051/8.0),
+    REAL_CONST(34401.532916010263/8.0),
+    REAL_CONST(34419.692748443973/8.0),
+    REAL_CONST(34437.854976475966/8.0),
+    REAL_CONST(34456.01959947445/8.0),
+    REAL_CONST(34474.18661680806/8.0),
+    REAL_CONST(34492.356027845817/8.0),
+    REAL_CONST(34510.527831957188/8.0),
+    REAL_CONST(34528.702028512052/8.0),
+    REAL_CONST(34546.878616880676/8.0),
+    REAL_CONST(34565.05759643377/8.0),
+    REAL_CONST(34583.238966542449/8.0),
+    REAL_CONST(34601.422726578232/8.0),
+    REAL_CONST(34619.608875913065/8.0),
+    REAL_CONST(34637.797413919296/8.0),
+    REAL_CONST(34655.988339969692/8.0),
+    REAL_CONST(34674.181653437423/8.0),
+    REAL_CONST(34692.37735369608/8.0),
+    REAL_CONST(34710.575440119668/8.0),
+    REAL_CONST(34728.775912082579/8.0),
+    REAL_CONST(34746.978768959649/8.0),
+    REAL_CONST(34765.184010126082/8.0),
+    REAL_CONST(34783.391634957537/8.0),
+    REAL_CONST(34801.60164283005/8.0),
+    REAL_CONST(34819.814033120063/8.0),
+    REAL_CONST(34838.028805204456/8.0),
+    REAL_CONST(34856.24595846048/8.0),
+    REAL_CONST(34874.465492265823/8.0),
+    REAL_CONST(34892.687405998557/8.0),
+    REAL_CONST(34910.911699037177/8.0),
+    REAL_CONST(34929.138370760564/8.0),
+    REAL_CONST(34947.367420548027/8.0),
+    REAL_CONST(34965.598847779271/8.0),
+    REAL_CONST(34983.832651834389/8.0),
+    REAL_CONST(35002.068832093908/8.0),
+    REAL_CONST(35020.307387938738/8.0),
+    REAL_CONST(35038.548318750189/8.0),
+    REAL_CONST(35056.79162390998/8.0),
+    REAL_CONST(35075.03730280025/8.0),
+    REAL_CONST(35093.285354803513/8.0),
+    REAL_CONST(35111.535779302685/8.0),
+    REAL_CONST(35129.788575681116/8.0),
+    REAL_CONST(35148.043743322516/8.0),
+    REAL_CONST(35166.301281611013/8.0),
+    REAL_CONST(35184.561189931141/8.0),
+    REAL_CONST(35202.823467667826/8.0),
+    REAL_CONST(35221.088114206388/8.0),
+    REAL_CONST(35239.355128932555/8.0),
+    REAL_CONST(35257.624511232447/8.0),
+    REAL_CONST(35275.896260492584/8.0),
+    REAL_CONST(35294.170376099886/8.0),
+    REAL_CONST(35312.446857441668/8.0),
+    REAL_CONST(35330.725703905628/8.0),
+    REAL_CONST(35349.006914879887/8.0),
+    REAL_CONST(35367.290489752944/8.0),
+    REAL_CONST(35385.576427913686/8.0),
+    REAL_CONST(35403.864728751418/8.0),
+    REAL_CONST(35422.155391655811/8.0),
+    REAL_CONST(35440.448416016967/8.0),
+    REAL_CONST(35458.743801225341/8.0),
+    REAL_CONST(35477.041546671804/8.0),
+    REAL_CONST(35495.341651747622/8.0),
+    REAL_CONST(35513.644115844436/8.0),
+    REAL_CONST(35531.948938354304/8.0),
+    REAL_CONST(35550.256118669655/8.0),
+    REAL_CONST(35568.565656183309/8.0),
+    REAL_CONST(35586.877550288496/8.0),
+    REAL_CONST(35605.191800378816/8.0),
+    REAL_CONST(35623.508405848268/8.0),
+    REAL_CONST(35641.827366091238/8.0),
+    REAL_CONST(35660.148680502505/8.0),
+    REAL_CONST(35678.472348477233/8.0),
+    REAL_CONST(35696.798369410979/8.0),
+    REAL_CONST(35715.126742699678/8.0),
+    REAL_CONST(35733.457467739659/8.0),
+    REAL_CONST(35751.790543927644/8.0),
+    REAL_CONST(35770.125970660738/8.0),
+    REAL_CONST(35788.46374733642/8.0),
+    REAL_CONST(35806.803873352568/8.0),
+    REAL_CONST(35825.146348107453/8.0),
+    REAL_CONST(35843.49117099971/8.0),
+    REAL_CONST(35861.838341428367/8.0),
+    REAL_CONST(35880.187858792851/8.0),
+    REAL_CONST(35898.539722492955/8.0),
+    REAL_CONST(35916.893931928862/8.0),
+    REAL_CONST(35935.250486501129/8.0),
+    REAL_CONST(35953.609385610718/8.0),
+    REAL_CONST(35971.970628658957/8.0),
+    REAL_CONST(35990.334215047558/8.0),
+    REAL_CONST(36008.700144178612/8.0),
+    REAL_CONST(36027.068415454596/8.0),
+    REAL_CONST(36045.439028278372/8.0),
+    REAL_CONST(36063.811982053165/8.0),
+    REAL_CONST(36082.187276182609/8.0),
+    REAL_CONST(36100.564910070694/8.0),
+    REAL_CONST(36118.944883121789/8.0),
+    REAL_CONST(36137.327194740654/8.0),
+    REAL_CONST(36155.711844332429/8.0),
+    REAL_CONST(36174.098831302617/8.0),
+    REAL_CONST(36192.488155057115/8.0),
+    REAL_CONST(36210.87981500219/8.0),
+    REAL_CONST(36229.273810544473/8.0),
+    REAL_CONST(36247.670141091003/8.0),
+    REAL_CONST(36266.068806049167/8.0),
+    REAL_CONST(36284.469804826738/8.0),
+    REAL_CONST(36302.873136831862/8.0),
+    REAL_CONST(36321.278801473069/8.0),
+    REAL_CONST(36339.686798159251/8.0),
+    REAL_CONST(36358.097126299683/8.0),
+    REAL_CONST(36376.509785304013/8.0),
+    REAL_CONST(36394.924774582258/8.0),
+    REAL_CONST(36413.342093544816/8.0),
+    REAL_CONST(36431.761741602444/8.0),
+    REAL_CONST(36450.183718166292/8.0),
+    REAL_CONST(36468.608022647859/8.0),
+    REAL_CONST(36487.034654459028/8.0),
+    REAL_CONST(36505.463613012063/8.0),
+    REAL_CONST(36523.894897719583/8.0),
+    REAL_CONST(36542.328507994578/8.0),
+    REAL_CONST(36560.764443250409/8.0),
+    REAL_CONST(36579.202702900831/8.0),
+    REAL_CONST(36597.643286359926/8.0),
+    REAL_CONST(36616.086193042182/8.0),
+    REAL_CONST(36634.531422362437/8.0),
+    REAL_CONST(36652.978973735895/8.0),
+    REAL_CONST(36671.428846578143/8.0),
+    REAL_CONST(36689.881040305125/8.0),
+    REAL_CONST(36708.335554333149/8.0),
+    REAL_CONST(36726.792388078902/8.0),
+    REAL_CONST(36745.251540959427/8.0),
+    REAL_CONST(36763.713012392138/8.0),
+    REAL_CONST(36782.176801794812/8.0),
+    REAL_CONST(36800.642908585593/8.0),
+    REAL_CONST(36819.111332182983/8.0),
+    REAL_CONST(36837.582072005869/8.0),
+    REAL_CONST(36856.055127473483/8.0),
+    REAL_CONST(36874.530498005421/8.0),
+    REAL_CONST(36893.008183021651/8.0),
+    REAL_CONST(36911.488181942506/8.0),
+    REAL_CONST(36929.970494188674/8.0),
+    REAL_CONST(36948.455119181206/8.0),
+    REAL_CONST(36966.942056341519/8.0),
+    REAL_CONST(36985.431305091392/8.0),
+    REAL_CONST(37003.922864852961/8.0),
+    REAL_CONST(37022.416735048733/8.0),
+    REAL_CONST(37040.912915101559/8.0),
+    REAL_CONST(37059.411404434657/8.0),
+    REAL_CONST(37077.91220247162/8.0),
+    REAL_CONST(37096.415308636388/8.0),
+    REAL_CONST(37114.920722353243/8.0),
+    REAL_CONST(37133.428443046862/8.0),
+    REAL_CONST(37151.938470142253/8.0),
+    REAL_CONST(37170.450803064785/8.0),
+    REAL_CONST(37188.965441240209/8.0),
+    REAL_CONST(37207.482384094597/8.0),
+    REAL_CONST(37226.001631054402/8.0),
+    REAL_CONST(37244.523181546429/8.0),
+    REAL_CONST(37263.047034997842/8.0),
+    REAL_CONST(37281.573190836149/8.0),
+    REAL_CONST(37300.101648489224/8.0),
+    REAL_CONST(37318.632407385296/8.0),
+    REAL_CONST(37337.165466952945/8.0),
+    REAL_CONST(37355.700826621112/8.0),
+    REAL_CONST(37374.238485819085/8.0),
+    REAL_CONST(37392.778443976509/8.0),
+    REAL_CONST(37411.320700523385/8.0),
+    REAL_CONST(37429.865254890057/8.0),
+    REAL_CONST(37448.412106507232/8.0),
+    REAL_CONST(37466.961254805974/8.0),
+    REAL_CONST(37485.512699217681/8.0),
+    REAL_CONST(37504.066439174116/8.0),
+    REAL_CONST(37522.622474107404/8.0),
+    REAL_CONST(37541.180803449992/8.0),
+    REAL_CONST(37559.741426634704/8.0),
+    REAL_CONST(37578.304343094693/8.0),
+    REAL_CONST(37596.869552263488/8.0),
+    REAL_CONST(37615.43705357494/8.0),
+    REAL_CONST(37634.006846463279/8.0),
+    REAL_CONST(37652.578930363044/8.0),
+    REAL_CONST(37671.153304709165/8.0),
+    REAL_CONST(37689.729968936896/8.0),
+    REAL_CONST(37708.308922481847/8.0),
+    REAL_CONST(37726.890164779965/8.0),
+    REAL_CONST(37745.473695267559/8.0),
+    REAL_CONST(37764.059513381275/8.0),
+    REAL_CONST(37782.647618558112/8.0),
+    REAL_CONST(37801.238010235415/8.0),
+    REAL_CONST(37819.830687850859/8.0),
+    REAL_CONST(37838.425650842495/8.0),
+    REAL_CONST(37857.022898648691/8.0),
+    REAL_CONST(37875.622430708172/8.0),
+    REAL_CONST(37894.224246460013/8.0),
+    REAL_CONST(37912.828345343616/8.0),
+    REAL_CONST(37931.434726798747/8.0),
+    REAL_CONST(37950.043390265506/8.0),
+    REAL_CONST(37968.654335184328/8.0),
+    REAL_CONST(37987.267560995999/8.0),
+    REAL_CONST(38005.883067141665/8.0),
+    REAL_CONST(38024.500853062775/8.0),
+    REAL_CONST(38043.120918201159/8.0),
+    REAL_CONST(38061.743261998963/8.0),
+    REAL_CONST(38080.367883898682/8.0),
+    REAL_CONST(38098.994783343158/8.0),
+    REAL_CONST(38117.623959775563/8.0),
+    REAL_CONST(38136.255412639417/8.0),
+    REAL_CONST(38154.889141378575/8.0),
+    REAL_CONST(38173.525145437234/8.0),
+    REAL_CONST(38192.163424259939/8.0),
+    REAL_CONST(38210.803977291551/8.0),
+    REAL_CONST(38229.446803977284/8.0),
+    REAL_CONST(38248.091903762703/8.0),
+    REAL_CONST(38266.739276093685/8.0),
+    REAL_CONST(38285.388920416466/8.0),
+    REAL_CONST(38304.040836177606/8.0),
+    REAL_CONST(38322.695022824002/8.0),
+    REAL_CONST(38341.351479802899/8.0),
+    REAL_CONST(38360.010206561863/8.0),
+    REAL_CONST(38378.671202548816/8.0),
+    REAL_CONST(38397.334467211993/8.0),
+    REAL_CONST(38415.999999999978/8.0),
+    REAL_CONST(38434.667800361683/8.0),
+    REAL_CONST(38453.33786774637/8.0),
+    REAL_CONST(38472.010201603611/8.0),
+    REAL_CONST(38490.684801383337/8.0),
+    REAL_CONST(38509.361666535784/8.0),
+    REAL_CONST(38528.040796511552/8.0),
+    REAL_CONST(38546.722190761553/8.0),
+    REAL_CONST(38565.405848737035/8.0),
+    REAL_CONST(38584.091769889594/8.0),
+    REAL_CONST(38602.779953671132/8.0),
+    REAL_CONST(38621.470399533908/8.0),
+    REAL_CONST(38640.163106930493/8.0),
+    REAL_CONST(38658.858075313794/8.0),
+    REAL_CONST(38677.555304137059/8.0),
+    REAL_CONST(38696.254792853862/8.0),
+    REAL_CONST(38714.956540918094/8.0),
+    REAL_CONST(38733.660547783991/8.0),
+    REAL_CONST(38752.366812906112/8.0),
+    REAL_CONST(38771.075335739348/8.0),
+    REAL_CONST(38789.78611573892/8.0),
+    REAL_CONST(38808.499152360368/8.0),
+    REAL_CONST(38827.214445059573/8.0),
+    REAL_CONST(38845.931993292739/8.0),
+    REAL_CONST(38864.651796516388/8.0),
+    REAL_CONST(38883.373854187383/8.0),
+    REAL_CONST(38902.098165762916/8.0),
+    REAL_CONST(38920.824730700486/8.0),
+    REAL_CONST(38939.553548457938/8.0),
+    REAL_CONST(38958.284618493431/8.0),
+    REAL_CONST(38977.017940265461/8.0),
+    REAL_CONST(38995.753513232834/8.0),
+    REAL_CONST(39014.491336854699/8.0),
+    REAL_CONST(39033.231410590517/8.0),
+    REAL_CONST(39051.973733900079/8.0),
+    REAL_CONST(39070.718306243485/8.0),
+    REAL_CONST(39089.465127081188/8.0),
+    REAL_CONST(39108.214195873945/8.0),
+    REAL_CONST(39126.965512082832/8.0),
+    REAL_CONST(39145.719075169261/8.0),
+    REAL_CONST(39164.474884594965/8.0),
+    REAL_CONST(39183.232939821988/8.0),
+    REAL_CONST(39201.99324031271/8.0),
+    REAL_CONST(39220.755785529815/8.0),
+    REAL_CONST(39239.52057493633/8.0),
+    REAL_CONST(39258.287607995589/8.0),
+    REAL_CONST(39277.056884171245/8.0),
+    REAL_CONST(39295.828402927284/8.0),
+    REAL_CONST(39314.602163728006/8.0),
+    REAL_CONST(39333.378166038019/8.0),
+    REAL_CONST(39352.15640932227/8.0),
+    REAL_CONST(39370.936893046004/8.0),
+    REAL_CONST(39389.719616674811/8.0),
+    REAL_CONST(39408.504579674584/8.0),
+    REAL_CONST(39427.291781511522/8.0),
+    REAL_CONST(39446.081221652174/8.0),
+    REAL_CONST(39464.872899563372/8.0),
+    REAL_CONST(39483.666814712291/8.0),
+    REAL_CONST(39502.462966566411/8.0),
+    REAL_CONST(39521.261354593538/8.0),
+    REAL_CONST(39540.06197826178/8.0),
+    REAL_CONST(39558.864837039568/8.0),
+    REAL_CONST(39577.669930395656/8.0),
+    REAL_CONST(39596.47725779911/8.0),
+    REAL_CONST(39615.286818719302/8.0),
+    REAL_CONST(39634.098612625923/8.0),
+    REAL_CONST(39652.912638988993/8.0),
+    REAL_CONST(39671.728897278823/8.0),
+    REAL_CONST(39690.547386966064/8.0),
+    REAL_CONST(39709.368107521652/8.0),
+    REAL_CONST(39728.191058416858/8.0),
+    REAL_CONST(39747.016239123259/8.0),
+    REAL_CONST(39765.84364911275/8.0),
+    REAL_CONST(39784.673287857528/8.0),
+    REAL_CONST(39803.505154830105/8.0),
+    REAL_CONST(39822.339249503319/8.0),
+    REAL_CONST(39841.175571350293/8.0),
+    REAL_CONST(39860.014119844491/8.0),
+    REAL_CONST(39878.854894459677/8.0),
+    REAL_CONST(39897.697894669909/8.0),
+    REAL_CONST(39916.54311994958/8.0),
+    REAL_CONST(39935.390569773372/8.0),
+    REAL_CONST(39954.240243616303/8.0),
+    REAL_CONST(39973.092140953675/8.0),
+    REAL_CONST(39991.946261261117/8.0),
+    REAL_CONST(40010.802604014549/8.0),
+    REAL_CONST(40029.661168690225/8.0),
+    REAL_CONST(40048.521954764678/8.0),
+    REAL_CONST(40067.384961714779/8.0),
+    REAL_CONST(40086.250189017679/8.0),
+    REAL_CONST(40105.117636150855/8.0),
+    REAL_CONST(40123.98730259209/8.0),
+    REAL_CONST(40142.859187819471/8.0),
+    REAL_CONST(40161.733291311379/8.0),
+    REAL_CONST(40180.609612546526/8.0),
+    REAL_CONST(40199.488151003912/8.0),
+    REAL_CONST(40218.368906162854/8.0),
+    REAL_CONST(40237.25187750296/8.0),
+    REAL_CONST(40256.137064504153/8.0),
+    REAL_CONST(40275.024466646668/8.0),
+    REAL_CONST(40293.914083411029/8.0),
+    REAL_CONST(40312.805914278084/8.0),
+    REAL_CONST(40331.699958728961/8.0),
+    REAL_CONST(40350.596216245103/8.0),
+    REAL_CONST(40369.494686308273/8.0),
+    REAL_CONST(40388.39536840051/8.0),
+    REAL_CONST(40407.298262004173/8.0),
+    REAL_CONST(40426.20336660192/8.0),
+    REAL_CONST(40445.110681676706/8.0),
+    REAL_CONST(40464.020206711793/8.0),
+    REAL_CONST(40482.931941190756/8.0),
+    REAL_CONST(40501.845884597446/8.0),
+    REAL_CONST(40520.762036416032/8.0),
+    REAL_CONST(40539.680396130985/8.0),
+    REAL_CONST(40558.600963227072/8.0),
+    REAL_CONST(40577.523737189367/8.0),
+    REAL_CONST(40596.448717503234/8.0),
+    REAL_CONST(40615.375903654342/8.0),
+    REAL_CONST(40634.305295128659/8.0),
+    REAL_CONST(40653.236891412453/8.0),
+    REAL_CONST(40672.170691992294/8.0),
+    REAL_CONST(40691.106696355047/8.0),
+    REAL_CONST(40710.044903987873/8.0),
+    REAL_CONST(40728.985314378238/8.0),
+    REAL_CONST(40747.927927013901/8.0),
+    REAL_CONST(40766.872741382918/8.0),
+    REAL_CONST(40785.819756973651/8.0),
+    REAL_CONST(40804.768973274746/8.0),
+    REAL_CONST(40823.720389775161/8.0),
+    REAL_CONST(40842.674005964131/8.0),
+    REAL_CONST(40861.629821331211/8.0),
+    REAL_CONST(40880.587835366234/8.0),
+    REAL_CONST(40899.548047559321/8.0),
+    REAL_CONST(40918.510457400931/8.0),
+    REAL_CONST(40937.475064381761/8.0),
+    REAL_CONST(40956.441867992849/8.0),
+    REAL_CONST(40975.410867725499/8.0),
+    REAL_CONST(40994.382063071331/8.0),
+    REAL_CONST(41013.355453522236/8.0),
+    REAL_CONST(41032.331038570417/8.0),
+    REAL_CONST(41051.308817708363/8.0),
+    REAL_CONST(41070.288790428858/8.0),
+    REAL_CONST(41089.270956224987/8.0),
+    REAL_CONST(41108.255314590111/8.0),
+    REAL_CONST(41127.241865017888/8.0),
+    REAL_CONST(41146.23060700229/8.0),
+    REAL_CONST(41165.221540037543/8.0),
+    REAL_CONST(41184.214663618193/8.0),
+    REAL_CONST(41203.209977239079/8.0),
+    REAL_CONST(41222.207480395307/8.0),
+    REAL_CONST(41241.207172582297/8.0),
+    REAL_CONST(41260.209053295752/8.0),
+    REAL_CONST(41279.213122031659/8.0),
+    REAL_CONST(41298.219378286303/8.0),
+    REAL_CONST(41317.227821556255/8.0),
+    REAL_CONST(41336.23845133838/8.0),
+    REAL_CONST(41355.251267129832/8.0),
+    REAL_CONST(41374.266268428037/8.0),
+    REAL_CONST(41393.283454730743/8.0),
+    REAL_CONST(41412.302825535953/8.0),
+    REAL_CONST(41431.324380341983/8.0),
+    REAL_CONST(41450.348118647416/8.0),
+    REAL_CONST(41469.374039951144/8.0),
+    REAL_CONST(41488.402143752326/8.0),
+    REAL_CONST(41507.432429550427/8.0),
+    REAL_CONST(41526.464896845187/8.0),
+    REAL_CONST(41545.499545136627/8.0),
+    REAL_CONST(41564.536373925075/8.0),
+    REAL_CONST(41583.575382711126/8.0),
+    REAL_CONST(41602.616570995662/8.0),
+    REAL_CONST(41621.659938279874/8.0),
+    REAL_CONST(41640.705484065205/8.0),
+    REAL_CONST(41659.753207853406/8.0),
+    REAL_CONST(41678.803109146495/8.0),
+    REAL_CONST(41697.855187446803/8.0),
+    REAL_CONST(41716.909442256911/8.0),
+    REAL_CONST(41735.965873079709/8.0),
+    REAL_CONST(41755.02447941836/8.0),
+    REAL_CONST(41774.085260776315/8.0),
+    REAL_CONST(41793.148216657297/8.0),
+    REAL_CONST(41812.213346565331/8.0),
+    REAL_CONST(41831.280650004708/8.0),
+    REAL_CONST(41850.350126480014/8.0),
+    REAL_CONST(41869.421775496106/8.0),
+    REAL_CONST(41888.495596558132/8.0),
+    REAL_CONST(41907.571589171515/8.0),
+    REAL_CONST(41926.649752841957/8.0),
+    REAL_CONST(41945.730087075463/8.0),
+    REAL_CONST(41964.812591378286/8.0),
+    REAL_CONST(41983.897265256979/8.0),
+    REAL_CONST(42002.984108218378/8.0),
+    REAL_CONST(42022.073119769593/8.0),
+    REAL_CONST(42041.164299418015/8.0),
+    REAL_CONST(42060.257646671307/8.0),
+    REAL_CONST(42079.353161037419/8.0),
+    REAL_CONST(42098.450842024591/8.0),
+    REAL_CONST(42117.550689141324/8.0),
+    REAL_CONST(42136.652701896404/8.0),
+    REAL_CONST(42155.756879798893/8.0),
+    REAL_CONST(42174.863222358137/8.0),
+    REAL_CONST(42193.971729083758/8.0),
+    REAL_CONST(42213.082399485655/8.0),
+    REAL_CONST(42232.195233074002/8.0),
+    REAL_CONST(42251.310229359246/8.0),
+    REAL_CONST(42270.427387852127/8.0),
+    REAL_CONST(42289.546708063644/8.0),
+    REAL_CONST(42308.668189505079/8.0),
+    REAL_CONST(42327.791831687995/8.0),
+    REAL_CONST(42346.917634124227/8.0),
+    REAL_CONST(42366.045596325886/8.0),
+    REAL_CONST(42385.175717805352/8.0),
+    REAL_CONST(42404.307998075295/8.0),
+    REAL_CONST(42423.442436648642/8.0),
+    REAL_CONST(42442.579033038608/8.0),
+    REAL_CONST(42461.717786758672/8.0),
+    REAL_CONST(42480.858697322597/8.0),
+    REAL_CONST(42500.001764244422/8.0),
+    REAL_CONST(42519.146987038446/8.0),
+    REAL_CONST(42538.294365219248/8.0),
+    REAL_CONST(42557.443898301688/8.0),
+    REAL_CONST(42576.595585800882/8.0),
+    REAL_CONST(42595.749427232236/8.0),
+    REAL_CONST(42614.90542211142/8.0),
+    REAL_CONST(42634.063569954378/8.0),
+    REAL_CONST(42653.223870277317/8.0),
+    REAL_CONST(42672.386322596729/8.0),
+    REAL_CONST(42691.55092642938/8.0),
+    REAL_CONST(42710.717681292292/8.0),
+    REAL_CONST(42729.886586702756/8.0),
+    REAL_CONST(42749.057642178363/8.0),
+    REAL_CONST(42768.23084723694/8.0),
+    REAL_CONST(42787.406201396603/8.0),
+    REAL_CONST(42806.58370417574/8.0),
+    REAL_CONST(42825.76335509299/8.0),
+    REAL_CONST(42844.945153667286/8.0),
+    REAL_CONST(42864.129099417805/8.0),
+    REAL_CONST(42883.315191864014/8.0),
+    REAL_CONST(42902.503430525649/8.0),
+    REAL_CONST(42921.693814922692/8.0),
+    REAL_CONST(42940.88634457541/8.0),
+    REAL_CONST(42960.081019004348/8.0),
+    REAL_CONST(42979.277837730297/8.0),
+    REAL_CONST(42998.476800274322/8.0),
+    REAL_CONST(43017.677906157769/8.0),
+    REAL_CONST(43036.881154902228/8.0),
+    REAL_CONST(43056.086546029583/8.0),
+    REAL_CONST(43075.294079061961/8.0),
+    REAL_CONST(43094.503753521763/8.0),
+    REAL_CONST(43113.715568931671/8.0),
+    REAL_CONST(43132.929524814601/8.0),
+    REAL_CONST(43152.145620693766/8.0),
+    REAL_CONST(43171.363856092619/8.0),
+    REAL_CONST(43190.584230534907/8.0),
+    REAL_CONST(43209.806743544621/8.0),
+    REAL_CONST(43229.031394646016/8.0),
+    REAL_CONST(43248.258183363621/8.0),
+    REAL_CONST(43267.487109222224/8.0),
+    REAL_CONST(43286.718171746885/8.0),
+    REAL_CONST(43305.951370462906/8.0),
+    REAL_CONST(43325.186704895881/8.0),
+    REAL_CONST(43344.42417457165/8.0),
+    REAL_CONST(43363.663779016322/8.0),
+    REAL_CONST(43382.905517756262/8.0),
+    REAL_CONST(43402.149390318104/8.0),
+    REAL_CONST(43421.395396228749/8.0),
+    REAL_CONST(43440.643535015348/8.0),
+    REAL_CONST(43459.89380620532/8.0),
+    REAL_CONST(43479.146209326354/8.0),
+    REAL_CONST(43498.400743906379/8.0),
+    REAL_CONST(43517.657409473606/8.0),
+    REAL_CONST(43536.916205556496/8.0),
+    REAL_CONST(43556.177131683784/8.0),
+    REAL_CONST(43575.44018738444/8.0),
+    REAL_CONST(43594.705372187724/8.0),
+    REAL_CONST(43613.972685623135/8.0),
+    REAL_CONST(43633.242127220445/8.0),
+    REAL_CONST(43652.513696509668/8.0),
+    REAL_CONST(43671.787393021099/8.0),
+    REAL_CONST(43691.063216285271/8.0),
+    REAL_CONST(43710.341165833001/8.0),
+    REAL_CONST(43729.621241195346/8.0),
+    REAL_CONST(43748.903441903625/8.0),
+    REAL_CONST(43768.187767489413/8.0),
+    REAL_CONST(43787.474217484552/8.0),
+    REAL_CONST(43806.762791421126/8.0),
+    REAL_CONST(43826.053488831501/8.0),
+    REAL_CONST(43845.346309248278/8.0),
+    REAL_CONST(43864.641252204325/8.0),
+    REAL_CONST(43883.938317232765/8.0),
+    REAL_CONST(43903.237503866971/8.0),
+    REAL_CONST(43922.538811640596/8.0),
+    REAL_CONST(43941.842240087513/8.0),
+    REAL_CONST(43961.147788741881/8.0),
+    REAL_CONST(43980.455457138101/8.0),
+    REAL_CONST(43999.765244810835/8.0),
+    REAL_CONST(44019.077151295001/8.0),
+    REAL_CONST(44038.391176125755/8.0),
+    REAL_CONST(44057.70731883854/8.0),
+    REAL_CONST(44077.02557896902/8.0),
+    REAL_CONST(44096.345956053141/8.0),
+    REAL_CONST(44115.668449627083/8.0),
+    REAL_CONST(44134.993059227287/8.0),
+    REAL_CONST(44154.319784390456/8.0),
+    REAL_CONST(44173.648624653535/8.0),
+    REAL_CONST(44192.979579553728/8.0),
+    REAL_CONST(44212.312648628489/8.0),
+    REAL_CONST(44231.647831415532/8.0),
+    REAL_CONST(44250.985127452805/8.0),
+    REAL_CONST(44270.324536278538/8.0),
+    REAL_CONST(44289.666057431183/8.0),
+    REAL_CONST(44309.009690449464/8.0),
+    REAL_CONST(44328.355434872348/8.0),
+    REAL_CONST(44347.703290239064/8.0),
+    REAL_CONST(44367.053256089079/8.0),
+    REAL_CONST(44386.405331962109/8.0),
+    REAL_CONST(44405.759517398139/8.0),
+    REAL_CONST(44425.115811937387/8.0),
+    REAL_CONST(44444.474215120332/8.0),
+    REAL_CONST(44463.834726487694/8.0),
+    REAL_CONST(44483.197345580462/8.0),
+    REAL_CONST(44502.562071939843/8.0),
+    REAL_CONST(44521.928905107328/8.0),
+    REAL_CONST(44541.297844624634/8.0),
+    REAL_CONST(44560.668890033732/8.0),
+    REAL_CONST(44580.042040876848/8.0),
+    REAL_CONST(44599.417296696454/8.0),
+    REAL_CONST(44618.794657035272/8.0),
+    REAL_CONST(44638.174121436256/8.0),
+    REAL_CONST(44657.555689442641/8.0),
+    REAL_CONST(44676.939360597877/8.0),
+    REAL_CONST(44696.325134445673/8.0),
+    REAL_CONST(44715.713010530002/8.0),
+    REAL_CONST(44735.102988395054/8.0),
+    REAL_CONST(44754.495067585296/8.0),
+    REAL_CONST(44773.88924764542/8.0),
+    REAL_CONST(44793.285528120374/8.0),
+    REAL_CONST(44812.683908555344/8.0),
+    REAL_CONST(44832.084388495779/8.0),
+    REAL_CONST(44851.486967487363/8.0),
+    REAL_CONST(44870.891645076015/8.0),
+    REAL_CONST(44890.298420807922/8.0),
+    REAL_CONST(44909.707294229491/8.0),
+    REAL_CONST(44929.118264887409/8.0),
+    REAL_CONST(44948.531332328566/8.0),
+    REAL_CONST(44967.946496100136/8.0),
+    REAL_CONST(44987.363755749502/8.0),
+    REAL_CONST(45006.783110824319/8.0),
+    REAL_CONST(45026.204560872473/8.0),
+    REAL_CONST(45045.628105442098/8.0),
+    REAL_CONST(45065.053744081561/8.0),
+    REAL_CONST(45084.48147633949/8.0),
+    REAL_CONST(45103.911301764747/8.0),
+    REAL_CONST(45123.343219906426/8.0),
+    REAL_CONST(45142.777230313885/8.0),
+    REAL_CONST(45162.21333253671/8.0),
+    REAL_CONST(45181.651526124733/8.0),
+    REAL_CONST(45201.091810628037/8.0),
+    REAL_CONST(45220.534185596924/8.0),
+    REAL_CONST(45239.978650581965/8.0),
+    REAL_CONST(45259.425205133957/8.0),
+    REAL_CONST(45278.873848803938/8.0),
+    REAL_CONST(45298.324581143192/8.0),
+    REAL_CONST(45317.777401703235/8.0),
+    REAL_CONST(45337.232310035848/8.0),
+    REAL_CONST(45356.68930569302/8.0),
+    REAL_CONST(45376.148388226997/8.0),
+    REAL_CONST(45395.60955719027/8.0),
+    REAL_CONST(45415.072812135557/8.0),
+    REAL_CONST(45434.538152615823/8.0),
+    REAL_CONST(45454.005578184282/8.0),
+    REAL_CONST(45473.475088394356/8.0),
+    REAL_CONST(45492.946682799746/8.0),
+    REAL_CONST(45512.420360954362/8.0),
+    REAL_CONST(45531.896122412363/8.0),
+    REAL_CONST(45551.373966728155/8.0),
+    REAL_CONST(45570.853893456362/8.0),
+    REAL_CONST(45590.33590215187/8.0),
+    REAL_CONST(45609.819992369776/8.0),
+    REAL_CONST(45629.306163665438/8.0),
+    REAL_CONST(45648.794415594442/8.0),
+    REAL_CONST(45668.284747712612/8.0),
+    REAL_CONST(45687.777159576006/8.0),
+    REAL_CONST(45707.27165074092/8.0),
+    REAL_CONST(45726.768220763894/8.0),
+    REAL_CONST(45746.266869201696/8.0),
+    REAL_CONST(45765.767595611323/8.0),
+    REAL_CONST(45785.270399550034/8.0),
+    REAL_CONST(45804.775280575297/8.0),
+    REAL_CONST(45824.282238244828/8.0),
+    REAL_CONST(45843.79127211657/8.0),
+    REAL_CONST(45863.302381748719/8.0),
+    REAL_CONST(45882.815566699683/8.0),
+    REAL_CONST(45902.33082652813/8.0),
+    REAL_CONST(45921.848160792935/8.0),
+    REAL_CONST(45941.367569053225/8.0),
+    REAL_CONST(45960.889050868354/8.0),
+    REAL_CONST(45980.41260579793/8.0),
+    REAL_CONST(45999.938233401757/8.0),
+    REAL_CONST(46019.465933239902/8.0),
+    REAL_CONST(46038.995704872657/8.0),
+    REAL_CONST(46058.527547860547/8.0),
+    REAL_CONST(46078.06146176433/8.0),
+    REAL_CONST(46097.597446144995/8.0),
+    REAL_CONST(46117.135500563774/8.0),
+    REAL_CONST(46136.675624582109/8.0),
+    REAL_CONST(46156.217817761702/8.0),
+    REAL_CONST(46175.762079664462/8.0),
+    REAL_CONST(46195.308409852543/8.0),
+    REAL_CONST(46214.856807888333/8.0),
+    REAL_CONST(46234.407273334444/8.0),
+    REAL_CONST(46253.959805753715/8.0),
+    REAL_CONST(46273.51440470924/8.0),
+    REAL_CONST(46293.071069764315/8.0),
+    REAL_CONST(46312.629800482478/8.0),
+    REAL_CONST(46332.190596427499/8.0),
+    REAL_CONST(46351.753457163381/8.0),
+    REAL_CONST(46371.318382254351/8.0),
+    REAL_CONST(46390.885371264863/8.0),
+    REAL_CONST(46410.45442375962/8.0),
+    REAL_CONST(46430.025539303526/8.0),
+    REAL_CONST(46449.598717461733/8.0),
+    REAL_CONST(46469.17395779962/8.0),
+    REAL_CONST(46488.751259882782/8.0),
+    REAL_CONST(46508.33062327707/8.0),
+    REAL_CONST(46527.912047548532/8.0),
+    REAL_CONST(46547.495532263471/8.0),
+    REAL_CONST(46567.081076988397/8.0),
+    REAL_CONST(46586.668681290059/8.0),
+    REAL_CONST(46606.258344735434/8.0),
+    REAL_CONST(46625.850066891719/8.0),
+    REAL_CONST(46645.443847326351/8.0),
+    REAL_CONST(46665.039685606986/8.0),
+    REAL_CONST(46684.637581301497/8.0),
+    REAL_CONST(46704.237533978005/8.0),
+    REAL_CONST(46723.839543204842/8.0),
+    REAL_CONST(46743.443608550573/8.0),
+    REAL_CONST(46763.049729583989/8.0),
+    REAL_CONST(46782.657905874104/8.0),
+    REAL_CONST(46802.268136990162/8.0),
+    REAL_CONST(46821.880422501628/8.0),
+    REAL_CONST(46841.494761978196/8.0),
+    REAL_CONST(46861.111154989776/8.0),
+    REAL_CONST(46880.729601106526/8.0),
+    REAL_CONST(46900.350099898795/8.0),
+    REAL_CONST(46919.97265093719/8.0),
+    REAL_CONST(46939.597253792526/8.0),
+    REAL_CONST(46959.223908035841/8.0),
+    REAL_CONST(46978.852613238392/8.0),
+    REAL_CONST(46998.483368971691/8.0),
+    REAL_CONST(47018.11617480743/8.0),
+    REAL_CONST(47037.751030317551/8.0),
+    REAL_CONST(47057.387935074221/8.0),
+    REAL_CONST(47077.026888649809/8.0),
+    REAL_CONST(47096.66789061694/8.0),
+    REAL_CONST(47116.310940548428/8.0),
+    REAL_CONST(47135.956038017328/8.0),
+    REAL_CONST(47155.603182596918/8.0),
+    REAL_CONST(47175.252373860698/8.0),
+    REAL_CONST(47194.903611382375/8.0),
+    REAL_CONST(47214.556894735892/8.0),
+    REAL_CONST(47234.212223495422/8.0),
+    REAL_CONST(47253.869597235338/8.0),
+    REAL_CONST(47273.52901553025/8.0),
+    REAL_CONST(47293.19047795498/8.0),
+    REAL_CONST(47312.853984084577/8.0),
+    REAL_CONST(47332.519533494306/8.0),
+    REAL_CONST(47352.187125759658/8.0),
+    REAL_CONST(47371.856760456343/8.0),
+    REAL_CONST(47391.528437160297/8.0),
+    REAL_CONST(47411.202155447652/8.0),
+    REAL_CONST(47430.877914894787/8.0),
+    REAL_CONST(47450.555715078299/8.0),
+    REAL_CONST(47470.235555574982/8.0),
+    REAL_CONST(47489.917435961863/8.0),
+    REAL_CONST(47509.601355816201/8.0),
+    REAL_CONST(47529.287314715453/8.0),
+    REAL_CONST(47548.975312237308/8.0),
+    REAL_CONST(47568.665347959672/8.0),
+    REAL_CONST(47588.357421460656/8.0),
+    REAL_CONST(47608.051532318605/8.0),
+    REAL_CONST(47627.747680112072/8.0),
+    REAL_CONST(47647.445864419846/8.0),
+    REAL_CONST(47667.14608482091/8.0),
+    REAL_CONST(47686.848340894474/8.0),
+    REAL_CONST(47706.552632219973/8.0),
+    REAL_CONST(47726.258958377046/8.0),
+    REAL_CONST(47745.967318945557/8.0),
+    REAL_CONST(47765.677713505589/8.0),
+    REAL_CONST(47785.390141637428/8.0),
+    REAL_CONST(47805.104602921601/8.0),
+    REAL_CONST(47824.821096938824/8.0),
+    REAL_CONST(47844.539623270044/8.0),
+    REAL_CONST(47864.260181496429/8.0),
+    REAL_CONST(47883.982771199349/8.0),
+    REAL_CONST(47903.707391960394/8.0),
+    REAL_CONST(47923.434043361369/8.0),
+    REAL_CONST(47943.162724984308/8.0),
+    REAL_CONST(47962.893436411439/8.0),
+    REAL_CONST(47982.626177225218/8.0),
+    REAL_CONST(48002.36094700831/8.0),
+    REAL_CONST(48022.097745343599/8.0),
+    REAL_CONST(48041.836571814172/8.0),
+    REAL_CONST(48061.57742600335/8.0),
+    REAL_CONST(48081.32030749465/8.0),
+    REAL_CONST(48101.065215871815/8.0),
+    REAL_CONST(48120.81215071879/8.0),
+    REAL_CONST(48140.56111161974/8.0),
+    REAL_CONST(48160.312098159047/8.0),
+    REAL_CONST(48180.065109921306/8.0),
+    REAL_CONST(48199.820146491307/8.0),
+    REAL_CONST(48219.577207454073/8.0),
+    REAL_CONST(48239.336292394844/8.0),
+    REAL_CONST(48259.097400899045/8.0),
+    REAL_CONST(48278.860532552339/8.0),
+    REAL_CONST(48298.625686940592/8.0),
+    REAL_CONST(48318.392863649875/8.0),
+    REAL_CONST(48338.162062266485/8.0),
+    REAL_CONST(48357.933282376915/8.0),
+    REAL_CONST(48377.706523567889/8.0),
+    REAL_CONST(48397.481785426316/8.0),
+    REAL_CONST(48417.259067539344/8.0),
+    REAL_CONST(48437.038369494308/8.0),
+    REAL_CONST(48456.819690878765/8.0),
+    REAL_CONST(48476.603031280487/8.0),
+    REAL_CONST(48496.388390287451/8.0),
+    REAL_CONST(48516.175767487839/8.0),
+    REAL_CONST(48535.965162470042/8.0),
+    REAL_CONST(48555.756574822684/8.0),
+    REAL_CONST(48575.550004134566/8.0),
+    REAL_CONST(48595.345449994718/8.0),
+    REAL_CONST(48615.142911992378/8.0),
+    REAL_CONST(48634.942389716991/8.0),
+    REAL_CONST(48654.743882758201/8.0),
+    REAL_CONST(48674.547390705877/8.0),
+    REAL_CONST(48694.352913150084/8.0),
+    REAL_CONST(48714.160449681112/8.0),
+    REAL_CONST(48733.969999889443/8.0),
+    REAL_CONST(48753.781563365759/8.0),
+    REAL_CONST(48773.595139700978/8.0),
+    REAL_CONST(48793.410728486211/8.0),
+    REAL_CONST(48813.228329312769/8.0),
+    REAL_CONST(48833.047941772187/8.0),
+    REAL_CONST(48852.869565456189/8.0),
+    REAL_CONST(48872.693199956717/8.0),
+    REAL_CONST(48892.518844865925/8.0),
+    REAL_CONST(48912.346499776155/8.0),
+    REAL_CONST(48932.176164279976/8.0),
+    REAL_CONST(48952.007837970152/8.0),
+    REAL_CONST(48971.841520439666/8.0),
+    REAL_CONST(48991.677211281676/8.0),
+    REAL_CONST(49011.514910089587/8.0),
+    REAL_CONST(49031.354616456978/8.0),
+    REAL_CONST(49051.196329977654/8.0),
+    REAL_CONST(49071.04005024561/8.0),
+    REAL_CONST(49090.885776855059/8.0),
+    REAL_CONST(49110.733509400408/8.0),
+    REAL_CONST(49130.583247476279/8.0),
+    REAL_CONST(49150.434990677488/8.0),
+    REAL_CONST(49170.288738599062/8.0),
+    REAL_CONST(49190.144490836232/8.0),
+    REAL_CONST(49210.002246984441/8.0),
+    REAL_CONST(49229.86200663932/8.0),
+    REAL_CONST(49249.723769396718/8.0),
+    REAL_CONST(49269.587534852675/8.0),
+    REAL_CONST(49289.453302603448/8.0),
+    REAL_CONST(49309.32107224549/8.0),
+    REAL_CONST(49329.190843375451/8.0),
+    REAL_CONST(49349.062615590192/8.0),
+    REAL_CONST(49368.936388486785/8.0),
+    REAL_CONST(49388.812161662492/8.0),
+    REAL_CONST(49408.689934714785/8.0),
+    REAL_CONST(49428.569707241324/8.0),
+    REAL_CONST(49448.45147883999/8.0),
+    REAL_CONST(49468.335249108866/8.0),
+    REAL_CONST(49488.22101764621/8.0),
+    REAL_CONST(49508.108784050521/8.0),
+    REAL_CONST(49527.99854792047/8.0),
+    REAL_CONST(49547.890308854934/8.0),
+    REAL_CONST(49567.784066453009/8.0),
+    REAL_CONST(49587.679820313977/8.0),
+    REAL_CONST(49607.57757003732/8.0),
+    REAL_CONST(49627.477315222721/8.0),
+    REAL_CONST(49647.379055470075/8.0),
+    REAL_CONST(49667.28279037946/8.0),
+    REAL_CONST(49687.188519551179/8.0),
+    REAL_CONST(49707.096242585707/8.0),
+    REAL_CONST(49727.005959083741/8.0),
+    REAL_CONST(49746.917668646165/8.0),
+    REAL_CONST(49766.831370874068/8.0),
+    REAL_CONST(49786.747065368734/8.0),
+    REAL_CONST(49806.66475173166/8.0),
+    REAL_CONST(49826.584429564515/8.0),
+    REAL_CONST(49846.506098469203/8.0),
+    REAL_CONST(49866.429758047794/8.0),
+    REAL_CONST(49886.355407902578/8.0),
+    REAL_CONST(49906.283047636032/8.0),
+    REAL_CONST(49926.212676850846/8.0),
+    REAL_CONST(49946.144295149883/8.0),
+    REAL_CONST(49966.077902136225/8.0),
+    REAL_CONST(49986.013497413151/8.0),
+    REAL_CONST(50005.951080584135/8.0),
+    REAL_CONST(50025.890651252834/8.0),
+    REAL_CONST(50045.832209023123/8.0),
+    REAL_CONST(50065.775753499074/8.0),
+    REAL_CONST(50085.721284284933/8.0),
+    REAL_CONST(50105.668800985164/8.0),
+    REAL_CONST(50125.618303204428/8.0),
+    REAL_CONST(50145.569790547575/8.0),
+    REAL_CONST(50165.523262619652/8.0),
+    REAL_CONST(50185.478719025901/8.0),
+    REAL_CONST(50205.436159371769/8.0),
+    REAL_CONST(50225.395583262893/8.0),
+    REAL_CONST(50245.356990305103/8.0),
+    REAL_CONST(50265.320380104429/8.0),
+    REAL_CONST(50285.285752267104/8.0),
+    REAL_CONST(50305.253106399534/8.0),
+    REAL_CONST(50325.222442108337/8.0),
+    REAL_CONST(50345.193759000336/8.0),
+    REAL_CONST(50365.16705668252/8.0),
+    REAL_CONST(50385.142334762102/8.0),
+    REAL_CONST(50405.119592846473/8.0),
+    REAL_CONST(50425.098830543218/8.0),
+    REAL_CONST(50445.080047460127/8.0),
+    REAL_CONST(50465.063243205179/8.0),
+    REAL_CONST(50485.048417386541/8.0),
+    REAL_CONST(50505.035569612577/8.0),
+    REAL_CONST(50525.024699491856/8.0),
+    REAL_CONST(50545.015806633128/8.0),
+    REAL_CONST(50565.008890645338/8.0),
+    REAL_CONST(50585.003951137631/8.0),
+    REAL_CONST(50605.00098771933/8.0),
+    REAL_CONST(50624.999999999971/8.0),
+    REAL_CONST(50645.000987589265/8.0),
+    REAL_CONST(50665.003950097132/8.0),
+    REAL_CONST(50685.008887133677/8.0),
+    REAL_CONST(50705.015798309192/8.0),
+    REAL_CONST(50725.024683234165/8.0),
+    REAL_CONST(50745.035541519283/8.0),
+    REAL_CONST(50765.048372775411/8.0),
+    REAL_CONST(50785.063176613621/8.0),
+    REAL_CONST(50805.079952645159/8.0),
+    REAL_CONST(50825.098700481489/8.0),
+    REAL_CONST(50845.119419734241/8.0),
+    REAL_CONST(50865.142110015244/8.0),
+    REAL_CONST(50885.166770936521/8.0),
+    REAL_CONST(50905.193402110279/8.0),
+    REAL_CONST(50925.222003148934/8.0),
+    REAL_CONST(50945.252573665071/8.0),
+    REAL_CONST(50965.285113271471/8.0),
+    REAL_CONST(50985.319621581119/8.0),
+    REAL_CONST(51005.356098207172/8.0),
+    REAL_CONST(51025.394542762981/8.0),
+    REAL_CONST(51045.434954862096/8.0),
+    REAL_CONST(51065.477334118244/8.0),
+    REAL_CONST(51085.521680145357/8.0),
+    REAL_CONST(51105.567992557546/8.0),
+    REAL_CONST(51125.616270969113/8.0),
+    REAL_CONST(51145.66651499454/8.0),
+    REAL_CONST(51165.718724248516/8.0),
+    REAL_CONST(51185.772898345916/8.0),
+    REAL_CONST(51205.829036901778/8.0),
+    REAL_CONST(51225.887139531362/8.0),
+    REAL_CONST(51245.947205850105/8.0),
+    REAL_CONST(51266.009235473619/8.0),
+    REAL_CONST(51286.073228017718/8.0),
+    REAL_CONST(51306.139183098399/8.0),
+    REAL_CONST(51326.207100331856/8.0),
+    REAL_CONST(51346.276979334456/8.0),
+    REAL_CONST(51366.348819722756/8.0),
+    REAL_CONST(51386.42262111351/8.0),
+    REAL_CONST(51406.498383123653/8.0),
+    REAL_CONST(51426.57610537031/8.0),
+    REAL_CONST(51446.655787470787/8.0),
+    REAL_CONST(51466.737429042587/8.0),
+    REAL_CONST(51486.82102970338/8.0),
+    REAL_CONST(51506.906589071048/8.0),
+    REAL_CONST(51526.994106763632/8.0),
+    REAL_CONST(51547.083582399391/8.0),
+    REAL_CONST(51567.175015596738/8.0),
+    REAL_CONST(51587.268405974297/8.0),
+    REAL_CONST(51607.363753150858/8.0),
+    REAL_CONST(51627.461056745415/8.0),
+    REAL_CONST(51647.56031637713/8.0),
+    REAL_CONST(51667.661531665362/8.0),
+    REAL_CONST(51687.764702229651/8.0),
+    REAL_CONST(51707.869827689727/8.0),
+    REAL_CONST(51727.976907665499/8.0),
+    REAL_CONST(51748.085941777055/8.0),
+    REAL_CONST(51768.196929644677/8.0),
+    REAL_CONST(51788.309870888836/8.0),
+    REAL_CONST(51808.42476513017/8.0),
+    REAL_CONST(51828.541611989524/8.0),
+    REAL_CONST(51848.660411087905/8.0),
+    REAL_CONST(51868.781162046515/8.0),
+    REAL_CONST(51888.90386448674/8.0),
+    REAL_CONST(51909.028518030143/8.0),
+    REAL_CONST(51929.155122298485/8.0),
+    REAL_CONST(51949.283676913685/8.0),
+    REAL_CONST(51969.414181497872/8.0),
+    REAL_CONST(51989.546635673345/8.0),
+    REAL_CONST(52009.681039062583/8.0),
+    REAL_CONST(52029.817391288263/8.0),
+    REAL_CONST(52049.955691973213/8.0),
+    REAL_CONST(52070.095940740481/8.0),
+    REAL_CONST(52090.238137213273/8.0),
+    REAL_CONST(52110.382281014987/8.0),
+    REAL_CONST(52130.5283717692/8.0),
+    REAL_CONST(52150.676409099666/8.0),
+    REAL_CONST(52170.826392630333/8.0),
+    REAL_CONST(52190.97832198532/8.0),
+    REAL_CONST(52211.132196788931/8.0),
+    REAL_CONST(52231.288016665654/8.0),
+    REAL_CONST(52251.445781240145/8.0),
+    REAL_CONST(52271.60549013727/8.0),
+    REAL_CONST(52291.76714298204/8.0),
+    REAL_CONST(52311.930739399664/8.0),
+    REAL_CONST(52332.096279015546/8.0),
+    REAL_CONST(52352.263761455244/8.0),
+    REAL_CONST(52372.433186344519/8.0),
+    REAL_CONST(52392.604553309284/8.0),
+    REAL_CONST(52412.777861975665/8.0),
+    REAL_CONST(52432.953111969946/8.0),
+    REAL_CONST(52453.130302918595/8.0),
+    REAL_CONST(52473.309434448267/8.0),
+    REAL_CONST(52493.490506185793/8.0),
+    REAL_CONST(52513.67351775818/8.0),
+    REAL_CONST(52533.858468792605/8.0),
+    REAL_CONST(52554.045358916446/8.0),
+    REAL_CONST(52574.234187757254/8.0),
+    REAL_CONST(52594.42495494274/8.0),
+    REAL_CONST(52614.617660100812/8.0),
+    REAL_CONST(52634.812302859558/8.0),
+    REAL_CONST(52655.008882847229/8.0),
+    REAL_CONST(52675.20739969227/8.0),
+    REAL_CONST(52695.407853023295/8.0),
+    REAL_CONST(52715.610242469098/8.0),
+    REAL_CONST(52735.814567658657/8.0),
+    REAL_CONST(52756.02082822111/8.0),
+    REAL_CONST(52776.229023785803/8.0),
+    REAL_CONST(52796.439153982225/8.0),
+    REAL_CONST(52816.651218440056/8.0),
+    REAL_CONST(52836.865216789171/8.0),
+    REAL_CONST(52857.081148659599/8.0),
+    REAL_CONST(52877.29901368155/8.0),
+    REAL_CONST(52897.518811485425/8.0),
+    REAL_CONST(52917.740541701773/8.0),
+    REAL_CONST(52937.964203961354/8.0),
+    REAL_CONST(52958.18979789508/8.0),
+    REAL_CONST(52978.417323134046/8.0),
+    REAL_CONST(52998.646779309529/8.0),
+    REAL_CONST(53018.878166052978/8.0),
+    REAL_CONST(53039.111482996006/8.0),
+    REAL_CONST(53059.346729770419/8.0),
+    REAL_CONST(53079.583906008193/8.0),
+    REAL_CONST(53099.823011341483/8.0),
+    REAL_CONST(53120.0640454026/8.0),
+    REAL_CONST(53140.307007824063/8.0),
+    REAL_CONST(53160.551898238533/8.0),
+    REAL_CONST(53180.79871627887/8.0),
+    REAL_CONST(53201.047461578091/8.0),
+    REAL_CONST(53221.2981337694/8.0),
+    REAL_CONST(53241.550732486176/8.0),
+    REAL_CONST(53261.805257361964/8.0),
+    REAL_CONST(53282.061708030487/8.0),
+    REAL_CONST(53302.32008412564/8.0),
+    REAL_CONST(53322.580385281493/8.0),
+    REAL_CONST(53342.842611132299/8.0),
+    REAL_CONST(53363.106761312469/8.0),
+    REAL_CONST(53383.372835456597/8.0),
+    REAL_CONST(53403.640833199453/8.0),
+    REAL_CONST(53423.910754175973/8.0),
+    REAL_CONST(53444.18259802126/8.0),
+    REAL_CONST(53464.456364370613/8.0),
+    REAL_CONST(53484.732052859479/8.0),
+    REAL_CONST(53505.009663123499/8.0),
+    REAL_CONST(53525.289194798468/8.0),
+    REAL_CONST(53545.570647520362/8.0),
+    REAL_CONST(53565.854020925333/8.0),
+    REAL_CONST(53586.139314649699/8.0),
+    REAL_CONST(53606.426528329954/8.0),
+    REAL_CONST(53626.715661602764/8.0),
+    REAL_CONST(53647.006714104959/8.0),
+    REAL_CONST(53667.299685473547/8.0),
+    REAL_CONST(53687.59457534572/8.0),
+    REAL_CONST(53707.891383358816/8.0),
+    REAL_CONST(53728.190109150361/8.0),
+    REAL_CONST(53748.490752358055/8.0),
+    REAL_CONST(53768.793312619753/8.0),
+    REAL_CONST(53789.09778957349/8.0),
+    REAL_CONST(53809.404182857485/8.0),
+    REAL_CONST(53829.712492110106/8.0),
+    REAL_CONST(53850.022716969899/8.0),
+    REAL_CONST(53870.334857075584/8.0),
+    REAL_CONST(53890.648912066055/8.0),
+    REAL_CONST(53910.964881580367/8.0),
+    REAL_CONST(53931.28276525774/8.0),
+    REAL_CONST(53951.602562737586/8.0),
+    REAL_CONST(53971.924273659461/8.0),
+    REAL_CONST(53992.24789766311/8.0),
+    REAL_CONST(54012.57343438844/8.0),
+    REAL_CONST(54032.90088347553/8.0),
+    REAL_CONST(54053.23024456462/8.0),
+    REAL_CONST(54073.561517296133/8.0),
+    REAL_CONST(54093.894701310644/8.0),
+    REAL_CONST(54114.22979624891/8.0),
+    REAL_CONST(54134.566801751855/8.0),
+    REAL_CONST(54154.90571746057/8.0),
+    REAL_CONST(54175.246543016314/8.0),
+    REAL_CONST(54195.589278060506/8.0),
+    REAL_CONST(54215.933922234755/8.0),
+    REAL_CONST(54236.280475180814/8.0),
+    REAL_CONST(54256.628936540626/8.0),
+    REAL_CONST(54276.97930595628/8.0),
+    REAL_CONST(54297.331583070045/8.0),
+    REAL_CONST(54317.685767524359/8.0),
+    REAL_CONST(54338.041858961828/8.0),
+    REAL_CONST(54358.399857025215/8.0),
+    REAL_CONST(54378.759761357462/8.0),
+    REAL_CONST(54399.121571601667/8.0),
+    REAL_CONST(54419.485287401105/8.0),
+    REAL_CONST(54439.850908399218/8.0),
+    REAL_CONST(54460.218434239614/8.0),
+    REAL_CONST(54480.587864566056/8.0),
+    REAL_CONST(54500.95919902248/8.0),
+    REAL_CONST(54521.332437252997/8.0),
+    REAL_CONST(54541.707578901878/8.0),
+    REAL_CONST(54562.084623613555/8.0),
+    REAL_CONST(54582.46357103264/8.0),
+    REAL_CONST(54602.844420803893/8.0),
+    REAL_CONST(54623.227172572246/8.0),
+    REAL_CONST(54643.611825982807/8.0),
+    REAL_CONST(54663.998380680838/8.0),
+    REAL_CONST(54684.386836311773/8.0),
+    REAL_CONST(54704.777192521207/8.0),
+    REAL_CONST(54725.169448954897/8.0),
+    REAL_CONST(54745.563605258772/8.0),
+    REAL_CONST(54765.959661078923/8.0),
+    REAL_CONST(54786.357616061614/8.0),
+    REAL_CONST(54806.757469853255/8.0),
+    REAL_CONST(54827.159222100439/8.0),
+    REAL_CONST(54847.562872449904/8.0),
+    REAL_CONST(54867.968420548583/8.0),
+    REAL_CONST(54888.375866043534/8.0),
+    REAL_CONST(54908.785208582012/8.0),
+    REAL_CONST(54929.196447811417/8.0),
+    REAL_CONST(54949.609583379322/8.0),
+    REAL_CONST(54970.024614933463/8.0),
+    REAL_CONST(54990.441542121727/8.0),
+    REAL_CONST(55010.86036459219/8.0),
+    REAL_CONST(55031.28108199306/8.0),
+    REAL_CONST(55051.703693972733/8.0),
+    REAL_CONST(55072.128200179759/8.0),
+    REAL_CONST(55092.554600262847/8.0),
+    REAL_CONST(55112.982893870874/8.0),
+    REAL_CONST(55133.413080652877/8.0),
+    REAL_CONST(55153.845160258061/8.0),
+    REAL_CONST(55174.279132335789/8.0),
+    REAL_CONST(55194.714996535586/8.0),
+    REAL_CONST(55215.152752507143/8.0),
+    REAL_CONST(55235.592399900306/8.0),
+    REAL_CONST(55256.033938365079/8.0),
+    REAL_CONST(55276.477367551655/8.0),
+    REAL_CONST(55296.92268711036/8.0),
+    REAL_CONST(55317.369896691685/8.0),
+    REAL_CONST(55337.818995946305/8.0),
+    REAL_CONST(55358.269984525024/8.0),
+    REAL_CONST(55378.72286207883/8.0),
+    REAL_CONST(55399.177628258869/8.0),
+    REAL_CONST(55419.634282716441/8.0),
+    REAL_CONST(55440.092825103013/8.0),
+    REAL_CONST(55460.553255070205/8.0),
+    REAL_CONST(55481.015572269804/8.0),
+    REAL_CONST(55501.479776353764/8.0),
+    REAL_CONST(55521.945866974187/8.0),
+    REAL_CONST(55542.413843783339/8.0),
+    REAL_CONST(55562.883706433655/8.0),
+    REAL_CONST(55583.355454577715/8.0),
+    REAL_CONST(55603.82908786826/8.0),
+    REAL_CONST(55624.304605958219/8.0),
+    REAL_CONST(55644.782008500639/8.0),
+    REAL_CONST(55665.261295148754/8.0),
+    REAL_CONST(55685.742465555952/8.0),
+    REAL_CONST(55706.225519375774/8.0),
+    REAL_CONST(55726.710456261928/8.0),
+    REAL_CONST(55747.197275868275/8.0),
+    REAL_CONST(55767.685977848843/8.0),
+    REAL_CONST(55788.176561857814/8.0),
+    REAL_CONST(55808.669027549528/8.0),
+    REAL_CONST(55829.163374578478/8.0),
+    REAL_CONST(55849.659602599328/8.0),
+    REAL_CONST(55870.157711266889/8.0),
+    REAL_CONST(55890.657700236145/8.0),
+    REAL_CONST(55911.159569162221/8.0),
+    REAL_CONST(55931.663317700411/8.0),
+    REAL_CONST(55952.168945506164/8.0),
+    REAL_CONST(55972.676452235086/8.0),
+    REAL_CONST(55993.185837542944/8.0),
+    REAL_CONST(56013.697101085651/8.0),
+    REAL_CONST(56034.210242519301/8.0),
+    REAL_CONST(56054.72526150012/8.0),
+    REAL_CONST(56075.242157684508/8.0),
+    REAL_CONST(56095.760930729011/8.0),
+    REAL_CONST(56116.281580290342/8.0),
+    REAL_CONST(56136.804106025367/8.0),
+    REAL_CONST(56157.328507591104/8.0),
+    REAL_CONST(56177.85478464474/8.0),
+    REAL_CONST(56198.382936843598/8.0),
+    REAL_CONST(56218.912963845185/8.0),
+    REAL_CONST(56239.444865307138/8.0),
+    REAL_CONST(56259.978640887268/8.0),
+    REAL_CONST(56280.514290243525/8.0),
+    REAL_CONST(56301.051813034042/8.0),
+    REAL_CONST(56321.591208917082/8.0),
+    REAL_CONST(56342.13247755108/8.0),
+    REAL_CONST(56362.675618594607/8.0),
+    REAL_CONST(56383.220631706419/8.0),
+    REAL_CONST(56403.767516545398/8.0),
+    REAL_CONST(56424.316272770608/8.0),
+    REAL_CONST(56444.866900041241/8.0),
+    REAL_CONST(56465.419398016667/8.0),
+    REAL_CONST(56485.973766356394/8.0),
+    REAL_CONST(56506.530004720102/8.0),
+    REAL_CONST(56527.088112767611/8.0),
+    REAL_CONST(56547.648090158902/8.0),
+    REAL_CONST(56568.209936554107/8.0),
+    REAL_CONST(56588.773651613519/8.0),
+    REAL_CONST(56609.339234997584/8.0),
+    REAL_CONST(56629.9066863669/8.0),
+    REAL_CONST(56650.47600538221/8.0),
+    REAL_CONST(56671.04719170442/8.0),
+    REAL_CONST(56691.620244994599/8.0),
+    REAL_CONST(56712.195164913959/8.0),
+    REAL_CONST(56732.771951123868/8.0),
+    REAL_CONST(56753.350603285835/8.0),
+    REAL_CONST(56773.931121061541/8.0),
+    REAL_CONST(56794.513504112823/8.0),
+    REAL_CONST(56815.097752101647/8.0),
+    REAL_CONST(56835.683864690152/8.0),
+    REAL_CONST(56856.271841540627/8.0),
+    REAL_CONST(56876.86168231551/8.0),
+    REAL_CONST(56897.453386677393/8.0),
+    REAL_CONST(56918.046954289028/8.0),
+    REAL_CONST(56938.642384813298/8.0),
+    REAL_CONST(56959.239677913261/8.0),
+    REAL_CONST(56979.838833252121/8.0),
+    REAL_CONST(57000.439850493225/8.0),
+    REAL_CONST(57021.04272930009/8.0),
+    REAL_CONST(57041.647469336371/8.0),
+    REAL_CONST(57062.254070265873/8.0),
+    REAL_CONST(57082.862531752558/8.0),
+    REAL_CONST(57103.472853460553/8.0),
+    REAL_CONST(57124.085035054108/8.0),
+    REAL_CONST(57144.699076197649/8.0),
+    REAL_CONST(57165.314976555739/8.0),
+    REAL_CONST(57185.932735793103/8.0),
+    REAL_CONST(57206.552353574611/8.0),
+    REAL_CONST(57227.173829565276/8.0),
+    REAL_CONST(57247.797163430281/8.0),
+    REAL_CONST(57268.42235483494/8.0),
+    REAL_CONST(57289.049403444733/8.0),
+    REAL_CONST(57309.678308925286/8.0),
+    REAL_CONST(57330.30907094237/8.0),
+    REAL_CONST(57350.941689161911/8.0),
+    REAL_CONST(57371.576163249985/8.0),
+    REAL_CONST(57392.212492872815/8.0),
+    REAL_CONST(57412.850677696784/8.0),
+    REAL_CONST(57433.490717388406/8.0),
+    REAL_CONST(57454.132611614368/8.0),
+    REAL_CONST(57474.776360041491/8.0),
+    REAL_CONST(57495.421962336746/8.0),
+    REAL_CONST(57516.069418167266/8.0),
+    REAL_CONST(57536.718727200314/8.0),
+    REAL_CONST(57557.36988910332/8.0),
+    REAL_CONST(57578.022903543861/8.0),
+    REAL_CONST(57598.677770189643/8.0),
+    REAL_CONST(57619.334488708548/8.0),
+    REAL_CONST(57639.993058768589/8.0),
+    REAL_CONST(57660.653480037938/8.0),
+    REAL_CONST(57681.315752184906/8.0),
+    REAL_CONST(57701.979874877965/8.0),
+    REAL_CONST(57722.64584778573/8.0),
+    REAL_CONST(57743.31367057695/8.0),
+    REAL_CONST(57763.983342920546/8.0),
+    REAL_CONST(57784.654864485572/8.0),
+    REAL_CONST(57805.328234941233/8.0),
+    REAL_CONST(57826.003453956881/8.0),
+    REAL_CONST(57846.680521202026/8.0),
+    REAL_CONST(57867.359436346305/8.0),
+    REAL_CONST(57888.040199059527/8.0),
+    REAL_CONST(57908.722809011633/8.0),
+    REAL_CONST(57929.407265872709/8.0),
+    REAL_CONST(57950.093569313001/8.0),
+    REAL_CONST(57970.781719002895/8.0),
+    REAL_CONST(57991.471714612911/8.0),
+    REAL_CONST(58012.16355581375/8.0),
+    REAL_CONST(58032.857242276223/8.0),
+    REAL_CONST(58053.552773671312/8.0),
+    REAL_CONST(58074.25014967013/8.0),
+    REAL_CONST(58094.949369943948/8.0),
+    REAL_CONST(58115.650434164185/8.0),
+    REAL_CONST(58136.353342002389/8.0),
+    REAL_CONST(58157.058093130276/8.0),
+    REAL_CONST(58177.764687219693/8.0),
+    REAL_CONST(58198.47312394264/8.0),
+    REAL_CONST(58219.183402971255/8.0),
+    REAL_CONST(58239.895523977837/8.0),
+    REAL_CONST(58260.609486634821/8.0),
+    REAL_CONST(58281.325290614775/8.0),
+    REAL_CONST(58302.042935590434/8.0),
+    REAL_CONST(58322.762421234678/8.0),
+    REAL_CONST(58343.483747220511/8.0),
+    REAL_CONST(58364.206913221096/8.0),
+    REAL_CONST(58384.931918909751/8.0),
+    REAL_CONST(58405.658763959924/8.0),
+    REAL_CONST(58426.3874480452/8.0),
+    REAL_CONST(58447.117970839339/8.0),
+    REAL_CONST(58467.85033201622/8.0),
+    REAL_CONST(58488.584531249864/8.0),
+    REAL_CONST(58509.320568214462/8.0),
+    REAL_CONST(58530.058442584334/8.0),
+    REAL_CONST(58550.798154033931/8.0),
+    REAL_CONST(58571.539702237875/8.0),
+    REAL_CONST(58592.283086870906/8.0),
+    REAL_CONST(58613.028307607929/8.0),
+    REAL_CONST(58633.775364123983/8.0),
+    REAL_CONST(58654.52425609425/8.0),
+    REAL_CONST(58675.274983194053/8.0),
+    REAL_CONST(58696.027545098877/8.0),
+    REAL_CONST(58716.781941484325/8.0),
+    REAL_CONST(58737.538172026158/8.0),
+    REAL_CONST(58758.296236400274/8.0),
+    REAL_CONST(58779.056134282728/8.0),
+    REAL_CONST(58799.817865349694/8.0),
+    REAL_CONST(58820.581429277503/8.0),
+    REAL_CONST(58841.346825742643/8.0),
+    REAL_CONST(58862.114054421712/8.0),
+    REAL_CONST(58882.883114991484/8.0),
+    REAL_CONST(58903.654007128847/8.0),
+    REAL_CONST(58924.426730510851/8.0),
+    REAL_CONST(58945.201284814684/8.0),
+    REAL_CONST(58965.977669717664/8.0),
+    REAL_CONST(58986.755884897269/8.0),
+    REAL_CONST(59007.535930031117/8.0),
+    REAL_CONST(59028.317804796949/8.0),
+    REAL_CONST(59049.101508872664/8.0),
+    REAL_CONST(59069.887041936301/8.0),
+    REAL_CONST(59090.674403666046/8.0),
+    REAL_CONST(59111.463593740213/8.0),
+    REAL_CONST(59132.254611837263/8.0),
+    REAL_CONST(59153.047457635803/8.0),
+    REAL_CONST(59173.84213081457/8.0),
+    REAL_CONST(59194.638631052461/8.0),
+    REAL_CONST(59215.436958028506/8.0),
+    REAL_CONST(59236.237111421855/8.0),
+    REAL_CONST(59257.039090911829/8.0),
+    REAL_CONST(59277.842896177877/8.0),
+    REAL_CONST(59298.648526899589/8.0),
+    REAL_CONST(59319.455982756685/8.0),
+    REAL_CONST(59340.26526342905/8.0),
+    REAL_CONST(59361.076368596696/8.0),
+    REAL_CONST(59381.889297939757/8.0),
+    REAL_CONST(59402.704051138542/8.0),
+    REAL_CONST(59423.520627873484/8.0),
+    REAL_CONST(59444.339027825139/8.0),
+    REAL_CONST(59465.159250674224/8.0),
+    REAL_CONST(59485.9812961016/8.0),
+    REAL_CONST(59506.805163788253/8.0),
+    REAL_CONST(59527.630853415307/8.0),
+    REAL_CONST(59548.458364664046/8.0),
+    REAL_CONST(59569.287697215863/8.0),
+    REAL_CONST(59590.118850752311/8.0),
+    REAL_CONST(59610.951824955089/8.0),
+    REAL_CONST(59631.786619506012/8.0),
+    REAL_CONST(59652.623234087048/8.0),
+    REAL_CONST(59673.461668380311/8.0),
+    REAL_CONST(59694.301922068029/8.0),
+    REAL_CONST(59715.143994832593/8.0),
+    REAL_CONST(59735.987886356525/8.0),
+    REAL_CONST(59756.833596322482/8.0),
+    REAL_CONST(59777.681124413255/8.0),
+    REAL_CONST(59798.530470311794/8.0),
+    REAL_CONST(59819.381633701159/8.0),
+    REAL_CONST(59840.234614264569/8.0),
+    REAL_CONST(59861.089411685381/8.0),
+    REAL_CONST(59881.94602564707/8.0),
+    REAL_CONST(59902.804455833269/8.0),
+    REAL_CONST(59923.664701927737/8.0),
+    REAL_CONST(59944.526763614384/8.0),
+    REAL_CONST(59965.390640577243/8.0),
+    REAL_CONST(59986.256332500488/8.0),
+    REAL_CONST(60007.123839068438/8.0),
+    REAL_CONST(60027.993159965539/8.0),
+    REAL_CONST(60048.864294876381/8.0),
+    REAL_CONST(60069.737243485688/8.0),
+    REAL_CONST(60090.612005478324/8.0),
+    REAL_CONST(60111.488580539284/8.0),
+    REAL_CONST(60132.366968353708/8.0),
+    REAL_CONST(60153.247168606867/8.0),
+    REAL_CONST(60174.129180984164/8.0),
+    REAL_CONST(60195.013005171153/8.0),
+    REAL_CONST(60215.898640853513/8.0),
+    REAL_CONST(60236.786087717061/8.0),
+    REAL_CONST(60257.675345447751/8.0),
+    REAL_CONST(60278.566413731671/8.0),
+    REAL_CONST(60299.459292255044/8.0),
+    REAL_CONST(60320.353980704247/8.0),
+    REAL_CONST(60341.25047876576/8.0),
+    REAL_CONST(60362.148786126229/8.0),
+    REAL_CONST(60383.048902472423/8.0),
+    REAL_CONST(60403.950827491237/8.0),
+    REAL_CONST(60424.854560869717/8.0),
+    REAL_CONST(60445.76010229504/8.0),
+    REAL_CONST(60466.667451454516/8.0),
+    REAL_CONST(60487.57660803559/8.0),
+    REAL_CONST(60508.487571725847/8.0),
+    REAL_CONST(60529.400342212997/8.0),
+    REAL_CONST(60550.314919184893/8.0),
+    REAL_CONST(60571.231302329521/8.0),
+    REAL_CONST(60592.149491335003/8.0),
+    REAL_CONST(60613.069485889588/8.0),
+    REAL_CONST(60633.991285681674/8.0),
+    REAL_CONST(60654.914890399785/8.0),
+    REAL_CONST(60675.840299732568/8.0),
+    REAL_CONST(60696.767513368832/8.0),
+    REAL_CONST(60717.696530997484/8.0),
+    REAL_CONST(60738.627352307602/8.0),
+    REAL_CONST(60759.55997698837/8.0),
+    REAL_CONST(60780.494404729128/8.0),
+    REAL_CONST(60801.430635219323/8.0),
+    REAL_CONST(60822.368668148556/8.0),
+    REAL_CONST(60843.308503206565/8.0),
+    REAL_CONST(60864.250140083204/8.0),
+    REAL_CONST(60885.193578468468/8.0),
+    REAL_CONST(60906.138818052495/8.0),
+    REAL_CONST(60927.085858525541/8.0),
+    REAL_CONST(60948.034699578006/8.0),
+    REAL_CONST(60968.985340900421/8.0),
+    REAL_CONST(60989.937782183442/8.0),
+    REAL_CONST(61010.892023117864/8.0),
+    REAL_CONST(61031.848063394616/8.0),
+    REAL_CONST(61052.805902704764/8.0),
+    REAL_CONST(61073.765540739492/8.0),
+    REAL_CONST(61094.726977190134/8.0),
+    REAL_CONST(61115.690211748137/8.0),
+    REAL_CONST(61136.655244105103/8.0),
+    REAL_CONST(61157.622073952742/8.0),
+    REAL_CONST(61178.590700982917/8.0),
+    REAL_CONST(61199.561124887616/8.0),
+    REAL_CONST(61220.533345358948/8.0),
+    REAL_CONST(61241.507362089171/8.0),
+    REAL_CONST(61262.483174770663/8.0),
+    REAL_CONST(61283.460783095943/8.0),
+    REAL_CONST(61304.440186757645/8.0),
+    REAL_CONST(61325.421385448557/8.0),
+    REAL_CONST(61346.404378861582/8.0),
+    REAL_CONST(61367.389166689762/8.0),
+    REAL_CONST(61388.375748626262/8.0),
+    REAL_CONST(61409.364124364387/8.0),
+    REAL_CONST(61430.354293597571/8.0),
+    REAL_CONST(61451.346256019373/8.0),
+    REAL_CONST(61472.340011323497/8.0),
+    REAL_CONST(61493.335559203762/8.0),
+    REAL_CONST(61514.332899354122/8.0),
+    REAL_CONST(61535.332031468672/8.0),
+    REAL_CONST(61556.332955241618/8.0),
+    REAL_CONST(61577.335670367313/8.0),
+    REAL_CONST(61598.340176540238/8.0),
+    REAL_CONST(61619.346473454993/8.0),
+    REAL_CONST(61640.354560806329/8.0),
+    REAL_CONST(61661.3644382891/8.0),
+    REAL_CONST(61682.376105598312/8.0),
+    REAL_CONST(61703.389562429089/8.0),
+    REAL_CONST(61724.404808476691/8.0),
+    REAL_CONST(61745.42184343651/8.0),
+    REAL_CONST(61766.440667004063/8.0),
+    REAL_CONST(61787.461278874987/8.0),
+    REAL_CONST(61808.483678745069/8.0),
+    REAL_CONST(61829.507866310203/8.0),
+    REAL_CONST(61850.533841266435/8.0),
+    REAL_CONST(61871.561603309929/8.0),
+    REAL_CONST(61892.591152136971/8.0),
+    REAL_CONST(61913.622487443987/8.0),
+    REAL_CONST(61934.655608927525/8.0),
+    REAL_CONST(61955.690516284267/8.0),
+    REAL_CONST(61976.727209211022/8.0),
+    REAL_CONST(61997.765687404724/8.0),
+    REAL_CONST(62018.805950562448/8.0),
+    REAL_CONST(62039.847998381381/8.0),
+    REAL_CONST(62060.891830558845/8.0),
+    REAL_CONST(62081.93744679229/8.0),
+    REAL_CONST(62102.984846779298/8.0),
+    REAL_CONST(62124.034030217575/8.0),
+    REAL_CONST(62145.084996804966/8.0),
+    REAL_CONST(62166.137746239416/8.0),
+    REAL_CONST(62187.19227821903/8.0),
+    REAL_CONST(62208.248592442025/8.0),
+    REAL_CONST(62229.306688606739/8.0),
+    REAL_CONST(62250.366566411656/8.0),
+    REAL_CONST(62271.428225555377/8.0),
+    REAL_CONST(62292.491665736627/8.0),
+    REAL_CONST(62313.556886654267/8.0),
+    REAL_CONST(62334.623888007271/8.0),
+    REAL_CONST(62355.692669494762/8.0),
+    REAL_CONST(62376.763230815974/8.0),
+    REAL_CONST(62397.835571670272/8.0),
+    REAL_CONST(62418.909691757144/8.0),
+    REAL_CONST(62439.98559077621/8.0),
+    REAL_CONST(62461.063268427228/8.0),
+    REAL_CONST(62482.142724410049/8.0),
+    REAL_CONST(62503.223958424685/8.0),
+    REAL_CONST(62524.306970171267/8.0),
+    REAL_CONST(62545.39175935003/8.0),
+    REAL_CONST(62566.478325661366/8.0),
+    REAL_CONST(62587.566668805768/8.0),
+    REAL_CONST(62608.656788483881/8.0),
+    REAL_CONST(62629.748684396451/8.0),
+    REAL_CONST(62650.842356244357/8.0),
+    REAL_CONST(62671.937803728622/8.0),
+    REAL_CONST(62693.035026550366/8.0),
+    REAL_CONST(62714.134024410858/8.0),
+    REAL_CONST(62735.234797011479/8.0),
+    REAL_CONST(62756.337344053733/8.0),
+    REAL_CONST(62777.441665239276/8.0),
+    REAL_CONST(62798.547760269852/8.0),
+    REAL_CONST(62819.655628847358/8.0),
+    REAL_CONST(62840.765270673801/8.0),
+    REAL_CONST(62861.876685451323/8.0),
+    REAL_CONST(62882.989872882186/8.0),
+    REAL_CONST(62904.104832668774/8.0),
+    REAL_CONST(62925.221564513602/8.0),
+    REAL_CONST(62946.340068119309/8.0),
+    REAL_CONST(62967.460343188657/8.0),
+    REAL_CONST(62988.582389424526/8.0),
+    REAL_CONST(63009.70620652994/8.0),
+    REAL_CONST(63030.831794208025/8.0),
+    REAL_CONST(63051.959152162039/8.0),
+    REAL_CONST(63073.08828009537/8.0),
+    REAL_CONST(63094.219177711529/8.0),
+    REAL_CONST(63115.351844714154/8.0),
+    REAL_CONST(63136.486280806988/8.0),
+    REAL_CONST(63157.622485693922/8.0),
+    REAL_CONST(63178.760459078956/8.0),
+    REAL_CONST(63199.900200666219/8.0),
+    REAL_CONST(63221.041710159967/8.0),
+    REAL_CONST(63242.184987264569/8.0),
+    REAL_CONST(63263.330031684534/8.0),
+    REAL_CONST(63284.476843124474/8.0),
+    REAL_CONST(63305.625421289144/8.0),
+    REAL_CONST(63326.775765883409/8.0),
+    REAL_CONST(63347.927876612259/8.0),
+    REAL_CONST(63369.081753180813/8.0),
+    REAL_CONST(63390.237395294316/8.0),
+    REAL_CONST(63411.39480265812/8.0),
+    REAL_CONST(63432.553974977716/8.0),
+    REAL_CONST(63453.714911958712/8.0),
+    REAL_CONST(63474.877613306839/8.0),
+    REAL_CONST(63496.042078727944/8.0),
+    REAL_CONST(63517.208307927998/8.0),
+    REAL_CONST(63538.376300613119/8.0),
+    REAL_CONST(63559.546056489504/8.0),
+    REAL_CONST(63580.717575263516/8.0),
+    REAL_CONST(63601.890856641607/8.0),
+    REAL_CONST(63623.065900330374/8.0),
+    REAL_CONST(63644.242706036515/8.0),
+    REAL_CONST(63665.421273466869/8.0),
+    REAL_CONST(63686.601602328381/8.0),
+    REAL_CONST(63707.783692328136/8.0),
+    REAL_CONST(63728.967543173334/8.0),
+    REAL_CONST(63750.153154571279/8.0),
+    REAL_CONST(63771.340526229418/8.0),
+    REAL_CONST(63792.529657855317/8.0),
+    REAL_CONST(63813.720549156649/8.0),
+    REAL_CONST(63834.913199841227/8.0),
+    REAL_CONST(63856.107609616978/8.0),
+    REAL_CONST(63877.303778191941/8.0),
+    REAL_CONST(63898.501705274284/8.0),
+    REAL_CONST(63919.7013905723/8.0),
+    REAL_CONST(63940.902833794404/8.0),
+    REAL_CONST(63962.106034649114/8.0),
+    REAL_CONST(63983.310992845094/8.0),
+    REAL_CONST(64004.517708091109/8.0),
+    REAL_CONST(64025.726180096048/8.0),
+    REAL_CONST(64046.936408568938/8.0),
+    REAL_CONST(64068.1483932189/8.0),
+    REAL_CONST(64089.362133755196/8.0),
+    REAL_CONST(64110.577629887193/8.0),
+    REAL_CONST(64131.794881324393/8.0),
+    REAL_CONST(64153.013887776404/8.0),
+    REAL_CONST(64174.234648952966/8.0),
+    REAL_CONST(64195.457164563937/8.0),
+    REAL_CONST(64216.681434319289/8.0),
+    REAL_CONST(64237.907457929112/8.0),
+    REAL_CONST(64259.135235103626/8.0),
+    REAL_CONST(64280.36476555316/8.0),
+    REAL_CONST(64301.596048988169/8.0),
+    REAL_CONST(64322.829085119236/8.0),
+    REAL_CONST(64344.06387365704/8.0),
+    REAL_CONST(64365.300414312398/8.0),
+    REAL_CONST(64386.538706796251/8.0),
+    REAL_CONST(64407.778750819634/8.0),
+    REAL_CONST(64429.020546093721/8.0),
+    REAL_CONST(64450.26409232981/8.0),
+    REAL_CONST(64471.509389239291/8.0),
+    REAL_CONST(64492.756436533709/8.0),
+    REAL_CONST(64514.005233924705/8.0),
+    REAL_CONST(64535.255781124033/8.0),
+    REAL_CONST(64556.50807784358/8.0),
+    REAL_CONST(64577.762123795357/8.0),
+    REAL_CONST(64599.017918691468/8.0),
+    REAL_CONST(64620.275462244172/8.0),
+    REAL_CONST(64641.534754165805/8.0),
+    REAL_CONST(64662.795794168844/8.0),
+    REAL_CONST(64684.058581965895/8.0),
+    REAL_CONST(64705.323117269661/8.0),
+    REAL_CONST(64726.589399792974/8.0),
+    REAL_CONST(64747.857429248776/8.0),
+    REAL_CONST(64769.127205350138/8.0),
+    REAL_CONST(64790.398727810236/8.0),
+    REAL_CONST(64811.671996342375/8.0),
+    REAL_CONST(64832.947010659969/8.0),
+    REAL_CONST(64854.223770476558/8.0),
+    REAL_CONST(64875.502275505794/8.0),
+    REAL_CONST(64896.782525461451/8.0),
+    REAL_CONST(64918.064520057414/8.0),
+    REAL_CONST(64939.348259007682/8.0),
+    REAL_CONST(64960.633742026388/8.0),
+    REAL_CONST(64981.920968827762/8.0),
+    REAL_CONST(65003.209939126165/8.0),
+    REAL_CONST(65024.500652636067/8.0),
+    REAL_CONST(65045.793109072067/8.0),
+    REAL_CONST(65067.087308148861/8.0),
+    REAL_CONST(65088.383249581282/8.0),
+    REAL_CONST(65109.680933084259/8.0),
+    REAL_CONST(65130.980358372864/8.0),
+    REAL_CONST(65152.28152516226/8.0),
+    REAL_CONST(65173.584433167736/8.0),
+    REAL_CONST(65194.889082104703/8.0),
+    REAL_CONST(65216.195471688683/8.0),
+    REAL_CONST(65237.503601635319/8.0),
+    REAL_CONST(65258.813471660353/8.0),
+    REAL_CONST(65280.125081479666/8.0),
+    REAL_CONST(65301.438430809241/8.0),
+    REAL_CONST(65322.753519365178/8.0),
+    REAL_CONST(65344.070346863708/8.0),
+    REAL_CONST(65365.388913021146/8.0),
+    REAL_CONST(65386.709217553958/8.0),
+    REAL_CONST(65408.031260178701/8.0),
+    REAL_CONST(65429.355040612056/8.0),
+    REAL_CONST(65450.680558570821/8.0),
+    REAL_CONST(65472.00781377191/8.0),
+    REAL_CONST(65493.336805932355/8.0),
+    REAL_CONST(65514.66753476928/8.0),
+    REAL_CONST(65535.999999999956/8.0),
+    REAL_CONST(65557.334201341757/8.0),
+    REAL_CONST(65578.670138512171/8.0),
+    REAL_CONST(65600.007811228788/8.0),
+    REAL_CONST(65621.347219209332/8.0),
+    REAL_CONST(65642.688362171626/8.0),
+    REAL_CONST(65664.031239833639/8.0),
+    REAL_CONST(65685.375851913413/8.0),
+    REAL_CONST(65706.722198129137/8.0),
+    REAL_CONST(65728.070278199084/8.0),
+    REAL_CONST(65749.420091841661/8.0),
+    REAL_CONST(65770.771638775404/8.0),
+    REAL_CONST(65792.124918718939/8.0),
+    REAL_CONST(65813.479931391004/8.0),
+    REAL_CONST(65834.836676510458/8.0),
+    REAL_CONST(65856.195153796303/8.0),
+    REAL_CONST(65877.5553629676/8.0),
+    REAL_CONST(65898.917303743554/8.0),
+    REAL_CONST(65920.280975843489/8.0),
+    REAL_CONST(65941.646378986843/8.0),
+    REAL_CONST(65963.013512893158/8.0),
+    REAL_CONST(65984.382377282076/8.0),
+    REAL_CONST(66005.752971873386/8.0),
+    REAL_CONST(66027.125296386963/8.0),
+    REAL_CONST(66048.499350542799/8.0),
+    REAL_CONST(66069.875134061018/8.0),
+    REAL_CONST(66091.252646661844/8.0),
+    REAL_CONST(66112.631888065618/8.0),
+    REAL_CONST(66134.01285799277/8.0),
+    REAL_CONST(66155.395556163887/8.0),
+    REAL_CONST(66176.779982299631/8.0),
+    REAL_CONST(66198.166136120795/8.0),
+    REAL_CONST(66219.554017348273/8.0),
+    REAL_CONST(66240.943625703105/8.0),
+    REAL_CONST(66262.334960906388/8.0),
+    REAL_CONST(66283.728022679396/8.0),
+    REAL_CONST(66305.122810743444/8.0),
+    REAL_CONST(66326.519324820023/8.0),
+    REAL_CONST(66347.917564630698/8.0),
+    REAL_CONST(66369.317529897162/8.0),
+    REAL_CONST(66390.719220341227/8.0),
+    REAL_CONST(66412.122635684791/8.0),
+    REAL_CONST(66433.527775649884/8.0),
+    REAL_CONST(66454.934639958636/8.0),
+    REAL_CONST(66476.343228333324/8.0),
+    REAL_CONST(66497.753540496284/8.0),
+    REAL_CONST(66519.165576169995/8.0),
+    REAL_CONST(66540.57933507704/8.0),
+    REAL_CONST(66561.994816940118/8.0),
+    REAL_CONST(66583.412021482043/8.0),
+    REAL_CONST(66604.830948425733/8.0),
+    REAL_CONST(66626.251597494222/8.0),
+    REAL_CONST(66647.673968410629/8.0),
+    REAL_CONST(66669.098060898235/8.0),
+    REAL_CONST(66690.523874680381/8.0),
+    REAL_CONST(66711.951409480564/8.0),
+    REAL_CONST(66733.380665022371/8.0),
+    REAL_CONST(66754.811641029475/8.0),
+    REAL_CONST(66776.244337225711/8.0),
+    REAL_CONST(66797.678753334985/8.0),
+    REAL_CONST(66819.11488908132/8.0),
+    REAL_CONST(66840.552744188884/8.0),
+    REAL_CONST(66861.992318381905/8.0),
+    REAL_CONST(66883.433611384738/8.0),
+    REAL_CONST(66904.876622921889/8.0),
+    REAL_CONST(66926.321352717903/8.0),
+    REAL_CONST(66947.767800497502/8.0),
+    REAL_CONST(66969.215965985466/8.0),
+    REAL_CONST(66990.665848906734/8.0),
+    REAL_CONST(67012.117448986304/8.0),
+    REAL_CONST(67033.570765949335/8.0),
+    REAL_CONST(67055.025799521056/8.0),
+    REAL_CONST(67076.482549426815/8.0),
+    REAL_CONST(67097.941015392076/8.0),
+    REAL_CONST(67119.401197142433/8.0),
+    REAL_CONST(67140.863094403554/8.0),
+    REAL_CONST(67162.326706901222/8.0),
+    REAL_CONST(67183.792034361351/8.0),
+    REAL_CONST(67205.259076509959/8.0),
+    REAL_CONST(67226.72783307315/8.0),
+    REAL_CONST(67248.198303777172/8.0),
+    REAL_CONST(67269.670488348347/8.0),
+    REAL_CONST(67291.144386513144/8.0),
+    REAL_CONST(67312.619997998088/8.0),
+    REAL_CONST(67334.09732252988/8.0),
+    REAL_CONST(67355.576359835293/8.0),
+    REAL_CONST(67377.057109641188/8.0),
+    REAL_CONST(67398.53957167457/8.0),
+    REAL_CONST(67420.023745662547/8.0),
+    REAL_CONST(67441.50963133233/8.0),
+    REAL_CONST(67462.99722841123/8.0),
+    REAL_CONST(67484.486536626689/8.0),
+    REAL_CONST(67505.977555706224/8.0),
+    REAL_CONST(67527.470285377494/8.0),
+    REAL_CONST(67548.964725368263/8.0),
+    REAL_CONST(67570.460875406367/8.0),
+    REAL_CONST(67591.9587352198/8.0),
+    REAL_CONST(67613.458304536631/8.0),
+    REAL_CONST(67634.95958308503/8.0),
+    REAL_CONST(67656.462570593329/8.0),
+    REAL_CONST(67677.967266789899/8.0),
+    REAL_CONST(67699.473671403248/8.0),
+    REAL_CONST(67720.981784162024/8.0),
+    REAL_CONST(67742.491604794923/8.0),
+    REAL_CONST(67764.003133030797/8.0),
+    REAL_CONST(67785.516368598575/8.0),
+    REAL_CONST(67807.031311227314/8.0),
+    REAL_CONST(67828.547960646174/8.0),
+    REAL_CONST(67850.066316584402/8.0),
+    REAL_CONST(67871.58637877139/8.0),
+    REAL_CONST(67893.108146936589/8.0),
+    REAL_CONST(67914.63162080961/8.0),
+    REAL_CONST(67936.156800120138/8.0),
+    REAL_CONST(67957.683684597971/8.0),
+    REAL_CONST(67979.212273973011/8.0),
+    REAL_CONST(68000.742567975263/8.0),
+    REAL_CONST(68022.274566334876/8.0),
+    REAL_CONST(68043.808268782057/8.0),
+    REAL_CONST(68065.343675047145/8.0),
+    REAL_CONST(68086.880784860579/8.0),
+    REAL_CONST(68108.419597952918/8.0),
+    REAL_CONST(68129.960114054789/8.0),
+    REAL_CONST(68151.502332896969/8.0),
+    REAL_CONST(68173.04625421032/8.0),
+    REAL_CONST(68194.591877725834/8.0),
+    REAL_CONST(68216.139203174564/8.0),
+    REAL_CONST(68237.688230287706/8.0),
+    REAL_CONST(68259.238958796544/8.0),
+    REAL_CONST(68280.791388432481/8.0),
+    REAL_CONST(68302.345518927032/8.0),
+    REAL_CONST(68323.901350011787/8.0),
+    REAL_CONST(68345.458881418483/8.0),
+    REAL_CONST(68367.018112878912/8.0),
+    REAL_CONST(68388.579044125028/8.0),
+    REAL_CONST(68410.141674888844/8.0),
+    REAL_CONST(68431.706004902502/8.0),
+    REAL_CONST(68453.272033898262/8.0),
+    REAL_CONST(68474.839761608455/8.0),
+    REAL_CONST(68496.409187765545/8.0),
+    REAL_CONST(68517.980312102081/8.0),
+    REAL_CONST(68539.553134350732/8.0),
+    REAL_CONST(68561.127654244279/8.0),
+    REAL_CONST(68582.70387151558/8.0),
+    REAL_CONST(68604.281785897634/8.0),
+    REAL_CONST(68625.861397123503/8.0),
+    REAL_CONST(68647.44270492639/8.0),
+    REAL_CONST(68669.025709039604/8.0),
+    REAL_CONST(68690.610409196524/8.0),
+    REAL_CONST(68712.196805130661/8.0),
+    REAL_CONST(68733.784896575627/8.0),
+    REAL_CONST(68755.374683265123/8.0),
+    REAL_CONST(68776.966164932994/8.0),
+    REAL_CONST(68798.559341313128/8.0),
+    REAL_CONST(68820.154212139591/8.0),
+    REAL_CONST(68841.750777146473/8.0),
+    REAL_CONST(68863.349036068044/8.0),
+    REAL_CONST(68884.948988638629/8.0),
+    REAL_CONST(68906.550634592684/8.0),
+    REAL_CONST(68928.153973664739/8.0),
+    REAL_CONST(68949.75900558944/8.0),
+    REAL_CONST(68971.365730101577/8.0),
+    REAL_CONST(68992.974146935987/8.0),
+    REAL_CONST(69014.584255827634/8.0),
+    REAL_CONST(69036.196056511588/8.0),
+    REAL_CONST(69057.809548723017/8.0),
+    REAL_CONST(69079.424732197207/8.0),
+    REAL_CONST(69101.041606669532/8.0),
+    REAL_CONST(69122.660171875468/8.0),
+    REAL_CONST(69144.280427550606/8.0),
+    REAL_CONST(69165.902373430625/8.0),
+    REAL_CONST(69187.526009251334/8.0),
+    REAL_CONST(69209.151334748618/8.0),
+    REAL_CONST(69230.778349658474/8.0),
+    REAL_CONST(69252.40705371699/8.0),
+    REAL_CONST(69274.037446660412/8.0),
+    REAL_CONST(69295.669528225/8.0),
+    REAL_CONST(69317.303298147192/8.0),
+    REAL_CONST(69338.938756163494/8.0),
+    REAL_CONST(69360.575902010532/8.0),
+    REAL_CONST(69382.214735425005/8.0),
+    REAL_CONST(69403.855256143754/8.0),
+    REAL_CONST(69425.497463903681/8.0),
+    REAL_CONST(69447.141358441833/8.0),
+    REAL_CONST(69468.78693949533/8.0),
+    REAL_CONST(69490.434206801394/8.0),
+    REAL_CONST(69512.083160097391/8.0),
+    REAL_CONST(69533.733799120717/8.0),
+    REAL_CONST(69555.386123608929/8.0),
+    REAL_CONST(69577.04013329967/8.0),
+    REAL_CONST(69598.695827930685/8.0),
+    REAL_CONST(69620.353207239794/8.0),
+    REAL_CONST(69642.012270964973/8.0),
+    REAL_CONST(69663.67301884426/8.0),
+    REAL_CONST(69685.335450615792/8.0),
+    REAL_CONST(69706.999566017839/8.0),
+    REAL_CONST(69728.665364788743/8.0),
+    REAL_CONST(69750.332846666963/8.0),
+    REAL_CONST(69772.002011391058/8.0),
+    REAL_CONST(69793.672858699691/8.0),
+    REAL_CONST(69815.345388331611/8.0),
+    REAL_CONST(69837.019600025669/8.0),
+    REAL_CONST(69858.695493520849/8.0),
+    REAL_CONST(69880.373068556204/8.0),
+    REAL_CONST(69902.052324870907/8.0),
+    REAL_CONST(69923.733262204216/8.0),
+    REAL_CONST(69945.415880295492/8.0),
+    REAL_CONST(69967.100178884211/8.0),
+    REAL_CONST(69988.786157709939/8.0),
+    REAL_CONST(70010.473816512356/8.0),
+    REAL_CONST(70032.163155031216/8.0),
+    REAL_CONST(70053.854173006403/8.0),
+    REAL_CONST(70075.546870177874/8.0),
+    REAL_CONST(70097.241246285717/8.0),
+    REAL_CONST(70118.937301070109/8.0),
+    REAL_CONST(70140.635034271298/8.0),
+    REAL_CONST(70162.334445629691/8.0),
+    REAL_CONST(70184.035534885741/8.0),
+    REAL_CONST(70205.738301780017/8.0),
+    REAL_CONST(70227.442746053217/8.0),
+    REAL_CONST(70249.1488674461/8.0),
+    REAL_CONST(70270.856665699539/8.0),
+    REAL_CONST(70292.566140554511/8.0),
+    REAL_CONST(70314.277291752107/8.0),
+    REAL_CONST(70335.990119033493/8.0),
+    REAL_CONST(70357.704622139936/8.0),
+    REAL_CONST(70379.420800812819/8.0),
+    REAL_CONST(70401.138654793613/8.0),
+    REAL_CONST(70422.85818382389/8.0),
+    REAL_CONST(70444.579387645339/8.0),
+    REAL_CONST(70466.302265999722/8.0),
+    REAL_CONST(70488.026818628918/8.0),
+    REAL_CONST(70509.753045274876/8.0),
+    REAL_CONST(70531.480945679708/8.0),
+    REAL_CONST(70553.210519585555/8.0),
+    REAL_CONST(70574.941766734701/8.0),
+    REAL_CONST(70596.674686869505/8.0),
+    REAL_CONST(70618.409279732456/8.0),
+    REAL_CONST(70640.145545066101/8.0),
+    REAL_CONST(70661.883482613106/8.0),
+    REAL_CONST(70683.623092116264/8.0),
+    REAL_CONST(70705.364373318414/8.0),
+    REAL_CONST(70727.107325962526/8.0),
+    REAL_CONST(70748.851949791671/8.0),
+    REAL_CONST(70770.598244549008/8.0),
+    REAL_CONST(70792.346209977783/8.0),
+    REAL_CONST(70814.095845821372/8.0),
+    REAL_CONST(70835.847151823225/8.0),
+    REAL_CONST(70857.600127726895/8.0),
+    REAL_CONST(70879.354773276034/8.0),
+    REAL_CONST(70901.111088214413/8.0),
+    REAL_CONST(70922.869072285859/8.0),
+    REAL_CONST(70944.628725234332/8.0),
+    REAL_CONST(70966.390046803877/8.0),
+    REAL_CONST(70988.153036738629/8.0),
+    REAL_CONST(71009.917694782853/8.0),
+    REAL_CONST(71031.684020680885/8.0),
+    REAL_CONST(71053.45201417715/8.0),
+    REAL_CONST(71075.221675016204/8.0),
+    REAL_CONST(71096.993002942661/8.0),
+    REAL_CONST(71118.765997701266/8.0),
+    REAL_CONST(71140.540659036851/8.0),
+    REAL_CONST(71162.316986694335/8.0),
+    REAL_CONST(71184.09498041874/8.0),
+    REAL_CONST(71205.874639955218/8.0),
+    REAL_CONST(71227.655965048951/8.0),
+    REAL_CONST(71249.438955445294/8.0),
+    REAL_CONST(71271.223610889632/8.0),
+    REAL_CONST(71293.009931127483/8.0),
+    REAL_CONST(71314.797915904477/8.0),
+    REAL_CONST(71336.587564966307/8.0),
+    REAL_CONST(71358.378878058764/8.0),
+    REAL_CONST(71380.171854927772/8.0),
+    REAL_CONST(71401.966495319313/8.0),
+    REAL_CONST(71423.762798979486/8.0),
+    REAL_CONST(71445.560765654489/8.0),
+    REAL_CONST(71467.360395090596/8.0),
+    REAL_CONST(71489.161687034211/8.0),
+    REAL_CONST(71510.964641231811/8.0),
+    REAL_CONST(71532.769257429973/8.0),
+    REAL_CONST(71554.575535375348/8.0),
+    REAL_CONST(71576.383474814749/8.0),
+    REAL_CONST(71598.19307549503/8.0),
+    REAL_CONST(71620.004337163133/8.0),
+    REAL_CONST(71641.817259566145/8.0),
+    REAL_CONST(71663.631842451214/8.0),
+    REAL_CONST(71685.4480855656/8.0),
+    REAL_CONST(71707.26598865664/8.0),
+    REAL_CONST(71729.085551471784/8.0),
+    REAL_CONST(71750.906773758586/8.0),
+    REAL_CONST(71772.729655264673/8.0),
+    REAL_CONST(71794.554195737772/8.0),
+    REAL_CONST(71816.380394925713/8.0),
+    REAL_CONST(71838.208252576442/8.0),
+    REAL_CONST(71860.037768437964/8.0),
+    REAL_CONST(71881.868942258385/8.0),
+    REAL_CONST(71903.701773785942/8.0),
+    REAL_CONST(71925.536262768932/8.0),
+    REAL_CONST(71947.372408955751/8.0),
+    REAL_CONST(71969.210212094898/8.0),
+    REAL_CONST(71991.049671934976/8.0),
+    REAL_CONST(72012.890788224686/8.0),
+    REAL_CONST(72034.73356071279/8.0),
+    REAL_CONST(72056.577989148165/8.0),
+    REAL_CONST(72078.424073279821/8.0),
+    REAL_CONST(72100.271812856794/8.0),
+    REAL_CONST(72122.121207628254/8.0),
+    REAL_CONST(72143.97225734347/8.0),
+    REAL_CONST(72165.824961751801/8.0),
+    REAL_CONST(72187.679320602692/8.0),
+    REAL_CONST(72209.53533364569/8.0),
+    REAL_CONST(72231.393000630429/8.0),
+    REAL_CONST(72253.252321306645/8.0),
+    REAL_CONST(72275.113295424177/8.0),
+    REAL_CONST(72296.975922732949/8.0),
+    REAL_CONST(72318.840202982959/8.0),
+    REAL_CONST(72340.706135924338/8.0),
+    REAL_CONST(72362.573721307272/8.0),
+    REAL_CONST(72384.442958882093/8.0),
+    REAL_CONST(72406.313848399179/8.0),
+    REAL_CONST(72428.186389609036/8.0),
+    REAL_CONST(72450.060582262216/8.0),
+    REAL_CONST(72471.936426109431/8.0),
+    REAL_CONST(72493.813920901433/8.0),
+    REAL_CONST(72515.693066389096/8.0),
+    REAL_CONST(72537.573862323392/8.0),
+    REAL_CONST(72559.456308455352/8.0),
+    REAL_CONST(72581.340404536139/8.0),
+    REAL_CONST(72603.226150316987/8.0),
+    REAL_CONST(72625.113545549248/8.0),
+    REAL_CONST(72647.002589984331/8.0),
+    REAL_CONST(72668.893283373764/8.0),
+    REAL_CONST(72690.785625469172/8.0),
+    REAL_CONST(72712.679616022273/8.0),
+    REAL_CONST(72734.575254784853/8.0),
+    REAL_CONST(72756.472541508803/8.0),
+    REAL_CONST(72778.371475946144/8.0),
+    REAL_CONST(72800.272057848939/8.0),
+    REAL_CONST(72822.174286969355/8.0),
+    REAL_CONST(72844.07816305969/8.0),
+    REAL_CONST(72865.983685872285/8.0),
+    REAL_CONST(72887.890855159596/8.0),
+    REAL_CONST(72909.799670674183/8.0),
+    REAL_CONST(72931.710132168693/8.0),
+    REAL_CONST(72953.622239395845/8.0),
+    REAL_CONST(72975.535992108475/8.0),
+    REAL_CONST(72997.451390059519/8.0),
+    REAL_CONST(73019.368433001961/8.0),
+    REAL_CONST(73041.287120688925/8.0),
+    REAL_CONST(73063.207452873612/8.0),
+    REAL_CONST(73085.129429309294/8.0),
+    REAL_CONST(73107.053049749389/8.0),
+    REAL_CONST(73128.978313947344/8.0),
+    REAL_CONST(73150.905221656736/8.0),
+    REAL_CONST(73172.833772631217/8.0),
+    REAL_CONST(73194.763966624567/8.0),
+    REAL_CONST(73216.695803390612/8.0),
+    REAL_CONST(73238.62928268328/8.0),
+    REAL_CONST(73260.564404256627/8.0),
+    REAL_CONST(73282.501167864757/8.0),
+    REAL_CONST(73304.439573261901/8.0),
+    REAL_CONST(73326.379620202337/8.0),
+    REAL_CONST(73348.321308440485/8.0),
+    REAL_CONST(73370.264637730841/8.0),
+    REAL_CONST(73392.209607827957/8.0),
+    REAL_CONST(73414.156218486532/8.0),
+    REAL_CONST(73436.104469461323/8.0),
+    REAL_CONST(73458.054360507173/8.0),
+    REAL_CONST(73480.005891379056/8.0),
+    REAL_CONST(73501.959061831993/8.0),
+    REAL_CONST(73523.913871621116/8.0),
+    REAL_CONST(73545.870320501665/8.0),
+    REAL_CONST(73567.828408228932/8.0),
+    REAL_CONST(73589.78813455833/8.0),
+    REAL_CONST(73611.749499245358/8.0),
+    REAL_CONST(73633.712502045615/8.0),
+    REAL_CONST(73655.677142714747/8.0),
+    REAL_CONST(73677.643421008557/8.0),
+    REAL_CONST(73699.611336682879/8.0),
+    REAL_CONST(73721.580889493693/8.0),
+    REAL_CONST(73743.552079197019/8.0),
+    REAL_CONST(73765.524905548999/8.0),
+    REAL_CONST(73787.499368305856/8.0),
+    REAL_CONST(73809.475467223907/8.0),
+    REAL_CONST(73831.453202059551/8.0),
+    REAL_CONST(73853.432572569291/8.0),
+    REAL_CONST(73875.413578509717/8.0),
+    REAL_CONST(73897.396219637507/8.0),
+    REAL_CONST(73919.380495709411/8.0),
+    REAL_CONST(73941.36640648231/8.0),
+    REAL_CONST(73963.353951713143/8.0),
+    REAL_CONST(73985.343131158952/8.0),
+    REAL_CONST(74007.333944576865/8.0),
+    REAL_CONST(74029.326391724098/8.0),
+    REAL_CONST(74051.320472357969/8.0),
+    REAL_CONST(74073.316186235883/8.0),
+    REAL_CONST(74095.313533115303/8.0),
+    REAL_CONST(74117.312512753837/8.0),
+    REAL_CONST(74139.313124909138/8.0),
+    REAL_CONST(74161.315369338976/8.0),
+    REAL_CONST(74183.319245801191/8.0),
+    REAL_CONST(74205.324754053727/8.0),
+    REAL_CONST(74227.331893854629/8.0),
+    REAL_CONST(74249.340664961986/8.0),
+    REAL_CONST(74271.351067134034/8.0),
+    REAL_CONST(74293.363100129049/8.0),
+    REAL_CONST(74315.376763705441/8.0),
+    REAL_CONST(74337.392057621662/8.0),
+    REAL_CONST(74359.408981636298/8.0),
+    REAL_CONST(74381.427535508003/8.0),
+    REAL_CONST(74403.447718995507/8.0),
+    REAL_CONST(74425.469531857671/8.0),
+    REAL_CONST(74447.492973853383/8.0),
+    REAL_CONST(74469.518044741693/8.0),
+    REAL_CONST(74491.54474428168/8.0),
+    REAL_CONST(74513.573072232539/8.0),
+    REAL_CONST(74535.603028353551/8.0),
+    REAL_CONST(74557.634612404087/8.0),
+    REAL_CONST(74579.667824143602/8.0),
+    REAL_CONST(74601.702663331642/8.0),
+    REAL_CONST(74623.739129727837/8.0),
+    REAL_CONST(74645.777223091936/8.0),
+    REAL_CONST(74667.816943183716/8.0),
+    REAL_CONST(74689.858289763113/8.0),
+    REAL_CONST(74711.901262590094/8.0),
+    REAL_CONST(74733.945861424741/8.0),
+    REAL_CONST(74755.992086027225/8.0),
+    REAL_CONST(74778.039936157802/8.0),
+    REAL_CONST(74800.089411576817/8.0),
+    REAL_CONST(74822.140512044702/8.0),
+    REAL_CONST(74844.193237321961/8.0),
+    REAL_CONST(74866.24758716923/8.0),
+    REAL_CONST(74888.303561347187/8.0),
+    REAL_CONST(74910.36115961663/8.0),
+    REAL_CONST(74932.420381738411/8.0),
+    REAL_CONST(74954.481227473516/8.0),
+    REAL_CONST(74976.543696582972/8.0),
+    REAL_CONST(74998.607788827925/8.0),
+    REAL_CONST(75020.673503969607/8.0),
+    REAL_CONST(75042.740841769322/8.0),
+    REAL_CONST(75064.809801988464/8.0),
+    REAL_CONST(75086.88038438854/8.0),
+    REAL_CONST(75108.952588731103/8.0),
+    REAL_CONST(75131.026414777836/8.0),
+    REAL_CONST(75153.101862290467/8.0),
+    REAL_CONST(75175.178931030852/8.0),
+    REAL_CONST(75197.257620760924/8.0),
+    REAL_CONST(75219.33793124267/8.0),
+    REAL_CONST(75241.419862238225/8.0),
+    REAL_CONST(75263.503413509738/8.0),
+    REAL_CONST(75285.588584819503/8.0),
+    REAL_CONST(75307.675375929874/8.0),
+    REAL_CONST(75329.763786603318/8.0),
+    REAL_CONST(75351.853816602365/8.0),
+    REAL_CONST(75373.945465689612/8.0),
+    REAL_CONST(75396.038733627807/8.0),
+    REAL_CONST(75418.133620179724/8.0),
+    REAL_CONST(75440.230125108254/8.0),
+    REAL_CONST(75462.32824817636/8.0),
+    REAL_CONST(75484.427989147109/8.0),
+    REAL_CONST(75506.529347783653/8.0),
+    REAL_CONST(75528.63232384919/8.0),
+    REAL_CONST(75550.736917107075/8.0),
+    REAL_CONST(75572.843127320695/8.0),
+    REAL_CONST(75594.950954253538/8.0),
+    REAL_CONST(75617.060397669193/8.0),
+    REAL_CONST(75639.171457331307/8.0),
+    REAL_CONST(75661.284133003646/8.0),
+    REAL_CONST(75683.398424450032/8.0),
+    REAL_CONST(75705.514331434402/8.0),
+    REAL_CONST(75727.631853720741/8.0),
+    REAL_CONST(75749.750991073175/8.0),
+    REAL_CONST(75771.871743255862/8.0),
+    REAL_CONST(75793.994110033076/8.0),
+    REAL_CONST(75816.118091169177/8.0),
+    REAL_CONST(75838.243686428585/8.0),
+    REAL_CONST(75860.370895575848/8.0),
+    REAL_CONST(75882.499718375562/8.0),
+    REAL_CONST(75904.630154592422/8.0),
+    REAL_CONST(75926.762203991224/8.0),
+    REAL_CONST(75948.895866336825/8.0),
+    REAL_CONST(75971.031141394182/8.0),
+    REAL_CONST(75993.168028928325/8.0),
+    REAL_CONST(76015.306528704401/8.0),
+    REAL_CONST(76037.4466404876/8.0),
+    REAL_CONST(76059.588364043215/8.0),
+    REAL_CONST(76081.731699136653/8.0),
+    REAL_CONST(76103.876645533353/8.0),
+    REAL_CONST(76126.023202998884/8.0),
+    REAL_CONST(76148.171371298871/8.0),
+    REAL_CONST(76170.321150199044/8.0),
+    REAL_CONST(76192.472539465205/8.0),
+    REAL_CONST(76214.625538863256/8.0),
+    REAL_CONST(76236.780148159174/8.0),
+    REAL_CONST(76258.936367119008/8.0),
+    REAL_CONST(76281.094195508922/8.0),
+    REAL_CONST(76303.253633095141/8.0),
+    REAL_CONST(76325.414679643975/8.0),
+    REAL_CONST(76347.577334921851/8.0),
+    REAL_CONST(76369.741598695226/8.0),
+    REAL_CONST(76391.907470730686/8.0),
+    REAL_CONST(76414.074950794879/8.0),
+    REAL_CONST(76436.244038654564/8.0),
+    REAL_CONST(76458.414734076548/8.0),
+    REAL_CONST(76480.587036827754/8.0),
+    REAL_CONST(76502.760946675175/8.0),
+    REAL_CONST(76524.936463385893/8.0),
+    REAL_CONST(76547.11358672705/8.0),
+    REAL_CONST(76569.292316465915/8.0),
+    REAL_CONST(76591.472652369819/8.0),
+    REAL_CONST(76613.654594206164/8.0),
+    REAL_CONST(76635.838141742468/8.0),
+    REAL_CONST(76658.023294746308/8.0),
+    REAL_CONST(76680.210052985349/8.0),
+    REAL_CONST(76702.398416227341/8.0),
+    REAL_CONST(76724.588384240138/8.0),
+    REAL_CONST(76746.779956791637/8.0),
+    REAL_CONST(76768.973133649866/8.0),
+    REAL_CONST(76791.167914582897/8.0),
+    REAL_CONST(76813.364299358902/8.0),
+    REAL_CONST(76835.562287746157/8.0),
+    REAL_CONST(76857.761879512967/8.0),
+    REAL_CONST(76879.963074427797/8.0),
+    REAL_CONST(76902.165872259109/8.0),
+    REAL_CONST(76924.37027277553/8.0),
+    REAL_CONST(76946.576275745727/8.0),
+    REAL_CONST(76968.783880938441/8.0),
+    REAL_CONST(76990.993088122515/8.0),
+    REAL_CONST(77013.203897066895/8.0),
+    REAL_CONST(77035.416307540567/8.0),
+    REAL_CONST(77057.630319312622/8.0),
+    REAL_CONST(77079.845932152239/8.0),
+    REAL_CONST(77102.063145828695/8.0),
+    REAL_CONST(77124.281960111301/8.0),
+    REAL_CONST(77146.50237476948/8.0),
+    REAL_CONST(77168.724389572759/8.0),
+    REAL_CONST(77190.948004290723/8.0),
+    REAL_CONST(77213.173218693031/8.0),
+    REAL_CONST(77235.400032549442/8.0),
+    REAL_CONST(77257.628445629802/8.0),
+    REAL_CONST(77279.858457704031/8.0),
+    REAL_CONST(77302.090068542122/8.0),
+    REAL_CONST(77324.323277914169/8.0),
+    REAL_CONST(77346.558085590339/8.0),
+    REAL_CONST(77368.794491340886/8.0),
+    REAL_CONST(77391.032494936138/8.0),
+    REAL_CONST(77413.272096146524/8.0),
+    REAL_CONST(77435.51329474253/8.0),
+    REAL_CONST(77457.756090494731/8.0),
+    REAL_CONST(77480.000483173804/8.0),
+    REAL_CONST(77502.246472550498/8.0),
+    REAL_CONST(77524.494058395634/8.0),
+    REAL_CONST(77546.743240480107/8.0),
+    REAL_CONST(77568.994018574944/8.0),
+    REAL_CONST(77591.246392451198/8.0),
+    REAL_CONST(77613.500361880026/8.0),
+    REAL_CONST(77635.755926632657/8.0),
+    REAL_CONST(77658.013086480438/8.0),
+    REAL_CONST(77680.271841194757/8.0),
+    REAL_CONST(77702.532190547092/8.0),
+    REAL_CONST(77724.794134309021/8.0),
+    REAL_CONST(77747.057672252195/8.0),
+    REAL_CONST(77769.322804148323/8.0),
+    REAL_CONST(77791.589529769248/8.0),
+    REAL_CONST(77813.857848886837/8.0),
+    REAL_CONST(77836.127761273063/8.0),
+    REAL_CONST(77858.399266699998/8.0),
+    REAL_CONST(77880.67236493979/8.0),
+    REAL_CONST(77902.947055764627/8.0),
+    REAL_CONST(77925.223338946831/8.0),
+    REAL_CONST(77947.50121425878/8.0),
+    REAL_CONST(77969.780681472927/8.0),
+    REAL_CONST(77992.061740361838/8.0),
+    REAL_CONST(78014.344390698127/8.0),
+    REAL_CONST(78036.628632254491/8.0),
+    REAL_CONST(78058.914464803747/8.0),
+    REAL_CONST(78081.201888118725/8.0),
+    REAL_CONST(78103.490901972415/8.0),
+    REAL_CONST(78125.781506137821/8.0),
+    REAL_CONST(78148.073700388064/8.0),
+    REAL_CONST(78170.367484496339/8.0),
+    REAL_CONST(78192.662858235926/8.0),
+    REAL_CONST(78214.959821380166/8.0),
+    REAL_CONST(78237.258373702498/8.0),
+    REAL_CONST(78259.558514976452/8.0),
+    REAL_CONST(78281.860244975614/8.0),
+    REAL_CONST(78304.163563473659/8.0),
+    REAL_CONST(78326.468470244363/8.0),
+    REAL_CONST(78348.77496506153/8.0),
+    REAL_CONST(78371.083047699125/8.0),
+    REAL_CONST(78393.392717931114/8.0),
+    REAL_CONST(78415.703975531578/8.0),
+    REAL_CONST(78438.016820274701/8.0),
+    REAL_CONST(78460.331251934695/8.0),
+    REAL_CONST(78482.647270285903/8.0),
+    REAL_CONST(78504.964875102727/8.0),
+    REAL_CONST(78527.284066159627/8.0),
+    REAL_CONST(78549.604843231195/8.0),
+    REAL_CONST(78571.927206092048/8.0),
+    REAL_CONST(78594.251154516911/8.0),
+    REAL_CONST(78616.576688280606/8.0),
+    REAL_CONST(78638.903807157985/8.0),
+    REAL_CONST(78661.232510924034/8.0),
+    REAL_CONST(78683.562799353778/8.0),
+    REAL_CONST(78705.894672222363/8.0),
+    REAL_CONST(78728.228129304945/8.0),
+    REAL_CONST(78750.563170376859/8.0),
+    REAL_CONST(78772.899795213423/8.0),
+    REAL_CONST(78795.238003590101/8.0),
+    REAL_CONST(78817.577795282399/8.0),
+    REAL_CONST(78839.919170065928/8.0),
+    REAL_CONST(78862.262127716356/8.0),
+    REAL_CONST(78884.606668009452/8.0),
+    REAL_CONST(78906.952790721043/8.0),
+    REAL_CONST(78929.300495627045/8.0),
+    REAL_CONST(78951.64978250346/8.0),
+    REAL_CONST(78974.000651126378/8.0),
+    REAL_CONST(78996.353101271932/8.0),
+    REAL_CONST(79018.707132716358/8.0),
+    REAL_CONST(79041.062745235977/8.0),
+    REAL_CONST(79063.41993860717/8.0),
+    REAL_CONST(79085.778712606436/8.0),
+    REAL_CONST(79108.139067010285/8.0),
+    REAL_CONST(79130.501001595389/8.0),
+    REAL_CONST(79152.864516138419/8.0),
+    REAL_CONST(79175.22961041618/8.0),
+    REAL_CONST(79197.596284205531/8.0),
+    REAL_CONST(79219.96453728342/8.0),
+    REAL_CONST(79242.33436942687/8.0),
+    REAL_CONST(79264.705780412987/8.0),
+    REAL_CONST(79287.078770018954/8.0),
+    REAL_CONST(79309.453338022009/8.0),
+    REAL_CONST(79331.829484199508/8.0),
+    REAL_CONST(79354.207208328866/8.0),
+    REAL_CONST(79376.586510187582/8.0),
+    REAL_CONST(79398.967389553218/8.0),
+    REAL_CONST(79421.349846203433/8.0),
+    REAL_CONST(79443.733879915948/8.0),
+    REAL_CONST(79466.119490468584/8.0),
+    REAL_CONST(79488.50667763922/8.0),
+    REAL_CONST(79510.895441205823/8.0),
+    REAL_CONST(79533.285780946433/8.0),
+    REAL_CONST(79555.677696639163/8.0),
+    REAL_CONST(79578.071188062226/8.0),
+    REAL_CONST(79600.466254993895/8.0),
+    REAL_CONST(79622.862897212515/8.0),
+    REAL_CONST(79645.261114496549/8.0),
+    REAL_CONST(79667.660906624471/8.0),
+    REAL_CONST(79690.062273374875/8.0),
+    REAL_CONST(79712.465214526455/8.0),
+    REAL_CONST(79734.869729857935/8.0),
+    REAL_CONST(79757.275819148126/8.0),
+    REAL_CONST(79779.683482175955/8.0),
+    REAL_CONST(79802.092718720378/8.0),
+    REAL_CONST(79824.503528560454/8.0),
+    REAL_CONST(79846.915911475327/8.0),
+    REAL_CONST(79869.329867244203/8.0),
+    REAL_CONST(79891.745395646343/8.0),
+    REAL_CONST(79914.162496461155/8.0),
+    REAL_CONST(79936.581169468045/8.0),
+    REAL_CONST(79959.001414446553/8.0),
+    REAL_CONST(79981.423231176261/8.0),
+    REAL_CONST(80003.846619436852/8.0),
+    REAL_CONST(80026.271579008084/8.0),
+    REAL_CONST(80048.698109669771/8.0),
+    REAL_CONST(80071.12621120183/8.0),
+    REAL_CONST(80093.555883384237/8.0),
+    REAL_CONST(80115.987125997053/8.0),
+    REAL_CONST(80138.419938820414/8.0),
+    REAL_CONST(80160.854321634528/8.0),
+    REAL_CONST(80183.290274219689/8.0),
+    REAL_CONST(80205.727796356281/8.0),
+    REAL_CONST(80228.166887824715/8.0),
+    REAL_CONST(80250.607548405547/8.0),
+    REAL_CONST(80273.049777879336/8.0),
+    REAL_CONST(80295.493576026798/8.0),
+    REAL_CONST(80317.938942628651/8.0),
+    REAL_CONST(80340.385877465727/8.0),
+    REAL_CONST(80362.834380318949/8.0),
+    REAL_CONST(80385.28445096928/8.0),
+    REAL_CONST(80407.736089197788/8.0),
+    REAL_CONST(80430.189294785596/8.0),
+    REAL_CONST(80452.644067513917/8.0),
+    REAL_CONST(80475.100407164035/8.0),
+    REAL_CONST(80497.558313517322/8.0),
+    REAL_CONST(80520.017786355209/8.0),
+    REAL_CONST(80542.478825459213/8.0),
+    REAL_CONST(80564.941430610925/8.0),
+    REAL_CONST(80587.405601592007/8.0),
+    REAL_CONST(80609.871338184195/8.0),
+    REAL_CONST(80632.338640169342/8.0),
+    REAL_CONST(80654.8075073293/8.0),
+    REAL_CONST(80677.277939446067/8.0),
+    REAL_CONST(80699.749936301683/8.0),
+    REAL_CONST(80722.223497678278/8.0),
+    REAL_CONST(80744.698623358039/8.0),
+    REAL_CONST(80767.17531312324/8.0),
+    REAL_CONST(80789.653566756242/8.0),
+    REAL_CONST(80812.133384039465/8.0),
+    REAL_CONST(80834.614764755403/8.0),
+    REAL_CONST(80857.097708686648/8.0),
+    REAL_CONST(80879.582215615854/8.0),
+    REAL_CONST(80902.068285325731/8.0),
+    REAL_CONST(80924.555917599093/8.0),
+    REAL_CONST(80947.045112218824/8.0),
+    REAL_CONST(80969.535868967869/8.0),
+    REAL_CONST(80992.028187629272/8.0),
+    REAL_CONST(81014.522067986123/8.0),
+    REAL_CONST(81037.017509821613/8.0),
+    REAL_CONST(81059.514512919006/8.0),
+    REAL_CONST(81082.013077061609/8.0),
+    REAL_CONST(81104.513202032831/8.0),
+    REAL_CONST(81127.014887616184/8.0),
+    REAL_CONST(81149.518133595193/8.0),
+    REAL_CONST(81172.022939753486/8.0),
+    REAL_CONST(81194.529305874807/8.0),
+    REAL_CONST(81217.037231742899/8.0),
+    REAL_CONST(81239.546717141639/8.0),
+    REAL_CONST(81262.057761854958/8.0),
+    REAL_CONST(81284.570365666848/8.0),
+    REAL_CONST(81307.084528361403/8.0),
+    REAL_CONST(81329.600249722775/8.0),
+    REAL_CONST(81352.117529535186/8.0),
+    REAL_CONST(81374.636367582949/8.0),
+    REAL_CONST(81397.156763650448/8.0),
+    REAL_CONST(81419.678717522125/8.0),
+    REAL_CONST(81442.202228982511/8.0),
+    REAL_CONST(81464.727297816222/8.0),
+    REAL_CONST(81487.253923807933/8.0),
+    REAL_CONST(81509.782106742379/8.0),
+    REAL_CONST(81532.311846404409/8.0),
+    REAL_CONST(81554.843142578902/8.0),
+    REAL_CONST(81577.375995050839/8.0),
+    REAL_CONST(81599.910403605274/8.0),
+    REAL_CONST(81622.446368027333/8.0),
+    REAL_CONST(81644.983888102215/8.0),
+    REAL_CONST(81667.522963615178/8.0),
+    REAL_CONST(81690.063594351581/8.0),
+    REAL_CONST(81712.605780096841/8.0),
+    REAL_CONST(81735.149520636449/8.0),
+    REAL_CONST(81757.694815755967/8.0),
+    REAL_CONST(81780.241665241047/8.0),
+    REAL_CONST(81802.79006887741/8.0),
+    REAL_CONST(81825.340026450824/8.0),
+    REAL_CONST(81847.891537747171/8.0),
+    REAL_CONST(81870.444602552379/8.0),
+    REAL_CONST(81892.999220652477/8.0),
+    REAL_CONST(81915.555391833506/8.0),
+    REAL_CONST(81938.113115881672/8.0),
+    REAL_CONST(81960.672392583176/8.0),
+    REAL_CONST(81983.233221724338/8.0),
+    REAL_CONST(82005.795603091537/8.0),
+    REAL_CONST(82028.359536471224/8.0),
+    REAL_CONST(82050.925021649906/8.0),
+    REAL_CONST(82073.492058414209/8.0),
+    REAL_CONST(82096.060646550788/8.0),
+    REAL_CONST(82118.630785846399/8.0),
+    REAL_CONST(82141.202476087841/8.0),
+    REAL_CONST(82163.775717062032/8.0),
+    REAL_CONST(82186.35050855593/8.0),
+    REAL_CONST(82208.926850356569/8.0),
+    REAL_CONST(82231.504742251054/8.0),
+    REAL_CONST(82254.084184026578/8.0),
+    REAL_CONST(82276.665175470393/8.0),
+    REAL_CONST(82299.24771636985/8.0),
+    REAL_CONST(82321.831806512317/8.0),
+    REAL_CONST(82344.417445685307/8.0),
+    REAL_CONST(82367.004633676348/8.0),
+    REAL_CONST(82389.593370273054/8.0),
+    REAL_CONST(82412.183655263143/8.0),
+    REAL_CONST(82434.775488434374/8.0),
+    REAL_CONST(82457.368869574595/8.0),
+    REAL_CONST(82479.963798471697/8.0),
+    REAL_CONST(82502.560274913689/8.0),
+    REAL_CONST(82525.158298688606/8.0),
+    REAL_CONST(82547.757869584602/8.0),
+    REAL_CONST(82570.35898738986/8.0),
+    REAL_CONST(82592.961651892678/8.0),
+    REAL_CONST(82615.565862881398/8.0),
+    REAL_CONST(82638.171620144421/8.0),
+    REAL_CONST(82660.778923470265/8.0),
+    REAL_CONST(82683.387772647475/8.0),
+    REAL_CONST(82705.998167464713/8.0),
+    REAL_CONST(82728.610107710658/8.0),
+    REAL_CONST(82751.223593174116/8.0),
+    REAL_CONST(82773.83862364394/8.0),
+    REAL_CONST(82796.45519890904/8.0),
+    REAL_CONST(82819.073318758441/8.0),
+    REAL_CONST(82841.692982981185/8.0),
+    REAL_CONST(82864.314191366429/8.0),
+    REAL_CONST(82886.936943703375/8.0),
+    REAL_CONST(82909.561239781324/8.0),
+    REAL_CONST(82932.187079389638/8.0),
+    REAL_CONST(82954.814462317736/8.0),
+    REAL_CONST(82977.443388355125/8.0),
+    REAL_CONST(83000.073857291369/8.0),
+    REAL_CONST(83022.70586891612/8.0),
+    REAL_CONST(83045.339423019104/8.0),
+    REAL_CONST(83067.974519390089/8.0),
+    REAL_CONST(83090.611157818959/8.0),
+    REAL_CONST(83113.249338095629/8.0),
+    REAL_CONST(83135.8890600101/8.0),
+    REAL_CONST(83158.530323352461/8.0),
+    REAL_CONST(83181.173127912858/8.0),
+    REAL_CONST(83203.817473481497/8.0),
+    REAL_CONST(83226.463359848669/8.0),
+    REAL_CONST(83249.11078680474/8.0),
+    REAL_CONST(83271.759754140134/8.0),
+    REAL_CONST(83294.410261645375/8.0),
+    REAL_CONST(83317.062309111003/8.0),
+    REAL_CONST(83339.715896327703/8.0),
+    REAL_CONST(83362.371023086147/8.0),
+    REAL_CONST(83385.027689177165/8.0),
+    REAL_CONST(83407.685894391587/8.0),
+    REAL_CONST(83430.345638520361/8.0),
+    REAL_CONST(83453.006921354478/8.0),
+    REAL_CONST(83475.669742685001/8.0),
+    REAL_CONST(83498.334102303095/8.0),
+    REAL_CONST(83520.999999999942/8.0),
+    REAL_CONST(83543.667435566866/8.0),
+    REAL_CONST(83566.336408795192/8.0),
+    REAL_CONST(83589.006919476349/8.0),
+    REAL_CONST(83611.678967401851/8.0),
+    REAL_CONST(83634.352552363242/8.0),
+    REAL_CONST(83657.027674152167/8.0),
+    REAL_CONST(83679.704332560359/8.0),
+    REAL_CONST(83702.382527379552/8.0),
+    REAL_CONST(83725.062258401638/8.0),
+    REAL_CONST(83747.743525418511/8.0),
+    REAL_CONST(83770.42632822218/8.0),
+    REAL_CONST(83793.110666604684/8.0),
+    REAL_CONST(83815.796540358162/8.0),
+    REAL_CONST(83838.483949274829/8.0),
+    REAL_CONST(83861.172893146941/8.0),
+    REAL_CONST(83883.863371766842/8.0),
+    REAL_CONST(83906.555384926964/8.0),
+    REAL_CONST(83929.248932419752/8.0),
+    REAL_CONST(83951.944014037799/8.0),
+    REAL_CONST(83974.640629573696/8.0),
+    REAL_CONST(83997.338778820151/8.0),
+    REAL_CONST(84020.038461569929/8.0),
+    REAL_CONST(84042.739677615857/8.0),
+    REAL_CONST(84065.442426750829/8.0),
+    REAL_CONST(84088.146708767847/8.0),
+    REAL_CONST(84110.852523459922/8.0),
+    REAL_CONST(84133.559870620171/8.0),
+    REAL_CONST(84156.268750041796/8.0),
+    REAL_CONST(84178.979161518029/8.0),
+    REAL_CONST(84201.691104842204/8.0),
+    REAL_CONST(84224.404579807713/8.0),
+    REAL_CONST(84247.119586208006/8.0),
+    REAL_CONST(84269.83612383662/8.0),
+    REAL_CONST(84292.55419248715/8.0),
+    REAL_CONST(84315.273791953281/8.0),
+    REAL_CONST(84337.994922028738/8.0),
+    REAL_CONST(84360.717582507335/8.0),
+    REAL_CONST(84383.441773182945/8.0),
+    REAL_CONST(84406.167493849513/8.0),
+    REAL_CONST(84428.894744301069/8.0),
+    REAL_CONST(84451.623524331691/8.0),
+    REAL_CONST(84474.353833735542/8.0),
+    REAL_CONST(84497.085672306828/8.0),
+    REAL_CONST(84519.819039839858/8.0),
+    REAL_CONST(84542.553936128999/8.0),
+    REAL_CONST(84565.290360968676/8.0),
+    REAL_CONST(84588.028314153402/8.0),
+    REAL_CONST(84610.767795477717/8.0),
+    REAL_CONST(84633.508804736295/8.0),
+    REAL_CONST(84656.251341723822/8.0),
+    REAL_CONST(84678.995406235073/8.0),
+    REAL_CONST(84701.740998064924/8.0),
+    REAL_CONST(84724.488117008252/8.0),
+    REAL_CONST(84747.236762860062/8.0),
+    REAL_CONST(84769.986935415407/8.0),
+    REAL_CONST(84792.73863446941/8.0),
+    REAL_CONST(84815.491859817252/8.0),
+    REAL_CONST(84838.246611254188/8.0),
+    REAL_CONST(84861.002888575575/8.0),
+    REAL_CONST(84883.760691576768/8.0),
+    REAL_CONST(84906.520020053256/8.0),
+    REAL_CONST(84929.28087380057/8.0),
+    REAL_CONST(84952.043252614312/8.0),
+    REAL_CONST(84974.807156290146/8.0),
+    REAL_CONST(84997.572584623806/8.0),
+    REAL_CONST(85020.339537411113/8.0),
+    REAL_CONST(85043.108014447949/8.0),
+    REAL_CONST(85065.878015530237/8.0),
+    REAL_CONST(85088.649540453989/8.0),
+    REAL_CONST(85111.422589015303/8.0),
+    REAL_CONST(85134.197161010321/8.0),
+    REAL_CONST(85156.973256235244/8.0),
+    REAL_CONST(85179.750874486374/8.0),
+    REAL_CONST(85202.530015560071/8.0),
+    REAL_CONST(85225.310679252725/8.0),
+    REAL_CONST(85248.092865360857/8.0),
+    REAL_CONST(85270.876573681016/8.0),
+    REAL_CONST(85293.661804009811/8.0),
+    REAL_CONST(85316.448556143951/8.0),
+    REAL_CONST(85339.236829880188/8.0),
+    REAL_CONST(85362.026625015351/8.0),
+    REAL_CONST(85384.817941346351/8.0),
+    REAL_CONST(85407.610778670132/8.0),
+    REAL_CONST(85430.405136783724/8.0),
+    REAL_CONST(85453.201015484257/8.0),
+    REAL_CONST(85475.998414568865/8.0),
+    REAL_CONST(85498.797333834795/8.0),
+    REAL_CONST(85521.597773079353/8.0),
+    REAL_CONST(85544.399732099904/8.0),
+    REAL_CONST(85567.203210693886/8.0),
+    REAL_CONST(85590.008208658808/8.0),
+    REAL_CONST(85612.814725792239/8.0),
+    REAL_CONST(85635.62276189182/8.0),
+    REAL_CONST(85658.432316755265/8.0),
+    REAL_CONST(85681.243390180331/8.0),
+    REAL_CONST(85704.055981964877/8.0),
+    REAL_CONST(85726.870091906807/8.0),
+    REAL_CONST(85749.685719804082/8.0),
+    REAL_CONST(85772.502865454764/8.0),
+    REAL_CONST(85795.321528656961/8.0),
+    REAL_CONST(85818.141709208852/8.0),
+    REAL_CONST(85840.963406908675/8.0),
+    REAL_CONST(85863.78662155474/8.0),
+    REAL_CONST(85886.611352945445/8.0),
+    REAL_CONST(85909.437600879217/8.0),
+    REAL_CONST(85932.26536515457/8.0),
+    REAL_CONST(85955.094645570091/8.0),
+    REAL_CONST(85977.92544192441/8.0),
+    REAL_CONST(86000.757754016275/8.0),
+    REAL_CONST(86023.591581644432/8.0),
+    REAL_CONST(86046.426924607746/8.0),
+    REAL_CONST(86069.263782705122/8.0),
+    REAL_CONST(86092.102155735556/8.0),
+    REAL_CONST(86114.942043498071/8.0),
+    REAL_CONST(86137.783445791807/8.0),
+    REAL_CONST(86160.626362415918/8.0),
+    REAL_CONST(86183.470793169676/8.0),
+    REAL_CONST(86206.316737852379/8.0),
+    REAL_CONST(86229.164196263402/8.0),
+    REAL_CONST(86252.013168202204/8.0),
+    REAL_CONST(86274.863653468303/8.0),
+    REAL_CONST(86297.715651861261/8.0),
+    REAL_CONST(86320.569163180728/8.0),
+    REAL_CONST(86343.424187226425/8.0),
+    REAL_CONST(86366.280723798132/8.0),
+    REAL_CONST(86389.138772695675/8.0),
+    REAL_CONST(86411.998333718977/8.0),
+    REAL_CONST(86434.859406668009/8.0),
+    REAL_CONST(86457.721991342827/8.0),
+    REAL_CONST(86480.586087543532/8.0),
+    REAL_CONST(86503.451695070296/8.0),
+    REAL_CONST(86526.318813723352/8.0),
+    REAL_CONST(86549.187443303032/8.0),
+    REAL_CONST(86572.057583609683/8.0),
+    REAL_CONST(86594.929234443756/8.0),
+    REAL_CONST(86617.802395605773/8.0),
+    REAL_CONST(86640.677066896271/8.0),
+    REAL_CONST(86663.553248115903/8.0),
+    REAL_CONST(86686.43093906538/8.0),
+    REAL_CONST(86709.310139545443/8.0),
+    REAL_CONST(86732.190849356964/8.0),
+    REAL_CONST(86755.073068300815/8.0),
+    REAL_CONST(86777.956796177954/8.0),
+    REAL_CONST(86800.842032789442/8.0),
+    REAL_CONST(86823.728777936354/8.0),
+    REAL_CONST(86846.617031419853/8.0),
+    REAL_CONST(86869.506793041175/8.0),
+    REAL_CONST(86892.398062601613/8.0),
+    REAL_CONST(86915.290839902518/8.0),
+    REAL_CONST(86938.185124745316/8.0),
+    REAL_CONST(86961.080916931489/8.0),
+    REAL_CONST(86983.978216262592/8.0),
+    REAL_CONST(87006.87702254027/8.0),
+    REAL_CONST(87029.777335566177/8.0),
+    REAL_CONST(87052.67915514209/8.0),
+    REAL_CONST(87075.582481069796/8.0),
+    REAL_CONST(87098.487313151185/8.0),
+    REAL_CONST(87121.39365118822/8.0),
+    REAL_CONST(87144.301494982894/8.0),
+    REAL_CONST(87167.210844337285/8.0),
+    REAL_CONST(87190.121699053532/8.0),
+    REAL_CONST(87213.034058933845/8.0),
+    REAL_CONST(87235.947923780506/8.0),
+    REAL_CONST(87258.863293395829/8.0),
+    REAL_CONST(87281.780167582241/8.0),
+    REAL_CONST(87304.698546142172/8.0),
+    REAL_CONST(87327.618428878181/8.0),
+    REAL_CONST(87350.539815592856/8.0),
+    REAL_CONST(87373.462706088845/8.0),
+    REAL_CONST(87396.387100168897/8.0),
+    REAL_CONST(87419.312997635774/8.0),
+    REAL_CONST(87442.240398292357/8.0),
+    REAL_CONST(87465.16930194154/8.0),
+    REAL_CONST(87488.099708386319/8.0),
+    REAL_CONST(87511.031617429733/8.0),
+    REAL_CONST(87533.965028874911/8.0),
+    REAL_CONST(87556.899942525008/8.0),
+    REAL_CONST(87579.836358183282/8.0),
+    REAL_CONST(87602.774275653021/8.0),
+    REAL_CONST(87625.713694737613/8.0),
+    REAL_CONST(87648.654615240492/8.0),
+    REAL_CONST(87671.597036965148/8.0),
+    REAL_CONST(87694.540959715145/8.0),
+    REAL_CONST(87717.486383294105/8.0),
+    REAL_CONST(87740.433307505737/8.0),
+    REAL_CONST(87763.381732153779/8.0),
+    REAL_CONST(87786.331657042057/8.0),
+    REAL_CONST(87809.283081974456/8.0),
+    REAL_CONST(87832.236006754916/8.0),
+    REAL_CONST(87855.190431187453/8.0),
+    REAL_CONST(87878.146355076155/8.0),
+    REAL_CONST(87901.103778225151/8.0),
+    REAL_CONST(87924.062700438633/8.0),
+    REAL_CONST(87947.023121520891/8.0),
+    REAL_CONST(87969.985041276246/8.0),
+    REAL_CONST(87992.948459509105/8.0),
+    REAL_CONST(88015.913376023906/8.0),
+    REAL_CONST(88038.879790625171/8.0),
+    REAL_CONST(88061.847703117513/8.0),
+    REAL_CONST(88084.817113305573/8.0),
+    REAL_CONST(88107.788020994049/8.0),
+    REAL_CONST(88130.760425987726/8.0),
+    REAL_CONST(88153.734328091465/8.0),
+    REAL_CONST(88176.709727110137/8.0),
+    REAL_CONST(88199.686622848749/8.0),
+    REAL_CONST(88222.665015112303/8.0),
+    REAL_CONST(88245.644903705906/8.0),
+    REAL_CONST(88268.626288434709/8.0),
+    REAL_CONST(88291.609169103947/8.0),
+    REAL_CONST(88314.593545518903/8.0),
+    REAL_CONST(88337.579417484914/8.0),
+    REAL_CONST(88360.566784807408/8.0),
+    REAL_CONST(88383.555647291854/8.0),
+    REAL_CONST(88406.546004743795/8.0),
+    REAL_CONST(88429.537856968818/8.0),
+    REAL_CONST(88452.531203772611/8.0),
+    REAL_CONST(88475.52604496089/8.0),
+    REAL_CONST(88498.522380339447/8.0),
+    REAL_CONST(88521.52020971413/8.0),
+    REAL_CONST(88544.519532890874/8.0),
+    REAL_CONST(88567.520349675644/8.0),
+    REAL_CONST(88590.522659874507/8.0),
+    REAL_CONST(88613.526463293543/8.0),
+    REAL_CONST(88636.531759738922/8.0),
+    REAL_CONST(88659.538549016899/8.0),
+    REAL_CONST(88682.546830933745/8.0),
+    REAL_CONST(88705.556605295846/8.0),
+    REAL_CONST(88728.567871909589/8.0),
+    REAL_CONST(88751.580630581491/8.0),
+    REAL_CONST(88774.594881118086/8.0),
+    REAL_CONST(88797.610623325963/8.0),
+    REAL_CONST(88820.62785701183/8.0),
+    REAL_CONST(88843.646581982393/8.0),
+    REAL_CONST(88866.666798044462/8.0),
+    REAL_CONST(88889.688505004888/8.0),
+    REAL_CONST(88912.711702670611/8.0),
+    REAL_CONST(88935.7363908486/8.0),
+    REAL_CONST(88958.762569345898/8.0),
+    REAL_CONST(88981.790237969632/8.0),
+    REAL_CONST(89004.81939652696/8.0),
+    REAL_CONST(89027.850044825114/8.0),
+    REAL_CONST(89050.882182671412/8.0),
+    REAL_CONST(89073.9158098732/8.0),
+    REAL_CONST(89096.950926237885/8.0),
+    REAL_CONST(89119.987531572973/8.0),
+    REAL_CONST(89143.025625686001/8.0),
+    REAL_CONST(89166.065208384563/8.0),
+    REAL_CONST(89189.106279476357/8.0),
+    REAL_CONST(89212.148838769106/8.0),
+    REAL_CONST(89235.192886070581/8.0),
+    REAL_CONST(89258.238421188667/8.0),
+    REAL_CONST(89281.285443931265/8.0),
+    REAL_CONST(89304.333954106376/8.0),
+    REAL_CONST(89327.383951522017/8.0),
+    REAL_CONST(89350.435435986306/8.0),
+    REAL_CONST(89373.488407307406/8.0),
+    REAL_CONST(89396.542865293537/8.0),
+    REAL_CONST(89419.598809753006/8.0),
+    REAL_CONST(89442.656240494165/8.0),
+    REAL_CONST(89465.715157325409/8.0),
+    REAL_CONST(89488.775560055219/8.0),
+    REAL_CONST(89511.837448492137/8.0),
+    REAL_CONST(89534.900822444746/8.0),
+    REAL_CONST(89557.965681721733/8.0),
+    REAL_CONST(89581.032026131812/8.0),
+    REAL_CONST(89604.099855483742/8.0),
+    REAL_CONST(89627.169169586399/8.0),
+    REAL_CONST(89650.239968248672/8.0),
+    REAL_CONST(89673.312251279538/8.0),
+    REAL_CONST(89696.386018488018/8.0),
+    REAL_CONST(89719.461269683205/8.0),
+    REAL_CONST(89742.53800467425/8.0),
+    REAL_CONST(89765.616223270365/8.0),
+    REAL_CONST(89788.69592528083/8.0),
+    REAL_CONST(89811.777110514988/8.0),
+    REAL_CONST(89834.859778782207/8.0),
+    REAL_CONST(89857.943929891975/8.0),
+    REAL_CONST(89881.029563653807/8.0),
+    REAL_CONST(89904.116679877261/8.0),
+    REAL_CONST(89927.205278372014/8.0),
+    REAL_CONST(89950.29535894774/8.0),
+    REAL_CONST(89973.386921414218/8.0),
+    REAL_CONST(89996.479965581268/8.0),
+    REAL_CONST(90019.574491258769/8.0),
+    REAL_CONST(90042.670498256688/8.0),
+    REAL_CONST(90065.767986385021/8.0),
+    REAL_CONST(90088.866955453836/8.0),
+    REAL_CONST(90111.967405273259/8.0),
+    REAL_CONST(90135.069335653476/8.0),
+    REAL_CONST(90158.172746404758/8.0),
+    REAL_CONST(90181.277637337407/8.0),
+    REAL_CONST(90204.384008261797/8.0),
+    REAL_CONST(90227.49185898836/8.0),
+    REAL_CONST(90250.601189327586/8.0),
+    REAL_CONST(90273.711999090039/8.0),
+    REAL_CONST(90296.824288086325/8.0),
+    REAL_CONST(90319.938056127125/8.0),
+    REAL_CONST(90343.053303023189/8.0),
+    REAL_CONST(90366.170028585286/8.0),
+    REAL_CONST(90389.288232624298/8.0),
+    REAL_CONST(90412.407914951138/8.0),
+    REAL_CONST(90435.529075376777/8.0),
+    REAL_CONST(90458.651713712257/8.0),
+    REAL_CONST(90481.775829768681/8.0),
+    REAL_CONST(90504.901423357209/8.0),
+    REAL_CONST(90528.028494289058/8.0),
+    REAL_CONST(90551.157042375504/8.0),
+    REAL_CONST(90574.287067427911/8.0),
+    REAL_CONST(90597.418569257643/8.0),
+    REAL_CONST(90620.551547676194/8.0),
+    REAL_CONST(90643.686002495073/8.0),
+    REAL_CONST(90666.821933525847/8.0),
+    REAL_CONST(90689.959340580186/8.0),
+    REAL_CONST(90713.098223469773/8.0),
+    REAL_CONST(90736.238582006365/8.0),
+    REAL_CONST(90759.380416001804/8.0),
+    REAL_CONST(90782.523725267951/8.0),
+    REAL_CONST(90805.668509616764/8.0),
+    REAL_CONST(90828.814768860233/8.0),
+    REAL_CONST(90851.962502810435/8.0),
+    REAL_CONST(90875.11171127946/8.0),
+    REAL_CONST(90898.262394079517/8.0),
+    REAL_CONST(90921.414551022855/8.0),
+    REAL_CONST(90944.568181921743/8.0),
+    REAL_CONST(90967.72328658856/8.0),
+    REAL_CONST(90990.879864835719/8.0),
+    REAL_CONST(91014.037916475718/8.0),
+    REAL_CONST(91037.19744132107/8.0),
+    REAL_CONST(91060.358439184391/8.0),
+    REAL_CONST(91083.520909878338/8.0),
+    REAL_CONST(91106.684853215629/8.0),
+    REAL_CONST(91129.850269009039/8.0),
+    REAL_CONST(91153.017157071401/8.0),
+    REAL_CONST(91176.185517215621/8.0),
+    REAL_CONST(91199.355349254649/8.0),
+    REAL_CONST(91222.526653001492/8.0),
+    REAL_CONST(91245.699428269247/8.0),
+    REAL_CONST(91268.873674871036/8.0),
+    REAL_CONST(91292.049392620058/8.0),
+    REAL_CONST(91315.226581329553/8.0),
+    REAL_CONST(91338.405240812834/8.0),
+    REAL_CONST(91361.585370883287/8.0),
+    REAL_CONST(91384.766971354344/8.0),
+    REAL_CONST(91407.950042039476/8.0),
+    REAL_CONST(91431.134582752245/8.0),
+    REAL_CONST(91454.320593306256/8.0),
+    REAL_CONST(91477.508073515171/8.0),
+    REAL_CONST(91500.697023192712/8.0),
+    REAL_CONST(91523.887442152685/8.0),
+    REAL_CONST(91547.07933020893/8.0),
+    REAL_CONST(91570.272687175326/8.0),
+    REAL_CONST(91593.467512865856/8.0),
+    REAL_CONST(91616.663807094534/8.0),
+    REAL_CONST(91639.861569675442/8.0),
+    REAL_CONST(91663.060800422725/8.0),
+    REAL_CONST(91686.261499150554/8.0),
+    REAL_CONST(91709.463665673218/8.0),
+    REAL_CONST(91732.66729980502/8.0),
+    REAL_CONST(91755.872401360321/8.0),
+    REAL_CONST(91779.078970153569/8.0),
+    REAL_CONST(91802.287005999257/8.0),
+    REAL_CONST(91825.49650871192/8.0),
+    REAL_CONST(91848.707478106167/8.0),
+    REAL_CONST(91871.91991399668/8.0),
+    REAL_CONST(91895.133816198169/8.0),
+    REAL_CONST(91918.349184525418/8.0),
+    REAL_CONST(91941.566018793281/8.0),
+    REAL_CONST(91964.784318816659/8.0),
+    REAL_CONST(91988.004084410495/8.0),
+    REAL_CONST(92011.22531538982/8.0),
+    REAL_CONST(92034.448011569708/8.0),
+    REAL_CONST(92057.672172765277/8.0),
+    REAL_CONST(92080.897798791746/8.0),
+    REAL_CONST(92104.124889464365/8.0),
+    REAL_CONST(92127.353444598411/8.0),
+    REAL_CONST(92150.58346400928/8.0),
+    REAL_CONST(92173.814947512379/8.0),
+    REAL_CONST(92197.04789492322/8.0),
+    REAL_CONST(92220.282306057314/8.0),
+    REAL_CONST(92243.518180730272/8.0),
+    REAL_CONST(92266.755518757753/8.0),
+    REAL_CONST(92289.994319955469/8.0),
+    REAL_CONST(92313.234584139194/8.0),
+    REAL_CONST(92336.476311124774/8.0),
+    REAL_CONST(92359.719500728082/8.0),
+    REAL_CONST(92382.964152765067/8.0),
+    REAL_CONST(92406.210267051734/8.0),
+    REAL_CONST(92429.457843404161/8.0),
+    REAL_CONST(92452.706881638471/8.0),
+    REAL_CONST(92475.957381570814/8.0),
+    REAL_CONST(92499.209343017443/8.0),
+    REAL_CONST(92522.462765794655/8.0),
+    REAL_CONST(92545.717649718805/8.0),
+    REAL_CONST(92568.973994606305/8.0),
+    REAL_CONST(92592.231800273614/8.0),
+    REAL_CONST(92615.491066537259/8.0),
+    REAL_CONST(92638.751793213814/8.0),
+    REAL_CONST(92662.01398011994/8.0),
+    REAL_CONST(92685.277627072326/8.0),
+    REAL_CONST(92708.54273388772/8.0),
+    REAL_CONST(92731.809300382942/8.0),
+    REAL_CONST(92755.077326374871/8.0),
+    REAL_CONST(92778.346811680414/8.0),
+    REAL_CONST(92801.617756116568/8.0),
+    REAL_CONST(92824.890159500384/8.0),
+    REAL_CONST(92848.164021648947/8.0),
+    REAL_CONST(92871.439342379424/8.0),
+    REAL_CONST(92894.716121509016/8.0),
+    REAL_CONST(92917.994358855023/8.0),
+    REAL_CONST(92941.274054234746/8.0),
+    REAL_CONST(92964.555207465572/8.0),
+    REAL_CONST(92987.837818364962/8.0),
+    REAL_CONST(93011.121886750407/8.0),
+    REAL_CONST(93034.407412439468/8.0),
+    REAL_CONST(93057.694395249753/8.0),
+    REAL_CONST(93080.982834998955/8.0),
+    REAL_CONST(93104.272731504767/8.0),
+    REAL_CONST(93127.564084584999/8.0),
+    REAL_CONST(93150.856894057491/8.0),
+    REAL_CONST(93174.15115974014/8.0),
+    REAL_CONST(93197.446881450916/8.0),
+    REAL_CONST(93220.744059007804/8.0),
+    REAL_CONST(93244.04269222889/8.0),
+    REAL_CONST(93267.342780932304/8.0),
+    REAL_CONST(93290.644324936235/8.0),
+    REAL_CONST(93313.947324058914/8.0),
+    REAL_CONST(93337.251778118633/8.0),
+    REAL_CONST(93360.557686933767/8.0),
+    REAL_CONST(93383.865050322696/8.0),
+    REAL_CONST(93407.173868103928/8.0),
+    REAL_CONST(93430.484140095941/8.0),
+    REAL_CONST(93453.795866117362/8.0),
+    REAL_CONST(93477.109045986799/8.0),
+    REAL_CONST(93500.423679522952/8.0),
+    REAL_CONST(93523.739766544561/8.0),
+    REAL_CONST(93547.057306870454/8.0),
+    REAL_CONST(93570.376300319491/8.0),
+    REAL_CONST(93593.696746710571/8.0),
+    REAL_CONST(93617.018645862699/8.0),
+    REAL_CONST(93640.341997594893/8.0),
+    REAL_CONST(93663.666801726242/8.0),
+    REAL_CONST(93686.993058075881/8.0),
+    REAL_CONST(93710.320766463032/8.0),
+    REAL_CONST(93733.64992670693/8.0),
+    REAL_CONST(93756.980538626914/8.0),
+    REAL_CONST(93780.312602042337/8.0),
+    REAL_CONST(93803.646116772637/8.0),
+    REAL_CONST(93826.981082637285/8.0),
+    REAL_CONST(93850.317499455836/8.0),
+    REAL_CONST(93873.655367047861/8.0),
+    REAL_CONST(93896.994685233032/8.0),
+    REAL_CONST(93920.335453831038/8.0),
+    REAL_CONST(93943.677672661666/8.0),
+    REAL_CONST(93967.021341544707/8.0),
+    REAL_CONST(93990.366460300051/8.0),
+    REAL_CONST(94013.713028747632/8.0),
+    REAL_CONST(94037.061046707429/8.0),
+    REAL_CONST(94060.410513999494/8.0),
+    REAL_CONST(94083.761430443905/8.0),
+    REAL_CONST(94107.113795860845/8.0),
+    REAL_CONST(94130.467610070496/8.0),
+    REAL_CONST(94153.822872893157/8.0),
+    REAL_CONST(94177.179584149111/8.0),
+    REAL_CONST(94200.537743658759/8.0),
+    REAL_CONST(94223.897351242529/8.0),
+    REAL_CONST(94247.25840672091/8.0),
+    REAL_CONST(94270.620909914433/8.0),
+    REAL_CONST(94293.98486064373/8.0),
+    REAL_CONST(94317.350258729421/8.0),
+    REAL_CONST(94340.71710399224/8.0),
+    REAL_CONST(94364.085396252936/8.0),
+    REAL_CONST(94387.455135332348/8.0),
+    REAL_CONST(94410.82632105134/8.0),
+    REAL_CONST(94434.198953230851/8.0),
+    REAL_CONST(94457.573031691878/8.0),
+    REAL_CONST(94480.948556255447/8.0),
+    REAL_CONST(94504.325526742658/8.0),
+    REAL_CONST(94527.70394297468/8.0),
+    REAL_CONST(94551.083804772716/8.0),
+    REAL_CONST(94574.465111958023/8.0),
+    REAL_CONST(94597.847864351934/8.0),
+    REAL_CONST(94621.232061775823/8.0),
+    REAL_CONST(94644.617704051096/8.0),
+    REAL_CONST(94668.004790999272/8.0),
+    REAL_CONST(94691.393322441872/8.0),
+    REAL_CONST(94714.783298200506/8.0),
+    REAL_CONST(94738.174718096794/8.0),
+    REAL_CONST(94761.567581952477/8.0),
+    REAL_CONST(94784.961889589307/8.0),
+    REAL_CONST(94808.357640829097/8.0),
+    REAL_CONST(94831.754835493703/8.0),
+    REAL_CONST(94855.153473405066/8.0),
+    REAL_CONST(94878.553554385173/8.0),
+    REAL_CONST(94901.955078256055/8.0),
+    REAL_CONST(94925.358044839784/8.0),
+    REAL_CONST(94948.762453958523/8.0),
+    REAL_CONST(94972.168305434476/8.0),
+    REAL_CONST(94995.575599089891/8.0),
+    REAL_CONST(95018.984334747074/8.0),
+    REAL_CONST(95042.394512228391/8.0),
+    REAL_CONST(95065.806131356265/8.0),
+    REAL_CONST(95089.219191953176/8.0),
+    REAL_CONST(95112.633693841635/8.0),
+    REAL_CONST(95136.04963684424/8.0),
+    REAL_CONST(95159.467020783617/8.0),
+    REAL_CONST(95182.885845482466/8.0),
+    REAL_CONST(95206.306110763529/8.0),
+    REAL_CONST(95229.727816449609/8.0),
+    REAL_CONST(95253.150962363579/8.0),
+    REAL_CONST(95276.575548328314/8.0),
+    REAL_CONST(95300.001574166803/8.0),
+    REAL_CONST(95323.429039702052/8.0),
+    REAL_CONST(95346.857944757154/8.0),
+    REAL_CONST(95370.288289155214/8.0),
+    REAL_CONST(95393.720072719429/8.0),
+    REAL_CONST(95417.153295273019/8.0),
+    REAL_CONST(95440.587956639298/8.0),
+    REAL_CONST(95464.024056641589/8.0),
+    REAL_CONST(95487.461595103305/8.0),
+    REAL_CONST(95510.900571847902/8.0),
+    REAL_CONST(95534.340986698866/8.0),
+    REAL_CONST(95557.782839479783/8.0),
+    REAL_CONST(95581.226130014256/8.0),
+    REAL_CONST(95604.670858125959/8.0),
+    REAL_CONST(95628.117023638595/8.0),
+    REAL_CONST(95651.564626375985/8.0),
+    REAL_CONST(95675.013666161918/8.0),
+    REAL_CONST(95698.464142820303/8.0),
+    REAL_CONST(95721.916056175076/8.0),
+    REAL_CONST(95745.369406050231/8.0),
+    REAL_CONST(95768.824192269807/8.0),
+    REAL_CONST(95792.280414657915/8.0),
+    REAL_CONST(95815.738073038709/8.0),
+    REAL_CONST(95839.197167236387/8.0),
+    REAL_CONST(95862.657697075221/8.0),
+    REAL_CONST(95886.11966237954/8.0),
+    REAL_CONST(95909.583062973688/8.0),
+    REAL_CONST(95933.047898682111/8.0),
+    REAL_CONST(95956.514169329268/8.0),
+    REAL_CONST(95979.981874739708/8.0),
+    REAL_CONST(96003.451014738006/8.0),
+    REAL_CONST(96026.921589148798/8.0),
+    REAL_CONST(96050.393597796792/8.0),
+    REAL_CONST(96073.867040506724/8.0),
+    REAL_CONST(96097.341917103375/8.0),
+    REAL_CONST(96120.818227411626/8.0),
+    REAL_CONST(96144.295971256375/8.0),
+    REAL_CONST(96167.775148462577/8.0),
+    REAL_CONST(96191.255758855244/8.0),
+    REAL_CONST(96214.737802259449/8.0),
+    REAL_CONST(96238.221278500292/8.0),
+    REAL_CONST(96261.70618740299/8.0),
+    REAL_CONST(96285.192528792715/8.0),
+    REAL_CONST(96308.680302494788/8.0),
+    REAL_CONST(96332.169508334526/8.0),
+    REAL_CONST(96355.660146137321/8.0),
+    REAL_CONST(96379.152215728609/8.0),
+    REAL_CONST(96402.645716933868/8.0),
+    REAL_CONST(96426.14064957868/8.0),
+    REAL_CONST(96449.637013488609/8.0),
+    REAL_CONST(96473.134808489311/8.0),
+    REAL_CONST(96496.63403440651/8.0),
+    REAL_CONST(96520.134691065963/8.0),
+    REAL_CONST(96543.636778293469/8.0),
+    REAL_CONST(96567.140295914898/8.0),
+    REAL_CONST(96590.645243756153/8.0),
+    REAL_CONST(96614.151621643221/8.0),
+    REAL_CONST(96637.659429402134/8.0),
+    REAL_CONST(96661.168666858954/8.0),
+    REAL_CONST(96684.679333839798/8.0),
+    REAL_CONST(96708.191430170875/8.0),
+    REAL_CONST(96731.70495567839/8.0),
+    REAL_CONST(96755.219910188665/8.0),
+    REAL_CONST(96778.736293528011/8.0),
+    REAL_CONST(96802.254105522836/8.0),
+    REAL_CONST(96825.77334599958/8.0),
+    REAL_CONST(96849.29401478474/8.0),
+    REAL_CONST(96872.816111704873/8.0),
+    REAL_CONST(96896.339636586577/8.0),
+    REAL_CONST(96919.864589256511/8.0),
+    REAL_CONST(96943.390969541389/8.0),
+    REAL_CONST(96966.918777267958/8.0),
+    REAL_CONST(96990.448012263048/8.0),
+    REAL_CONST(97013.978674353522/8.0),
+    REAL_CONST(97037.510763366285/8.0),
+    REAL_CONST(97061.044279128328/8.0),
+    REAL_CONST(97084.579221466673/8.0),
+    REAL_CONST(97108.115590208385/8.0),
+    REAL_CONST(97131.653385180587/8.0),
+    REAL_CONST(97155.19260621049/8.0),
+    REAL_CONST(97178.733253125291/8.0),
+    REAL_CONST(97202.2753257523/8.0),
+    REAL_CONST(97225.81882391886/8.0),
+    REAL_CONST(97249.363747452342/8.0),
+    REAL_CONST(97272.910096180189/8.0),
+    REAL_CONST(97296.457869929916/8.0),
+    REAL_CONST(97320.007068529041/8.0),
+    REAL_CONST(97343.557691805196/8.0),
+    REAL_CONST(97367.109739586012/8.0),
+    REAL_CONST(97390.663211699197/8.0),
+    REAL_CONST(97414.218107972498/8.0),
+    REAL_CONST(97437.774428233737/8.0),
+    REAL_CONST(97461.332172310766/8.0),
+    REAL_CONST(97484.891340031507/8.0),
+    REAL_CONST(97508.451931223899/8.0),
+    REAL_CONST(97532.013945715982/8.0),
+    REAL_CONST(97555.577383335811/8.0),
+    REAL_CONST(97579.142243911512/8.0),
+    REAL_CONST(97602.708527271257/8.0),
+    REAL_CONST(97626.276233243261/8.0),
+    REAL_CONST(97649.845361655811/8.0),
+    REAL_CONST(97673.415912337223/8.0),
+    REAL_CONST(97696.987885115886/8.0),
+    REAL_CONST(97720.561279820206/8.0),
+    REAL_CONST(97744.1360962787/8.0),
+    REAL_CONST(97767.712334319876/8.0),
+    REAL_CONST(97791.289993772341/8.0),
+    REAL_CONST(97814.869074464703/8.0),
+    REAL_CONST(97838.449576225685/8.0),
+    REAL_CONST(97862.031498883996/8.0),
+    REAL_CONST(97885.614842268449/8.0),
+    REAL_CONST(97909.199606207883/8.0),
+    REAL_CONST(97932.785790531183/8.0),
+    REAL_CONST(97956.37339506732/8.0),
+    REAL_CONST(97979.962419645264/8.0),
+    REAL_CONST(98003.552864094076/8.0),
+    REAL_CONST(98027.144728242856/8.0),
+    REAL_CONST(98050.738011920766/8.0),
+    REAL_CONST(98074.332714956996/8.0),
+    REAL_CONST(98097.928837180807/8.0),
+    REAL_CONST(98121.526378421506/8.0),
+    REAL_CONST(98145.125338508456/8.0),
+    REAL_CONST(98168.725717271067/8.0),
+    REAL_CONST(98192.327514538789/8.0),
+    REAL_CONST(98215.930730141132/8.0),
+    REAL_CONST(98239.535363907664/8.0),
+    REAL_CONST(98263.141415668011/8.0),
+    REAL_CONST(98286.748885251814/8.0),
+    REAL_CONST(98310.357772488816/8.0),
+    REAL_CONST(98333.968077208759/8.0),
+    REAL_CONST(98357.579799241488/8.0),
+    REAL_CONST(98381.192938416847/8.0),
+    REAL_CONST(98404.807494564782/8.0),
+    REAL_CONST(98428.42346751524/8.0),
+    REAL_CONST(98452.040857098269/8.0),
+    REAL_CONST(98475.659663143917/8.0),
+    REAL_CONST(98499.27988548232/8.0),
+    REAL_CONST(98522.901523943656/8.0),
+    REAL_CONST(98546.524578358163/8.0),
+    REAL_CONST(98570.149048556093/8.0),
+    REAL_CONST(98593.774934367786/8.0),
+    REAL_CONST(98617.402235623624/8.0),
+    REAL_CONST(98641.030952154048/8.0),
+    REAL_CONST(98664.661083789513/8.0),
+    REAL_CONST(98688.292630360564/8.0),
+    REAL_CONST(98711.925591697771/8.0),
+    REAL_CONST(98735.559967631794/8.0),
+    REAL_CONST(98759.195757993293/8.0),
+    REAL_CONST(98782.832962613014/8.0),
+    REAL_CONST(98806.471581321734/8.0),
+    REAL_CONST(98830.111613950285/8.0),
+    REAL_CONST(98853.753060329575/8.0),
+    REAL_CONST(98877.39592029051/8.0),
+    REAL_CONST(98901.040193664099/8.0),
+    REAL_CONST(98924.68588028138/8.0),
+    REAL_CONST(98948.33297997342/8.0),
+    REAL_CONST(98971.981492571387/8.0),
+    REAL_CONST(98995.63141790645/8.0),
+    REAL_CONST(99019.282755809851/8.0),
+    REAL_CONST(99042.935506112874/8.0),
+    REAL_CONST(99066.589668646877/8.0),
+    REAL_CONST(99090.245243243233/8.0),
+    REAL_CONST(99113.902229733401/8.0),
+    REAL_CONST(99137.560627948857/8.0),
+    REAL_CONST(99161.220437721131/8.0),
+    REAL_CONST(99184.881658881859/8.0),
+    REAL_CONST(99208.544291262631/8.0),
+    REAL_CONST(99232.208334695169/8.0),
+    REAL_CONST(99255.87378901121/8.0),
+    REAL_CONST(99279.540654042547/8.0),
+    REAL_CONST(99303.208929621018/8.0),
+    REAL_CONST(99326.878615578535/8.0),
+    REAL_CONST(99350.549711746993/8.0),
+    REAL_CONST(99374.222217958435/8.0),
+    REAL_CONST(99397.896134044888/8.0),
+    REAL_CONST(99421.571459838422/8.0),
+    REAL_CONST(99445.248195171211/8.0),
+    REAL_CONST(99468.926339875441/8.0),
+    REAL_CONST(99492.605893783344/8.0),
+    REAL_CONST(99516.286856727209/8.0),
+    REAL_CONST(99539.969228539398/8.0),
+    REAL_CONST(99563.653009052287/8.0),
+    REAL_CONST(99587.338198098325/8.0),
+    REAL_CONST(99611.024795510006/8.0),
+    REAL_CONST(99634.712801119866/8.0),
+    REAL_CONST(99658.402214760499/8.0),
+    REAL_CONST(99682.093036264545/8.0),
+    REAL_CONST(99705.785265464699/8.0),
+    REAL_CONST(99729.478902193689/8.0),
+    REAL_CONST(99753.173946284325/8.0),
+    REAL_CONST(99776.870397569437/8.0),
+    REAL_CONST(99800.56825588191/8.0),
+    REAL_CONST(99824.267521054688/8.0),
+    REAL_CONST(99847.968192920773/8.0),
+    REAL_CONST(99871.670271313182/8.0),
+    REAL_CONST(99895.373756065004/8.0),
+    REAL_CONST(99919.078647009388/8.0),
+    REAL_CONST(99942.78494397951/8.0),
+    REAL_CONST(99966.492646808634/8.0),
+    REAL_CONST(99990.20175533001/8.0),
+    REAL_CONST(100013.91226937699/8.0),
+    REAL_CONST(100037.62418878295/8.0),
+    REAL_CONST(100061.33751338134/8.0),
+    REAL_CONST(100085.05224300563/8.0),
+    REAL_CONST(100108.76837748935/8.0),
+    REAL_CONST(100132.4859166661/8.0),
+    REAL_CONST(100156.2048603695/8.0),
+    REAL_CONST(100179.92520843323/8.0),
+    REAL_CONST(100203.64696069101/8.0),
+    REAL_CONST(100227.37011697664/8.0),
+    REAL_CONST(100251.09467712394/8.0),
+    REAL_CONST(100274.82064096678/8.0),
+    REAL_CONST(100298.54800833909/8.0),
+    REAL_CONST(100322.27677907483/8.0),
+    REAL_CONST(100346.00695300807/8.0),
+    REAL_CONST(100369.73852997283/8.0),
+    REAL_CONST(100393.47150980328/8.0),
+    REAL_CONST(100417.20589233354/8.0),
+    REAL_CONST(100440.94167739789/8.0),
+    REAL_CONST(100464.67886483055/8.0),
+    REAL_CONST(100488.41745446586/8.0),
+    REAL_CONST(100512.1574461382/8.0),
+    REAL_CONST(100535.89883968196/8.0),
+    REAL_CONST(100559.64163493161/8.0),
+    REAL_CONST(100583.38583172169/8.0),
+    REAL_CONST(100607.13142988674/8.0),
+    REAL_CONST(100630.87842926137/8.0),
+    REAL_CONST(100654.62682968024/8.0),
+    REAL_CONST(100678.37663097809/8.0),
+    REAL_CONST(100702.12783298964/8.0),
+    REAL_CONST(100725.88043554971/8.0),
+    REAL_CONST(100749.63443849317/8.0),
+    REAL_CONST(100773.38984165489/8.0),
+    REAL_CONST(100797.14664486986/8.0),
+    REAL_CONST(100820.90484797307/8.0),
+    REAL_CONST(100844.66445079957/8.0),
+    REAL_CONST(100868.42545318443/8.0),
+    REAL_CONST(100892.18785496285/8.0),
+    REAL_CONST(100915.95165596998/8.0),
+    REAL_CONST(100939.71685604109/8.0),
+    REAL_CONST(100963.48345501146/8.0),
+    REAL_CONST(100987.25145271645/8.0),
+    REAL_CONST(101011.02084899142/8.0),
+    REAL_CONST(101034.79164367182/8.0),
+    REAL_CONST(101058.56383659317/8.0),
+    REAL_CONST(101082.33742759094/8.0),
+    REAL_CONST(101106.11241650078/8.0),
+    REAL_CONST(101129.88880315828/8.0),
+    REAL_CONST(101153.66658739912/8.0),
+    REAL_CONST(101177.44576905905/8.0),
+    REAL_CONST(101201.22634797383/8.0),
+    REAL_CONST(101225.00832397929/8.0),
+    REAL_CONST(101248.7916969113/8.0),
+    REAL_CONST(101272.57646660579/8.0),
+    REAL_CONST(101296.36263289873/8.0),
+    REAL_CONST(101320.15019562612/8.0),
+    REAL_CONST(101343.93915462404/8.0),
+    REAL_CONST(101367.7295097286/8.0),
+    REAL_CONST(101391.52126077596/8.0),
+    REAL_CONST(101415.31440760233/8.0),
+    REAL_CONST(101439.10895004397/8.0),
+    REAL_CONST(101462.9048879372/8.0),
+    REAL_CONST(101486.70222111834/8.0),
+    REAL_CONST(101510.50094942382/8.0),
+    REAL_CONST(101534.30107269008/8.0),
+    REAL_CONST(101558.10259075361/8.0),
+    REAL_CONST(101581.90550345098/8.0),
+    REAL_CONST(101605.70981061876/8.0),
+    REAL_CONST(101629.5155120936/8.0),
+    REAL_CONST(101653.32260771218/8.0),
+    REAL_CONST(101677.13109731126/8.0),
+    REAL_CONST(101700.9409807276/8.0),
+    REAL_CONST(101724.75225779804/8.0),
+    REAL_CONST(101748.56492835947/8.0),
+    REAL_CONST(101772.37899224881/8.0),
+    REAL_CONST(101796.19444930303/8.0),
+    REAL_CONST(101820.01129935916/8.0),
+    REAL_CONST(101843.82954225427/8.0),
+    REAL_CONST(101867.64917782549/8.0),
+    REAL_CONST(101891.47020590997/8.0),
+    REAL_CONST(101915.29262634492/8.0),
+    REAL_CONST(101939.11643896763/8.0),
+    REAL_CONST(101962.94164361537/8.0),
+    REAL_CONST(101986.76824012553/8.0),
+    REAL_CONST(102010.59622833549/8.0),
+    REAL_CONST(102034.42560808272/8.0),
+    REAL_CONST(102058.25637920471/8.0),
+    REAL_CONST(102082.08854153901/8.0),
+    REAL_CONST(102105.9220949232/8.0),
+    REAL_CONST(102129.75703919494/8.0),
+    REAL_CONST(102153.59337419191/8.0),
+    REAL_CONST(102177.43109975185/8.0),
+    REAL_CONST(102201.27021571253/8.0),
+    REAL_CONST(102225.1107219118/8.0),
+    REAL_CONST(102248.95261818753/8.0),
+    REAL_CONST(102272.79590437764/8.0),
+    REAL_CONST(102296.64058032009/8.0),
+    REAL_CONST(102320.48664585294/8.0),
+    REAL_CONST(102344.33410081422/8.0),
+    REAL_CONST(102368.18294504205/8.0),
+    REAL_CONST(102392.03317837461/8.0),
+    REAL_CONST(102415.88480065008/8.0),
+    REAL_CONST(102439.73781170673/8.0),
+    REAL_CONST(102463.59221138287/8.0),
+    REAL_CONST(102487.44799951684/8.0),
+    REAL_CONST(102511.30517594704/8.0),
+    REAL_CONST(102535.1637405119/8.0),
+    REAL_CONST(102559.02369304992/8.0),
+    REAL_CONST(102582.88503339965/8.0),
+    REAL_CONST(102606.74776139967/8.0),
+    REAL_CONST(102630.61187688859/8.0),
+    REAL_CONST(102654.4773797051/8.0),
+    REAL_CONST(102678.34426968795/8.0),
+    REAL_CONST(102702.21254667587/8.0),
+    REAL_CONST(102726.08221050771/8.0),
+    REAL_CONST(102749.95326102231/8.0),
+    REAL_CONST(102773.8256980586/8.0),
+    REAL_CONST(102797.69952145554/8.0),
+    REAL_CONST(102821.57473105213/8.0),
+    REAL_CONST(102845.45132668741/8.0),
+    REAL_CONST(102869.32930820051/8.0),
+    REAL_CONST(102893.20867543056/8.0),
+    REAL_CONST(102917.08942821674/8.0),
+    REAL_CONST(102940.97156639832/8.0),
+    REAL_CONST(102964.85508981455/8.0),
+    REAL_CONST(102988.73999830478/8.0),
+    REAL_CONST(103012.6262917084/8.0),
+    REAL_CONST(103036.51396986481/8.0),
+    REAL_CONST(103060.40303261351/8.0),
+    REAL_CONST(103084.293479794/8.0),
+    REAL_CONST(103108.18531124585/8.0),
+    REAL_CONST(103132.07852680866/8.0),
+    REAL_CONST(103155.97312632212/8.0),
+    REAL_CONST(103179.8691096259/8.0),
+    REAL_CONST(103203.76647655977/8.0),
+    REAL_CONST(103227.66522696352/8.0),
+    REAL_CONST(103251.56536067701/8.0),
+    REAL_CONST(103275.46687754011/8.0),
+    REAL_CONST(103299.36977739276/8.0),
+    REAL_CONST(103323.27406007495/8.0),
+    REAL_CONST(103347.1797254267/8.0),
+    REAL_CONST(103371.0867732881/8.0),
+    REAL_CONST(103394.99520349925/8.0),
+    REAL_CONST(103418.90501590034/8.0),
+    REAL_CONST(103442.81621033157/8.0),
+    REAL_CONST(103466.72878663319/8.0),
+    REAL_CONST(103490.64274464553/8.0),
+    REAL_CONST(103514.55808420894/8.0),
+    REAL_CONST(103538.4748051638/8.0),
+    REAL_CONST(103562.39290735057/8.0),
+    REAL_CONST(103586.31239060973/8.0),
+    REAL_CONST(103610.23325478184/8.0),
+    REAL_CONST(103634.15549970744/8.0),
+    REAL_CONST(103658.07912522719/8.0),
+    REAL_CONST(103682.00413118176/8.0),
+    REAL_CONST(103705.93051741188/8.0),
+    REAL_CONST(103729.85828375829/8.0),
+    REAL_CONST(103753.78743006183/8.0),
+    REAL_CONST(103777.71795616332/8.0),
+    REAL_CONST(103801.64986190372/8.0),
+    REAL_CONST(103825.58314712394/8.0),
+    REAL_CONST(103849.51781166498/8.0),
+    REAL_CONST(103873.4538553679/8.0),
+    REAL_CONST(103897.39127807376/8.0),
+    REAL_CONST(103921.33007962372/8.0),
+    REAL_CONST(103945.27025985894/8.0),
+    REAL_CONST(103969.21181862066/8.0),
+    REAL_CONST(103993.15475575015/8.0),
+    REAL_CONST(104017.0990710887/8.0),
+    REAL_CONST(104041.0447644777/8.0),
+    REAL_CONST(104064.99183575854/8.0),
+    REAL_CONST(104088.94028477269/8.0),
+    REAL_CONST(104112.89011136163/8.0),
+    REAL_CONST(104136.84131536692/8.0),
+    REAL_CONST(104160.79389663014/8.0),
+    REAL_CONST(104184.74785499295/8.0),
+    REAL_CONST(104208.70319029699/8.0),
+    REAL_CONST(104232.65990238401/8.0),
+    REAL_CONST(104256.61799109577/8.0),
+    REAL_CONST(104280.57745627411/8.0),
+    REAL_CONST(104304.53829776087/8.0),
+    REAL_CONST(104328.50051539797/8.0),
+    REAL_CONST(104352.46410902737/8.0),
+    REAL_CONST(104376.42907849104/8.0),
+    REAL_CONST(104400.39542363105/8.0),
+    REAL_CONST(104424.36314428948/8.0),
+    REAL_CONST(104448.33224030846/8.0),
+    REAL_CONST(104472.3027115302/8.0),
+    REAL_CONST(104496.27455779689/8.0),
+    REAL_CONST(104520.24777895081/8.0),
+    REAL_CONST(104544.22237483428/8.0),
+    REAL_CONST(104568.19834528965/8.0),
+    REAL_CONST(104592.17569015936/8.0),
+    REAL_CONST(104616.15440928582/8.0),
+    REAL_CONST(104640.13450251156/8.0),
+    REAL_CONST(104664.1159696791/8.0),
+    REAL_CONST(104688.09881063103/8.0),
+    REAL_CONST(104712.08302520998/8.0),
+    REAL_CONST(104736.06861325864/8.0),
+    REAL_CONST(104760.05557461972/8.0),
+    REAL_CONST(104784.043909136/8.0),
+    REAL_CONST(104808.03361665027/8.0),
+    REAL_CONST(104832.0246970054/8.0),
+    REAL_CONST(104856.01715004431/8.0),
+    REAL_CONST(104880.01097560991/8.0),
+    REAL_CONST(104904.00617354522/8.0),
+    REAL_CONST(104928.00274369326/8.0),
+    REAL_CONST(104952.00068589712/8.0),
+    REAL_CONST(104975.99999999993/8.0),
+    REAL_CONST(105000.00068584486/8.0),
+    REAL_CONST(105024.00274327511/8.0),
+    REAL_CONST(105048.00617213396/8.0),
+    REAL_CONST(105072.0109722647/8.0),
+    REAL_CONST(105096.0171435107/8.0),
+    REAL_CONST(105120.02468571534/8.0),
+    REAL_CONST(105144.03359872208/8.0),
+    REAL_CONST(105168.04388237436/8.0),
+    REAL_CONST(105192.05553651576/8.0),
+    REAL_CONST(105216.06856098982/8.0),
+    REAL_CONST(105240.08295564017/8.0),
+    REAL_CONST(105264.09872031047/8.0),
+    REAL_CONST(105288.11585484444/8.0),
+    REAL_CONST(105312.13435908582/8.0),
+    REAL_CONST(105336.1542328784/8.0),
+    REAL_CONST(105360.17547606604/8.0),
+    REAL_CONST(105384.19808849262/8.0),
+    REAL_CONST(105408.22207000206/8.0),
+    REAL_CONST(105432.24742043833/8.0),
+    REAL_CONST(105456.27413964548/8.0),
+    REAL_CONST(105480.30222746753/8.0),
+    REAL_CONST(105504.33168374863/8.0),
+    REAL_CONST(105528.36250833291/8.0),
+    REAL_CONST(105552.39470106458/8.0),
+    REAL_CONST(105576.42826178786/8.0),
+    REAL_CONST(105600.46319034706/8.0),
+    REAL_CONST(105624.49948658649/8.0),
+    REAL_CONST(105648.53715035053/8.0),
+    REAL_CONST(105672.5761814836/8.0),
+    REAL_CONST(105696.61657983017/8.0),
+    REAL_CONST(105720.65834523473/8.0),
+    REAL_CONST(105744.70147754184/8.0),
+    REAL_CONST(105768.7459765961/8.0),
+    REAL_CONST(105792.79184224214/8.0),
+    REAL_CONST(105816.83907432464/8.0),
+    REAL_CONST(105840.88767268835/8.0),
+    REAL_CONST(105864.93763717801/8.0),
+    REAL_CONST(105888.98896763846/8.0),
+    REAL_CONST(105913.04166391456/8.0),
+    REAL_CONST(105937.09572585119/8.0),
+    REAL_CONST(105961.15115329332/8.0),
+    REAL_CONST(105985.20794608595/8.0),
+    REAL_CONST(106009.26610407409/8.0),
+    REAL_CONST(106033.32562710284/8.0),
+    REAL_CONST(106057.38651501729/8.0),
+    REAL_CONST(106081.44876766266/8.0),
+    REAL_CONST(106105.51238488412/8.0),
+    REAL_CONST(106129.57736652695/8.0),
+    REAL_CONST(106153.64371243643/8.0),
+    REAL_CONST(106177.71142245791/8.0),
+    REAL_CONST(106201.78049643678/8.0),
+    REAL_CONST(106225.85093421848/8.0),
+    REAL_CONST(106249.92273564848/8.0),
+    REAL_CONST(106273.99590057228/8.0),
+    REAL_CONST(106298.07042883546/8.0),
+    REAL_CONST(106322.14632028362/8.0),
+    REAL_CONST(106346.22357476239/8.0),
+    REAL_CONST(106370.30219211751/8.0),
+    REAL_CONST(106394.38217219469/8.0),
+    REAL_CONST(106418.46351483969/8.0),
+    REAL_CONST(106442.54621989837/8.0),
+    REAL_CONST(106466.63028721658/8.0),
+    REAL_CONST(106490.71571664025/8.0),
+    REAL_CONST(106514.80250801529/8.0),
+    REAL_CONST(106538.89066118775/8.0),
+    REAL_CONST(106562.98017600364/8.0),
+    REAL_CONST(106587.07105230905/8.0),
+    REAL_CONST(106611.16328995011/8.0),
+    REAL_CONST(106635.25688877302/8.0),
+    REAL_CONST(106659.35184862395/8.0),
+    REAL_CONST(106683.44816934918/8.0),
+    REAL_CONST(106707.54585079502/8.0),
+    REAL_CONST(106731.64489280782/8.0),
+    REAL_CONST(106755.74529523395/8.0),
+    REAL_CONST(106779.84705791986/8.0),
+    REAL_CONST(106803.95018071201/8.0),
+    REAL_CONST(106828.05466345693/8.0),
+    REAL_CONST(106852.16050600118/8.0),
+    REAL_CONST(106876.26770819137/8.0),
+    REAL_CONST(106900.37626987413/8.0),
+    REAL_CONST(106924.48619089619/8.0),
+    REAL_CONST(106948.59747110425/8.0),
+    REAL_CONST(106972.71011034511/8.0),
+    REAL_CONST(106996.82410846559/8.0),
+    REAL_CONST(107020.93946531253/8.0),
+    REAL_CONST(107045.05618073288/8.0),
+    REAL_CONST(107069.17425457356/8.0),
+    REAL_CONST(107093.29368668159/8.0),
+    REAL_CONST(107117.41447690397/8.0),
+    REAL_CONST(107141.53662508781/8.0),
+    REAL_CONST(107165.66013108024/8.0),
+    REAL_CONST(107189.7849947284/8.0),
+    REAL_CONST(107213.91121587952/8.0),
+    REAL_CONST(107238.03879438085/8.0),
+    REAL_CONST(107262.16773007967/8.0),
+    REAL_CONST(107286.29802282334/8.0),
+    REAL_CONST(107310.42967245923/8.0),
+    REAL_CONST(107334.56267883476/8.0),
+    REAL_CONST(107358.69704179741/8.0),
+    REAL_CONST(107382.83276119467/8.0),
+    REAL_CONST(107406.96983687414/8.0),
+    REAL_CONST(107431.10826868335/8.0),
+    REAL_CONST(107455.24805646999/8.0),
+    REAL_CONST(107479.38920008171/8.0),
+    REAL_CONST(107503.53169936626/8.0),
+    REAL_CONST(107527.67555417139/8.0),
+    REAL_CONST(107551.82076434491/8.0),
+    REAL_CONST(107575.96732973469/8.0),
+    REAL_CONST(107600.11525018861/8.0),
+    REAL_CONST(107624.26452555459/8.0),
+    REAL_CONST(107648.41515568066/8.0),
+    REAL_CONST(107672.56714041479/8.0),
+    REAL_CONST(107696.72047960508/8.0),
+    REAL_CONST(107720.87517309963/8.0),
+    REAL_CONST(107745.03122074658/8.0),
+    REAL_CONST(107769.18862239413/8.0),
+    REAL_CONST(107793.34737789053/8.0),
+    REAL_CONST(107817.50748708403/8.0),
+    REAL_CONST(107841.66894982298/8.0),
+    REAL_CONST(107865.83176595572/8.0),
+    REAL_CONST(107889.99593533068/8.0),
+    REAL_CONST(107914.16145779629/8.0),
+    REAL_CONST(107938.32833320105/8.0),
+    REAL_CONST(107962.49656139348/8.0),
+    REAL_CONST(107986.66614222217/8.0),
+    REAL_CONST(108010.83707553572/8.0),
+    REAL_CONST(108035.00936118282/8.0),
+    REAL_CONST(108059.18299901215/8.0),
+    REAL_CONST(108083.35798887245/8.0),
+    REAL_CONST(108107.53433061253/8.0),
+    REAL_CONST(108131.71202408121/8.0),
+    REAL_CONST(108155.89106912735/8.0),
+    REAL_CONST(108180.07146559987/8.0),
+    REAL_CONST(108204.25321334775/8.0),
+    REAL_CONST(108228.43631221994/8.0),
+    REAL_CONST(108252.62076206553/8.0),
+    REAL_CONST(108276.80656273357/8.0),
+    REAL_CONST(108300.99371407321/8.0),
+    REAL_CONST(108325.18221593359/8.0),
+    REAL_CONST(108349.37206816394/8.0),
+    REAL_CONST(108373.56327061349/8.0),
+    REAL_CONST(108397.75582313156/8.0),
+    REAL_CONST(108421.94972556747/8.0),
+    REAL_CONST(108446.1449777706/8.0),
+    REAL_CONST(108470.34157959036/8.0),
+    REAL_CONST(108494.53953087622/8.0),
+    REAL_CONST(108518.73883147769/8.0),
+    REAL_CONST(108542.93948124432/8.0),
+    REAL_CONST(108567.14148002568/8.0),
+    REAL_CONST(108591.34482767139/8.0),
+    REAL_CONST(108615.54952403114/8.0),
+    REAL_CONST(108639.75556895464/8.0),
+    REAL_CONST(108663.96296229165/8.0),
+    REAL_CONST(108688.17170389196/8.0),
+    REAL_CONST(108712.38179360541/8.0),
+    REAL_CONST(108736.59323128188/8.0),
+    REAL_CONST(108760.80601677128/8.0),
+    REAL_CONST(108785.02014992358/8.0),
+    REAL_CONST(108809.23563058881/8.0),
+    REAL_CONST(108833.45245861699/8.0),
+    REAL_CONST(108857.67063385822/8.0),
+    REAL_CONST(108881.89015616261/8.0),
+    REAL_CONST(108906.11102538036/8.0),
+    REAL_CONST(108930.33324136167/8.0),
+    REAL_CONST(108954.55680395682/8.0),
+    REAL_CONST(108978.78171301607/8.0),
+    REAL_CONST(109003.00796838976/8.0),
+    REAL_CONST(109027.23556992831/8.0),
+    REAL_CONST(109051.46451748211/8.0),
+    REAL_CONST(109075.69481090162/8.0),
+    REAL_CONST(109099.92645003737/8.0),
+    REAL_CONST(109124.15943473989/8.0),
+    REAL_CONST(109148.39376485976/8.0),
+    REAL_CONST(109172.62944024763/8.0),
+    REAL_CONST(109196.86646075416/8.0),
+    REAL_CONST(109221.10482623006/8.0),
+    REAL_CONST(109245.34453652608/8.0),
+    REAL_CONST(109269.58559149304/8.0),
+    REAL_CONST(109293.82799098175/8.0),
+    REAL_CONST(109318.07173484311/8.0),
+    REAL_CONST(109342.31682292801/8.0),
+    REAL_CONST(109366.56325508743/8.0),
+    REAL_CONST(109390.81103117237/8.0),
+    REAL_CONST(109415.06015103387/8.0),
+    REAL_CONST(109439.31061452301/8.0),
+    REAL_CONST(109463.56242149093/8.0),
+    REAL_CONST(109487.8155717888/8.0),
+    REAL_CONST(109512.07006526781/8.0),
+    REAL_CONST(109536.3259017792/8.0),
+    REAL_CONST(109560.58308117429/8.0),
+    REAL_CONST(109584.8416033044/8.0),
+    REAL_CONST(109609.1014680209/8.0),
+    REAL_CONST(109633.36267517522/8.0),
+    REAL_CONST(109657.62522461878/8.0),
+    REAL_CONST(109681.88911620311/8.0),
+    REAL_CONST(109706.15434977971/8.0),
+    REAL_CONST(109730.4209252002/8.0),
+    REAL_CONST(109754.68884231619/8.0),
+    REAL_CONST(109778.95810097932/8.0),
+    REAL_CONST(109803.22870104131/8.0),
+    REAL_CONST(109827.50064235389/8.0),
+    REAL_CONST(109851.77392476884/8.0),
+    REAL_CONST(109876.04854813802/8.0),
+    REAL_CONST(109900.32451231324/8.0),
+    REAL_CONST(109924.60181714644/8.0),
+    REAL_CONST(109948.88046248957/8.0),
+    REAL_CONST(109973.1604481946/8.0),
+    REAL_CONST(109997.44177411357/8.0),
+    REAL_CONST(110021.72444009855/8.0),
+    REAL_CONST(110046.00844600165/8.0),
+    REAL_CONST(110070.29379167501/8.0),
+    REAL_CONST(110094.58047697082/8.0),
+    REAL_CONST(110118.86850174134/8.0),
+    REAL_CONST(110143.15786583882/8.0),
+    REAL_CONST(110167.44856911557/8.0),
+    REAL_CONST(110191.74061142397/8.0),
+    REAL_CONST(110216.03399261639/8.0),
+    REAL_CONST(110240.32871254528/8.0),
+    REAL_CONST(110264.62477106311/8.0),
+    REAL_CONST(110288.9221680224/8.0),
+    REAL_CONST(110313.22090327571/8.0),
+    REAL_CONST(110337.52097667565/8.0),
+    REAL_CONST(110361.82238807483/8.0),
+    REAL_CONST(110386.12513732594/8.0),
+    REAL_CONST(110410.42922428172/8.0),
+    REAL_CONST(110434.73464879491/8.0),
+    REAL_CONST(110459.04141071832/8.0),
+    REAL_CONST(110483.34950990479/8.0),
+    REAL_CONST(110507.6589462072/8.0),
+    REAL_CONST(110531.96971947847/8.0),
+    REAL_CONST(110556.28182957157/8.0),
+    REAL_CONST(110580.5952763395/8.0),
+    REAL_CONST(110604.91005963532/8.0),
+    REAL_CONST(110629.22617931209/8.0),
+    REAL_CONST(110653.54363522294/8.0),
+    REAL_CONST(110677.86242722106/8.0),
+    REAL_CONST(110702.18255515963/8.0),
+    REAL_CONST(110726.50401889188/8.0),
+    REAL_CONST(110750.82681827113/8.0),
+    REAL_CONST(110775.1509531507/8.0),
+    REAL_CONST(110799.47642338395/8.0),
+    REAL_CONST(110823.80322882428/8.0),
+    REAL_CONST(110848.13136932514/8.0),
+    REAL_CONST(110872.46084474004/8.0),
+    REAL_CONST(110896.79165492248/8.0),
+    REAL_CONST(110921.12379972603/8.0),
+    REAL_CONST(110945.4572790043/8.0),
+    REAL_CONST(110969.79209261097/8.0),
+    REAL_CONST(110994.12824039967/8.0),
+    REAL_CONST(111018.46572222417/8.0),
+    REAL_CONST(111042.80453793822/8.0),
+    REAL_CONST(111067.14468739564/8.0),
+    REAL_CONST(111091.48617045028/8.0),
+    REAL_CONST(111115.82898695602/8.0),
+    REAL_CONST(111140.1731367668/8.0),
+    REAL_CONST(111164.51861973655/8.0),
+    REAL_CONST(111188.86543571933/8.0),
+    REAL_CONST(111213.21358456917/8.0),
+    REAL_CONST(111237.56306614014/8.0),
+    REAL_CONST(111261.91388028639/8.0),
+    REAL_CONST(111286.26602686207/8.0),
+    REAL_CONST(111310.61950572141/8.0),
+    REAL_CONST(111334.97431671864/8.0),
+    REAL_CONST(111359.33045970804/8.0),
+    REAL_CONST(111383.68793454397/8.0),
+    REAL_CONST(111408.04674108078/8.0),
+    REAL_CONST(111432.40687917286/8.0),
+    REAL_CONST(111456.76834867468/8.0),
+    REAL_CONST(111481.13114944073/8.0),
+    REAL_CONST(111505.49528132551/8.0),
+    REAL_CONST(111529.86074418361/8.0),
+    REAL_CONST(111554.22753786964/8.0),
+    REAL_CONST(111578.59566223821/8.0),
+    REAL_CONST(111602.96511714405/8.0),
+    REAL_CONST(111627.33590244185/8.0),
+    REAL_CONST(111651.7080179864/8.0),
+    REAL_CONST(111676.08146363248/8.0),
+    REAL_CONST(111700.45623923496/8.0),
+    REAL_CONST(111724.8323446487/8.0),
+    REAL_CONST(111749.20977972864/8.0),
+    REAL_CONST(111773.58854432974/8.0),
+    REAL_CONST(111797.96863830699/8.0),
+    REAL_CONST(111822.35006151545/8.0),
+    REAL_CONST(111846.73281381019/8.0),
+    REAL_CONST(111871.11689504632/8.0),
+    REAL_CONST(111895.50230507903/8.0),
+    REAL_CONST(111919.8890437635/8.0),
+    REAL_CONST(111944.27711095495/8.0),
+    REAL_CONST(111968.6665065087/8.0),
+    REAL_CONST(111993.05723028004/8.0),
+    REAL_CONST(112017.44928212435/8.0),
+    REAL_CONST(112041.842661897/8.0),
+    REAL_CONST(112066.23736945343/8.0),
+    REAL_CONST(112090.63340464912/8.0),
+    REAL_CONST(112115.03076733962/8.0),
+    REAL_CONST(112139.42945738042/8.0),
+    REAL_CONST(112163.82947462716/8.0),
+    REAL_CONST(112188.23081893545/8.0),
+    REAL_CONST(112212.63349016097/8.0),
+    REAL_CONST(112237.03748815943/8.0),
+    REAL_CONST(112261.44281278658/8.0),
+    REAL_CONST(112285.84946389822/8.0),
+    REAL_CONST(112310.25744135017/8.0),
+    REAL_CONST(112334.66674499828/8.0),
+    REAL_CONST(112359.07737469849/8.0),
+    REAL_CONST(112383.48933030672/8.0),
+    REAL_CONST(112407.90261167898/8.0),
+    REAL_CONST(112432.31721867126/8.0),
+    REAL_CONST(112456.73315113965/8.0),
+    REAL_CONST(112481.15040894024/8.0),
+    REAL_CONST(112505.56899192919/8.0),
+    REAL_CONST(112529.98889996267/8.0),
+    REAL_CONST(112554.41013289688/8.0),
+    REAL_CONST(112578.8326905881/8.0),
+    REAL_CONST(112603.25657289263/8.0),
+    REAL_CONST(112627.68177966679/8.0),
+    REAL_CONST(112652.10831076698/8.0),
+    REAL_CONST(112676.53616604958/8.0),
+    REAL_CONST(112700.96534537108/8.0),
+    REAL_CONST(112725.39584858794/8.0),
+    REAL_CONST(112749.82767555672/8.0),
+    REAL_CONST(112774.26082613398/8.0),
+    REAL_CONST(112798.6953001763/8.0),
+    REAL_CONST(112823.13109754038/8.0),
+    REAL_CONST(112847.56821808286/8.0),
+    REAL_CONST(112872.00666166049/8.0),
+    REAL_CONST(112896.44642813003/8.0),
+    REAL_CONST(112920.88751734827/8.0),
+    REAL_CONST(112945.32992917208/8.0),
+    REAL_CONST(112969.77366345831/8.0),
+    REAL_CONST(112994.21872006389/8.0),
+    REAL_CONST(113018.66509884578/8.0),
+    REAL_CONST(113043.11279966099/8.0),
+    REAL_CONST(113067.56182236652/8.0),
+    REAL_CONST(113092.01216681948/8.0),
+    REAL_CONST(113116.46383287695/8.0),
+    REAL_CONST(113140.9168203961/8.0),
+    REAL_CONST(113165.37112923413/8.0),
+    REAL_CONST(113189.82675924824/8.0),
+    REAL_CONST(113214.28371029573/8.0),
+    REAL_CONST(113238.74198223387/8.0),
+    REAL_CONST(113263.20157492002/8.0),
+    REAL_CONST(113287.66248821157/8.0),
+    REAL_CONST(113312.12472196593/8.0),
+    REAL_CONST(113336.58827604055/8.0),
+    REAL_CONST(113361.05315029295/8.0),
+    REAL_CONST(113385.51934458067/8.0),
+    REAL_CONST(113409.98685876124/8.0),
+    REAL_CONST(113434.45569269233/8.0),
+    REAL_CONST(113458.92584623155/8.0),
+    REAL_CONST(113483.39731923661/8.0),
+    REAL_CONST(113507.87011156522/8.0),
+    REAL_CONST(113532.34422307517/8.0),
+    REAL_CONST(113556.81965362425/8.0),
+    REAL_CONST(113581.2964030703/8.0),
+    REAL_CONST(113605.77447127122/8.0),
+    REAL_CONST(113630.25385808491/8.0),
+    REAL_CONST(113654.73456336933/8.0),
+    REAL_CONST(113679.2165869825/8.0),
+    REAL_CONST(113703.69992878241/8.0),
+    REAL_CONST(113728.18458862718/8.0),
+    REAL_CONST(113752.67056637487/8.0),
+    REAL_CONST(113777.15786188368/8.0),
+    REAL_CONST(113801.64647501177/8.0),
+    REAL_CONST(113826.13640561736/8.0),
+    REAL_CONST(113850.62765355874/8.0),
+    REAL_CONST(113875.12021869418/8.0),
+    REAL_CONST(113899.61410088204/8.0),
+    REAL_CONST(113924.1092999807/8.0),
+    REAL_CONST(113948.60581584855/8.0),
+    REAL_CONST(113973.10364834407/8.0),
+    REAL_CONST(113997.60279732574/8.0),
+    REAL_CONST(114022.1032626521/8.0),
+    REAL_CONST(114046.60504418171/8.0),
+    REAL_CONST(114071.10814177318/8.0),
+    REAL_CONST(114095.61255528514/8.0),
+    REAL_CONST(114120.11828457628/8.0),
+    REAL_CONST(114144.62532950533/8.0),
+    REAL_CONST(114169.13368993104/8.0),
+    REAL_CONST(114193.6433657122/8.0),
+    REAL_CONST(114218.15435670764/8.0),
+    REAL_CONST(114242.66666277625/8.0),
+    REAL_CONST(114267.18028377694/8.0),
+    REAL_CONST(114291.69521956862/8.0),
+    REAL_CONST(114316.21147001031/8.0),
+    REAL_CONST(114340.72903496103/8.0),
+    REAL_CONST(114365.24791427983/8.0),
+    REAL_CONST(114389.7681078258/8.0),
+    REAL_CONST(114414.2896154581/8.0),
+    REAL_CONST(114438.81243703589/8.0),
+    REAL_CONST(114463.33657241837/8.0),
+    REAL_CONST(114487.8620214648/8.0),
+    REAL_CONST(114512.38878403447/8.0),
+    REAL_CONST(114536.91685998671/8.0),
+    REAL_CONST(114561.44624918087/8.0),
+    REAL_CONST(114585.97695147636/8.0),
+    REAL_CONST(114610.5089667326/8.0),
+    REAL_CONST(114635.04229480909/8.0),
+    REAL_CONST(114659.57693556532/8.0),
+    REAL_CONST(114684.11288886084/8.0),
+    REAL_CONST(114708.65015455526/8.0),
+    REAL_CONST(114733.18873250818/8.0),
+    REAL_CONST(114757.72862257928/8.0),
+    REAL_CONST(114782.26982462825/8.0),
+    REAL_CONST(114806.81233851484/8.0),
+    REAL_CONST(114831.35616409882/8.0),
+    REAL_CONST(114855.90130123998/8.0),
+    REAL_CONST(114880.44774979822/8.0),
+    REAL_CONST(114904.99550963337/8.0),
+    REAL_CONST(114929.5445806054/8.0),
+    REAL_CONST(114954.09496257425/8.0),
+    REAL_CONST(114978.64665539992/8.0),
+    REAL_CONST(115003.19965894247/8.0),
+    REAL_CONST(115027.75397306195/8.0),
+    REAL_CONST(115052.30959761847/8.0),
+    REAL_CONST(115076.86653247218/8.0),
+    REAL_CONST(115101.42477748329/8.0),
+    REAL_CONST(115125.984332512/8.0),
+    REAL_CONST(115150.54519741859/8.0),
+    REAL_CONST(115175.10737206334/8.0),
+    REAL_CONST(115199.67085630659/8.0),
+    REAL_CONST(115224.23565000873/8.0),
+    REAL_CONST(115248.80175303014/8.0),
+    REAL_CONST(115273.3691652313/8.0),
+    REAL_CONST(115297.93788647266/8.0),
+    REAL_CONST(115322.50791661476/8.0),
+    REAL_CONST(115347.07925551817/8.0),
+    REAL_CONST(115371.65190304347/8.0),
+    REAL_CONST(115396.22585905129/8.0),
+    REAL_CONST(115420.80112340231/8.0),
+    REAL_CONST(115445.37769595724/8.0),
+    REAL_CONST(115469.95557657682/8.0),
+    REAL_CONST(115494.53476512182/8.0),
+    REAL_CONST(115519.11526145306/8.0),
+    REAL_CONST(115543.69706543141/8.0),
+    REAL_CONST(115568.28017691776/8.0),
+    REAL_CONST(115592.86459577303/8.0),
+    REAL_CONST(115617.4503218582/8.0),
+    REAL_CONST(115642.03735503425/8.0),
+    REAL_CONST(115666.62569516223/8.0),
+    REAL_CONST(115691.21534210323/8.0),
+    REAL_CONST(115715.80629571836/8.0),
+    REAL_CONST(115740.39855586876/8.0),
+    REAL_CONST(115764.99212241563/8.0),
+    REAL_CONST(115789.58699522018/8.0),
+    REAL_CONST(115814.18317414368/8.0),
+    REAL_CONST(115838.78065904744/8.0),
+    REAL_CONST(115863.37944979276/8.0),
+    REAL_CONST(115887.97954624105/8.0),
+    REAL_CONST(115912.5809482537/8.0),
+    REAL_CONST(115937.18365569216/8.0),
+    REAL_CONST(115961.78766841792/8.0),
+    REAL_CONST(115986.39298629249/8.0),
+    REAL_CONST(116010.99960917742/8.0),
+    REAL_CONST(116035.60753693432/8.0),
+    REAL_CONST(116060.21676942479/8.0),
+    REAL_CONST(116084.82730651053/8.0),
+    REAL_CONST(116109.43914805322/8.0),
+    REAL_CONST(116134.0522939146/8.0),
+    REAL_CONST(116158.66674395646/8.0),
+    REAL_CONST(116183.2824980406/8.0),
+    REAL_CONST(116207.89955602887/8.0),
+    REAL_CONST(116232.51791778316/8.0),
+    REAL_CONST(116257.13758316539/8.0),
+    REAL_CONST(116281.75855203751/8.0),
+    REAL_CONST(116306.38082426153/8.0),
+    REAL_CONST(116331.00439969949/8.0),
+    REAL_CONST(116355.62927821343/8.0),
+    REAL_CONST(116380.25545966547/8.0),
+    REAL_CONST(116404.88294391775/8.0),
+    REAL_CONST(116429.51173083246/8.0),
+    REAL_CONST(116454.14182027178/8.0),
+    REAL_CONST(116478.77321209799/8.0),
+    REAL_CONST(116503.40590617337/8.0),
+    REAL_CONST(116528.03990236025/8.0),
+    REAL_CONST(116552.67520052097/8.0),
+    REAL_CONST(116577.31180051794/8.0),
+    REAL_CONST(116601.94970221359/8.0),
+    REAL_CONST(116626.5889054704/8.0),
+    REAL_CONST(116651.22941015086/8.0),
+    REAL_CONST(116675.87121611751/8.0),
+    REAL_CONST(116700.51432323294/8.0),
+    REAL_CONST(116725.15873135976/8.0),
+    REAL_CONST(116749.8044403606/8.0),
+    REAL_CONST(116774.45145009817/8.0),
+    REAL_CONST(116799.0997604352/8.0),
+    REAL_CONST(116823.74937123443/8.0),
+    REAL_CONST(116848.40028235866/8.0),
+    REAL_CONST(116873.05249367072/8.0),
+    REAL_CONST(116897.70600503348/8.0),
+    REAL_CONST(116922.36081630984/8.0),
+    REAL_CONST(116947.01692736275/8.0),
+    REAL_CONST(116971.67433805518/8.0),
+    REAL_CONST(116996.33304825013/8.0),
+    REAL_CONST(117020.99305781067/8.0),
+    REAL_CONST(117045.65436659988/8.0),
+    REAL_CONST(117070.31697448085/8.0),
+    REAL_CONST(117094.98088131678/8.0),
+    REAL_CONST(117119.64608697082/8.0),
+    REAL_CONST(117144.31259130624/8.0),
+    REAL_CONST(117168.98039418629/8.0),
+    REAL_CONST(117193.64949547425/8.0),
+    REAL_CONST(117218.31989503348/8.0),
+    REAL_CONST(117242.99159272734/8.0),
+    REAL_CONST(117267.66458841923/8.0),
+    REAL_CONST(117292.33888197262/8.0),
+    REAL_CONST(117317.01447325097/8.0),
+    REAL_CONST(117341.6913621178/8.0),
+    REAL_CONST(117366.36954843666/8.0),
+    REAL_CONST(117391.04903207115/8.0),
+    REAL_CONST(117415.72981288488/8.0),
+    REAL_CONST(117440.41189074152/8.0),
+    REAL_CONST(117465.09526550474/8.0),
+    REAL_CONST(117489.77993703831/8.0),
+    REAL_CONST(117514.46590520597/8.0),
+    REAL_CONST(117539.15316987153/8.0),
+    REAL_CONST(117563.84173089883/8.0),
+    REAL_CONST(117588.53158815173/8.0),
+    REAL_CONST(117613.22274149416/8.0),
+    REAL_CONST(117637.91519079007/8.0),
+    REAL_CONST(117662.60893590341/8.0),
+    REAL_CONST(117687.30397669821/8.0),
+    REAL_CONST(117712.00031303853/8.0),
+    REAL_CONST(117736.69794478847/8.0),
+    REAL_CONST(117761.39687181212/8.0),
+    REAL_CONST(117786.09709397367/8.0),
+    REAL_CONST(117810.7986111373/8.0),
+    REAL_CONST(117835.50142316725/8.0),
+    REAL_CONST(117860.20552992777/8.0),
+    REAL_CONST(117884.91093128319/8.0),
+    REAL_CONST(117909.6176270978/8.0),
+    REAL_CONST(117934.32561723603/8.0),
+    REAL_CONST(117959.03490156225/8.0),
+    REAL_CONST(117983.74547994092/8.0),
+    REAL_CONST(118008.45735223651/8.0),
+    REAL_CONST(118033.17051831353/8.0),
+    REAL_CONST(118057.88497803656/8.0),
+    REAL_CONST(118082.60073127014/8.0),
+    REAL_CONST(118107.31777787894/8.0),
+    REAL_CONST(118132.03611772758/8.0),
+    REAL_CONST(118156.75575068076/8.0),
+    REAL_CONST(118181.47667660323/8.0),
+    REAL_CONST(118206.19889535972/8.0),
+    REAL_CONST(118230.92240681504/8.0),
+    REAL_CONST(118255.64721083404/8.0),
+    REAL_CONST(118280.37330728157/8.0),
+    REAL_CONST(118305.10069602253/8.0),
+    REAL_CONST(118329.82937692189/8.0),
+    REAL_CONST(118354.55934984458/8.0),
+    REAL_CONST(118379.29061465565/8.0),
+    REAL_CONST(118404.02317122012/8.0),
+    REAL_CONST(118428.75701940308/8.0),
+    REAL_CONST(118453.49215906965/8.0),
+    REAL_CONST(118478.22859008498/8.0),
+    REAL_CONST(118502.96631231424/8.0),
+    REAL_CONST(118527.70532562268/8.0),
+    REAL_CONST(118552.44562987552/8.0),
+    REAL_CONST(118577.18722493808/8.0),
+    REAL_CONST(118601.93011067568/8.0),
+    REAL_CONST(118626.67428695368/8.0),
+    REAL_CONST(118651.41975363747/8.0),
+    REAL_CONST(118676.16651059251/8.0),
+    REAL_CONST(118700.91455768423/8.0),
+    REAL_CONST(118725.66389477813/8.0),
+    REAL_CONST(118750.41452173979/8.0),
+    REAL_CONST(118775.16643843475/8.0),
+    REAL_CONST(118799.91964472862/8.0),
+    REAL_CONST(118824.67414048707/8.0),
+    REAL_CONST(118849.42992557574/8.0),
+    REAL_CONST(118874.18699986035/8.0),
+    REAL_CONST(118898.94536320666/8.0),
+    REAL_CONST(118923.70501548045/8.0),
+    REAL_CONST(118948.46595654752/8.0),
+    REAL_CONST(118973.22818627374/8.0),
+    REAL_CONST(118997.99170452499/8.0),
+    REAL_CONST(119022.7565111672/8.0),
+    REAL_CONST(119047.52260606633/8.0),
+    REAL_CONST(119072.28998908834/8.0),
+    REAL_CONST(119097.0586600993/8.0),
+    REAL_CONST(119121.82861896523/8.0),
+    REAL_CONST(119146.59986555226/8.0),
+    REAL_CONST(119171.3723997265/8.0),
+    REAL_CONST(119196.14622135412/8.0),
+    REAL_CONST(119220.92133030134/8.0),
+    REAL_CONST(119245.69772643436/8.0),
+    REAL_CONST(119270.47540961947/8.0),
+    REAL_CONST(119295.25437972297/8.0),
+    REAL_CONST(119320.03463661121/8.0),
+    REAL_CONST(119344.81618015055/8.0),
+    REAL_CONST(119369.5990102074/8.0),
+    REAL_CONST(119394.38312664822/8.0),
+    REAL_CONST(119419.16852933947/8.0),
+    REAL_CONST(119443.95521814766/8.0),
+    REAL_CONST(119468.74319293935/8.0),
+    REAL_CONST(119493.53245358112/8.0),
+    REAL_CONST(119518.32299993958/8.0),
+    REAL_CONST(119543.11483188139/8.0),
+    REAL_CONST(119567.90794927324/8.0),
+    REAL_CONST(119592.70235198183/8.0),
+    REAL_CONST(119617.49803987393/8.0),
+    REAL_CONST(119642.29501281632/8.0),
+    REAL_CONST(119667.09327067583/8.0),
+    REAL_CONST(119691.89281331931/8.0),
+    REAL_CONST(119716.69364061367/8.0),
+    REAL_CONST(119741.49575242582/8.0),
+    REAL_CONST(119766.29914862274/8.0),
+    REAL_CONST(119791.10382907141/8.0),
+    REAL_CONST(119815.90979363887/8.0),
+    REAL_CONST(119840.71704219218/8.0),
+    REAL_CONST(119865.52557459843/8.0),
+    REAL_CONST(119890.33539072477/8.0),
+    REAL_CONST(119915.14649043836/8.0),
+    REAL_CONST(119939.95887360642/8.0),
+    REAL_CONST(119964.77254009615/8.0),
+    REAL_CONST(119989.58748977486/8.0),
+    REAL_CONST(120014.40372250983/8.0),
+    REAL_CONST(120039.22123816841/8.0),
+    REAL_CONST(120064.04003661797/8.0),
+    REAL_CONST(120088.86011772591/8.0),
+    REAL_CONST(120113.6814813597/8.0),
+    REAL_CONST(120138.5041273868/8.0),
+    REAL_CONST(120163.3280556747/8.0),
+    REAL_CONST(120188.15326609099/8.0),
+    REAL_CONST(120212.97975850321/8.0),
+    REAL_CONST(120237.807532779/8.0),
+    REAL_CONST(120262.63658878599/8.0),
+    REAL_CONST(120287.46692639188/8.0),
+    REAL_CONST(120312.29854546436/8.0),
+    REAL_CONST(120337.13144587121/8.0),
+    REAL_CONST(120361.9656274802/8.0),
+    REAL_CONST(120386.80109015915/8.0),
+    REAL_CONST(120411.63783377589/8.0),
+    REAL_CONST(120436.47585819835/8.0),
+    REAL_CONST(120461.31516329442/8.0),
+    REAL_CONST(120486.15574893207/8.0),
+    REAL_CONST(120510.99761497928/8.0),
+    REAL_CONST(120535.84076130406/8.0),
+    REAL_CONST(120560.68518777451/8.0),
+    REAL_CONST(120585.53089425867/8.0),
+    REAL_CONST(120610.3778806247/8.0),
+    REAL_CONST(120635.22614674074/8.0),
+    REAL_CONST(120660.07569247499/8.0),
+    REAL_CONST(120684.92651769568/8.0),
+    REAL_CONST(120709.77862227106/8.0),
+    REAL_CONST(120734.63200606944/8.0),
+    REAL_CONST(120759.48666895913/8.0),
+    REAL_CONST(120784.3426108085/8.0),
+    REAL_CONST(120809.19983148595/8.0),
+    REAL_CONST(120834.05833085992/8.0),
+    REAL_CONST(120858.91810879884/8.0),
+    REAL_CONST(120883.77916517125/8.0),
+    REAL_CONST(120908.64149984565/8.0),
+    REAL_CONST(120933.5051126906/8.0),
+    REAL_CONST(120958.37000357473/8.0),
+    REAL_CONST(120983.23617236665/8.0),
+    REAL_CONST(121008.10361893504/8.0),
+    REAL_CONST(121032.97234314861/8.0),
+    REAL_CONST(121057.84234487606/8.0),
+    REAL_CONST(121082.71362398617/8.0),
+    REAL_CONST(121107.58618034775/8.0),
+    REAL_CONST(121132.46001382964/8.0),
+    REAL_CONST(121157.33512430069/8.0),
+    REAL_CONST(121182.21151162982/8.0),
+    REAL_CONST(121207.08917568595/8.0),
+    REAL_CONST(121231.96811633807/8.0),
+    REAL_CONST(121256.84833345517/8.0),
+    REAL_CONST(121281.72982690629/8.0),
+    REAL_CONST(121306.61259656049/8.0),
+    REAL_CONST(121331.49664228689/8.0),
+    REAL_CONST(121356.38196395461/8.0),
+    REAL_CONST(121381.26856143285/8.0),
+    REAL_CONST(121406.15643459078/8.0),
+    REAL_CONST(121431.04558329767/8.0),
+    REAL_CONST(121455.93600742276/8.0),
+    REAL_CONST(121480.82770683538/8.0),
+    REAL_CONST(121505.72068140487/8.0),
+    REAL_CONST(121530.61493100057/8.0),
+    REAL_CONST(121555.51045549192/8.0),
+    REAL_CONST(121580.40725474835/8.0),
+    REAL_CONST(121605.30532863933/8.0),
+    REAL_CONST(121630.20467703436/8.0),
+    REAL_CONST(121655.10529980299/8.0),
+    REAL_CONST(121680.00719681478/8.0),
+    REAL_CONST(121704.91036793934/8.0),
+    REAL_CONST(121729.81481304632/8.0),
+    REAL_CONST(121754.72053200539/8.0),
+    REAL_CONST(121779.62752468624/8.0),
+    REAL_CONST(121804.53579095862/8.0),
+    REAL_CONST(121829.44533069231/8.0),
+    REAL_CONST(121854.3561437571/8.0),
+    REAL_CONST(121879.26823002285/8.0),
+    REAL_CONST(121904.1815893594/8.0),
+    REAL_CONST(121929.09622163669/8.0),
+    REAL_CONST(121954.01212672464/8.0),
+    REAL_CONST(121978.92930449323/8.0),
+    REAL_CONST(122003.84775481246/8.0),
+    REAL_CONST(122028.76747755238/8.0),
+    REAL_CONST(122053.68847258303/8.0),
+    REAL_CONST(122078.61073977455/8.0),
+    REAL_CONST(122103.53427899707/8.0),
+    REAL_CONST(122128.45909012076/8.0),
+    REAL_CONST(122153.38517301581/8.0),
+    REAL_CONST(122178.31252755247/8.0),
+    REAL_CONST(122203.24115360099/8.0),
+    REAL_CONST(122228.17105103172/8.0),
+    REAL_CONST(122253.10221971494/8.0),
+    REAL_CONST(122278.03465952107/8.0),
+    REAL_CONST(122302.96837032049/8.0),
+    REAL_CONST(122327.90335198362/8.0),
+    REAL_CONST(122352.83960438096/8.0),
+    REAL_CONST(122377.777127383/8.0),
+    REAL_CONST(122402.71592086025/8.0),
+    REAL_CONST(122427.65598468333/8.0),
+    REAL_CONST(122452.59731872278/8.0),
+    REAL_CONST(122477.53992284928/8.0),
+    REAL_CONST(122502.48379693348/8.0),
+    REAL_CONST(122527.42894084606/8.0),
+    REAL_CONST(122552.37535445779/8.0),
+    REAL_CONST(122577.32303763942/8.0),
+    REAL_CONST(122602.27199026172/8.0),
+    REAL_CONST(122627.22221219557/8.0),
+    REAL_CONST(122652.17370331181/8.0),
+    REAL_CONST(122677.12646348133/8.0),
+    REAL_CONST(122702.08049257506/8.0),
+    REAL_CONST(122727.03579046397/8.0),
+    REAL_CONST(122751.99235701906/8.0),
+    REAL_CONST(122776.95019211136/8.0),
+    REAL_CONST(122801.9092956119/8.0),
+    REAL_CONST(122826.8696673918/8.0),
+    REAL_CONST(122851.83130732219/8.0),
+    REAL_CONST(122876.79421527422/8.0),
+    REAL_CONST(122901.75839111909/8.0),
+    REAL_CONST(122926.72383472799/8.0),
+    REAL_CONST(122951.69054597223/8.0),
+    REAL_CONST(122976.65852472307/8.0),
+    REAL_CONST(123001.62777085182/8.0),
+    REAL_CONST(123026.59828422987/8.0),
+    REAL_CONST(123051.57006472857/8.0),
+    REAL_CONST(123076.54311221937/8.0),
+    REAL_CONST(123101.5174265737/8.0),
+    REAL_CONST(123126.49300766307/8.0),
+    REAL_CONST(123151.46985535898/8.0),
+    REAL_CONST(123176.44796953299/8.0),
+    REAL_CONST(123201.42735005668/8.0),
+    REAL_CONST(123226.40799680166/8.0),
+    REAL_CONST(123251.38990963959/8.0),
+    REAL_CONST(123276.37308844214/8.0),
+    REAL_CONST(123301.35753308103/8.0),
+    REAL_CONST(123326.343243428/8.0),
+    REAL_CONST(123351.33021935483/8.0),
+    REAL_CONST(123376.31846073334/8.0),
+    REAL_CONST(123401.30796743535/8.0),
+    REAL_CONST(123426.29873933276/8.0),
+    REAL_CONST(123451.29077629748/8.0),
+    REAL_CONST(123476.28407820144/8.0),
+    REAL_CONST(123501.2786449166/8.0),
+    REAL_CONST(123526.27447631498/8.0),
+    REAL_CONST(123551.27157226863/8.0),
+    REAL_CONST(123576.26993264959/8.0),
+    REAL_CONST(123601.26955732999/8.0),
+    REAL_CONST(123626.27044618195/8.0),
+    REAL_CONST(123651.27259907764/8.0),
+    REAL_CONST(123676.27601588926/8.0),
+    REAL_CONST(123701.28069648903/8.0),
+    REAL_CONST(123726.28664074924/8.0),
+    REAL_CONST(123751.29384854218/8.0),
+    REAL_CONST(123776.30231974016/8.0),
+    REAL_CONST(123801.31205421555/8.0),
+    REAL_CONST(123826.32305184075/8.0),
+    REAL_CONST(123851.33531248817/8.0),
+    REAL_CONST(123876.34883603029/8.0),
+    REAL_CONST(123901.36362233957/8.0),
+    REAL_CONST(123926.37967128855/8.0),
+    REAL_CONST(123951.39698274979/8.0),
+    REAL_CONST(123976.41555659588/8.0),
+    REAL_CONST(124001.43539269941/8.0),
+    REAL_CONST(124026.45649093305/8.0),
+    REAL_CONST(124051.47885116948/8.0),
+    REAL_CONST(124076.50247328142/8.0),
+    REAL_CONST(124101.5273571416/8.0),
+    REAL_CONST(124126.55350262282/8.0),
+    REAL_CONST(124151.58090959788/8.0),
+    REAL_CONST(124176.60957793961/8.0),
+    REAL_CONST(124201.63950752091/8.0),
+    REAL_CONST(124226.67069821467/8.0),
+    REAL_CONST(124251.70314989384/8.0),
+    REAL_CONST(124276.73686243138/8.0),
+    REAL_CONST(124301.7718357003/8.0),
+    REAL_CONST(124326.80806957364/8.0),
+    REAL_CONST(124351.84556392446/8.0),
+    REAL_CONST(124376.88431862585/8.0),
+    REAL_CONST(124401.92433355095/8.0),
+    REAL_CONST(124426.96560857294/8.0),
+    REAL_CONST(124452.00814356498/8.0),
+    REAL_CONST(124477.05193840031/8.0),
+    REAL_CONST(124502.0969929522/8.0),
+    REAL_CONST(124527.14330709392/8.0),
+    REAL_CONST(124552.19088069882/8.0),
+    REAL_CONST(124577.23971364023/8.0),
+    REAL_CONST(124602.28980579154/8.0),
+    REAL_CONST(124627.34115702618/8.0),
+    REAL_CONST(124652.3937672176/8.0),
+    REAL_CONST(124677.44763623926/8.0),
+    REAL_CONST(124702.50276396469/8.0),
+    REAL_CONST(124727.55915026742/8.0),
+    REAL_CONST(124752.61679502104/8.0),
+    REAL_CONST(124777.67569809916/8.0),
+    REAL_CONST(124802.73585937542/8.0),
+    REAL_CONST(124827.79727872348/8.0),
+    REAL_CONST(124852.85995601704/8.0),
+    REAL_CONST(124877.92389112986/8.0),
+    REAL_CONST(124902.98908393568/8.0),
+    REAL_CONST(124928.05553430831/8.0),
+    REAL_CONST(124953.1232421216/8.0),
+    REAL_CONST(124978.19220724938/8.0),
+    REAL_CONST(125003.26242956554/8.0),
+    REAL_CONST(125028.33390894404/8.0),
+    REAL_CONST(125053.40664525882/8.0),
+    REAL_CONST(125078.48063838384/8.0),
+    REAL_CONST(125103.55588819318/8.0),
+    REAL_CONST(125128.63239456083/8.0),
+    REAL_CONST(125153.71015736091/8.0),
+    REAL_CONST(125178.78917646752/8.0),
+    REAL_CONST(125203.86945175481/8.0),
+    REAL_CONST(125228.95098309696/8.0),
+    REAL_CONST(125254.03377036817/8.0),
+    REAL_CONST(125279.1178134427/8.0),
+    REAL_CONST(125304.20311219479/8.0),
+    REAL_CONST(125329.28966649878/8.0),
+    REAL_CONST(125354.37747622898/8.0),
+    REAL_CONST(125379.46654125977/8.0),
+    REAL_CONST(125404.55686146552/8.0),
+    REAL_CONST(125429.6484367207/8.0),
+    REAL_CONST(125454.74126689974/8.0),
+    REAL_CONST(125479.83535187715/8.0),
+    REAL_CONST(125504.93069152744/8.0),
+    REAL_CONST(125530.02728572517/8.0),
+    REAL_CONST(125555.12513434493/8.0),
+    REAL_CONST(125580.22423726133/8.0),
+    REAL_CONST(125605.32459434902/8.0),
+    REAL_CONST(125630.4262054827/8.0),
+    REAL_CONST(125655.52907053704/8.0),
+    REAL_CONST(125680.63318938682/8.0),
+    REAL_CONST(125705.73856190679/8.0),
+    REAL_CONST(125730.84518797178/8.0),
+    REAL_CONST(125755.9530674566/8.0),
+    REAL_CONST(125781.06220023613/8.0),
+    REAL_CONST(125806.17258618528/8.0),
+    REAL_CONST(125831.28422517896/8.0),
+    REAL_CONST(125856.39711709213/8.0),
+    REAL_CONST(125881.51126179981/8.0),
+    REAL_CONST(125906.62665917698/8.0),
+    REAL_CONST(125931.74330909875/8.0),
+    REAL_CONST(125956.86121144016/8.0),
+    REAL_CONST(125981.98036607634/8.0),
+    REAL_CONST(126007.10077288245/8.0),
+    REAL_CONST(126032.22243173365/8.0),
+    REAL_CONST(126057.34534250517/8.0),
+    REAL_CONST(126082.46950507225/8.0),
+    REAL_CONST(126107.59491931014/8.0),
+    REAL_CONST(126132.72158509417/8.0),
+    REAL_CONST(126157.84950229966/8.0),
+    REAL_CONST(126182.97867080198/8.0),
+    REAL_CONST(126208.10909047653/8.0),
+    REAL_CONST(126233.24076119871/8.0),
+    REAL_CONST(126258.37368284403/8.0),
+    REAL_CONST(126283.50785528794/8.0),
+    REAL_CONST(126308.64327840599/8.0),
+    REAL_CONST(126333.77995207369/8.0),
+    REAL_CONST(126358.91787616667/8.0),
+    REAL_CONST(126384.0570505605/8.0),
+    REAL_CONST(126409.19747513086/8.0),
+    REAL_CONST(126434.3391497534/8.0),
+    REAL_CONST(126459.48207430386/8.0),
+    REAL_CONST(126484.62624865794/8.0),
+    REAL_CONST(126509.77167269142/8.0),
+    REAL_CONST(126534.9183462801/8.0),
+    REAL_CONST(126560.06626929982/8.0),
+    REAL_CONST(126585.21544162642/8.0),
+    REAL_CONST(126610.36586313581/8.0),
+    REAL_CONST(126635.51753370393/8.0),
+    REAL_CONST(126660.67045320668/8.0),
+    REAL_CONST(126685.82462152008/8.0),
+    REAL_CONST(126710.98003852014/8.0),
+    REAL_CONST(126736.13670408291/8.0),
+    REAL_CONST(126761.29461808444/8.0),
+    REAL_CONST(126786.45378040087/8.0),
+    REAL_CONST(126811.61419090834/8.0),
+    REAL_CONST(126836.77584948298/8.0),
+    REAL_CONST(126861.93875600102/8.0),
+    REAL_CONST(126887.10291033868/8.0),
+    REAL_CONST(126912.26831237224/8.0),
+    REAL_CONST(126937.43496197795/8.0),
+    REAL_CONST(126962.60285903217/8.0),
+    REAL_CONST(126987.77200341123/8.0),
+    REAL_CONST(127012.94239499152/8.0),
+    REAL_CONST(127038.11403364947/8.0),
+    REAL_CONST(127063.2869192615/8.0),
+    REAL_CONST(127088.46105170409/8.0),
+    REAL_CONST(127113.63643085376/8.0),
+    REAL_CONST(127138.81305658702/8.0),
+    REAL_CONST(127163.99092878048/8.0),
+    REAL_CONST(127189.17004731069/8.0),
+    REAL_CONST(127214.35041205429/8.0),
+    REAL_CONST(127239.53202288797/8.0),
+    REAL_CONST(127264.71487968838/8.0),
+    REAL_CONST(127289.89898233226/8.0),
+    REAL_CONST(127315.08433069635/8.0),
+    REAL_CONST(127340.27092465744/8.0),
+    REAL_CONST(127365.45876409234/8.0),
+    REAL_CONST(127390.64784887788/8.0),
+    REAL_CONST(127415.83817889093/8.0),
+    REAL_CONST(127441.02975400841/8.0),
+    REAL_CONST(127466.22257410725/8.0),
+    REAL_CONST(127491.41663906439/8.0),
+    REAL_CONST(127516.61194875685/8.0),
+    REAL_CONST(127541.80850306165/8.0),
+    REAL_CONST(127567.00630185583/8.0),
+    REAL_CONST(127592.20534501647/8.0),
+    REAL_CONST(127617.4056324207/8.0),
+    REAL_CONST(127642.60716394568/8.0),
+    REAL_CONST(127667.80993946856/8.0),
+    REAL_CONST(127693.01395886653/8.0),
+    REAL_CONST(127718.21922201688/8.0),
+    REAL_CONST(127743.42572879682/8.0),
+    REAL_CONST(127768.63347908368/8.0),
+    REAL_CONST(127793.84247275478/8.0),
+    REAL_CONST(127819.05270968749/8.0),
+    REAL_CONST(127844.26418975917/8.0),
+    REAL_CONST(127869.47691284724/8.0),
+    REAL_CONST(127894.69087882918/8.0),
+    REAL_CONST(127919.90608758242/8.0),
+    REAL_CONST(127945.12253898452/8.0),
+    REAL_CONST(127970.34023291297/8.0),
+    REAL_CONST(127995.55916924537/8.0),
+    REAL_CONST(128020.77934785932/8.0),
+    REAL_CONST(128046.00076863244/8.0),
+    REAL_CONST(128071.22343144237/8.0),
+    REAL_CONST(128096.44733616684/8.0),
+    REAL_CONST(128121.67248268353/8.0),
+    REAL_CONST(128146.89887087021/8.0),
+    REAL_CONST(128172.12650060465/8.0),
+    REAL_CONST(128197.35537176467/8.0),
+    REAL_CONST(128222.5854842281/8.0),
+    REAL_CONST(128247.81683787282/8.0),
+    REAL_CONST(128273.04943257671/8.0),
+    REAL_CONST(128298.28326821771/8.0),
+    REAL_CONST(128323.51834467379/8.0),
+    REAL_CONST(128348.75466182294/8.0),
+    REAL_CONST(128373.99221954317/8.0),
+    REAL_CONST(128399.23101771252/8.0),
+    REAL_CONST(128424.47105620909/8.0),
+    REAL_CONST(128449.71233491098/8.0),
+    REAL_CONST(128474.95485369631/8.0),
+    REAL_CONST(128500.19861244329/8.0),
+    REAL_CONST(128525.44361103009/8.0),
+    REAL_CONST(128550.68984933494/8.0),
+    REAL_CONST(128575.93732723613/8.0),
+    REAL_CONST(128601.18604461191/8.0),
+    REAL_CONST(128626.43600134061/8.0),
+    REAL_CONST(128651.68719730059/8.0),
+    REAL_CONST(128676.93963237021/8.0),
+    REAL_CONST(128702.1933064279/8.0),
+    REAL_CONST(128727.44821935208/8.0),
+    REAL_CONST(128752.70437102125/8.0),
+    REAL_CONST(128777.96176131385/8.0),
+    REAL_CONST(128803.22039010846/8.0),
+    REAL_CONST(128828.48025728362/8.0),
+    REAL_CONST(128853.74136271792/8.0),
+    REAL_CONST(128879.00370628996/8.0),
+    REAL_CONST(128904.26728787841/8.0),
+    REAL_CONST(128929.53210736193/8.0),
+    REAL_CONST(128954.79816461923/8.0),
+    REAL_CONST(128980.06545952905/8.0),
+    REAL_CONST(129005.33399197015/8.0),
+    REAL_CONST(129030.60376182134/8.0),
+    REAL_CONST(129055.87476896142/8.0),
+    REAL_CONST(129081.14701326926/8.0),
+    REAL_CONST(129106.42049462376/8.0),
+    REAL_CONST(129131.6952129038/8.0),
+    REAL_CONST(129156.97116798835/8.0),
+    REAL_CONST(129182.24835975636/8.0),
+    REAL_CONST(129207.52678808685/8.0),
+    REAL_CONST(129232.80645285884/8.0),
+    REAL_CONST(129258.08735395141/8.0),
+    REAL_CONST(129283.36949124365/8.0),
+    REAL_CONST(129308.65286461466/8.0),
+    REAL_CONST(129333.9374739436/8.0),
+    REAL_CONST(129359.22331910966/8.0),
+    REAL_CONST(129384.51039999202/8.0),
+    REAL_CONST(129409.79871646997/8.0),
+    REAL_CONST(129435.08826842274/8.0),
+    REAL_CONST(129460.37905572963/8.0),
+    REAL_CONST(129485.67107826998/8.0),
+    REAL_CONST(129510.96433592314/8.0),
+    REAL_CONST(129536.25882856851/8.0),
+    REAL_CONST(129561.55455608548/8.0),
+    REAL_CONST(129586.85151835352/8.0),
+    REAL_CONST(129612.14971525209/8.0),
+    REAL_CONST(129637.4491466607/8.0),
+    REAL_CONST(129662.74981245887/8.0),
+    REAL_CONST(129688.0517125262/8.0),
+    REAL_CONST(129713.35484674224/8.0),
+    REAL_CONST(129738.65921498663/8.0),
+    REAL_CONST(129763.96481713903/8.0),
+    REAL_CONST(129789.27165307909/8.0),
+    REAL_CONST(129814.57972268655/8.0),
+    REAL_CONST(129839.88902584116/8.0),
+    REAL_CONST(129865.19956242264/8.0),
+    REAL_CONST(129890.51133231082/8.0),
+    REAL_CONST(129915.82433538554/8.0),
+    REAL_CONST(129941.13857152662/8.0),
+    REAL_CONST(129966.45404061397/8.0),
+    REAL_CONST(129991.7707425275/8.0),
+    REAL_CONST(130017.08867714716/8.0),
+    REAL_CONST(130042.4078443529/8.0),
+    REAL_CONST(130067.72824402474/8.0),
+    REAL_CONST(130093.04987604271/8.0),
+    REAL_CONST(130118.37274028687/8.0),
+    REAL_CONST(130143.69683663732/8.0),
+    REAL_CONST(130169.02216497416/8.0),
+    REAL_CONST(130194.34872517755/8.0),
+    REAL_CONST(130219.67651712766/8.0),
+    REAL_CONST(130245.0055407047/8.0),
+    REAL_CONST(130270.33579578891/8.0),
+    REAL_CONST(130295.66728226055/8.0),
+    REAL_CONST(130320.99999999991/8.0),
+    REAL_CONST(130346.33394888733/8.0),
+    REAL_CONST(130371.66912880314/8.0),
+    REAL_CONST(130397.00553962773/8.0),
+    REAL_CONST(130422.34318124152/8.0),
+    REAL_CONST(130447.68205352494/8.0),
+    REAL_CONST(130473.02215635845/8.0),
+    REAL_CONST(130498.36348962256/8.0),
+    REAL_CONST(130523.70605319779/8.0),
+    REAL_CONST(130549.0498469647/8.0),
+    REAL_CONST(130574.39487080388/8.0),
+    REAL_CONST(130599.74112459592/8.0),
+    REAL_CONST(130625.08860822149/8.0),
+    REAL_CONST(130650.43732156123/8.0),
+    REAL_CONST(130675.78726449587/8.0),
+    REAL_CONST(130701.13843690613/8.0),
+    REAL_CONST(130726.49083867275/8.0),
+    REAL_CONST(130751.84446967654/8.0),
+    REAL_CONST(130777.19932979831/8.0),
+    REAL_CONST(130802.5554189189/8.0),
+    REAL_CONST(130827.91273691918/8.0),
+    REAL_CONST(130853.27128368006/8.0),
+    REAL_CONST(130878.63105908247/8.0),
+    REAL_CONST(130903.99206300738/8.0),
+    REAL_CONST(130929.35429533575/8.0),
+    REAL_CONST(130954.71775594862/8.0),
+    REAL_CONST(130980.08244472703/8.0),
+    REAL_CONST(131005.44836155206/8.0),
+    REAL_CONST(131030.81550630482/8.0),
+    REAL_CONST(131056.18387886642/8.0),
+    REAL_CONST(131081.55347911804/8.0),
+    REAL_CONST(131106.92430694087/8.0),
+    REAL_CONST(131132.29636221612/8.0),
+    REAL_CONST(131157.66964482504/8.0),
+    REAL_CONST(131183.0441546489/8.0),
+    REAL_CONST(131208.41989156904/8.0),
+    REAL_CONST(131233.79685546676/8.0),
+    REAL_CONST(131259.17504622342/8.0),
+    REAL_CONST(131284.55446372041/8.0),
+    REAL_CONST(131309.93510783918/8.0),
+    REAL_CONST(131335.31697846117/8.0),
+    REAL_CONST(131360.70007546784/8.0),
+    REAL_CONST(131386.0843987407/8.0),
+    REAL_CONST(131411.46994816128/8.0),
+    REAL_CONST(131436.85672361116/8.0),
+    REAL_CONST(131462.24472497194/8.0),
+    REAL_CONST(131487.63395212521/8.0),
+    REAL_CONST(131513.02440495262/8.0),
+    REAL_CONST(131538.41608333588/8.0),
+    REAL_CONST(131563.80898715663/8.0),
+    REAL_CONST(131589.2031162967/8.0),
+    REAL_CONST(131614.59847063778/8.0),
+    REAL_CONST(131639.9950500617/8.0),
+    REAL_CONST(131665.39285445024/8.0),
+    REAL_CONST(131690.79188368531/8.0),
+    REAL_CONST(131716.19213764873/8.0),
+    REAL_CONST(131741.59361622241/8.0),
+    REAL_CONST(131766.99631928833/8.0),
+    REAL_CONST(131792.40024672839/8.0),
+    REAL_CONST(131817.80539842462/8.0),
+    REAL_CONST(131843.21177425905/8.0),
+    REAL_CONST(131868.61937411371/8.0),
+    REAL_CONST(131894.02819787065/8.0),
+    REAL_CONST(131919.43824541202/8.0),
+    REAL_CONST(131944.84951661993/8.0),
+    REAL_CONST(131970.26201137656/8.0),
+    REAL_CONST(131995.67572956407/8.0),
+    REAL_CONST(132021.09067106468/8.0),
+    REAL_CONST(132046.50683576067/8.0),
+    REAL_CONST(132071.9242235343/8.0),
+    REAL_CONST(132097.34283426782/8.0),
+    REAL_CONST(132122.76266784366/8.0),
+    REAL_CONST(132148.1837241441/8.0),
+    REAL_CONST(132173.60600305157/8.0),
+    REAL_CONST(132199.02950444847/8.0),
+    REAL_CONST(132224.45422821722/8.0),
+    REAL_CONST(132249.88017424036/8.0),
+    REAL_CONST(132275.30734240031/8.0),
+    REAL_CONST(132300.73573257966/8.0),
+    REAL_CONST(132326.16534466096/8.0),
+    REAL_CONST(132351.59617852676/8.0),
+    REAL_CONST(132377.02823405969/8.0),
+    REAL_CONST(132402.46151114244/8.0),
+    REAL_CONST(132427.89600965759/8.0),
+    REAL_CONST(132453.33172948789/8.0),
+    REAL_CONST(132478.76867051609/8.0),
+    REAL_CONST(132504.20683262491/8.0),
+    REAL_CONST(132529.64621569714/8.0),
+    REAL_CONST(132555.08681961559/8.0),
+    REAL_CONST(132580.5286442631/8.0),
+    REAL_CONST(132605.97168952253/8.0),
+    REAL_CONST(132631.41595527678/8.0),
+    REAL_CONST(132656.86144140881/8.0),
+    REAL_CONST(132682.30814780149/8.0),
+    REAL_CONST(132707.75607433787/8.0),
+    REAL_CONST(132733.20522090094/8.0),
+    REAL_CONST(132758.65558737374/8.0),
+    REAL_CONST(132784.10717363929/8.0),
+    REAL_CONST(132809.55997958075/8.0),
+    REAL_CONST(132835.01400508118/8.0),
+    REAL_CONST(132860.46925002377/8.0),
+    REAL_CONST(132885.92571429166/8.0),
+    REAL_CONST(132911.38339776811/8.0),
+    REAL_CONST(132936.84230033628/8.0),
+    REAL_CONST(132962.30242187946/8.0),
+    REAL_CONST(132987.76376228096/8.0),
+    REAL_CONST(133013.22632142407/8.0),
+    REAL_CONST(133038.69009919214/8.0),
+    REAL_CONST(133064.15509546854/8.0),
+    REAL_CONST(133089.62131013666/8.0),
+    REAL_CONST(133115.08874307995/8.0),
+    REAL_CONST(133140.55739418184/8.0),
+    REAL_CONST(133166.02726332581/8.0),
+    REAL_CONST(133191.49835039541/8.0),
+    REAL_CONST(133216.97065527414/8.0),
+    REAL_CONST(133242.44417784561/8.0),
+    REAL_CONST(133267.91891799335/8.0),
+    REAL_CONST(133293.39487560102/8.0),
+    REAL_CONST(133318.87205055228/8.0),
+    REAL_CONST(133344.35044273079/8.0),
+    REAL_CONST(133369.83005202023/8.0),
+    REAL_CONST(133395.31087830439/8.0),
+    REAL_CONST(133420.79292146701/8.0),
+    REAL_CONST(133446.27618139185/8.0),
+    REAL_CONST(133471.76065796276/8.0),
+    REAL_CONST(133497.24635106357/8.0),
+    REAL_CONST(133522.73326057816/8.0),
+    REAL_CONST(133548.22138639039/8.0),
+    REAL_CONST(133573.71072838426/8.0),
+    REAL_CONST(133599.20128644365/8.0),
+    REAL_CONST(133624.69306045261/8.0),
+    REAL_CONST(133650.1860502951/8.0),
+    REAL_CONST(133675.68025585517/8.0),
+    REAL_CONST(133701.1756770169/8.0),
+    REAL_CONST(133726.67231366437/8.0),
+    REAL_CONST(133752.17016568172/8.0),
+    REAL_CONST(133777.66923295305/8.0),
+    REAL_CONST(133803.16951536259/8.0),
+    REAL_CONST(133828.67101279454/8.0),
+    REAL_CONST(133854.17372513309/8.0),
+    REAL_CONST(133879.67765226253/8.0),
+    REAL_CONST(133905.18279406714/8.0),
+    REAL_CONST(133930.68915043125/8.0),
+    REAL_CONST(133956.19672123916/8.0),
+    REAL_CONST(133981.70550637526/8.0),
+    REAL_CONST(134007.21550572399/8.0),
+    REAL_CONST(134032.7267191697/8.0),
+    REAL_CONST(134058.23914659687/8.0),
+    REAL_CONST(134083.75278789/8.0),
+    REAL_CONST(134109.26764293358/8.0),
+    REAL_CONST(134134.78371161217/8.0),
+    REAL_CONST(134160.30099381026/8.0),
+    REAL_CONST(134185.8194894125/8.0),
+    REAL_CONST(134211.33919830353/8.0),
+    REAL_CONST(134236.8601203679/8.0),
+    REAL_CONST(134262.38225549037/8.0),
+    REAL_CONST(134287.90560355558/8.0),
+    REAL_CONST(134313.43016444831/8.0),
+    REAL_CONST(134338.95593805326/8.0),
+    REAL_CONST(134364.48292425525/8.0),
+    REAL_CONST(134390.01112293909/8.0),
+    REAL_CONST(134415.54053398955/8.0),
+    REAL_CONST(134441.07115729159/8.0),
+    REAL_CONST(134466.60299273001/8.0),
+    REAL_CONST(134492.1360401898/8.0),
+    REAL_CONST(134517.67029955584/8.0),
+    REAL_CONST(134543.20577071316/8.0),
+    REAL_CONST(134568.74245354676/8.0),
+    REAL_CONST(134594.28034794159/8.0),
+    REAL_CONST(134619.81945378278/8.0),
+    REAL_CONST(134645.35977095537/8.0),
+    REAL_CONST(134670.90129934452/8.0),
+    REAL_CONST(134696.4440388353/8.0),
+    REAL_CONST(134721.98798931291/8.0),
+    REAL_CONST(134747.53315066252/8.0),
+    REAL_CONST(134773.07952276937/8.0),
+    REAL_CONST(134798.62710551871/8.0),
+    REAL_CONST(134824.17589879577/8.0),
+    REAL_CONST(134849.72590248589/8.0),
+    REAL_CONST(134875.27711647438/8.0),
+    REAL_CONST(134900.82954064661/8.0),
+    REAL_CONST(134926.38317488792/8.0),
+    REAL_CONST(134951.93801908373/8.0),
+    REAL_CONST(134977.49407311951/8.0),
+    REAL_CONST(135003.05133688069/8.0),
+    REAL_CONST(135028.60981025276/8.0),
+    REAL_CONST(135054.16949312127/8.0),
+    REAL_CONST(135079.73038537172/8.0),
+    REAL_CONST(135105.29248688967/8.0),
+    REAL_CONST(135130.85579756077/8.0),
+    REAL_CONST(135156.42031727062/8.0),
+    REAL_CONST(135181.98604590484/8.0),
+    REAL_CONST(135207.55298334916/8.0),
+    REAL_CONST(135233.12112948924/8.0),
+    REAL_CONST(135258.69048421088/8.0),
+    REAL_CONST(135284.26104739975/8.0),
+    REAL_CONST(135309.83281894168/8.0),
+    REAL_CONST(135335.4057987225/8.0),
+    REAL_CONST(135360.97998662802/8.0),
+    REAL_CONST(135386.55538254412/8.0),
+    REAL_CONST(135412.13198635669/8.0),
+    REAL_CONST(135437.70979795168/8.0),
+    REAL_CONST(135463.28881721498/8.0),
+    REAL_CONST(135488.86904403262/8.0),
+    REAL_CONST(135514.45047829056/8.0),
+    REAL_CONST(135540.03311987486/8.0),
+    REAL_CONST(135565.61696867159/8.0),
+    REAL_CONST(135591.20202456677/8.0),
+    REAL_CONST(135616.78828744654/8.0),
+    REAL_CONST(135642.37575719706/8.0),
+    REAL_CONST(135667.96443370447/8.0),
+    REAL_CONST(135693.55431685498/8.0),
+    REAL_CONST(135719.14540653475/8.0),
+    REAL_CONST(135744.73770263011/8.0),
+    REAL_CONST(135770.33120502727/8.0),
+    REAL_CONST(135795.92591361253/8.0),
+    REAL_CONST(135821.52182827223/8.0),
+    REAL_CONST(135847.11894889272/8.0),
+    REAL_CONST(135872.7172753604/8.0),
+    REAL_CONST(135898.31680756161/8.0),
+    REAL_CONST(135923.91754538284/8.0),
+    REAL_CONST(135949.51948871053/8.0),
+    REAL_CONST(135975.12263743114/8.0),
+    REAL_CONST(136000.72699143123/8.0),
+    REAL_CONST(136026.33255059729/8.0),
+    REAL_CONST(136051.93931481591/8.0),
+    REAL_CONST(136077.54728397369/8.0),
+    REAL_CONST(136103.15645795723/8.0),
+    REAL_CONST(136128.76683665317/8.0),
+    REAL_CONST(136154.37841994822/8.0),
+    REAL_CONST(136179.99120772901/8.0),
+    REAL_CONST(136205.60519988232/8.0),
+    REAL_CONST(136231.2203962949/8.0),
+    REAL_CONST(136256.83679685349/8.0),
+    REAL_CONST(136282.45440144493/8.0),
+    REAL_CONST(136308.07320995603/8.0),
+    REAL_CONST(136333.69322227367/8.0),
+    REAL_CONST(136359.31443828469/8.0),
+    REAL_CONST(136384.93685787608/8.0),
+    REAL_CONST(136410.56048093468/8.0),
+    REAL_CONST(136436.18530734754/8.0),
+    REAL_CONST(136461.81133700156/8.0),
+    REAL_CONST(136487.43856978384/8.0),
+    REAL_CONST(136513.06700558143/8.0),
+    REAL_CONST(136538.6966442813/8.0),
+    REAL_CONST(136564.32748577066/8.0),
+    REAL_CONST(136589.95952993655/8.0),
+    REAL_CONST(136615.59277666616/8.0),
+    REAL_CONST(136641.22722584667/8.0),
+    REAL_CONST(136666.86287736523/8.0),
+    REAL_CONST(136692.49973110916/8.0),
+    REAL_CONST(136718.13778696564/8.0),
+    REAL_CONST(136743.77704482197/8.0),
+    REAL_CONST(136769.41750456547/8.0),
+    REAL_CONST(136795.05916608346/8.0),
+    REAL_CONST(136820.70202926331/8.0),
+    REAL_CONST(136846.34609399244/8.0),
+    REAL_CONST(136871.99136015819/8.0),
+    REAL_CONST(136897.63782764805/8.0),
+    REAL_CONST(136923.28549634948/8.0),
+    REAL_CONST(136948.93436614997/8.0),
+    REAL_CONST(136974.58443693706/8.0),
+    REAL_CONST(137000.23570859825/8.0),
+    REAL_CONST(137025.88818102115/8.0),
+    REAL_CONST(137051.54185409332/8.0),
+    REAL_CONST(137077.19672770242/8.0),
+    REAL_CONST(137102.85280173609/8.0),
+    REAL_CONST(137128.51007608202/8.0),
+    REAL_CONST(137154.16855062786/8.0),
+    REAL_CONST(137179.82822526142/8.0),
+    REAL_CONST(137205.48909987041/8.0),
+    REAL_CONST(137231.15117434258/8.0),
+    REAL_CONST(137256.8144485658/8.0),
+    REAL_CONST(137282.47892242789/8.0),
+    REAL_CONST(137308.14459581667/8.0),
+    REAL_CONST(137333.81146862009/8.0),
+    REAL_CONST(137359.47954072602/8.0),
+    REAL_CONST(137385.14881202241/8.0),
+    REAL_CONST(137410.81928239719/8.0),
+    REAL_CONST(137436.49095173844/8.0),
+    REAL_CONST(137462.16381993407/8.0),
+    REAL_CONST(137487.83788687221/8.0),
+    REAL_CONST(137513.51315244089/8.0),
+    REAL_CONST(137539.18961652822/8.0),
+    REAL_CONST(137564.86727902229/8.0),
+    REAL_CONST(137590.54613981131/8.0),
+    REAL_CONST(137616.22619878338/8.0),
+    REAL_CONST(137641.90745582676/8.0),
+    REAL_CONST(137667.58991082967/8.0),
+    REAL_CONST(137693.27356368033/8.0),
+    REAL_CONST(137718.95841426702/8.0),
+    REAL_CONST(137744.64446247809/8.0),
+    REAL_CONST(137770.33170820182/8.0),
+    REAL_CONST(137796.02015132661/8.0),
+    REAL_CONST(137821.70979174081/8.0),
+    REAL_CONST(137847.40062933284/8.0),
+    REAL_CONST(137873.09266399115/8.0),
+    REAL_CONST(137898.78589560417/8.0),
+    REAL_CONST(137924.48032406042/8.0),
+    REAL_CONST(137950.17594924837/8.0),
+    REAL_CONST(137975.8727710566/8.0),
+    REAL_CONST(138001.57078937365/8.0),
+    REAL_CONST(138027.27000408815/8.0),
+    REAL_CONST(138052.97041508864/8.0),
+    REAL_CONST(138078.67202226384/8.0),
+    REAL_CONST(138104.3748255024/8.0),
+    REAL_CONST(138130.07882469296/8.0),
+    REAL_CONST(138155.78401972432/8.0),
+    REAL_CONST(138181.49041048516/8.0),
+    REAL_CONST(138207.1979968643/8.0),
+    REAL_CONST(138232.9067787505/8.0),
+    REAL_CONST(138258.61675603263/8.0),
+    REAL_CONST(138284.32792859949/8.0),
+    REAL_CONST(138310.04029633995/8.0),
+    REAL_CONST(138335.75385914298/8.0),
+    REAL_CONST(138361.46861689744/8.0),
+    REAL_CONST(138387.18456949232/8.0),
+    REAL_CONST(138412.90171681659/8.0),
+    REAL_CONST(138438.62005875923/8.0),
+    REAL_CONST(138464.33959520931/8.0),
+    REAL_CONST(138490.06032605586/8.0),
+    REAL_CONST(138515.78225118798/8.0),
+    REAL_CONST(138541.50537049473/8.0),
+    REAL_CONST(138567.2296838653/8.0),
+    REAL_CONST(138592.95519118884/8.0),
+    REAL_CONST(138618.68189235451/8.0),
+    REAL_CONST(138644.40978725153/8.0),
+    REAL_CONST(138670.13887576913/8.0),
+    REAL_CONST(138695.86915779658/8.0),
+    REAL_CONST(138721.60063322316/8.0),
+    REAL_CONST(138747.33330193823/8.0),
+    REAL_CONST(138773.06716383106/8.0),
+    REAL_CONST(138798.80221879104/8.0),
+    REAL_CONST(138824.53846670757/8.0),
+    REAL_CONST(138850.27590747006/8.0),
+    REAL_CONST(138876.01454096794/8.0),
+    REAL_CONST(138901.7543670907/8.0),
+    REAL_CONST(138927.49538572782/8.0),
+    REAL_CONST(138953.2375967688/8.0),
+    REAL_CONST(138978.9810001032/8.0),
+    REAL_CONST(139004.72559562061/8.0),
+    REAL_CONST(139030.47138321059/8.0),
+    REAL_CONST(139056.2183627628/8.0),
+    REAL_CONST(139081.96653416683/8.0),
+    REAL_CONST(139107.71589731239/8.0),
+    REAL_CONST(139133.46645208917/8.0),
+    REAL_CONST(139159.21819838689/8.0),
+    REAL_CONST(139184.97113609532/8.0),
+    REAL_CONST(139210.72526510421/8.0),
+    REAL_CONST(139236.48058530336/8.0),
+    REAL_CONST(139262.23709658257/8.0),
+    REAL_CONST(139287.99479883176/8.0),
+    REAL_CONST(139313.75369194071/8.0),
+    REAL_CONST(139339.51377579942/8.0),
+    REAL_CONST(139365.27505029776/8.0),
+    REAL_CONST(139391.03751532568/8.0),
+    REAL_CONST(139416.80117077316/8.0),
+    REAL_CONST(139442.56601653024/8.0),
+    REAL_CONST(139468.33205248689/8.0),
+    REAL_CONST(139494.09927853322/8.0),
+    REAL_CONST(139519.86769455927/8.0),
+    REAL_CONST(139545.63730045516/8.0),
+    REAL_CONST(139571.408096111/8.0),
+    REAL_CONST(139597.18008141697/8.0),
+    REAL_CONST(139622.95325626322/8.0),
+    REAL_CONST(139648.72762054001/8.0),
+    REAL_CONST(139674.5031741375/8.0),
+    REAL_CONST(139700.27991694602/8.0),
+    REAL_CONST(139726.05784885579/8.0),
+    REAL_CONST(139751.83696975713/8.0),
+    REAL_CONST(139777.61727954043/8.0),
+    REAL_CONST(139803.39877809596/8.0),
+    REAL_CONST(139829.18146531415/8.0),
+    REAL_CONST(139854.96534108539/8.0),
+    REAL_CONST(139880.75040530015/8.0),
+    REAL_CONST(139906.53665784886/8.0),
+    REAL_CONST(139932.32409862199/8.0),
+    REAL_CONST(139958.11272751007/8.0),
+    REAL_CONST(139983.90254440365/8.0),
+    REAL_CONST(140009.69354919327/8.0),
+    REAL_CONST(140035.48574176949/8.0),
+    REAL_CONST(140061.27912202294/8.0),
+    REAL_CONST(140087.07368984428/8.0),
+    REAL_CONST(140112.86944512415/8.0),
+    REAL_CONST(140138.66638775321/8.0),
+    REAL_CONST(140164.4645176222/8.0),
+    REAL_CONST(140190.26383462184/8.0),
+    REAL_CONST(140216.06433864293/8.0),
+    REAL_CONST(140241.86602957622/8.0),
+    REAL_CONST(140267.66890731253/8.0),
+    REAL_CONST(140293.47297174268/8.0),
+    REAL_CONST(140319.27822275754/8.0),
+    REAL_CONST(140345.08466024802/8.0),
+    REAL_CONST(140370.89228410498/8.0),
+    REAL_CONST(140396.70109421943/8.0),
+    REAL_CONST(140422.51109048226/8.0),
+    REAL_CONST(140448.32227278448/8.0),
+    REAL_CONST(140474.13464101712/8.0),
+    REAL_CONST(140499.94819507122/8.0),
+    REAL_CONST(140525.76293483781/8.0),
+    REAL_CONST(140551.57886020801/8.0),
+    REAL_CONST(140577.3959710729/8.0),
+    REAL_CONST(140603.21426732364/8.0),
+    REAL_CONST(140629.03374885136/8.0),
+    REAL_CONST(140654.85441554731/8.0),
+    REAL_CONST(140680.67626730262/8.0),
+    REAL_CONST(140706.49930400858/8.0),
+    REAL_CONST(140732.32352555645/8.0),
+    REAL_CONST(140758.1489318375/8.0),
+    REAL_CONST(140783.97552274304/8.0),
+    REAL_CONST(140809.80329816442/8.0),
+    REAL_CONST(140835.63225799298/8.0),
+    REAL_CONST(140861.46240212015/8.0),
+    REAL_CONST(140887.29373043729/8.0),
+    REAL_CONST(140913.12624283586/8.0),
+    REAL_CONST(140938.95993920733/8.0),
+    REAL_CONST(140964.79481944317/8.0),
+    REAL_CONST(140990.63088343487/8.0),
+    REAL_CONST(141016.46813107401/8.0),
+    REAL_CONST(141042.30656225214/8.0),
+    REAL_CONST(141068.14617686081/8.0),
+    REAL_CONST(141093.98697479168/8.0),
+    REAL_CONST(141119.82895593636/8.0),
+    REAL_CONST(141145.6721201865/8.0),
+    REAL_CONST(141171.51646743377/8.0),
+    REAL_CONST(141197.36199756994/8.0),
+    REAL_CONST(141223.20871048668/8.0),
+    REAL_CONST(141249.05660607578/8.0),
+    REAL_CONST(141274.90568422904/8.0),
+    REAL_CONST(141300.75594483822/8.0),
+    REAL_CONST(141326.6073877952/8.0),
+    REAL_CONST(141352.4600129918/8.0),
+    REAL_CONST(141378.31382031992/8.0),
+    REAL_CONST(141404.16880967148/8.0),
+    REAL_CONST(141430.02498093838/8.0),
+    REAL_CONST(141455.8823340126/8.0),
+    REAL_CONST(141481.74086878612/8.0),
+    REAL_CONST(141507.60058515094/8.0),
+    REAL_CONST(141533.46148299909/8.0),
+    REAL_CONST(141559.32356222265/8.0),
+    REAL_CONST(141585.18682271364/8.0),
+    REAL_CONST(141611.05126436421/8.0),
+    REAL_CONST(141636.9168870665/8.0),
+    REAL_CONST(141662.78369071262/8.0),
+    REAL_CONST(141688.65167519479/8.0),
+    REAL_CONST(141714.5208404052/8.0),
+    REAL_CONST(141740.39118623605/8.0),
+    REAL_CONST(141766.26271257963/8.0),
+    REAL_CONST(141792.1354193282/8.0),
+    REAL_CONST(141818.00930637406/8.0),
+    REAL_CONST(141843.88437360956/8.0),
+    REAL_CONST(141869.760620927/8.0),
+    REAL_CONST(141895.6380482188/8.0),
+    REAL_CONST(141921.51665537735/8.0),
+    REAL_CONST(141947.39644229505/8.0),
+    REAL_CONST(141973.27740886438/8.0),
+    REAL_CONST(141999.15955497778/8.0),
+    REAL_CONST(142025.04288052776/8.0),
+    REAL_CONST(142050.92738540689/8.0),
+    REAL_CONST(142076.81306950765/8.0),
+    REAL_CONST(142102.69993272264/8.0),
+    REAL_CONST(142128.58797494444/8.0),
+    REAL_CONST(142154.47719606571/8.0),
+    REAL_CONST(142180.36759597904/8.0),
+    REAL_CONST(142206.25917457714/8.0),
+    REAL_CONST(142232.15193175265/8.0),
+    REAL_CONST(142258.04586739838/8.0),
+    REAL_CONST(142283.94098140698/8.0),
+    REAL_CONST(142309.83727367126/8.0),
+    REAL_CONST(142335.73474408401/8.0),
+    REAL_CONST(142361.63339253806/8.0),
+    REAL_CONST(142387.5332189262/8.0),
+    REAL_CONST(142413.43422314132/8.0),
+    REAL_CONST(142439.33640507635/8.0),
+    REAL_CONST(142465.23976462413/8.0),
+    REAL_CONST(142491.14430167765/8.0),
+    REAL_CONST(142517.05001612983/8.0),
+    REAL_CONST(142542.95690787368/8.0),
+    REAL_CONST(142568.86497680223/8.0),
+    REAL_CONST(142594.77422280848/8.0),
+    REAL_CONST(142620.68464578551/8.0),
+    REAL_CONST(142646.5962456264/8.0),
+    REAL_CONST(142672.50902222423/8.0),
+    REAL_CONST(142698.42297547215/8.0),
+    REAL_CONST(142724.33810526333/8.0),
+    REAL_CONST(142750.25441149093/8.0),
+    REAL_CONST(142776.17189404817/8.0),
+    REAL_CONST(142802.09055282827/8.0),
+    REAL_CONST(142828.01038772447/8.0),
+    REAL_CONST(142853.93139863008/8.0),
+    REAL_CONST(142879.85358543837/8.0),
+    REAL_CONST(142905.77694804268/8.0),
+    REAL_CONST(142931.70148633636/8.0),
+    REAL_CONST(142957.62720021277/8.0),
+    REAL_CONST(142983.55408956532/8.0),
+    REAL_CONST(143009.48215428743/8.0),
+    REAL_CONST(143035.41139427255/8.0),
+    REAL_CONST(143061.34180941415/8.0),
+    REAL_CONST(143087.27339960571/8.0),
+    REAL_CONST(143113.20616474075/8.0),
+    REAL_CONST(143139.14010471283/8.0),
+    REAL_CONST(143165.07521941551/8.0),
+    REAL_CONST(143191.01150874238/8.0),
+    REAL_CONST(143216.94897258704/8.0),
+    REAL_CONST(143242.88761084314/8.0),
+    REAL_CONST(143268.82742340435/8.0),
+    REAL_CONST(143294.76841016437/8.0),
+    REAL_CONST(143320.71057101688/8.0),
+    REAL_CONST(143346.65390585564/8.0),
+    REAL_CONST(143372.59841457437/8.0),
+    REAL_CONST(143398.54409706692/8.0),
+    REAL_CONST(143424.49095322701/8.0),
+    REAL_CONST(143450.43898294857/8.0),
+    REAL_CONST(143476.38818612538/8.0),
+    REAL_CONST(143502.33856265133/8.0),
+    REAL_CONST(143528.29011242036/8.0),
+    REAL_CONST(143554.24283532638/8.0),
+    REAL_CONST(143580.19673126334/8.0),
+    REAL_CONST(143606.1518001252/8.0),
+    REAL_CONST(143632.10804180597/8.0),
+    REAL_CONST(143658.06545619969/8.0),
+    REAL_CONST(143684.02404320039/8.0),
+    REAL_CONST(143709.98380270213/8.0),
+    REAL_CONST(143735.944734599/8.0),
+    REAL_CONST(143761.90683878519/8.0),
+    REAL_CONST(143787.87011515474/8.0),
+    REAL_CONST(143813.83456360188/8.0),
+    REAL_CONST(143839.8001840208/8.0),
+    REAL_CONST(143865.76697630569/8.0),
+    REAL_CONST(143891.73494035081/8.0),
+    REAL_CONST(143917.7040760504/8.0),
+    REAL_CONST(143943.67438329876/8.0),
+    REAL_CONST(143969.6458619902/8.0),
+    REAL_CONST(143995.61851201905/8.0),
+    REAL_CONST(144021.59233327967/8.0),
+    REAL_CONST(144047.56732566646/8.0),
+    REAL_CONST(144073.54348907378/8.0),
+    REAL_CONST(144099.52082339607/8.0),
+    REAL_CONST(144125.49932852783/8.0),
+    REAL_CONST(144151.4790043635/8.0),
+    REAL_CONST(144177.45985079758/8.0),
+    REAL_CONST(144203.44186772458/8.0),
+    REAL_CONST(144229.42505503909/8.0),
+    REAL_CONST(144255.40941263564/8.0),
+    REAL_CONST(144281.39494040885/8.0),
+    REAL_CONST(144307.38163825331/8.0),
+    REAL_CONST(144333.36950606373/8.0),
+    REAL_CONST(144359.35854373468/8.0),
+    REAL_CONST(144385.34875116093/8.0),
+    REAL_CONST(144411.34012823718/8.0),
+    REAL_CONST(144437.33267485813/8.0),
+    REAL_CONST(144463.32639091855/8.0),
+    REAL_CONST(144489.32127631325/8.0),
+    REAL_CONST(144515.31733093705/8.0),
+    REAL_CONST(144541.31455468474/8.0),
+    REAL_CONST(144567.3129474512/8.0),
+    REAL_CONST(144593.3125091313/8.0),
+    REAL_CONST(144619.31323961995/8.0),
+    REAL_CONST(144645.31513881206/8.0),
+    REAL_CONST(144671.31820660262/8.0),
+    REAL_CONST(144697.32244288657/8.0),
+    REAL_CONST(144723.32784755889/8.0),
+    REAL_CONST(144749.33442051467/8.0),
+    REAL_CONST(144775.34216164888/8.0),
+    REAL_CONST(144801.35107085665/8.0),
+    REAL_CONST(144827.36114803303/8.0),
+    REAL_CONST(144853.37239307314/8.0),
+    REAL_CONST(144879.38480587213/8.0),
+    REAL_CONST(144905.39838632516/8.0),
+    REAL_CONST(144931.41313432742/8.0),
+    REAL_CONST(144957.4290497741/8.0),
+    REAL_CONST(144983.44613256046/8.0),
+    REAL_CONST(145009.46438258173/8.0),
+    REAL_CONST(145035.48379973322/8.0),
+    REAL_CONST(145061.50438391021/8.0),
+    REAL_CONST(145087.52613500805/8.0),
+    REAL_CONST(145113.54905292206/8.0),
+    REAL_CONST(145139.57313754765/8.0),
+    REAL_CONST(145165.59838878017/8.0),
+    REAL_CONST(145191.62480651509/8.0),
+    REAL_CONST(145217.65239064783/8.0),
+    REAL_CONST(145243.68114107384/8.0),
+    REAL_CONST(145269.71105768863/8.0),
+    REAL_CONST(145295.74214038774/8.0),
+    REAL_CONST(145321.77438906668/8.0),
+    REAL_CONST(145347.80780362099/8.0),
+    REAL_CONST(145373.84238394629/8.0),
+    REAL_CONST(145399.87812993818/8.0),
+    REAL_CONST(145425.91504149229/8.0),
+    REAL_CONST(145451.95311850426/8.0),
+    REAL_CONST(145477.9923608698/8.0),
+    REAL_CONST(145504.03276848458/8.0),
+    REAL_CONST(145530.07434124436/8.0),
+    REAL_CONST(145556.11707904484/8.0),
+    REAL_CONST(145582.16098178181/8.0),
+    REAL_CONST(145608.20604935108/8.0),
+    REAL_CONST(145634.25228164849/8.0),
+    REAL_CONST(145660.29967856981/8.0),
+    REAL_CONST(145686.34824001096/8.0),
+    REAL_CONST(145712.39796586783/8.0),
+    REAL_CONST(145738.4488560363/8.0),
+    REAL_CONST(145764.50091041232/8.0),
+    REAL_CONST(145790.55412889185/8.0),
+    REAL_CONST(145816.60851137087/8.0),
+    REAL_CONST(145842.66405774537/8.0),
+    REAL_CONST(145868.72076791141/8.0),
+    REAL_CONST(145894.77864176501/8.0),
+    REAL_CONST(145920.83767920226/8.0),
+    REAL_CONST(145946.89788011924/8.0),
+    REAL_CONST(145972.95924441208/8.0),
+    REAL_CONST(145999.02177197693/8.0),
+    REAL_CONST(146025.08546270995/8.0),
+    REAL_CONST(146051.15031650732/8.0),
+    REAL_CONST(146077.21633326527/8.0),
+    REAL_CONST(146103.28351288004/8.0),
+    REAL_CONST(146129.35185524789/8.0),
+    REAL_CONST(146155.42136026506/8.0),
+    REAL_CONST(146181.49202782792/8.0),
+    REAL_CONST(146207.56385783272/8.0),
+    REAL_CONST(146233.63685017588/8.0),
+    REAL_CONST(146259.71100475377/8.0),
+    REAL_CONST(146285.78632146274/8.0),
+    REAL_CONST(146311.86280019928/8.0),
+    REAL_CONST(146337.94044085976/8.0),
+    REAL_CONST(146364.01924334071/8.0),
+    REAL_CONST(146390.09920753856/8.0),
+    REAL_CONST(146416.18033334985/8.0),
+    REAL_CONST(146442.26262067116/8.0),
+    REAL_CONST(146468.34606939898/8.0),
+    REAL_CONST(146494.43067942993/8.0),
+    REAL_CONST(146520.51645066062/8.0),
+    REAL_CONST(146546.60338298764/8.0),
+    REAL_CONST(146572.69147630769/8.0),
+    REAL_CONST(146598.78073051744/8.0),
+    REAL_CONST(146624.87114551352/8.0),
+    REAL_CONST(146650.96272119274/8.0),
+    REAL_CONST(146677.05545745179/8.0),
+    REAL_CONST(146703.14935418745/8.0),
+    REAL_CONST(146729.2444112965/8.0),
+    REAL_CONST(146755.34062867577/8.0),
+    REAL_CONST(146781.43800622207/8.0),
+    REAL_CONST(146807.53654383228/8.0),
+    REAL_CONST(146833.63624140329/8.0),
+    REAL_CONST(146859.73709883197/8.0),
+    REAL_CONST(146885.83911601527/8.0),
+    REAL_CONST(146911.94229285014/8.0),
+    REAL_CONST(146938.04662923355/8.0),
+    REAL_CONST(146964.15212506248/8.0),
+    REAL_CONST(146990.25878023397/8.0),
+    REAL_CONST(147016.36659464505/8.0),
+    REAL_CONST(147042.47556819281/8.0),
+    REAL_CONST(147068.58570077427/8.0),
+    REAL_CONST(147094.6969922866/8.0),
+    REAL_CONST(147120.80944262692/8.0),
+    REAL_CONST(147146.92305169237/8.0),
+    REAL_CONST(147173.03781938017/8.0),
+    REAL_CONST(147199.15374558745/8.0),
+    REAL_CONST(147225.27083021149/8.0),
+    REAL_CONST(147251.38907314953/8.0),
+    REAL_CONST(147277.50847429881/8.0),
+    REAL_CONST(147303.62903355664/8.0),
+    REAL_CONST(147329.75075082036/8.0),
+    REAL_CONST(147355.87362598727/8.0),
+    REAL_CONST(147381.99765895473/8.0),
+    REAL_CONST(147408.12284962015/8.0),
+    REAL_CONST(147434.24919788091/8.0),
+    REAL_CONST(147460.37670363448/8.0),
+    REAL_CONST(147486.50536677826/8.0),
+    REAL_CONST(147512.63518720976/8.0),
+    REAL_CONST(147538.76616482646/8.0),
+    REAL_CONST(147564.89829952587/8.0),
+    REAL_CONST(147591.03159120557/8.0),
+    REAL_CONST(147617.16603976308/8.0),
+    REAL_CONST(147643.30164509601/8.0),
+    REAL_CONST(147669.43840710199/8.0),
+    REAL_CONST(147695.57632567859/8.0),
+    REAL_CONST(147721.71540072354/8.0),
+    REAL_CONST(147747.85563213445/8.0),
+    REAL_CONST(147773.99701980909/8.0),
+    REAL_CONST(147800.13956364512/8.0),
+    REAL_CONST(147826.28326354033/8.0),
+    REAL_CONST(147852.42811939248/8.0),
+    REAL_CONST(147878.57413109933/8.0),
+    REAL_CONST(147904.72129855872/8.0),
+    REAL_CONST(147930.86962166851/8.0),
+    REAL_CONST(147957.01910032652/8.0),
+    REAL_CONST(147983.16973443062/8.0),
+    REAL_CONST(148009.32152387875/8.0),
+    REAL_CONST(148035.47446856883/8.0),
+    REAL_CONST(148061.62856839882/8.0),
+    REAL_CONST(148087.78382326665/8.0),
+    REAL_CONST(148113.94023307035/8.0),
+    REAL_CONST(148140.09779770792/8.0),
+    REAL_CONST(148166.25651707739/8.0),
+    REAL_CONST(148192.41639107687/8.0),
+    REAL_CONST(148218.57741960438/8.0),
+    REAL_CONST(148244.73960255808/8.0),
+    REAL_CONST(148270.90293983606/8.0),
+    REAL_CONST(148297.0674313365/8.0),
+    REAL_CONST(148323.23307695755/8.0),
+    REAL_CONST(148349.39987659742/8.0),
+    REAL_CONST(148375.56783015432/8.0),
+    REAL_CONST(148401.73693752653/8.0),
+    REAL_CONST(148427.90719861226/8.0),
+    REAL_CONST(148454.07861330983/8.0),
+    REAL_CONST(148480.25118151752/8.0),
+    REAL_CONST(148506.42490313368/8.0),
+    REAL_CONST(148532.59977805667/8.0),
+    REAL_CONST(148558.77580618486/8.0),
+    REAL_CONST(148584.95298741665/8.0),
+    REAL_CONST(148611.13132165043/8.0),
+    REAL_CONST(148637.31080878471/8.0),
+    REAL_CONST(148663.49144871789/8.0),
+    REAL_CONST(148689.6732413485/8.0),
+    REAL_CONST(148715.85618657502/8.0),
+    REAL_CONST(148742.040284296/8.0),
+    REAL_CONST(148768.22553440998/8.0),
+    REAL_CONST(148794.41193681557/8.0),
+    REAL_CONST(148820.59949141133/8.0),
+    REAL_CONST(148846.78819809589/8.0),
+    REAL_CONST(148872.97805676793/8.0),
+    REAL_CONST(148899.16906732606/8.0),
+    REAL_CONST(148925.36122966901/8.0),
+    REAL_CONST(148951.55454369547/8.0),
+    REAL_CONST(148977.74900930419/8.0),
+    REAL_CONST(149003.9446263939/8.0),
+    REAL_CONST(149030.1413948634/8.0),
+    REAL_CONST(149056.33931461151/8.0),
+    REAL_CONST(149082.53838553699/8.0),
+    REAL_CONST(149108.73860753875/8.0),
+    REAL_CONST(149134.9399805156/8.0),
+    REAL_CONST(149161.14250436646/8.0),
+    REAL_CONST(149187.34617899026/8.0),
+    REAL_CONST(149213.5510042859/8.0),
+    REAL_CONST(149239.75698015234/8.0),
+    REAL_CONST(149265.96410648854/8.0),
+    REAL_CONST(149292.17238319354/8.0),
+    REAL_CONST(149318.38181016635/8.0),
+    REAL_CONST(149344.59238730598/8.0),
+    REAL_CONST(149370.80411451156/8.0),
+    REAL_CONST(149397.01699168212/8.0),
+    REAL_CONST(149423.23101871679/8.0),
+    REAL_CONST(149449.44619551473/8.0),
+    REAL_CONST(149475.66252197503/8.0),
+    REAL_CONST(149501.87999799693/8.0),
+    REAL_CONST(149528.0986234796/8.0),
+    REAL_CONST(149554.31839832227/8.0),
+    REAL_CONST(149580.53932242419/8.0),
+    REAL_CONST(149606.76139568459/8.0),
+    REAL_CONST(149632.98461800278/8.0),
+    REAL_CONST(149659.20898927809/8.0),
+    REAL_CONST(149685.43450940982/8.0),
+    REAL_CONST(149711.66117829733/8.0),
+    REAL_CONST(149737.88899584001/8.0),
+    REAL_CONST(149764.11796193724/8.0),
+    REAL_CONST(149790.34807648844/8.0),
+    REAL_CONST(149816.57933939309/8.0),
+    REAL_CONST(149842.81175055061/8.0),
+    REAL_CONST(149869.04530986046/8.0),
+    REAL_CONST(149895.28001722222/8.0),
+    REAL_CONST(149921.51587253538/8.0),
+    REAL_CONST(149947.75287569952/8.0),
+    REAL_CONST(149973.99102661415/8.0),
+    REAL_CONST(150000.23032517891/8.0),
+    REAL_CONST(150026.47077129342/8.0),
+    REAL_CONST(150052.71236485732/8.0),
+    REAL_CONST(150078.95510577026/8.0),
+    REAL_CONST(150105.1989939319/8.0),
+    REAL_CONST(150131.444029242/8.0),
+    REAL_CONST(150157.69021160025/8.0),
+    REAL_CONST(150183.93754090639/8.0),
+    REAL_CONST(150210.18601706024/8.0),
+    REAL_CONST(150236.43563996154/8.0),
+    REAL_CONST(150262.68640951012/8.0),
+    REAL_CONST(150288.93832560582/8.0),
+    REAL_CONST(150315.19138814852/8.0),
+    REAL_CONST(150341.44559703805/8.0),
+    REAL_CONST(150367.70095217437/8.0),
+    REAL_CONST(150393.95745345735/8.0),
+    REAL_CONST(150420.21510078697/8.0),
+    REAL_CONST(150446.47389406321/8.0),
+    REAL_CONST(150472.73383318601/8.0),
+    REAL_CONST(150498.99491805542/8.0),
+    REAL_CONST(150525.25714857146/8.0),
+    REAL_CONST(150551.52052463419/8.0),
+    REAL_CONST(150577.78504614369/8.0),
+    REAL_CONST(150604.05071300003/8.0),
+    REAL_CONST(150630.31752510337/8.0),
+    REAL_CONST(150656.58548235384/8.0),
+    REAL_CONST(150682.85458465159/8.0),
+    REAL_CONST(150709.1248318968/8.0),
+    REAL_CONST(150735.39622398972/8.0),
+    REAL_CONST(150761.66876083051/8.0),
+    REAL_CONST(150787.9424423195/8.0),
+    REAL_CONST(150814.21726835691/8.0),
+    REAL_CONST(150840.49323884305/8.0),
+    REAL_CONST(150866.77035367821/8.0),
+    REAL_CONST(150893.04861276277/8.0),
+    REAL_CONST(150919.32801599705/8.0),
+    REAL_CONST(150945.60856328148/8.0),
+    REAL_CONST(150971.89025451642/8.0),
+    REAL_CONST(150998.17308960229/8.0),
+    REAL_CONST(151024.45706843957/8.0),
+    REAL_CONST(151050.74219092872/8.0),
+    REAL_CONST(151077.02845697021/8.0),
+    REAL_CONST(151103.31586646455/8.0),
+    REAL_CONST(151129.60441931229/8.0),
+    REAL_CONST(151155.894115414/8.0),
+    REAL_CONST(151182.1849546702/8.0),
+    REAL_CONST(151208.47693698155/8.0),
+    REAL_CONST(151234.77006224863/8.0),
+    REAL_CONST(151261.06433037209/8.0),
+    REAL_CONST(151287.35974125259/8.0),
+    REAL_CONST(151313.65629479082/8.0),
+    REAL_CONST(151339.95399088747/8.0),
+    REAL_CONST(151366.25282944329/8.0),
+    REAL_CONST(151392.55281035902/8.0),
+    REAL_CONST(151418.85393353543/8.0),
+    REAL_CONST(151445.1561988733/8.0),
+    REAL_CONST(151471.45960627345/8.0),
+    REAL_CONST(151497.76415563675/8.0),
+    REAL_CONST(151524.06984686397/8.0),
+    REAL_CONST(151550.37667985607/8.0),
+    REAL_CONST(151576.68465451393/8.0),
+    REAL_CONST(151602.99377073845/8.0),
+    REAL_CONST(151629.30402843058/8.0),
+    REAL_CONST(151655.61542749128/8.0),
+    REAL_CONST(151681.92796782157/8.0),
+    REAL_CONST(151708.24164932242/8.0),
+    REAL_CONST(151734.55647189484/8.0),
+    REAL_CONST(151760.87243543993/8.0),
+    REAL_CONST(151787.18953985872/8.0),
+    REAL_CONST(151813.50778505235/8.0),
+    REAL_CONST(151839.82717092187/8.0),
+    REAL_CONST(151866.14769736846/8.0),
+    REAL_CONST(151892.46936429327/8.0),
+    REAL_CONST(151918.79217159748/8.0),
+    REAL_CONST(151945.11611918229/8.0),
+    REAL_CONST(151971.44120694889/8.0),
+    REAL_CONST(151997.76743479856/8.0),
+    REAL_CONST(152024.09480263255/8.0),
+    REAL_CONST(152050.42331035214/8.0),
+    REAL_CONST(152076.75295785864/8.0),
+    REAL_CONST(152103.08374505339/8.0),
+    REAL_CONST(152129.41567183775/8.0),
+    REAL_CONST(152155.74873811303/8.0),
+    REAL_CONST(152182.08294378067/8.0),
+    REAL_CONST(152208.41828874208/8.0),
+    REAL_CONST(152234.75477289871/8.0),
+    REAL_CONST(152261.09239615197/8.0),
+    REAL_CONST(152287.43115840337/8.0),
+    REAL_CONST(152313.77105955439/8.0),
+    REAL_CONST(152340.11209950657/8.0),
+    REAL_CONST(152366.45427816146/8.0),
+    REAL_CONST(152392.79759542056/8.0),
+    REAL_CONST(152419.14205118554/8.0),
+    REAL_CONST(152445.48764535793/8.0),
+    REAL_CONST(152471.8343778394/8.0),
+    REAL_CONST(152498.18224853161/8.0),
+    REAL_CONST(152524.53125733617/8.0),
+    REAL_CONST(152550.88140415482/8.0),
+    REAL_CONST(152577.23268888926/8.0),
+    REAL_CONST(152603.58511144121/8.0),
+    REAL_CONST(152629.93867171241/8.0),
+    REAL_CONST(152656.29336960468/8.0),
+    REAL_CONST(152682.64920501978/8.0),
+    REAL_CONST(152709.00617785956/8.0),
+    REAL_CONST(152735.36428802583/8.0),
+    REAL_CONST(152761.72353542043/8.0),
+    REAL_CONST(152788.08391994529/8.0),
+    REAL_CONST(152814.44544150229/8.0),
+    REAL_CONST(152840.80809999333/8.0),
+    REAL_CONST(152867.17189532038/8.0),
+    REAL_CONST(152893.53682738543/8.0),
+    REAL_CONST(152919.90289609041/8.0),
+    REAL_CONST(152946.27010133737/8.0),
+    REAL_CONST(152972.63844302832/8.0),
+    REAL_CONST(152999.00792106529/8.0),
+    REAL_CONST(153025.37853535041/8.0),
+    REAL_CONST(153051.7502857857/8.0),
+    REAL_CONST(153078.12317227334/8.0),
+    REAL_CONST(153104.4971947154/8.0),
+    REAL_CONST(153130.8723530141/8.0),
+    REAL_CONST(153157.24864707157/8.0),
+    REAL_CONST(153183.62607679001/8.0),
+    REAL_CONST(153210.00464207167/8.0),
+    REAL_CONST(153236.38434281875/8.0),
+    REAL_CONST(153262.76517893354/8.0),
+    REAL_CONST(153289.14715031831/8.0),
+    REAL_CONST(153315.53025687535/8.0),
+    REAL_CONST(153341.91449850702/8.0),
+    REAL_CONST(153368.2998751156/8.0),
+    REAL_CONST(153394.68638660354/8.0),
+    REAL_CONST(153421.07403287315/8.0),
+    REAL_CONST(153447.46281382689/8.0),
+    REAL_CONST(153473.85272936718/8.0),
+    REAL_CONST(153500.24377939643/8.0),
+    REAL_CONST(153526.63596381716/8.0),
+    REAL_CONST(153553.02928253182/8.0),
+    REAL_CONST(153579.42373544298/8.0),
+    REAL_CONST(153605.81932245308/8.0),
+    REAL_CONST(153632.21604346478/8.0),
+    REAL_CONST(153658.61389838057/8.0),
+    REAL_CONST(153685.0128871031/8.0),
+    REAL_CONST(153711.41300953497/8.0),
+    REAL_CONST(153737.81426557881/8.0),
+    REAL_CONST(153764.21665513728/8.0),
+    REAL_CONST(153790.62017811305/8.0),
+    REAL_CONST(153817.02483440886/8.0),
+    REAL_CONST(153843.43062392739/8.0),
+    REAL_CONST(153869.83754657139/8.0),
+    REAL_CONST(153896.24560224367/8.0),
+    REAL_CONST(153922.65479084692/8.0),
+    REAL_CONST(153949.06511228404/8.0),
+    REAL_CONST(153975.4765664578/8.0),
+    REAL_CONST(154001.88915327107/8.0),
+    REAL_CONST(154028.30287262669/8.0),
+    REAL_CONST(154054.71772442761/8.0),
+    REAL_CONST(154081.13370857667/8.0),
+    REAL_CONST(154107.55082497682/8.0),
+    REAL_CONST(154133.96907353101/8.0),
+    REAL_CONST(154160.38845414223/8.0),
+    REAL_CONST(154186.80896671346/8.0),
+    REAL_CONST(154213.23061114774/8.0),
+    REAL_CONST(154239.65338734805/8.0),
+    REAL_CONST(154266.07729521746/8.0),
+    REAL_CONST(154292.50233465908/8.0),
+    REAL_CONST(154318.92850557598/8.0),
+    REAL_CONST(154345.35580787127/8.0),
+    REAL_CONST(154371.7842414481/8.0),
+    REAL_CONST(154398.21380620965/8.0),
+    REAL_CONST(154424.64450205903/8.0),
+    REAL_CONST(154451.07632889951/8.0),
+    REAL_CONST(154477.50928663427/8.0),
+    REAL_CONST(154503.94337516659/8.0),
+    REAL_CONST(154530.37859439969/8.0),
+    REAL_CONST(154556.81494423689/8.0),
+    REAL_CONST(154583.25242458144/8.0),
+    REAL_CONST(154609.69103533673/8.0),
+    REAL_CONST(154636.13077640603/8.0),
+    REAL_CONST(154662.57164769279/8.0),
+    REAL_CONST(154689.01364910032/8.0),
+    REAL_CONST(154715.45678053208/8.0),
+    REAL_CONST(154741.90104189145/8.0),
+    REAL_CONST(154768.34643308193/8.0),
+    REAL_CONST(154794.79295400696/8.0),
+    REAL_CONST(154821.24060457002/8.0),
+    REAL_CONST(154847.68938467462/8.0),
+    REAL_CONST(154874.13929422433/8.0),
+    REAL_CONST(154900.59033312264/8.0),
+    REAL_CONST(154927.04250127316/8.0),
+    REAL_CONST(154953.49579857948/8.0),
+    REAL_CONST(154979.95022494521/8.0),
+    REAL_CONST(155006.40578027396/8.0),
+    REAL_CONST(155032.86246446942/8.0),
+    REAL_CONST(155059.32027743524/8.0),
+    REAL_CONST(155085.77921907514/8.0),
+    REAL_CONST(155112.2392892928/8.0),
+    REAL_CONST(155138.70048799197/8.0),
+    REAL_CONST(155165.16281507642/8.0),
+    REAL_CONST(155191.62627044989/8.0),
+    REAL_CONST(155218.09085401625/8.0),
+    REAL_CONST(155244.55656567923/8.0),
+    REAL_CONST(155271.02340534274/8.0),
+    REAL_CONST(155297.49137291059/8.0),
+    REAL_CONST(155323.96046828668/8.0),
+    REAL_CONST(155350.4306913749/8.0),
+    REAL_CONST(155376.90204207919/8.0),
+    REAL_CONST(155403.37452030348/8.0),
+    REAL_CONST(155429.84812595171/8.0),
+    REAL_CONST(155456.32285892789/8.0),
+    REAL_CONST(155482.79871913602/8.0),
+    REAL_CONST(155509.27570648011/8.0),
+    REAL_CONST(155535.75382086422/8.0),
+    REAL_CONST(155562.23306219239/8.0),
+    REAL_CONST(155588.71343036872/8.0),
+    REAL_CONST(155615.19492529731/8.0),
+    REAL_CONST(155641.67754688227/8.0),
+    REAL_CONST(155668.16129502779/8.0),
+    REAL_CONST(155694.64616963797/8.0),
+    REAL_CONST(155721.13217061706/8.0),
+    REAL_CONST(155747.61929786921/8.0),
+    REAL_CONST(155774.10755129869/8.0),
+    REAL_CONST(155800.59693080973/8.0),
+    REAL_CONST(155827.08743630661/8.0),
+    REAL_CONST(155853.57906769359/8.0),
+    REAL_CONST(155880.07182487496/8.0),
+    REAL_CONST(155906.56570775513/8.0),
+    REAL_CONST(155933.06071623837/8.0),
+    REAL_CONST(155959.55685022907/8.0),
+    REAL_CONST(155986.05410963166/8.0),
+    REAL_CONST(156012.5524943505/8.0),
+    REAL_CONST(156039.05200429002/8.0),
+    REAL_CONST(156065.55263935472/8.0),
+    REAL_CONST(156092.054399449/8.0),
+    REAL_CONST(156118.5572844774/8.0),
+    REAL_CONST(156145.06129434443/8.0),
+    REAL_CONST(156171.5664289546/8.0),
+    REAL_CONST(156198.07268821247/8.0),
+    REAL_CONST(156224.5800720226/8.0),
+    REAL_CONST(156251.08858028959/8.0),
+    REAL_CONST(156277.59821291809/8.0),
+    REAL_CONST(156304.10896981266/8.0),
+    REAL_CONST(156330.62085087801/8.0),
+    REAL_CONST(156357.1338560188/8.0),
+    REAL_CONST(156383.64798513969/8.0),
+    REAL_CONST(156410.16323814544/8.0),
+    REAL_CONST(156436.67961494075/8.0),
+    REAL_CONST(156463.1971154304/8.0),
+    REAL_CONST(156489.71573951913/8.0),
+    REAL_CONST(156516.23548711176/8.0),
+    REAL_CONST(156542.75635811311/8.0),
+    REAL_CONST(156569.27835242799/8.0),
+    REAL_CONST(156595.80146996127/8.0),
+    REAL_CONST(156622.32571061782/8.0),
+    REAL_CONST(156648.85107430254/8.0),
+    REAL_CONST(156675.37756092031/8.0),
+    REAL_CONST(156701.90517037612/8.0),
+    REAL_CONST(156728.43390257491/8.0),
+    REAL_CONST(156754.96375742162/8.0),
+    REAL_CONST(156781.49473482129/8.0),
+    REAL_CONST(156808.02683467892/8.0),
+    REAL_CONST(156834.5600568995/8.0),
+    REAL_CONST(156861.09440138817/8.0),
+    REAL_CONST(156887.62986804993/8.0),
+    REAL_CONST(156914.16645678994/8.0),
+    REAL_CONST(156940.70416751326/8.0),
+    REAL_CONST(156967.24300012505/8.0),
+    REAL_CONST(156993.78295453047/8.0),
+    REAL_CONST(157020.32403063469/8.0),
+    REAL_CONST(157046.8662283429/8.0),
+    REAL_CONST(157073.40954756032/8.0),
+    REAL_CONST(157099.9539881922/8.0),
+    REAL_CONST(157126.49955014378/8.0),
+    REAL_CONST(157153.04623332032/8.0),
+    REAL_CONST(157179.59403762716/8.0),
+    REAL_CONST(157206.14296296958/8.0),
+    REAL_CONST(157232.69300925292/8.0),
+    REAL_CONST(157259.24417638258/8.0),
+    REAL_CONST(157285.79646426387/8.0),
+    REAL_CONST(157312.34987280221/8.0),
+    REAL_CONST(157338.90440190304/8.0),
+    REAL_CONST(157365.46005147175/8.0),
+    REAL_CONST(157392.01682141385/8.0),
+    REAL_CONST(157418.57471163478/8.0),
+    REAL_CONST(157445.13372204005/8.0),
+    REAL_CONST(157471.69385253513/8.0),
+    REAL_CONST(157498.25510302564/8.0),
+    REAL_CONST(157524.81747341706/8.0),
+    REAL_CONST(157551.38096361503/8.0),
+    REAL_CONST(157577.9455735251/8.0),
+    REAL_CONST(157604.51130305286/8.0),
+    REAL_CONST(157631.07815210402/8.0),
+    REAL_CONST(157657.64612058419/8.0),
+    REAL_CONST(157684.21520839902/8.0),
+    REAL_CONST(157710.78541545427/8.0),
+    REAL_CONST(157737.35674165559/8.0),
+    REAL_CONST(157763.92918690876/8.0),
+    REAL_CONST(157790.50275111952/8.0),
+    REAL_CONST(157817.07743419363/8.0),
+    REAL_CONST(157843.65323603692/8.0),
+    REAL_CONST(157870.23015655516/8.0),
+    REAL_CONST(157896.80819565422/8.0),
+    REAL_CONST(157923.3873532399/8.0),
+    REAL_CONST(157949.96762921812/8.0),
+    REAL_CONST(157976.54902349479/8.0),
+    REAL_CONST(158003.13153597576/8.0),
+    REAL_CONST(158029.71516656701/8.0),
+    REAL_CONST(158056.29991517449/8.0),
+    REAL_CONST(158082.88578170416/8.0),
+    REAL_CONST(158109.47276606198/8.0),
+    REAL_CONST(158136.06086815402/8.0),
+    REAL_CONST(158162.65008788629/8.0),
+    REAL_CONST(158189.24042516484/8.0),
+    REAL_CONST(158215.83187989573/8.0),
+    REAL_CONST(158242.42445198505/8.0),
+    REAL_CONST(158269.01814133892/8.0),
+    REAL_CONST(158295.61294786347/8.0),
+    REAL_CONST(158322.20887146486/8.0),
+    REAL_CONST(158348.80591204923/8.0),
+    REAL_CONST(158375.4040695228/8.0),
+    REAL_CONST(158402.00334379176/8.0),
+    REAL_CONST(158428.60373476235/8.0),
+    REAL_CONST(158455.2052423408/8.0),
+    REAL_CONST(158481.80786643337/8.0),
+    REAL_CONST(158508.41160694641/8.0),
+    REAL_CONST(158535.01646378616/8.0),
+    REAL_CONST(158561.62243685898/8.0),
+    REAL_CONST(158588.2295260712/8.0),
+    REAL_CONST(158614.8377313292/8.0),
+    REAL_CONST(158641.44705253936/8.0),
+    REAL_CONST(158668.05748960807/8.0),
+    REAL_CONST(158694.66904244179/8.0),
+    REAL_CONST(158721.28171094693/8.0),
+    REAL_CONST(158747.89549502998/8.0),
+    REAL_CONST(158774.5103945974/8.0),
+    REAL_CONST(158801.12640955573/8.0),
+    REAL_CONST(158827.74353981143/8.0),
+    REAL_CONST(158854.36178527112/8.0),
+    REAL_CONST(158880.9811458413/8.0),
+    REAL_CONST(158907.60162142856/8.0),
+    REAL_CONST(158934.22321193956/8.0),
+    REAL_CONST(158960.84591728085/8.0),
+    REAL_CONST(158987.46973735912/8.0),
+    REAL_CONST(159014.09467208097/8.0),
+    REAL_CONST(159040.72072135314/8.0),
+    REAL_CONST(159067.3478850823/8.0),
+    REAL_CONST(159093.97616317519/8.0),
+    REAL_CONST(159120.60555553852/8.0),
+    REAL_CONST(159147.23606207906/8.0),
+    REAL_CONST(159173.8676827036/8.0),
+    REAL_CONST(159200.50041731889/8.0),
+    REAL_CONST(159227.13426583182/8.0),
+    REAL_CONST(159253.76922814918/8.0),
+    REAL_CONST(159280.40530417781/8.0),
+    REAL_CONST(159307.04249382461/8.0),
+    REAL_CONST(159333.68079699649/8.0),
+    REAL_CONST(159360.32021360032/8.0),
+    REAL_CONST(159386.96074354305/8.0),
+    REAL_CONST(159413.60238673165/8.0),
+    REAL_CONST(159440.24514307309/8.0),
+    REAL_CONST(159466.88901247433/8.0),
+    REAL_CONST(159493.53399484244/8.0),
+    REAL_CONST(159520.18009008438/8.0),
+    REAL_CONST(159546.82729810724/8.0),
+    REAL_CONST(159573.47561881805/8.0),
+    REAL_CONST(159600.12505212394/8.0),
+    REAL_CONST(159626.77559793202/8.0),
+    REAL_CONST(159653.42725614941/8.0),
+    REAL_CONST(159680.08002668325/8.0),
+    REAL_CONST(159706.73390944069/8.0),
+    REAL_CONST(159733.38890432892/8.0),
+    REAL_CONST(159760.04501125516/8.0),
+    REAL_CONST(159786.70223012666/8.0),
+    REAL_CONST(159813.36056085059/8.0),
+    REAL_CONST(159840.02000333427/8.0),
+    REAL_CONST(159866.68055748497/8.0),
+    REAL_CONST(159893.34222320997/8.0),
+    REAL_CONST(159920.00500041663/8.0),
+    REAL_CONST(159946.66888901225/8.0),
+    REAL_CONST(159973.33388890422/8.0),
+    REAL_CONST(159999.99999999988/8.0),
+    REAL_CONST(160026.66722220668/8.0),
+    REAL_CONST(160053.33555543202/8.0),
+    REAL_CONST(160080.0049995833/8.0),
+    REAL_CONST(160106.67555456801/8.0),
+    REAL_CONST(160133.3472202936/8.0),
+    REAL_CONST(160160.0199966676/8.0),
+    REAL_CONST(160186.6938835975/8.0),
+    REAL_CONST(160213.36888099083/8.0),
+    REAL_CONST(160240.04498875517/8.0),
+    REAL_CONST(160266.72220679806/8.0),
+    REAL_CONST(160293.40053502709/8.0),
+    REAL_CONST(160320.07997334987/8.0),
+    REAL_CONST(160346.76052167406/8.0),
+    REAL_CONST(160373.44217990729/8.0),
+    REAL_CONST(160400.1249479572/8.0),
+    REAL_CONST(160426.80882573154/8.0),
+    REAL_CONST(160453.49381313793/8.0),
+    REAL_CONST(160480.17991008417/8.0),
+    REAL_CONST(160506.86711647795/8.0),
+    REAL_CONST(160533.55543222709/8.0),
+    REAL_CONST(160560.24485723933/8.0),
+    REAL_CONST(160586.93539142248/8.0),
+    REAL_CONST(160613.62703468435/8.0),
+    REAL_CONST(160640.31978693281/8.0),
+    REAL_CONST(160667.01364807569/8.0),
+    REAL_CONST(160693.70861802087/8.0),
+    REAL_CONST(160720.40469667627/8.0),
+    REAL_CONST(160747.1018839498/8.0),
+    REAL_CONST(160773.80017974938/8.0),
+    REAL_CONST(160800.49958398298/8.0),
+    REAL_CONST(160827.20009655855/8.0),
+    REAL_CONST(160853.90171738411/8.0),
+    REAL_CONST(160880.60444636765/8.0),
+    REAL_CONST(160907.30828341722/8.0),
+    REAL_CONST(160934.01322844089/8.0),
+    REAL_CONST(160960.71928134665/8.0),
+    REAL_CONST(160987.42644204266/8.0),
+    REAL_CONST(161014.13471043704/8.0),
+    REAL_CONST(161040.84408643784/8.0),
+    REAL_CONST(161067.55456995327/8.0),
+    REAL_CONST(161094.26616089148/8.0),
+    REAL_CONST(161120.97885916062/8.0),
+    REAL_CONST(161147.69266466892/8.0),
+    REAL_CONST(161174.40757732463/8.0),
+    REAL_CONST(161201.12359703594/8.0),
+    REAL_CONST(161227.84072371112/8.0),
+    REAL_CONST(161254.55895725847/8.0),
+    REAL_CONST(161281.27829758628/8.0),
+    REAL_CONST(161307.99874460287/8.0),
+    REAL_CONST(161334.72029821656/8.0),
+    REAL_CONST(161361.44295833571/8.0),
+    REAL_CONST(161388.1667248687/8.0),
+    REAL_CONST(161414.89159772391/8.0),
+    REAL_CONST(161441.61757680977/8.0),
+    REAL_CONST(161468.34466203468/8.0),
+    REAL_CONST(161495.07285330712/8.0),
+    REAL_CONST(161521.80215053557/8.0),
+    REAL_CONST(161548.53255362847/8.0),
+    REAL_CONST(161575.26406249436/8.0),
+    REAL_CONST(161601.99667704175/8.0),
+    REAL_CONST(161628.7303971792/8.0),
+    REAL_CONST(161655.46522281526/8.0),
+    REAL_CONST(161682.20115385848/8.0),
+    REAL_CONST(161708.93819021754/8.0),
+    REAL_CONST(161735.67633180099/8.0),
+    REAL_CONST(161762.41557851751/8.0),
+    REAL_CONST(161789.15593027571/8.0),
+    REAL_CONST(161815.89738698432/8.0),
+    REAL_CONST(161842.63994855201/8.0),
+    REAL_CONST(161869.38361488748/8.0),
+    REAL_CONST(161896.1283858995/8.0),
+    REAL_CONST(161922.87426149679/8.0),
+    REAL_CONST(161949.62124158812/8.0),
+    REAL_CONST(161976.36932608229/8.0),
+    REAL_CONST(162003.1185148881/8.0),
+    REAL_CONST(162029.8688079144/8.0),
+    REAL_CONST(162056.62020507001/8.0),
+    REAL_CONST(162083.37270626382/8.0),
+    REAL_CONST(162110.12631140469/8.0),
+    REAL_CONST(162136.88102040152/8.0),
+    REAL_CONST(162163.63683316324/8.0),
+    REAL_CONST(162190.39374959879/8.0),
+    REAL_CONST(162217.15176961714/8.0),
+    REAL_CONST(162243.91089312723/8.0),
+    REAL_CONST(162270.67112003808/8.0),
+    REAL_CONST(162297.43245025873/8.0),
+    REAL_CONST(162324.19488369819/8.0),
+    REAL_CONST(162350.9584202655/8.0),
+    REAL_CONST(162377.72305986975/8.0),
+    REAL_CONST(162404.48880242003/8.0),
+    REAL_CONST(162431.25564782543/8.0),
+    REAL_CONST(162458.02359599507/8.0),
+    REAL_CONST(162484.79264683815/8.0),
+    REAL_CONST(162511.56280026378/8.0),
+    REAL_CONST(162538.33405618116/8.0),
+    REAL_CONST(162565.10641449949/8.0),
+    REAL_CONST(162591.87987512801/8.0),
+    REAL_CONST(162618.65443797593/8.0),
+    REAL_CONST(162645.43010295252/8.0),
+    REAL_CONST(162672.20686996708/8.0),
+    REAL_CONST(162698.98473892888/8.0),
+    REAL_CONST(162725.76370974723/8.0),
+    REAL_CONST(162752.54378233149/8.0),
+    REAL_CONST(162779.32495659095/8.0),
+    REAL_CONST(162806.10723243505/8.0),
+    REAL_CONST(162832.89060977317/8.0),
+    REAL_CONST(162859.67508851466/8.0),
+    REAL_CONST(162886.46066856899/8.0),
+    REAL_CONST(162913.24734984562/8.0),
+    REAL_CONST(162940.03513225398/8.0),
+    REAL_CONST(162966.82401570358/8.0),
+    REAL_CONST(162993.6140001039/8.0),
+    REAL_CONST(163020.40508536444/8.0),
+    REAL_CONST(163047.19727139481/8.0),
+    REAL_CONST(163073.99055810447/8.0),
+    REAL_CONST(163100.78494540305/8.0),
+    REAL_CONST(163127.58043320014/8.0),
+    REAL_CONST(163154.37702140535/8.0),
+    REAL_CONST(163181.17470992831/8.0),
+    REAL_CONST(163207.97349867865/8.0),
+    REAL_CONST(163234.77338756606/8.0),
+    REAL_CONST(163261.57437650024/8.0),
+    REAL_CONST(163288.37646539087/8.0),
+    REAL_CONST(163315.17965414765/8.0),
+    REAL_CONST(163341.98394268038/8.0),
+    REAL_CONST(163368.78933089875/8.0),
+    REAL_CONST(163395.59581871261/8.0),
+    REAL_CONST(163422.40340603172/8.0),
+    REAL_CONST(163449.2120927659/8.0),
+    REAL_CONST(163476.02187882498/8.0),
+    REAL_CONST(163502.83276411882/8.0),
+    REAL_CONST(163529.6447485573/8.0),
+    REAL_CONST(163556.45783205028/8.0),
+    REAL_CONST(163583.2720145077/8.0),
+    REAL_CONST(163610.08729583945/8.0),
+    REAL_CONST(163636.90367595552/8.0),
+    REAL_CONST(163663.72115476584/8.0),
+    REAL_CONST(163690.53973218042/8.0),
+    REAL_CONST(163717.35940810922/8.0),
+    REAL_CONST(163744.18018246227/8.0),
+    REAL_CONST(163771.00205514964/8.0),
+    REAL_CONST(163797.82502608138/8.0),
+    REAL_CONST(163824.64909516752/8.0),
+    REAL_CONST(163851.4742623182/8.0),
+    REAL_CONST(163878.3005274435/8.0),
+    REAL_CONST(163905.12789045356/8.0),
+    REAL_CONST(163931.95635125853/8.0),
+    REAL_CONST(163958.78590976857/8.0),
+    REAL_CONST(163985.61656589387/8.0),
+    REAL_CONST(164012.44831954464/8.0),
+    REAL_CONST(164039.28117063109/8.0),
+    REAL_CONST(164066.11511906344/8.0),
+    REAL_CONST(164092.95016475199/8.0),
+    REAL_CONST(164119.78630760699/8.0),
+    REAL_CONST(164146.62354753874/8.0),
+    REAL_CONST(164173.46188445756/8.0),
+    REAL_CONST(164200.30131827376/8.0),
+    REAL_CONST(164227.14184889771/8.0),
+    REAL_CONST(164253.98347623978/8.0),
+    REAL_CONST(164280.82620021031/8.0),
+    REAL_CONST(164307.67002071979/8.0),
+    REAL_CONST(164334.51493767856/8.0),
+    REAL_CONST(164361.3609509971/8.0),
+    REAL_CONST(164388.20806058586/8.0),
+    REAL_CONST(164415.05626635533/8.0),
+    REAL_CONST(164441.905568216/8.0),
+    REAL_CONST(164468.75596607837/8.0),
+    REAL_CONST(164495.607459853/8.0),
+    REAL_CONST(164522.4600494504/8.0),
+    REAL_CONST(164549.31373478117/8.0),
+    REAL_CONST(164576.16851575591/8.0),
+    REAL_CONST(164603.02439228518/8.0),
+    REAL_CONST(164629.88136427966/8.0),
+    REAL_CONST(164656.73943164994/8.0),
+    REAL_CONST(164683.59859430668/8.0),
+    REAL_CONST(164710.45885216061/8.0),
+    REAL_CONST(164737.32020512238/8.0),
+    REAL_CONST(164764.1826531027/8.0),
+    REAL_CONST(164791.04619601235/8.0),
+    REAL_CONST(164817.91083376206/8.0),
+    REAL_CONST(164844.77656626256/8.0),
+    REAL_CONST(164871.64339342469/8.0),
+    REAL_CONST(164898.51131515924/8.0),
+    REAL_CONST(164925.38033137703/8.0),
+    REAL_CONST(164952.25044198887/8.0),
+    REAL_CONST(164979.1216469057/8.0),
+    REAL_CONST(165005.9939460383/8.0),
+    REAL_CONST(165032.86733929763/8.0),
+    REAL_CONST(165059.7418265946/8.0),
+    REAL_CONST(165086.61740784015/8.0),
+    REAL_CONST(165113.4940829452/8.0)
+#endif
 };
 
 #endif
--- a/Plugins/Input/aac/libfaad2/is.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/is.c	Wed May 10 14:44:20 2006 -0700
@@ -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.20 2004/01/16 20:20:32 menno Exp $
+** $Id: is.c,v 1.24 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -66,12 +66,14 @@
             {
                 if (is_intensity(icsr, g, sfb))
                 {
+#ifdef MAIN_DEC
                     /* For scalefactor bands coded in intensity stereo the
                        corresponding predictors in the right channel are
                        switched to "off".
                      */
                     ics->pred.prediction_used[sfb] = 0;
                     icsr->pred.prediction_used[sfb] = 0;
+#endif
 
 #ifndef FIXED_POINT
                     scale = (real_t)pow(0.5, (0.25*icsr->scale_factors[g][sfb]));
--- a/Plugins/Input/aac/libfaad2/is.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/is.h	Wed May 10 14:44:20 2006 -0700
@@ -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.13 2004/01/05 14:05:12 menno Exp $
+** $Id: is.h,v 1.16 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __IS_H__
--- a/Plugins/Input/aac/libfaad2/kbd_win.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/kbd_win.h	Wed May 10 14:44:20 2006 -0700
@@ -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.13 2004/01/05 14:05:12 menno Exp $
+** $Id: kbd_win.h,v 1.17 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __KBD_WIN_H__
--- a/Plugins/Input/aac/libfaad2/lt_predict.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/lt_predict.c	Wed May 10 14:44:20 2006 -0700
@@ -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.20 2004/01/05 14:05:12 menno Exp $
+** $Id: lt_predict.c,v 1.23 2004/09/04 14:56:28 menno Exp $
 **/
 
 
--- a/Plugins/Input/aac/libfaad2/lt_predict.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/lt_predict.h	Wed May 10 14:44:20 2006 -0700
@@ -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.13 2004/01/05 14:05:12 menno Exp $
+** $Id: lt_predict.h,v 1.16 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifdef LTP_DEC
--- a/Plugins/Input/aac/libfaad2/mdct.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/mdct.c	Wed May 10 14:44:20 2006 -0700
@@ -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.37 2004/01/05 14:05:12 menno Exp $
+** $Id: mdct.c,v 1.43 2004/09/04 14:56:28 menno Exp $
 **/
 
 /*
@@ -53,139 +53,40 @@
 
 #include "cfft.h"
 #include "mdct.h"
+#include "mdct_tab.h"
 
-/* const_tab[]:
-    0: sqrt(2 / N)
-    1: cos(2 * PI / N)
-    2: sin(2 * PI / N)
-    3: cos(2 * PI * (1/8) / N)
-    4: sin(2 * PI * (1/8) / N)
- */
-#ifdef FIXED_POINT
-real_t const_tab[][5] =
-{
-    {    /* 2048 */
-        COEF_CONST(1),
-        FRAC_CONST(0.99999529380957619),
-        FRAC_CONST(0.0030679567629659761),
-        FRAC_CONST(0.99999992646571789),
-        FRAC_CONST(0.00038349518757139556)
-    }, { /* 1920 */
-        COEF_CONST(/* sqrt(1024/960) */ 1.0327955589886444),
-        FRAC_CONST(0.99999464540169647),
-        FRAC_CONST(0.0032724865065266251),
-        FRAC_CONST(0.99999991633432805),
-        FRAC_CONST(0.00040906153202803459)
-    }, { /* 1024 */
-        COEF_CONST(1),
-        FRAC_CONST(0.99998117528260111),
-        FRAC_CONST(0.0061358846491544753),
-        FRAC_CONST(0.99999970586288223),
-        FRAC_CONST(0.00076699031874270449)
-    }, { /* 960 */
-        COEF_CONST(/* sqrt(512/480) */ 1.0327955589886444),
-        FRAC_CONST(0.99997858166412923),
-        FRAC_CONST(0.0065449379673518581),
-        FRAC_CONST(0.99999966533732598),
-        FRAC_CONST(0.00081812299560725323)
-    }, { /* 256 */
-        COEF_CONST(1),
-        FRAC_CONST(0.99969881869620425),
-        FRAC_CONST(0.024541228522912288),
-        FRAC_CONST(0.99999529380957619),
-        FRAC_CONST(0.0030679567629659761)
-    }, {  /* 240 */
-        COEF_CONST(/* sqrt(256/240) */ 1.0327955589886444),
-        FRAC_CONST(0.99965732497555726),
-        FRAC_CONST(0.026176948307873149),
-        FRAC_CONST(0.99999464540169647),
-        FRAC_CONST(0.0032724865065266251)
-    }
-#ifdef SSR_DEC
-    ,{   /* 512 */
-        COEF_CONST(1),
-        FRAC_CONST(0.9999247018391445),
-        FRAC_CONST(0.012271538285719925),
-        FRAC_CONST(0.99999882345170188),
-        FRAC_CONST(0.0015339801862847655)
-    }, { /* 64 */
-        COEF_CONST(1),
-        FRAC_CONST(0.99518472667219693),
-        FRAC_CONST(0.098017140329560604),
-        FRAC_CONST(0.9999247018391445),
-        FRAC_CONST(0.012271538285719925)
-    }
-#endif
-};
-#endif
-
-#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 */
-    /* index 0 and 4 will be used */
-    switch(N)
-    {
-    case 2048: return 0;
-    case 1920: return 1;
-    case 1024: return 2;
-    case 960:  return 3;
-    case 256:  return 4;
-    case 240:  return 5;
-#ifdef SSR_DEC
-    case 512:  return 6;
-    case 64:   return 7;
-#endif
-    }
-    return 0;
-}
-#endif
 
 mdct_info *faad_mdct_init(uint16_t N)
 {
-    uint16_t k;
-#ifdef FIXED_POINT
-    uint16_t N_idx;
-    real_t cangle, sangle, c, s, cold;
-#endif
-	real_t scale;
-
     mdct_info *mdct = (mdct_info*)faad_malloc(sizeof(mdct_info));
 
     assert(N % 8 == 0);
 
     mdct->N = N;
-    mdct->sincos = (complex_t*)faad_malloc(N/4*sizeof(complex_t));
 
-#ifdef FIXED_POINT
-    N_idx = map_N_to_idx(N);
-
-    scale = const_tab[N_idx][0];
-    cangle = const_tab[N_idx][1];
-    sangle = const_tab[N_idx][2];
-    c = const_tab[N_idx][3];
-    s = const_tab[N_idx][4];
-#else
-    scale = (real_t)sqrt(2.0 / (real_t)N);
-#endif
+    /* NOTE: For "small framelengths" in FIXED_POINT the coefficients need to be
+     * scaled by sqrt("(nearest power of 2) > N" / N) */
 
-    /* (co)sine table build using recurrence relations */
-    /* this can also be done using static table lookup or */
-    /* some form of interpolation */
-    for (k = 0; k < N/4; k++)
+    /* RE(mdct->sincos[k]) = scale*(real_t)(cos(2.0*M_PI*(k+1./8.) / (real_t)N));
+     * IM(mdct->sincos[k]) = scale*(real_t)(sin(2.0*M_PI*(k+1./8.) / (real_t)N)); */
+    /* scale is 1 for fixed point, sqrt(N) for floating point */
+    switch (N)
     {
-#ifdef FIXED_POINT
-        RE(mdct->sincos[k]) = c; //MUL_C_C(c,scale);
-        IM(mdct->sincos[k]) = s; //MUL_C_C(s,scale);
-
-        cold = c;
-        c = MUL_F(c,cangle) - MUL_F(s,sangle);
-        s = MUL_F(s,cangle) + MUL_F(cold,sangle);
-#else
-        /* no recurrence, just sines */
-        RE(mdct->sincos[k]) = scale*(real_t)(cos(2.0*M_PI*(k+1./8.) / (real_t)N));
-        IM(mdct->sincos[k]) = scale*(real_t)(sin(2.0*M_PI*(k+1./8.) / (real_t)N));
+    case 2048: mdct->sincos = (complex_t*)mdct_tab_2048; break;
+    case 256:  mdct->sincos = (complex_t*)mdct_tab_256;  break;
+#ifdef LD_DEC
+    case 1024: mdct->sincos = (complex_t*)mdct_tab_1024; break;
+#endif
+#ifdef ALLOW_SMALL_FRAMELENGTH
+    case 1920: mdct->sincos = (complex_t*)mdct_tab_1920; break;
+    case 240:  mdct->sincos = (complex_t*)mdct_tab_240;  break;
+#ifdef LD_DEC
+    case 960:  mdct->sincos = (complex_t*)mdct_tab_960;  break;
+#endif
+#endif
+#ifdef SSR_DEC
+    case 512:  mdct->sincos = (complex_t*)mdct_tab_512;  break;
+    case 64:   mdct->sincos = (complex_t*)mdct_tab_64;   break;
 #endif
     }
 
@@ -211,8 +112,6 @@
 
         cfftu(mdct->cfft);
 
-        if (mdct->sincos) faad_free(mdct->sincos);
-
         faad_free(mdct);
     }
 }
@@ -222,6 +121,11 @@
     uint16_t k;
 
     complex_t x;
+#ifdef ALLOW_SMALL_FRAMELENGTH
+#ifdef FIXED_POINT
+    real_t scale, b_scale = 0;
+#endif
+#endif
     ALIGN complex_t Z1[512];
     complex_t *sincos = mdct->sincos;
 
@@ -234,6 +138,19 @@
     int64_t count1, count2 = faad_get_ts();
 #endif
 
+#ifdef ALLOW_SMALL_FRAMELENGTH
+#ifdef FIXED_POINT
+    /* detect non-power of 2 */
+    if (N & (N-1))
+    {
+        /* adjust scale for non-power of 2 MDCT */
+        /* 2048/1920 */
+        b_scale = 1;
+        scale = COEF_CONST(1.0666666666666667);
+    }
+#endif
+#endif
+
     /* pre-IFFT complex multiplication */
     for (k = 0; k < N4; k++)
     {
@@ -259,6 +176,17 @@
         IM(x) = IM(Z1[k]);
         ComplexMult(&IM(Z1[k]), &RE(Z1[k]),
             IM(x), RE(x), RE(sincos[k]), IM(sincos[k]));
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+#ifdef FIXED_POINT
+        /* non-power of 2 MDCT scaling */
+        if (b_scale)
+        {
+            RE(Z1[k]) = MUL_C(RE(Z1[k]), scale);
+            IM(Z1[k]) = MUL_C(IM(Z1[k]), scale);
+        }
+#endif
+#endif
     }
 
     /* reordering */
@@ -296,166 +224,6 @@
 #endif
 }
 
-#ifdef USE_SSE
-void faad_imdct_sse(mdct_info *mdct, real_t *X_in, real_t *X_out)
-{
-    uint16_t k;
-
-    ALIGN complex_t Z1[512];
-    complex_t *sincos = mdct->sincos;
-
-    uint16_t N  = mdct->N;
-    uint16_t N2 = N >> 1;
-    uint16_t N4 = N >> 2;
-    uint16_t N8 = N >> 3;
-
-#ifdef PROFILE
-    int64_t count1, count2 = faad_get_ts();
-#endif
-
-    /* pre-IFFT complex multiplication */
-    for (k = 0; k < N4; k+=4)
-    {
-        __m128 m12, m13, m14, m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11;
-        __m128 n12, n13, n14, n0, n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11;
-        n12 = _mm_load_ps(&X_in[N2 - 2*k - 8]);
-        m12 = _mm_load_ps(&X_in[N2 - 2*k - 4]);
-        m13 = _mm_load_ps(&X_in[2*k]);
-        n13 = _mm_load_ps(&X_in[2*k + 4]);
-        m1 = _mm_load_ps(&RE(sincos[k]));
-        n1 = _mm_load_ps(&RE(sincos[k+2]));
-
-        m0 = _mm_shuffle_ps(m12, m13, _MM_SHUFFLE(2,0,1,3));
-        m2 = _mm_shuffle_ps(m1, m1, _MM_SHUFFLE(2,3,0,1));
-        m14 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(3,1,2,0));
-        n0 = _mm_shuffle_ps(n12, n13, _MM_SHUFFLE(2,0,1,3));
-        n2 = _mm_shuffle_ps(n1, n1, _MM_SHUFFLE(2,3,0,1));
-        n14 = _mm_shuffle_ps(n0, n0, _MM_SHUFFLE(3,1,2,0));
-
-        m3 = _mm_mul_ps(m14, m1);
-        n3 = _mm_mul_ps(n14, n1);
-        m4 = _mm_mul_ps(m14, m2);
-        n4 = _mm_mul_ps(n14, n2);
-
-        m5 = _mm_shuffle_ps(m3, m4, _MM_SHUFFLE(2,0,2,0));
-        n5 = _mm_shuffle_ps(n3, n4, _MM_SHUFFLE(2,0,2,0));
-        m6 = _mm_shuffle_ps(m3, m4, _MM_SHUFFLE(3,1,3,1));
-        n6 = _mm_shuffle_ps(n3, n4, _MM_SHUFFLE(3,1,3,1));
-
-        m7 = _mm_add_ps(m5, m6);
-        n7 = _mm_add_ps(n5, n6);
-        m8 = _mm_sub_ps(m5, m6);
-        n8 = _mm_sub_ps(n5, n6);
-
-        m9 = _mm_shuffle_ps(m7, m7, _MM_SHUFFLE(3,2,3,2));
-        n9 = _mm_shuffle_ps(n7, n7, _MM_SHUFFLE(3,2,3,2));
-        m10 = _mm_shuffle_ps(m8, m8, _MM_SHUFFLE(1,0,1,0));
-        n10 = _mm_shuffle_ps(n8, n8, _MM_SHUFFLE(1,0,1,0));
-
-        m11 = _mm_unpacklo_ps(m10, m9);
-        n11 = _mm_unpacklo_ps(n10, n9);
-
-        _mm_store_ps(&RE(Z1[k]), m11);
-        _mm_store_ps(&RE(Z1[k+2]), n11);
-    }
-
-#ifdef PROFILE
-    count1 = faad_get_ts();
-#endif
-
-    /* complex IFFT, any non-scaling FFT can be used here */
-    cfftb_sse(mdct->cfft, Z1);
-
-#ifdef PROFILE
-    count1 = faad_get_ts() - count1;
-#endif
-
-    /* post-IFFT complex multiplication */
-    for (k = 0; k < N4; k+=4)
-    {
-        __m128 m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11;
-        __m128 n0, n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11;
-        m0 = _mm_load_ps(&RE(Z1[k]));
-        n0 = _mm_load_ps(&RE(Z1[k+2]));
-        m1 = _mm_load_ps(&RE(sincos[k]));
-        n1 = _mm_load_ps(&RE(sincos[k+2]));
-
-        m2 = _mm_shuffle_ps(m1, m1, _MM_SHUFFLE(2,3,0,1));
-        n2 = _mm_shuffle_ps(n1, n1, _MM_SHUFFLE(2,3,0,1));
-
-        m3 = _mm_mul_ps(m0, m1);
-        n3 = _mm_mul_ps(n0, n1);
-        m4 = _mm_mul_ps(m0, m2);
-        n4 = _mm_mul_ps(n0, n2);
-
-        m5 = _mm_shuffle_ps(m3, m4, _MM_SHUFFLE(2,0,2,0));
-        n5 = _mm_shuffle_ps(n3, n4, _MM_SHUFFLE(2,0,2,0));
-        m6 = _mm_shuffle_ps(m3, m4, _MM_SHUFFLE(3,1,3,1));
-        n6 = _mm_shuffle_ps(n3, n4, _MM_SHUFFLE(3,1,3,1));
-
-        m7 = _mm_add_ps(m5, m6);
-        n7 = _mm_add_ps(n5, n6);
-        m8 = _mm_sub_ps(m5, m6);
-        n8 = _mm_sub_ps(n5, n6);
-
-        m9 = _mm_shuffle_ps(m7, m7, _MM_SHUFFLE(3,2,3,2));
-        n9 = _mm_shuffle_ps(n7, n7, _MM_SHUFFLE(3,2,3,2));
-        m10 = _mm_shuffle_ps(m8, m8, _MM_SHUFFLE(1,0,1,0));
-        n10 = _mm_shuffle_ps(n8, n8, _MM_SHUFFLE(1,0,1,0));
-
-        m11 = _mm_unpacklo_ps(m10, m9);
-        n11 = _mm_unpacklo_ps(n10, n9);
-
-        _mm_store_ps(&RE(Z1[k]), m11);
-        _mm_store_ps(&RE(Z1[k+2]), n11);
-    }
-
-    /* reordering */
-    for (k = 0; k < N8; k+=2)
-    {
-        __m128 m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m13;
-        __m128 n4, n5, n6, n7, n8, n9;
-        __m128 neg1 = _mm_set_ps(-1.0,  1.0, -1.0,  1.0);
-        __m128 neg2 = _mm_set_ps(-1.0, -1.0, -1.0, -1.0);
-
-        m0 = _mm_load_ps(&RE(Z1[k]));
-        m1 = _mm_load_ps(&RE(Z1[N8 - 2 - k]));
-        m2 = _mm_load_ps(&RE(Z1[N8 + k]));
-        m3 = _mm_load_ps(&RE(Z1[N4 - 2 - k]));
-
-        m10 = _mm_mul_ps(m0, neg1);
-        m11 = _mm_mul_ps(m1, neg2);
-        m13 = _mm_mul_ps(m3, neg1);
-
-        m5 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(3,1,2,0));
-        n4 = _mm_shuffle_ps(m10, m10, _MM_SHUFFLE(3,1,2,0));
-        m4 = _mm_shuffle_ps(m11, m11, _MM_SHUFFLE(3,1,2,0));
-        n5 = _mm_shuffle_ps(m13, m13, _MM_SHUFFLE(3,1,2,0));
-
-        m6 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(3,2,1,0));
-        n6 = _mm_shuffle_ps(n4, n5, _MM_SHUFFLE(3,2,1,0));
-        m7 = _mm_shuffle_ps(m5, m4, _MM_SHUFFLE(3,2,1,0));
-        n7 = _mm_shuffle_ps(n5, n4, _MM_SHUFFLE(3,2,1,0));
-
-        m8 = _mm_shuffle_ps(m6, m6, _MM_SHUFFLE(0,3,1,2));
-        n8 = _mm_shuffle_ps(n6, n6, _MM_SHUFFLE(2,1,3,0));
-        m9 = _mm_shuffle_ps(m7, m7, _MM_SHUFFLE(2,1,3,0));
-        n9 = _mm_shuffle_ps(n7, n7, _MM_SHUFFLE(0,3,1,2));
-
-        _mm_store_ps(&X_out[2*k], m8);
-        _mm_store_ps(&X_out[N4 + 2*k], n8);
-        _mm_store_ps(&X_out[N2 + 2*k], m9);
-        _mm_store_ps(&X_out[N2 + N4 + 2*k], n9);
-    }
-
-#ifdef PROFILE
-    count2 = faad_get_ts() - count2;
-    mdct->fft_cycles += count1;
-    mdct->cycles += (count2 - count1);
-#endif
-}
-#endif
-
 #ifdef LTP_DEC
 void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
 {
@@ -476,6 +244,18 @@
 	real_t scale = REAL_CONST(4.0/N);
 #endif
 
+#ifdef ALLOW_SMALL_FRAMELENGTH
+#ifdef FIXED_POINT
+    /* detect non-power of 2 */
+    if (N & (N-1))
+    {
+        /* adjust scale for non-power of 2 MDCT */
+        /* *= sqrt(2048/1920) */
+        scale = MUL_C(scale, COEF_CONST(1.0327955589886444));
+    }
+#endif
+#endif
+
     /* pre-FFT complex multiplication */
     for (k = 0; k < N8; k++)
     {
--- a/Plugins/Input/aac/libfaad2/mdct.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/mdct.h	Wed May 10 14:44:20 2006 -0700
@@ -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.22 2004/01/05 14:05:12 menno Exp $
+** $Id: mdct.h,v 1.26 2004/09/08 09:43:11 gcp Exp $
 **/
 
 #ifndef __MDCT_H__
@@ -36,9 +36,6 @@
 mdct_info *faad_mdct_init(uint16_t N);
 void faad_mdct_end(mdct_info *mdct);
 void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out);
-#ifdef USE_SSE
-void faad_imdct_sse(mdct_info *mdct, real_t *X_in, real_t *X_out);
-#endif
 void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out);
 
 
--- a/Plugins/Input/aac/libfaad2/mp4.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/mp4.c	Wed May 10 14:44:20 2006 -0700
@@ -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.26 2004/01/05 14:05:12 menno Exp $
+** $Id: mp4.c,v 1.32 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -119,17 +119,17 @@
 };
 
 /* Table 1.6.1 */
-int8_t FAADAPI AudioSpecificConfig(uint8_t *pBuffer,
-                                   uint32_t buffer_size,
-                                   mp4AudioSpecificConfig *mp4ASC)
+int8_t NEAACDECAPI NeAACDecAudioSpecificConfig(uint8_t *pBuffer,
+                                               uint32_t buffer_size,
+                                               mp4AudioSpecificConfig *mp4ASC)
 {
     return AudioSpecificConfig2(pBuffer, buffer_size, mp4ASC, NULL);
 }
 
-int8_t FAADAPI AudioSpecificConfig2(uint8_t *pBuffer,
-                                    uint32_t buffer_size,
-                                    mp4AudioSpecificConfig *mp4ASC,
-                                    program_config *pce)
+int8_t AudioSpecificConfig2(uint8_t *pBuffer,
+                            uint32_t buffer_size,
+                            mp4AudioSpecificConfig *mp4ASC,
+                            program_config *pce)
 {
     bitfile ld;
     int8_t result = 0;
@@ -176,13 +176,28 @@
         return -3;
     }
 
+#if (defined(PS_DEC) || defined(DRM_PS))
+    /* check if we have a mono file */
+    if (mp4ASC->channelsConfiguration == 1)
+    {
+        /* upMatrix to 2 channels for implicit signalling of PS */
+        mp4ASC->channelsConfiguration = 2;
+    }
+#endif
+
 #ifdef SBR_DEC
     mp4ASC->sbr_present_flag = -1;
     if (mp4ASC->objectTypeIndex == 5)
     {
+        uint8_t tmp;
+
         mp4ASC->sbr_present_flag = 1;
-        mp4ASC->samplingFrequencyIndex = (uint8_t)faad_getbits(&ld, 4
+        tmp = (uint8_t)faad_getbits(&ld, 4
             DEBUGVAR(1,5,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
+        /* check for downsampled SBR */
+        if (tmp == mp4ASC->samplingFrequencyIndex)
+            mp4ASC->downSampledSBR = 1;
+        mp4ASC->samplingFrequencyIndex = tmp;
         if (mp4ASC->samplingFrequencyIndex == 15)
         {
             mp4ASC->samplingFrequency = (uint32_t)faad_getbits(&ld, 24
@@ -243,8 +258,15 @@
 
                 if (mp4ASC->sbr_present_flag)
                 {
-                    mp4ASC->samplingFrequencyIndex = (uint8_t)faad_getbits(&ld, 4
+                    uint8_t tmp;
+                    tmp = (uint8_t)faad_getbits(&ld, 4
                         DEBUGVAR(1,12,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
+
+                    /* check for downsampled SBR */
+                    if (tmp == mp4ASC->samplingFrequencyIndex)
+                        mp4ASC->downSampledSBR = 1;
+                    mp4ASC->samplingFrequencyIndex = tmp;
+
                     if (mp4ASC->samplingFrequencyIndex == 15)
                     {
                         mp4ASC->samplingFrequency = (uint32_t)faad_getbits(&ld, 24
@@ -265,6 +287,8 @@
         {
             mp4ASC->samplingFrequency *= 2;
             mp4ASC->forceUpSampling = 1;
+        } else /* > 24000*/ {
+            mp4ASC->downSampledSBR = 1;
         }
     }
 #endif
--- a/Plugins/Input/aac/libfaad2/mp4.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/mp4.h	Wed May 10 14:44:20 2006 -0700
@@ -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.17 2004/01/05 14:05:12 menno Exp $
+** $Id: mp4.h,v 1.21 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __MP4_H__
@@ -34,14 +34,14 @@
 
 #include "decoder.h"
 
-int8_t FAADAPI AudioSpecificConfig(uint8_t *pBuffer,
-                                   uint32_t buffer_size,
-                                   mp4AudioSpecificConfig *mp4ASC);
+int8_t NEAACDECAPI NeAACDecAudioSpecificConfig(uint8_t *pBuffer,
+                                               uint32_t buffer_size,
+                                               mp4AudioSpecificConfig *mp4ASC);
 
-int8_t FAADAPI AudioSpecificConfig2(uint8_t *pBuffer,
-                                    uint32_t buffer_size,
-                                    mp4AudioSpecificConfig *mp4ASC,
-                                    program_config *pce);
+int8_t AudioSpecificConfig2(uint8_t *pBuffer,
+                            uint32_t buffer_size,
+                            mp4AudioSpecificConfig *mp4ASC,
+                            program_config *pce);
 
 #ifdef __cplusplus
 }
--- a/Plugins/Input/aac/libfaad2/ms.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/ms.c	Wed May 10 14:44:20 2006 -0700
@@ -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.13 2004/01/05 14:05:12 menno Exp $
+** $Id: ms.c,v 1.17 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
--- a/Plugins/Input/aac/libfaad2/ms.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/ms.h	Wed May 10 14:44:20 2006 -0700
@@ -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.12 2004/01/05 14:05:12 menno Exp $
+** $Id: ms.h,v 1.15 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __MS_H__
--- a/Plugins/Input/aac/libfaad2/output.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/output.c	Wed May 10 14:44:20 2006 -0700
@@ -1,19 +1,19 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
 ** Copyright (C) 2003 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
 ** the Free Software Foundation; either version 2 of the License, or
 ** (at your option) any later version.
-** 
+**
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ** GNU General Public License for more details.
-** 
+**
 ** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software 
+** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
 ** Any non-GPL usage of this software or parts of this software is strictly
@@ -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.c,v 1.34 2004/01/28 19:17:26 menno Exp $
+** $Id: output.c,v 1.42 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -84,7 +84,7 @@
 
 #define CONV(a,b) ((a<<1)|(b&0x1))
 
-static void to_PCM_16bit(faacDecHandle hDecoder, real_t **input,
+static void to_PCM_16bit(NeAACDecHandle hDecoder, real_t **input,
                          uint8_t channels, uint16_t frame_len,
                          int16_t **sample_buffer)
 {
@@ -105,18 +105,32 @@
         }
         break;
     case CONV(2,0):
-        ch  = hDecoder->internal_channel[0];
-        ch1 = hDecoder->internal_channel[1];
-        for(i = 0; i < frame_len; i++)
+        if (hDecoder->upMatrix)
         {
-            real_t inp0 = input[ch ][i];
-            real_t inp1 = input[ch1][i];
+            ch  = hDecoder->internal_channel[0];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch][i];
+
+                CLIP(inp0, 32767.0f, -32768.0f);
 
-            CLIP(inp0, 32767.0f, -32768.0f);
-            CLIP(inp1, 32767.0f, -32768.0f);
+                (*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp0);
+            }
+        } else {
+            ch  = hDecoder->internal_channel[0];
+            ch1 = hDecoder->internal_channel[1];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch ][i];
+                real_t inp1 = input[ch1][i];
 
-            (*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0);
-            (*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp1);
+                CLIP(inp0, 32767.0f, -32768.0f);
+                CLIP(inp1, 32767.0f, -32768.0f);
+
+                (*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp1);
+            }
         }
         break;
     default:
@@ -135,7 +149,7 @@
     }
 }
 
-static void to_PCM_24bit(faacDecHandle hDecoder, real_t **input,
+static void to_PCM_24bit(NeAACDecHandle hDecoder, real_t **input,
                          uint8_t channels, uint16_t frame_len,
                          int32_t **sample_buffer)
 {
@@ -157,20 +171,35 @@
         }
         break;
     case CONV(2,0):
-        ch  = hDecoder->internal_channel[0];
-        ch1 = hDecoder->internal_channel[1];
-        for(i = 0; i < frame_len; i++)
+        if (hDecoder->upMatrix)
         {
-            real_t inp0 = input[ch ][i];
-            real_t inp1 = input[ch1][i];
+            ch = hDecoder->internal_channel[0];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch][i];
+
+                inp0 *= 256.0f;
+                CLIP(inp0, 8388607.0f, -8388608.0f);
 
-            inp0 *= 256.0f;
-            inp1 *= 256.0f;
-            CLIP(inp0, 8388607.0f, -8388608.0f);
-            CLIP(inp1, 8388607.0f, -8388608.0f);
+                (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0);
+            }
+        } else {
+            ch  = hDecoder->internal_channel[0];
+            ch1 = hDecoder->internal_channel[1];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch ][i];
+                real_t inp1 = input[ch1][i];
 
-            (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
-            (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1);
+                inp0 *= 256.0f;
+                inp1 *= 256.0f;
+                CLIP(inp0, 8388607.0f, -8388608.0f);
+                CLIP(inp1, 8388607.0f, -8388608.0f);
+
+                (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1);
+            }
         }
         break;
     default:
@@ -190,7 +219,7 @@
     }
 }
 
-static void to_PCM_32bit(faacDecHandle hDecoder, real_t **input,
+static void to_PCM_32bit(NeAACDecHandle hDecoder, real_t **input,
                          uint8_t channels, uint16_t frame_len,
                          int32_t **sample_buffer)
 {
@@ -212,20 +241,35 @@
         }
         break;
     case CONV(2,0):
-        ch  = hDecoder->internal_channel[0];
-        ch1 = hDecoder->internal_channel[1];
-        for(i = 0; i < frame_len; i++)
+        if (hDecoder->upMatrix)
         {
-            real_t inp0 = input[ch ][i];
-            real_t inp1 = input[ch1][i];
+            ch = hDecoder->internal_channel[0];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch][i];
+
+                inp0 *= 65536.0f;
+                CLIP(inp0, 2147483647.0f, -2147483648.0f);
 
-            inp0 *= 65536.0f;
-            inp1 *= 65536.0f;
-            CLIP(inp0, 2147483647.0f, -2147483648.0f);
-            CLIP(inp1, 2147483647.0f, -2147483648.0f);
+                (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0);
+            }
+        } else {
+            ch  = hDecoder->internal_channel[0];
+            ch1 = hDecoder->internal_channel[1];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch ][i];
+                real_t inp1 = input[ch1][i];
 
-            (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
-            (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1);
+                inp0 *= 65536.0f;
+                inp1 *= 65536.0f;
+                CLIP(inp0, 2147483647.0f, -2147483648.0f);
+                CLIP(inp1, 2147483647.0f, -2147483648.0f);
+
+                (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1);
+            }
         }
         break;
     default:
@@ -245,7 +289,7 @@
     }
 }
 
-static void to_PCM_float(faacDecHandle hDecoder, real_t **input,
+static void to_PCM_float(NeAACDecHandle hDecoder, real_t **input,
                          uint8_t channels, uint16_t frame_len,
                          float32_t **sample_buffer)
 {
@@ -263,14 +307,25 @@
         }
         break;
     case CONV(2,0):
-        ch  = hDecoder->internal_channel[0];
-        ch1 = hDecoder->internal_channel[1];
-        for(i = 0; i < frame_len; i++)
+        if (hDecoder->upMatrix)
         {
-            real_t inp0 = input[ch ][i];
-            real_t inp1 = input[ch1][i];
-            (*sample_buffer)[(i*2)+0] = inp0*FLOAT_SCALE;
-            (*sample_buffer)[(i*2)+1] = inp1*FLOAT_SCALE;
+            ch = hDecoder->internal_channel[0];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch][i];
+                (*sample_buffer)[(i*2)+0] = inp0*FLOAT_SCALE;
+                (*sample_buffer)[(i*2)+1] = inp0*FLOAT_SCALE;
+            }
+        } else {
+            ch  = hDecoder->internal_channel[0];
+            ch1 = hDecoder->internal_channel[1];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch ][i];
+                real_t inp1 = input[ch1][i];
+                (*sample_buffer)[(i*2)+0] = inp0*FLOAT_SCALE;
+                (*sample_buffer)[(i*2)+1] = inp1*FLOAT_SCALE;
+            }
         }
         break;
     default:
@@ -286,7 +341,7 @@
     }
 }
 
-static void to_PCM_double(faacDecHandle hDecoder, real_t **input,
+static void to_PCM_double(NeAACDecHandle hDecoder, real_t **input,
                           uint8_t channels, uint16_t frame_len,
                           double **sample_buffer)
 {
@@ -304,14 +359,25 @@
         }
         break;
     case CONV(2,0):
-        ch  = hDecoder->internal_channel[0];
-        ch1 = hDecoder->internal_channel[1];
-        for(i = 0; i < frame_len; i++)
+        if (hDecoder->upMatrix)
         {
-            real_t inp0 = input[ch ][i];
-            real_t inp1 = input[ch1][i];
-            (*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE;
-            (*sample_buffer)[(i*2)+1] = (double)inp1*FLOAT_SCALE;
+            ch = hDecoder->internal_channel[0];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch][i];
+                (*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE;
+                (*sample_buffer)[(i*2)+1] = (double)inp0*FLOAT_SCALE;
+            }
+        } else {
+            ch  = hDecoder->internal_channel[0];
+            ch1 = hDecoder->internal_channel[1];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch ][i];
+                real_t inp1 = input[ch1][i];
+                (*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE;
+                (*sample_buffer)[(i*2)+1] = (double)inp1*FLOAT_SCALE;
+            }
         }
         break;
     default:
@@ -327,7 +393,7 @@
     }
 }
 
-void *output_to_PCM(faacDecHandle hDecoder,
+void *output_to_PCM(NeAACDecHandle hDecoder,
                     real_t **input, void *sample_buffer, uint8_t channels,
                     uint16_t frame_len, uint8_t format)
 {
@@ -374,8 +440,12 @@
 #define RSQRT2 FRAC_CONST(0.7071067811865475244) // 1/sqrt(2)
 
 static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample,
-                                uint8_t down_matrix, uint8_t *internal_channel)
+                                uint8_t down_matrix, uint8_t up_matrix,
+                                uint8_t *internal_channel)
 {
+    if (up_matrix == 1)
+        return input[internal_channel[0]][sample];
+
     if (!down_matrix)
         return input[internal_channel[channel]][sample];
 
@@ -393,7 +463,7 @@
     }
 }
 
-void* output_to_PCM(faacDecHandle hDecoder,
+void* output_to_PCM(NeAACDecHandle hDecoder,
                     real_t **input, void *sample_buffer, uint8_t channels,
                     uint16_t frame_len, uint8_t format)
 {
@@ -410,8 +480,8 @@
         case FAAD_FMT_16BIT:
             for(i = 0; i < frame_len; i++)
             {
-                //int32_t tmp = input[ch][i];
-                int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
+                int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
+                    hDecoder->internal_channel);
                 if (tmp >= 0)
                 {
                     tmp += (1 << (REAL_BITS-1));
@@ -433,8 +503,8 @@
         case FAAD_FMT_24BIT:
             for(i = 0; i < frame_len; i++)
             {
-                //int32_t tmp = input[ch][i];
-                int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
+                int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
+                    hDecoder->internal_channel);
                 if (tmp >= 0)
                 {
                     tmp += (1 << (REAL_BITS-9));
@@ -457,8 +527,8 @@
         case FAAD_FMT_32BIT:
             for(i = 0; i < frame_len; i++)
             {
-                //int32_t tmp = input[ch][i];
-                int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
+                int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
+                    hDecoder->internal_channel);
                 if (tmp >= 0)
                 {
                     tmp += (1 << (16-REAL_BITS-1));
@@ -470,6 +540,14 @@
                 int_sample_buffer[(i*channels)+ch] = (int32_t)tmp;
             }
             break;
+        case FAAD_FMT_FIXED:
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
+                    hDecoder->internal_channel);
+                int_sample_buffer[(i*channels)+ch] = (int32_t)tmp;
+            }
+            break;
         }
     }
 
--- a/Plugins/Input/aac/libfaad2/output.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/output.h	Wed May 10 14:44:20 2006 -0700
@@ -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.17 2004/01/05 14:05:12 menno Exp $
+** $Id: output.h,v 1.21 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __OUTPUT_H__
@@ -32,7 +32,7 @@
 extern "C" {
 #endif
 
-void* output_to_PCM(faacDecHandle hDecoder,
+void* output_to_PCM(NeAACDecHandle hDecoder,
                     real_t **input,
                     void *samplebuffer,
                     uint8_t channels,
--- a/Plugins/Input/aac/libfaad2/pns.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/pns.c	Wed May 10 14:44:20 2006 -0700
@@ -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.29 2004/01/05 14:05:12 menno Exp $
+** $Id: pns.c,v 1.34 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -70,9 +70,6 @@
 
 static real_t pow2_table[] =
 {
-    COEF_CONST(0.59460355750136),
-    COEF_CONST(0.70710678118655),
-    COEF_CONST(0.84089641525371),
     COEF_CONST(1.0),
     COEF_CONST(1.18920711500272),
     COEF_CONST(1.41421356237310),
@@ -131,8 +128,8 @@
     {
         scale = DIV(REAL_CONST(1),energy);
 
-        exp = scale_factor / 4;
-        frac = scale_factor % 4;
+        exp = scale_factor >> 2;
+        frac = scale_factor & 3;
 
         /* IMDCT pre-scaling */
         exp -= sub;
@@ -143,7 +140,7 @@
             scale <<= exp;
 
         if (frac)
-            scale = MUL_C(scale, pow2_table[frac + 3]);
+            scale = MUL_C(scale, pow2_table[frac]);
 
         for (i = 0; i < size; i++)
         {
@@ -187,6 +184,7 @@
             {
                 if (is_noise(ics_left, g, sfb))
                 {
+#ifdef LTP_DEC
                     /* Simultaneous use of LTP and PNS is not prevented in the
                        syntax. If both LTP, and PNS are enabled on the same
                        scalefactor band, PNS takes precedence, and no prediction
@@ -194,11 +192,14 @@
                     */
                     ics_left->ltp.long_used[sfb] = 0;
                     ics_left->ltp2.long_used[sfb] = 0;
+#endif
 
+#ifdef MAIN_DEC
                     /* For scalefactor bands coded using PNS the corresponding
                        predictors are switched to "off".
                     */
                     ics_left->pred.prediction_used[sfb] = 0;
+#endif
 
                     offs = ics_left->swb_offset[sfb];
                     size = ics_left->swb_offset[sfb+1] - offs;
@@ -240,9 +241,13 @@
                                     spec_left[(group*nshort) + offs + c];
                             }
                         } else /*if (ics_left->ms_mask_present == 0)*/ {
+#ifdef LTP_DEC
                             ics_right->ltp.long_used[sfb] = 0;
                             ics_right->ltp2.long_used[sfb] = 0;
+#endif
+#ifdef MAIN_DEC
                             ics_right->pred.prediction_used[sfb] = 0;
+#endif
 
                             offs = ics_right->swb_offset[sfb];
                             size = ics_right->swb_offset[sfb+1] - offs;
--- a/Plugins/Input/aac/libfaad2/pns.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/pns.h	Wed May 10 14:44:20 2006 -0700
@@ -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.19 2004/01/05 14:05:12 menno Exp $
+** $Id: pns.h,v 1.23 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __PNS_H__
@@ -32,8 +32,6 @@
 extern "C" {
 #endif
 
-#include "common.h"
-
 #include "syntax.h"
 
 #define NOISE_OFFSET 90
--- a/Plugins/Input/aac/libfaad2/pulse.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/pulse.c	Wed May 10 14:44:20 2006 -0700
@@ -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.14 2004/01/05 14:05:12 menno Exp $
+** $Id: pulse.c,v 1.17 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -39,7 +39,8 @@
 
     k = ics->swb_offset[pul->pulse_start_sfb];
 
-    for(i = 0; i <= pul->number_pulse; i++) {
+    for (i = 0; i <= pul->number_pulse; i++)
+    {
         k += pul->pulse_offset[i];
 
         if (k >= framelen)
--- a/Plugins/Input/aac/libfaad2/pulse.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/pulse.h	Wed May 10 14:44:20 2006 -0700
@@ -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.13 2004/01/05 14:05:12 menno Exp $
+** $Id: pulse.h,v 1.16 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __PULSE_H__
--- a/Plugins/Input/aac/libfaad2/rvlc.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/rvlc.c	Wed May 10 14:44:20 2006 -0700
@@ -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.14 2004/01/16 20:20:32 menno Exp $
+** $Id: rvlc.c,v 1.17 2004/09/04 14:56:28 menno Exp $
 **/
 
 /* RVLC scalefactor decoding
--- a/Plugins/Input/aac/libfaad2/rvlc.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/rvlc.h	Wed May 10 14:44:20 2006 -0700
@@ -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.10 2004/01/05 14:05:12 menno Exp $
+** $Id: rvlc.h,v 1.13 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __RVLC_SCF_H__
--- a/Plugins/Input/aac/libfaad2/sbr_dct.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sbr_dct.c	Wed May 10 14:44:20 2006 -0700
@@ -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.10 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_dct.c,v 1.15 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -37,8 +37,758 @@
 
 #include "sbr_dct.h"
 
+void DCT4_32(real_t *y, real_t *x)
+{
+    real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
+    real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20;
+    real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30;
+    real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40;
+    real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50;
+    real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60;
+    real_t f61, f62, f63, f64, f65, f66, f67, f68, f69, f70;
+    real_t f71, f72, f73, f74, f75, f76, f77, f78, f79, f80;
+    real_t f81, f82, f83, f84, f85, f86, f87, f88, f89, f90;
+    real_t f91, f92, f93, f94, f95, f96, f97, f98, f99, f100;
+    real_t f101, f102, f103, f104, f105, f106, f107, f108, f109, f110;
+    real_t f111, f112, f113, f114, f115, f116, f117, f118, f119, f120;
+    real_t f121, f122, f123, f124, f125, f126, f127, f128, f129, f130;
+    real_t f131, f132, f133, f134, f135, f136, f137, f138, f139, f140;
+    real_t f141, f142, f143, f144, f145, f146, f147, f148, f149, f150;
+    real_t f151, f152, f153, f154, f155, f156, f157, f158, f159, f160;
+    real_t f161, f162, f163, f164, f165, f166, f167, f168, f169, f170;
+    real_t f171, f172, f173, f174, f175, f176, f177, f178, f179, f180;
+    real_t f181, f182, f183, f184, f185, f186, f187, f188, f189, f190;
+    real_t f191, f192, f193, f194, f195, f196, f197, f198, f199, f200;
+    real_t f201, f202, f203, f204, f205, f206, f207, f208, f209, f210;
+    real_t f211, f212, f213, f214, f215, f216, f217, f218, f219, f220;
+    real_t f221, f222, f223, f224, f225, f226, f227, f228, f229, f230;
+    real_t f231, f232, f233, f234, f235, f236, f237, f238, f239, f240;
+    real_t f241, f242, f243, f244, f245, f246, f247, f248, f249, f250;
+    real_t f251, f252, f253, f254, f255, f256, f257, f258, f259, f260;
+    real_t f261, f262, f263, f264, f265, f266, f267, f268, f269, f270;
+    real_t f271, f272, f273, f274, f275, f276, f277, f278, f279, f280;
+    real_t f281, f282, f283, f284, f285, f286, f287, f288, f289, f290;
+    real_t f291, f292, f293, f294, f295, f296, f297, f298, f299, f300;
+    real_t f301, f302, f303, f304, f305, f306, f307, f310, f311, f312;
+    real_t f313, f316, f317, f318, f319, f322, f323, f324, f325, f328;
+    real_t f329, f330, f331, f334, f335, f336, f337, f340, f341, f342;
+    real_t f343, f346, f347, f348, f349, f352, f353, f354, f355, f358;
+    real_t f359, f360, f361, f364, f365, f366, f367, f370, f371, f372;
+    real_t f373, f376, f377, f378, f379, f382, f383, f384, f385, f388;
+    real_t f389, f390, f391, f394, f395, f396, f397;
+
+    f0 = x[15] - x[16];
+    f1 = x[15] + x[16];
+    f2 = MUL_F(FRAC_CONST(0.7071067811865476), f1);
+    f3 = MUL_F(FRAC_CONST(0.7071067811865476), f0);
+    f4 = x[8] - x[23];
+    f5 = x[8] + x[23];
+    f6 = MUL_F(FRAC_CONST(0.7071067811865476), f5);
+    f7 = MUL_F(FRAC_CONST(0.7071067811865476), f4);
+    f8 = x[12] - x[19];
+    f9 = x[12] + x[19];
+    f10 = MUL_F(FRAC_CONST(0.7071067811865476), f9);
+    f11 = MUL_F(FRAC_CONST(0.7071067811865476), f8);
+    f12 = x[11] - x[20];
+    f13 = x[11] + x[20];
+    f14 = MUL_F(FRAC_CONST(0.7071067811865476), f13);
+    f15 = MUL_F(FRAC_CONST(0.7071067811865476), f12);
+    f16 = x[14] - x[17];
+    f17 = x[14] + x[17];
+    f18 = MUL_F(FRAC_CONST(0.7071067811865476), f17);
+    f19 = MUL_F(FRAC_CONST(0.7071067811865476), f16);
+    f20 = x[9] - x[22];
+    f21 = x[9] + x[22];
+    f22 = MUL_F(FRAC_CONST(0.7071067811865476), f21);
+    f23 = MUL_F(FRAC_CONST(0.7071067811865476), f20);
+    f24 = x[13] - x[18];
+    f25 = x[13] + x[18];
+    f26 = MUL_F(FRAC_CONST(0.7071067811865476), f25);
+    f27 = MUL_F(FRAC_CONST(0.7071067811865476), f24);
+    f28 = x[10] - x[21];
+    f29 = x[10] + x[21];
+    f30 = MUL_F(FRAC_CONST(0.7071067811865476), f29);
+    f31 = MUL_F(FRAC_CONST(0.7071067811865476), f28);
+    f32 = x[0] - f2;
+    f33 = x[0] + f2;
+    f34 = x[31] - f3;
+    f35 = x[31] + f3;
+    f36 = x[7] - f6;
+    f37 = x[7] + f6;
+    f38 = x[24] - f7;
+    f39 = x[24] + f7;
+    f40 = x[3] - f10;
+    f41 = x[3] + f10;
+    f42 = x[28] - f11;
+    f43 = x[28] + f11;
+    f44 = x[4] - f14;
+    f45 = x[4] + f14;
+    f46 = x[27] - f15;
+    f47 = x[27] + f15;
+    f48 = x[1] - f18;
+    f49 = x[1] + f18;
+    f50 = x[30] - f19;
+    f51 = x[30] + f19;
+    f52 = x[6] - f22;
+    f53 = x[6] + f22;
+    f54 = x[25] - f23;
+    f55 = x[25] + f23;
+    f56 = x[2] - f26;
+    f57 = x[2] + f26;
+    f58 = x[29] - f27;
+    f59 = x[29] + f27;
+    f60 = x[5] - f30;
+    f61 = x[5] + f30;
+    f62 = x[26] - f31;
+    f63 = x[26] + f31;
+    f64 = f39 + f37;
+    f65 = MUL_F(FRAC_CONST(-0.5411961001461969), f39);
+    f66 = MUL_F(FRAC_CONST(0.9238795325112867), f64);
+    f67 = MUL_C(COEF_CONST(1.3065629648763766), f37);
+    f68 = f65 + f66;
+    f69 = f67 - f66;
+    f70 = f38 + f36;
+    f71 = MUL_C(COEF_CONST(1.3065629648763770), f38);
+    f72 = MUL_F(FRAC_CONST(-0.3826834323650904), f70);
+    f73 = MUL_F(FRAC_CONST(0.5411961001461961), f36);
+    f74 = f71 + f72;
+    f75 = f73 - f72;
+    f76 = f47 + f45;
+    f77 = MUL_F(FRAC_CONST(-0.5411961001461969), f47);
+    f78 = MUL_F(FRAC_CONST(0.9238795325112867), f76);
+    f79 = MUL_C(COEF_CONST(1.3065629648763766), f45);
+    f80 = f77 + f78;
+    f81 = f79 - f78;
+    f82 = f46 + f44;
+    f83 = MUL_C(COEF_CONST(1.3065629648763770), f46);
+    f84 = MUL_F(FRAC_CONST(-0.3826834323650904), f82);
+    f85 = MUL_F(FRAC_CONST(0.5411961001461961), f44);
+    f86 = f83 + f84;
+    f87 = f85 - f84;
+    f88 = f55 + f53;
+    f89 = MUL_F(FRAC_CONST(-0.5411961001461969), f55);
+    f90 = MUL_F(FRAC_CONST(0.9238795325112867), f88);
+    f91 = MUL_C(COEF_CONST(1.3065629648763766), f53);
+    f92 = f89 + f90;
+    f93 = f91 - f90;
+    f94 = f54 + f52;
+    f95 = MUL_C(COEF_CONST(1.3065629648763770), f54);
+    f96 = MUL_F(FRAC_CONST(-0.3826834323650904), f94);
+    f97 = MUL_F(FRAC_CONST(0.5411961001461961), f52);
+    f98 = f95 + f96;
+    f99 = f97 - f96;
+    f100 = f63 + f61;
+    f101 = MUL_F(FRAC_CONST(-0.5411961001461969), f63);
+    f102 = MUL_F(FRAC_CONST(0.9238795325112867), f100);
+    f103 = MUL_C(COEF_CONST(1.3065629648763766), f61);
+    f104 = f101 + f102;
+    f105 = f103 - f102;
+    f106 = f62 + f60;
+    f107 = MUL_C(COEF_CONST(1.3065629648763770), f62);
+    f108 = MUL_F(FRAC_CONST(-0.3826834323650904), f106);
+    f109 = MUL_F(FRAC_CONST(0.5411961001461961), f60);
+    f110 = f107 + f108;
+    f111 = f109 - f108;
+    f112 = f33 - f68;
+    f113 = f33 + f68;
+    f114 = f35 - f69;
+    f115 = f35 + f69;
+    f116 = f32 - f74;
+    f117 = f32 + f74;
+    f118 = f34 - f75;
+    f119 = f34 + f75;
+    f120 = f41 - f80;
+    f121 = f41 + f80;
+    f122 = f43 - f81;
+    f123 = f43 + f81;
+    f124 = f40 - f86;
+    f125 = f40 + f86;
+    f126 = f42 - f87;
+    f127 = f42 + f87;
+    f128 = f49 - f92;
+    f129 = f49 + f92;
+    f130 = f51 - f93;
+    f131 = f51 + f93;
+    f132 = f48 - f98;
+    f133 = f48 + f98;
+    f134 = f50 - f99;
+    f135 = f50 + f99;
+    f136 = f57 - f104;
+    f137 = f57 + f104;
+    f138 = f59 - f105;
+    f139 = f59 + f105;
+    f140 = f56 - f110;
+    f141 = f56 + f110;
+    f142 = f58 - f111;
+    f143 = f58 + f111;
+    f144 = f123 + f121;
+    f145 = MUL_F(FRAC_CONST(-0.7856949583871021), f123);
+    f146 = MUL_F(FRAC_CONST(0.9807852804032304), f144);
+    f147 = MUL_C(COEF_CONST(1.1758756024193588), f121);
+    f148 = f145 + f146;
+    f149 = f147 - f146;
+    f150 = f127 + f125;
+    f151 = MUL_F(FRAC_CONST(0.2758993792829431), f127);
+    f152 = MUL_F(FRAC_CONST(0.5555702330196022), f150);
+    f153 = MUL_C(COEF_CONST(1.3870398453221475), f125);
+    f154 = f151 + f152;
+    f155 = f153 - f152;
+    f156 = f122 + f120;
+    f157 = MUL_C(COEF_CONST(1.1758756024193591), f122);
+    f158 = MUL_F(FRAC_CONST(-0.1950903220161287), f156);
+    f159 = MUL_F(FRAC_CONST(0.7856949583871016), f120);
+    f160 = f157 + f158;
+    f161 = f159 - f158;
+    f162 = f126 + f124;
+    f163 = MUL_C(COEF_CONST(1.3870398453221473), f126);
+    f164 = MUL_F(FRAC_CONST(-0.8314696123025455), f162);
+    f165 = MUL_F(FRAC_CONST(-0.2758993792829436), f124);
+    f166 = f163 + f164;
+    f167 = f165 - f164;
+    f168 = f139 + f137;
+    f169 = MUL_F(FRAC_CONST(-0.7856949583871021), f139);
+    f170 = MUL_F(FRAC_CONST(0.9807852804032304), f168);
+    f171 = MUL_C(COEF_CONST(1.1758756024193588), f137);
+    f172 = f169 + f170;
+    f173 = f171 - f170;
+    f174 = f143 + f141;
+    f175 = MUL_F(FRAC_CONST(0.2758993792829431), f143);
+    f176 = MUL_F(FRAC_CONST(0.5555702330196022), f174);
+    f177 = MUL_C(COEF_CONST(1.3870398453221475), f141);
+    f178 = f175 + f176;
+    f179 = f177 - f176;
+    f180 = f138 + f136;
+    f181 = MUL_C(COEF_CONST(1.1758756024193591), f138);
+    f182 = MUL_F(FRAC_CONST(-0.1950903220161287), f180);
+    f183 = MUL_F(FRAC_CONST(0.7856949583871016), f136);
+    f184 = f181 + f182;
+    f185 = f183 - f182;
+    f186 = f142 + f140;
+    f187 = MUL_C(COEF_CONST(1.3870398453221473), f142);
+    f188 = MUL_F(FRAC_CONST(-0.8314696123025455), f186);
+    f189 = MUL_F(FRAC_CONST(-0.2758993792829436), f140);
+    f190 = f187 + f188;
+    f191 = f189 - f188;
+    f192 = f113 - f148;
+    f193 = f113 + f148;
+    f194 = f115 - f149;
+    f195 = f115 + f149;
+    f196 = f117 - f154;
+    f197 = f117 + f154;
+    f198 = f119 - f155;
+    f199 = f119 + f155;
+    f200 = f112 - f160;
+    f201 = f112 + f160;
+    f202 = f114 - f161;
+    f203 = f114 + f161;
+    f204 = f116 - f166;
+    f205 = f116 + f166;
+    f206 = f118 - f167;
+    f207 = f118 + f167;
+    f208 = f129 - f172;
+    f209 = f129 + f172;
+    f210 = f131 - f173;
+    f211 = f131 + f173;
+    f212 = f133 - f178;
+    f213 = f133 + f178;
+    f214 = f135 - f179;
+    f215 = f135 + f179;
+    f216 = f128 - f184;
+    f217 = f128 + f184;
+    f218 = f130 - f185;
+    f219 = f130 + f185;
+    f220 = f132 - f190;
+    f221 = f132 + f190;
+    f222 = f134 - f191;
+    f223 = f134 + f191;
+    f224 = f211 + f209;
+    f225 = MUL_F(FRAC_CONST(-0.8971675863426361), f211);
+    f226 = MUL_F(FRAC_CONST(0.9951847266721968), f224);
+    f227 = MUL_C(COEF_CONST(1.0932018670017576), f209);
+    f228 = f225 + f226;
+    f229 = f227 - f226;
+    f230 = f215 + f213;
+    f231 = MUL_F(FRAC_CONST(-0.4105245275223571), f215);
+    f232 = MUL_F(FRAC_CONST(0.8819212643483549), f230);
+    f233 = MUL_C(COEF_CONST(1.3533180011743529), f213);
+    f234 = f231 + f232;
+    f235 = f233 - f232;
+    f236 = f219 + f217;
+    f237 = MUL_F(FRAC_CONST(0.1386171691990915), f219);
+    f238 = MUL_F(FRAC_CONST(0.6343932841636455), f236);
+    f239 = MUL_C(COEF_CONST(1.4074037375263826), f217);
+    f240 = f237 + f238;
+    f241 = f239 - f238;
+    f242 = f223 + f221;
+    f243 = MUL_F(FRAC_CONST(0.6666556584777466), f223);
+    f244 = MUL_F(FRAC_CONST(0.2902846772544623), f242);
+    f245 = MUL_C(COEF_CONST(1.2472250129866711), f221);
+    f246 = f243 + f244;
+    f247 = f245 - f244;
+    f248 = f210 + f208;
+    f249 = MUL_C(COEF_CONST(1.0932018670017574), f210);
+    f250 = MUL_F(FRAC_CONST(-0.0980171403295605), f248);
+    f251 = MUL_F(FRAC_CONST(0.8971675863426364), f208);
+    f252 = f249 + f250;
+    f253 = f251 - f250;
+    f254 = f214 + f212;
+    f255 = MUL_C(COEF_CONST(1.3533180011743529), f214);
+    f256 = MUL_F(FRAC_CONST(-0.4713967368259979), f254);
+    f257 = MUL_F(FRAC_CONST(0.4105245275223569), f212);
+    f258 = f255 + f256;
+    f259 = f257 - f256;
+    f260 = f218 + f216;
+    f261 = MUL_C(COEF_CONST(1.4074037375263826), f218);
+    f262 = MUL_F(FRAC_CONST(-0.7730104533627369), f260);
+    f263 = MUL_F(FRAC_CONST(-0.1386171691990913), f216);
+    f264 = f261 + f262;
+    f265 = f263 - f262;
+    f266 = f222 + f220;
+    f267 = MUL_C(COEF_CONST(1.2472250129866711), f222);
+    f268 = MUL_F(FRAC_CONST(-0.9569403357322089), f266);
+    f269 = MUL_F(FRAC_CONST(-0.6666556584777469), f220);
+    f270 = f267 + f268;
+    f271 = f269 - f268;
+    f272 = f193 - f228;
+    f273 = f193 + f228;
+    f274 = f195 - f229;
+    f275 = f195 + f229;
+    f276 = f197 - f234;
+    f277 = f197 + f234;
+    f278 = f199 - f235;
+    f279 = f199 + f235;
+    f280 = f201 - f240;
+    f281 = f201 + f240;
+    f282 = f203 - f241;
+    f283 = f203 + f241;
+    f284 = f205 - f246;
+    f285 = f205 + f246;
+    f286 = f207 - f247;
+    f287 = f207 + f247;
+    f288 = f192 - f252;
+    f289 = f192 + f252;
+    f290 = f194 - f253;
+    f291 = f194 + f253;
+    f292 = f196 - f258;
+    f293 = f196 + f258;
+    f294 = f198 - f259;
+    f295 = f198 + f259;
+    f296 = f200 - f264;
+    f297 = f200 + f264;
+    f298 = f202 - f265;
+    f299 = f202 + f265;
+    f300 = f204 - f270;
+    f301 = f204 + f270;
+    f302 = f206 - f271;
+    f303 = f206 + f271;
+    f304 = f275 + f273;
+    f305 = MUL_F(FRAC_CONST(-0.9751575901732920), f275);
+    f306 = MUL_F(FRAC_CONST(0.9996988186962043), f304);
+    f307 = MUL_C(COEF_CONST(1.0242400472191164), f273);
+    y[0] = f305 + f306;
+    y[31] = f307 - f306;
+    f310 = f279 + f277;
+    f311 = MUL_F(FRAC_CONST(-0.8700688593994936), f279);
+    f312 = MUL_F(FRAC_CONST(0.9924795345987100), f310);
+    f313 = MUL_C(COEF_CONST(1.1148902097979263), f277);
+    y[2] = f311 + f312;
+    y[29] = f313 - f312;
+    f316 = f283 + f281;
+    f317 = MUL_F(FRAC_CONST(-0.7566008898816587), f283);
+    f318 = MUL_F(FRAC_CONST(0.9757021300385286), f316);
+    f319 = MUL_C(COEF_CONST(1.1948033701953984), f281);
+    y[4] = f317 + f318;
+    y[27] = f319 - f318;
+    f322 = f287 + f285;
+    f323 = MUL_F(FRAC_CONST(-0.6358464401941451), f287);
+    f324 = MUL_F(FRAC_CONST(0.9495281805930367), f322);
+    f325 = MUL_C(COEF_CONST(1.2632099209919283), f285);
+    y[6] = f323 + f324;
+    y[25] = f325 - f324;
+    f328 = f291 + f289;
+    f329 = MUL_F(FRAC_CONST(-0.5089684416985408), f291);
+    f330 = MUL_F(FRAC_CONST(0.9142097557035307), f328);
+    f331 = MUL_C(COEF_CONST(1.3194510697085207), f289);
+    y[8] = f329 + f330;
+    y[23] = f331 - f330;
+    f334 = f295 + f293;
+    f335 = MUL_F(FRAC_CONST(-0.3771887988789273), f295);
+    f336 = MUL_F(FRAC_CONST(0.8700869911087114), f334);
+    f337 = MUL_C(COEF_CONST(1.3629851833384954), f293);
+    y[10] = f335 + f336;
+    y[21] = f337 - f336;
+    f340 = f299 + f297;
+    f341 = MUL_F(FRAC_CONST(-0.2417766217337384), f299);
+    f342 = MUL_F(FRAC_CONST(0.8175848131515837), f340);
+    f343 = MUL_C(COEF_CONST(1.3933930045694289), f297);
+    y[12] = f341 + f342;
+    y[19] = f343 - f342;
+    f346 = f303 + f301;
+    f347 = MUL_F(FRAC_CONST(-0.1040360035527077), f303);
+    f348 = MUL_F(FRAC_CONST(0.7572088465064845), f346);
+    f349 = MUL_C(COEF_CONST(1.4103816894602612), f301);
+    y[14] = f347 + f348;
+    y[17] = f349 - f348;
+    f352 = f274 + f272;
+    f353 = MUL_F(FRAC_CONST(0.0347065382144002), f274);
+    f354 = MUL_F(FRAC_CONST(0.6895405447370668), f352);
+    f355 = MUL_C(COEF_CONST(1.4137876276885337), f272);
+    y[16] = f353 + f354;
+    y[15] = f355 - f354;
+    f358 = f278 + f276;
+    f359 = MUL_F(FRAC_CONST(0.1731148370459795), f278);
+    f360 = MUL_F(FRAC_CONST(0.6152315905806268), f358);
+    f361 = MUL_C(COEF_CONST(1.4035780182072330), f276);
+    y[18] = f359 + f360;
+    y[13] = f361 - f360;
+    f364 = f282 + f280;
+    f365 = MUL_F(FRAC_CONST(0.3098559453626100), f282);
+    f366 = MUL_F(FRAC_CONST(0.5349976198870972), f364);
+    f367 = MUL_C(COEF_CONST(1.3798511851368043), f280);
+    y[20] = f365 + f366;
+    y[11] = f367 - f366;
+    f370 = f286 + f284;
+    f371 = MUL_F(FRAC_CONST(0.4436129715409088), f286);
+    f372 = MUL_F(FRAC_CONST(0.4496113296546065), f370);
+    f373 = MUL_C(COEF_CONST(1.3428356308501219), f284);
+    y[22] = f371 + f372;
+    y[9] = f373 - f372;
+    f376 = f290 + f288;
+    f377 = MUL_F(FRAC_CONST(0.5730977622997509), f290);
+    f378 = MUL_F(FRAC_CONST(0.3598950365349881), f376);
+    f379 = MUL_C(COEF_CONST(1.2928878353697271), f288);
+    y[24] = f377 + f378;
+    y[7] = f379 - f378;
+    f382 = f294 + f292;
+    f383 = MUL_F(FRAC_CONST(0.6970633083205415), f294);
+    f384 = MUL_F(FRAC_CONST(0.2667127574748984), f382);
+    f385 = MUL_C(COEF_CONST(1.2304888232703382), f292);
+    y[26] = f383 + f384;
+    y[5] = f385 - f384;
+    f388 = f298 + f296;
+    f389 = MUL_F(FRAC_CONST(0.8143157536286401), f298);
+    f390 = MUL_F(FRAC_CONST(0.1709618887603012), f388);
+    f391 = MUL_C(COEF_CONST(1.1562395311492424), f296);
+    y[28] = f389 + f390;
+    y[3] = f391 - f390;
+    f394 = f302 + f300;
+    f395 = MUL_F(FRAC_CONST(0.9237258930790228), f302);
+    f396 = MUL_F(FRAC_CONST(0.0735645635996674), f394);
+    f397 = MUL_C(COEF_CONST(1.0708550202783576), f300);
+    y[30] = f395 + f396;
+    y[1] = f397 - f396;
+}
+
 #ifdef SBR_LOW_POWER
 
+void DCT2_16_unscaled(real_t *y, real_t *x)
+{
+    real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
+    real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20;
+    real_t f21, f22, f23, f24, f25, f26, f27, f28, f31, f32;
+    real_t f33, f34, f37, f38, f39, f40, f41, f42, f43, f44;
+    real_t f45, f46, f47, f48, f49, f51, f53, f54, f57, f58;
+    real_t f59, f60, f61, f62, f63, f64, f65, f66, f67, f68;
+    real_t f69, f70, f71, f72, f73, f74, f75, f76, f77, f78;
+    real_t f79, f80, f81, f82, f83, f84, f85, f86, f87, f88;
+    real_t f89, f90, f91, f92, f95, f96, f97, f98, f101, f102;
+    real_t f103, f104, f107, f108, f109, f110;
+
+    f0 = x[0] - x[15];
+    f1 = x[0] + x[15];
+    f2 = x[1] - x[14];
+    f3 = x[1] + x[14];
+    f4 = x[2] - x[13];
+    f5 = x[2] + x[13];
+    f6 = x[3] - x[12];
+    f7 = x[3] + x[12];
+    f8 = x[4] - x[11];
+    f9 = x[4] + x[11];
+    f10 = x[5] - x[10];
+    f11 = x[5] + x[10];
+    f12 = x[6] - x[9];
+    f13 = x[6] + x[9];
+    f14 = x[7] - x[8];
+    f15 = x[7] + x[8];
+    f16 = f1 - f15;
+    f17 = f1 + f15;
+    f18 = f3 - f13;
+    f19 = f3 + f13;
+    f20 = f5 - f11;
+    f21 = f5 + f11;
+    f22 = f7 - f9;
+    f23 = f7 + f9;
+    f24 = f17 - f23;
+    f25 = f17 + f23;
+    f26 = f19 - f21;
+    f27 = f19 + f21;
+    f28 = f25 - f27;
+    y[0] = f25 + f27;
+    y[8] = MUL_F(f28, FRAC_CONST(0.7071067811865476));
+    f31 = f24 + f26;
+    f32 = MUL_C(f24, COEF_CONST(1.3065629648763766));
+    f33 = MUL_F(f31, FRAC_CONST(-0.9238795325112866));
+    f34 = MUL_F(f26, FRAC_CONST(-0.5411961001461967));
+    y[12] = f32 + f33;
+    y[4] = f34 - f33;
+    f37 = f16 + f22;
+    f38 = MUL_C(f16, COEF_CONST(1.1758756024193588));
+    f39 = MUL_F(f37, FRAC_CONST(-0.9807852804032304));
+    f40 = MUL_F(f22, FRAC_CONST(-0.7856949583871021));
+    f41 = f38 + f39;
+    f42 = f40 - f39;
+    f43 = f18 + f20;
+    f44 = MUL_C(f18, COEF_CONST(1.3870398453221473));
+    f45 = MUL_F(f43, FRAC_CONST(-0.8314696123025455));
+    f46 = MUL_F(f20, FRAC_CONST(-0.2758993792829436));
+    f47 = f44 + f45;
+    f48 = f46 - f45;
+    f49 = f42 - f48;
+    y[2] = f42 + f48;
+    f51 = MUL_F(f49, FRAC_CONST(0.7071067811865476));
+    y[14] = f41 - f47;
+    f53 = f41 + f47;
+    f54 = MUL_F(f53, FRAC_CONST(0.7071067811865476));
+    y[10] = f51 - f54;
+    y[6] = f51 + f54;
+    f57 = f2 - f4;
+    f58 = f2 + f4;
+    f59 = f6 - f8;
+    f60 = f6 + f8;
+    f61 = f10 - f12;
+    f62 = f10 + f12;
+    f63 = MUL_F(f60, FRAC_CONST(0.7071067811865476));
+    f64 = f0 - f63;
+    f65 = f0 + f63;
+    f66 = f58 + f62;
+    f67 = MUL_C(f58, COEF_CONST(1.3065629648763766));
+    f68 = MUL_F(f66, FRAC_CONST(-0.9238795325112866));
+    f69 = MUL_F(f62, FRAC_CONST(-0.5411961001461967));
+    f70 = f67 + f68;
+    f71 = f69 - f68;
+    f72 = f65 - f71;
+    f73 = f65 + f71;
+    f74 = f64 - f70;
+    f75 = f64 + f70;
+    f76 = MUL_F(f59, FRAC_CONST(0.7071067811865476));
+    f77 = f14 - f76;
+    f78 = f14 + f76;
+    f79 = f61 + f57;
+    f80 = MUL_C(f61, COEF_CONST(1.3065629648763766));
+    f81 = MUL_F(f79, FRAC_CONST(-0.9238795325112866));
+    f82 = MUL_F(f57, FRAC_CONST(-0.5411961001461967));
+    f83 = f80 + f81;
+    f84 = f82 - f81;
+    f85 = f78 - f84;
+    f86 = f78 + f84;
+    f87 = f77 - f83;
+    f88 = f77 + f83;
+    f89 = f86 + f73;
+    f90 = MUL_F(f86, FRAC_CONST(-0.8971675863426361));
+    f91 = MUL_F(f89, FRAC_CONST(0.9951847266721968));
+    f92 = MUL_C(f73, COEF_CONST(1.0932018670017576));
+    y[1] = f90 + f91;
+    y[15] = f92 - f91;
+    f95 = f75 - f88;
+    f96 = MUL_F(f88, FRAC_CONST(-0.6666556584777466));
+    f97 = MUL_F(f95, FRAC_CONST(0.9569403357322089));
+    f98 = MUL_C(f75, COEF_CONST(1.2472250129866713));
+    y[3] = f97 - f96;
+    y[13] = f98 - f97;
+    f101 = f87 + f74;
+    f102 = MUL_F(f87, FRAC_CONST(-0.4105245275223571));
+    f103 = MUL_F(f101, FRAC_CONST(0.8819212643483549));
+    f104 = MUL_C(f74, COEF_CONST(1.3533180011743529));
+    y[5] = f102 + f103;
+    y[11] = f104 - f103;
+    f107 = f72 - f85;
+    f108 = MUL_F(f85, FRAC_CONST(-0.1386171691990915));
+    f109 = MUL_F(f107, FRAC_CONST(0.7730104533627370));
+    f110 = MUL_C(f72, COEF_CONST(1.4074037375263826));
+    y[7] = f109 - f108;
+    y[9] = f110 - f109;
+}
+
+void DCT4_16(real_t *y, real_t *x)
+{
+    real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
+    real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20;
+    real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30;
+    real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40;
+    real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50;
+    real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60;
+    real_t f61, f62, f63, f64, f65, f66, f67, f68, f69, f70;
+    real_t f71, f72, f73, f74, f75, f76, f77, f78, f79, f80;
+    real_t f81, f82, f83, f84, f85, f86, f87, f88, f89, f90;
+    real_t f91, f92, f93, f94, f95, f96, f97, f98, f99, f100;
+    real_t f101, f102, f103, f104, f105, f106, f107, f108, f109, f110;
+    real_t f111, f112, f113, f114, f115, f116, f117, f118, f119, f120;
+    real_t f121, f122, f123, f124, f125, f126, f127, f128, f130, f132;
+    real_t f134, f136, f138, f140, f142, f144, f145, f148, f149, f152;
+    real_t f153, f156, f157;
+
+    f0 = x[0] + x[15];
+    f1 = MUL_C(COEF_CONST(1.0478631305325901), x[0]);
+    f2 = MUL_F(FRAC_CONST(-0.9987954562051724), f0);
+    f3 = MUL_F(FRAC_CONST(-0.9497277818777548), x[15]);
+    f4 = f1 + f2;
+    f5 = f3 - f2;
+    f6 = x[2] + x[13];
+    f7 = MUL_C(COEF_CONST(1.2130114330978077), x[2]);
+    f8 = MUL_F(FRAC_CONST(-0.9700312531945440), f6);
+    f9 = MUL_F(FRAC_CONST(-0.7270510732912803), x[13]);
+    f10 = f7 + f8;
+    f11 = f9 - f8;
+    f12 = x[4] + x[11];
+    f13 = MUL_C(COEF_CONST(1.3315443865537255), x[4]);
+    f14 = MUL_F(FRAC_CONST(-0.9039892931234433), f12);
+    f15 = MUL_F(FRAC_CONST(-0.4764341996931612), x[11]);
+    f16 = f13 + f14;
+    f17 = f15 - f14;
+    f18 = x[6] + x[9];
+    f19 = MUL_C(COEF_CONST(1.3989068359730781), x[6]);
+    f20 = MUL_F(FRAC_CONST(-0.8032075314806453), f18);
+    f21 = MUL_F(FRAC_CONST(-0.2075082269882124), x[9]);
+    f22 = f19 + f20;
+    f23 = f21 - f20;
+    f24 = x[8] + x[7];
+    f25 = MUL_C(COEF_CONST(1.4125100802019777), x[8]);
+    f26 = MUL_F(FRAC_CONST(-0.6715589548470187), f24);
+    f27 = MUL_F(FRAC_CONST(0.0693921705079402), x[7]);
+    f28 = f25 + f26;
+    f29 = f27 - f26;
+    f30 = x[10] + x[5];
+    f31 = MUL_C(COEF_CONST(1.3718313541934939), x[10]);
+    f32 = MUL_F(FRAC_CONST(-0.5141027441932219), f30);
+    f33 = MUL_F(FRAC_CONST(0.3436258658070501), x[5]);
+    f34 = f31 + f32;
+    f35 = f33 - f32;
+    f36 = x[12] + x[3];
+    f37 = MUL_C(COEF_CONST(1.2784339185752409), x[12]);
+    f38 = MUL_F(FRAC_CONST(-0.3368898533922200), f36);
+    f39 = MUL_F(FRAC_CONST(0.6046542117908008), x[3]);
+    f40 = f37 + f38;
+    f41 = f39 - f38;
+    f42 = x[14] + x[1];
+    f43 = MUL_C(COEF_CONST(1.1359069844201433), x[14]);
+    f44 = MUL_F(FRAC_CONST(-0.1467304744553624), f42);
+    f45 = MUL_F(FRAC_CONST(0.8424460355094185), x[1]);
+    f46 = f43 + f44;
+    f47 = f45 - f44;
+    f48 = f5 - f29;
+    f49 = f5 + f29;
+    f50 = f4 - f28;
+    f51 = f4 + f28;
+    f52 = f11 - f35;
+    f53 = f11 + f35;
+    f54 = f10 - f34;
+    f55 = f10 + f34;
+    f56 = f17 - f41;
+    f57 = f17 + f41;
+    f58 = f16 - f40;
+    f59 = f16 + f40;
+    f60 = f23 - f47;
+    f61 = f23 + f47;
+    f62 = f22 - f46;
+    f63 = f22 + f46;
+    f64 = f48 + f50;
+    f65 = MUL_C(COEF_CONST(1.1758756024193588), f48);
+    f66 = MUL_F(FRAC_CONST(-0.9807852804032304), f64);
+    f67 = MUL_F(FRAC_CONST(-0.7856949583871021), f50);
+    f68 = f65 + f66;
+    f69 = f67 - f66;
+    f70 = f52 + f54;
+    f71 = MUL_C(COEF_CONST(1.3870398453221475), f52);
+    f72 = MUL_F(FRAC_CONST(-0.5555702330196022), f70);
+    f73 = MUL_F(FRAC_CONST(0.2758993792829431), f54);
+    f74 = f71 + f72;
+    f75 = f73 - f72;
+    f76 = f56 + f58;
+    f77 = MUL_F(FRAC_CONST(0.7856949583871022), f56);
+    f78 = MUL_F(FRAC_CONST(0.1950903220161283), f76);
+    f79 = MUL_C(COEF_CONST(1.1758756024193586), f58);
+    f80 = f77 + f78;
+    f81 = f79 - f78;
+    f82 = f60 + f62;
+    f83 = MUL_F(FRAC_CONST(-0.2758993792829430), f60);
+    f84 = MUL_F(FRAC_CONST(0.8314696123025452), f82);
+    f85 = MUL_C(COEF_CONST(1.3870398453221475), f62);
+    f86 = f83 + f84;
+    f87 = f85 - f84;
+    f88 = f49 - f57;
+    f89 = f49 + f57;
+    f90 = f51 - f59;
+    f91 = f51 + f59;
+    f92 = f53 - f61;
+    f93 = f53 + f61;
+    f94 = f55 - f63;
+    f95 = f55 + f63;
+    f96 = f69 - f81;
+    f97 = f69 + f81;
+    f98 = f68 - f80;
+    f99 = f68 + f80;
+    f100 = f75 - f87;
+    f101 = f75 + f87;
+    f102 = f74 - f86;
+    f103 = f74 + f86;
+    f104 = f88 + f90;
+    f105 = MUL_C(COEF_CONST(1.3065629648763766), f88);
+    f106 = MUL_F(FRAC_CONST(-0.9238795325112866), f104);
+    f107 = MUL_F(FRAC_CONST(-0.5411961001461967), f90);
+    f108 = f105 + f106;
+    f109 = f107 - f106;
+    f110 = f92 + f94;
+    f111 = MUL_F(FRAC_CONST(0.5411961001461969), f92);
+    f112 = MUL_F(FRAC_CONST(0.3826834323650898), f110);
+    f113 = MUL_C(COEF_CONST(1.3065629648763766), f94);
+    f114 = f111 + f112;
+    f115 = f113 - f112;
+    f116 = f96 + f98;
+    f117 = MUL_C(COEF_CONST(1.3065629648763766), f96);
+    f118 = MUL_F(FRAC_CONST(-0.9238795325112866), f116);
+    f119 = MUL_F(FRAC_CONST(-0.5411961001461967), f98);
+    f120 = f117 + f118;
+    f121 = f119 - f118;
+    f122 = f100 + f102;
+    f123 = MUL_F(FRAC_CONST(0.5411961001461969), f100);
+    f124 = MUL_F(FRAC_CONST(0.3826834323650898), f122);
+    f125 = MUL_C(COEF_CONST(1.3065629648763766), f102);
+    f126 = f123 + f124;
+    f127 = f125 - f124;
+    f128 = f89 - f93;
+    y[0] = f89 + f93;
+    f130 = f91 - f95;
+    y[15] = f91 + f95;
+    f132 = f109 - f115;
+    y[3] = f109 + f115;
+    f134 = f108 - f114;
+    y[12] = f108 + f114;
+    f136 = f97 - f101;
+    y[1] = f97 + f101;
+    f138 = f99 - f103;
+    y[14] = f99 + f103;
+    f140 = f121 - f127;
+    y[2] = f121 + f127;
+    f142 = f120 - f126;
+    y[13] = f120 + f126;
+    f144 = f128 - f130;
+    f145 = f128 + f130;
+    y[8] = MUL_F(FRAC_CONST(0.7071067811865474), f144);
+    y[7] = MUL_F(FRAC_CONST(0.7071067811865474), f145);
+    f148 = f132 - f134;
+    f149 = f132 + f134;
+    y[11] = MUL_F(FRAC_CONST(0.7071067811865474), f148);
+    y[4] = MUL_F(FRAC_CONST(0.7071067811865474), f149);
+    f152 = f136 - f138;
+    f153 = f136 + f138;
+    y[9] = MUL_F(FRAC_CONST(0.7071067811865474), f152);
+    y[6] = MUL_F(FRAC_CONST(0.7071067811865474), f153);
+    f156 = f140 - f142;
+    f157 = f140 + f142;
+    y[10] = MUL_F(FRAC_CONST(0.7071067811865474), f156);
+    y[5] = MUL_F(FRAC_CONST(0.7071067811865474), f157);
+}
+
 void DCT3_32_unscaled(real_t *y, real_t *x)
 {
     real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
@@ -70,13 +820,13 @@
     real_t f261, f262, f263, f264, f265, f266, f267, f268, f269, f270;
     real_t f271, f272;
 
-    f0 = MUL_C(COEF_CONST(0.7071067811865476), x[16]);
+    f0 = MUL_F(x[16], FRAC_CONST(0.7071067811865476));
     f1 = x[0] - f0;
     f2 = x[0] + f0;
     f3 = x[8] + x[24];
-    f4 = MUL_C(COEF_CONST(1.3065629648763766), x[8]);
-    f5 = MUL_C(COEF_CONST((-0.9238795325112866)), f3);
-    f6 = MUL_C(COEF_CONST((-0.5411961001461967)), x[24]);
+    f4 = MUL_C(x[8], COEF_CONST(1.3065629648763766));
+    f5 = MUL_F(f3, FRAC_CONST((-0.9238795325112866)));
+    f6 = MUL_F(x[24], FRAC_CONST((-0.5411961001461967)));
     f7 = f4 + f5;
     f8 = f6 - f5;
     f9 = f2 - f8;
@@ -84,23 +834,23 @@
     f11 = f1 - f7;
     f12 = f1 + f7;
     f13 = x[4] + x[28];
-    f14 = MUL_C(COEF_CONST(1.1758756024193588), x[4]);
-    f15 = MUL_C(COEF_CONST((-0.9807852804032304)), f13);
-    f16 = MUL_C(COEF_CONST((-0.7856949583871021)), x[28]);
+    f14 = MUL_C(x[4], COEF_CONST(1.1758756024193588));
+    f15 = MUL_F(f13, FRAC_CONST((-0.9807852804032304)));
+    f16 = MUL_F(x[28], FRAC_CONST((-0.7856949583871021)));
     f17 = f14 + f15;
     f18 = f16 - f15;
     f19 = x[12] + x[20];
-    f20 = MUL_C(COEF_CONST(1.3870398453221473), x[12]);
-    f21 = MUL_C(COEF_CONST((-0.8314696123025455)), f19);
-    f22 = MUL_C(COEF_CONST((-0.2758993792829436)), x[20]);
+    f20 = MUL_C(x[12], COEF_CONST(1.3870398453221473));
+    f21 = MUL_F(f19, FRAC_CONST((-0.8314696123025455)));
+    f22 = MUL_F(x[20], FRAC_CONST((-0.2758993792829436)));
     f23 = f20 + f21;
     f24 = f22 - f21;
     f25 = f18 - f24;
     f26 = f18 + f24;
-    f27 = MUL_C(COEF_CONST(0.7071067811865476), f25);
+    f27 = MUL_F(f25, FRAC_CONST(0.7071067811865476));
     f28 = f17 - f23;
     f29 = f17 + f23;
-    f30 = MUL_C(COEF_CONST(0.7071067811865476), f29);
+    f30 = MUL_F(f29, FRAC_CONST(0.7071067811865476));
     f31 = f27 - f30;
     f32 = f27 + f30;
     f33 = f10 - f26;
@@ -112,27 +862,27 @@
     f39 = f9 - f28;
     f40 = f9 + f28;
     f41 = x[2] + x[30];
-    f42 = MUL_C(COEF_CONST(1.0932018670017569), x[2]);
-    f43 = MUL_C(COEF_CONST((-0.9951847266721969)), f41);
-    f44 = MUL_C(COEF_CONST((-0.8971675863426368)), x[30]);
+    f42 = MUL_C(x[2], COEF_CONST(1.0932018670017569));
+    f43 = MUL_F(f41, FRAC_CONST((-0.9951847266721969)));
+    f44 = MUL_F(x[30], FRAC_CONST((-0.8971675863426368)));
     f45 = f42 + f43;
     f46 = f44 - f43;
     f47 = x[6] + x[26];
-    f48 = MUL_C(COEF_CONST(1.2472250129866711), x[6]);
-    f49 = MUL_C(COEF_CONST((-0.9569403357322089)), f47);
-    f50 = MUL_C(COEF_CONST((-0.6666556584777469)), x[26]);
+    f48 = MUL_C(x[6], COEF_CONST(1.2472250129866711));
+    f49 = MUL_F(f47, FRAC_CONST((-0.9569403357322089)));
+    f50 = MUL_F(x[26], FRAC_CONST((-0.6666556584777469)));
     f51 = f48 + f49;
     f52 = f50 - f49;
     f53 = x[10] + x[22];
-    f54 = MUL_C(COEF_CONST(1.3533180011743526), x[10]);
-    f55 = MUL_C(COEF_CONST((-0.8819212643483551)), f53);
-    f56 = MUL_C(COEF_CONST((-0.4105245275223575)), x[22]);
+    f54 = MUL_C(x[10], COEF_CONST(1.3533180011743526));
+    f55 = MUL_F(f53, FRAC_CONST((-0.8819212643483551)));
+    f56 = MUL_F(x[22], FRAC_CONST((-0.4105245275223575)));
     f57 = f54 + f55;
     f58 = f56 - f55;
     f59 = x[14] + x[18];
-    f60 = MUL_C(COEF_CONST(1.4074037375263826), x[14]);
-    f61 = MUL_C(COEF_CONST((-0.7730104533627369)), f59);
-    f62 = MUL_C(COEF_CONST((-0.1386171691990913)), x[18]);
+    f60 = MUL_C(x[14], COEF_CONST(1.4074037375263826));
+    f61 = MUL_F(f59, FRAC_CONST((-0.7730104533627369)));
+    f62 = MUL_F(x[18], FRAC_CONST((-0.1386171691990913)));
     f63 = f60 + f61;
     f64 = f62 - f61;
     f65 = f46 - f64;
@@ -141,11 +891,11 @@
     f68 = f52 + f58;
     f69 = f66 - f68;
     f70 = f66 + f68;
-    f71 = MUL_C(COEF_CONST(0.7071067811865476), f69);
+    f71 = MUL_F(f69, FRAC_CONST(0.7071067811865476));
     f72 = f65 + f67;
-    f73 = MUL_C(COEF_CONST(1.3065629648763766), f65);
-    f74 = MUL_C(COEF_CONST((-0.9238795325112866)), f72);
-    f75 = MUL_C(COEF_CONST((-0.5411961001461967)), f67);
+    f73 = MUL_C(f65, COEF_CONST(1.3065629648763766));
+    f74 = MUL_F(f72, FRAC_CONST((-0.9238795325112866)));
+    f75 = MUL_F(f67, FRAC_CONST((-0.5411961001461967)));
     f76 = f73 + f74;
     f77 = f75 - f74;
     f78 = f45 - f63;
@@ -153,14 +903,14 @@
     f80 = f51 - f57;
     f81 = f51 + f57;
     f82 = f79 + f81;
-    f83 = MUL_C(COEF_CONST(1.3065629648763770), f79);
-    f84 = MUL_C(COEF_CONST((-0.3826834323650904)), f82);
-    f85 = MUL_C(COEF_CONST(0.5411961001461961), f81);
+    f83 = MUL_C(f79, COEF_CONST(1.3065629648763770));
+    f84 = MUL_F(f82, FRAC_CONST((-0.3826834323650904)));
+    f85 = MUL_F(f81, FRAC_CONST(0.5411961001461961));
     f86 = f83 + f84;
     f87 = f85 - f84;
     f88 = f78 - f80;
     f89 = f78 + f80;
-    f90 = MUL_C(COEF_CONST(0.7071067811865476), f89);
+    f90 = MUL_F(f89, FRAC_CONST(0.7071067811865476));
     f91 = f77 - f87;
     f92 = f77 + f87;
     f93 = f71 - f90;
@@ -184,51 +934,51 @@
     f111 = f33 - f88;
     f112 = f33 + f88;
     f113 = x[1] + x[31];
-    f114 = MUL_C(COEF_CONST(1.0478631305325901), x[1]);
-    f115 = MUL_C(COEF_CONST((-0.9987954562051724)), f113);
-    f116 = MUL_C(COEF_CONST((-0.9497277818777548)), x[31]);
+    f114 = MUL_C(x[1], COEF_CONST(1.0478631305325901));
+    f115 = MUL_F(f113, FRAC_CONST((-0.9987954562051724)));
+    f116 = MUL_F(x[31], FRAC_CONST((-0.9497277818777548)));
     f117 = f114 + f115;
     f118 = f116 - f115;
     f119 = x[5] + x[27];
-    f120 = MUL_C(COEF_CONST(1.2130114330978077), x[5]);
-    f121 = MUL_C(COEF_CONST((-0.9700312531945440)), f119);
-    f122 = MUL_C(COEF_CONST((-0.7270510732912803)), x[27]);
+    f120 = MUL_C(x[5], COEF_CONST(1.2130114330978077));
+    f121 = MUL_F(f119, FRAC_CONST((-0.9700312531945440)));
+    f122 = MUL_F(x[27], FRAC_CONST((-0.7270510732912803)));
     f123 = f120 + f121;
     f124 = f122 - f121;
     f125 = x[9] + x[23];
-    f126 = MUL_C(COEF_CONST(1.3315443865537255), x[9]);
-    f127 = MUL_C(COEF_CONST((-0.9039892931234433)), f125);
-    f128 = MUL_C(COEF_CONST((-0.4764341996931612)), x[23]);
+    f126 = MUL_C(x[9], COEF_CONST(1.3315443865537255));
+    f127 = MUL_F(f125, FRAC_CONST((-0.9039892931234433)));
+    f128 = MUL_F(x[23], FRAC_CONST((-0.4764341996931612)));
     f129 = f126 + f127;
     f130 = f128 - f127;
     f131 = x[13] + x[19];
-    f132 = MUL_C(COEF_CONST(1.3989068359730781), x[13]);
-    f133 = MUL_C(COEF_CONST((-0.8032075314806453)), f131);
-    f134 = MUL_C(COEF_CONST((-0.2075082269882124)), x[19]);
+    f132 = MUL_C(x[13], COEF_CONST(1.3989068359730781));
+    f133 = MUL_F(f131, FRAC_CONST((-0.8032075314806453)));
+    f134 = MUL_F(x[19], FRAC_CONST((-0.2075082269882124)));
     f135 = f132 + f133;
     f136 = f134 - f133;
     f137 = x[17] + x[15];
-    f138 = MUL_C(COEF_CONST(1.4125100802019777), x[17]);
-    f139 = MUL_C(COEF_CONST((-0.6715589548470187)), f137);
-    f140 = MUL_C(COEF_CONST(0.0693921705079402), x[15]);
+    f138 = MUL_C(x[17], COEF_CONST(1.4125100802019777));
+    f139 = MUL_F(f137, FRAC_CONST((-0.6715589548470187)));
+    f140 = MUL_F(x[15], FRAC_CONST(0.0693921705079402));
     f141 = f138 + f139;
     f142 = f140 - f139;
     f143 = x[21] + x[11];
-    f144 = MUL_C(COEF_CONST(1.3718313541934939), x[21]);
-    f145 = MUL_C(COEF_CONST((-0.5141027441932219)), f143);
-    f146 = MUL_C(COEF_CONST(0.3436258658070501), x[11]);
+    f144 = MUL_C(x[21], COEF_CONST(1.3718313541934939));
+    f145 = MUL_F(f143, FRAC_CONST((-0.5141027441932219)));
+    f146 = MUL_F(x[11], FRAC_CONST(0.3436258658070501));
     f147 = f144 + f145;
     f148 = f146 - f145;
     f149 = x[25] + x[7];
-    f150 = MUL_C(COEF_CONST(1.2784339185752409), x[25]);
-    f151 = MUL_C(COEF_CONST((-0.3368898533922200)), f149);
-    f152 = MUL_C(COEF_CONST(0.6046542117908008), x[7]);
+    f150 = MUL_C(x[25], COEF_CONST(1.2784339185752409));
+    f151 = MUL_F(f149, FRAC_CONST((-0.3368898533922200)));
+    f152 = MUL_F(x[7], FRAC_CONST(0.6046542117908008));
     f153 = f150 + f151;
     f154 = f152 - f151;
     f155 = x[29] + x[3];
-    f156 = MUL_C(COEF_CONST(1.1359069844201433), x[29]);
-    f157 = MUL_C(COEF_CONST((-0.1467304744553624)), f155);
-    f158 = MUL_C(COEF_CONST(0.8424460355094185), x[3]);
+    f156 = MUL_C(x[29], COEF_CONST(1.1359069844201433));
+    f157 = MUL_F(f155, FRAC_CONST((-0.1467304744553624)));
+    f158 = MUL_F(x[3], FRAC_CONST(0.8424460355094185));
     f159 = f156 + f157;
     f160 = f158 - f157;
     f161 = f118 - f142;
@@ -248,27 +998,27 @@
     f175 = f135 - f159;
     f176 = f135 + f159;
     f177 = f161 + f163;
-    f178 = MUL_C(COEF_CONST(1.1758756024193588), f161);
-    f179 = MUL_C(COEF_CONST((-0.9807852804032304)), f177);
-    f180 = MUL_C(COEF_CONST((-0.7856949583871021)), f163);
+    f178 = MUL_C(f161, COEF_CONST(1.1758756024193588));
+    f179 = MUL_F(f177, FRAC_CONST((-0.9807852804032304)));
+    f180 = MUL_F(f163, FRAC_CONST((-0.7856949583871021)));
     f181 = f178 + f179;
     f182 = f180 - f179;
     f183 = f165 + f167;
-    f184 = MUL_C(COEF_CONST(1.3870398453221475), f165);
-    f185 = MUL_C(COEF_CONST((-0.5555702330196022)), f183);
-    f186 = MUL_C(COEF_CONST(0.2758993792829431), f167);
+    f184 = MUL_C(f165, COEF_CONST(1.3870398453221475));
+    f185 = MUL_F(f183, FRAC_CONST((-0.5555702330196022)));
+    f186 = MUL_F(f167, FRAC_CONST(0.2758993792829431));
     f187 = f184 + f185;
     f188 = f186 - f185;
     f189 = f169 + f171;
-    f190 = MUL_C(COEF_CONST(0.7856949583871022), f169);
-    f191 = MUL_C(COEF_CONST(0.1950903220161283), f189);
-    f192 = MUL_C(COEF_CONST(1.1758756024193586), f171);
+    f190 = MUL_F(f169, FRAC_CONST(0.7856949583871022));
+    f191 = MUL_F(f189, FRAC_CONST(0.1950903220161283));
+    f192 = MUL_C(f171, COEF_CONST(1.1758756024193586));
     f193 = f190 + f191;
     f194 = f192 - f191;
     f195 = f173 + f175;
-    f196 = MUL_C(COEF_CONST((-0.2758993792829430)), f173);
-    f197 = MUL_C(COEF_CONST(0.8314696123025452), f195);
-    f198 = MUL_C(COEF_CONST(1.3870398453221475), f175);
+    f196 = MUL_F(f173, FRAC_CONST((-0.2758993792829430)));
+    f197 = MUL_F(f195, FRAC_CONST(0.8314696123025452));
+    f198 = MUL_C(f175, COEF_CONST(1.3870398453221475));
     f199 = f196 + f197;
     f200 = f198 - f197;
     f201 = f162 - f170;
@@ -288,27 +1038,27 @@
     f215 = f187 - f199;
     f216 = f187 + f199;
     f217 = f201 + f203;
-    f218 = MUL_C(COEF_CONST(1.3065629648763766), f201);
-    f219 = MUL_C(COEF_CONST((-0.9238795325112866)), f217);
-    f220 = MUL_C(COEF_CONST((-0.5411961001461967)), f203);
+    f218 = MUL_C(f201, COEF_CONST(1.3065629648763766));
+    f219 = MUL_F(f217, FRAC_CONST((-0.9238795325112866)));
+    f220 = MUL_F(f203, FRAC_CONST((-0.5411961001461967)));
     f221 = f218 + f219;
     f222 = f220 - f219;
     f223 = f205 + f207;
-    f224 = MUL_C(COEF_CONST(0.5411961001461969), f205);
-    f225 = MUL_C(COEF_CONST(0.3826834323650898), f223);
-    f226 = MUL_C(COEF_CONST(1.3065629648763766), f207);
+    f224 = MUL_F(f205, FRAC_CONST(0.5411961001461969));
+    f225 = MUL_F(f223, FRAC_CONST(0.3826834323650898));
+    f226 = MUL_C(f207, COEF_CONST(1.3065629648763766));
     f227 = f224 + f225;
     f228 = f226 - f225;
     f229 = f209 + f211;
-    f230 = MUL_C(COEF_CONST(1.3065629648763766), f209);
-    f231 = MUL_C(COEF_CONST((-0.9238795325112866)), f229);
-    f232 = MUL_C(COEF_CONST((-0.5411961001461967)), f211);
+    f230 = MUL_C(f209, COEF_CONST(1.3065629648763766));
+    f231 = MUL_F(f229, FRAC_CONST((-0.9238795325112866)));
+    f232 = MUL_F(f211, FRAC_CONST((-0.5411961001461967)));
     f233 = f230 + f231;
     f234 = f232 - f231;
     f235 = f213 + f215;
-    f236 = MUL_C(COEF_CONST(0.5411961001461969), f213);
-    f237 = MUL_C(COEF_CONST(0.3826834323650898), f235);
-    f238 = MUL_C(COEF_CONST(1.3065629648763766), f215);
+    f236 = MUL_F(f213, FRAC_CONST(0.5411961001461969));
+    f237 = MUL_F(f235, FRAC_CONST(0.3826834323650898));
+    f238 = MUL_C(f215, COEF_CONST(1.3065629648763766));
     f239 = f236 + f237;
     f240 = f238 - f237;
     f241 = f202 - f206;
@@ -329,20 +1079,20 @@
     f256 = f233 + f239;
     f257 = f241 - f243;
     f258 = f241 + f243;
-    f259 = MUL_C(COEF_CONST(0.7071067811865474), f257);
-    f260 = MUL_C(COEF_CONST(0.7071067811865474), f258);
+    f259 = MUL_F(f257, FRAC_CONST(0.7071067811865474));
+    f260 = MUL_F(f258, FRAC_CONST(0.7071067811865474));
     f261 = f245 - f247;
     f262 = f245 + f247;
-    f263 = MUL_C(COEF_CONST(0.7071067811865474), f261);
-    f264 = MUL_C(COEF_CONST(0.7071067811865474), f262);
+    f263 = MUL_F(f261, FRAC_CONST(0.7071067811865474));
+    f264 = MUL_F(f262, FRAC_CONST(0.7071067811865474));
     f265 = f249 - f251;
     f266 = f249 + f251;
-    f267 = MUL_C(COEF_CONST(0.7071067811865474), f265);
-    f268 = MUL_C(COEF_CONST(0.7071067811865474), f266);
+    f267 = MUL_F(f265, FRAC_CONST(0.7071067811865474));
+    f268 = MUL_F(f266, FRAC_CONST(0.7071067811865474));
     f269 = f253 - f255;
     f270 = f253 + f255;
-    f271 = MUL_C(COEF_CONST(0.7071067811865474), f269);
-    f272 = MUL_C(COEF_CONST(0.7071067811865474), f270);
+    f271 = MUL_F(f269, FRAC_CONST(0.7071067811865474));
+    f272 = MUL_F(f270, FRAC_CONST(0.7071067811865474));
     y[31] = f98 - f242;
     y[0] = f98 + f242;
     y[30] = f100 - f250;
@@ -377,22 +1127,21 @@
     y[15] = f97 + f244;
 }
 
-void DCT2_64_unscaled(real_t *y, real_t *x)
+void DCT2_32_unscaled(real_t *y, real_t *x)
 {
-    int16_t i0;
-    real_t f2, f3, f4, f5, f6, f7, f8, f9, f10;
+    real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
     real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20;
     real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30;
     real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40;
     real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50;
     real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60;
-    real_t f61, f62, f65, f66, f67, f68, f71, f72, f73, f74;
-    real_t f75, f76, f77, f78, f79, f80, f81, f82, f83, f85;
-    real_t f87, f88, f91, f92, f93, f94, f95, f96, f97, f98;
+    real_t f63, f64, f65, f66, f69, f70, f71, f72, f73, f74;
+    real_t f75, f76, f77, f78, f79, f80, f81, f83, f85, f86;
+    real_t f89, f90, f91, f92, f93, f94, f95, f96, f97, f98;
     real_t f99, f100, f101, f102, f103, f104, f105, f106, f107, f108;
     real_t f109, f110, f111, f112, f113, f114, f115, f116, f117, f118;
-    real_t f119, f120, f121, f122, f123, f124, f125, f126, f129, f130;
-    real_t f131, f132, f135, f136, f137, f138, f141, f142, f143, f144;
+    real_t f119, f120, f121, f122, f123, f124, f127, f128, f129, f130;
+    real_t f133, f134, f135, f136, f139, f140, f141, f142, f145, f146;
     real_t f147, f148, f149, f150, f151, f152, f153, f154, f155, f156;
     real_t f157, f158, f159, f160, f161, f162, f163, f164, f165, f166;
     real_t f167, f168, f169, f170, f171, f172, f173, f174, f175, f176;
@@ -402,2410 +1151,1121 @@
     real_t f207, f208, f209, f210, f211, f212, f213, f214, f215, f216;
     real_t f217, f218, f219, f220, f221, f222, f223, f224, f225, f226;
     real_t f227, f228, f229, f230, f231, f232, f233, f234, f235, f236;
-    real_t f237, f238, f239, f240, f241, f242, f243, f244, f245, f246;
-    real_t f247, f248, f249, f250, f251, f252, f253, f254, f255, f256;
-    real_t f257, f258, f259, f260, f261, f262, f265, f266, f267, f268;
-    real_t f271, f272, f273, f274, f277, f278, f279, f280, f283, f284;
-    real_t f285, f286, f289, f290, f291, f292, f295, f296, f297, f298;
-    real_t f301, f302, f303, f304, f307, f308, f309, f310, f311, f312;
-    real_t f313, f314, f315, f316, f317, f318, f319, f320, f321, f322;
-    real_t f323, f324, f325, f326, f327, f328, f329, f330, f331, f332;
-    real_t f333, f334, f335, f336, f337, f338, f339, f340, f341, f342;
-    real_t f343, f344, f345, f346, f347, f348, f349, f350, f351, f352;
-    real_t f353, f354, f355, f356, f357, f358, f359, f360, f361, f362;
-    real_t f363, f364, f365, f366, f367, f368, f369, f370, f371, f372;
-    real_t f373, f374, f375, f376, f377, f378, f379, f380, f381, f382;
-    real_t f383, f384, f385, f386, f387, f388, f389, f390, f391, f392;
-    real_t f393, f394, f395, f396, f397, f398, f399, f400, f401, f402;
-    real_t f403, f404, f405, f406, f407, f408, f409, f410, f411, f412;
-    real_t f413, f414, f415, f416, f417, f418, f419, f420, f421, f422;
-    real_t f423, f424, f425, f426, f427, f428, f429, f430, f431, f433;
-    real_t f434, f435, f436, f437, f438, f439, f440, f441, f442, f443;
-    real_t f444, f445, f446, f447, f448, f449, f450, f451, f452, f453;
-    real_t f454, f455, f456, f457, f458, f459, f460, f461, f462, f463;
-    real_t f464, f465, f466, f467, f468, f469, f470, f471, f472, f473;
-    real_t f474, f475, f476, f477, f478, f479, f480, f481, f482, f483;
-    real_t f484, f485, f486, f487, f488, f489, f490, f491, f492, f493;
-    real_t f494, f495, f496, f497, f498, f499, f500, f501, f502, f503;
-    real_t f504, f505, f506, f507, f508, f509, f510, f511, f512, f513;
-    real_t f514, f515, f516, f517, f518, f519, f520, f521, f522, f523;
-    real_t f524, f525, f526, f527, f528, f529, f530, f531, f532, f533;
-    real_t f534, f535, f536, f537, f538, f539, f540, f541, f542, f543;
-    real_t f544, f546, f547, f548, f549, f550, f551, f552, f553, f554;
-    real_t f555, f556, f557, f558, f559, f560, f561, f562, f563, f564;
-    real_t f565, f566, f567, f568, f569, f570, f571, f572, f573, f574;
-    real_t f575, f576, f577, f578, f579, f580, f581, f582, f583, f584;
-    real_t f585, f586, f587, f588, f589, f590, f591, f592, f593, f594;
-    real_t f595, f596, f597, f598, f599, f600, f601, f602, f603, f604;
-    real_t f605, f606, f607, f608, f609, f610, f611, f612, f613, f614;
-    real_t f615, f616, f617, f618, f619, f620, f621, f622, f623, f624;
-    real_t f625, f626, f627, f628;
-    ALIGN static real_t t2[64];
+    real_t f237, f238, f239, f240, f241, f242, f243, f244, f247, f248;
+    real_t f249, f250, f253, f254, f255, f256, f259, f260, f261, f262;
+    real_t f265, f266, f267, f268, f271, f272, f273, f274, f277, f278;
+    real_t f279, f280, f283, f284, f285, f286;
 
-    for (i0=0; i0<32; i0++)
-    {
-        t2[2*i0+1] = x[i0] - x[-i0+63];
-        t2[2*i0] = x[i0] + x[-i0+63];
-    }
-    f2 = t2[0] - t2[62];
-    f3 = t2[0] + t2[62];
-    f4 = t2[2] - t2[60];
-    f5 = t2[2] + t2[60];
-    f6 = t2[4] - t2[58];
-    f7 = t2[4] + t2[58];
-    f8 = t2[6] - t2[56];
-    f9 = t2[6] + t2[56];
-    f10 = t2[8] - t2[54];
-    f11 = t2[8] + t2[54];
-    f12 = t2[10] - t2[52];
-    f13 = t2[10] + t2[52];
-    f14 = t2[12] - t2[50];
-    f15 = t2[12] + t2[50];
-    f16 = t2[14] - t2[48];
-    f17 = t2[14] + t2[48];
-    f18 = t2[16] - t2[46];
-    f19 = t2[16] + t2[46];
-    f20 = t2[18] - t2[44];
-    f21 = t2[18] + t2[44];
-    f22 = t2[20] - t2[42];
-    f23 = t2[20] + t2[42];
-    f24 = t2[22] - t2[40];
-    f25 = t2[22] + t2[40];
-    f26 = t2[24] - t2[38];
-    f27 = t2[24] + t2[38];
-    f28 = t2[26] - t2[36];
-    f29 = t2[26] + t2[36];
-    f30 = t2[28] - t2[34];
-    f31 = t2[28] + t2[34];
-    f32 = t2[30] - t2[32];
-    f33 = t2[30] + t2[32];
-    f34 = f3 - f33;
-    f35 = f3 + f33;
-    f36 = f5 - f31;
-    f37 = f5 + f31;
-    f38 = f7 - f29;
-    f39 = f7 + f29;
-    f40 = f9 - f27;
-    f41 = f9 + f27;
-    f42 = f11 - f25;
-    f43 = f11 + f25;
-    f44 = f13 - f23;
-    f45 = f13 + f23;
-    f46 = f15 - f21;
-    f47 = f15 + f21;
-    f48 = f17 - f19;
-    f49 = f17 + f19;
-    f50 = f35 - f49;
-    f51 = f35 + f49;
-    f52 = f37 - f47;
-    f53 = f37 + f47;
-    f54 = f39 - f45;
-    f55 = f39 + f45;
-    f56 = f41 - f43;
-    f57 = f41 + f43;
-    f58 = f51 - f57;
-    f59 = f51 + f57;
-    f60 = f53 - f55;
-    f61 = f53 + f55;
-    f62 = f59 - f61;
-    y[0] = f59 + f61;
-    y[32] = MUL_C(COEF_CONST(0.7071067811865476), f62);
-    f65 = f58 + f60;
-    f66 = MUL_C(COEF_CONST(1.3065629648763766), f58);
-    f67 = MUL_C(COEF_CONST((-0.9238795325112866)), f65);
-    f68 = MUL_C(COEF_CONST((-0.5411961001461967)), f60);
-    y[48] = f66 + f67;
-    y[16] = f68 - f67;
-    f71 = f50 + f56;
-    f72 = MUL_C(COEF_CONST(1.1758756024193588), f50);
-    f73 = MUL_C(COEF_CONST((-0.9807852804032304)), f71);
-    f74 = MUL_C(COEF_CONST((-0.7856949583871021)), f56);
-    f75 = f72 + f73;
-    f76 = f74 - f73;
-    f77 = f52 + f54;
-    f78 = MUL_C(COEF_CONST(1.3870398453221473), f52);
-    f79 = MUL_C(COEF_CONST((-0.8314696123025455)), f77);
-    f80 = MUL_C(COEF_CONST((-0.2758993792829436)), f54);
-    f81 = f78 + f79;
-    f82 = f80 - f79;
-    f83 = f76 - f82;
-    y[8] = f76 + f82;
-    f85 = MUL_C(COEF_CONST(0.7071067811865476), f83);
-    y[56] = f75 - f81;
-    f87 = f75 + f81;
-    f88 = MUL_C(COEF_CONST(0.7071067811865476), f87);
-    y[40] = f85 - f88;
-    y[24] = f85 + f88;
-    f91 = f36 - f38;
-    f92 = f36 + f38;
-    f93 = f40 - f42;
-    f94 = f40 + f42;
-    f95 = f44 - f46;
-    f96 = f44 + f46;
-    f97 = MUL_C(COEF_CONST(0.7071067811865476), f94);
-    f98 = f34 - f97;
-    f99 = f34 + f97;
-    f100 = f92 + f96;
-    f101 = MUL_C(COEF_CONST(1.3065629648763766), f92);
-    f102 = MUL_C(COEF_CONST((-0.9238795325112866)), f100);
-    f103 = MUL_C(COEF_CONST((-0.5411961001461967)), f96);
-    f104 = f101 + f102;
-    f105 = f103 - f102;
-    f106 = f99 - f105;
-    f107 = f99 + f105;
-    f108 = f98 - f104;
-    f109 = f98 + f104;
-    f110 = f91 + f95;
-    f111 = MUL_C(COEF_CONST(1.3065629648763770), f91);
-    f112 = MUL_C(COEF_CONST((-0.3826834323650904)), f110);
-    f113 = MUL_C(COEF_CONST(0.5411961001461961), f95);
-    f114 = f111 + f112;
-    f115 = f113 - f112;
-    f116 = MUL_C(COEF_CONST(0.7071067811865476), f93);
-    f117 = f116 - f48;
-    f118 = f116 + f48;
-    f119 = f115 - f118;
-    f120 = f115 + f118;
-    f121 = f114 - f117;
-    f122 = f114 + f117;
-    f123 = f120 + f107;
-    f124 = MUL_C(COEF_CONST((-0.8971675863426361)), f120);
-    f125 = MUL_C(COEF_CONST(0.9951847266721968), f123);
-    f126 = MUL_C(COEF_CONST(1.0932018670017576), f107);
-    y[4] = f124 + f125;
-    y[60] = f126 - f125;
-    f129 = f122 + f109;
-    f130 = MUL_C(COEF_CONST((-0.6666556584777466)), f122);
-    f131 = MUL_C(COEF_CONST(0.9569403357322089), f129);
-    f132 = MUL_C(COEF_CONST(1.2472250129866713), f109);
-    y[12] = f130 + f131;
-    y[52] = f132 - f131;
-    f135 = f121 + f108;
-    f136 = MUL_C(COEF_CONST((-0.4105245275223571)), f121);
-    f137 = MUL_C(COEF_CONST(0.8819212643483549), f135);
-    f138 = MUL_C(COEF_CONST(1.3533180011743529), f108);
-    y[20] = f136 + f137;
-    y[44] = f138 - f137;
-    f141 = f119 + f106;
-    f142 = MUL_C(COEF_CONST((-0.1386171691990915)), f119);
-    f143 = MUL_C(COEF_CONST(0.7730104533627370), f141);
-    f144 = MUL_C(COEF_CONST(1.4074037375263826), f106);
-    y[28] = f142 + f143;
-    y[36] = f144 - f143;
-    f147 = f16 - f18;
-    f148 = f16 + f18;
-    f149 = MUL_C(COEF_CONST(0.7071067811865476), f148);
-    f150 = MUL_C(COEF_CONST(0.7071067811865476), f147);
-    f151 = f10 - f24;
-    f152 = f10 + f24;
-    f153 = MUL_C(COEF_CONST(0.7071067811865476), f152);
-    f154 = MUL_C(COEF_CONST(0.7071067811865476), f151);
-    f155 = f14 - f20;
-    f156 = f14 + f20;
-    f157 = MUL_C(COEF_CONST(0.7071067811865476), f156);
-    f158 = MUL_C(COEF_CONST(0.7071067811865476), f155);
-    f159 = f12 - f22;
-    f160 = f12 + f22;
-    f161 = MUL_C(COEF_CONST(0.7071067811865476), f160);
-    f162 = MUL_C(COEF_CONST(0.7071067811865476), f159);
-    f163 = f2 - f149;
-    f164 = f2 + f149;
-    f165 = f32 - f150;
-    f166 = f32 + f150;
-    f167 = f8 - f153;
-    f168 = f8 + f153;
-    f169 = f26 - f154;
-    f170 = f26 + f154;
-    f171 = f4 - f157;
-    f172 = f4 + f157;
-    f173 = f30 - f158;
-    f174 = f30 + f158;
-    f175 = f6 - f161;
-    f176 = f6 + f161;
-    f177 = f28 - f162;
-    f178 = f28 + f162;
-    f179 = f170 + f168;
-    f180 = MUL_C(COEF_CONST((-0.5411961001461969)), f170);
-    f181 = MUL_C(COEF_CONST(0.9238795325112867), f179);
-    f182 = MUL_C(COEF_CONST(1.3065629648763766), f168);
-    f183 = f180 + f181;
-    f184 = f182 - f181;
-    f185 = f169 + f167;
-    f186 = MUL_C(COEF_CONST(1.3065629648763770), f169);
-    f187 = MUL_C(COEF_CONST((-0.3826834323650904)), f185);
-    f188 = MUL_C(COEF_CONST(0.5411961001461961), f167);
-    f189 = f186 + f187;
-    f190 = f188 - f187;
-    f191 = f178 + f176;
-    f192 = MUL_C(COEF_CONST((-0.5411961001461969)), f178);
-    f193 = MUL_C(COEF_CONST(0.9238795325112867), f191);
-    f194 = MUL_C(COEF_CONST(1.3065629648763766), f176);
-    f195 = f192 + f193;
-    f196 = f194 - f193;
-    f197 = f177 + f175;
-    f198 = MUL_C(COEF_CONST(1.3065629648763770), f177);
-    f199 = MUL_C(COEF_CONST((-0.3826834323650904)), f197);
-    f200 = MUL_C(COEF_CONST(0.5411961001461961), f175);
-    f201 = f198 + f199;
-    f202 = f200 - f199;
-    f203 = f164 - f183;
-    f204 = f164 + f183;
-    f205 = f166 - f184;
-    f206 = f166 + f184;
-    f207 = f163 - f189;
-    f208 = f163 + f189;
-    f209 = f165 - f190;
-    f210 = f165 + f190;
-    f211 = f172 - f195;
-    f212 = f172 + f195;
-    f213 = f174 - f196;
-    f214 = f174 + f196;
-    f215 = f171 - f201;
-    f216 = f171 + f201;
-    f217 = f173 - f202;
-    f218 = f173 + f202;
-    f219 = f214 + f212;
-    f220 = MUL_C(COEF_CONST((-0.7856949583871021)), f214);
-    f221 = MUL_C(COEF_CONST(0.9807852804032304), f219);
-    f222 = MUL_C(COEF_CONST(1.1758756024193588), f212);
+    f0 = x[0] - x[31];
+    f1 = x[0] + x[31];
+    f2 = x[1] - x[30];
+    f3 = x[1] + x[30];
+    f4 = x[2] - x[29];
+    f5 = x[2] + x[29];
+    f6 = x[3] - x[28];
+    f7 = x[3] + x[28];
+    f8 = x[4] - x[27];
+    f9 = x[4] + x[27];
+    f10 = x[5] - x[26];
+    f11 = x[5] + x[26];
+    f12 = x[6] - x[25];
+    f13 = x[6] + x[25];
+    f14 = x[7] - x[24];
+    f15 = x[7] + x[24];
+    f16 = x[8] - x[23];
+    f17 = x[8] + x[23];
+    f18 = x[9] - x[22];
+    f19 = x[9] + x[22];
+    f20 = x[10] - x[21];
+    f21 = x[10] + x[21];
+    f22 = x[11] - x[20];
+    f23 = x[11] + x[20];
+    f24 = x[12] - x[19];
+    f25 = x[12] + x[19];
+    f26 = x[13] - x[18];
+    f27 = x[13] + x[18];
+    f28 = x[14] - x[17];
+    f29 = x[14] + x[17];
+    f30 = x[15] - x[16];
+    f31 = x[15] + x[16];
+    f32 = f1 - f31;
+    f33 = f1 + f31;
+    f34 = f3 - f29;
+    f35 = f3 + f29;
+    f36 = f5 - f27;
+    f37 = f5 + f27;
+    f38 = f7 - f25;
+    f39 = f7 + f25;
+    f40 = f9 - f23;
+    f41 = f9 + f23;
+    f42 = f11 - f21;
+    f43 = f11 + f21;
+    f44 = f13 - f19;
+    f45 = f13 + f19;
+    f46 = f15 - f17;
+    f47 = f15 + f17;
+    f48 = f33 - f47;
+    f49 = f33 + f47;
+    f50 = f35 - f45;
+    f51 = f35 + f45;
+    f52 = f37 - f43;
+    f53 = f37 + f43;
+    f54 = f39 - f41;
+    f55 = f39 + f41;
+    f56 = f49 - f55;
+    f57 = f49 + f55;
+    f58 = f51 - f53;
+    f59 = f51 + f53;
+    f60 = f57 - f59;
+    y[0] = f57 + f59;
+    y[16] = MUL_F(FRAC_CONST(0.7071067811865476), f60);
+    f63 = f56 + f58;
+    f64 = MUL_C(COEF_CONST(1.3065629648763766), f56);
+    f65 = MUL_F(FRAC_CONST(-0.9238795325112866), f63);
+    f66 = MUL_F(FRAC_CONST(-0.5411961001461967), f58);
+    y[24] = f64 + f65;
+    y[8] = f66 - f65;
+    f69 = f48 + f54;
+    f70 = MUL_C(COEF_CONST(1.1758756024193588), f48);
+    f71 = MUL_F(FRAC_CONST(-0.9807852804032304), f69);
+    f72 = MUL_F(FRAC_CONST(-0.7856949583871021), f54);
+    f73 = f70 + f71;
+    f74 = f72 - f71;
+    f75 = f50 + f52;
+    f76 = MUL_C(COEF_CONST(1.3870398453221473), f50);
+    f77 = MUL_F(FRAC_CONST(-0.8314696123025455), f75);
+    f78 = MUL_F(FRAC_CONST(-0.2758993792829436), f52);
+    f79 = f76 + f77;
+    f80 = f78 - f77;
+    f81 = f74 - f80;
+    y[4] = f74 + f80;
+    f83 = MUL_F(FRAC_CONST(0.7071067811865476), f81);
+    y[28] = f73 - f79;
+    f85 = f73 + f79;
+    f86 = MUL_F(FRAC_CONST(0.7071067811865476), f85);
+    y[20] = f83 - f86;
+    y[12] = f83 + f86;
+    f89 = f34 - f36;
+    f90 = f34 + f36;
+    f91 = f38 - f40;
+    f92 = f38 + f40;
+    f93 = f42 - f44;
+    f94 = f42 + f44;
+    f95 = MUL_F(FRAC_CONST(0.7071067811865476), f92);
+    f96 = f32 - f95;
+    f97 = f32 + f95;
+    f98 = f90 + f94;
+    f99 = MUL_C(COEF_CONST(1.3065629648763766), f90);
+    f100 = MUL_F(FRAC_CONST(-0.9238795325112866), f98);
+    f101 = MUL_F(FRAC_CONST(-0.5411961001461967), f94);
+    f102 = f99 + f100;
+    f103 = f101 - f100;
+    f104 = f97 - f103;
+    f105 = f97 + f103;
+    f106 = f96 - f102;
+    f107 = f96 + f102;
+    f108 = MUL_F(FRAC_CONST(0.7071067811865476), f91);
+    f109 = f46 - f108;
+    f110 = f46 + f108;
+    f111 = f93 + f89;
+    f112 = MUL_C(COEF_CONST(1.3065629648763766), f93);
+    f113 = MUL_F(FRAC_CONST(-0.9238795325112866), f111);
+    f114 = MUL_F(FRAC_CONST(-0.5411961001461967), f89);
+    f115 = f112 + f113;
+    f116 = f114 - f113;
+    f117 = f110 - f116;
+    f118 = f110 + f116;
+    f119 = f109 - f115;
+    f120 = f109 + f115;
+    f121 = f118 + f105;
+    f122 = MUL_F(FRAC_CONST(-0.8971675863426361), f118);
+    f123 = MUL_F(FRAC_CONST(0.9951847266721968), f121);
+    f124 = MUL_C(COEF_CONST(1.0932018670017576), f105);
+    y[2] = f122 + f123;
+    y[30] = f124 - f123;
+    f127 = f107 - f120;
+    f128 = MUL_F(FRAC_CONST(-0.6666556584777466), f120);
+    f129 = MUL_F(FRAC_CONST(0.9569403357322089), f127);
+    f130 = MUL_C(COEF_CONST(1.2472250129866713), f107);
+    y[6] = f129 - f128;
+    y[26] = f130 - f129;
+    f133 = f119 + f106;
+    f134 = MUL_F(FRAC_CONST(-0.4105245275223571), f119);
+    f135 = MUL_F(FRAC_CONST(0.8819212643483549), f133);
+    f136 = MUL_C(COEF_CONST(1.3533180011743529), f106);
+    y[10] = f134 + f135;
+    y[22] = f136 - f135;
+    f139 = f104 - f117;
+    f140 = MUL_F(FRAC_CONST(-0.1386171691990915), f117);
+    f141 = MUL_F(FRAC_CONST(0.7730104533627370), f139);
+    f142 = MUL_C(COEF_CONST(1.4074037375263826), f104);
+    y[14] = f141 - f140;
+    y[18] = f142 - f141;
+    f145 = f2 - f4;
+    f146 = f2 + f4;
+    f147 = f6 - f8;
+    f148 = f6 + f8;
+    f149 = f10 - f12;
+    f150 = f10 + f12;
+    f151 = f14 - f16;
+    f152 = f14 + f16;
+    f153 = f18 - f20;
+    f154 = f18 + f20;
+    f155 = f22 - f24;
+    f156 = f22 + f24;
+    f157 = f26 - f28;
+    f158 = f26 + f28;
+    f159 = MUL_F(FRAC_CONST(0.7071067811865476), f152);
+    f160 = f0 - f159;
+    f161 = f0 + f159;
+    f162 = f148 + f156;
+    f163 = MUL_C(COEF_CONST(1.3065629648763766), f148);
+    f164 = MUL_F(FRAC_CONST(-0.9238795325112866), f162);
+    f165 = MUL_F(FRAC_CONST(-0.5411961001461967), f156);
+    f166 = f163 + f164;
+    f167 = f165 - f164;
+    f168 = f161 - f167;
+    f169 = f161 + f167;
+    f170 = f160 - f166;
+    f171 = f160 + f166;
+    f172 = f146 + f158;
+    f173 = MUL_C(COEF_CONST(1.1758756024193588), f146);
+    f174 = MUL_F(FRAC_CONST(-0.9807852804032304), f172);
+    f175 = MUL_F(FRAC_CONST(-0.7856949583871021), f158);
+    f176 = f173 + f174;
+    f177 = f175 - f174;
+    f178 = f150 + f154;
+    f179 = MUL_C(COEF_CONST(1.3870398453221473), f150);
+    f180 = MUL_F(FRAC_CONST(-0.8314696123025455), f178);
+    f181 = MUL_F(FRAC_CONST(-0.2758993792829436), f154);
+    f182 = f179 + f180;
+    f183 = f181 - f180;
+    f184 = f177 - f183;
+    f185 = f177 + f183;
+    f186 = MUL_F(FRAC_CONST(0.7071067811865476), f184);
+    f187 = f176 - f182;
+    f188 = f176 + f182;
+    f189 = MUL_F(FRAC_CONST(0.7071067811865476), f188);
+    f190 = f186 - f189;
+    f191 = f186 + f189;
+    f192 = f169 - f185;
+    f193 = f169 + f185;
+    f194 = f171 - f191;
+    f195 = f171 + f191;
+    f196 = f170 - f190;
+    f197 = f170 + f190;
+    f198 = f168 - f187;
+    f199 = f168 + f187;
+    f200 = MUL_F(FRAC_CONST(0.7071067811865476), f151);
+    f201 = f30 - f200;
+    f202 = f30 + f200;
+    f203 = f155 + f147;
+    f204 = MUL_C(COEF_CONST(1.3065629648763766), f155);
+    f205 = MUL_F(FRAC_CONST(-0.9238795325112866), f203);
+    f206 = MUL_F(FRAC_CONST(-0.5411961001461967), f147);
+    f207 = f204 + f205;
+    f208 = f206 - f205;
+    f209 = f202 - f208;
+    f210 = f202 + f208;
+    f211 = f201 - f207;
+    f212 = f201 + f207;
+    f213 = f157 + f145;
+    f214 = MUL_C(COEF_CONST(1.1758756024193588), f157);
+    f215 = MUL_F(FRAC_CONST(-0.9807852804032304), f213);
+    f216 = MUL_F(FRAC_CONST(-0.7856949583871021), f145);
+    f217 = f214 + f215;
+    f218 = f216 - f215;
+    f219 = f153 + f149;
+    f220 = MUL_C(COEF_CONST(1.3870398453221473), f153);
+    f221 = MUL_F(FRAC_CONST(-0.8314696123025455), f219);
+    f222 = MUL_F(FRAC_CONST(-0.2758993792829436), f149);
     f223 = f220 + f221;
     f224 = f222 - f221;
-    f225 = f218 + f216;
-    f226 = MUL_C(COEF_CONST(0.2758993792829431), f218);
-    f227 = MUL_C(COEF_CONST(0.5555702330196022), f225);
-    f228 = MUL_C(COEF_CONST(1.3870398453221475), f216);
-    f229 = f226 + f227;
-    f230 = f228 - f227;
-    f231 = f213 + f211;
-    f232 = MUL_C(COEF_CONST(1.1758756024193591), f213);
-    f233 = MUL_C(COEF_CONST((-0.1950903220161287)), f231);
-    f234 = MUL_C(COEF_CONST(0.7856949583871016), f211);
-    f235 = f232 + f233;
-    f236 = f234 - f233;
-    f237 = f217 + f215;
-    f238 = MUL_C(COEF_CONST(1.3870398453221473), f217);
-    f239 = MUL_C(COEF_CONST((-0.8314696123025455)), f237);
-    f240 = MUL_C(COEF_CONST((-0.2758993792829436)), f215);
-    f241 = f238 + f239;
-    f242 = f240 - f239;
-    f243 = f204 - f223;
-    f244 = f204 + f223;
-    f245 = f206 - f224;
-    f246 = f206 + f224;
-    f247 = f208 - f229;
-    f248 = f208 + f229;
-    f249 = f210 - f230;
-    f250 = f210 + f230;
-    f251 = f203 - f235;
-    f252 = f203 + f235;
-    f253 = f205 - f236;
-    f254 = f205 + f236;
-    f255 = f207 - f241;
-    f256 = f207 + f241;
-    f257 = f209 - f242;
-    f258 = f209 + f242;
-    f259 = f246 + f244;
-    f260 = MUL_C(COEF_CONST((-0.9497277818777543)), f246);
-    f261 = MUL_C(COEF_CONST(0.9987954562051724), f259);
-    f262 = MUL_C(COEF_CONST(1.0478631305325905), f244);
-    y[2] = f260 + f261;
-    y[62] = f262 - f261;
-    f265 = f250 + f248;
-    f266 = MUL_C(COEF_CONST((-0.7270510732912801)), f250);
-    f267 = MUL_C(COEF_CONST(0.9700312531945440), f265);
-    f268 = MUL_C(COEF_CONST(1.2130114330978079), f248);
-    y[10] = f266 + f267;
-    y[54] = f268 - f267;
-    f271 = f254 + f252;
-    f272 = MUL_C(COEF_CONST((-0.4764341996931611)), f254);
-    f273 = MUL_C(COEF_CONST(0.9039892931234433), f271);
-    f274 = MUL_C(COEF_CONST(1.3315443865537255), f252);
-    y[18] = f272 + f273;
-    y[46] = f274 - f273;
-    f277 = f258 + f256;
-    f278 = MUL_C(COEF_CONST((-0.2075082269882114)), f258);
-    f279 = MUL_C(COEF_CONST(0.8032075314806448), f277);
-    f280 = MUL_C(COEF_CONST(1.3989068359730783), f256);
-    y[26] = f278 + f279;
-    y[38] = f280 - f279;
-    f283 = f245 + f243;
-    f284 = MUL_C(COEF_CONST(0.0693921705079408), f245);
-    f285 = MUL_C(COEF_CONST(0.6715589548470183), f283);
-    f286 = MUL_C(COEF_CONST(1.4125100802019774), f243);
-    y[34] = f284 + f285;
-    y[30] = f286 - f285;
-    f289 = f249 + f247;
-    f290 = MUL_C(COEF_CONST(0.3436258658070505), f249);
-    f291 = MUL_C(COEF_CONST(0.5141027441932217), f289);
-    f292 = MUL_C(COEF_CONST(1.3718313541934939), f247);
-    y[42] = f290 + f291;
-    y[22] = f292 - f291;
-    f295 = f253 + f251;
-    f296 = MUL_C(COEF_CONST(0.6046542117908007), f253);
-    f297 = MUL_C(COEF_CONST(0.3368898533922201), f295);
-    f298 = MUL_C(COEF_CONST(1.2784339185752409), f251);
-    y[50] = f296 + f297;
-    y[14] = f298 - f297;
-    f301 = f257 + f255;
-    f302 = MUL_C(COEF_CONST(0.8424460355094192), f257);
-    f303 = MUL_C(COEF_CONST(0.1467304744553618), f301);
-    f304 = MUL_C(COEF_CONST(1.1359069844201428), f255);
-    y[58] = f302 + f303;
-    y[6] = f304 - f303;
-    f307 = t2[1] + t2[63];
-    f308 = MUL_C(COEF_CONST(1.0242400472191162), t2[1]);
-    f309 = MUL_C(COEF_CONST((-0.9996988186962043)), f307);
-    f310 = MUL_C(COEF_CONST((-0.9751575901732922)), t2[63]);
-    f311 = f308 + f309;
-    f312 = f310 - f309;
-    f313 = t2[3] + t2[61];
-    f314 = MUL_C(COEF_CONST(1.0708550202783571),t2[3]);
-    f315 = MUL_C(COEF_CONST((-0.9972904566786902)), f313);
-    f316 = MUL_C(COEF_CONST((-0.9237258930790232)), t2[61]);
-    f317 = f314 + f315;
-    f318 = f316 - f315;
-    f319 = t2[5] + t2[59];
-    f320 = MUL_C(COEF_CONST(1.1148902097979256), t2[5]);
-    f321 = MUL_C(COEF_CONST((-0.9924795345987101)), f319);
-    f322 = MUL_C(COEF_CONST((-0.8700688593994945)), t2[59]);
-    f323 = f320 + f321;
-    f324 = f322 - f321;
-    f325 = t2[7] + t2[57];
-    f326 = MUL_C(COEF_CONST(1.1562395311492426), t2[7]);
-    f327 = MUL_C(COEF_CONST((-0.9852776423889412)), f325);
-    f328 = MUL_C(COEF_CONST((-0.8143157536286398)), t2[57]);
-    f329 = f326 + f327;
-    f330 = f328 - f327;
-    f331 = t2[9] + t2[55];
-    f332 = MUL_C(COEF_CONST(1.1948033701953984), t2[9]);
-    f333 = MUL_C(COEF_CONST((-0.9757021300385286)), f331);
-    f334 = MUL_C(COEF_CONST((-0.7566008898816589)), t2[55]);
-    f335 = f332 + f333;
-    f336 = f334 - f333;
-    f337 = t2[11] + t2[53];
-    f338 = MUL_C(COEF_CONST(1.2304888232703382), t2[11]);
-    f339 = MUL_C(COEF_CONST((-0.9637760657954400)), f337);
-    f340 = MUL_C(COEF_CONST((-0.6970633083205418)), t2[53]);
-    f341 = f338 + f339;
-    f342 = f340 - f339;
-    f343 = t2[13] + t2[51];
-    f344 = MUL_C(COEF_CONST(1.2632099209919279), t2[13]);
-    f345 = MUL_C(COEF_CONST((-0.9495281805930368)), f343);
-    f346 = MUL_C(COEF_CONST((-0.6358464401941457)), t2[51]);
-    f347 = f344 + f345;
-    f348 = f346 - f345;
-    f349 = t2[15] + t2[49];
-    f350 = MUL_C(COEF_CONST(1.2928878353697266), t2[15]);
-    f351 = MUL_C(COEF_CONST((-0.9329927988347391)), f349);
-    f352 = MUL_C(COEF_CONST((-0.5730977622997515)), t2[49]);
-    f353 = f350 + f351;
-    f354 = f352 - f351;
-    f355 = t2[17] + t2[47];
-    f356 = MUL_C(COEF_CONST(1.3194510697085207), t2[17]);
-    f357 = MUL_C(COEF_CONST((-0.9142097557035306)), f355);
-    f358 = MUL_C(COEF_CONST((-0.5089684416985405)), t2[47]);
-    f359 = f356 + f357;
-    f360 = f358 - f357;
-    f361 = t2[19] + t2[45];
-    f362 = MUL_C(COEF_CONST(1.3428356308501219), t2[19]);
-    f363 = MUL_C(COEF_CONST((-0.8932243011955153)), f361);
-    f364 = MUL_C(COEF_CONST((-0.4436129715409087)), t2[45]);
-    f365 = f362 + f363;
-    f366 = f364 - f363;
-    f367 = t2[21] + t2[43];
-    f368 = MUL_C(COEF_CONST(1.3629851833384954), t2[21]);
-    f369 = MUL_C(COEF_CONST((-0.8700869911087115)), f367);
-    f370 = MUL_C(COEF_CONST((-0.3771887988789276)), t2[43]);
-    f371 = f368 + f369;
-    f372 = f370 - f369;
-    f373 = t2[23] + t2[41];
-    f374 = MUL_C(COEF_CONST(1.3798511851368040), t2[23]);
-    f375 = MUL_C(COEF_CONST((-0.8448535652497072)), f373);
-    f376 = MUL_C(COEF_CONST((-0.3098559453626103)), t2[41]);
-    f377 = f374 + f375;
-    f378 = f376 - f375;
-    f379 = t2[25] + t2[39];
-    f380 = MUL_C(COEF_CONST(1.3933930045694289), t2[25]);
-    f381 = MUL_C(COEF_CONST((-0.8175848131515840)), f379);
-    f382 = MUL_C(COEF_CONST((-0.2417766217337392)), t2[39]);
-    f383 = f380 + f381;
-    f384 = f382 - f381;
-    f385 = t2[27] + t2[37];
-    f386 = MUL_C(COEF_CONST(1.4035780182072330), t2[27]);
-    f387 = MUL_C(COEF_CONST((-0.7883464276266061)), f385);
-    f388 = MUL_C(COEF_CONST((-0.1731148370459791)), t2[37]);
-    f389 = f386 + f387;
-    f390 = f388 - f387;
-    f391 = t2[29] + t2[35];
-    f392 = MUL_C(COEF_CONST(1.4103816894602614), t2[29]);
-    f393 = MUL_C(COEF_CONST((-0.7572088465064846)), f391);
-    f394 = MUL_C(COEF_CONST((-0.1040360035527078)), t2[35]);
-    f395 = f392 + f393;
-    f396 = f394 - f393;
-    f397 = t2[31] + t2[33];
-    f398 = MUL_C(COEF_CONST(1.4137876276885337), t2[31]);
-    f399 = MUL_C(COEF_CONST((-0.7242470829514670)), f397);
-    f400 = MUL_C(COEF_CONST((-0.0347065382144002)), t2[33]);
-    f401 = f398 + f399;
-    f402 = f400 - f399;
-    f403 = f312 - f402;
-    f404 = f312 + f402;
-    f405 = f318 - f396;
-    f406 = f318 + f396;
-    f407 = f324 - f390;
-    f408 = f324 + f390;
-    f409 = f330 - f384;
-    f410 = f330 + f384;
-    f411 = f336 - f378;
-    f412 = f336 + f378;
-    f413 = f342 - f372;
-    f414 = f342 + f372;
-    f415 = f348 - f366;
-    f416 = f348 + f366;
-    f417 = f354 - f360;
-    f418 = f354 + f360;
-    f419 = f404 - f418;
-    f420 = f404 + f418;
-    f421 = f406 - f416;
-    f422 = f406 + f416;
-    f423 = f408 - f414;
-    f424 = f408 + f414;
-    f425 = f410 - f412;
-    f426 = f410 + f412;
-    f427 = f420 - f426;
-    f428 = f420 + f426;
-    f429 = f422 - f424;
-    f430 = f422 + f424;
-    f431 = f428 - f430;
-    y[1] = f428 + f430;
-    f433 = MUL_C(COEF_CONST(0.7071067811865476), f431);
-    f434 = f427 + f429;
-    f435 = MUL_C(COEF_CONST(1.3065629648763766), f427);
-    f436 = MUL_C(COEF_CONST((-0.9238795325112866)), f434);
-    f437 = MUL_C(COEF_CONST((-0.5411961001461967)), f429);
-    f438 = f435 + f436;
-    f439 = f437 - f436;
-    f440 = f419 + f425;
-    f441 = MUL_C(COEF_CONST(1.1758756024193588), f419);
-    f442 = MUL_C(COEF_CONST((-0.9807852804032304)), f440);
-    f443 = MUL_C(COEF_CONST((-0.7856949583871021)), f425);
-    f444 = f441 + f442;
-    f445 = f443 - f442;
-    f446 = f421 + f423;
-    f447 = MUL_C(COEF_CONST(1.3870398453221473), f421);
-    f448 = MUL_C(COEF_CONST((-0.8314696123025455)), f446);
-    f449 = MUL_C(COEF_CONST((-0.2758993792829436)), f423);
-    f450 = f447 + f448;
-    f451 = f449 - f448;
-    f452 = f445 - f451;
-    f453 = f445 + f451;
-    f454 = MUL_C(COEF_CONST(0.7071067811865476), f452);
-    f455 = f444 - f450;
-    f456 = f444 + f450;
-    f457 = MUL_C(COEF_CONST(0.7071067811865476), f456);
-    f458 = f454 - f457;
-    f459 = f454 + f457;
-    f460 = f405 - f407;
-    f461 = f405 + f407;
-    f462 = f409 - f411;
-    f463 = f409 + f411;
-    f464 = f413 - f415;
-    f465 = f413 + f415;
-    f466 = MUL_C(COEF_CONST(0.7071067811865476), f463);
-    f467 = f403 - f466;
-    f468 = f403 + f466;
-    f469 = f461 + f465;
-    f470 = MUL_C(COEF_CONST(1.3065629648763766), f461);
-    f471 = MUL_C(COEF_CONST((-0.9238795325112866)), f469);
-    f472 = MUL_C(COEF_CONST((-0.5411961001461967)), f465);
-    f473 = f470 + f471;
-    f474 = f472 - f471;
-    f475 = f468 - f474;
-    f476 = f468 + f474;
-    f477 = f467 - f473;
-    f478 = f467 + f473;
-    f479 = f460 + f464;
-    f480 = MUL_C(COEF_CONST(1.3065629648763770), f460);
-    f481 = MUL_C(COEF_CONST((-0.3826834323650904)), f479);
-    f482 = MUL_C(COEF_CONST(0.5411961001461961), f464);
-    f483 = f480 + f481;
-    f484 = f482 - f481;
-    f485 = MUL_C(COEF_CONST(0.7071067811865476), f462);
-    f486 = f485 - f417;
-    f487 = f485 + f417;
-    f488 = f484 - f487;
-    f489 = f484 + f487;
-    f490 = f483 - f486;
-    f491 = f483 + f486;
-    f492 = f489 + f476;
-    f493 = MUL_C(COEF_CONST((-0.8971675863426361)), f489);
-    f494 = MUL_C(COEF_CONST(0.9951847266721968), f492);
-    f495 = MUL_C(COEF_CONST(1.0932018670017576), f476);
-    f496 = f493 + f494;
-    f497 = f495 - f494;
-    f498 = f491 + f478;
-    f499 = MUL_C(COEF_CONST((-0.6666556584777466)), f491);
-    f500 = MUL_C(COEF_CONST(0.9569403357322089), f498);
-    f501 = MUL_C(COEF_CONST(1.2472250129866713), f478);
-    f502 = f499 + f500;
-    f503 = f501 - f500;
-    f504 = f490 + f477;
-    f505 = MUL_C(COEF_CONST((-0.4105245275223571)), f490);
-    f506 = MUL_C(COEF_CONST(0.8819212643483549), f504);
-    f507 = MUL_C(COEF_CONST(1.3533180011743529), f477);
-    f508 = f505 + f506;
-    f509 = f507 - f506;
-    f510 = f488 + f475;
-    f511 = MUL_C(COEF_CONST((-0.1386171691990915)), f488);
-    f512 = MUL_C(COEF_CONST(0.7730104533627370), f510);
-    f513 = MUL_C(COEF_CONST(1.4074037375263826), f475);
-    f514 = f511 + f512;
-    f515 = f513 - f512;
-    f516 = f311 + f401;
-    f517 = f311 - f401;
-    f518 = f317 + f395;
-    f519 = f395 - f317;
-    f520 = f323 + f389;
-    f521 = f323 - f389;
-    f522 = f329 + f383;
-    f523 = f383 - f329;
-    f524 = f335 + f377;
-    f525 = f335 - f377;
-    f526 = f341 + f371;
-    f527 = f371 - f341;
-    f528 = f347 + f365;
-    f529 = f347 - f365;
-    f530 = f353 + f359;
-    f531 = f359 - f353;
-    f532 = f517 - f531;
-    f533 = f517 + f531;
-    f534 = f519 - f529;
-    f535 = f519 + f529;
-    f536 = f521 - f527;
-    f537 = f521 + f527;
-    f538 = f523 - f525;
-    f539 = f523 + f525;
-    f540 = f533 - f539;
-    f541 = f533 + f539;
-    f542 = f535 - f537;
-    f543 = f535 + f537;
-    f544 = f541 - f543;
-    y[63] = f541 + f543;
-    f546 = MUL_C(COEF_CONST(0.7071067811865476), f544);
-    f547 = f540 + f542;
-    f548 = MUL_C(COEF_CONST(1.3065629648763766), f540);
-    f549 = MUL_C(COEF_CONST((-0.9238795325112866)), f547);
-    f550 = MUL_C(COEF_CONST((-0.5411961001461967)), f542);
-    f551 = f548 + f549;
-    f552 = f550 - f549;
-    f553 = f532 + f538;
-    f554 = MUL_C(COEF_CONST(1.1758756024193588), f532);
-    f555 = MUL_C(COEF_CONST((-0.9807852804032304)), f553);
-    f556 = MUL_C(COEF_CONST((-0.7856949583871021)), f538);
-    f557 = f554 + f555;
-    f558 = f556 - f555;
-    f559 = f534 + f536;
-    f560 = MUL_C(COEF_CONST(1.3870398453221473), f534);
-    f561 = MUL_C(COEF_CONST((-0.8314696123025455)), f559);
-    f562 = MUL_C(COEF_CONST((-0.2758993792829436)), f536);
-    f563 = f560 + f561;
-    f564 = f562 - f561;
-    f565 = f558 - f564;
-    f566 = f558 + f564;
-    f567 = MUL_C(COEF_CONST(0.7071067811865476), f565);
-    f568 = f557 - f563;
-    f569 = f557 + f563;
-    f570 = MUL_C(COEF_CONST(0.7071067811865476), f569);
-    f571 = f567 - f570;
-    f572 = f567 + f570;
-    f573 = MUL_C(COEF_CONST(0.5024192861881557), f516);
-    f574 = MUL_C(COEF_CONST(0.5224986149396889), f518);
-    f575 = MUL_C(COEF_CONST(0.5669440348163577), f520);
-    f576 = MUL_C(COEF_CONST(0.6468217833599901), f522);
-    f577 = MUL_C(COEF_CONST(0.7881546234512502), f524);
-    f578 = MUL_C(COEF_CONST(1.0606776859903471), f526);
-    f579 = MUL_C(COEF_CONST(1.7224470982383342), f528);
-    f580 = MUL_C(COEF_CONST(5.1011486186891553), f530);
-    f581 = f573 + f580;
-    f582 = f573 - f580;
-    f583 = f574 + f579;
-    f584 = f579 - f574;
-    f585 = f575 + f578;
-    f586 = f575 - f578;
-    f587 = f576 + f577;
-    f588 = f577 - f576;
-    f589 = f582 - f588;
-    f590 = f582 + f588;
-    f591 = f584 - f586;
-    f592 = f584 + f586;
-    f593 = f590 - f592;
-    f594 = f590 + f592;
-    f595 = MUL_C(COEF_CONST(0.7071067811865476), f593);
-    f596 = f589 + f591;
-    f597 = MUL_C(COEF_CONST(1.3065629648763766), f589);
-    f598 = MUL_C(COEF_CONST((-0.9238795325112866)), f596);
-    f599 = MUL_C(COEF_CONST((-0.5411961001461967)), f591);
-    f600 = f597 + f598;
-    f601 = f599 - f598;
-    f602 = f583 + f585;
-    f603 = f585 - f583;
-    f604 = MUL_C(COEF_CONST(0.7071067811865476), f603);
-    f605 = MUL_C(COEF_CONST(0.7071067811865476), f602);
-    f606 = f581 - f604;
-    f607 = f581 + f604;
-    f608 = f605 - f587;
-    f609 = f587 + f605;
-    f610 = f607 - f609;
-    f611 = MUL_C(COEF_CONST((-0.7856949583871021)), f609);
-    f612 = MUL_C(COEF_CONST(0.9807852804032304), f610);
-    f613 = MUL_C(COEF_CONST(1.1758756024193588), f607);
-    f614 = f612 - f611;
-    f615 = f613 - f612;
-    f616 = f608 + f606;
-    f617 = MUL_C(COEF_CONST(0.2758993792829431), f608);
-    f618 = MUL_C(COEF_CONST(0.5555702330196022), f616);
-    f619 = MUL_C(COEF_CONST(1.3870398453221475), f606);
-    f620 = f617 + f618;
-    f621 = f619 - f618;
-    f622 = f594 + f614;
-    f623 = f614 + f601;
-    f624 = f601 + f621;
-    f625 = f621 + f595;
-    f626 = f595 + f620;
-    f627 = f620 + f600;
-    f628 = f600 + f615;
-    y[5] = f496 - f615;
-    y[3] = f496 + f615;
-    y[9] = f453 - f568;
-    y[7] = f453 + f568;
-    y[13] = f502 - f628;
-    y[11] = f502 + f628;
-    y[17] = f439 - f551;
-    y[15] = f439 + f551;
-    y[21] = f508 - f627;
-    y[19] = f508 + f627;
-    y[25] = f459 - f571;
-    y[23] = f459 + f571;
-    y[29] = f514 - f626;
-    y[27] = f514 + f626;
-    y[33] = f433 - f546;
-    y[31] = f433 + f546;
-    y[37] = f515 - f625;
-    y[35] = f515 + f625;
-    y[41] = f458 - f572;
-    y[39] = f458 + f572;
-    y[45] = f509 - f624;
-    y[43] = f509 + f624;
-    y[49] = f438 - f552;
-    y[47] = f438 + f552;
-    y[53] = f503 - f623;
-    y[51] = f503 + f623;
-    y[57] = f455 - f566;
-    y[55] = f455 + f566;
-    y[61] = f497 - f622;
-    y[59] = f497 + f622;
-}
-
-void DST2_64_unscaled(real_t *y, real_t *x)
-{
-    int16_t i0;
-    real_t f2, f3, f4, f5, f6, f7;
-    real_t f8, f9, f10, f11, f12, f13;
-    real_t f14, f15, f16, f17, f18, f19;
-    real_t f20, f21, f22, f23, f24, f25;
-    real_t f26, f27, f28, f29, f30, f31;
-    real_t f32, f33, f34, f35, f36, f37;
-    real_t f38, f39, f40, f41, f42, f43;
-    real_t f44, f45, f46, f47, f48, f49;
-    real_t f50, f51, f52, f53, f54, f55;
-    real_t f56, f57, f58, f59, f60, f61;
-    real_t f62, f63, f64, f65, f66, f67;
-    real_t f68, f69, f70, f71, f72, f73;
-    real_t f74, f75, f76, f77, f78, f79;
-    real_t f80, f81, f82, f83, f84, f85;
-    real_t f86, f87, f88, f89, f90, f91;
-    real_t f92, f93, f94, f95, f96, f97;
-    real_t f98, f99, f100, f101, f102, f103;
-    real_t f104, f105, f106, f107, f108, f109;
-    real_t f110, f111, f112, f113, f114, f115;
-    real_t f116, f117, f118, f119, f120, f121;
-    real_t f122, f123, f124, f125, f126, f127;
-    real_t f128, f129, f130, f131, f132, f133;
-    real_t f134, f135, f136, f137, f138, f139;
-    real_t f140, f141, f142, f143, f144, f145;
-    real_t f146, f147, f148, f149, f150, f151;
-    real_t f152, f153, f154, f155, f156, f157;
-    real_t f158, f159, f160, f161, f162, f163;
-    real_t f164, f165, f166, f167, f168, f169;
-    real_t f170, f171, f172, f173, f174, f175;
-    real_t f176, f177, f178, f179, f180, f181;
-    real_t f182, f183, f184, f185, f186, f187;
-    real_t f188, f189, f190, f191, f192, f193;
-    real_t f194, f195, f196, f197, f198, f199;
-    real_t f200, f201, f202, f203, f204, f205;
-    real_t f206, f207, f208, f209, f210, f211;
-    real_t f212, f213, f214, f215, f216, f217;
-    real_t f218, f219, f220, f221, f222, f223;
-    real_t f224, f225, f226, f227, f228, f229;
-    real_t f230, f231, f232, f233, f234, f235;
-    real_t f236, f237, f238, f239, f240, f241;
-    real_t f242, f243, f244, f245, f246, f247;
-    real_t f248, f249, f250, f251, f252, f253;
-    real_t f254, f255, f256, f257, f258, f259;
-    real_t f260, f261, f264, f265, f266, f267;
-    real_t f270, f271, f272, f273, f276, f277;
-    real_t f278, f279, f282, f283, f284, f285;
-    real_t f288, f289, f290, f291, f294, f295;
-    real_t f296, f297, f300, f301, f302, f303;
-    real_t f306, f307, f308, f309, f312, f313;
-    real_t f314, f315, f318, f319, f320, f321;
-    real_t f324, f325, f326, f327, f330, f331;
-    real_t f332, f333, f336, f337, f338, f339;
-    real_t f342, f343, f344, f345, f348, f349;
-    real_t f350, f351, f354, f355, f356, f357;
-    real_t f358, f359, f360, f361, f362, f363;
-    real_t f364, f365, f366, f367, f368, f369;
-    real_t f370, f371, f372, f373, f374, f375;
-    real_t f376, f377, f378, f379, f380, f381;
-    real_t f382, f383, f384, f385, f386, f387;
-    real_t f388, f389, f390, f391, f392, f393;
-    real_t f394, f395, f396, f397, f398, f399;
-    real_t f400, f401, f402, f403, f404, f405;
-    real_t f406, f407, f408, f409, f410, f411;
-    real_t f412, f413, f414, f415, f416, f417;
-    real_t f418, f419, f420, f421, f422, f423;
-    real_t f424, f425, f426, f427, f428, f429;
-    real_t f430, f431, f432, f433, f434, f435;
-    real_t f436, f437, f438, f439, f440, f441;
-    real_t f442, f443, f444, f445, f446, f447;
-    real_t f448, f449, f450, f451, f452, f453;
-    real_t f454, f455, f456, f457, f458, f459;
-    real_t f460, f461, f462, f463, f464, f465;
-    real_t f466, f467, f468, f469, f470, f471;
-    real_t f472, f473, f474, f475, f476, f477;
-    real_t f478, f479, f480, f481, f482, f483;
-    real_t f484, f485, f486, f487, f488, f489;
-    real_t f490, f491, f492, f493, f494, f495;
-    real_t f496, f497, f498, f499, f500, f501;
-    real_t f504, f505, f506, f507, f510, f511;
-    real_t f512, f513, f516, f517, f518, f519;
-    real_t f522, f523, f524, f525, f528, f529;
-    real_t f530, f531, f534, f535, f536, f537;
-    real_t f540, f541, f542, f543, f546, f547;
-    real_t f548, f549, f550, f551, f552, f553;
-    real_t f554, f555, f556, f557, f558, f559;
-    real_t f560, f561, f562, f563, f564, f565;
-    real_t f566, f567, f568, f569, f570, f571;
-    real_t f572, f573, f574, f577, f578, f579;
-    real_t f580, f583, f584, f585, f586, f587;
-    real_t f588, f589, f590, f591, f592, f593;
-    real_t f594, f595, f596, f597, f598, f603;
-    real_t f604, f605, f606, f607, f608, f609;
-    real_t f610, f611, f612, f613, f614, f615;
-    real_t f616, f617, f618, f619, f620, f621;
-    real_t f622, f623, f624, f625, f626, f627;
-    real_t f628, f629, f630, f631, f632, f633;
-    real_t f634, f635, f636, f637, f638, f639;
-    real_t f640, f641, f642, f643, f644, f645;
-    real_t f646, f647, f648, f649, f650;
-    ALIGN static real_t t2[64];
-
-    for (i0=0; i0<32; i0++)
-    {
-        t2[2*i0+1] = x[i0] - x[-i0+63];
-        t2[2*i0] = x[i0] + x[-i0+63];
-    }
-    f2 = t2[2] + t2[4];
-    f3 = t2[4] - t2[2];
-    f4 = t2[6] + t2[8];
-    f5 = t2[8] - t2[6];
-    f6 = t2[10] + t2[12];
-    f7 = t2[12] - t2[10];
-    f8 = t2[14] + t2[16];
-    f9 = t2[16] - t2[14];
-    f10 = t2[18] + t2[20];
-    f11 = t2[20] - t2[18];
-    f12 = t2[22] + t2[24];
-    f13 = t2[24] - t2[22];
-    f14 = t2[26] + t2[28];
-    f15 = t2[28] - t2[26];
-    f16 = t2[30] + t2[32];
-    f17 = t2[32] - t2[30];
-    f18 = t2[34] + t2[36];
-    f19 = t2[36] - t2[34];
-    f20 = t2[38] + t2[40];
-    f21 = t2[40] - t2[38];
-    f22 = t2[42] + t2[44];
-    f23 = t2[44] - t2[42];
-    f24 = t2[46] + t2[48];
-    f25 = t2[48] - t2[46];
-    f26 = t2[50] + t2[52];
-    f27 = t2[52] - t2[50];
-    f28 = t2[54] + t2[56];
-    f29 = t2[56] - t2[54];
-    f30 = t2[58] + t2[60];
-    f31 = t2[60] - t2[58];
-    f32 = MUL_C(COEF_CONST(0.7071067811865476), f17);
-    f33 = t2[0] - f32;
-    f34 = t2[0] + f32;
-    f35 = f9 + f25;
-    f36 = MUL_C(COEF_CONST(1.3065629648763766), f9);
-    f37 = MUL_C(COEF_CONST((-0.9238795325112866)), f35);
-    f38 = MUL_C(COEF_CONST((-0.5411961001461967)), f25);
-    f39 = f36 + f37;
-    f40 = f38 - f37;
-    f41 = f34 - f40;
-    f42 = f34 + f40;
-    f43 = f33 - f39;
-    f44 = f33 + f39;
-    f45 = MUL_C(COEF_CONST(2.5629154477415064), f5);
-    f46 = MUL_C(COEF_CONST(0.8999762231364158), f13);
-    f47 = MUL_C(COEF_CONST(0.5097955791041592), f29);
-    f48 = MUL_C(COEF_CONST(0.6013448869350453), f21);
-    f49 = f45 - f47;
-    f50 = f45 + f47;
-    f51 = f46 - f48;
-    f52 = f46 + f48;
-    f53 = f50 + f52;
-    f54 = MUL_C(COEF_CONST(1.3065629648763770), f50);
-    f55 = MUL_C(COEF_CONST((-0.3826834323650904)), f53);
-    f56 = MUL_C(COEF_CONST(0.5411961001461961), f52);
-    f57 = f54 + f55;
-    f58 = f56 - f55;
-    f59 = f51 - f49;
-    f60 = f49 + f51;
-    f61 = MUL_C(COEF_CONST(0.7071067811865476), f60);
-    f62 = f58 - f61;
-    f63 = f57 - f61;
-    f64 = f59 + f57;
-    f65 = f42 - f58;
-    f66 = f42 + f58;
-    f67 = f44 + f62;
-    f68 = f44 - f62;
-    f69 = f43 - f63;
-    f70 = f43 + f63;
-    f71 = f41 + f64;
-    f72 = f41 - f64;
-    f73 = f7 - f11;
-    f74 = f7 + f11;
-    f75 = f15 - f19;
-    f76 = f15 + f19;
-    f77 = f23 - f27;
-    f78 = f23 + f27;
-    f79 = MUL_C(COEF_CONST(0.7071067811865476), f76);
-    f80 = f3 - f79;
-    f81 = f3 + f79;
-    f82 = f74 + f78;
-    f83 = MUL_C(COEF_CONST(1.3065629648763766), f74);
-    f84 = MUL_C(COEF_CONST((-0.9238795325112866)), f82);
-    f85 = MUL_C(COEF_CONST((-0.5411961001461967)), f78);
-    f86 = f83 + f84;
-    f87 = f85 - f84;
-    f88 = f81 - f87;
-    f89 = f81 + f87;
-    f90 = f80 - f86;
-    f91 = f80 + f86;
-    f92 = MUL_C(COEF_CONST(0.7071067811865476), f75);
-    f93 = f31 - f92;
-    f94 = f31 + f92;
-    f95 = f77 + f73;
-    f96 = MUL_C(COEF_CONST(1.3065629648763766), f77);
-    f97 = MUL_C(COEF_CONST((-0.9238795325112866)), f95);
-    f98 = MUL_C(COEF_CONST((-0.5411961001461967)), f73);
-    f99 = f96 + f97;
-    f100 = f98 - f97;
-    f101 = f94 - f100;
-    f102 = f94 + f100;
-    f103 = f93 - f99;
-    f104 = f93 + f99;
-    f105 = f102 + f89;
-    f106 = MUL_C(COEF_CONST((-0.8971675863426361)), f102);
-    f107 = MUL_C(COEF_CONST(0.9951847266721968), f105);
-    f108 = MUL_C(COEF_CONST(1.0932018670017576), f89);
-    f109 = f106 + f107;
-    f110 = f108 - f107;
-    f111 = f91 - f104;
-    f112 = MUL_C(COEF_CONST((-0.6666556584777466)), f104);
-    f113 = MUL_C(COEF_CONST(0.9569403357322089), f111);
-    f114 = MUL_C(COEF_CONST(1.2472250129866713), f91);
-    f115 = f113 - f112;
-    f116 = f114 - f113;
-    f117 = f103 + f90;
-    f118 = MUL_C(COEF_CONST((-0.4105245275223571)), f103);
-    f119 = MUL_C(COEF_CONST(0.8819212643483549), f117);
-    f120 = MUL_C(COEF_CONST(1.3533180011743529), f90);
-    f121 = f118 + f119;
-    f122 = f120 - f119;
-    f123 = f88 - f101;
-    f124 = MUL_C(COEF_CONST((-0.1386171691990915)), f101);
-    f125 = MUL_C(COEF_CONST(0.7730104533627370), f123);
-    f126 = MUL_C(COEF_CONST(1.4074037375263826), f88);
-    f127 = f125 - f124;
-    f128 = f126 - f125;
-    f129 = f66 - f109;
-    f130 = f66 + f109;
-    f131 = f68 - f115;
-    f132 = f68 + f115;
-    f133 = f70 - f121;
-    f134 = f70 + f121;
-    f135 = f72 - f127;
-    f136 = f72 + f127;
-    f137 = f71 - f128;
-    f138 = f71 + f128;
-    f139 = f69 - f122;
-    f140 = f69 + f122;
-    f141 = f67 - f116;
-    f142 = f67 + f116;
-    f143 = f65 - f110;
-    f144 = f65 + f110;
-    f145 = f26 + f30;
-    f146 = f22 + f26;
-    f147 = f18 + f22;
-    f148 = f14 + f18;
-    f149 = f10 + f14;
-    f150 = f6 + f10;
-    f151 = f2 + f6;
-    f152 = MUL_C(COEF_CONST(0.7071067811865476), f148);
-    f153 = f152 - f30;
-    f154 = f30 + f152;
-    f155 = f146 + f150;
-    f156 = MUL_C(COEF_CONST(1.3065629648763766), f146);
-    f157 = MUL_C(COEF_CONST((-0.9238795325112866)), f155);
-    f158 = MUL_C(COEF_CONST((-0.5411961001461967)), f150);
-    f159 = f156 + f157;
-    f160 = f157 - f158;
-    f161 = f154 + f160;
-    f162 = f160 - f154;
-    f163 = f153 + f159;
-    f164 = f153 - f159;
-    f165 = f147 + f145;
-    f166 = f149 + f147;
-    f167 = f151 + f149;
-    f168 = MUL_C(COEF_CONST(0.7071067811865476), f166);
-    f169 = f168 - f145;
-    f170 = f145 + f168;
-    f171 = f165 + f167;
-    f172 = MUL_C(COEF_CONST(1.3065629648763766), f165);
-    f173 = MUL_C(COEF_CONST((-0.9238795325112866)), f171);
-    f174 = MUL_C(COEF_CONST((-0.5411961001461967)), f167);
-    f175 = f172 + f173;
-    f176 = f173 - f174;
-    f177 = f170 + f176;
-    f178 = f176 - f170;
-    f179 = f169 + f175;
-    f180 = f169 - f175;
-    f181 = MUL_C(COEF_CONST(0.5097955791041592), f178);
-    f182 = MUL_C(COEF_CONST(0.6013448869350453), f180);
-    f183 = MUL_C(COEF_CONST(0.8999762231364156), f179);
-    f184 = MUL_C(COEF_CONST(2.5629154477415055), f177);
-    f185 = f162 - f181;
-    f186 = f162 + f181;
-    f187 = f164 - f182;
-    f188 = f164 + f182;
-    f189 = f163 - f183;
-    f190 = f163 + f183;
-    f191 = f184 - f161;
-    f192 = f161 + f184;
-    f193 = MUL_C(COEF_CONST(0.5024192861881557), f186);
-    f194 = MUL_C(COEF_CONST(0.5224986149396889), f188);
-    f195 = MUL_C(COEF_CONST(0.5669440348163577), f190);
-    f196 = MUL_C(COEF_CONST(0.6468217833599901), f192);
-    f197 = MUL_C(COEF_CONST(0.7881546234512502), f191);
-    f198 = MUL_C(COEF_CONST(1.0606776859903471), f189);
-    f199 = MUL_C(COEF_CONST(1.7224470982383342), f187);
-    f200 = MUL_C(COEF_CONST(5.1011486186891553), f185);
-    f201 = MUL_C(COEF_CONST(0.7071067811865476), f16);
-    f202 = f201 - t2[62];
-    f203 = t2[62] + f201;
-    f204 = f24 + f8;
-    f205 = MUL_C(COEF_CONST(1.3065629648763766), f24);
-    f206 = MUL_C(COEF_CONST((-0.9238795325112866)), f204);
-    f207 = MUL_C(COEF_CONST((-0.5411961001461967)), f8);
-    f208 = f205 + f206;
-    f209 = f206 - f207;
-    f210 = f203 + f209;
-    f211 = f209 - f203;
-    f212 = f202 + f208;
-    f213 = f202 - f208;
-    f214 = f20 + f28;
-    f215 = f12 + f20;
-    f216 = f4 + f12;
-    f217 = MUL_C(COEF_CONST(0.7071067811865476), f215);
-    f218 = f217 - f28;
-    f219 = f28 + f217;
-    f220 = f214 + f216;
-    f221 = MUL_C(COEF_CONST(1.3065629648763766), f214);
-    f222 = MUL_C(COEF_CONST((-0.9238795325112866)), f220);
-    f223 = MUL_C(COEF_CONST((-0.5411961001461967)), f216);
-    f224 = f221 + f222;
-    f225 = f222 - f223;
-    f226 = f219 + f225;
-    f227 = f225 - f219;
-    f228 = f218 + f224;
-    f229 = f218 - f224;
-    f230 = MUL_C(COEF_CONST(0.5097955791041592), f227);
-    f231 = MUL_C(COEF_CONST(0.6013448869350453), f229);
-    f232 = MUL_C(COEF_CONST(0.8999762231364156), f228);
-    f233 = MUL_C(COEF_CONST(2.5629154477415055), f226);
-    f234 = f211 - f230;
-    f235 = f211 + f230;
-    f236 = f213 - f231;
-    f237 = f213 + f231;
-    f238 = f212 - f232;
-    f239 = f212 + f232;
-    f240 = f233 - f210;
-    f241 = f210 + f233;
-    f242 = f193 - f235;
-    f243 = f193 + f235;
-    f244 = f237 - f194;
-    f245 = f194 + f237;
-    f246 = f195 - f239;
-    f247 = f195 + f239;
-    f248 = f196 - f241;
-    f249 = f196 + f241;
-    f250 = f197 - f240;
-    f251 = f197 + f240;
-    f252 = f238 - f198;
-    f253 = f198 + f238;
-    f254 = f199 - f236;
-    f255 = f199 + f236;
-    f256 = f234 - f200;
-    f257 = f200 + f234;
-    f258 = f243 + f130;
-    f259 = MUL_C(COEF_CONST((-0.9751575901732920)), f243);
-    f260 = MUL_C(COEF_CONST(0.9996988186962043), f258);
-    f261 = MUL_C(COEF_CONST(1.0242400472191164), f130);
-    y[62] = f259 + f260;
-    y[0] = f261 - f260;
-    f264 = f132 - f245;
-    f265 = MUL_C(COEF_CONST((-0.9237258930790228)), f245);
-    f266 = MUL_C(COEF_CONST(0.9972904566786902), f264);
-    f267 = MUL_C(COEF_CONST(1.0708550202783576), f132);
-    y[60] = f266 - f265;
-    y[2] = f267 - f266;
-    f270 = f247 + f134;
-    f271 = MUL_C(COEF_CONST((-0.8700688593994936)), f247);
-    f272 = MUL_C(COEF_CONST(0.9924795345987100), f270);
-    f273 = MUL_C(COEF_CONST(1.1148902097979263), f134);
-    y[58] = f271 + f272;
-    y[4] = f273 - f272;
-    f276 = f249 + f136;
-    f277 = MUL_C(COEF_CONST((-0.8143157536286398)), f249);
-    f278 = MUL_C(COEF_CONST(0.9852776423889412), f276);
-    f279 = MUL_C(COEF_CONST(1.1562395311492426), f136);
-    y[56] = f277 + f278;
-    y[6] = f279 - f278;
-    f282 = f251 + f138;
-    f283 = MUL_C(COEF_CONST((-0.7566008898816587)), f251);
-    f284 = MUL_C(COEF_CONST(0.9757021300385286), f282);
-    f285 = MUL_C(COEF_CONST(1.1948033701953984), f138);
-    y[54] = f283 + f284;
-    y[8] = f285 - f284;
-    f288 = f140 - f253;
-    f289 = MUL_C(COEF_CONST((-0.6970633083205414)), f253);
-    f290 = MUL_C(COEF_CONST(0.9637760657954398), f288);
-    f291 = MUL_C(COEF_CONST(1.2304888232703384), f140);
-    y[52] = f290 - f289;
-    y[10] = f291 - f290;
-    f294 = f255 + f142;
-    f295 = MUL_C(COEF_CONST((-0.6358464401941451)), f255);
-    f296 = MUL_C(COEF_CONST(0.9495281805930367), f294);
-    f297 = MUL_C(COEF_CONST(1.2632099209919283), f142);
-    y[50] = f295 + f296;
-    y[12] = f297 - f296;
-    f300 = f144 - f257;
-    f301 = MUL_C(COEF_CONST((-0.5730977622997506)), f257);
-    f302 = MUL_C(COEF_CONST(0.9329927988347389), f300);
-    f303 = MUL_C(COEF_CONST(1.2928878353697271), f144);
-    y[48] = f302 - f301;
-    y[14] = f303 - f302;
-    f306 = f256 + f143;
-    f307 = MUL_C(COEF_CONST((-0.5089684416985408)), f256);
-    f308 = MUL_C(COEF_CONST(0.9142097557035307), f306);
-    f309 = MUL_C(COEF_CONST(1.3194510697085207), f143);
-    y[46] = f307 + f308;
-    y[16] = f309 - f308;
-    f312 = f254 + f141;
-    f313 = MUL_C(COEF_CONST((-0.4436129715409087)), f254);
-    f314 = MUL_C(COEF_CONST(0.8932243011955153), f312);
-    f315 = MUL_C(COEF_CONST(1.3428356308501219), f141);
-    y[44] = f313 + f314;
-    y[18] = f315 - f314;
-    f318 = f252 + f139;
-    f319 = MUL_C(COEF_CONST((-0.3771887988789273)), f252);
-    f320 = MUL_C(COEF_CONST(0.8700869911087114), f318);
-    f321 = MUL_C(COEF_CONST(1.3629851833384954), f139);
-    y[42] = f319 + f320;
-    y[20] = f321 - f320;
-    f324 = f250 + f137;
-    f325 = MUL_C(COEF_CONST((-0.3098559453626097)), f250);
-    f326 = MUL_C(COEF_CONST(0.8448535652497070), f324);
-    f327 = MUL_C(COEF_CONST(1.3798511851368043), f137);
-    y[40] = f325 + f326;
-    y[22] = f327 - f326;
-    f330 = f248 + f135;
-    f331 = MUL_C(COEF_CONST((-0.2417766217337384)), f248);
-    f332 = MUL_C(COEF_CONST(0.8175848131515837), f330);
-    f333 = MUL_C(COEF_CONST(1.3933930045694289), f135);
-    y[38] = f331 + f332;
-    y[24] = f333 - f332;
-    f336 = f246 + f133;
-    f337 = MUL_C(COEF_CONST((-0.1731148370459794)), f246);
-    f338 = MUL_C(COEF_CONST(0.7883464276266062), f336);
-    f339 = MUL_C(COEF_CONST(1.4035780182072330), f133);
-    y[36] = f337 + f338;
-    y[26] = f339 - f338;
-    f342 = f244 + f131;
-    f343 = MUL_C(COEF_CONST((-0.1040360035527077)), f244);
-    f344 = MUL_C(COEF_CONST(0.7572088465064845), f342);
-    f345 = MUL_C(COEF_CONST(1.4103816894602612), f131);
-    y[34] = f343 + f344;
-    y[28] = f345 - f344;
-    f348 = f242 + f129;
-    f349 = MUL_C(COEF_CONST((-0.0347065382144000)), f242);
-    f350 = MUL_C(COEF_CONST(0.7242470829514669), f348);
-    f351 = MUL_C(COEF_CONST(1.4137876276885337), f129);
-    y[32] = f349 + f350;
-    y[30] = f351 - f350;
-    f354 = t2[1] - t2[63];
-    f355 = t2[1] + t2[63];
-    f356 = t2[3] - t2[61];
-    f357 = t2[3] + t2[61];
-    f358 = t2[5] - t2[59];
-    f359 = t2[5] + t2[59];
-    f360 = t2[7] - t2[57];
-    f361 = t2[7] + t2[57];
-    f362 = t2[9] - t2[55];
-    f363 = t2[9] + t2[55];
-    f364 = t2[11] - t2[53];
-    f365 = t2[11] + t2[53];
-    f366 = t2[13] - t2[51];
-    f367 = t2[13] + t2[51];
-    f368 = t2[15] - t2[49];
-    f369 = t2[15] + t2[49];
-    f370 = t2[17] - t2[47];
-    f371 = t2[17] + t2[47];
-    f372 = t2[19] - t2[45];
-    f373 = t2[19] + t2[45];
-    f374 = t2[21] - t2[43];
-    f375 = t2[21] + t2[43];
-    f376 = t2[23] - t2[41];
-    f377 = t2[23] + t2[41];
-    f378 = t2[25] - t2[39];
-    f379 = t2[25] + t2[39];
-    f380 = t2[27] - t2[37];
-    f381 = t2[27] + t2[37];
-    f382 = t2[29] - t2[35];
-    f383 = t2[29] + t2[35];
-    f384 = t2[31] - t2[33];
-    f385 = t2[31] + t2[33];
-    f386 = f369 + f371;
-    f387 = f371 - f369;
-    f388 = MUL_C(COEF_CONST(0.7071067811865476), f387);
-    f389 = MUL_C(COEF_CONST(0.7071067811865476), f386);
-    f390 = f363 + f377;
-    f391 = f363 - f377;
-    f392 = MUL_C(COEF_CONST(0.7071067811865476), f391);
-    f393 = MUL_C(COEF_CONST(0.7071067811865476), f390);
-    f394 = f367 + f373;
-    f395 = f367 - f373;
-    f396 = MUL_C(COEF_CONST(0.7071067811865476), f395);
-    f397 = MUL_C(COEF_CONST(0.7071067811865476), f394);
-    f398 = f365 + f375;
-    f399 = f375 - f365;
-    f400 = MUL_C(COEF_CONST(0.7071067811865476), f399);
-    f401 = MUL_C(COEF_CONST(0.7071067811865476), f398);
-    f402 = f355 - f388;
-    f403 = f355 + f388;
-    f404 = f389 - f385;
-    f405 = f385 + f389;
-    f406 = f361 + f392;
-    f407 = f392 - f361;
-    f408 = f379 - f393;
-    f409 = f379 + f393;
-    f410 = f357 + f396;
-    f411 = f396 - f357;
-    f412 = f383 - f397;
-    f413 = f383 + f397;
-    f414 = f359 - f400;
-    f415 = f359 + f400;
-    f416 = f401 - f381;
-    f417 = f381 + f401;
-    f418 = f409 + f407;
-    f419 = MUL_C(COEF_CONST((-0.5411961001461969)), f409);
-    f420 = MUL_C(COEF_CONST(0.9238795325112867), f418);
-    f421 = MUL_C(COEF_CONST(1.3065629648763766), f407);
-    f422 = f419 + f420;
-    f423 = f421 - f420;
-    f424 = f408 - f406;
-    f425 = MUL_C(COEF_CONST(1.3065629648763770), f408);
-    f426 = MUL_C(COEF_CONST((-0.3826834323650904)), f424);
-    f427 = MUL_C(COEF_CONST(0.5411961001461961), f406);
-    f428 = f425 + f426;
-    f429 = f426 + f427;
-    f430 = f415 - f417;
-    f431 = MUL_C(COEF_CONST((-0.5411961001461969)), f417);
-    f432 = MUL_C(COEF_CONST(0.9238795325112867), f430);
-    f433 = MUL_C(COEF_CONST(1.3065629648763766), f415);
-    f434 = f432 - f431;
-    f435 = f433 - f432;
-    f436 = f416 + f414;
-    f437 = MUL_C(COEF_CONST(1.3065629648763770), f416);
-    f438 = MUL_C(COEF_CONST((-0.3826834323650904)), f436);
-    f439 = MUL_C(COEF_CONST(0.5411961001461961), f414);
-    f440 = f437 + f438;
-    f441 = f439 - f438;
-    f442 = f403 - f422;
-    f443 = f403 + f422;
-    f444 = f405 + f423;
-    f445 = f423 - f405;
-    f446 = f402 - f428;
-    f447 = f402 + f428;
-    f448 = f404 + f429;
-    f449 = f404 - f429;
-    f450 = f411 - f434;
-    f451 = f411 + f434;
-    f452 = f413 - f435;
-    f453 = f413 + f435;
-    f454 = f410 + f440;
-    f455 = f440 - f410;
-    f456 = f412 - f441;
-    f457 = f412 + f441;
-    f458 = f453 + f451;
-    f459 = MUL_C(COEF_CONST((-0.7856949583871021)), f453);
-    f460 = MUL_C(COEF_CONST(0.9807852804032304), f458);
-    f461 = MUL_C(COEF_CONST(1.1758756024193588), f451);
-    f462 = f459 + f460;
-    f463 = f461 - f460;
-    f464 = f457 + f455;
-    f465 = MUL_C(COEF_CONST(0.2758993792829431), f457);
-    f466 = MUL_C(COEF_CONST(0.5555702330196022), f464);
-    f467 = MUL_C(COEF_CONST(1.3870398453221475), f455);
-    f468 = f465 + f466;
-    f469 = f467 - f466;
-    f470 = f452 + f450;
-    f471 = MUL_C(COEF_CONST(1.1758756024193591), f452);
-    f472 = MUL_C(COEF_CONST((-0.1950903220161287)), f470);
-    f473 = MUL_C(COEF_CONST(0.7856949583871016), f450);
-    f474 = f471 + f472;
-    f475 = f473 - f472;
-    f476 = f456 - f454;
-    f477 = MUL_C(COEF_CONST(1.3870398453221473), f456);
-    f478 = MUL_C(COEF_CONST((-0.8314696123025455)), f476);
-    f479 = MUL_C(COEF_CONST((-0.2758993792829436)), f454);
-    f480 = f477 + f478;
-    f481 = f478 + f479;
-    f482 = f443 - f462;
-    f483 = f443 + f462;
-    f484 = f445 - f463;
-    f485 = f445 + f463;
-    f486 = f447 - f468;
-    f487 = f447 + f468;
-    f488 = f449 - f469;
-    f489 = f449 + f469;
-    f490 = f442 - f474;
-    f491 = f442 + f474;
-    f492 = f444 + f475;
-    f493 = f475 - f444;
-    f494 = f446 - f480;
-    f495 = f446 + f480;
-    f496 = f448 + f481;
-    f497 = f448 - f481;
-    f498 = f485 + f483;
-    f499 = MUL_C(COEF_CONST((-0.9497277818777543)), f485);
-    f500 = MUL_C(COEF_CONST(0.9987954562051724), f498);
-    f501 = MUL_C(COEF_CONST(1.0478631305325905), f483);
-    y[61] = f499 + f500;
-    y[1] = f501 - f500;
-    f504 = f489 + f487;
-    f505 = MUL_C(COEF_CONST((-0.7270510732912801)), f489);
-    f506 = MUL_C(COEF_CONST(0.9700312531945440), f504);
-    f507 = MUL_C(COEF_CONST(1.2130114330978079), f487);
-    y[53] = f505 + f506;
-    y[9] = f507 - f506;
-    f510 = f493 + f491;
-    f511 = MUL_C(COEF_CONST((-0.4764341996931611)), f493);
-    f512 = MUL_C(COEF_CONST(0.9039892931234433), f510);
-    f513 = MUL_C(COEF_CONST(1.3315443865537255), f491);
-    y[45] = f511 + f512;
-    y[17] = f513 - f512;
-    f516 = f497 + f495;
-    f517 = MUL_C(COEF_CONST((-0.2075082269882114)), f497);
-    f518 = MUL_C(COEF_CONST(0.8032075314806448), f516);
-    f519 = MUL_C(COEF_CONST(1.3989068359730783), f495);
-    y[37] = f517 + f518;
-    y[25] = f519 - f518;
-    f522 = f484 + f482;
-    f523 = MUL_C(COEF_CONST(0.0693921705079408), f484);
-    f524 = MUL_C(COEF_CONST(0.6715589548470183), f522);
-    f525 = MUL_C(COEF_CONST(1.4125100802019774), f482);
-    y[29] = f523 + f524;
-    y[33] = f525 - f524;
-    f528 = f488 + f486;
-    f529 = MUL_C(COEF_CONST(0.3436258658070505), f488);
-    f530 = MUL_C(COEF_CONST(0.5141027441932217), f528);
-    f531 = MUL_C(COEF_CONST(1.3718313541934939), f486);
-    y[21] = f529 + f530;
-    y[41] = f531 - f530;
-    f534 = f490 - f492;
-    f535 = MUL_C(COEF_CONST(0.6046542117908007), f492);
-    f536 = MUL_C(COEF_CONST(0.3368898533922201), f534);
-    f537 = MUL_C(COEF_CONST(1.2784339185752409), f490);
-    y[13] = f536 - f535;
-    y[49] = f537 - f536;
-    f540 = f496 + f494;
-    f541 = MUL_C(COEF_CONST(0.8424460355094192), f496);
-    f542 = MUL_C(COEF_CONST(0.1467304744553618), f540);
-    f543 = MUL_C(COEF_CONST(1.1359069844201428), f494);
-    y[5] = f541 + f542;
-    y[57] = f543 - f542;
-    f546 = f354 + f384;
-    f547 = f354 - f384;
-    f548 = f356 + f382;
-    f549 = f382 - f356;
-    f550 = f358 + f380;
-    f551 = f358 - f380;
-    f552 = f360 + f378;
-    f553 = f378 - f360;
-    f554 = f362 + f376;
-    f555 = f362 - f376;
-    f556 = f364 + f374;
-    f557 = f374 - f364;
-    f558 = f366 + f372;
-    f559 = f366 - f372;
-    f560 = f368 + f370;
-    f561 = f370 - f368;
-    f562 = f547 - f561;
-    f563 = f547 + f561;
-    f564 = f549 - f559;
-    f565 = f549 + f559;
-    f566 = f551 - f557;
-    f567 = f551 + f557;
-    f568 = f553 - f555;
-    f569 = f553 + f555;
-    f570 = f563 - f569;
-    f571 = f563 + f569;
-    f572 = f565 - f567;
-    f573 = f565 + f567;
-    f574 = f571 - f573;
-    y[63] = f571 + f573;
-    y[31] = MUL_C(COEF_CONST(0.7071067811865476), f574);
-    f577 = f570 + f572;
-    f578 = MUL_C(COEF_CONST(1.3065629648763766), f570);
-    f579 = MUL_C(COEF_CONST((-0.9238795325112866)), f577);
-    f580 = MUL_C(COEF_CONST((-0.5411961001461967)), f572);
-    y[15] = f578 + f579;
-    y[47] = f580 - f579;
-    f583 = f564 + f562;
-    f584 = f566 + f564;
-    f585 = f568 + f566;
-    f586 = MUL_C(COEF_CONST(0.7071067811865476), f584);
-    f587 = f562 - f586;
-    f588 = f562 + f586;
-    f589 = f583 + f585;
-    f590 = MUL_C(COEF_CONST(1.3065629648763766), f583);
-    f591 = MUL_C(COEF_CONST((-0.9238795325112866)), f589);
-    f592 = MUL_C(COEF_CONST((-0.5411961001461967)), f585);
-    f593 = f590 + f591;
-    f594 = f592 - f591;
-    f595 = f588 - f594;
-    f596 = f588 + f594;
-    f597 = f587 - f593;
-    f598 = f587 + f593;
-    y[55] = MUL_C(COEF_CONST(0.5097955791041592), f596);
-    y[39] = MUL_C(COEF_CONST(0.6013448869350453), f598);
-    y[23] = MUL_C(COEF_CONST(0.8999762231364156), f597);
-    y[7] = MUL_C(COEF_CONST(2.5629154477415055), f595);
-    f603 = MUL_C(COEF_CONST(0.5024192861881557), f546);
-    f604 = MUL_C(COEF_CONST(0.5224986149396889), f548);
-    f605 = MUL_C(COEF_CONST(0.5669440348163577), f550);
-    f606 = MUL_C(COEF_CONST(0.6468217833599901), f552);
-    f607 = MUL_C(COEF_CONST(0.7881546234512502), f554);
-    f608 = MUL_C(COEF_CONST(1.0606776859903471), f556);
-    f609 = MUL_C(COEF_CONST(1.7224470982383342), f558);
-    f610 = MUL_C(COEF_CONST(5.1011486186891553), f560);
-    f611 = f603 + f610;
-    f612 = f603 - f610;
-    f613 = f604 + f609;
-    f614 = f609 - f604;
-    f615 = f605 + f608;
-    f616 = f605 - f608;
-    f617 = f606 + f607;
-    f618 = f607 - f606;
-    f619 = f612 - f618;
-    f620 = f612 + f618;
-    f621 = f614 - f616;
-    f622 = f614 + f616;
-    f623 = f620 - f622;
-    f624 = f620 + f622;
-    f625 = MUL_C(COEF_CONST(0.7071067811865476), f623);
-    f626 = f619 + f621;
-    f627 = MUL_C(COEF_CONST(1.3065629648763766), f619);
-    f628 = MUL_C(COEF_CONST((-0.9238795325112866)), f626);
-    f629 = MUL_C(COEF_CONST((-0.5411961001461967)), f621);
-    f630 = f627 + f628;
-    f631 = f629 - f628;
-    f632 = f611 - f613;
-    f633 = f615 - f613;
-    f634 = f615 - f617;
-    f635 = MUL_C(COEF_CONST(0.7071067811865476), f633);
-    f636 = f611 - f635;
-    f637 = f611 + f635;
-    f638 = f632 + f634;
-    f639 = MUL_C(COEF_CONST(1.3065629648763766), f632);
-    f640 = MUL_C(COEF_CONST((-0.9238795325112866)), f638);
-    f641 = MUL_C(COEF_CONST((-0.5411961001461967)), f634);
-    f642 = f639 + f640;
-    f643 = f641 - f640;
-    f644 = f637 - f643;
-    f645 = f637 + f643;
-    f646 = f636 - f642;
-    f647 = f636 + f642;
-    f648 = MUL_C(COEF_CONST(0.5097955791041592), f645);
-    f649 = MUL_C(COEF_CONST(0.6013448869350453), f647);
-    f650 = MUL_C(COEF_CONST(0.8999762231364156), f646);
-    y[3] = MUL_C(COEF_CONST(2.5629154477415055), f644);
-    y[59] = f624 + f648;
-    y[51] = f648 + f631;
-    y[43] = f631 + f649;
-    y[35] = f649 + f625;
-    y[27] = f625 + f650;
-    y[19] = f650 + f630;
-    y[11] = f630 + y[3];
+    f225 = f218 - f224;
+    f226 = f218 + f224;
+    f227 = MUL_F(FRAC_CONST(0.7071067811865476), f225);
+    f228 = f217 - f223;
+    f229 = f217 + f223;
+    f230 = MUL_F(FRAC_CONST(0.7071067811865476), f229);
+    f231 = f227 - f230;
+    f232 = f227 + f230;
+    f233 = f210 - f226;
+    f234 = f210 + f226;
+    f235 = f212 - f232;
+    f236 = f212 + f232;
+    f237 = f211 - f231;
+    f238 = f211 + f231;
+    f239 = f209 - f228;
+    f240 = f209 + f228;
+    f241 = f234 + f193;
+    f242 = MUL_F(FRAC_CONST(-0.9497277818777543), f234);
+    f243 = MUL_F(FRAC_CONST(0.9987954562051724), f241);
+    f244 = MUL_C(COEF_CONST(1.0478631305325905), f193);
+    y[1] = f242 + f243;
+    y[31] = f244 - f243;
+    f247 = f195 - f236;
+    f248 = MUL_F(FRAC_CONST(-0.8424460355094192), f236);
+    f249 = MUL_F(FRAC_CONST(0.9891765099647810), f247);
+    f250 = MUL_C(COEF_CONST(1.1359069844201428), f195);
+    y[3] = f249 - f248;
+    y[29] = f250 - f249;
+    f253 = f238 + f197;
+    f254 = MUL_F(FRAC_CONST(-0.7270510732912801), f238);
+    f255 = MUL_F(FRAC_CONST(0.9700312531945440), f253);
+    f256 = MUL_C(COEF_CONST(1.2130114330978079), f197);
+    y[5] = f254 + f255;
+    y[27] = f256 - f255;
+    f259 = f199 - f240;
+    f260 = MUL_F(FRAC_CONST(-0.6046542117908007), f240);
+    f261 = MUL_F(FRAC_CONST(0.9415440651830208), f259);
+    f262 = MUL_C(COEF_CONST(1.2784339185752409), f199);
+    y[7] = f261 - f260;
+    y[25] = f262 - f261;
+    f265 = f239 + f198;
+    f266 = MUL_F(FRAC_CONST(-0.4764341996931611), f239);
+    f267 = MUL_F(FRAC_CONST(0.9039892931234433), f265);
+    f268 = MUL_C(COEF_CONST(1.3315443865537255), f198);
+    y[9] = f266 + f267;
+    y[23] = f268 - f267;
+    f271 = f196 - f237;
+    f272 = MUL_F(FRAC_CONST(-0.3436258658070505), f237);
+    f273 = MUL_F(FRAC_CONST(0.8577286100002721), f271);
+    f274 = MUL_C(COEF_CONST(1.3718313541934939), f196);
+    y[11] = f273 - f272;
+    y[21] = f274 - f273;
+    f277 = f235 + f194;
+    f278 = MUL_F(FRAC_CONST(-0.2075082269882114), f235);
+    f279 = MUL_F(FRAC_CONST(0.8032075314806448), f277);
+    f280 = MUL_C(COEF_CONST(1.3989068359730783), f194);
+    y[13] = f278 + f279;
+    y[19] = f280 - f279;
+    f283 = f192 - f233;
+    f284 = MUL_F(FRAC_CONST(-0.0693921705079408), f233);
+    f285 = MUL_F(FRAC_CONST(0.7409511253549591), f283);
+    f286 = MUL_C(COEF_CONST(1.4125100802019774), f192);
+    y[15] = f285 - f284;
+    y[17] = f286 - f285;
 }
 
 #else
 
-void DCT4_64(real_t *y, real_t *x)
+
+#define n 32
+#define log2n 5
+
+// w_array_real[i] = cos(2*M_PI*i/32)
+static const real_t w_array_real[] = {
+    FRAC_CONST(1.000000000000000), FRAC_CONST(0.980785279337272),
+    FRAC_CONST(0.923879528329380), FRAC_CONST(0.831469603195765),
+    FRAC_CONST(0.707106765732237), FRAC_CONST(0.555570210304169),
+    FRAC_CONST(0.382683402077046), FRAC_CONST(0.195090284503576),
+    FRAC_CONST(0.000000000000000), FRAC_CONST(-0.195090370246552),
+    FRAC_CONST(-0.382683482845162), FRAC_CONST(-0.555570282993553),
+    FRAC_CONST(-0.707106827549476), FRAC_CONST(-0.831469651765257),
+    FRAC_CONST(-0.923879561784627), FRAC_CONST(-0.980785296392607)
+};
+
+// w_array_imag[i] = sin(-2*M_PI*i/32)
+static const real_t w_array_imag[] = {
+    FRAC_CONST(0.000000000000000), FRAC_CONST(-0.195090327375064),
+    FRAC_CONST(-0.382683442461104), FRAC_CONST(-0.555570246648862),
+    FRAC_CONST(-0.707106796640858), FRAC_CONST(-0.831469627480512),
+    FRAC_CONST(-0.923879545057005), FRAC_CONST(-0.980785287864940),
+    FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.980785270809601),
+    FRAC_CONST(-0.923879511601754), FRAC_CONST(-0.831469578911016),
+    FRAC_CONST(-0.707106734823616), FRAC_CONST(-0.555570173959476),
+    FRAC_CONST(-0.382683361692986), FRAC_CONST(-0.195090241632088)
+};
+
+// FFT decimation in frequency
+// 4*16*2+16=128+16=144 multiplications
+// 6*16*2+10*8+4*16*2=192+80+128=400 additions
+static void fft_dif(real_t * Real, real_t * Imag)
 {
-    int16_t i0;
-    ALIGN static real_t t2[64];
+    real_t w_real, w_imag; // For faster access
+    real_t point1_real, point1_imag, point2_real, point2_imag; // For faster access
+    uint32_t j, i, i2, w_index; // Counters
+
+    // First 2 stages of 32 point FFT decimation in frequency
+    // 4*16*2=64*2=128 multiplications
+    // 6*16*2=96*2=192 additions
+	// Stage 1 of 32 point FFT decimation in frequency
+    for (i = 0; i < 16; i++)
+    {
+        point1_real = Real[i];
+        point1_imag = Imag[i];
+        i2 = i+16;
+        point2_real = Real[i2];
+        point2_imag = Imag[i2];
+
+        w_real = w_array_real[i];
+        w_imag = w_array_imag[i];
+
+        // temp1 = x[i] - x[i2]
+        point1_real -= point2_real;
+        point1_imag -= point2_imag;
+
+        // x[i1] = x[i] + x[i2]
+        Real[i] += point2_real;
+        Imag[i] += point2_imag;
+
+        // x[i2] = (x[i] - x[i2]) * w
+        Real[i2] = (MUL_F(point1_real,w_real) - MUL_F(point1_imag,w_imag));
+        Imag[i2] = (MUL_F(point1_real,w_imag) + MUL_F(point1_imag,w_real));
+     }
+    // Stage 2 of 32 point FFT decimation in frequency
+    for (j = 0, w_index = 0; j < 8; j++, w_index += 2)
+    {
+        w_real = w_array_real[w_index];
+        w_imag = w_array_imag[w_index];
+
+    	i = j;
+        point1_real = Real[i];
+        point1_imag = Imag[i];
+        i2 = i+8;
+        point2_real = Real[i2];
+        point2_imag = Imag[i2];
+
+        // temp1 = x[i] - x[i2]
+        point1_real -= point2_real;
+        point1_imag -= point2_imag;
+
+        // x[i1] = x[i] + x[i2]
+        Real[i] += point2_real;
+        Imag[i] += point2_imag;
+
+        // x[i2] = (x[i] - x[i2]) * w
+        Real[i2] = (MUL_F(point1_real,w_real) - MUL_F(point1_imag,w_imag));
+        Imag[i2] = (MUL_F(point1_real,w_imag) + MUL_F(point1_imag,w_real));
+
+        i = j+16;
+        point1_real = Real[i];
+        point1_imag = Imag[i];
+        i2 = i+8;
+        point2_real = Real[i2];
+        point2_imag = Imag[i2];
+
+        // temp1 = x[i] - x[i2]
+        point1_real -= point2_real;
+        point1_imag -= point2_imag;
+
+        // x[i1] = x[i] + x[i2]
+        Real[i] += point2_real;
+        Imag[i] += point2_imag;
+
+        // x[i2] = (x[i] - x[i2]) * w
+        Real[i2] = (MUL_F(point1_real,w_real) - MUL_F(point1_imag,w_imag));
+        Imag[i2] = (MUL_F(point1_real,w_imag) + MUL_F(point1_imag,w_real));
+    }
+
+    // Stage 3 of 32 point FFT decimation in frequency
+    // 2*4*2=16 multiplications
+    // 4*4*2+6*4*2=10*8=80 additions
+    for (i = 0; i < n; i += 8)
+    {
+        i2 = i+4;
+        point1_real = Real[i];
+        point1_imag = Imag[i];
+
+        point2_real = Real[i2];
+        point2_imag = Imag[i2];
+
+        // out[i1] = point1 + point2
+        Real[i] += point2_real;
+        Imag[i] += point2_imag;
+
+        // out[i2] = point1 - point2
+        Real[i2] = point1_real - point2_real;
+        Imag[i2] = point1_imag - point2_imag;
+    }
+    w_real = w_array_real[4]; // = sqrt(2)/2
+    // w_imag = -w_real; // = w_array_imag[4]; // = -sqrt(2)/2
+    for (i = 1; i < n; i += 8)
+    {
+        i2 = i+4;
+        point1_real = Real[i];
+        point1_imag = Imag[i];
+
+        point2_real = Real[i2];
+        point2_imag = Imag[i2];
+
+        // temp1 = x[i] - x[i2]
+        point1_real -= point2_real;
+        point1_imag -= point2_imag;
+
+        // x[i1] = x[i] + x[i2]
+        Real[i] += point2_real;
+        Imag[i] += point2_imag;
+
+        // x[i2] = (x[i] - x[i2]) * w
+        Real[i2] = MUL_F(point1_real+point1_imag, w_real);
+        Imag[i2] = MUL_F(point1_imag-point1_real, w_real);
+    }
+    for (i = 2; i < n; i += 8)
+    {
+        i2 = i+4;
+        point1_real = Real[i];
+        point1_imag = Imag[i];
+
+        point2_real = Real[i2];
+        point2_imag = Imag[i2];
+
+        // x[i] = x[i] + x[i2]
+        Real[i] += point2_real;
+        Imag[i] += point2_imag;
+
+        // x[i2] = (x[i] - x[i2]) * (-i)
+        Real[i2] = point1_imag - point2_imag;
+        Imag[i2] = point2_real - point1_real;
+    }
+    w_real = w_array_real[12]; // = -sqrt(2)/2
+    // w_imag = w_real; // = w_array_imag[12]; // = -sqrt(2)/2
+    for (i = 3; i < n; i += 8)
+    {
+        i2 = i+4;
+        point1_real = Real[i];
+        point1_imag = Imag[i];
+
+        point2_real = Real[i2];
+        point2_imag = Imag[i2];
+
+        // temp1 = x[i] - x[i2]
+        point1_real -= point2_real;
+        point1_imag -= point2_imag;
+
+        // x[i1] = x[i] + x[i2]
+        Real[i] += point2_real;
+        Imag[i] += point2_imag;
+
+        // x[i2] = (x[i] - x[i2]) * w
+        Real[i2] = MUL_F(point1_real-point1_imag, w_real);
+        Imag[i2] = MUL_F(point1_real+point1_imag, w_real);
+    }
+
+
+    // Stage 4 of 32 point FFT decimation in frequency (no multiplications)
+    // 16*4=64 additions
+    for (i = 0; i < n; i += 4)
+    {
+        i2 = i+2;
+        point1_real = Real[i];
+        point1_imag = Imag[i];
 
-    t2[0] = x[0];
-    for (i0=0; i0<31; i0++)
+        point2_real = Real[i2];
+        point2_imag = Imag[i2];
+
+        // x[i1] = x[i] + x[i2]
+        Real[i] += point2_real;
+        Imag[i] += point2_imag;
+
+        // x[i2] = x[i] - x[i2]
+        Real[i2] = point1_real - point2_real;
+        Imag[i2] = point1_imag - point2_imag;
+    }
+    for (i = 1; i < n; i += 4)
+    {
+        i2 = i+2;
+        point1_real = Real[i];
+        point1_imag = Imag[i];
+
+        point2_real = Real[i2];
+        point2_imag = Imag[i2];
+
+        // x[i] = x[i] + x[i2]
+        Real[i] += point2_real;
+        Imag[i] += point2_imag;
+
+        // x[i2] = (x[i] - x[i2]) * (-i)
+        Real[i2] = point1_imag - point2_imag;
+        Imag[i2] = point2_real - point1_real;
+    }
+
+    // Stage 5 of 32 point FFT decimation in frequency (no multiplications)
+    // 16*4=64 additions
+    for (i = 0; i < n; i += 2)
     {
-        t2[2*i0+1] = x[2*i0+1] - x[2*i0+2];
-        t2[2*i0+2] = x[2*i0+1] + x[2*i0+2];
+        i2 = i+1;
+        point1_real = Real[i];
+        point1_imag = Imag[i];
+
+        point2_real = Real[i2];
+        point2_imag = Imag[i2];
+
+        // out[i1] = point1 + point2
+        Real[i] += point2_real;
+        Imag[i] += point2_imag;
+
+        // out[i2] = point1 - point2
+        Real[i2] = point1_real - point2_real;
+        Imag[i2] = point1_imag - point2_imag;
     }
-    t2[63] = x[63];
+
+#ifdef REORDER_IN_FFT
+    FFTReorder(Real, Imag);
+#endif // #ifdef REORDER_IN_FFT
+}
+#undef n
+#undef log2n
 
-    DCT4_64_kernel(y, t2);
+static const real_t dct4_64_tab[] = {
+    COEF_CONST(0.999924719333649), COEF_CONST(0.998118102550507),
+    COEF_CONST(0.993906974792480), COEF_CONST(0.987301409244537),
+    COEF_CONST(0.978317379951477), COEF_CONST(0.966976463794708),
+    COEF_CONST(0.953306019306183), COEF_CONST(0.937339007854462),
+    COEF_CONST(0.919113874435425), COEF_CONST(0.898674488067627),
+    COEF_CONST(0.876070082187653), COEF_CONST(0.851355195045471),
+    COEF_CONST(0.824589252471924), COEF_CONST(0.795836925506592),
+    COEF_CONST(0.765167236328125), COEF_CONST(0.732654273509979),
+    COEF_CONST(0.698376238346100), COEF_CONST(0.662415742874146),
+    COEF_CONST(0.624859452247620), COEF_CONST(0.585797846317291),
+    COEF_CONST(0.545324981212616), COEF_CONST(0.503538429737091),
+    COEF_CONST(0.460538715124130), COEF_CONST(0.416429549455643),
+    COEF_CONST(0.371317148208618), COEF_CONST(0.325310230255127),
+    COEF_CONST(0.278519600629807), COEF_CONST(0.231058135628700),
+    COEF_CONST(0.183039888739586), COEF_CONST(0.134580686688423),
+    COEF_CONST(0.085797272622585), COEF_CONST(0.036807164549828),
+    COEF_CONST(-1.012196302413940), COEF_CONST(-1.059438824653626),
+    COEF_CONST(-1.104129195213318), COEF_CONST(-1.146159529685974),
+    COEF_CONST(-1.185428738594055), COEF_CONST(-1.221842169761658),
+    COEF_CONST(-1.255311965942383), COEF_CONST(-1.285757660865784),
+    COEF_CONST(-1.313105940818787), COEF_CONST(-1.337290763854981),
+    COEF_CONST(-1.358253836631775), COEF_CONST(-1.375944852828980),
+    COEF_CONST(-1.390321016311646), COEF_CONST(-1.401347875595093),
+    COEF_CONST(-1.408998727798462), COEF_CONST(-1.413255214691162),
+    COEF_CONST(-1.414107084274292), COEF_CONST(-1.411552190780640),
+    COEF_CONST(-1.405596733093262), COEF_CONST(-1.396255016326904),
+    COEF_CONST(-1.383549690246582), COEF_CONST(-1.367511272430420),
+    COEF_CONST(-1.348178386688232), COEF_CONST(-1.325597524642944),
+    COEF_CONST(-1.299823284149170), COEF_CONST(-1.270917654037476),
+    COEF_CONST(-1.238950133323669), COEF_CONST(-1.203998088836670),
+    COEF_CONST(-1.166145324707031), COEF_CONST(-1.125483393669128),
+    COEF_CONST(-1.082109928131104), COEF_CONST(-1.036129593849182),
+    COEF_CONST(-0.987653195858002), COEF_CONST(-0.936797380447388),
+    COEF_CONST(-0.883684754371643), COEF_CONST(-0.828443288803101),
+    COEF_CONST(-0.771206021308899), COEF_CONST(-0.712110757827759),
+    COEF_CONST(-0.651300072669983), COEF_CONST(-0.588920354843140),
+    COEF_CONST(-0.525121808052063), COEF_CONST(-0.460058242082596),
+    COEF_CONST(-0.393886327743530), COEF_CONST(-0.326765477657318),
+    COEF_CONST(-0.258857429027557), COEF_CONST(-0.190325915813446),
+    COEF_CONST(-0.121335685253143), COEF_CONST(-0.052053272724152),
+    COEF_CONST(0.017354607582092), COEF_CONST(0.086720645427704),
+    COEF_CONST(0.155877828598022), COEF_CONST(0.224659323692322),
+    COEF_CONST(0.292899727821350), COEF_CONST(0.360434412956238),
+    COEF_CONST(0.427100926637650), COEF_CONST(0.492738455533981),
+    COEF_CONST(0.557188928127289), COEF_CONST(0.620297133922577),
+    COEF_CONST(0.681910991668701), COEF_CONST(0.741881847381592),
+    COEF_CONST(0.800065577030182), COEF_CONST(0.856321990489960),
+    COEF_CONST(0.910515367984772), COEF_CONST(0.962515234947205),
+    COEF_CONST(1.000000000000000), COEF_CONST(0.998795449733734),
+    COEF_CONST(0.995184719562531), COEF_CONST(0.989176511764526),
+    COEF_CONST(0.980785250663757), COEF_CONST(0.970031261444092),
+    COEF_CONST(0.956940352916718), COEF_CONST(0.941544055938721),
+    COEF_CONST(0.923879504203796), COEF_CONST(0.903989315032959),
+    COEF_CONST(0.881921231746674), COEF_CONST(0.857728600502014),
+    COEF_CONST(0.831469595432281), COEF_CONST(0.803207516670227),
+    COEF_CONST(0.773010432720184), COEF_CONST(0.740951120853424),
+    COEF_CONST(0.707106769084930), COEF_CONST(0.671558916568756),
+    COEF_CONST(0.634393274784088), COEF_CONST(0.595699310302734),
+    COEF_CONST(0.555570185184479), COEF_CONST(0.514102697372437),
+    COEF_CONST(0.471396654844284), COEF_CONST(0.427555114030838),
+    COEF_CONST(0.382683426141739), COEF_CONST(0.336889833211899),
+    COEF_CONST(0.290284633636475), COEF_CONST(0.242980122566223),
+    COEF_CONST(0.195090234279633), COEF_CONST(0.146730497479439),
+    COEF_CONST(0.098017133772373), COEF_CONST(0.049067649990320),
+    COEF_CONST(-1.000000000000000), COEF_CONST(-1.047863125801086),
+    COEF_CONST(-1.093201875686646), COEF_CONST(-1.135906934738159),
+    COEF_CONST(-1.175875544548035), COEF_CONST(-1.213011503219605),
+    COEF_CONST(-1.247225046157837), COEF_CONST(-1.278433918952942),
+    COEF_CONST(-1.306562900543213), COEF_CONST(-1.331544399261475),
+    COEF_CONST(-1.353317975997925), COEF_CONST(-1.371831417083740),
+    COEF_CONST(-1.387039899826050), COEF_CONST(-1.398906826972961),
+    COEF_CONST(-1.407403707504273), COEF_CONST(-1.412510156631470),
+    COEF_CONST(0), COEF_CONST(-1.412510156631470),
+    COEF_CONST(-1.407403707504273), COEF_CONST(-1.398906826972961),
+    COEF_CONST(-1.387039899826050), COEF_CONST(-1.371831417083740),
+    COEF_CONST(-1.353317975997925), COEF_CONST(-1.331544399261475),
+    COEF_CONST(-1.306562900543213), COEF_CONST(-1.278433918952942),
+    COEF_CONST(-1.247225046157837), COEF_CONST(-1.213011384010315),
+    COEF_CONST(-1.175875544548035), COEF_CONST(-1.135907053947449),
+    COEF_CONST(-1.093201875686646), COEF_CONST(-1.047863125801086),
+    COEF_CONST(-1.000000000000000), COEF_CONST(-0.949727773666382),
+    COEF_CONST(-0.897167563438416), COEF_CONST(-0.842446029186249),
+    COEF_CONST(-0.785694956779480), COEF_CONST(-0.727051079273224),
+    COEF_CONST(-0.666655659675598), COEF_CONST(-0.604654192924500),
+    COEF_CONST(-0.541196048259735), COEF_CONST(-0.476434230804443),
+    COEF_CONST(-0.410524487495422), COEF_CONST(-0.343625843524933),
+    COEF_CONST(-0.275899350643158), COEF_CONST(-0.207508206367493),
+    COEF_CONST(-0.138617098331451), COEF_CONST(-0.069392144680023),
+    COEF_CONST(0), COEF_CONST(0.069392263889313),
+    COEF_CONST(0.138617157936096), COEF_CONST(0.207508206367493),
+    COEF_CONST(0.275899469852448), COEF_CONST(0.343625962734222),
+    COEF_CONST(0.410524636507034), COEF_CONST(0.476434201002121),
+    COEF_CONST(0.541196107864380), COEF_CONST(0.604654192924500),
+    COEF_CONST(0.666655719280243), COEF_CONST(0.727051138877869),
+    COEF_CONST(0.785695075988770), COEF_CONST(0.842446029186249),
+    COEF_CONST(0.897167563438416), COEF_CONST(0.949727773666382)
+};
+
+/* size 64 only! */
+void dct4_kernel(real_t * in_real, real_t * in_imag, real_t * out_real, real_t * out_imag)
+{
+    // Tables with bit reverse values for 5 bits, bit reverse of i at i-th position
+    const uint8_t bit_rev_tab[32] = { 0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30,1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31 };
+    uint16_t i, i_rev;
+
+    /* Step 2: modulate */
+    // 3*32=96 multiplications
+    // 3*32=96 additions
+    for (i = 0; i < 32; i++)
+    {
+    	real_t x_re, x_im, tmp;
+    	x_re = in_real[i];
+    	x_im = in_imag[i];
+        tmp =        MUL_C(x_re + x_im, dct4_64_tab[i]);
+        in_real[i] = MUL_C(x_im, dct4_64_tab[i + 64]) + tmp;
+        in_imag[i] = MUL_C(x_re, dct4_64_tab[i + 32]) + tmp;
+    }
+
+    /* Step 3: FFT, but with output in bit reverse order */
+    fft_dif(in_real, in_imag);
+
+    /* Step 4: modulate + bitreverse reordering */
+    // 3*31+2=95 multiplications
+    // 3*31+2=95 additions
+    for (i = 0; i < 16; i++)
+    {
+    	real_t x_re, x_im, tmp;
+    	i_rev = bit_rev_tab[i];
+    	x_re = in_real[i_rev];
+    	x_im = in_imag[i_rev];
+
+        tmp =         MUL_C(x_re + x_im, dct4_64_tab[i + 3*32]);
+        out_real[i] = MUL_C(x_im, dct4_64_tab[i + 5*32]) + tmp;
+        out_imag[i] = MUL_C(x_re, dct4_64_tab[i + 4*32]) + tmp;
+    }
+    // i = 16, i_rev = 1 = rev(16);
+    out_imag[16] = MUL_C(in_imag[1] - in_real[1], dct4_64_tab[16 + 3*32]);
+    out_real[16] = MUL_C(in_real[1] + in_imag[1], dct4_64_tab[16 + 3*32]);
+    for (i = 17; i < 32; i++)
+    {
+    	real_t x_re, x_im, tmp;
+    	i_rev = bit_rev_tab[i];
+    	x_re = in_real[i_rev];
+    	x_im = in_imag[i_rev];
+        tmp =         MUL_C(x_re + x_im, dct4_64_tab[i + 3*32]);
+        out_real[i] = MUL_C(x_im, dct4_64_tab[i + 5*32]) + tmp;
+        out_imag[i] = MUL_C(x_re, dct4_64_tab[i + 4*32]) + tmp;
+    }
+
 }
 
-void DCT4_64_kernel(real_t *y, real_t *t2)
+void DST4_32(real_t *y, real_t *x)
 {
-    real_t f2, f3, f4, f5, f6, f7, f8;
-    real_t f9, f10, f11, f12, f13, f14, f15;
-    real_t f16, f17, f18, f19, f20, f21, f22;
-    real_t f23, f24, f25, f26, f27, f28, f29;
-    real_t f30, f31, f32, f33, f34, f35, f36;
-    real_t f37, f38, f39, f40, f41, f42, f43;
-    real_t f44, f45, f46, f47, f48, f49, f50;
-    real_t f51, f52, f53, f54, f55, f56, f57;
-    real_t f58, f59, f60, f61, f62, f63, f64;
-    real_t f65, f66, f67, f68, f69, f70, f71;
-    real_t f72, f73, f74, f75, f76, f77, f78;
-    real_t f79, f80, f81, f82, f83, f84, f85;
-    real_t f86, f87, f88, f89, f90, f91, f92;
-    real_t f93, f94, f95, f96, f97, f98, f99;
-    real_t f100, f101, f102, f103, f104, f105, f106;
-    real_t f107, f108, f109, f110, f111, f112, f113;
-    real_t f114, f115, f116, f117, f118, f119, f120;
-    real_t f121, f122, f123, f124, f125, f126, f127;
-    real_t f128, f129, f130, f131, f132, f133, f134;
-    real_t f135, f136, f137, f138, f139, f140, f141;
-    real_t f142, f143, f144, f145, f146, f147, f148;
-    real_t f149, f150, f151, f152, f153, f154, f155;
-    real_t f156, f157, f158, f159, f160, f161, f162;
-    real_t f163, f164, f165, f166, f167, f168, f169;
-    real_t f170, f171, f172, f173, f174, f175, f176;
-    real_t f177, f178, f179, f180, f181, f182, f183;
-    real_t f184, f185, f186, f187, f188, f189, f190;
-    real_t f191, f192, f193, f194, f195, f196, f197;
-    real_t f198, f199, f200, f201, f202, f203, f204;
-    real_t f205, f206, f207, f208, f209, f210, f211;
-    real_t f212, f213, f214, f215, f216, f217, f218;
-    real_t f219, f220, f221, f222, f223, f224, f225;
-    real_t f226, f227, f228, f229, f230, f231, f232;
-    real_t f233, f234, f235, f236, f237, f238, f239;
-    real_t f240, f241, f242, f243, f244, f245, f246;
-    real_t f247, f248, f249, f250, f251, f252, f253;
-    real_t f254, f255, f256, f257, f258, f259, f260;
-    real_t f261, f262, f263, f264, f265, f266, f267;
-    real_t f268, f269, f270, f271, f272, f273, f274;
-    real_t f275, f276, f277, f278, f279, f280, f281;
-    real_t f282, f283, f284, f285, f286, f287, f288;
-    real_t f289, f290, f291, f292, f293, f294, f295;
-    real_t f296, f297, f298, f299, f300, f301, f302;
-    real_t f303, f304, f305, f306, f307, f308, f309;
-    real_t f310, f311, f312, f313, f314, f315, f316;
-    real_t f317, f318, f319, f320, f321, f322, f323;
-    real_t f324, f325, f326, f327, f328, f329, f330;
-    real_t f331, f332, f333, f334, f335, f336, f337;
-    real_t f338, f339, f340, f341, f342, f343, f344;
-    real_t f345, f346, f347, f348, f349, f350, f351;
-    real_t f352, f353, f354, f355, f356, f357, f358;
-    real_t f359, f360, f361, f362, f363, f364, f365;
-    real_t f366, f367, f368, f369, f370, f371, f372;
-    real_t f373, f374, f375, f376, f377, f378, f379;
-    real_t f380, f381, f382, f383, f384, f385, f386;
-    real_t f387, f388, f389, f390, f391, f392, f393;
-    real_t f394, f395, f396, f397, f398, f399, f400;
-    real_t f401, f402, f403, f404, f405, f406, f407;
-    real_t f408, f409, f410, f411, f412, f413, f414;
-    real_t f415, f416, f417, f418, f419, f420, f421;
-    real_t f422, f423, f424, f425, f426, f427, f428;
-    real_t f429, f430, f431, f432, f433, f434, f435;
-    real_t f436, f437, f438, f439, f440, f441, f442;
-    real_t f443, f444, f445, f446, f447, f448, f449;
-    real_t f450, f451, f452, f453, f454, f455, f456;
-    real_t f457, f458, f459, f460, f461, f462, f463;
-    real_t f464, f465, f466, f467, f468, f469, f470;
-    real_t f471, f472, f473, f474, f475, f476, f477;
-    real_t f478, f479, f480, f481, f482, f483, f484;
-    real_t f485, f486, f487, f488, f489, f490, f491;
-    real_t f492, f493, f494, f495, f496, f497, f498;
-    real_t f499, f500, f501, f502, f503, f504, f505;
-    real_t f506, f507, f508, f509, f510, f511, f512;
-    real_t f513, f514, f515, f516, f517, f518, f519;
-    real_t f520, f521, f522, f523, f524, f525, f526;
-    real_t f527, f528, f529, f530, f531, f532, f533;
-    real_t f534, f535, f536, f537, f538, f539, f540;
-    real_t f541, f542, f543, f544, f545, f546, f547;
-    real_t f548, f549, f550, f551, f552, f553, f554;
-    real_t f555, f556, f557, f558, f559, f560, f561;
-    real_t f562, f563, f564, f565, f566, f567, f568;
-    real_t f569, f570, f571, f572, f573, f574, f575;
-    real_t f576, f577, f578, f579, f580, f581, f582;
-    real_t f583, f584, f585, f586, f587, f588, f589;
-    real_t f590, f591, f592, f593, f594, f595, f596;
-    real_t f597, f598, f599, f600, f601, f602, f603;
-    real_t f604, f605, f606, f607, f608, f609, f610;
-    real_t f611, f612, f613, f614, f615, f618, f619;
-    real_t f620, f621, f624, f625, f626, f627, f630;
-    real_t f631, f632, f633, f636, f637, f638, f639;
-    real_t f642, f643, f644, f645, f648, f649, f650;
-    real_t f651, f654, f655, f656, f657, f660, f661;
-    real_t f662, f663, f666, f667, f668, f669, f672;
-    real_t f673, f674, f675, f678, f679, f680, f681;
-    real_t f684, f685, f686, f687, f690, f691, f692;
-    real_t f693, f696, f697, f698, f699, f702, f703;
-    real_t f704, f705, f708, f709, f710, f711, f714;
-    real_t f715, f716, f717, f720, f721, f722, f723;
-    real_t f726, f727, f728, f729, f732, f733, f734;
-    real_t f735, f738, f739, f740, f741, f744, f745;
-    real_t f746, f747, f750, f751, f752, f753, f756;
-    real_t f757, f758, f759, f762, f763, f764, f765;
-    real_t f768, f769, f770, f771, f774, f775, f776;
-    real_t f777, f780, f781, f782, f783, f786, f787;
-    real_t f788, f789, f792, f793, f794, f795, f798;
-    real_t f799, f800, f801;
+    real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9;
+    real_t f10, f11, f12, f13, f14, f15, f16, f17, f18, f19;
+    real_t f20, f21, f22, f23, f24, f25, f26, f27, f28, f29;
+    real_t f30, f31, f32, f33, f34, f35, f36, f37, f38, f39;
+    real_t f40, f41, f42, f43, f44, f45, f46, f47, f48, f49;
+    real_t f50, f51, f52, f53, f54, f55, f56, f57, f58, f59;
+    real_t f60, f61, f62, f63, f64, f65, f66, f67, f68, f69;
+    real_t f70, f71, f72, f73, f74, f75, f76, f77, f78, f79;
+    real_t f80, f81, f82, f83, f84, f85, f86, f87, f88, f89;
+    real_t f90, f91, f92, f93, f94, f95, f96, f97, f98, f99;
+    real_t f100, f101, f102, f103, f104, f105, f106, f107, f108, f109;
+    real_t f110, f111, f112, f113, f114, f115, f116, f117, f118, f119;
+    real_t f120, f121, f122, f123, f124, f125, f126, f127, f128, f129;
+    real_t f130, f131, f132, f133, f134, f135, f136, f137, f138, f139;
+    real_t f140, f141, f142, f143, f144, f145, f146, f147, f148, f149;
+    real_t f150, f151, f152, f153, f154, f155, f156, f157, f158, f159;
+    real_t f160, f161, f162, f163, f164, f165, f166, f167, f168, f169;
+    real_t f170, f171, f172, f173, f174, f175, f176, f177, f178, f179;
+    real_t f180, f181, f182, f183, f184, f185, f186, f187, f188, f189;
+    real_t f190, f191, f192, f193, f194, f195, f196, f197, f198, f199;
+    real_t f200, f201, f202, f203, f204, f205, f206, f207, f208, f209;
+    real_t f210, f211, f212, f213, f214, f215, f216, f217, f218, f219;
+    real_t f220, f221, f222, f223, f224, f225, f226, f227, f228, f229;
+    real_t f230, f231, f232, f233, f234, f235, f236, f237, f238, f239;
+    real_t f240, f241, f242, f243, f244, f245, f246, f247, f248, f249;
+    real_t f250, f251, f252, f253, f254, f255, f256, f257, f258, f259;
+    real_t f260, f261, f262, f263, f264, f265, f266, f267, f268, f269;
+    real_t f270, f271, f272, f273, f274, f275, f276, f277, f278, f279;
+    real_t f280, f281, f282, f283, f284, f285, f286, f287, f288, f289;
+    real_t f290, f291, f292, f293, f294, f295, f296, f297, f298, f299;
+    real_t f300, f301, f302, f303, f304, f305, f306, f307, f308, f309;
+    real_t f310, f311, f312, f313, f314, f315, f316, f317, f318, f319;
+    real_t f320, f321, f322, f323, f324, f325, f326, f327, f328, f329;
+    real_t f330, f331, f332, f333, f334, f335;
 
-    f2 = 0.7071067811865476 * t2[32];
-    f3 = t2[0] - f2;
-    f4 = t2[0] + f2;
-    f5 = t2[16] + t2[48];
-    f6 = 1.3065629648763766 * t2[16];
-    f7 = (-0.9238795325112866) * f5;
-    f8 = (-0.5411961001461967) * t2[48];
-    f9 = f6 + f7;
-    f10 = f8 - f7;
-    f11 = f4 - f10;
-    f12 = f4 + f10;
-    f13 = f3 - f9;
-    f14 = f3 + f9;
-    f15 = t2[8] + t2[56];
-    f16 = 1.1758756024193588 * t2[8];
-    f17 = (-0.9807852804032304) * f15;
-    f18 = (-0.7856949583871021) * t2[56];
-    f19 = f16 + f17;
-    f20 = f18 - f17;
-    f21 = t2[24] + t2[40];
-    f22 = 1.3870398453221473 * t2[24];
-    f23 = (-0.8314696123025455) * f21;
-    f24 = (-0.2758993792829436) * t2[40];
-    f25 = f22 + f23;
-    f26 = f24 - f23;
-    f27 = f20 - f26;
-    f28 = f20 + f26;
-    f29 = 0.7071067811865476 * f27;
-    f30 = f19 - f25;
-    f31 = f19 + f25;
-    f32 = 0.7071067811865476 * f31;
-    f33 = f29 - f32;
-    f34 = f29 + f32;
-    f35 = f12 - f28;
-    f36 = f12 + f28;
-    f37 = f14 - f34;
-    f38 = f14 + f34;
-    f39 = f13 - f33;
-    f40 = f13 + f33;
-    f41 = f11 - f30;
-    f42 = f11 + f30;
-    f43 = t2[4] + t2[60];
-    f44 = 1.0932018670017569 * t2[4];
-    f45 = (-0.9951847266721969) * f43;
-    f46 = (-0.8971675863426368) * t2[60];
-    f47 = f44 + f45;
-    f48 = f46 - f45;
-    f49 = t2[12] + t2[52];
-    f50 = 1.2472250129866711 * t2[12];
-    f51 = (-0.9569403357322089) * f49;
-    f52 = (-0.6666556584777469) * t2[52];
-    f53 = f50 + f51;
-    f54 = f52 - f51;
-    f55 = t2[20] + t2[44];
-    f56 = 1.3533180011743526 * t2[20];
-    f57 = (-0.8819212643483551) * f55;
-    f58 = (-0.4105245275223575) * t2[44];
-    f59 = f56 + f57;
-    f60 = f58 - f57;
-    f61 = t2[28] + t2[36];
-    f62 = 1.4074037375263826 * t2[28];
-    f63 = (-0.7730104533627369) * f61;
-    f64 = (-0.1386171691990913) * t2[36];
-    f65 = f62 + f63;
-    f66 = f64 - f63;
-    f67 = f48 - f66;
-    f68 = f48 + f66;
-    f69 = f54 - f60;
-    f70 = f54 + f60;
-    f71 = f68 - f70;
-    f72 = f68 + f70;
-    f73 = 0.7071067811865476 * f71;
-    f74 = f67 + f69;
-    f75 = 1.3065629648763766 * f67;
-    f76 = (-0.9238795325112866) * f74;
-    f77 = (-0.5411961001461967) * f69;
-    f78 = f75 + f76;
-    f79 = f77 - f76;
-    f80 = f47 - f65;
-    f81 = f47 + f65;
-    f82 = f53 - f59;
-    f83 = f53 + f59;
-    f84 = f81 + f83;
-    f85 = 1.3065629648763770 * f81;
-    f86 = (-0.3826834323650904) * f84;
-    f87 = 0.5411961001461961 * f83;
-    f88 = f85 + f86;
-    f89 = f87 - f86;
-    f90 = f80 - f82;
-    f91 = f80 + f82;
-    f92 = 0.7071067811865476 * f91;
-    f93 = f79 - f89;
-    f94 = f79 + f89;
-    f95 = f73 - f92;
-    f96 = f73 + f92;
-    f97 = f78 - f88;
-    f98 = f78 + f88;
-    f99 = f36 - f72;
-    f100 = f36 + f72;
-    f101 = f38 - f94;
-    f102 = f38 + f94;
-    f103 = f40 - f93;
-    f104 = f40 + f93;
-    f105 = f42 - f96;
-    f106 = f42 + f96;
-    f107 = f41 - f95;
-    f108 = f41 + f95;
-    f109 = f39 - f98;
-    f110 = f39 + f98;
-    f111 = f37 - f97;
-    f112 = f37 + f97;
-    f113 = f35 - f90;
-    f114 = f35 + f90;
-    f115 = t2[2] + t2[62];
-    f116 = 1.0478631305325901 * t2[2];
-    f117 = (-0.9987954562051724) * f115;
-    f118 = (-0.9497277818777548) * t2[62];
-    f119 = f116 + f117;
-    f120 = f118 - f117;
-    f121 = t2[10] + t2[54];
-    f122 = 1.2130114330978077 * t2[10];
-    f123 = (-0.9700312531945440) * f121;
-    f124 = (-0.7270510732912803) * t2[54];
-    f125 = f122 + f123;
+    f0 = x[0] - x[1];
+    f1 = x[2] - x[1];
+    f2 = x[2] - x[3];
+    f3 = x[4] - x[3];
+    f4 = x[4] - x[5];
+    f5 = x[6] - x[5];
+    f6 = x[6] - x[7];
+    f7 = x[8] - x[7];
+    f8 = x[8] - x[9];
+    f9 = x[10] - x[9];
+    f10 = x[10] - x[11];
+    f11 = x[12] - x[11];
+    f12 = x[12] - x[13];
+    f13 = x[14] - x[13];
+    f14 = x[14] - x[15];
+    f15 = x[16] - x[15];
+    f16 = x[16] - x[17];
+    f17 = x[18] - x[17];
+    f18 = x[18] - x[19];
+    f19 = x[20] - x[19];
+    f20 = x[20] - x[21];
+    f21 = x[22] - x[21];
+    f22 = x[22] - x[23];
+    f23 = x[24] - x[23];
+    f24 = x[24] - x[25];
+    f25 = x[26] - x[25];
+    f26 = x[26] - x[27];
+    f27 = x[28] - x[27];
+    f28 = x[28] - x[29];
+    f29 = x[30] - x[29];
+    f30 = x[30] - x[31];
+    f31 = MUL_F(FRAC_CONST(0.7071067811865476), f15);
+    f32 = x[0] - f31;
+    f33 = x[0] + f31;
+    f34 = f7 + f23;
+    f35 = MUL_C(COEF_CONST(1.3065629648763766), f7);
+    f36 = MUL_F(FRAC_CONST(-0.9238795325112866), f34);
+    f37 = MUL_F(FRAC_CONST(-0.5411961001461967), f23);
+    f38 = f35 + f36;
+    f39 = f37 - f36;
+    f40 = f33 - f39;
+    f41 = f33 + f39;
+    f42 = f32 - f38;
+    f43 = f32 + f38;
+    f44 = f11 - f19;
+    f45 = f11 + f19;
+    f46 = MUL_F(FRAC_CONST(0.7071067811865476), f45);
+    f47 = f3 - f46;
+    f48 = f3 + f46;
+    f49 = MUL_F(FRAC_CONST(0.7071067811865476), f44);
+    f50 = f49 - f27;
+    f51 = f49 + f27;
+    f52 = f51 + f48;
+    f53 = MUL_F(FRAC_CONST(-0.7856949583871021), f51);
+    f54 = MUL_F(FRAC_CONST(0.9807852804032304), f52);
+    f55 = MUL_C(COEF_CONST(1.1758756024193588), f48);
+    f56 = f53 + f54;
+    f57 = f55 - f54;
+    f58 = f50 + f47;
+    f59 = MUL_F(FRAC_CONST(-0.2758993792829430), f50);
+    f60 = MUL_F(FRAC_CONST(0.8314696123025452), f58);
+    f61 = MUL_C(COEF_CONST(1.3870398453221475), f47);
+    f62 = f59 + f60;
+    f63 = f61 - f60;
+    f64 = f41 - f56;
+    f65 = f41 + f56;
+    f66 = f43 - f62;
+    f67 = f43 + f62;
+    f68 = f42 - f63;
+    f69 = f42 + f63;
+    f70 = f40 - f57;
+    f71 = f40 + f57;
+    f72 = f5 - f9;
+    f73 = f5 + f9;
+    f74 = f13 - f17;
+    f75 = f13 + f17;
+    f76 = f21 - f25;
+    f77 = f21 + f25;
+    f78 = MUL_F(FRAC_CONST(0.7071067811865476), f75);
+    f79 = f1 - f78;
+    f80 = f1 + f78;
+    f81 = f73 + f77;
+    f82 = MUL_C(COEF_CONST(1.3065629648763766), f73);
+    f83 = MUL_F(FRAC_CONST(-0.9238795325112866), f81);
+    f84 = MUL_F(FRAC_CONST(-0.5411961001461967), f77);
+    f85 = f82 + f83;
+    f86 = f84 - f83;
+    f87 = f80 - f86;
+    f88 = f80 + f86;
+    f89 = f79 - f85;
+    f90 = f79 + f85;
+    f91 = MUL_F(FRAC_CONST(0.7071067811865476), f74);
+    f92 = f29 - f91;
+    f93 = f29 + f91;
+    f94 = f76 + f72;
+    f95 = MUL_C(COEF_CONST(1.3065629648763766), f76);
+    f96 = MUL_F(FRAC_CONST(-0.9238795325112866), f94);
+    f97 = MUL_F(FRAC_CONST(-0.5411961001461967), f72);
+    f98 = f95 + f96;
+    f99 = f97 - f96;
+    f100 = f93 - f99;
+    f101 = f93 + f99;
+    f102 = f92 - f98;
+    f103 = f92 + f98;
+    f104 = f101 + f88;
+    f105 = MUL_F(FRAC_CONST(-0.8971675863426361), f101);
+    f106 = MUL_F(FRAC_CONST(0.9951847266721968), f104);
+    f107 = MUL_C(COEF_CONST(1.0932018670017576), f88);
+    f108 = f105 + f106;
+    f109 = f107 - f106;
+    f110 = f90 - f103;
+    f111 = MUL_F(FRAC_CONST(-0.6666556584777466), f103);
+    f112 = MUL_F(FRAC_CONST(0.9569403357322089), f110);
+    f113 = MUL_C(COEF_CONST(1.2472250129866713), f90);
+    f114 = f112 - f111;
+    f115 = f113 - f112;
+    f116 = f102 + f89;
+    f117 = MUL_F(FRAC_CONST(-0.4105245275223571), f102);
+    f118 = MUL_F(FRAC_CONST(0.8819212643483549), f116);
+    f119 = MUL_C(COEF_CONST(1.3533180011743529), f89);
+    f120 = f117 + f118;
+    f121 = f119 - f118;
+    f122 = f87 - f100;
+    f123 = MUL_F(FRAC_CONST(-0.1386171691990915), f100);
+    f124 = MUL_F(FRAC_CONST(0.7730104533627370), f122);
+    f125 = MUL_C(COEF_CONST(1.4074037375263826), f87);
     f126 = f124 - f123;
-    f127 = t2[18] + t2[46];
-    f128 = 1.3315443865537255 * t2[18];
-    f129 = (-0.9039892931234433) * f127;
-    f130 = (-0.4764341996931612) * t2[46];
-    f131 = f128 + f129;
-    f132 = f130 - f129;
-    f133 = t2[26] + t2[38];
-    f134 = 1.3989068359730781 * t2[26];
-    f135 = (-0.8032075314806453) * f133;
-    f136 = (-0.2075082269882124) * t2[38];
-    f137 = f134 + f135;
-    f138 = f136 - f135;
-    f139 = t2[34] + t2[30];
-    f140 = 1.4125100802019777 * t2[34];
-    f141 = (-0.6715589548470187) * f139;
-    f142 = 0.0693921705079402 * t2[30];
-    f143 = f140 + f141;
-    f144 = f142 - f141;
-    f145 = t2[42] + t2[22];
-    f146 = 1.3718313541934939 * t2[42];
-    f147 = (-0.5141027441932219) * f145;
-    f148 = 0.3436258658070501 * t2[22];
-    f149 = f146 + f147;
-    f150 = f148 - f147;
-    f151 = t2[50] + t2[14];
-    f152 = 1.2784339185752409 * t2[50];
-    f153 = (-0.3368898533922200) * f151;
-    f154 = 0.6046542117908008 * t2[14];
-    f155 = f152 + f153;
-    f156 = f154 - f153;
-    f157 = t2[58] + t2[6];
-    f158 = 1.1359069844201433 * t2[58];
-    f159 = (-0.1467304744553624) * f157;
-    f160 = 0.8424460355094185 * t2[6];
-    f161 = f158 + f159;
-    f162 = f160 - f159;
-    f163 = f120 - f144;
-    f164 = f120 + f144;
-    f165 = f119 - f143;
-    f166 = f119 + f143;
-    f167 = f126 - f150;
-    f168 = f126 + f150;
-    f169 = f125 - f149;
-    f170 = f125 + f149;
-    f171 = f132 - f156;
-    f172 = f132 + f156;
-    f173 = f131 - f155;
-    f174 = f131 + f155;
-    f175 = f138 - f162;
-    f176 = f138 + f162;
-    f177 = f137 - f161;
-    f178 = f137 + f161;
-    f179 = f163 + f165;
-    f180 = 1.1758756024193588 * f163;
-    f181 = (-0.9807852804032304) * f179;
-    f182 = (-0.7856949583871021) * f165;
-    f183 = f180 + f181;
-    f184 = f182 - f181;
-    f185 = f167 + f169;
-    f186 = 1.3870398453221475 * f167;
-    f187 = (-0.5555702330196022) * f185;
-    f188 = 0.2758993792829431 * f169;
-    f189 = f186 + f187;
-    f190 = f188 - f187;
-    f191 = f171 + f173;
-    f192 = 0.7856949583871022 * f171;
-    f193 = 0.1950903220161283 * f191;
-    f194 = 1.1758756024193586 * f173;
-    f195 = f192 + f193;
-    f196 = f194 - f193;
-    f197 = f175 + f177;
-    f198 = (-0.2758993792829430) * f175;
-    f199 = 0.8314696123025452 * f197;
-    f200 = 1.3870398453221475 * f177;
-    f201 = f198 + f199;
-    f202 = f200 - f199;
-    f203 = f164 - f172;
-    f204 = f164 + f172;
-    f205 = f166 - f174;
-    f206 = f166 + f174;
-    f207 = f168 - f176;
-    f208 = f168 + f176;
-    f209 = f170 - f178;
-    f210 = f170 + f178;
-    f211 = f184 - f196;
-    f212 = f184 + f196;
-    f213 = f183 - f195;
-    f214 = f183 + f195;
-    f215 = f190 - f202;
-    f216 = f190 + f202;
-    f217 = f189 - f201;
-    f218 = f189 + f201;
-    f219 = f203 + f205;
-    f220 = 1.3065629648763766 * f203;
-    f221 = (-0.9238795325112866) * f219;
-    f222 = (-0.5411961001461967) * f205;
-    f223 = f220 + f221;
-    f224 = f222 - f221;
-    f225 = f207 + f209;
-    f226 = 0.5411961001461969 * f207;
-    f227 = 0.3826834323650898 * f225;
-    f228 = 1.3065629648763766 * f209;
-    f229 = f226 + f227;
-    f230 = f228 - f227;
-    f231 = f211 + f213;
-    f232 = 1.3065629648763766 * f211;
-    f233 = (-0.9238795325112866) * f231;
-    f234 = (-0.5411961001461967) * f213;
-    f235 = f232 + f233;
-    f236 = f234 - f233;
-    f237 = f215 + f217;
-    f238 = 0.5411961001461969 * f215;
-    f239 = 0.3826834323650898 * f237;
-    f240 = 1.3065629648763766 * f217;
-    f241 = f238 + f239;
-    f242 = f240 - f239;
-    f243 = f204 - f208;
-    f244 = f204 + f208;
-    f245 = f206 - f210;
-    f246 = f206 + f210;
-    f247 = f224 - f230;
-    f248 = f224 + f230;
-    f249 = f223 - f229;
-    f250 = f223 + f229;
-    f251 = f212 - f216;
-    f252 = f212 + f216;
-    f253 = f214 - f218;
-    f254 = f214 + f218;
-    f255 = f236 - f242;
-    f256 = f236 + f242;
-    f257 = f235 - f241;
-    f258 = f235 + f241;
-    f259 = f243 - f245;
-    f260 = f243 + f245;
-    f261 = 0.7071067811865474 * f259;
-    f262 = 0.7071067811865474 * f260;
-    f263 = f247 - f249;
-    f264 = f247 + f249;
-    f265 = 0.7071067811865474 * f263;
-    f266 = 0.7071067811865474 * f264;
-    f267 = f251 - f253;
-    f268 = f251 + f253;
-    f269 = 0.7071067811865474 * f267;
-    f270 = 0.7071067811865474 * f268;
-    f271 = f255 - f257;
-    f272 = f255 + f257;
-    f273 = 0.7071067811865474 * f271;
-    f274 = 0.7071067811865474 * f272;
-    f275 = f100 - f244;
-    f276 = f100 + f244;
-    f277 = f102 - f252;
-    f278 = f102 + f252;
-    f279 = f104 - f256;
-    f280 = f104 + f256;
-    f281 = f106 - f248;
-    f282 = f106 + f248;
-    f283 = f108 - f266;
-    f284 = f108 + f266;
-    f285 = f110 - f274;
-    f286 = f110 + f274;
-    f287 = f112 - f270;
-    f288 = f112 + f270;
-    f289 = f114 - f262;
-    f290 = f114 + f262;
-    f291 = f113 - f261;
-    f292 = f113 + f261;
-    f293 = f111 - f269;
-    f294 = f111 + f269;
-    f295 = f109 - f273;
-    f296 = f109 + f273;
-    f297 = f107 - f265;
-    f298 = f107 + f265;
-    f299 = f105 - f250;
-    f300 = f105 + f250;
-    f301 = f103 - f258;
-    f302 = f103 + f258;
-    f303 = f101 - f254;
-    f304 = f101 + f254;
-    f305 = f99 - f246;
-    f306 = f99 + f246;
-    f307 = t2[1] - t2[61];
-    f308 = 1.0478631305325901 * t2[1];
-    f309 = (-0.9987954562051724) * f307;
-    f310 = (-0.9497277818777548) * t2[61];
-    f311 = f308 + f309;
-    f312 = f309 + f310;
-    f313 = t2[9] - t2[53];
-    f314 = 1.2130114330978077 * t2[9];
-    f315 = (-0.9700312531945440) * f313;
-    f316 = (-0.7270510732912803) * t2[53];
-    f317 = f314 + f315;
-    f318 = f315 + f316;
-    f319 = t2[17] - t2[45];
-    f320 = 1.3315443865537255 * t2[17];
-    f321 = (-0.9039892931234433) * f319;
-    f322 = (-0.4764341996931612) * t2[45];
-    f323 = f320 + f321;
-    f324 = f321 + f322;
-    f325 = t2[25] - t2[37];
-    f326 = 1.3989068359730781 * t2[25];
-    f327 = (-0.8032075314806453) * f325;
-    f328 = (-0.2075082269882124) * t2[37];
-    f329 = f326 + f327;
-    f330 = f327 + f328;
-    f331 = t2[33] - t2[29];
-    f332 = 1.4125100802019777 * t2[33];
-    f333 = (-0.6715589548470187) * f331;
-    f334 = 0.0693921705079402 * t2[29];
-    f335 = f332 + f333;
-    f336 = f333 + f334;
-    f337 = t2[41] - t2[21];
-    f338 = 1.3718313541934939 * t2[41];
-    f339 = (-0.5141027441932219) * f337;
-    f340 = 0.3436258658070501 * t2[21];
-    f341 = f338 + f339;
-    f342 = f339 + f340;
-    f343 = t2[49] - t2[13];
-    f344 = 1.2784339185752409 * t2[49];
-    f345 = (-0.3368898533922200) * f343;
-    f346 = 0.6046542117908008 * t2[13];
-    f347 = f344 + f345;
-    f348 = f345 + f346;
-    f349 = t2[57] - t2[5];
-    f350 = 1.1359069844201433 * t2[57];
-    f351 = (-0.1467304744553624) * f349;
-    f352 = 0.8424460355094185 * t2[5];
-    f353 = f350 + f351;
-    f354 = f351 + f352;
-    f355 = f336 - f312;
-    f356 = f312 + f336;
-    f357 = f311 - f335;
-    f358 = f311 + f335;
-    f359 = f342 - f318;
-    f360 = f318 + f342;
-    f361 = f317 - f341;
-    f362 = f317 + f341;
-    f363 = f348 - f324;
-    f364 = f324 + f348;
-    f365 = f323 - f347;
-    f366 = f323 + f347;
-    f367 = f354 - f330;
-    f368 = f330 + f354;
-    f369 = f329 - f353;
-    f370 = f329 + f353;
-    f371 = f355 + f357;
-    f372 = 1.1758756024193588 * f355;
-    f373 = (-0.9807852804032304) * f371;
-    f374 = (-0.7856949583871021) * f357;
-    f375 = f372 + f373;
-    f376 = f374 - f373;
-    f377 = f359 + f361;
-    f378 = 1.3870398453221475 * f359;
-    f379 = (-0.5555702330196022) * f377;
-    f380 = 0.2758993792829431 * f361;
-    f381 = f378 + f379;
-    f382 = f380 - f379;
-    f383 = f363 + f365;
-    f384 = 0.7856949583871022 * f363;
-    f385 = 0.1950903220161283 * f383;
-    f386 = 1.1758756024193586 * f365;
-    f387 = f384 + f385;
-    f388 = f386 - f385;
-    f389 = f367 + f369;
-    f390 = (-0.2758993792829430) * f367;
-    f391 = 0.8314696123025452 * f389;
-    f392 = 1.3870398453221475 * f369;
-    f393 = f390 + f391;
-    f394 = f392 - f391;
-    f395 = f364 - f356;
-    f396 = f356 + f364;
-    f397 = f358 - f366;
-    f398 = f358 + f366;
-    f399 = f368 - f360;
-    f400 = f360 + f368;
-    f401 = f362 - f370;
-    f402 = f362 + f370;
-    f403 = f376 - f388;
-    f404 = f376 + f388;
-    f405 = f375 - f387;
-    f406 = f375 + f387;
-    f407 = f382 - f394;
-    f408 = f382 + f394;
-    f409 = f381 - f393;
-    f410 = f381 + f393;
-    f411 = f395 + f397;
-    f412 = 1.3065629648763766 * f395;
-    f413 = (-0.9238795325112866) * f411;
-    f414 = (-0.5411961001461967) * f397;
-    f415 = f412 + f413;
-    f416 = f414 - f413;
-    f417 = f399 + f401;
-    f418 = 0.5411961001461969 * f399;
-    f419 = 0.3826834323650898 * f417;
-    f420 = 1.3065629648763766 * f401;
-    f421 = f418 + f419;
-    f422 = f420 - f419;
-    f423 = f403 + f405;
-    f424 = 1.3065629648763766 * f403;
-    f425 = (-0.9238795325112866) * f423;
-    f426 = (-0.5411961001461967) * f405;
-    f427 = f424 + f425;
-    f428 = f426 - f425;
-    f429 = f407 + f409;
-    f430 = 0.5411961001461969 * f407;
-    f431 = 0.3826834323650898 * f429;
-    f432 = 1.3065629648763766 * f409;
-    f433 = f430 + f431;
-    f434 = f432 - f431;
-    f435 = f400 - f396;
-    f436 = f396 + f400;
-    f437 = f398 - f402;
-    f438 = f398 + f402;
-    f439 = f416 - f422;
-    f440 = f416 + f422;
-    f441 = f415 - f421;
-    f442 = f415 + f421;
-    f443 = f404 - f408;
-    f444 = f404 + f408;
-    f445 = f406 - f410;
-    f446 = f406 + f410;
-    f447 = f428 - f434;
-    f448 = f428 + f434;
-    f449 = f427 - f433;
-    f450 = f427 + f433;
-    f451 = f435 - f437;
-    f452 = f435 + f437;
-    f453 = 0.7071067811865474 * f451;
-    f454 = 0.7071067811865474 * f452;
-    f455 = f439 - f441;
-    f456 = f439 + f441;
-    f457 = 0.7071067811865474 * f455;
-    f458 = 0.7071067811865474 * f456;
-    f459 = f443 - f445;
-    f460 = f443 + f445;
-    f461 = 0.7071067811865474 * f459;
-    f462 = 0.7071067811865474 * f460;
-    f463 = f447 - f449;
-    f464 = f447 + f449;
-    f465 = 0.7071067811865474 * f463;
-    f466 = 0.7071067811865474 * f464;
-    f467 = 0.7071067811865476 * t2[31];
-    f468 = t2[63] - f467;
-    f469 = t2[63] + f467;
-    f470 = t2[47] + t2[15];
-    f471 = 1.3065629648763766 * t2[47];
-    f472 = (-0.9238795325112866) * f470;
-    f473 = (-0.5411961001461967) * t2[15];
-    f474 = f471 + f472;
-    f475 = f473 - f472;
-    f476 = f469 - f475;
-    f477 = f469 + f475;
-    f478 = f468 - f474;
-    f479 = f468 + f474;
-    f480 = t2[55] + t2[7];
-    f481 = 1.1758756024193588 * t2[55];
-    f482 = (-0.9807852804032304) * f480;
-    f483 = (-0.7856949583871021) * t2[7];
-    f484 = f481 + f482;
-    f485 = f483 - f482;
-    f486 = t2[39] + t2[23];
-    f487 = 1.3870398453221473 * t2[39];
-    f488 = (-0.8314696123025455) * f486;
-    f489 = (-0.2758993792829436) * t2[23];
-    f490 = f487 + f488;
-    f491 = f489 - f488;
-    f492 = f485 - f491;
-    f493 = f485 + f491;
-    f494 = 0.7071067811865476 * f492;
-    f495 = f484 - f490;
-    f496 = f484 + f490;
-    f497 = 0.7071067811865476 * f496;
-    f498 = f494 - f497;
-    f499 = f494 + f497;
-    f500 = f477 - f493;
-    f501 = f477 + f493;
-    f502 = f479 - f499;
-    f503 = f479 + f499;
-    f504 = f478 - f498;
-    f505 = f478 + f498;
-    f506 = f476 - f495;
-    f507 = f476 + f495;
-    f508 = t2[59] + t2[3];
-    f509 = 1.0932018670017569 * t2[59];
-    f510 = (-0.9951847266721969) * f508;
-    f511 = (-0.8971675863426368) * t2[3];
-    f512 = f509 + f510;
-    f513 = f511 - f510;
-    f514 = t2[51] + t2[11];
-    f515 = 1.2472250129866711 * t2[51];
-    f516 = (-0.9569403357322089) * f514;
-    f517 = (-0.6666556584777469) * t2[11];
-    f518 = f515 + f516;
-    f519 = f517 - f516;
-    f520 = t2[43] + t2[19];
-    f521 = 1.3533180011743526 * t2[43];
-    f522 = (-0.8819212643483551) * f520;
-    f523 = (-0.4105245275223575) * t2[19];
-    f524 = f521 + f522;
-    f525 = f523 - f522;
-    f526 = t2[35] + t2[27];
-    f527 = 1.4074037375263826 * t2[35];
-    f528 = (-0.7730104533627369) * f526;
-    f529 = (-0.1386171691990913) * t2[27];
-    f530 = f527 + f528;
-    f531 = f529 - f528;
-    f532 = f513 - f531;
-    f533 = f513 + f531;
-    f534 = f519 - f525;
-    f535 = f519 + f525;
-    f536 = f533 - f535;
-    f537 = f533 + f535;
-    f538 = 0.7071067811865476 * f536;
-    f539 = f532 + f534;
-    f540 = 1.3065629648763766 * f532;
-    f541 = (-0.9238795325112866) * f539;
-    f542 = (-0.5411961001461967) * f534;
-    f543 = f540 + f541;
-    f544 = f542 - f541;
-    f545 = f512 - f530;
-    f546 = f512 + f530;
-    f547 = f518 - f524;
-    f548 = f518 + f524;
-    f549 = f546 + f548;
-    f550 = 1.3065629648763770 * f546;
-    f551 = (-0.3826834323650904) * f549;
-    f552 = 0.5411961001461961 * f548;
-    f553 = f550 + f551;
-    f554 = f552 - f551;
-    f555 = f545 - f547;
-    f556 = f545 + f547;
-    f557 = 0.7071067811865476 * f556;
-    f558 = f544 - f554;
-    f559 = f544 + f554;
-    f560 = f538 - f557;
-    f561 = f538 + f557;
-    f562 = f543 - f553;
-    f563 = f543 + f553;
-    f564 = f501 - f537;
-    f565 = f501 + f537;
-    f566 = f503 - f559;
-    f567 = f503 + f559;
-    f568 = f505 - f558;
-    f569 = f505 + f558;
-    f570 = f507 - f561;
-    f571 = f507 + f561;
-    f572 = f506 - f560;
-    f573 = f506 + f560;
-    f574 = f504 - f563;
-    f575 = f504 + f563;
-    f576 = f502 - f562;
-    f577 = f502 + f562;
-    f578 = f500 - f555;
-    f579 = f500 + f555;
-    f580 = f438 - f565;
-    f581 = f438 + f565;
-    f582 = f446 + f567;
-    f583 = f446 - f567;
-    f584 = f450 - f569;
-    f585 = f450 + f569;
-    f586 = f442 + f571;
-    f587 = f442 - f571;
-    f588 = f457 - f573;
-    f589 = f457 + f573;
-    f590 = f465 + f575;
-    f591 = f465 - f575;
-    f592 = f461 - f577;
-    f593 = f461 + f577;
-    f594 = f453 + f579;
-    f595 = f453 - f579;
-    f596 = f454 - f578;
-    f597 = f454 + f578;
-    f598 = f462 + f576;
-    f599 = f462 - f576;
-    f600 = f466 - f574;
-    f601 = f466 + f574;
-    f602 = f458 + f572;
-    f603 = f458 - f572;
-    f604 = f440 - f570;
-    f605 = f440 + f570;
-    f606 = f448 + f568;
-    f607 = f448 - f568;
-    f608 = f444 - f566;
-    f609 = f444 + f566;
-    f610 = f564 - f436;
-    f611 = f436 + f564;
-    f612 = f581 + f276;
-    f613 = (-0.9876531635534246) * f581;
-    f614 = 0.9999247018391445 * f612;
-    f615 = 1.0121962401248645 * f276;
-    y[0] = f613 + f614;
-    y[63] = f615 - f614;
-    f618 = f583 + f278;
-    f619 = (-0.9625151616469906) * f583;
-    f620 = 0.9993223845883495 * f618;
-    f621 = 1.0361296075297086 * f278;
-    y[1] = f619 + f620;
-    y[62] = f621 - f620;
-    f624 = f585 + f280;
-    f625 = (-0.9367973765979405) * f585;
-    f626 = 0.9981181129001492 * f624;
-    f627 = 1.0594388492023579 * f280;
-    y[2] = f625 + f626;
-    y[61] = f627 - f626;
-    f630 = f587 + f282;
-    f631 = (-0.9105152998383381) * f587;
-    f632 = 0.9963126121827780 * f630;
-    f633 = 1.0821099245272179 * f282;
-    y[3] = f631 + f632;
-    y[60] = f633 - f632;
-    f636 = f589 + f284;
-    f637 = (-0.8836847627084729) * f589;
-    f638 = 0.9939069700023561 * f636;
-    f639 = 1.1041291772962392 * f284;
-    y[4] = f637 + f638;
-    y[59] = f639 - f638;
-    f642 = f591 + f286;
-    f643 = (-0.8563219269206538) * f591;
-    f644 = 0.9909026354277800 * f642;
-    f645 = 1.1254833439349063 * f286;
-    y[5] = f643 + f644;
-    y[58] = f645 - f644;
-    f648 = f593 + f288;
-    f649 = (-0.8284432748239970) * f593;
-    f650 = 0.9873014181578584 * f648;
-    f651 = 1.1461595614917197 * f288;
-    y[6] = f649 + f650;
-    y[57] = f651 - f650;
-    f654 = f595 + f290;
-    f655 = (-0.8000655994760753) * f595;
-    f656 = 0.9831054874312163 * f654;
-    f657 = 1.1661453753863573 * f290;
-    y[7] = f655 + f656;
-    y[56] = f657 - f656;
-    f660 = f597 + f292;
-    f661 = (-0.7712059945274091) * f597;
-    f662 = 0.9783173707196277 * f660;
-    f663 = 1.1854287469118463 * f292;
-    y[8] = f661 + f662;
-    y[55] = f663 - f662;
-    f666 = f599 + f294;
-    f667 = (-0.7418818439248888) * f599;
-    f668 = 0.9729399522055601 * f666;
-    f669 = 1.2039980604862313 * f294;
-    y[9] = f667 + f668;
-    y[54] = f669 - f668;
-    f672 = f601 + f296;
-    f673 = (-0.7121108114403374) * f601;
-    f674 = 0.9669764710448521 * f672;
-    f675 = 1.2218421306493668 * f296;
-    y[10] = f673 + f674;
-    y[53] = f675 - f674;
-    f678 = f603 + f298;
-    f679 = (-0.6819108300305128) * f603;
-    f680 = 0.9604305194155658 * f678;
-    f681 = 1.2389502088006188 * f298;
-    y[11] = f679 + f680;
-    y[52] = f681 - f680;
-    f684 = f605 + f300;
-    f685 = (-0.6513000910349656) * f605;
-    f686 = 0.9533060403541938 * f684;
-    f687 = 1.2553119896734219 * f300;
-    y[12] = f685 + f686;
-    y[51] = f687 - f686;
-    f690 = f607 + f302;
-    f691 = (-0.6202970332182582) * f607;
-    f692 = 0.9456073253805213 * f690;
-    f693 = 1.2709176175427843 * f302;
-    y[13] = f691 + f692;
-    y[50] = f693 - f692;
-    f696 = f609 + f304;
-    f697 = (-0.5889203316631404) * f609;
-    f698 = 0.9373390119125750 * f696;
-    f699 = 1.2857576921620095 * f304;
-    y[14] = f697 + f698;
-    y[49] = f699 - f698;
-    f702 = f306 - f611;
-    f703 = (-0.5571888865213779) * f611;
-    f704 = 0.9285060804732155 * f702;
-    f705 = 1.2998232744250531 * f306;
-    y[15] = f704 - f703;
-    y[48] = f705 - f704;
-    f708 = f610 + f305;
-    f709 = (-0.5251218116290097) * f610;
-    f710 = 0.9191138516900578 * f708;
-    f711 = 1.3131058917511058 * f305;
-    y[16] = f709 + f710;
-    y[47] = f711 - f710;
-    f714 = f608 + f303;
-    f715 = (-0.4927384229928850) * f608;
-    f716 = 0.9091679830905223 * f714;
-    f717 = 1.3255975431881595 * f303;
-    y[17] = f715 + f716;
-    y[46] = f717 - f716;
-    f720 = f606 + f301;
-    f721 = (-0.4600582271554261) * f606;
-    f722 = 0.8986744656939538 * f720;
-    f723 = 1.3372907042324815 * f301;
-    y[18] = f721 + f722;
-    y[45] = f723 - f722;
-    f726 = f604 + f299;
-    f727 = (-0.4271009094446139) * f604;
-    f728 = 0.8876396204028539 * f726;
-    f729 = 1.3481783313610940 * f299;
-    y[19] = f727 + f728;
-    y[44] = f729 - f728;
-    f732 = f602 + f297;
-    f733 = (-0.3938863221162838) * f602;
-    f734 = 0.8760700941954066 * f732;
-    f735 = 1.3582538662745294 * f297;
-    y[20] = f733 + f734;
-    y[43] = f735 - f734;
-    f738 = f600 + f295;
-    f739 = (-0.3604344723958691) * f600;
-    f740 = 0.8639728561215867 * f738;
-    f741 = 1.3675112398473042 * f295;
-    y[21] = f739 + f740;
-    y[42] = f741 - f740;
-    f744 = f598 + f293;
-    f745 = (-0.3267655104267964) * f598;
-    f746 = 0.8513551931052652 * f744;
-    f747 = 1.3759448757837340 * f293;
-    y[22] = f745 + f746;
-    y[41] = f747 - f746;
-    f750 = f596 + f291;
-    f751 = (-0.2928997171327915) * f596;
-    f752 = 0.8382247055548380 * f750;
-    f753 = 1.3835496939768843 * f291;
-    y[23] = f751 + f752;
-    y[40] = f753 - f752;
-    f756 = f594 + f289;
-    f757 = (-0.2588574920014121) * f594;
-    f758 = 0.8245893027850253 * f756;
-    f759 = 1.3903211135686386 * f289;
-    y[24] = f757 + f758;
-    y[39] = f759 - f758;
-    f762 = f592 + f287;
-    f763 = (-0.2246593407961559) * f592;
-    f764 = 0.8104571982525948 * f762;
-    f765 = 1.3962550557090336 * f287;
-    y[25] = f763 + f764;
-    y[38] = f765 - f764;
-    f768 = f590 + f285;
-    f769 = (-0.1903258632045579) * f590;
-    f770 = 0.7958369046088835 * f768;
-    f771 = 1.4013479460132090 * f285;
-    y[26] = f769 + f770;
-    y[37] = f771 - f770;
-    f774 = f588 + f283;
-    f775 = (-0.1558777404297079) * f588;
-    f776 = 0.7807372285720944 * f774;
-    f777 = 1.4055967167144807 * f283;
-    y[27] = f775 + f776;
-    y[36] = f777 - f776;
-    f780 = f586 + f281;
-    f781 = (-0.1213357227326675) * f586;
-    f782 = 0.7651672656224590 * f780;
-    f783 = 1.4089988085122505 * f281;
-    y[28] = f781 + f782;
-    y[35] = f783 - f782;
-    f786 = f584 + f279;
-    f787 = (-0.0867206169332875) * f584;
-    f788 = 0.7491363945234593 * f786;
-    f789 = 1.4115521721136310 * f279;
-    y[29] = f787 + f788;
-    y[34] = f789 - f788;
-    f792 = f582 + f277;
-    f793 = (-0.0520532738769597) * f582;
-    f794 = 0.7326542716724128 * f792;
-    f795 = 1.4132552694678659 * f277;
-    y[30] = f793 + f794;
-    y[33] = f795 - f794;
-    f798 = f580 + f275;
-    f799 = (-0.0173545758748457) * f580;
-    f800 = 0.7157308252838186 * f798;
-    f801 = 1.4141070746927915 * f275;
-    y[31] = f799 + f800;
-    y[32] = f801 - f800;
+    f127 = f125 - f124;
+    f128 = f65 - f108;
+    f129 = f65 + f108;
+    f130 = f67 - f114;
+    f131 = f67 + f114;
+    f132 = f69 - f120;
+    f133 = f69 + f120;
+    f134 = f71 - f126;
+    f135 = f71 + f126;
+    f136 = f70 - f127;
+    f137 = f70 + f127;
+    f138 = f68 - f121;
+    f139 = f68 + f121;
+    f140 = f66 - f115;
+    f141 = f66 + f115;
+    f142 = f64 - f109;
+    f143 = f64 + f109;
+    f144 = f0 + f30;
+    f145 = MUL_C(COEF_CONST(1.0478631305325901), f0);
+    f146 = MUL_F(FRAC_CONST(-0.9987954562051724), f144);
+    f147 = MUL_F(FRAC_CONST(-0.9497277818777548), f30);
+    f148 = f145 + f146;
+    f149 = f147 - f146;
+    f150 = f4 + f26;
+    f151 = MUL_F(FRAC_CONST(1.2130114330978077), f4);
+    f152 = MUL_F(FRAC_CONST(-0.9700312531945440), f150);
+    f153 = MUL_F(FRAC_CONST(-0.7270510732912803), f26);
+    f154 = f151 + f152;
+    f155 = f153 - f152;
+    f156 = f8 + f22;
+    f157 = MUL_C(COEF_CONST(1.3315443865537255), f8);
+    f158 = MUL_F(FRAC_CONST(-0.9039892931234433), f156);
+    f159 = MUL_F(FRAC_CONST(-0.4764341996931612), f22);
+    f160 = f157 + f158;
+    f161 = f159 - f158;
+    f162 = f12 + f18;
+    f163 = MUL_C(COEF_CONST(1.3989068359730781), f12);
+    f164 = MUL_F(FRAC_CONST(-0.8032075314806453), f162);
+    f165 = MUL_F(FRAC_CONST(-0.2075082269882124), f18);
+    f166 = f163 + f164;
+    f167 = f165 - f164;
+    f168 = f16 + f14;
+    f169 = MUL_C(COEF_CONST(1.4125100802019777), f16);
+    f170 = MUL_F(FRAC_CONST(-0.6715589548470187), f168);
+    f171 = MUL_F(FRAC_CONST(0.0693921705079402), f14);
+    f172 = f169 + f170;
+    f173 = f171 - f170;
+    f174 = f20 + f10;
+    f175 = MUL_C(COEF_CONST(1.3718313541934939), f20);
+    f176 = MUL_F(FRAC_CONST(-0.5141027441932219), f174);
+    f177 = MUL_F(FRAC_CONST(0.3436258658070501), f10);
+    f178 = f175 + f176;
+    f179 = f177 - f176;
+    f180 = f24 + f6;
+    f181 = MUL_C(COEF_CONST(1.2784339185752409), f24);
+    f182 = MUL_F(FRAC_CONST(-0.3368898533922200), f180);
+    f183 = MUL_F(FRAC_CONST(0.6046542117908008), f6);
+    f184 = f181 + f182;
+    f185 = f183 - f182;
+    f186 = f28 + f2;
+    f187 = MUL_C(COEF_CONST(1.1359069844201433), f28);
+    f188 = MUL_F(FRAC_CONST(-0.1467304744553624), f186);
+    f189 = MUL_F(FRAC_CONST(0.8424460355094185), f2);
+    f190 = f187 + f188;
+    f191 = f189 - f188;
+    f192 = f149 - f173;
+    f193 = f149 + f173;
+    f194 = f148 - f172;
+    f195 = f148 + f172;
+    f196 = f155 - f179;
+    f197 = f155 + f179;
+    f198 = f154 - f178;
+    f199 = f154 + f178;
+    f200 = f161 - f185;
+    f201 = f161 + f185;
+    f202 = f160 - f184;
+    f203 = f160 + f184;
+    f204 = f167 - f191;
+    f205 = f167 + f191;
+    f206 = f166 - f190;
+    f207 = f166 + f190;
+    f208 = f192 + f194;
+    f209 = MUL_C(COEF_CONST(1.1758756024193588), f192);
+    f210 = MUL_F(FRAC_CONST(-0.9807852804032304), f208);
+    f211 = MUL_F(FRAC_CONST(-0.7856949583871021), f194);
+    f212 = f209 + f210;
+    f213 = f211 - f210;
+    f214 = f196 + f198;
+    f215 = MUL_C(COEF_CONST(1.3870398453221475), f196);
+    f216 = MUL_F(FRAC_CONST(-0.5555702330196022), f214);
+    f217 = MUL_F(FRAC_CONST(0.2758993792829431), f198);
+    f218 = f215 + f216;
+    f219 = f217 - f216;
+    f220 = f200 + f202;
+    f221 = MUL_F(FRAC_CONST(0.7856949583871022), f200);
+    f222 = MUL_F(FRAC_CONST(0.1950903220161283), f220);
+    f223 = MUL_C(COEF_CONST(1.1758756024193586), f202);
+    f224 = f221 + f222;
+    f225 = f223 - f222;
+    f226 = f204 + f206;
+    f227 = MUL_F(FRAC_CONST(-0.2758993792829430), f204);
+    f228 = MUL_F(FRAC_CONST(0.8314696123025452), f226);
+    f229 = MUL_C(COEF_CONST(1.3870398453221475), f206);
+    f230 = f227 + f228;
+    f231 = f229 - f228;
+    f232 = f193 - f201;
+    f233 = f193 + f201;
+    f234 = f195 - f203;
+    f235 = f195 + f203;
+    f236 = f197 - f205;
+    f237 = f197 + f205;
+    f238 = f199 - f207;
+    f239 = f199 + f207;
+    f240 = f213 - f225;
+    f241 = f213 + f225;
+    f242 = f212 - f224;
+    f243 = f212 + f224;
+    f244 = f219 - f231;
+    f245 = f219 + f231;
+    f246 = f218 - f230;
+    f247 = f218 + f230;
+    f248 = f232 + f234;
+    f249 = MUL_C(COEF_CONST(1.3065629648763766), f232);
+    f250 = MUL_F(FRAC_CONST(-0.9238795325112866), f248);
+    f251 = MUL_F(FRAC_CONST(-0.5411961001461967), f234);
+    f252 = f249 + f250;
+    f253 = f251 - f250;
+    f254 = f236 + f238;
+    f255 = MUL_F(FRAC_CONST(0.5411961001461969), f236);
+    f256 = MUL_F(FRAC_CONST(0.3826834323650898), f254);
+    f257 = MUL_C(COEF_CONST(1.3065629648763766), f238);
+    f258 = f255 + f256;
+    f259 = f257 - f256;
+    f260 = f240 + f242;
+    f261 = MUL_C(COEF_CONST(1.3065629648763766), f240);
+    f262 = MUL_F(FRAC_CONST(-0.9238795325112866), f260);
+    f263 = MUL_F(FRAC_CONST(-0.5411961001461967), f242);
+    f264 = f261 + f262;
+    f265 = f263 - f262;
+    f266 = f244 + f246;
+    f267 = MUL_F(FRAC_CONST(0.5411961001461969), f244);
+    f268 = MUL_F(FRAC_CONST(0.3826834323650898), f266);
+    f269 = MUL_C(COEF_CONST(1.3065629648763766), f246);
+    f270 = f267 + f268;
+    f271 = f269 - f268;
+    f272 = f233 - f237;
+    f273 = f233 + f237;
+    f274 = f235 - f239;
+    f275 = f235 + f239;
+    f276 = f253 - f259;
+    f277 = f253 + f259;
+    f278 = f252 - f258;
+    f279 = f252 + f258;
+    f280 = f241 - f245;
+    f281 = f241 + f245;
+    f282 = f243 - f247;
+    f283 = f243 + f247;
+    f284 = f265 - f271;
+    f285 = f265 + f271;
+    f286 = f264 - f270;
+    f287 = f264 + f270;
+    f288 = f272 - f274;
+    f289 = f272 + f274;
+    f290 = MUL_F(FRAC_CONST(0.7071067811865474), f288);
+    f291 = MUL_F(FRAC_CONST(0.7071067811865474), f289);
+    f292 = f276 - f278;
+    f293 = f276 + f278;
+    f294 = MUL_F(FRAC_CONST(0.7071067811865474), f292);
+    f295 = MUL_F(FRAC_CONST(0.7071067811865474), f293);
+    f296 = f280 - f282;
+    f297 = f280 + f282;
+    f298 = MUL_F(FRAC_CONST(0.7071067811865474), f296);
+    f299 = MUL_F(FRAC_CONST(0.7071067811865474), f297);
+    f300 = f284 - f286;
+    f301 = f284 + f286;
+    f302 = MUL_F(FRAC_CONST(0.7071067811865474), f300);
+    f303 = MUL_F(FRAC_CONST(0.7071067811865474), f301);
+    f304 = f129 - f273;
+    f305 = f129 + f273;
+    f306 = f131 - f281;
+    f307 = f131 + f281;
+    f308 = f133 - f285;
+    f309 = f133 + f285;
+    f310 = f135 - f277;
+    f311 = f135 + f277;
+    f312 = f137 - f295;
+    f313 = f137 + f295;
+    f314 = f139 - f303;
+    f315 = f139 + f303;
+    f316 = f141 - f299;
+    f317 = f141 + f299;
+    f318 = f143 - f291;
+    f319 = f143 + f291;
+    f320 = f142 - f290;
+    f321 = f142 + f290;
+    f322 = f140 - f298;
+    f323 = f140 + f298;
+    f324 = f138 - f302;
+    f325 = f138 + f302;
+    f326 = f136 - f294;
+    f327 = f136 + f294;
+    f328 = f134 - f279;
+    f329 = f134 + f279;
+    f330 = f132 - f287;
+    f331 = f132 + f287;
+    f332 = f130 - f283;
+    f333 = f130 + f283;
+    f334 = f128 - f275;
+    f335 = f128 + f275;
+    y[31] = MUL_F(FRAC_CONST(0.5001506360206510), f305);
+    y[30] = MUL_F(FRAC_CONST(0.5013584524464084), f307);
+    y[29] = MUL_F(FRAC_CONST(0.5037887256810443), f309);
+    y[28] = MUL_F(FRAC_CONST(0.5074711720725553), f311);
+    y[27] = MUL_F(FRAC_CONST(0.5124514794082247), f313);
+    y[26] = MUL_F(FRAC_CONST(0.5187927131053328), f315);
+    y[25] = MUL_F(FRAC_CONST(0.5265773151542700), f317);
+    y[24] = MUL_F(FRAC_CONST(0.5359098169079920), f319);
+    y[23] = MUL_F(FRAC_CONST(0.5469204379855088), f321);
+    y[22] = MUL_F(FRAC_CONST(0.5597698129470802), f323);
+    y[21] = MUL_F(FRAC_CONST(0.5746551840326600), f325);
+    y[20] = MUL_F(FRAC_CONST(0.5918185358574165), f327);
+    y[19] = MUL_F(FRAC_CONST(0.6115573478825099), f329);
+    y[18] = MUL_F(FRAC_CONST(0.6342389366884031), f331);
+    y[17] = MUL_F(FRAC_CONST(0.6603198078137061), f333);
+    y[16] = MUL_F(FRAC_CONST(0.6903721282002123), f335);
+    y[15] = MUL_F(FRAC_CONST(0.7251205223771985), f334);
+    y[14] = MUL_F(FRAC_CONST(0.7654941649730891), f332);
+    y[13] = MUL_F(FRAC_CONST(0.8127020908144905), f330);
+    y[12] = MUL_F(FRAC_CONST(0.8683447152233481), f328);
+    y[11] = MUL_F(FRAC_CONST(0.9345835970364075), f326);
+    y[10] = MUL_C(COEF_CONST(1.0144082649970547), f324);
+    y[9] = MUL_C(COEF_CONST(1.1120716205797176), f322);
+    y[8] = MUL_C(COEF_CONST(1.2338327379765710), f320);
+    y[7] = MUL_C(COEF_CONST(1.3892939586328277), f318);
+    y[6] = MUL_C(COEF_CONST(1.5939722833856311), f316);
+    y[5] = MUL_C(COEF_CONST(1.8746759800084078), f314);
+    y[4] = MUL_C(COEF_CONST(2.2820500680051619), f312);
+    y[3] = MUL_C(COEF_CONST(2.9246284281582162), f310);
+    y[2] = MUL_C(COEF_CONST(4.0846110781292477), f308);
+    y[1] = MUL_C(COEF_CONST(6.7967507116736332), f306);
+    y[0] = MUL_R(REAL_CONST(20.3738781672314530), f304);
 }
 
 #endif
 
 #endif
-
--- a/Plugins/Input/aac/libfaad2/sbr_dct.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sbr_dct.h	Wed May 10 14:44:20 2006 -0700
@@ -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.10 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_dct.h,v 1.15 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_DCT_H__
@@ -32,11 +32,14 @@
 extern "C" {
 #endif
 
+void dct4_kernel(real_t * in_real, real_t * in_imag, real_t * out_real, real_t * out_imag);
+
 void DCT3_32_unscaled(real_t *y, real_t *x);
-void DCT2_64_unscaled(real_t *y, real_t *x);
-void DST2_64_unscaled(real_t *y, real_t *x);
-void DCT4_64(real_t *y, real_t *x);
-void DCT4_64_kernel(real_t *y, real_t *t2);
+void DCT4_32(real_t *y, real_t *x);
+void DST4_32(real_t *y, real_t *x);
+void DCT2_32_unscaled(real_t *y, real_t *x);
+void DCT4_16(real_t *y, real_t *x);
+void DCT2_16_unscaled(real_t *y, real_t *x);
 
 
 #ifdef __cplusplus
--- a/Plugins/Input/aac/libfaad2/sbr_dec.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sbr_dec.c	Wed May 10 14:44:20 2006 -0700
@@ -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.26 2004/01/29 11:31:11 menno Exp $
+** $Id: sbr_dec.c,v 1.39 2004/09/04 14:56:28 menno Exp $
 **/
 
 
@@ -41,11 +41,14 @@
 #include "sbr_hfgen.h"
 #include "sbr_hfadj.h"
 
+
 /* static function declarations */
 static uint8_t sbr_save_prev_data(sbr_info *sbr, uint8_t ch);
+static void sbr_save_matrix(sbr_info *sbr, uint8_t ch);
+
 
 sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac,
-                        uint32_t sample_rate
+                        uint32_t sample_rate, uint8_t downSampledSBR
 #ifdef DRM
 						, uint8_t IsDRM
 #endif
@@ -71,14 +74,19 @@
     sbr->prevEnvIsShort[0] = -1;
     sbr->prevEnvIsShort[1] = -1;
     sbr->header_count = 0;
+    sbr->Reset = 1;
 
 #ifdef DRM
     sbr->Is_DRM_SBR = IsDRM;
 #endif
-    sbr->bs_samplerate_mode = 1;
     sbr->tHFGen = T_HFGEN;
     sbr->tHFAdj = T_HFADJ;
 
+    sbr->bsco = 0;
+    sbr->bsco_prev = 0;
+    sbr->M_prev = 0;
+    sbr->frame_len = framelength;
+
     /* force sbr reset */
     sbr->bs_start_freq_prev = -1;
 
@@ -91,6 +99,44 @@
         sbr->numTimeSlots = NO_TIME_SLOTS;
     }
 
+    sbr->GQ_ringbuf_index[0] = 0;
+    sbr->GQ_ringbuf_index[1] = 0;
+
+    if (id_aac == ID_CPE)
+    {
+        /* stereo */
+        uint8_t j;
+        sbr->qmfa[0] = qmfa_init(32);
+        sbr->qmfa[1] = qmfa_init(32);
+        sbr->qmfs[0] = qmfs_init((downSampledSBR)?32:64);
+        sbr->qmfs[1] = qmfs_init((downSampledSBR)?32:64);
+
+        for (j = 0; j < 5; j++)
+        {
+            sbr->G_temp_prev[0][j] = faad_malloc(64*sizeof(real_t));
+            sbr->G_temp_prev[1][j] = faad_malloc(64*sizeof(real_t));
+            sbr->Q_temp_prev[0][j] = faad_malloc(64*sizeof(real_t));
+            sbr->Q_temp_prev[1][j] = faad_malloc(64*sizeof(real_t));
+        }
+
+        memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t));
+        memset(sbr->Xsbr[1], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t));
+    } else {
+        /* mono */
+        uint8_t j;
+        sbr->qmfa[0] = qmfa_init(32);
+        sbr->qmfs[0] = qmfs_init((downSampledSBR)?32:64);
+        sbr->qmfs[1] = NULL;
+
+        for (j = 0; j < 5; j++)
+        {
+            sbr->G_temp_prev[0][j] = faad_malloc(64*sizeof(real_t));
+            sbr->Q_temp_prev[0][j] = faad_malloc(64*sizeof(real_t));
+        }
+
+        memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t));
+    }
+
     return sbr;
 }
 
@@ -116,6 +162,16 @@
             if (sbr->Q_temp_prev[1][j]) faad_free(sbr->Q_temp_prev[1][j]);
         }
 
+#ifdef PS_DEC
+        if (sbr->ps != NULL) 
+            ps_free(sbr->ps);
+#endif
+
+#ifdef DRM_PS
+        if (sbr->drm_ps != NULL)
+            drm_ps_free(sbr->drm_ps);
+#endif
+
         faad_free(sbr);
     }
 }
@@ -126,6 +182,8 @@
 
     /* save data for next frame */
     sbr->kx_prev = sbr->kx;
+    sbr->M_prev = sbr->M;
+    sbr->bsco_prev = sbr->bsco;
 
     sbr->L_E_prev[ch] = sbr->L_E[ch];
 
@@ -134,13 +192,13 @@
         return 19;
 
     sbr->f_prev[ch] = sbr->f[ch][sbr->L_E[ch] - 1];
-    for (i = 0; i < 64; i++)
+    for (i = 0; i < MAX_M; i++)
     {
         sbr->E_prev[ch][i] = sbr->E[ch][i][sbr->L_E[ch] - 1];
         sbr->Q_prev[ch][i] = sbr->Q[ch][i][sbr->L_Q[ch] - 1];
     }
 
-    for (i = 0; i < 64; i++)
+    for (i = 0; i < MAX_M; i++)
     {
         sbr->bs_add_harmonic_prev[ch][i] = sbr->bs_add_harmonic[ch][i];
     }
@@ -154,43 +212,66 @@
     return 0;
 }
 
+static void sbr_save_matrix(sbr_info *sbr, uint8_t ch)
+{
+    uint8_t i;
+
+    for (i = 0; i < sbr->tHFGen; i++)
+    {
+        memmove(sbr->Xsbr[ch][i], sbr->Xsbr[ch][i+sbr->numTimeSlotsRate], 64 * sizeof(qmf_t));
+    }
+    for (i = sbr->tHFGen; i < MAX_NTSRHFG; i++)
+    {
+        memset(sbr->Xsbr[ch][i], 0, 64 * sizeof(qmf_t));
+    }
+}
+
 static void sbr_process_channel(sbr_info *sbr, real_t *channel_buf, qmf_t X[MAX_NTSR][64],
-                                uint8_t ch, uint8_t dont_process)
+                                uint8_t ch, uint8_t dont_process,
+                                const uint8_t downSampledSBR)
 {
-    int16_t i, k, l;
+    int16_t k, l;
 
 #ifdef SBR_LOW_POWER
     ALIGN real_t deg[64];
 #endif
 
-    if (sbr->frame == 0)
+#ifdef DRM
+    if (sbr->Is_DRM_SBR)
     {
-        uint8_t j;
-        sbr->qmfa[ch] = qmfa_init(32);
-        sbr->qmfs[ch] = qmfs_init(64);
+        sbr->bsco = max((int32_t)sbr->maxAACLine*32/(int32_t)sbr->frame_len - (int32_t)sbr->kx, 0);
+    } else {
+#endif
+        sbr->bsco = 0;
+#ifdef DRM
+    }
+#endif
 
-        for (j = 0; j < 5; j++)
+
+//#define PRE_QMF_PRINT
+#ifdef PRE_QMF_PRINT
+    {
+        int i;
+        for (i = 0; i < 1024; i++)
         {
-            sbr->G_temp_prev[ch][j] = faad_malloc(64*sizeof(real_t));
-            sbr->Q_temp_prev[ch][j] = faad_malloc(64*sizeof(real_t));
+            printf("%d\n", channel_buf[i]);
         }
+    }
+#endif
 
-        memset(sbr->Xsbr[ch], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t));
-        memset(sbr->Xcodec[ch], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*32 * sizeof(qmf_t));
-    }
 
     /* subband analysis */
     if (dont_process)
-        sbr_qmf_analysis_32(sbr, sbr->qmfa[ch], channel_buf, sbr->Xcodec[ch], sbr->tHFGen, 32);
+        sbr_qmf_analysis_32(sbr, sbr->qmfa[ch], channel_buf, sbr->Xsbr[ch], sbr->tHFGen, 32);
     else
-        sbr_qmf_analysis_32(sbr, sbr->qmfa[ch], channel_buf, sbr->Xcodec[ch], sbr->tHFGen, sbr->kx);
+        sbr_qmf_analysis_32(sbr, sbr->qmfa[ch], channel_buf, sbr->Xsbr[ch], sbr->tHFGen, sbr->kx);
 
     if (!dont_process)
     {
 #if 1
         /* insert high frequencies here */
         /* hf generation using patching */
-        hf_generation(sbr, sbr->Xcodec[ch], sbr->Xsbr[ch]
+        hf_generation(sbr, sbr->Xsbr[ch], sbr->Xsbr[ch]
 #ifdef SBR_LOW_POWER
             ,deg
 #endif
@@ -223,9 +304,9 @@
         {
             for (k = 0; k < 32; k++)
             {
-                QMF_RE(X[l][k]) = QMF_RE(sbr->Xcodec[ch][l + sbr->tHFAdj][k]);
+                QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
 #ifndef SBR_LOW_POWER
-                QMF_IM(X[l][k]) = QMF_IM(sbr->Xcodec[ch][l + sbr->tHFAdj][k]);
+                QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
 #endif
             }
             for (k = 32; k < 64; k++)
@@ -239,42 +320,57 @@
     } else {
         for (l = 0; l < sbr->numTimeSlotsRate; l++)
         {
-            uint8_t xover_band;
+            uint8_t kx_band, M_band, bsco_band;
 
             if (l < sbr->t_E[ch][0])
-                xover_band = sbr->kx_prev;
-            else
-                xover_band = sbr->kx;
-
-            for (k = 0; k < xover_band; k++)
             {
-                QMF_RE(X[l][k]) = QMF_RE(sbr->Xcodec[ch][l + sbr->tHFAdj][k]);
+                kx_band = sbr->kx_prev;
+                M_band = sbr->M_prev;
+                bsco_band = sbr->bsco_prev;
+            } else {
+                kx_band = sbr->kx;
+                M_band = sbr->M;
+                bsco_band = sbr->bsco;
+            }
+
 #ifndef SBR_LOW_POWER
-                QMF_IM(X[l][k]) = QMF_IM(sbr->Xcodec[ch][l + sbr->tHFAdj][k]);
-#endif
+            for (k = 0; k < kx_band + bsco_band; k++)
+            {
+                QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
+                QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
             }
-            for (k = xover_band; k < 64; k++)
+            for (k = kx_band + bsco_band; k < kx_band + M_band; k++)
             {
                 QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
-#ifndef SBR_LOW_POWER
                 QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
-#endif
+            }
+            for (k = max(kx_band + bsco_band, kx_band + M_band); k < 64; k++)
+            {
+                QMF_RE(X[l][k]) = 0;
+                QMF_IM(X[l][k]) = 0;
+            }
+#else
+            for (k = 0; k < kx_band + bsco_band; k++)
+            {
+                QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
             }
-#ifdef SBR_LOW_POWER
-            QMF_RE(X[l][xover_band - 1]) += QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][xover_band - 1]);
+            for (k = kx_band + bsco_band; k < min(kx_band + M_band, 63); k++)
+            {
+                QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
+            }
+            for (k = max(kx_band + bsco_band, kx_band + M_band); k < 64; k++)
+            {
+                QMF_RE(X[l][k]) = 0;
+            }
+            QMF_RE(X[l][kx_band - 1 + bsco_band]) +=
+                QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][kx_band - 1 + bsco_band]);
 #endif
         }
     }
-
-    for (i = 0; i < sbr->tHFGen; i++)
-    {
-        memmove(sbr->Xcodec[ch][i], sbr->Xcodec[ch][i+sbr->numTimeSlotsRate], 32 * sizeof(qmf_t));
-        memmove(sbr->Xsbr[ch][i], sbr->Xsbr[ch][i+sbr->numTimeSlotsRate], 64 * sizeof(qmf_t));
-    }
 }
 
 uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan,
-                             const uint8_t just_seeked, const uint8_t upsample_only)
+                             const uint8_t just_seeked, const uint8_t downSampledSBR)
 {
     uint8_t dont_process = 0;
     uint8_t ret = 0;
@@ -304,21 +400,23 @@
         sbr->just_seeked = 0;
     }
 
-    sbr_process_channel(sbr, left_chan, X, 0, dont_process);
+    sbr_process_channel(sbr, left_chan, X, 0, dont_process, downSampledSBR);
     /* subband synthesis */
-#ifndef USE_SSE
-    sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, left_chan);
-#else
-    sbr->qmfs[ch]->qmf_func(sbr, sbr->qmfs[0], X, left_chan);
-#endif
+    if (downSampledSBR)
+    {
+        sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X, left_chan);
+    } else {
+        sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, left_chan);
+    }
 
-    sbr_process_channel(sbr, right_chan, X, 1, dont_process);
+    sbr_process_channel(sbr, right_chan, X, 1, dont_process, downSampledSBR);
     /* subband synthesis */
-#ifndef USE_SSE
-    sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X, right_chan);
-#else
-    sbr->qmfs[ch]->qmf_func(sbr, sbr->qmfs[1], X, right_chan);
-#endif
+    if (downSampledSBR)
+    {
+        sbr_qmf_synthesis_32(sbr, sbr->qmfs[1], X, right_chan);
+    } else {
+        sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X, right_chan);
+    }
 
     if (sbr->bs_header_flag)
         sbr->just_seeked = 0;
@@ -331,13 +429,31 @@
         if (ret) return ret;
     }
 
+    sbr_save_matrix(sbr, 0);
+    sbr_save_matrix(sbr, 1);
+
     sbr->frame++;
 
+//#define POST_QMF_PRINT
+#ifdef POST_QMF_PRINT
+    {
+        int i;
+        for (i = 0; i < 2048; i++)
+        {
+            printf("%d\n", left_chan[i]);
+        }
+        for (i = 0; i < 2048; i++)
+        {
+            printf("%d\n", right_chan[i]);
+        }
+    }
+#endif
+
     return 0;
 }
 
 uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel,
-                             const uint8_t just_seeked, const uint8_t upsample_only)
+                             const uint8_t just_seeked, const uint8_t downSampledSBR)
 {
     uint8_t dont_process = 0;
     uint8_t ret = 0;
@@ -367,13 +483,14 @@
         sbr->just_seeked = 0;
     }
 
-    sbr_process_channel(sbr, channel, X, 0, dont_process);
+    sbr_process_channel(sbr, channel, X, 0, dont_process, downSampledSBR);
     /* subband synthesis */
-#ifndef USE_SSE
-    sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, channel);
-#else
-    sbr->qmfs[ch]->qmf_func(sbr, sbr->qmfs[0], X, channel);
-#endif
+    if (downSampledSBR)
+    {
+        sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X, channel);
+    } else {
+        sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, channel);
+    }
 
     if (sbr->bs_header_flag)
         sbr->just_seeked = 0;
@@ -384,20 +501,33 @@
         if (ret) return ret;
     }
 
+    sbr_save_matrix(sbr, 0);
+
     sbr->frame++;
 
+//#define POST_QMF_PRINT
+#ifdef POST_QMF_PRINT
+    {
+        int i;
+        for (i = 0; i < 2048; i++)
+        {
+            printf("%d\n", channel[i]);
+        }
+    }
+#endif
+
     return 0;
 }
 
 #if (defined(PS_DEC) || defined(DRM_PS))
 uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel,
-                               const uint8_t just_seeked, const uint8_t upsample_only)
+                               const uint8_t just_seeked, const uint8_t downSampledSBR)
 {
+    uint8_t l, k;
     uint8_t dont_process = 0;
     uint8_t ret = 0;
-    ALIGN qmf_t X_mono[MAX_NTSR][64];
-    ALIGN qmf_t X_left[MAX_NTSR][64];
-    ALIGN qmf_t X_right[MAX_NTSR][64];
+    ALIGN qmf_t X_left[38][64] = {{{0}}};
+    ALIGN qmf_t X_right[38][64] = {{{0}}}; /* must set this to 0 */
 
     if (sbr == NULL)
         return 20;
@@ -423,24 +553,46 @@
         sbr->just_seeked = 0;
     }
 
-    if (sbr->frame == 0)
+    if (sbr->qmfs[1] == NULL)
     {
-        sbr->qmfs[1] = qmfs_init(64);
+        sbr->qmfs[1] = qmfs_init((downSampledSBR)?32:64);
     }
 
-    sbr_process_channel(sbr, left_channel, X_mono, 0, dont_process);
+    sbr_process_channel(sbr, left_channel, X_left, 0, dont_process, downSampledSBR);
+
+    /* copy some extra data for PS */
+    for (l = 32; l < 38; l++)
+    {
+        for (k = 0; k < 5; k++)
+        {
+            QMF_RE(X_left[l][k]) = QMF_RE(sbr->Xsbr[0][sbr->tHFAdj+l][k]);
+            QMF_IM(X_left[l][k]) = QMF_IM(sbr->Xsbr[0][sbr->tHFAdj+l][k]);
+        }
+    }
 
     /* perform parametric stereo */
-    ps_dummy_function(X_mono, X_left, X_right);
+#ifdef DRM_PS
+    if (sbr->Is_DRM_SBR)
+    {
+        drm_ps_decode(sbr->drm_ps, (sbr->ret > 0), sbr->sample_rate, X_left, X_right);
+    } else {
+#endif
+#ifdef PS_DEC
+        ps_decode(sbr->ps, X_left, X_right);
+#endif
+#ifdef DRM_PS
+    }
+#endif
 
     /* subband synthesis */
-#ifndef USE_SSE
-    sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X_left, left_channel);
-    sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X_right, right_channel);
-#else
-    sbr->qmfs[ch]->qmf_func(sbr, sbr->qmfs[0], X_left, left_channel);
-    sbr->qmfs[ch]->qmf_func(sbr, sbr->qmfs[1], X_right, right_channel);
-#endif
+    if (downSampledSBR)
+    {
+        sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X_left, left_channel);
+        sbr_qmf_synthesis_32(sbr, sbr->qmfs[1], X_right, right_channel);
+    } else {
+        sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X_left, left_channel);
+        sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X_right, right_channel);
+    }
 
     if (sbr->bs_header_flag)
         sbr->just_seeked = 0;
@@ -451,6 +603,8 @@
         if (ret) return ret;
     }
 
+    sbr_save_matrix(sbr, 0);
+
     sbr->frame++;
 
     return 0;
--- a/Plugins/Input/aac/libfaad2/sbr_dec.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sbr_dec.h	Wed May 10 14:44:20 2006 -0700
@@ -1,19 +1,19 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
 ** 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
 ** the Free Software Foundation; either version 2 of the License, or
 ** (at your option) any later version.
-** 
+**
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ** GNU General Public License for more details.
-** 
+**
 ** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software 
+** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
 ** Any non-GPL usage of this software or parts of this software is strictly
@@ -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.23 2004/02/04 20:07:24 menno Exp $
+** $Id: sbr_dec.h,v 1.35 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_DEC_H__
@@ -43,24 +43,27 @@
 #define MAX_NTSRHFG 40
 #define MAX_NTSR    32 /* max number_time_slots * rate, ok for DRM and not DRM mode */
 
+/* MAX_M: maximum value for M */
+#define MAX_M       49
+/* MAX_L_E: maximum value for L_E */
+#define MAX_L_E      5
 
 typedef struct {
     real_t *x;
+    int16_t x_index;
     uint8_t channels;
 } qmfa_info;
 
 typedef struct {
-    real_t *v[2];
-    uint8_t v_index;
+    real_t *v;
+    int16_t v_index;
     uint8_t channels;
-#ifdef USE_SSE
-    void (*qmf_func)(void *a, void *b, void *c, void *d);
-#endif
 } qmfs_info;
 
 typedef struct
 {
     uint32_t sample_rate;
+    uint32_t maxAACLine;
 
     uint8_t rate;
     uint8_t just_seeked;
@@ -98,27 +101,33 @@
     uint8_t L_E_prev[2];
     uint8_t L_Q[2];
 
-    uint8_t t_E[2][6];
+    uint8_t t_E[2][MAX_L_E+1];
     uint8_t t_Q[2][3];
-    uint8_t f[2][6];
+    uint8_t f[2][MAX_L_E+1];
     uint8_t f_prev[2];
 
     real_t *G_temp_prev[2][5];
     real_t *Q_temp_prev[2][5];
+    int8_t GQ_ringbuf_index[2];
 
-    int16_t E[2][64][5];
+    int16_t E[2][64][MAX_L_E];
     int16_t E_prev[2][64];
-    real_t E_orig[2][64][5];
-    real_t E_curr[2][64][5];
+#ifndef FIXED_POINT
+    real_t E_orig[2][64][MAX_L_E];
+#endif
+    real_t E_curr[2][64][MAX_L_E];
     int32_t Q[2][64][2];
+#ifndef FIXED_POINT
+    real_t Q_div[2][64][2];
+    real_t Q_div2[2][64][2];
+#endif
     int32_t Q_prev[2][64];
-    real_t Q_orig[2][64][2];
 
     int8_t l_A[2];
     int8_t l_A_prev[2];
 
-    uint8_t bs_invf_mode[2][5];
-    uint8_t bs_invf_mode_prev[2][5];
+    uint8_t bs_invf_mode[2][MAX_L_E];
+    uint8_t bs_invf_mode_prev[2][MAX_L_E];
     real_t bwArray[2][64];
     real_t bwArray_prev[2][64];
 
@@ -142,6 +151,10 @@
     int8_t prevEnvIsShort[2];
 
     int8_t kx_prev;
+    uint8_t bsco;
+    uint8_t bsco_prev;
+    uint8_t M_prev;
+    uint16_t frame_len;
 
     uint8_t Reset;
     uint32_t frame;
@@ -152,24 +165,21 @@
     qmfs_info *qmfs[2];
 
     qmf_t Xsbr[2][MAX_NTSRHFG][64];
-    qmf_t Xcodec[2][MAX_NTSRHFG][32];
 
 #ifdef DRM
-	int8_t lcstereo_flag;
-	uint8_t bs_dataextra;
     uint8_t Is_DRM_SBR;
 #ifdef DRM_PS
-    drm_ps_info drm_ps;
+    drm_ps_info *drm_ps;
 #endif
 #endif
 
-	uint8_t numTimeSlotsRate;
-	uint8_t numTimeSlots;
-	uint8_t tHFGen;
-	uint8_t tHFAdj;
+    uint8_t numTimeSlotsRate;
+    uint8_t numTimeSlots;
+    uint8_t tHFGen;
+    uint8_t tHFAdj;
 
 #ifdef PS_DEC
-    ps_info ps;
+    ps_info *ps;
 #endif
 #if (defined(PS_DEC) || defined(DRM_PS))
     uint8_t ps_used;
@@ -215,20 +225,20 @@
 } sbr_info;
 
 sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac,
-                        uint32_t sample_rate
+                        uint32_t sample_rate, uint8_t downSampledSBR
 #ifdef DRM
-						, uint8_t IsDRM
+                        , uint8_t IsDRM
 #endif
-						);
+                        );
 void sbrDecodeEnd(sbr_info *sbr);
 
 uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan,
-                             const uint8_t just_seeked, const uint8_t upsample_only);
+                             const uint8_t just_seeked, const uint8_t downSampledSBR);
 uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel,
-                             const uint8_t just_seeked, const uint8_t upsample_only);
+                             const uint8_t just_seeked, const uint8_t downSampledSBR);
 #if (defined(PS_DEC) || defined(DRM_PS))
 uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel,
-                               const uint8_t just_seeked, const uint8_t upsample_only);
+                               const uint8_t just_seeked, const uint8_t downSampledSBR);
 #endif
 
 
--- a/Plugins/Input/aac/libfaad2/sbr_e_nf.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sbr_e_nf.c	Wed May 10 14:44:20 2006 -0700
@@ -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.11 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_e_nf.c,v 1.17 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -35,110 +35,6 @@
 #include "sbr_syntax.h"
 #include "sbr_e_nf.h"
 
-ALIGN static const real_t pow2deq[] = {
-    REAL_CONST(2.9103830456733704E-011), REAL_CONST(5.8207660913467407E-011),
-    REAL_CONST(1.1641532182693481E-010), REAL_CONST(2.3283064365386963E-010),
-    REAL_CONST(4.6566128730773926E-010), REAL_CONST(9.3132257461547852E-010),
-    REAL_CONST(1.862645149230957E-009), REAL_CONST(3.7252902984619141E-009),
-    REAL_CONST(7.4505805969238281E-009), REAL_CONST(1.4901161193847656E-008),
-    REAL_CONST(2.9802322387695313E-008), REAL_CONST(5.9604644775390625E-008),
-    REAL_CONST(1.1920928955078125E-007), REAL_CONST(2.384185791015625E-007),
-    REAL_CONST(4.76837158203125E-007), REAL_CONST(9.5367431640625E-007),
-    REAL_CONST(1.9073486328125E-006), REAL_CONST(3.814697265625E-006),
-    REAL_CONST(7.62939453125E-006), REAL_CONST(1.52587890625E-005),
-    REAL_CONST(3.0517578125E-005), REAL_CONST(6.103515625E-005),
-    REAL_CONST(0.0001220703125), REAL_CONST(0.000244140625),
-    REAL_CONST(0.00048828125), REAL_CONST(0.0009765625),
-    REAL_CONST(0.001953125), REAL_CONST(0.00390625),
-    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.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),
-    REAL_CONST(2.3611832414348226E+021), REAL_CONST(4.7223664828696452E+021),
-    REAL_CONST(9.4447329657392904E+021), REAL_CONST(1.8889465931478581E+022),
-    REAL_CONST(3.7778931862957162E+022), REAL_CONST(7.5557863725914323E+022),
-    REAL_CONST(1.5111572745182865E+023), REAL_CONST(3.0223145490365729E+023),
-    REAL_CONST(6.0446290980731459E+023), REAL_CONST(1.2089258196146292E+024),
-    REAL_CONST(2.4178516392292583E+024), REAL_CONST(4.8357032784585167E+024),
-    REAL_CONST(9.6714065569170334E+024), REAL_CONST(1.9342813113834067E+025),
-    REAL_CONST(3.8685626227668134E+025), REAL_CONST(7.7371252455336267E+025),
-    REAL_CONST(1.5474250491067253E+026), REAL_CONST(3.0948500982134507E+026),
-    REAL_CONST(6.1897001964269014E+026), REAL_CONST(1.2379400392853803E+027),
-    REAL_CONST(2.4758800785707605E+027)
-};
-
-/* 1.0 / (1.0 + pow(2.0, x - 12) */
-ALIGN static const real_t pow2deq_rcp[] = {
-    FRAC_CONST(0.99975591896509641),
-    FRAC_CONST(0.99951195705222062),
-    FRAC_CONST(0.99902439024390244),
-    FRAC_CONST(0.99805068226120852),
-    FRAC_CONST(0.99610894941634243),
-    FRAC_CONST(0.99224806201550386),
-    FRAC_CONST(0.98461538461538467),
-    FRAC_CONST(0.96969696969696972),
-    FRAC_CONST(0.94117647058823528),
-    FRAC_CONST(0.88888888888888884),
-    FRAC_CONST(0.80000000000000004),
-    FRAC_CONST(0.66666666666666663),
-    FRAC_CONST(0.5),
-    FRAC_CONST(0.33333333333333331),
-    FRAC_CONST(0.20000000000000001),
-    FRAC_CONST(0.1111111111111111),
-    FRAC_CONST(0.058823529411764705),
-    FRAC_CONST(0.030303030303030304),
-    FRAC_CONST(0.015384615384615385),
-    FRAC_CONST(0.0077519379844961239),
-    FRAC_CONST(0.0038910505836575876),
-    FRAC_CONST(0.0019493177387914229),
-    FRAC_CONST(0.00097560975609756097),
-    FRAC_CONST(0.0004880429477794046),
-    FRAC_CONST(0.00024408103490358799),
-    FRAC_CONST(0.00012205541315757354),
-    FRAC_CONST(6.1031431187061336E-005),
-    FRAC_CONST(3.0516646830846227E-005),
-    FRAC_CONST(1.5258556235409006E-005),
-    FRAC_CONST(7.6293363240331724E-006),
-    FRAC_CONST(3.8146827137652828E-006),
-    FRAC_CONST(1.9073449948406318E-006),
-    FRAC_CONST(9.5367340691241559E-007)
-};
-
 void extract_envelope_data(sbr_info *sbr, uint8_t ch)
 {
     uint8_t l, k;
@@ -150,6 +46,8 @@
             for (k = 1; k < sbr->n[sbr->f[ch][l]]; k++)
             {
                 sbr->E[ch][k][l] = sbr->E[ch][k - 1][l] + sbr->E[ch][k][l];
+                if (sbr->E[ch][k][l] < 0)
+                    sbr->E[ch][k][l] = 0;
             }
 
         } else { /* bs_df_env == 1 */
@@ -241,6 +139,256 @@
     }
 }
 
+#ifndef FIXED_POINT
+
+/* table for Q_div values when no coupling */
+static const real_t Q_div_tab[31] = {
+    FRAC_CONST(0.0153846), FRAC_CONST(0.030303),
+    FRAC_CONST(0.0588235), FRAC_CONST(0.111111),
+    FRAC_CONST(0.2),       FRAC_CONST(0.333333),
+    FRAC_CONST(0.5),       FRAC_CONST(0.666667),
+    FRAC_CONST(0.8),       FRAC_CONST(0.888889),
+    FRAC_CONST(0.941176),  FRAC_CONST(0.969697),
+    FRAC_CONST(0.984615),  FRAC_CONST(0.992248),
+    FRAC_CONST(0.996109),  FRAC_CONST(0.998051),
+    FRAC_CONST(0.999024),  FRAC_CONST(0.999512),
+    FRAC_CONST(0.999756),  FRAC_CONST(0.999878),
+    FRAC_CONST(0.999939),  FRAC_CONST(0.999969),
+    FRAC_CONST(0.999985),  FRAC_CONST(0.999992),
+    FRAC_CONST(0.999996),  FRAC_CONST(0.999998),
+    FRAC_CONST(0.999999),  FRAC_CONST(1),
+    FRAC_CONST(1),         FRAC_CONST(1),
+    FRAC_CONST(1)
+};
+
+static const real_t Q_div_tab_left[31][13] = {
+    { FRAC_CONST(0.969704), FRAC_CONST(0.888985), FRAC_CONST(0.667532), FRAC_CONST(0.336788), FRAC_CONST(0.117241), FRAC_CONST(0.037594), FRAC_CONST(0.0153846), FRAC_CONST(0.00967118), FRAC_CONST(0.00823245), FRAC_CONST(0.00787211), FRAC_CONST(0.00778198), FRAC_CONST(0.00775945), FRAC_CONST(0.00775382) },
+    { FRAC_CONST(0.984619), FRAC_CONST(0.94123), FRAC_CONST(0.800623), FRAC_CONST(0.503876), FRAC_CONST(0.209877), FRAC_CONST(0.0724638), FRAC_CONST(0.030303), FRAC_CONST(0.0191571), FRAC_CONST(0.0163305), FRAC_CONST(0.0156212), FRAC_CONST(0.0154438), FRAC_CONST(0.0153994), FRAC_CONST(0.0153883) },
+    { FRAC_CONST(0.99225), FRAC_CONST(0.969726), FRAC_CONST(0.889273), FRAC_CONST(0.670103), FRAC_CONST(0.346939), FRAC_CONST(0.135135), FRAC_CONST(0.0588235), FRAC_CONST(0.037594), FRAC_CONST(0.0321361), FRAC_CONST(0.0307619), FRAC_CONST(0.0304178), FRAC_CONST(0.0303317), FRAC_CONST(0.0303102) },
+    { FRAC_CONST(0.99611), FRAC_CONST(0.98463), FRAC_CONST(0.941392), FRAC_CONST(0.802469), FRAC_CONST(0.515152), FRAC_CONST(0.238095), FRAC_CONST(0.111111), FRAC_CONST(0.0724638), FRAC_CONST(0.0622711), FRAC_CONST(0.0596878), FRAC_CONST(0.0590397), FRAC_CONST(0.0588776), FRAC_CONST(0.058837) },
+    { FRAC_CONST(0.998051), FRAC_CONST(0.992256), FRAC_CONST(0.969811), FRAC_CONST(0.890411), FRAC_CONST(0.68), FRAC_CONST(0.384615), FRAC_CONST(0.2), FRAC_CONST(0.135135), FRAC_CONST(0.117241), FRAC_CONST(0.112652), FRAC_CONST(0.111497), FRAC_CONST(0.111208), FRAC_CONST(0.111135) },
+    { FRAC_CONST(0.999025), FRAC_CONST(0.996113), FRAC_CONST(0.984674), FRAC_CONST(0.942029), FRAC_CONST(0.809524), FRAC_CONST(0.555556), FRAC_CONST(0.333333), FRAC_CONST(0.238095), FRAC_CONST(0.209877), FRAC_CONST(0.202492), FRAC_CONST(0.200625), FRAC_CONST(0.200156), FRAC_CONST(0.200039) },
+    { FRAC_CONST(0.999512), FRAC_CONST(0.998053), FRAC_CONST(0.992278), FRAC_CONST(0.970149), FRAC_CONST(0.894737), FRAC_CONST(0.714286), FRAC_CONST(0.5), FRAC_CONST(0.384615), FRAC_CONST(0.346939), FRAC_CONST(0.336788), FRAC_CONST(0.3342), FRAC_CONST(0.33355), FRAC_CONST(0.333388) },
+    { FRAC_CONST(0.999756), FRAC_CONST(0.999025), FRAC_CONST(0.996124), FRAC_CONST(0.984848), FRAC_CONST(0.944444), FRAC_CONST(0.833333), FRAC_CONST(0.666667), FRAC_CONST(0.555556), FRAC_CONST(0.515152), FRAC_CONST(0.503876), FRAC_CONST(0.500975), FRAC_CONST(0.500244), FRAC_CONST(0.500061) },
+    { FRAC_CONST(0.999878), FRAC_CONST(0.999512), FRAC_CONST(0.998058), FRAC_CONST(0.992366), FRAC_CONST(0.971429), FRAC_CONST(0.909091), FRAC_CONST(0.8), FRAC_CONST(0.714286), FRAC_CONST(0.68), FRAC_CONST(0.670103), FRAC_CONST(0.667532), FRAC_CONST(0.666884), FRAC_CONST(0.666721) },
+    { FRAC_CONST(0.999939), FRAC_CONST(0.999756), FRAC_CONST(0.999028), FRAC_CONST(0.996169), FRAC_CONST(0.985507), FRAC_CONST(0.952381), FRAC_CONST(0.888889), FRAC_CONST(0.833333), FRAC_CONST(0.809524), FRAC_CONST(0.802469), FRAC_CONST(0.800623), FRAC_CONST(0.800156), FRAC_CONST(0.800039) },
+    { FRAC_CONST(0.999969), FRAC_CONST(0.999878), FRAC_CONST(0.999514), FRAC_CONST(0.998081), FRAC_CONST(0.992701), FRAC_CONST(0.97561), FRAC_CONST(0.941176), FRAC_CONST(0.909091), FRAC_CONST(0.894737), FRAC_CONST(0.890411), FRAC_CONST(0.889273), FRAC_CONST(0.888985), FRAC_CONST(0.888913) },
+    { FRAC_CONST(0.999985), FRAC_CONST(0.999939), FRAC_CONST(0.999757), FRAC_CONST(0.999039), FRAC_CONST(0.996337), FRAC_CONST(0.987654), FRAC_CONST(0.969697), FRAC_CONST(0.952381), FRAC_CONST(0.944444), FRAC_CONST(0.942029), FRAC_CONST(0.941392), FRAC_CONST(0.94123), FRAC_CONST(0.94119) },
+    { FRAC_CONST(0.999992), FRAC_CONST(0.99997), FRAC_CONST(0.999878), FRAC_CONST(0.999519), FRAC_CONST(0.998165), FRAC_CONST(0.993789), FRAC_CONST(0.984615), FRAC_CONST(0.97561), FRAC_CONST(0.971429), FRAC_CONST(0.970149), FRAC_CONST(0.969811), FRAC_CONST(0.969726), FRAC_CONST(0.969704) },
+    { FRAC_CONST(0.999996), FRAC_CONST(0.999985), FRAC_CONST(0.999939), FRAC_CONST(0.99976), FRAC_CONST(0.999082), FRAC_CONST(0.996885), FRAC_CONST(0.992248), FRAC_CONST(0.987654), FRAC_CONST(0.985507), FRAC_CONST(0.984848), FRAC_CONST(0.984674), FRAC_CONST(0.98463), FRAC_CONST(0.984619) },
+    { FRAC_CONST(0.999998), FRAC_CONST(0.999992), FRAC_CONST(0.99997), FRAC_CONST(0.99988), FRAC_CONST(0.999541), FRAC_CONST(0.99844), FRAC_CONST(0.996109), FRAC_CONST(0.993789), FRAC_CONST(0.992701), FRAC_CONST(0.992366), FRAC_CONST(0.992278), FRAC_CONST(0.992256), FRAC_CONST(0.99225) },
+    { FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999985), FRAC_CONST(0.99994), FRAC_CONST(0.99977), FRAC_CONST(0.999219), FRAC_CONST(0.998051), FRAC_CONST(0.996885), FRAC_CONST(0.996337), FRAC_CONST(0.996169), FRAC_CONST(0.996124), FRAC_CONST(0.996113), FRAC_CONST(0.99611) },
+    { FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999992), FRAC_CONST(0.99997), FRAC_CONST(0.999885), FRAC_CONST(0.99961), FRAC_CONST(0.999024), FRAC_CONST(0.99844), FRAC_CONST(0.998165), FRAC_CONST(0.998081), FRAC_CONST(0.998058), FRAC_CONST(0.998053), FRAC_CONST(0.998051) },
+    { FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999985), FRAC_CONST(0.999943), FRAC_CONST(0.999805), FRAC_CONST(0.999512), FRAC_CONST(0.999219), FRAC_CONST(0.999082), FRAC_CONST(0.999039), FRAC_CONST(0.999028), FRAC_CONST(0.999025), FRAC_CONST(0.999025) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999992), FRAC_CONST(0.999971), FRAC_CONST(0.999902), FRAC_CONST(0.999756), FRAC_CONST(0.99961), FRAC_CONST(0.999541), FRAC_CONST(0.999519), FRAC_CONST(0.999514), FRAC_CONST(0.999512), FRAC_CONST(0.999512) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999986), FRAC_CONST(0.999951), FRAC_CONST(0.999878), FRAC_CONST(0.999805), FRAC_CONST(0.99977), FRAC_CONST(0.99976), FRAC_CONST(0.999757), FRAC_CONST(0.999756), FRAC_CONST(0.999756) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999993), FRAC_CONST(0.999976), FRAC_CONST(0.999939), FRAC_CONST(0.999902), FRAC_CONST(0.999885), FRAC_CONST(0.99988), FRAC_CONST(0.999878), FRAC_CONST(0.999878), FRAC_CONST(0.999878) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999988), FRAC_CONST(0.999969), FRAC_CONST(0.999951), FRAC_CONST(0.999943), FRAC_CONST(0.99994), FRAC_CONST(0.999939), FRAC_CONST(0.999939), FRAC_CONST(0.999939) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999994), FRAC_CONST(0.999985), FRAC_CONST(0.999976), FRAC_CONST(0.999971), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.999969) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999997), FRAC_CONST(0.999992), FRAC_CONST(0.999988), FRAC_CONST(0.999986), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999996), FRAC_CONST(0.999994), FRAC_CONST(0.999993), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999998), FRAC_CONST(0.999997), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }
+};
+
+static const real_t Q_div_tab_right[31][13] = {
+    { FRAC_CONST(0.00775382), FRAC_CONST(0.00775945), FRAC_CONST(0.00778198), FRAC_CONST(0.00787211), FRAC_CONST(0.00823245), FRAC_CONST(0.00967118), FRAC_CONST(0.0153846), FRAC_CONST(0.037594), FRAC_CONST(0.117241), FRAC_CONST(0.336788), FRAC_CONST(0.667532), FRAC_CONST(0.888985), FRAC_CONST(0.969704) },
+    { FRAC_CONST(0.0153883), FRAC_CONST(0.0153994), FRAC_CONST(0.0154438), FRAC_CONST(0.0156212), FRAC_CONST(0.0163305), FRAC_CONST(0.0191571), FRAC_CONST(0.030303), FRAC_CONST(0.0724638), FRAC_CONST(0.209877), FRAC_CONST(0.503876), FRAC_CONST(0.800623), FRAC_CONST(0.94123), FRAC_CONST(0.984619) },
+    { FRAC_CONST(0.0303102), FRAC_CONST(0.0303317), FRAC_CONST(0.0304178), FRAC_CONST(0.0307619), FRAC_CONST(0.0321361), FRAC_CONST(0.037594), FRAC_CONST(0.0588235), FRAC_CONST(0.135135), FRAC_CONST(0.346939), FRAC_CONST(0.670103), FRAC_CONST(0.889273), FRAC_CONST(0.969726), FRAC_CONST(0.99225) },
+    { FRAC_CONST(0.058837), FRAC_CONST(0.0588776), FRAC_CONST(0.0590397), FRAC_CONST(0.0596878), FRAC_CONST(0.0622711), FRAC_CONST(0.0724638), FRAC_CONST(0.111111), FRAC_CONST(0.238095), FRAC_CONST(0.515152), FRAC_CONST(0.802469), FRAC_CONST(0.941392), FRAC_CONST(0.98463), FRAC_CONST(0.99611) },
+    { FRAC_CONST(0.111135), FRAC_CONST(0.111208), FRAC_CONST(0.111497), FRAC_CONST(0.112652), FRAC_CONST(0.117241), FRAC_CONST(0.135135), FRAC_CONST(0.2), FRAC_CONST(0.384615), FRAC_CONST(0.68), FRAC_CONST(0.890411), FRAC_CONST(0.969811), FRAC_CONST(0.992256), FRAC_CONST(0.998051) },
+    { FRAC_CONST(0.200039), FRAC_CONST(0.200156), FRAC_CONST(0.200625), FRAC_CONST(0.202492), FRAC_CONST(0.209877), FRAC_CONST(0.238095), FRAC_CONST(0.333333), FRAC_CONST(0.555556), FRAC_CONST(0.809524), FRAC_CONST(0.942029), FRAC_CONST(0.984674), FRAC_CONST(0.996113), FRAC_CONST(0.999025) },
+    { FRAC_CONST(0.333388), FRAC_CONST(0.33355), FRAC_CONST(0.3342), FRAC_CONST(0.336788), FRAC_CONST(0.346939), FRAC_CONST(0.384615), FRAC_CONST(0.5), FRAC_CONST(0.714286), FRAC_CONST(0.894737), FRAC_CONST(0.970149), FRAC_CONST(0.992278), FRAC_CONST(0.998053), FRAC_CONST(0.999512) },
+    { FRAC_CONST(0.500061), FRAC_CONST(0.500244), FRAC_CONST(0.500975), FRAC_CONST(0.503876), FRAC_CONST(0.515152), FRAC_CONST(0.555556), FRAC_CONST(0.666667), FRAC_CONST(0.833333), FRAC_CONST(0.944444), FRAC_CONST(0.984848), FRAC_CONST(0.996124), FRAC_CONST(0.999025), FRAC_CONST(0.999756) },
+    { FRAC_CONST(0.666721), FRAC_CONST(0.666884), FRAC_CONST(0.667532), FRAC_CONST(0.670103), FRAC_CONST(0.68), FRAC_CONST(0.714286), FRAC_CONST(0.8), FRAC_CONST(0.909091), FRAC_CONST(0.971429), FRAC_CONST(0.992366), FRAC_CONST(0.998058), FRAC_CONST(0.999512), FRAC_CONST(0.999878) },
+    { FRAC_CONST(0.800039), FRAC_CONST(0.800156), FRAC_CONST(0.800623), FRAC_CONST(0.802469), FRAC_CONST(0.809524), FRAC_CONST(0.833333), FRAC_CONST(0.888889), FRAC_CONST(0.952381), FRAC_CONST(0.985507), FRAC_CONST(0.996169), FRAC_CONST(0.999028), FRAC_CONST(0.999756), FRAC_CONST(0.999939) },
+    { FRAC_CONST(0.888913), FRAC_CONST(0.888985), FRAC_CONST(0.889273), FRAC_CONST(0.890411), FRAC_CONST(0.894737), FRAC_CONST(0.909091), FRAC_CONST(0.941176), FRAC_CONST(0.97561), FRAC_CONST(0.992701), FRAC_CONST(0.998081), FRAC_CONST(0.999514), FRAC_CONST(0.999878), FRAC_CONST(0.999969) },
+    { FRAC_CONST(0.94119), FRAC_CONST(0.94123), FRAC_CONST(0.941392), FRAC_CONST(0.942029), FRAC_CONST(0.944444), FRAC_CONST(0.952381), FRAC_CONST(0.969697), FRAC_CONST(0.987654), FRAC_CONST(0.996337), FRAC_CONST(0.999039), FRAC_CONST(0.999757), FRAC_CONST(0.999939), FRAC_CONST(0.999985) },
+    { FRAC_CONST(0.969704), FRAC_CONST(0.969726), FRAC_CONST(0.969811), FRAC_CONST(0.970149), FRAC_CONST(0.971429), FRAC_CONST(0.97561), FRAC_CONST(0.984615), FRAC_CONST(0.993789), FRAC_CONST(0.998165), FRAC_CONST(0.999519), FRAC_CONST(0.999878), FRAC_CONST(0.99997), FRAC_CONST(0.999992) },
+    { FRAC_CONST(0.984619), FRAC_CONST(0.98463), FRAC_CONST(0.984674), FRAC_CONST(0.984848), FRAC_CONST(0.985507), FRAC_CONST(0.987654), FRAC_CONST(0.992248), FRAC_CONST(0.996885), FRAC_CONST(0.999082), FRAC_CONST(0.99976), FRAC_CONST(0.999939), FRAC_CONST(0.999985), FRAC_CONST(0.999996) },
+    { FRAC_CONST(0.99225), FRAC_CONST(0.992256), FRAC_CONST(0.992278), FRAC_CONST(0.992366), FRAC_CONST(0.992701), FRAC_CONST(0.993789), FRAC_CONST(0.996109), FRAC_CONST(0.99844), FRAC_CONST(0.999541), FRAC_CONST(0.99988), FRAC_CONST(0.99997), FRAC_CONST(0.999992), FRAC_CONST(0.999998) },
+    { FRAC_CONST(0.99611), FRAC_CONST(0.996113), FRAC_CONST(0.996124), FRAC_CONST(0.996169), FRAC_CONST(0.996337), FRAC_CONST(0.996885), FRAC_CONST(0.998051), FRAC_CONST(0.999219), FRAC_CONST(0.99977), FRAC_CONST(0.99994), FRAC_CONST(0.999985), FRAC_CONST(0.999996), FRAC_CONST(0.999999) },
+    { FRAC_CONST(0.998051), FRAC_CONST(0.998053), FRAC_CONST(0.998058), FRAC_CONST(0.998081), FRAC_CONST(0.998165), FRAC_CONST(0.99844), FRAC_CONST(0.999024), FRAC_CONST(0.99961), FRAC_CONST(0.999885), FRAC_CONST(0.99997), FRAC_CONST(0.999992), FRAC_CONST(0.999998), FRAC_CONST(1) },
+    { FRAC_CONST(0.999025), FRAC_CONST(0.999025), FRAC_CONST(0.999028), FRAC_CONST(0.999039), FRAC_CONST(0.999082), FRAC_CONST(0.999219), FRAC_CONST(0.999512), FRAC_CONST(0.999805), FRAC_CONST(0.999943), FRAC_CONST(0.999985), FRAC_CONST(0.999996), FRAC_CONST(0.999999), FRAC_CONST(1) },
+    { FRAC_CONST(0.999512), FRAC_CONST(0.999512), FRAC_CONST(0.999514), FRAC_CONST(0.999519), FRAC_CONST(0.999541), FRAC_CONST(0.99961), FRAC_CONST(0.999756), FRAC_CONST(0.999902), FRAC_CONST(0.999971), FRAC_CONST(0.999992), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(0.999756), FRAC_CONST(0.999756), FRAC_CONST(0.999757), FRAC_CONST(0.99976), FRAC_CONST(0.99977), FRAC_CONST(0.999805), FRAC_CONST(0.999878), FRAC_CONST(0.999951), FRAC_CONST(0.999986), FRAC_CONST(0.999996), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(0.999878), FRAC_CONST(0.999878), FRAC_CONST(0.999878), FRAC_CONST(0.99988), FRAC_CONST(0.999885), FRAC_CONST(0.999902), FRAC_CONST(0.999939), FRAC_CONST(0.999976), FRAC_CONST(0.999993), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(0.999939), FRAC_CONST(0.999939), FRAC_CONST(0.999939), FRAC_CONST(0.99994), FRAC_CONST(0.999943), FRAC_CONST(0.999951), FRAC_CONST(0.999969), FRAC_CONST(0.999988), FRAC_CONST(0.999996), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(0.999969), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.999971), FRAC_CONST(0.999976), FRAC_CONST(0.999985), FRAC_CONST(0.999994), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999986), FRAC_CONST(0.999988), FRAC_CONST(0.999992), FRAC_CONST(0.999997), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999993), FRAC_CONST(0.999994), FRAC_CONST(0.999996), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999997), FRAC_CONST(0.999998), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }
+};
+
+/* calculates 1/(1+Q) */
+/* [0..1] */
+real_t calc_Q_div(sbr_info *sbr, uint8_t ch, uint8_t m, uint8_t l)
+{
+    if (sbr->bs_coupling)
+    {
+        /* left channel */
+        if ((sbr->Q[0][m][l] < 0 || sbr->Q[0][m][l] > 30) ||
+            (sbr->Q[1][m][l] < 0 || sbr->Q[1][m][l] > 24 /* 2*panOffset(1) */))
+        {
+            return 0;
+        } else {
+            /* the pan parameter is always even */
+            if (ch == 0)
+            {
+                return Q_div_tab_left[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1];
+            } else {
+                return Q_div_tab_right[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1];
+            }
+        }
+    } else {
+        /* no coupling */
+        if (sbr->Q[ch][m][l] < 0 || sbr->Q[ch][m][l] > 30)
+        {
+            return 0;
+        } else {
+            return Q_div_tab[sbr->Q[ch][m][l]];
+        }
+    }
+}
+
+/* table for Q_div2 values when no coupling */
+static const real_t Q_div2_tab[31] = {
+    FRAC_CONST(0.984615),     FRAC_CONST(0.969697),
+    FRAC_CONST(0.941176),     FRAC_CONST(0.888889),
+    FRAC_CONST(0.8),          FRAC_CONST(0.666667),
+    FRAC_CONST(0.5),          FRAC_CONST(0.333333),
+    FRAC_CONST(0.2),          FRAC_CONST(0.111111),
+    FRAC_CONST(0.0588235),    FRAC_CONST(0.030303),
+    FRAC_CONST(0.0153846),    FRAC_CONST(0.00775194),
+    FRAC_CONST(0.00389105),   FRAC_CONST(0.00194932),
+    FRAC_CONST(0.00097561),   FRAC_CONST(0.000488043),
+    FRAC_CONST(0.000244081),  FRAC_CONST(0.000122055),
+    FRAC_CONST(6.10314E-005), FRAC_CONST(3.05166E-005),
+    FRAC_CONST(1.52586E-005), FRAC_CONST(7.62934E-006),
+    FRAC_CONST(3.81468E-006), FRAC_CONST(1.90734E-006),
+    FRAC_CONST(9.53673E-007), FRAC_CONST(4.76837E-007),
+    FRAC_CONST(2.38419E-007), FRAC_CONST(1.19209E-007),
+    FRAC_CONST(5.96046E-008)
+};
+
+static const real_t Q_div2_tab_left[31][13] = {
+    { FRAC_CONST(0.0302959), FRAC_CONST(0.111015), FRAC_CONST(0.332468), FRAC_CONST(0.663212), FRAC_CONST(0.882759), FRAC_CONST(0.962406), FRAC_CONST(0.984615), FRAC_CONST(0.990329), FRAC_CONST(0.991768), FRAC_CONST(0.992128), FRAC_CONST(0.992218), FRAC_CONST(0.992241), FRAC_CONST(0.992246) },
+    { FRAC_CONST(0.0153809), FRAC_CONST(0.0587695), FRAC_CONST(0.199377), FRAC_CONST(0.496124), FRAC_CONST(0.790123), FRAC_CONST(0.927536), FRAC_CONST(0.969697), FRAC_CONST(0.980843), FRAC_CONST(0.98367), FRAC_CONST(0.984379), FRAC_CONST(0.984556), FRAC_CONST(0.984601), FRAC_CONST(0.984612) },
+    { FRAC_CONST(0.00775006), FRAC_CONST(0.0302744), FRAC_CONST(0.110727), FRAC_CONST(0.329897), FRAC_CONST(0.653061), FRAC_CONST(0.864865), FRAC_CONST(0.941176), FRAC_CONST(0.962406), FRAC_CONST(0.967864), FRAC_CONST(0.969238), FRAC_CONST(0.969582), FRAC_CONST(0.969668), FRAC_CONST(0.96969) },
+    { FRAC_CONST(0.0038901), FRAC_CONST(0.0153698), FRAC_CONST(0.0586081), FRAC_CONST(0.197531), FRAC_CONST(0.484848), FRAC_CONST(0.761905), FRAC_CONST(0.888889), FRAC_CONST(0.927536), FRAC_CONST(0.937729), FRAC_CONST(0.940312), FRAC_CONST(0.94096), FRAC_CONST(0.941122), FRAC_CONST(0.941163) },
+    { FRAC_CONST(0.00194884), FRAC_CONST(0.00774443), FRAC_CONST(0.0301887), FRAC_CONST(0.109589), FRAC_CONST(0.32), FRAC_CONST(0.615385), FRAC_CONST(0.8), FRAC_CONST(0.864865), FRAC_CONST(0.882759), FRAC_CONST(0.887348), FRAC_CONST(0.888503), FRAC_CONST(0.888792), FRAC_CONST(0.888865) },
+    { FRAC_CONST(0.000975372), FRAC_CONST(0.00388727), FRAC_CONST(0.0153257), FRAC_CONST(0.057971), FRAC_CONST(0.190476), FRAC_CONST(0.444444), FRAC_CONST(0.666667), FRAC_CONST(0.761905), FRAC_CONST(0.790123), FRAC_CONST(0.797508), FRAC_CONST(0.799375), FRAC_CONST(0.799844), FRAC_CONST(0.799961) },
+    { FRAC_CONST(0.000487924), FRAC_CONST(0.00194742), FRAC_CONST(0.00772201), FRAC_CONST(0.0298507), FRAC_CONST(0.105263), FRAC_CONST(0.285714), FRAC_CONST(0.5), FRAC_CONST(0.615385), FRAC_CONST(0.653061), FRAC_CONST(0.663212), FRAC_CONST(0.6658), FRAC_CONST(0.66645), FRAC_CONST(0.666612) },
+    { FRAC_CONST(0.000244021), FRAC_CONST(0.000974659), FRAC_CONST(0.00387597), FRAC_CONST(0.0151515), FRAC_CONST(0.0555556), FRAC_CONST(0.166667), FRAC_CONST(0.333333), FRAC_CONST(0.444444), FRAC_CONST(0.484848), FRAC_CONST(0.496124), FRAC_CONST(0.499025), FRAC_CONST(0.499756), FRAC_CONST(0.499939) },
+    { FRAC_CONST(0.000122026), FRAC_CONST(0.000487567), FRAC_CONST(0.00194175), FRAC_CONST(0.00763359), FRAC_CONST(0.0285714), FRAC_CONST(0.0909091), FRAC_CONST(0.2), FRAC_CONST(0.285714), FRAC_CONST(0.32), FRAC_CONST(0.329897), FRAC_CONST(0.332468), FRAC_CONST(0.333116), FRAC_CONST(0.333279) },
+    { FRAC_CONST(6.10165E-005), FRAC_CONST(0.000243843), FRAC_CONST(0.000971817), FRAC_CONST(0.00383142), FRAC_CONST(0.0144928), FRAC_CONST(0.047619), FRAC_CONST(0.111111), FRAC_CONST(0.166667), FRAC_CONST(0.190476), FRAC_CONST(0.197531), FRAC_CONST(0.199377), FRAC_CONST(0.199844), FRAC_CONST(0.199961) },
+    { FRAC_CONST(3.05092E-005), FRAC_CONST(0.000121936), FRAC_CONST(0.000486145), FRAC_CONST(0.00191939), FRAC_CONST(0.00729927), FRAC_CONST(0.0243902), FRAC_CONST(0.0588235), FRAC_CONST(0.0909091), FRAC_CONST(0.105263), FRAC_CONST(0.109589), FRAC_CONST(0.110727), FRAC_CONST(0.111015), FRAC_CONST(0.111087) },
+    { FRAC_CONST(1.52548E-005), FRAC_CONST(6.09719E-005), FRAC_CONST(0.000243132), FRAC_CONST(0.000960615), FRAC_CONST(0.003663), FRAC_CONST(0.0123457), FRAC_CONST(0.030303), FRAC_CONST(0.047619), FRAC_CONST(0.0555556), FRAC_CONST(0.057971), FRAC_CONST(0.0586081), FRAC_CONST(0.0587695), FRAC_CONST(0.05881) },
+    { FRAC_CONST(7.62747E-006), FRAC_CONST(3.04869E-005), FRAC_CONST(0.000121581), FRAC_CONST(0.000480538), FRAC_CONST(0.00183486), FRAC_CONST(0.00621118), FRAC_CONST(0.0153846), FRAC_CONST(0.0243902), FRAC_CONST(0.0285714), FRAC_CONST(0.0298507), FRAC_CONST(0.0301887), FRAC_CONST(0.0302744), FRAC_CONST(0.0302959) },
+    { FRAC_CONST(3.81375E-006), FRAC_CONST(1.52437E-005), FRAC_CONST(6.0794E-005), FRAC_CONST(0.000240327), FRAC_CONST(0.000918274), FRAC_CONST(0.00311526), FRAC_CONST(0.00775194), FRAC_CONST(0.0123457), FRAC_CONST(0.0144928), FRAC_CONST(0.0151515), FRAC_CONST(0.0153257), FRAC_CONST(0.0153698), FRAC_CONST(0.0153809) },
+    { FRAC_CONST(1.90688E-006), FRAC_CONST(7.62189E-006), FRAC_CONST(3.03979E-005), FRAC_CONST(0.000120178), FRAC_CONST(0.000459348), FRAC_CONST(0.00156006), FRAC_CONST(0.00389105), FRAC_CONST(0.00621118), FRAC_CONST(0.00729927), FRAC_CONST(0.00763359), FRAC_CONST(0.00772201), FRAC_CONST(0.00774443), FRAC_CONST(0.00775006) },
+    { FRAC_CONST(9.53441E-007), FRAC_CONST(3.81096E-006), FRAC_CONST(1.51992E-005), FRAC_CONST(6.00925E-005), FRAC_CONST(0.000229727), FRAC_CONST(0.00078064), FRAC_CONST(0.00194932), FRAC_CONST(0.00311526), FRAC_CONST(0.003663), FRAC_CONST(0.00383142), FRAC_CONST(0.00387597), FRAC_CONST(0.00388727), FRAC_CONST(0.0038901) },
+    { FRAC_CONST(4.76721E-007), FRAC_CONST(1.90548E-006), FRAC_CONST(7.59965E-006), FRAC_CONST(3.00472E-005), FRAC_CONST(0.000114877), FRAC_CONST(0.000390472), FRAC_CONST(0.00097561), FRAC_CONST(0.00156006), FRAC_CONST(0.00183486), FRAC_CONST(0.00191939), FRAC_CONST(0.00194175), FRAC_CONST(0.00194742), FRAC_CONST(0.00194884) },
+    { FRAC_CONST(2.3836E-007), FRAC_CONST(9.52743E-007), FRAC_CONST(3.79984E-006), FRAC_CONST(1.50238E-005), FRAC_CONST(5.74416E-005), FRAC_CONST(0.000195274), FRAC_CONST(0.000488043), FRAC_CONST(0.00078064), FRAC_CONST(0.000918274), FRAC_CONST(0.000960615), FRAC_CONST(0.000971817), FRAC_CONST(0.000974659), FRAC_CONST(0.000975372) },
+    { FRAC_CONST(1.1918E-007), FRAC_CONST(4.76372E-007), FRAC_CONST(1.89992E-006), FRAC_CONST(7.51196E-006), FRAC_CONST(2.87216E-005), FRAC_CONST(9.76467E-005), FRAC_CONST(0.000244081), FRAC_CONST(0.000390472), FRAC_CONST(0.000459348), FRAC_CONST(0.000480538), FRAC_CONST(0.000486145), FRAC_CONST(0.000487567), FRAC_CONST(0.000487924) },
+    { FRAC_CONST(5.95901E-008), FRAC_CONST(2.38186E-007), FRAC_CONST(9.49963E-007), FRAC_CONST(3.756E-006), FRAC_CONST(1.4361E-005), FRAC_CONST(4.88257E-005), FRAC_CONST(0.000122055), FRAC_CONST(0.000195274), FRAC_CONST(0.000229727), FRAC_CONST(0.000240327), FRAC_CONST(0.000243132), FRAC_CONST(0.000243843), FRAC_CONST(0.000244021) },
+    { FRAC_CONST(2.9795E-008), FRAC_CONST(1.19093E-007), FRAC_CONST(4.74982E-007), FRAC_CONST(1.878E-006), FRAC_CONST(7.18056E-006), FRAC_CONST(2.44135E-005), FRAC_CONST(6.10314E-005), FRAC_CONST(9.76467E-005), FRAC_CONST(0.000114877), FRAC_CONST(0.000120178), FRAC_CONST(0.000121581), FRAC_CONST(0.000121936), FRAC_CONST(0.000122026) },
+    { FRAC_CONST(1.48975E-008), FRAC_CONST(5.95465E-008), FRAC_CONST(2.37491E-007), FRAC_CONST(9.39002E-007), FRAC_CONST(3.59029E-006), FRAC_CONST(1.22069E-005), FRAC_CONST(3.05166E-005), FRAC_CONST(4.88257E-005), FRAC_CONST(5.74416E-005), FRAC_CONST(6.00925E-005), FRAC_CONST(6.0794E-005), FRAC_CONST(6.09719E-005), FRAC_CONST(6.10165E-005) },
+    { FRAC_CONST(7.44876E-009), FRAC_CONST(2.97732E-008), FRAC_CONST(1.18745E-007), FRAC_CONST(4.69501E-007), FRAC_CONST(1.79515E-006), FRAC_CONST(6.10348E-006), FRAC_CONST(1.52586E-005), FRAC_CONST(2.44135E-005), FRAC_CONST(2.87216E-005), FRAC_CONST(3.00472E-005), FRAC_CONST(3.03979E-005), FRAC_CONST(3.04869E-005), FRAC_CONST(3.05092E-005) },
+    { FRAC_CONST(3.72438E-009), FRAC_CONST(1.48866E-008), FRAC_CONST(5.93727E-008), FRAC_CONST(2.34751E-007), FRAC_CONST(8.97575E-007), FRAC_CONST(3.05175E-006), FRAC_CONST(7.62934E-006), FRAC_CONST(1.22069E-005), FRAC_CONST(1.4361E-005), FRAC_CONST(1.50238E-005), FRAC_CONST(1.51992E-005), FRAC_CONST(1.52437E-005), FRAC_CONST(1.52548E-005) },
+    { FRAC_CONST(1.86219E-009), FRAC_CONST(7.44331E-009), FRAC_CONST(2.96864E-008), FRAC_CONST(1.17375E-007), FRAC_CONST(4.48788E-007), FRAC_CONST(1.52588E-006), FRAC_CONST(3.81468E-006), FRAC_CONST(6.10348E-006), FRAC_CONST(7.18056E-006), FRAC_CONST(7.51196E-006), FRAC_CONST(7.59965E-006), FRAC_CONST(7.62189E-006), FRAC_CONST(7.62747E-006) },
+    { FRAC_CONST(9.31095E-010), FRAC_CONST(3.72166E-009), FRAC_CONST(1.48432E-008), FRAC_CONST(5.86876E-008), FRAC_CONST(2.24394E-007), FRAC_CONST(7.62939E-007), FRAC_CONST(1.90734E-006), FRAC_CONST(3.05175E-006), FRAC_CONST(3.59029E-006), FRAC_CONST(3.756E-006), FRAC_CONST(3.79984E-006), FRAC_CONST(3.81096E-006), FRAC_CONST(3.81375E-006) },
+    { FRAC_CONST(4.65548E-010), FRAC_CONST(1.86083E-009), FRAC_CONST(7.42159E-009), FRAC_CONST(2.93438E-008), FRAC_CONST(1.12197E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(9.53673E-007), FRAC_CONST(1.52588E-006), FRAC_CONST(1.79515E-006), FRAC_CONST(1.878E-006), FRAC_CONST(1.89992E-006), FRAC_CONST(1.90548E-006), FRAC_CONST(1.90688E-006) },
+    { FRAC_CONST(2.32774E-010), FRAC_CONST(9.30414E-010), FRAC_CONST(3.71079E-009), FRAC_CONST(1.46719E-008), FRAC_CONST(5.60985E-008), FRAC_CONST(1.90735E-007), FRAC_CONST(4.76837E-007), FRAC_CONST(7.62939E-007), FRAC_CONST(8.97575E-007), FRAC_CONST(9.39002E-007), FRAC_CONST(9.49963E-007), FRAC_CONST(9.52743E-007), FRAC_CONST(9.53441E-007) },
+    { FRAC_CONST(1.16387E-010), FRAC_CONST(4.65207E-010), FRAC_CONST(1.8554E-009), FRAC_CONST(7.33596E-009), FRAC_CONST(2.80492E-008), FRAC_CONST(9.53674E-008), FRAC_CONST(2.38419E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(4.48788E-007), FRAC_CONST(4.69501E-007), FRAC_CONST(4.74982E-007), FRAC_CONST(4.76372E-007), FRAC_CONST(4.76721E-007) },
+    { FRAC_CONST(5.81935E-011), FRAC_CONST(2.32603E-010), FRAC_CONST(9.27699E-010), FRAC_CONST(3.66798E-009), FRAC_CONST(1.40246E-008), FRAC_CONST(4.76837E-008), FRAC_CONST(1.19209E-007), FRAC_CONST(1.90735E-007), FRAC_CONST(2.24394E-007), FRAC_CONST(2.34751E-007), FRAC_CONST(2.37491E-007), FRAC_CONST(2.38186E-007), FRAC_CONST(2.3836E-007) },
+    { FRAC_CONST(2.90967E-011), FRAC_CONST(1.16302E-010), FRAC_CONST(4.63849E-010), FRAC_CONST(1.83399E-009), FRAC_CONST(7.01231E-009), FRAC_CONST(2.38419E-008), FRAC_CONST(5.96046E-008), FRAC_CONST(9.53674E-008), FRAC_CONST(1.12197E-007), FRAC_CONST(1.17375E-007), FRAC_CONST(1.18745E-007), FRAC_CONST(1.19093E-007), FRAC_CONST(1.1918E-007) }
+};
+
+static const real_t Q_div2_tab_right[31][13] = {
+    { FRAC_CONST(0.992246), FRAC_CONST(0.992241), FRAC_CONST(0.992218), FRAC_CONST(0.992128), FRAC_CONST(0.991768), FRAC_CONST(0.990329), FRAC_CONST(0.984615), FRAC_CONST(0.962406), FRAC_CONST(0.882759), FRAC_CONST(0.663212), FRAC_CONST(0.332468), FRAC_CONST(0.111015), FRAC_CONST(0.0302959) },
+    { FRAC_CONST(0.984612), FRAC_CONST(0.984601), FRAC_CONST(0.984556), FRAC_CONST(0.984379), FRAC_CONST(0.98367), FRAC_CONST(0.980843), FRAC_CONST(0.969697), FRAC_CONST(0.927536), FRAC_CONST(0.790123), FRAC_CONST(0.496124), FRAC_CONST(0.199377), FRAC_CONST(0.0587695), FRAC_CONST(0.0153809) },
+    { FRAC_CONST(0.96969), FRAC_CONST(0.969668), FRAC_CONST(0.969582), FRAC_CONST(0.969238), FRAC_CONST(0.967864), FRAC_CONST(0.962406), FRAC_CONST(0.941176), FRAC_CONST(0.864865), FRAC_CONST(0.653061), FRAC_CONST(0.329897), FRAC_CONST(0.110727), FRAC_CONST(0.0302744), FRAC_CONST(0.00775006) },
+    { FRAC_CONST(0.941163), FRAC_CONST(0.941122), FRAC_CONST(0.94096), FRAC_CONST(0.940312), FRAC_CONST(0.937729), FRAC_CONST(0.927536), FRAC_CONST(0.888889), FRAC_CONST(0.761905), FRAC_CONST(0.484848), FRAC_CONST(0.197531), FRAC_CONST(0.0586081), FRAC_CONST(0.0153698), FRAC_CONST(0.0038901) },
+    { FRAC_CONST(0.888865), FRAC_CONST(0.888792), FRAC_CONST(0.888503), FRAC_CONST(0.887348), FRAC_CONST(0.882759), FRAC_CONST(0.864865), FRAC_CONST(0.8), FRAC_CONST(0.615385), FRAC_CONST(0.32), FRAC_CONST(0.109589), FRAC_CONST(0.0301887), FRAC_CONST(0.00774443), FRAC_CONST(0.00194884) },
+    { FRAC_CONST(0.799961), FRAC_CONST(0.799844), FRAC_CONST(0.799375), FRAC_CONST(0.797508), FRAC_CONST(0.790123), FRAC_CONST(0.761905), FRAC_CONST(0.666667), FRAC_CONST(0.444444), FRAC_CONST(0.190476), FRAC_CONST(0.057971), FRAC_CONST(0.0153257), FRAC_CONST(0.00388727), FRAC_CONST(0.000975372) },
+    { FRAC_CONST(0.666612), FRAC_CONST(0.66645), FRAC_CONST(0.6658), FRAC_CONST(0.663212), FRAC_CONST(0.653061), FRAC_CONST(0.615385), FRAC_CONST(0.5), FRAC_CONST(0.285714), FRAC_CONST(0.105263), FRAC_CONST(0.0298507), FRAC_CONST(0.00772201), FRAC_CONST(0.00194742), FRAC_CONST(0.000487924) },
+    { FRAC_CONST(0.499939), FRAC_CONST(0.499756), FRAC_CONST(0.499025), FRAC_CONST(0.496124), FRAC_CONST(0.484848), FRAC_CONST(0.444444), FRAC_CONST(0.333333), FRAC_CONST(0.166667), FRAC_CONST(0.0555556), FRAC_CONST(0.0151515), FRAC_CONST(0.00387597), FRAC_CONST(0.000974659), FRAC_CONST(0.000244021) },
+    { FRAC_CONST(0.333279), FRAC_CONST(0.333116), FRAC_CONST(0.332468), FRAC_CONST(0.329897), FRAC_CONST(0.32), FRAC_CONST(0.285714), FRAC_CONST(0.2), FRAC_CONST(0.0909091), FRAC_CONST(0.0285714), FRAC_CONST(0.00763359), FRAC_CONST(0.00194175), FRAC_CONST(0.000487567), FRAC_CONST(0.000122026) },
+    { FRAC_CONST(0.199961), FRAC_CONST(0.199844), FRAC_CONST(0.199377), FRAC_CONST(0.197531), FRAC_CONST(0.190476), FRAC_CONST(0.166667), FRAC_CONST(0.111111), FRAC_CONST(0.047619), FRAC_CONST(0.0144928), FRAC_CONST(0.00383142), FRAC_CONST(0.000971817), FRAC_CONST(0.000243843), FRAC_CONST(6.10165E-005) },
+    { FRAC_CONST(0.111087), FRAC_CONST(0.111015), FRAC_CONST(0.110727), FRAC_CONST(0.109589), FRAC_CONST(0.105263), FRAC_CONST(0.0909091), FRAC_CONST(0.0588235), FRAC_CONST(0.0243902), FRAC_CONST(0.00729927), FRAC_CONST(0.00191939), FRAC_CONST(0.000486145), FRAC_CONST(0.000121936), FRAC_CONST(3.05092E-005) },
+    { FRAC_CONST(0.05881), FRAC_CONST(0.0587695), FRAC_CONST(0.0586081), FRAC_CONST(0.057971), FRAC_CONST(0.0555556), FRAC_CONST(0.047619), FRAC_CONST(0.030303), FRAC_CONST(0.0123457), FRAC_CONST(0.003663), FRAC_CONST(0.000960615), FRAC_CONST(0.000243132), FRAC_CONST(6.09719E-005), FRAC_CONST(1.52548E-005) },
+    { FRAC_CONST(0.0302959), FRAC_CONST(0.0302744), FRAC_CONST(0.0301887), FRAC_CONST(0.0298507), FRAC_CONST(0.0285714), FRAC_CONST(0.0243902), FRAC_CONST(0.0153846), FRAC_CONST(0.00621118), FRAC_CONST(0.00183486), FRAC_CONST(0.000480538), FRAC_CONST(0.000121581), FRAC_CONST(3.04869E-005), FRAC_CONST(7.62747E-006) },
+    { FRAC_CONST(0.0153809), FRAC_CONST(0.0153698), FRAC_CONST(0.0153257), FRAC_CONST(0.0151515), FRAC_CONST(0.0144928), FRAC_CONST(0.0123457), FRAC_CONST(0.00775194), FRAC_CONST(0.00311526), FRAC_CONST(0.000918274), FRAC_CONST(0.000240327), FRAC_CONST(6.0794E-005), FRAC_CONST(1.52437E-005), FRAC_CONST(3.81375E-006) },
+    { FRAC_CONST(0.00775006), FRAC_CONST(0.00774443), FRAC_CONST(0.00772201), FRAC_CONST(0.00763359), FRAC_CONST(0.00729927), FRAC_CONST(0.00621118), FRAC_CONST(0.00389105), FRAC_CONST(0.00156006), FRAC_CONST(0.000459348), FRAC_CONST(0.000120178), FRAC_CONST(3.03979E-005), FRAC_CONST(7.62189E-006), FRAC_CONST(1.90688E-006) },
+    { FRAC_CONST(0.0038901), FRAC_CONST(0.00388727), FRAC_CONST(0.00387597), FRAC_CONST(0.00383142), FRAC_CONST(0.003663), FRAC_CONST(0.00311526), FRAC_CONST(0.00194932), FRAC_CONST(0.00078064), FRAC_CONST(0.000229727), FRAC_CONST(6.00925E-005), FRAC_CONST(1.51992E-005), FRAC_CONST(3.81096E-006), FRAC_CONST(9.53441E-007) },
+    { FRAC_CONST(0.00194884), FRAC_CONST(0.00194742), FRAC_CONST(0.00194175), FRAC_CONST(0.00191939), FRAC_CONST(0.00183486), FRAC_CONST(0.00156006), FRAC_CONST(0.00097561), FRAC_CONST(0.000390472), FRAC_CONST(0.000114877), FRAC_CONST(3.00472E-005), FRAC_CONST(7.59965E-006), FRAC_CONST(1.90548E-006), FRAC_CONST(4.76721E-007) },
+    { FRAC_CONST(0.000975372), FRAC_CONST(0.000974659), FRAC_CONST(0.000971817), FRAC_CONST(0.000960615), FRAC_CONST(0.000918274), FRAC_CONST(0.00078064), FRAC_CONST(0.000488043), FRAC_CONST(0.000195274), FRAC_CONST(5.74416E-005), FRAC_CONST(1.50238E-005), FRAC_CONST(3.79984E-006), FRAC_CONST(9.52743E-007), FRAC_CONST(2.3836E-007) },
+    { FRAC_CONST(0.000487924), FRAC_CONST(0.000487567), FRAC_CONST(0.000486145), FRAC_CONST(0.000480538), FRAC_CONST(0.000459348), FRAC_CONST(0.000390472), FRAC_CONST(0.000244081), FRAC_CONST(9.76467E-005), FRAC_CONST(2.87216E-005), FRAC_CONST(7.51196E-006), FRAC_CONST(1.89992E-006), FRAC_CONST(4.76372E-007), FRAC_CONST(1.1918E-007) },
+    { FRAC_CONST(0.000244021), FRAC_CONST(0.000243843), FRAC_CONST(0.000243132), FRAC_CONST(0.000240327), FRAC_CONST(0.000229727), FRAC_CONST(0.000195274), FRAC_CONST(0.000122055), FRAC_CONST(4.88257E-005), FRAC_CONST(1.4361E-005), FRAC_CONST(3.756E-006), FRAC_CONST(9.49963E-007), FRAC_CONST(2.38186E-007), FRAC_CONST(5.95901E-008) },
+    { FRAC_CONST(0.000122026), FRAC_CONST(0.000121936), FRAC_CONST(0.000121581), FRAC_CONST(0.000120178), FRAC_CONST(0.000114877), FRAC_CONST(9.76467E-005), FRAC_CONST(6.10314E-005), FRAC_CONST(2.44135E-005), FRAC_CONST(7.18056E-006), FRAC_CONST(1.878E-006), FRAC_CONST(4.74982E-007), FRAC_CONST(1.19093E-007), FRAC_CONST(2.9795E-008) },
+    { FRAC_CONST(6.10165E-005), FRAC_CONST(6.09719E-005), FRAC_CONST(6.0794E-005), FRAC_CONST(6.00925E-005), FRAC_CONST(5.74416E-005), FRAC_CONST(4.88257E-005), FRAC_CONST(3.05166E-005), FRAC_CONST(1.22069E-005), FRAC_CONST(3.59029E-006), FRAC_CONST(9.39002E-007), FRAC_CONST(2.37491E-007), FRAC_CONST(5.95465E-008), FRAC_CONST(1.48975E-008) },
+    { FRAC_CONST(3.05092E-005), FRAC_CONST(3.04869E-005), FRAC_CONST(3.03979E-005), FRAC_CONST(3.00472E-005), FRAC_CONST(2.87216E-005), FRAC_CONST(2.44135E-005), FRAC_CONST(1.52586E-005), FRAC_CONST(6.10348E-006), FRAC_CONST(1.79515E-006), FRAC_CONST(4.69501E-007), FRAC_CONST(1.18745E-007), FRAC_CONST(2.97732E-008), FRAC_CONST(7.44876E-009) },
+    { FRAC_CONST(1.52548E-005), FRAC_CONST(1.52437E-005), FRAC_CONST(1.51992E-005), FRAC_CONST(1.50238E-005), FRAC_CONST(1.4361E-005), FRAC_CONST(1.22069E-005), FRAC_CONST(7.62934E-006), FRAC_CONST(3.05175E-006), FRAC_CONST(8.97575E-007), FRAC_CONST(2.34751E-007), FRAC_CONST(5.93727E-008), FRAC_CONST(1.48866E-008), FRAC_CONST(3.72438E-009) },
+    { FRAC_CONST(7.62747E-006), FRAC_CONST(7.62189E-006), FRAC_CONST(7.59965E-006), FRAC_CONST(7.51196E-006), FRAC_CONST(7.18056E-006), FRAC_CONST(6.10348E-006), FRAC_CONST(3.81468E-006), FRAC_CONST(1.52588E-006), FRAC_CONST(4.48788E-007), FRAC_CONST(1.17375E-007), FRAC_CONST(2.96864E-008), FRAC_CONST(7.44331E-009), FRAC_CONST(1.86219E-009) },
+    { FRAC_CONST(3.81375E-006), FRAC_CONST(3.81096E-006), FRAC_CONST(3.79984E-006), FRAC_CONST(3.756E-006), FRAC_CONST(3.59029E-006), FRAC_CONST(3.05175E-006), FRAC_CONST(1.90734E-006), FRAC_CONST(7.62939E-007), FRAC_CONST(2.24394E-007), FRAC_CONST(5.86876E-008), FRAC_CONST(1.48432E-008), FRAC_CONST(3.72166E-009), FRAC_CONST(9.31095E-010) },
+    { FRAC_CONST(1.90688E-006), FRAC_CONST(1.90548E-006), FRAC_CONST(1.89992E-006), FRAC_CONST(1.878E-006), FRAC_CONST(1.79515E-006), FRAC_CONST(1.52588E-006), FRAC_CONST(9.53673E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(1.12197E-007), FRAC_CONST(2.93438E-008), FRAC_CONST(7.42159E-009), FRAC_CONST(1.86083E-009), FRAC_CONST(4.65548E-010) },
+    { FRAC_CONST(9.53441E-007), FRAC_CONST(9.52743E-007), FRAC_CONST(9.49963E-007), FRAC_CONST(9.39002E-007), FRAC_CONST(8.97575E-007), FRAC_CONST(7.62939E-007), FRAC_CONST(4.76837E-007), FRAC_CONST(1.90735E-007), FRAC_CONST(5.60985E-008), FRAC_CONST(1.46719E-008), FRAC_CONST(3.71079E-009), FRAC_CONST(9.30414E-010), FRAC_CONST(2.32774E-010) },
+    { FRAC_CONST(4.76721E-007), FRAC_CONST(4.76372E-007), FRAC_CONST(4.74982E-007), FRAC_CONST(4.69501E-007), FRAC_CONST(4.48788E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(2.38419E-007), FRAC_CONST(9.53674E-008), FRAC_CONST(2.80492E-008), FRAC_CONST(7.33596E-009), FRAC_CONST(1.8554E-009), FRAC_CONST(4.65207E-010), FRAC_CONST(1.16387E-010) },
+    { FRAC_CONST(2.3836E-007), FRAC_CONST(2.38186E-007), FRAC_CONST(2.37491E-007), FRAC_CONST(2.34751E-007), FRAC_CONST(2.24394E-007), FRAC_CONST(1.90735E-007), FRAC_CONST(1.19209E-007), FRAC_CONST(4.76837E-008), FRAC_CONST(1.40246E-008), FRAC_CONST(3.66798E-009), FRAC_CONST(9.27699E-010), FRAC_CONST(2.32603E-010), FRAC_CONST(5.81935E-011) },
+    { FRAC_CONST(1.1918E-007), FRAC_CONST(1.19093E-007), FRAC_CONST(1.18745E-007), FRAC_CONST(1.17375E-007), FRAC_CONST(1.12197E-007), FRAC_CONST(9.53674E-008), FRAC_CONST(5.96046E-008), FRAC_CONST(2.38419E-008), FRAC_CONST(7.01231E-009), FRAC_CONST(1.83399E-009), FRAC_CONST(4.63849E-010), FRAC_CONST(1.16302E-010), FRAC_CONST(2.90967E-011) }
+};
+
+/* calculates Q/(1+Q) */
+/* [0..1] */
+real_t calc_Q_div2(sbr_info *sbr, uint8_t ch, uint8_t m, uint8_t l)
+{
+    if (sbr->bs_coupling)
+    {
+        if ((sbr->Q[0][m][l] < 0 || sbr->Q[0][m][l] > 30) ||
+            (sbr->Q[1][m][l] < 0 || sbr->Q[1][m][l] > 24 /* 2*panOffset(1) */))
+        {
+            return 0;
+        } else {
+            /* the pan parameter is always even */
+            if (ch == 0)
+            {
+                return Q_div2_tab_left[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1];
+            } else {
+                return Q_div2_tab_right[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1];
+            }
+        }
+    } else {
+        /* no coupling */
+        if (sbr->Q[ch][m][l] < 0 || sbr->Q[ch][m][l] > 30)
+        {
+            return 0;
+        } else {
+            return Q_div2_tab[sbr->Q[ch][m][l]];
+        }
+    }
+}
+
+static const real_t E_deq_tab[64] = {
+    64.0f, 128.0f, 256.0f, 512.0f, 1024.0f, 2048.0f, 4096.0f, 8192.0f,
+    16384.0f, 32768.0f, 65536.0f, 131072.0f, 262144.0f, 524288.0f, 1.04858E+006f, 2.09715E+006f,
+    4.1943E+006f, 8.38861E+006f, 1.67772E+007f, 3.35544E+007f, 6.71089E+007f, 1.34218E+008f, 2.68435E+008f, 5.36871E+008f,
+    1.07374E+009f, 2.14748E+009f, 4.29497E+009f, 8.58993E+009f, 1.71799E+010f, 3.43597E+010f, 6.87195E+010f, 1.37439E+011f,
+    2.74878E+011f, 5.49756E+011f, 1.09951E+012f, 2.19902E+012f, 4.39805E+012f, 8.79609E+012f, 1.75922E+013f, 3.51844E+013f,
+    7.03687E+013f, 1.40737E+014f, 2.81475E+014f, 5.6295E+014f, 1.1259E+015f, 2.2518E+015f, 4.5036E+015f, 9.0072E+015f,
+    1.80144E+016f, 3.60288E+016f, 7.20576E+016f, 1.44115E+017f, 2.8823E+017f, 5.76461E+017f, 1.15292E+018f, 2.30584E+018f,
+    4.61169E+018f, 9.22337E+018f, 1.84467E+019f, 3.68935E+019f, 7.3787E+019f, 1.47574E+020f, 2.95148E+020f, 5.90296E+020f
+};
+
 void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch)
 {
     if (sbr->bs_coupling == 0)
@@ -253,22 +401,22 @@
         {
             for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
             {
-                /* +6 for the *64 and -10 for the /32 in the synthesis QMF
+                /* +6 for the *64 and -10 for the /32 in the synthesis QMF (fixed)
                  * since this is a energy value: (x/32)^2 = (x^2)/1024
                  */
-                exp = (sbr->E[ch][k][l] >> amp) + 6;
+                /* exp = (sbr->E[ch][k][l] >> amp) + 6; */
+                exp = (sbr->E[ch][k][l] >> amp);
 
-                if ((exp < -P2_TABLE_OFFSET) || (exp > P2_TABLE_MAX))
+                if ((exp < 0) || (exp >= 64))
                 {
                     sbr->E_orig[ch][k][l] = 0;
                 } else {
-                    /* FIXED POINT TODO: E_orig: INTEGER!! */
-                    sbr->E_orig[ch][k][l] = pow2deq[exp + P2_TABLE_OFFSET];
+                    sbr->E_orig[ch][k][l] = E_deq_tab[exp];
 
                     /* save half the table size at the cost of 1 multiply */
                     if (amp && (sbr->E[ch][k][l] & 1))
                     {
-                        sbr->E_orig[ch][k][l] = MUL_R(sbr->E_orig[ch][k][l], REAL_CONST(1.414213562));
+                        sbr->E_orig[ch][k][l] = MUL_C(sbr->E_orig[ch][k][l], COEF_CONST(1.414213562));
                     }
                 }
             }
@@ -278,18 +426,29 @@
         {
             for (k = 0; k < sbr->N_Q; k++)
             {
-                if (sbr->Q[ch][k][l] < 0 || sbr->Q[ch][k][l] > 30)
-                {
-                    sbr->Q_orig[ch][k][l] = 0;
-                } else {
-                    exp = NOISE_FLOOR_OFFSET - sbr->Q[ch][k][l];
-                    sbr->Q_orig[ch][k][l] = pow2deq[exp + P2_TABLE_OFFSET];
-                }
+                sbr->Q_div[ch][k][l] = calc_Q_div(sbr, ch, k, l);
+                sbr->Q_div2[ch][k][l] = calc_Q_div2(sbr, ch, k, l);
             }
         }
     }
 }
 
+static const real_t E_pan_tab[25] = {
+    FRAC_CONST(0.000244081), FRAC_CONST(0.000488043),
+    FRAC_CONST(0.00097561),  FRAC_CONST(0.00194932),
+    FRAC_CONST(0.00389105),  FRAC_CONST(0.00775194),
+    FRAC_CONST(0.0153846),   FRAC_CONST(0.030303),
+    FRAC_CONST(0.0588235),   FRAC_CONST(0.111111),
+    FRAC_CONST(0.2),         FRAC_CONST(0.333333),
+    FRAC_CONST(0.5),         FRAC_CONST(0.666667),
+    FRAC_CONST(0.8),         FRAC_CONST(0.888889),
+    FRAC_CONST(0.941176),    FRAC_CONST(0.969697),
+    FRAC_CONST(0.984615),    FRAC_CONST(0.992248),
+    FRAC_CONST(0.996109),    FRAC_CONST(0.998051),
+    FRAC_CONST(0.999024),    FRAC_CONST(0.999512),
+    FRAC_CONST(0.999756)
+};
+
 void unmap_envelope_noise(sbr_info *sbr)
 {
     real_t tmp;
@@ -302,49 +461,47 @@
     {
         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;
+            /* +6: * 64 ; +1: * 2 ; */
+            exp0 = (sbr->E[0][k][l] >> amp0) + 1;
 
             /* 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
              */
-            exp1 = (sbr->E[1][k][l] >> amp1) - 12;
+            /* exp1 = (sbr->E[1][k][l] >> amp1) - 12; */
+            exp1 = (sbr->E[1][k][l] >> amp1);
 
-            if ((exp0 < -P2_TABLE_OFFSET) || (exp0 > P2_TABLE_MAX) ||
-                (exp1 < -P2_TABLE_RCP_OFFSET) || (exp1 > P2_TABLE_RCP_MAX))
+            if ((exp0 < 0) || (exp0 >= 64) ||
+                (exp1 < 0) || (exp1 > 24))
             {
                 sbr->E_orig[1][k][l] = 0;
                 sbr->E_orig[0][k][l] = 0;
             } else {
-                tmp = pow2deq[exp0 + P2_TABLE_OFFSET];
+                tmp = E_deq_tab[exp0];
                 if (amp0 && (sbr->E[0][k][l] & 1))
-                    tmp = MUL_R(tmp, REAL_CONST(1.414213562));
+                {
+                    tmp = MUL_C(tmp, COEF_CONST(1.414213562));
+                }
 
-                /* FIXED POINT TODO: E_orig: INTEGER!! */
-                sbr->E_orig[1][k][l] = MUL_F(tmp, pow2deq_rcp[exp1 + P2_TABLE_RCP_OFFSET]);
-                sbr->E_orig[0][k][l] = MUL_R(sbr->E_orig[1][k][l], pow2deq[exp1 + P2_TABLE_OFFSET]);
+                /* panning */
+                sbr->E_orig[0][k][l] = MUL_F(tmp, E_pan_tab[exp1]);
+                sbr->E_orig[1][k][l] = MUL_F(tmp, E_pan_tab[24 - exp1]);
             }
         }
     }
+
     for (l = 0; l < sbr->L_Q[0]; l++)
     {
         for (k = 0; k < sbr->N_Q; k++)
         {
-            if ((sbr->Q[0][k][l] < 0 || sbr->Q[0][k][l] > 30) ||
-                (sbr->Q[1][k][l] < 0 || sbr->Q[1][k][l] > 24 /* 2*panOffset(1) */))
-            {
-                sbr->Q_orig[0][k][l] = 0;
-                sbr->Q_orig[1][k][l] = 0;
-            } else {
-                exp0 = NOISE_FLOOR_OFFSET - sbr->Q[0][k][l] + 1;
-                exp1 = sbr->Q[1][k][l] - 12;
-
-                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]);
-            }
+            sbr->Q_div[0][k][l] = calc_Q_div(sbr, 0, k, l);
+            sbr->Q_div[1][k][l] = calc_Q_div(sbr, 1, k, l);
+            sbr->Q_div2[0][k][l] = calc_Q_div2(sbr, 0, k, l);
+            sbr->Q_div2[1][k][l] = calc_Q_div2(sbr, 1, k, l);
         }
     }
 }
 
 #endif
+
+#endif
--- a/Plugins/Input/aac/libfaad2/sbr_e_nf.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sbr_e_nf.h	Wed May 10 14:44:20 2006 -0700
@@ -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.9 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_e_nf.h,v 1.14 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_E_NF_H__
@@ -33,23 +33,12 @@
 #endif
 
 
-#ifndef FIXED_POINT
-#define P2_TABLE_OFFSET 35
-#define P2_TABLE_MAX 91
-#else
-#define P2Q_TABLE_OFFSET 24
-#define P2Q_TABLE_MAX 7
-#define P2_TABLE_OFFSET 0
-#define P2_TABLE_MAX 31
-#endif
-#define P2_TABLE_RCP_OFFSET 12
-#define P2_TABLE_RCP_MAX 21
-
-
 void extract_envelope_data(sbr_info *sbr, uint8_t ch);
 void extract_noise_floor_data(sbr_info *sbr, uint8_t ch);
+#ifndef FIXED_POINT
 void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch);
 void unmap_envelope_noise(sbr_info *sbr);
+#endif
 
 #ifdef __cplusplus
 }
--- a/Plugins/Input/aac/libfaad2/sbr_fbt.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sbr_fbt.c	Wed May 10 14:44:20 2006 -0700
@@ -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.10 2004/01/16 20:20:32 menno Exp $
+** $Id: sbr_fbt.c,v 1.17 2004/09/08 09:43:11 gcp Exp $
 **/
 
 /* Calculate frequency band tables */
@@ -197,7 +197,7 @@
     if (k2 <= k0)
     {
         sbr->N_master = 0;
-        return 0;
+        return 1;
     }
 
     dk = bs_alter_scale ? 2 : 1;
@@ -224,7 +224,7 @@
     if (k2Diff)
     {
         incr = (k2Diff > 0) ? -1 : 1;
-        k = (k2Diff > 0) ? (nrBands-1) : 0;
+        k = (uint8_t) ((k2Diff > 0) ? (nrBands-1) : 0);
 
         while (k2Diff != 0)
         {
@@ -236,10 +236,10 @@
 
     sbr->f_master[0] = k0;
     for (k = 1; k <= nrBands; k++)
-        sbr->f_master[k] = sbr->f_master[k-1] + vDk[k-1];
+        sbr->f_master[k] = (uint8_t)(sbr->f_master[k-1] + vDk[k-1]);
 
-    sbr->N_master = nrBands;
-    sbr->N_master = min(sbr->N_master, 64);
+    sbr->N_master = (uint8_t)nrBands;
+    sbr->N_master = (min(sbr->N_master, 64));
 
 #if 0
     printf("f_master[%d]: ", nrBands);
@@ -355,18 +355,23 @@
     uint8_t temp1[] = { 6, 5, 4 };
     real_t q, qk;
     int32_t A_1;
+#ifdef FIXED_POINT
+    real_t rk2, rk0;
+#endif
 
     /* mft only defined for k2 > k0 */
     if (k2 <= k0)
     {
         sbr->N_master = 0;
-        return 0;
+        return 1;
     }
 
     bands = temp1[bs_freq_scale-1];
 
 #ifdef FIXED_POINT
-    if (REAL_CONST(k2) > MUL_R(REAL_CONST(k0),REAL_CONST(2.2449)))
+    rk0 = (real_t)k0 << REAL_BITS;
+    rk2 = (real_t)k2 << REAL_BITS;
+    if (rk2 > MUL_C(rk0, COEF_CONST(2.2449)))
 #else
     if ((float)k2/(float)k0 > 2.2449)
 #endif
@@ -378,16 +383,18 @@
         k1 = k2;
     }
 
-    nrBand0 = 2 * find_bands(0, bands, k0, k1);
+    nrBand0 = (uint8_t)(2 * find_bands(0, bands, k0, k1));
     nrBand0 = min(nrBand0, 63);
     if (nrBand0 <= 0)
         return 1;
 
     q = find_initial_power(nrBand0, k0, k1);
+#ifdef FIXED_POINT
+    qk = (real_t)k0 << REAL_BITS;
+    //A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS);
+    A_1 = k0;
+#else
     qk = REAL_CONST(k0);
-#ifdef FIXED_POINT
-    A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS);
-#else
     A_1 = (int32_t)(qk + .5);
 #endif
     for (k = 0; k <= nrBand0; k++)
@@ -417,21 +424,23 @@
     if (!twoRegions)
     {
         for (k = 0; k <= nrBand0; k++)
-            sbr->f_master[k] = vk0[k];
+            sbr->f_master[k] = (uint8_t) vk0[k];
 
         sbr->N_master = nrBand0;
         sbr->N_master = min(sbr->N_master, 64);
         return 0;
     }
 
-    nrBand1 = 2 * find_bands(1 /* warped */, bands, k1, k2);
+    nrBand1 = (uint8_t)(2 * find_bands(1 /* warped */, bands, k1, k2));
     nrBand1 = min(nrBand1, 63);
 
     q = find_initial_power(nrBand1, k1, k2);
+#ifdef FIXED_POINT
+    qk = (real_t)k1 << REAL_BITS;
+    //A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS);
+    A_1 = k1;
+#else
     qk = REAL_CONST(k1);
-#ifdef FIXED_POINT
-    A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS);
-#else
     A_1 = (int32_t)(qk + .5);
 #endif
     for (k = 0; k <= nrBand1 - 1; k++)
@@ -472,11 +481,11 @@
     sbr->N_master = min(sbr->N_master, 64);
     for (k = 0; k <= nrBand0; k++)
     {
-        sbr->f_master[k] = vk0[k];
+        sbr->f_master[k] =  (uint8_t) vk0[k];
     }
     for (k = nrBand0 + 1; k <= sbr->N_master; k++)
     {
-        sbr->f_master[k] = vk1[k - nrBand0];
+        sbr->f_master[k] = (uint8_t) vk1[k - nrBand0];
     }
 
 #if 0
@@ -527,11 +536,13 @@
         if (k == 0)
             i = 0;
         else
-            i = 2*k - minus;
+            i = (uint8_t)(2*k - minus);
         sbr->f_table_res[LO_RES][k] = sbr->f_table_res[HI_RES][i];
     }
 
 #if 0
+    printf("bs_freq_scale: %d\n", sbr->bs_freq_scale);
+    printf("bs_limiter_bands: %d\n", sbr->bs_limiter_bands);
     printf("f_table_res[HI_RES][%d]: ", sbr->N_high);
     for (k = 0; k <= sbr->N_high; k++)
     {
@@ -556,7 +567,7 @@
 #if 0
         sbr->N_Q = max(1, (int32_t)(sbr->bs_noise_bands*(log(k2/(float)sbr->kx)/log(2.0)) + 0.5));
 #else
-        sbr->N_Q = max(1, find_bands(0, sbr->bs_noise_bands, sbr->kx, k2));
+        sbr->N_Q = (uint8_t)(max(1, find_bands(0, sbr->bs_noise_bands, sbr->kx, k2)));
 #endif
         sbr->N_Q = min(5, sbr->N_Q);
     }
@@ -592,7 +603,7 @@
     printf("f_table_noise[%d]: ", sbr->N_Q);
     for (k = 0; k <= sbr->N_Q; k++)
     {
-        printf("%d ", sbr->f_table_noise[k]);
+        printf("%d ", sbr->f_table_noise[k] - sbr->kx);
     }
     printf("\n");
 #endif
@@ -611,8 +622,8 @@
     static const real_t limiterBandsPerOctave[] = { REAL_CONST(1.2),
         REAL_CONST(2), REAL_CONST(3) };
 #else
-    static const real_t limiterBandsCompare[] = { REAL_CONST(1.328125),
-        REAL_CONST(1.1875), REAL_CONST(1.125) };
+    static const real_t limiterBandsCompare[] = { REAL_CONST(1.327152),
+        REAL_CONST(1.185093), REAL_CONST(1.119872) };
 #endif
     uint8_t k, s;
     int8_t nrLim;
@@ -624,6 +635,15 @@
     sbr->f_table_lim[0][1] = sbr->f_table_res[LO_RES][sbr->N_low] - sbr->kx;
     sbr->N_L[0] = 1;
 
+#if 0
+    printf("f_table_lim[%d][%d]: ", 0, sbr->N_L[0]);
+    for (k = 0; k <= sbr->N_L[0]; k++)
+    {
+        printf("%d ", sbr->f_table_lim[0][k]);
+    }
+    printf("\n");
+#endif
+
     for (s = 1; s < 4; s++)
     {
         int32_t limTable[100 /*TODO*/] = {0};
@@ -664,17 +684,18 @@
             if (limTable[k-1] != 0)
 #if 0
                 nOctaves = REAL_CONST(log((float)limTable[k]/(float)limTable[k-1])/log(2.0));
-#endif
+#else
 #ifdef FIXED_POINT
-                nOctaves = SBR_DIV(REAL_CONST(limTable[k]),REAL_CONST(limTable[k-1]));
+                nOctaves = DIV_R((limTable[k]<<REAL_BITS),REAL_CONST(limTable[k-1]));
 #else
                 nOctaves = (real_t)limTable[k]/(real_t)limTable[k-1];
 #endif
+#endif
             else
                 nOctaves = 0;
 
 #if 0
-            if ((MUL(nOctaves,limBands)) < REAL_CONST(0.49))
+            if ((MUL_R(nOctaves,limBands)) < REAL_CONST(0.49))
 #else
             if (nOctaves < limiterBandsCompare[s - 1])
 #endif
--- a/Plugins/Input/aac/libfaad2/sbr_fbt.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sbr_fbt.h	Wed May 10 14:44:20 2006 -0700
@@ -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.10 2004/01/16 20:20:32 menno Exp $
+** $Id: sbr_fbt.h,v 1.14 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_FBT_H__
--- a/Plugins/Input/aac/libfaad2/sbr_hfadj.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sbr_hfadj.c	Wed May 10 14:44:20 2006 -0700
@@ -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.10 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_hfadj.c,v 1.18 2004/09/04 14:56:28 menno Exp $
 **/
 
 /* High Frequency adjustment */
@@ -38,9 +38,7 @@
 #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 function declarations */
 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);
@@ -59,54 +57,6 @@
 {
     ALIGN sbr_hfadj_info adj = {{{0}}};
 
-    map_noise_data(sbr, &adj, ch);
-    map_sinusoids(sbr, &adj, ch);
-
-    estimate_current_envelope(sbr, &adj, Xsbr, ch);
-
-    calculate_gain(sbr, &adj, ch);
-
-#ifdef SBR_LOW_POWER
-    calc_gain_groups(sbr, &adj, deg, ch);
-    aliasing_reduction(sbr, &adj, deg, ch);
-#endif
-
-    hf_assembly(sbr, &adj, Xsbr, ch);
-}
-
-static void map_noise_data(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
-{
-    uint8_t l, i;
-    uint32_t m;
-
-    for (l = 0; l < sbr->L_E[ch]; l++)
-    {
-        for (i = 0; i < sbr->N_Q; i++)
-        {
-            for (m = sbr->f_table_noise[i]; m < sbr->f_table_noise[i+1]; m++)
-            {
-                uint8_t k;
-
-                adj->Q_mapped[m - sbr->kx][l] = 0;
-
-                for (k = 0; k < 2; k++)
-                {
-                    if ((sbr->t_E[ch][l] >= sbr->t_Q[ch][k]) &&
-                        (sbr->t_E[ch][l+1] <= sbr->t_Q[ch][k+1]))
-                    {
-                        adj->Q_mapped[m - sbr->kx][l] =
-                            sbr->Q_orig[ch][i][k];
-                    }
-                }
-            }
-        }
-    }
-}
-
-static void map_sinusoids(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
-{
-    uint8_t l, i, m, k, k1, k2, delta_S, l_i, u_i;
-
     if (sbr->bs_frame_class[ch] == FIXFIX)
     {
         sbr->l_A[ch] = -1;
@@ -122,82 +72,57 @@
             sbr->l_A[ch] = sbr->L_E[ch] + 1 - sbr->bs_pointer[ch];
     }
 
-    for (l = 0; l < 5; l++)
+    estimate_current_envelope(sbr, &adj, Xsbr, ch);
+
+    calculate_gain(sbr, &adj, ch);
+
+#ifdef SBR_LOW_POWER
+    calc_gain_groups(sbr, &adj, deg, ch);
+    aliasing_reduction(sbr, &adj, deg, ch);
+#endif
+
+    hf_assembly(sbr, &adj, Xsbr, ch);
+}
+
+static uint8_t get_S_mapped(sbr_info *sbr, uint8_t ch, uint8_t l, uint8_t current_band)
+{
+    if (sbr->f[ch][l] == HI_RES)
     {
-        for (i = 0; i < 64; i++)
+        /* in case of using f_table_high we just have 1 to 1 mapping
+         * from bs_add_harmonic[l][k]
+         */
+        if ((l >= sbr->l_A[ch]) ||
+            (sbr->bs_add_harmonic_prev[ch][current_band] && sbr->bs_add_harmonic_flag_prev[ch]))
         {
-            adj->S_index_mapped[i][l] = 0;
-            adj->S_mapped[i][l] = 0;
+            return sbr->bs_add_harmonic[ch][current_band];
         }
-    }
+    } else {
+        uint8_t b, lb, ub;
+
+        /* in case of f_table_low we check if any of the HI_RES bands
+         * within this LO_RES band has bs_add_harmonic[l][k] turned on
+         * (note that borders in the LO_RES table are also present in
+         * the HI_RES table)
+         */
 
-    for (l = 0; l < sbr->L_E[ch]; l++)
-    {
-        for (i = 0; i < sbr->N_high; i++)
+        /* find first HI_RES band in current LO_RES band */
+        lb = 2*current_band - ((sbr->N_high & 1) ? 1 : 0);
+        /* find first HI_RES band in next LO_RES band */
+        ub = 2*(current_band+1) - ((sbr->N_high & 1) ? 1 : 0);
+
+        /* check all HI_RES bands in current LO_RES band for sinusoid */
+        for (b = lb; b < ub; b++)
         {
-            for (m = sbr->f_table_res[HI_RES][i]; m < sbr->f_table_res[HI_RES][i+1]; m++)
+            if ((l >= sbr->l_A[ch]) ||
+                (sbr->bs_add_harmonic_prev[ch][b] && sbr->bs_add_harmonic_flag_prev[ch]))
             {
-                uint8_t delta_step = 0;
-                if ((l >= sbr->l_A[ch]) || ((sbr->bs_add_harmonic_prev[ch][i]) &&
-                    (sbr->bs_add_harmonic_flag_prev[ch])))
-                {
-                    delta_step = 1;
-                }
-
-                if (m == (int32_t)((real_t)(sbr->f_table_res[HI_RES][i+1]+sbr->f_table_res[HI_RES][i])/2.))
-                {
-                    adj->S_index_mapped[m - sbr->kx][l] =
-                        delta_step * sbr->bs_add_harmonic[ch][i];
-                } else {
-                    adj->S_index_mapped[m - sbr->kx][l] = 0;
-                }
+                if (sbr->bs_add_harmonic[ch][b] == 1)
+                    return 1;
             }
         }
     }
 
-    for (l = 0; l < sbr->L_E[ch]; l++)
-    {
-        for (i = 0; i < sbr->N_high; i++)
-        {
-            if (sbr->f[ch][l] == 1)
-            {
-                k1 = i;
-                k2 = i + 1;
-            } else {
-                for (k1 = 0; k1 < sbr->N_low; k1++)
-                {
-                    if ((sbr->f_table_res[HI_RES][i] >= sbr->f_table_res[LO_RES][k1]) &&
-                        (sbr->f_table_res[HI_RES][i+1] <= sbr->f_table_res[LO_RES][k1+1]))
-                    {
-                        break;
-                    }
-                }
-                for (k2 = 0; k2 < sbr->N_low; k2++)
-                {
-                    if ((sbr->f_table_res[HI_RES][i+1] >= sbr->f_table_res[LO_RES][k2]) &&
-                        (sbr->f_table_res[HI_RES][i+2] <= sbr->f_table_res[LO_RES][k2+1]))
-                    {
-                        break;
-                    }
-                }
-            }
-
-            l_i = sbr->f_table_res[sbr->f[ch][l]][k1];
-            u_i = sbr->f_table_res[sbr->f[ch][l]][k2];
-
-            delta_S = 0;
-            for (k = l_i; k < u_i; k++)
-            {
-                if (adj->S_index_mapped[k - sbr->kx][l] == 1)
-                    delta_S = 1;
-            }
-
-            for (m = l_i; m < u_i; m++)
-            {
-                adj->S_mapped[m - sbr->kx][l] = delta_S;
-            }
-        }
-    }
+    return 0;
 }
 
 static void estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj,
@@ -223,17 +148,30 @@
 
                 for (i = l_i + sbr->tHFAdj; i < u_i + sbr->tHFAdj; i++)
                 {
+#ifdef FIXED_POINT
+#ifdef SBR_LOW_POWER
+                    nrg += ((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS);
+#else
+                    nrg += ((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS) +
+                        ((QMF_IM(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_IM(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS);
+#endif
+#else
                     nrg += MUL_R(QMF_RE(Xsbr[i][m + sbr->kx]), QMF_RE(Xsbr[i][m + sbr->kx]))
 #ifndef SBR_LOW_POWER
                         + MUL_R(QMF_IM(Xsbr[i][m + sbr->kx]), QMF_IM(Xsbr[i][m + sbr->kx]))
 #endif
                         ;
+#endif
                 }
 
                 sbr->E_curr[ch][m][l] = nrg / div;
 #ifdef SBR_LOW_POWER
+#ifdef FIXED_POINT
+                sbr->E_curr[ch][m][l] <<= 1;
+#else
                 sbr->E_curr[ch][m][l] *= 2;
 #endif
+#endif
             }
         }
     } else {
@@ -247,7 +185,7 @@
                 for (k = k_l; k < k_h; k++)
                 {
                     uint8_t i, l_i, u_i;
-                    nrg = 0.0;
+                    nrg = 0;
 
                     l_i = sbr->t_E[ch][l];
                     u_i = sbr->t_E[ch][l+1];
@@ -258,52 +196,972 @@
                     {
                         for (j = k_l; j < k_h; j++)
                         {
+#ifdef FIXED_POINT
+#ifdef SBR_LOW_POWER
+                            nrg += ((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS);
+#else
+                            nrg += ((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS) +
+                                ((QMF_IM(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_IM(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS);
+#endif
+#else
                             nrg += MUL_R(QMF_RE(Xsbr[i][j]), QMF_RE(Xsbr[i][j]))
 #ifndef SBR_LOW_POWER
                                 + MUL_R(QMF_IM(Xsbr[i][j]), QMF_IM(Xsbr[i][j]))
 #endif
                                 ;
+#endif
                         }
                     }
 
                     sbr->E_curr[ch][k - sbr->kx][l] = nrg / div;
 #ifdef SBR_LOW_POWER
+#ifdef FIXED_POINT
+                    sbr->E_curr[ch][k - sbr->kx][l] <<= 1;
+#else
                     sbr->E_curr[ch][k - sbr->kx][l] *= 2;
 #endif
+#endif
                 }
             }
         }
     }
 }
 
+#ifdef FIXED_POINT
+#define EPS (1) /* smallest number available in fixed point */
+#else
+#define EPS (1e-12)
+#endif
 
-#define EPS (1e-12)
+
+
+#ifdef FIXED_POINT
+
+/* log2 values of [0..63] */
+static const real_t log2_int_tab[] = {
+    LOG2_MIN_INF, REAL_CONST(0.000000000000000), REAL_CONST(1.000000000000000), REAL_CONST(1.584962500721156),
+    REAL_CONST(2.000000000000000), REAL_CONST(2.321928094887362), REAL_CONST(2.584962500721156), REAL_CONST(2.807354922057604),
+    REAL_CONST(3.000000000000000), REAL_CONST(3.169925001442313), REAL_CONST(3.321928094887363), REAL_CONST(3.459431618637297),
+    REAL_CONST(3.584962500721156), REAL_CONST(3.700439718141092), REAL_CONST(3.807354922057604), REAL_CONST(3.906890595608519),
+    REAL_CONST(4.000000000000000), REAL_CONST(4.087462841250339), REAL_CONST(4.169925001442312), REAL_CONST(4.247927513443585),
+    REAL_CONST(4.321928094887362), REAL_CONST(4.392317422778761), REAL_CONST(4.459431618637297), REAL_CONST(4.523561956057013),
+    REAL_CONST(4.584962500721156), REAL_CONST(4.643856189774724), REAL_CONST(4.700439718141093), REAL_CONST(4.754887502163468),
+    REAL_CONST(4.807354922057604), REAL_CONST(4.857980995127572), REAL_CONST(4.906890595608519), REAL_CONST(4.954196310386875),
+    REAL_CONST(5.000000000000000), REAL_CONST(5.044394119358453), REAL_CONST(5.087462841250340), REAL_CONST(5.129283016944966),
+    REAL_CONST(5.169925001442312), REAL_CONST(5.209453365628949), REAL_CONST(5.247927513443585), REAL_CONST(5.285402218862248),
+    REAL_CONST(5.321928094887363), REAL_CONST(5.357552004618084), REAL_CONST(5.392317422778761), REAL_CONST(5.426264754702098),
+    REAL_CONST(5.459431618637297), REAL_CONST(5.491853096329675), REAL_CONST(5.523561956057013), REAL_CONST(5.554588851677637),
+    REAL_CONST(5.584962500721156), REAL_CONST(5.614709844115208), REAL_CONST(5.643856189774724), REAL_CONST(5.672425341971495),
+    REAL_CONST(5.700439718141093), REAL_CONST(5.727920454563200), REAL_CONST(5.754887502163469), REAL_CONST(5.781359713524660),
+    REAL_CONST(5.807354922057605), REAL_CONST(5.832890014164742), REAL_CONST(5.857980995127572), REAL_CONST(5.882643049361842),
+    REAL_CONST(5.906890595608518), REAL_CONST(5.930737337562887), REAL_CONST(5.954196310386876), REAL_CONST(5.977279923499916)
+};
+
+static const real_t pan_log2_tab[] = {
+    REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362), REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339),
+    REAL_CONST(0.044394119358453), REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878), REAL_CONST(0.002815015607054),
+    REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247), REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122),
+    REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667)
+};
+
+static real_t find_log2_E(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
+{
+    /* check for coupled energy/noise data */
+    if (sbr->bs_coupling == 1)
+    {
+        uint8_t amp0 = (sbr->amp_res[0]) ? 0 : 1;
+        uint8_t amp1 = (sbr->amp_res[1]) ? 0 : 1;
+        real_t tmp = (7 << REAL_BITS) + (sbr->E[0][k][l] << (REAL_BITS-amp0));
+        real_t pan;
+
+        /* E[1] should always be even so shifting is OK */
+        uint8_t E = sbr->E[1][k][l] >> amp1;
+
+        if (ch == 0)
+        {
+            if (E > 12)
+            {
+                /* negative */
+                pan = pan_log2_tab[-12 + E];
+            } else {
+                /* positive */
+                pan = pan_log2_tab[12 - E] + ((12 - E)<<REAL_BITS);
+            }
+        } else {
+            if (E < 12)
+            {
+                /* negative */
+                pan = pan_log2_tab[-E + 12];
+            } else {
+                /* positive */
+                pan = pan_log2_tab[E - 12] + ((E - 12)<<REAL_BITS);
+            }
+        }
+
+        /* tmp / pan in log2 */
+        return tmp - pan;
+    } else {
+        uint8_t amp = (sbr->amp_res[ch]) ? 0 : 1;
+
+        return (6 << REAL_BITS) + (sbr->E[ch][k][l] << (REAL_BITS-amp));
+    }
+}
+
+static real_t find_log2_Q(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
+{
+    /* check for coupled energy/noise data */
+    if (sbr->bs_coupling == 1)
+    {
+        real_t tmp = (7 << REAL_BITS) - (sbr->Q[0][k][l] << REAL_BITS);
+        real_t pan;
+
+        uint8_t Q = sbr->Q[1][k][l];
+
+        if (ch == 0)
+        {
+            if (Q > 12)
+            {
+                /* negative */
+                pan = pan_log2_tab[-12 + Q];
+            } else {
+                /* positive */
+                pan = pan_log2_tab[12 - Q] + ((12 - Q)<<REAL_BITS);
+            }
+        } else {
+            if (Q < 12)
+            {
+                /* negative */
+                pan = pan_log2_tab[-Q + 12];
+            } else {
+                /* positive */
+                pan = pan_log2_tab[Q - 12] + ((Q - 12)<<REAL_BITS);
+            }
+        }
+
+        /* tmp / pan in log2 */
+        return tmp - pan;
+    } else {
+        return (6 << REAL_BITS) - (sbr->Q[ch][k][l] << REAL_BITS);
+    }
+}
+
+static const real_t log_Qplus1_pan[31][13] = {
+    { REAL_CONST(0.044383447617292), REAL_CONST(0.169768601655960), REAL_CONST(0.583090126514435), REAL_CONST(1.570089221000671), REAL_CONST(3.092446088790894), REAL_CONST(4.733354568481445), REAL_CONST(6.022367954254150), REAL_CONST(6.692092418670654), REAL_CONST(6.924463272094727), REAL_CONST(6.989034175872803), REAL_CONST(7.005646705627441), REAL_CONST(7.009829998016357), REAL_CONST(7.010877609252930) },
+    { REAL_CONST(0.022362394258380), REAL_CONST(0.087379962205887), REAL_CONST(0.320804953575134), REAL_CONST(0.988859415054321), REAL_CONST(2.252387046813965), REAL_CONST(3.786596298217773), REAL_CONST(5.044394016265869), REAL_CONST(5.705977916717529), REAL_CONST(5.936291694641113), REAL_CONST(6.000346660614014), REAL_CONST(6.016829967498779), REAL_CONST(6.020981311798096), REAL_CONST(6.022020816802979) },
+    { REAL_CONST(0.011224525049329), REAL_CONST(0.044351425021887), REAL_CONST(0.169301137328148), REAL_CONST(0.577544987201691), REAL_CONST(1.527246952056885), REAL_CONST(2.887525320053101), REAL_CONST(4.087462902069092), REAL_CONST(4.733354568481445), REAL_CONST(4.959661006927490), REAL_CONST(5.022709369659424), REAL_CONST(5.038940429687500), REAL_CONST(5.043028831481934), REAL_CONST(5.044052600860596) },
+    { REAL_CONST(0.005623178556561), REAL_CONST(0.022346137091517), REAL_CONST(0.087132595479488), REAL_CONST(0.317482173442841), REAL_CONST(0.956931233406067), REAL_CONST(2.070389270782471), REAL_CONST(3.169924974441528), REAL_CONST(3.786596298217773), REAL_CONST(4.005294322967529), REAL_CONST(4.066420555114746), REAL_CONST(4.082170009613037), REAL_CONST(4.086137294769287), REAL_CONST(4.087131500244141) },
+    { REAL_CONST(0.002814328996465), REAL_CONST(0.011216334067285), REAL_CONST(0.044224001467228), REAL_CONST(0.167456731200218), REAL_CONST(0.556393325328827), REAL_CONST(1.378511548042297), REAL_CONST(2.321928024291992), REAL_CONST(2.887525320053101), REAL_CONST(3.092446088790894), REAL_CONST(3.150059700012207), REAL_CONST(3.164926528930664), REAL_CONST(3.168673276901245), REAL_CONST(3.169611930847168) },
+    { REAL_CONST(0.001407850766554), REAL_CONST(0.005619067233056), REAL_CONST(0.022281449288130), REAL_CONST(0.086156636476517), REAL_CONST(0.304854571819305), REAL_CONST(0.847996890544891), REAL_CONST(1.584962487220764), REAL_CONST(2.070389270782471), REAL_CONST(2.252387046813965), REAL_CONST(2.304061651229858), REAL_CONST(2.317430257797241), REAL_CONST(2.320801734924316), REAL_CONST(2.321646213531494) },
+    { REAL_CONST(0.000704097095877), REAL_CONST(0.002812269143760), REAL_CONST(0.011183738708496), REAL_CONST(0.043721374124289), REAL_CONST(0.160464659333229), REAL_CONST(0.485426813364029), REAL_CONST(1.000000000000000), REAL_CONST(1.378511548042297), REAL_CONST(1.527246952056885), REAL_CONST(1.570089221000671), REAL_CONST(1.581215262413025), REAL_CONST(1.584023833274841), REAL_CONST(1.584727644920349) },
+    { REAL_CONST(0.000352177477907), REAL_CONST(0.001406819908880), REAL_CONST(0.005602621007711), REAL_CONST(0.022026389837265), REAL_CONST(0.082462236285210), REAL_CONST(0.263034462928772), REAL_CONST(0.584962487220764), REAL_CONST(0.847996890544891), REAL_CONST(0.956931233406067), REAL_CONST(0.988859415054321), REAL_CONST(0.997190535068512), REAL_CONST(0.999296069145203), REAL_CONST(0.999823868274689) },
+    { REAL_CONST(0.000176099492819), REAL_CONST(0.000703581434209), REAL_CONST(0.002804030198604), REAL_CONST(0.011055230163038), REAL_CONST(0.041820213198662), REAL_CONST(0.137503549456596), REAL_CONST(0.321928083896637), REAL_CONST(0.485426813364029), REAL_CONST(0.556393325328827), REAL_CONST(0.577544987201691), REAL_CONST(0.583090126514435), REAL_CONST(0.584493279457092), REAL_CONST(0.584845066070557) },
+    { REAL_CONST(0.000088052431238), REAL_CONST(0.000351833587047), REAL_CONST(0.001402696361765), REAL_CONST(0.005538204684854), REAL_CONST(0.021061634644866), REAL_CONST(0.070389263331890), REAL_CONST(0.169925004243851), REAL_CONST(0.263034462928772), REAL_CONST(0.304854571819305), REAL_CONST(0.317482173442841), REAL_CONST(0.320804953575134), REAL_CONST(0.321646571159363), REAL_CONST(0.321857661008835) },
+    { REAL_CONST(0.000044026888645), REAL_CONST(0.000175927518285), REAL_CONST(0.000701518612914), REAL_CONST(0.002771759871393), REAL_CONST(0.010569252073765), REAL_CONST(0.035623874515295), REAL_CONST(0.087462842464447), REAL_CONST(0.137503549456596), REAL_CONST(0.160464659333229), REAL_CONST(0.167456731200218), REAL_CONST(0.169301137328148), REAL_CONST(0.169768601655960), REAL_CONST(0.169885858893394) },
+    { REAL_CONST(0.000022013611670), REAL_CONST(0.000088052431238), REAL_CONST(0.000350801943569), REAL_CONST(0.001386545598507), REAL_CONST(0.005294219125062), REAL_CONST(0.017921976745129), REAL_CONST(0.044394120573997), REAL_CONST(0.070389263331890), REAL_CONST(0.082462236285210), REAL_CONST(0.086156636476517), REAL_CONST(0.087132595479488), REAL_CONST(0.087379962205887), REAL_CONST(0.087442122399807) },
+    { REAL_CONST(0.000011006847672), REAL_CONST(0.000044026888645), REAL_CONST(0.000175411638338), REAL_CONST(0.000693439331371), REAL_CONST(0.002649537986144), REAL_CONST(0.008988817222416), REAL_CONST(0.022367812693119), REAL_CONST(0.035623874515295), REAL_CONST(0.041820213198662), REAL_CONST(0.043721374124289), REAL_CONST(0.044224001467228), REAL_CONST(0.044351425021887), REAL_CONST(0.044383447617292) },
+    { REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000087708482170), REAL_CONST(0.000346675369656), REAL_CONST(0.001325377263129), REAL_CONST(0.004501323681325), REAL_CONST(0.011227255687118), REAL_CONST(0.017921976745129), REAL_CONST(0.021061634644866), REAL_CONST(0.022026389837265), REAL_CONST(0.022281449288130), REAL_CONST(0.022346137091517), REAL_CONST(0.022362394258380) },
+    { REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043854910473), REAL_CONST(0.000173348103999), REAL_CONST(0.000662840844598), REAL_CONST(0.002252417383716), REAL_CONST(0.005624548997730), REAL_CONST(0.008988817222416), REAL_CONST(0.010569252073765), REAL_CONST(0.011055230163038), REAL_CONST(0.011183738708496), REAL_CONST(0.011216334067285), REAL_CONST(0.011224525049329) },
+    { REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000086676649516), REAL_CONST(0.000331544462824), REAL_CONST(0.001126734190620), REAL_CONST(0.002815015614033), REAL_CONST(0.004501323681325), REAL_CONST(0.005294219125062), REAL_CONST(0.005538204684854), REAL_CONST(0.005602621007711), REAL_CONST(0.005619067233056), REAL_CONST(0.005623178556561) },
+    { REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043338975956), REAL_CONST(0.000165781748365), REAL_CONST(0.000563477107789), REAL_CONST(0.001408194424585), REAL_CONST(0.002252417383716), REAL_CONST(0.002649537986144), REAL_CONST(0.002771759871393), REAL_CONST(0.002804030198604), REAL_CONST(0.002812269143760), REAL_CONST(0.002814328996465) },
+    { REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000021669651687), REAL_CONST(0.000082893253420), REAL_CONST(0.000281680084299), REAL_CONST(0.000704268983100), REAL_CONST(0.001126734190620), REAL_CONST(0.001325377263129), REAL_CONST(0.001386545598507), REAL_CONST(0.001402696361765), REAL_CONST(0.001406819908880), REAL_CONST(0.001407850766554) },
+    { REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010834866771), REAL_CONST(0.000041447223339), REAL_CONST(0.000140846910654), REAL_CONST(0.000352177477907), REAL_CONST(0.000563477107789), REAL_CONST(0.000662840844598), REAL_CONST(0.000693439331371), REAL_CONST(0.000701518612914), REAL_CONST(0.000703581434209), REAL_CONST(0.000704097095877) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000020637769921), REAL_CONST(0.000070511166996), REAL_CONST(0.000176099492819), REAL_CONST(0.000281680084299), REAL_CONST(0.000331544462824), REAL_CONST(0.000346675369656), REAL_CONST(0.000350801943569), REAL_CONST(0.000351833587047), REAL_CONST(0.000352177477907) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010318922250), REAL_CONST(0.000035256012779), REAL_CONST(0.000088052431238), REAL_CONST(0.000140846910654), REAL_CONST(0.000165781748365), REAL_CONST(0.000173348103999), REAL_CONST(0.000175411638338), REAL_CONST(0.000175927518285), REAL_CONST(0.000176099492819) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005159470220), REAL_CONST(0.000017542124624), REAL_CONST(0.000044026888645), REAL_CONST(0.000070511166996), REAL_CONST(0.000082893253420), REAL_CONST(0.000086676649516), REAL_CONST(0.000087708482170), REAL_CONST(0.000088052431238), REAL_CONST(0.000088052431238) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002579737384), REAL_CONST(0.000008771088687), REAL_CONST(0.000022013611670), REAL_CONST(0.000035256012779), REAL_CONST(0.000041447223339), REAL_CONST(0.000043338975956), REAL_CONST(0.000043854910473), REAL_CONST(0.000044026888645), REAL_CONST(0.000044026888645) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000004471542070), REAL_CONST(0.000011006847672), REAL_CONST(0.000017542124624), REAL_CONST(0.000020637769921), REAL_CONST(0.000021669651687), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002235772627), REAL_CONST(0.000005503434295), REAL_CONST(0.000008771088687), REAL_CONST(0.000010318922250), REAL_CONST(0.000010834866771), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001031895522), REAL_CONST(0.000002751719876), REAL_CONST(0.000004471542070), REAL_CONST(0.000005159470220), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000515947875), REAL_CONST(0.000001375860506), REAL_CONST(0.000002235772627), REAL_CONST(0.000002579737384), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000000687930424), REAL_CONST(0.000001031895522), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000515947875), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634) }
+};
+
+static const real_t log_Qplus1[31] = {
+    REAL_CONST(6.022367813028454), REAL_CONST(5.044394119358453), REAL_CONST(4.087462841250339), 
+    REAL_CONST(3.169925001442313), REAL_CONST(2.321928094887362), REAL_CONST(1.584962500721156), 
+    REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362), 
+    REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339), REAL_CONST(0.044394119358453), 
+    REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878), 
+    REAL_CONST(0.002815015607054), REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247), 
+    REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122), 
+    REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667), 
+    REAL_CONST(0.000005503434331), REAL_CONST(0.000002751719790), REAL_CONST(0.000001375860551), 
+    REAL_CONST(0.000000687930439), REAL_CONST(0.000000343965261), REAL_CONST(0.000000171982641), 
+    REAL_CONST(0.000000000000000)
+};
+
+static real_t find_log2_Qplus1(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
+{
+    /* check for coupled energy/noise data */
+    if (sbr->bs_coupling == 1)
+    {
+        if ((sbr->Q[0][k][l] >= 0) && (sbr->Q[0][k][l] <= 30) &&
+            (sbr->Q[1][k][l] >= 0) && (sbr->Q[1][k][l] <= 24))
+        {
+            if (ch == 0)
+            {
+                return log_Qplus1_pan[sbr->Q[0][k][l]][sbr->Q[1][k][l] >> 1];
+            } else {
+                return log_Qplus1_pan[sbr->Q[0][k][l]][12 - (sbr->Q[1][k][l] >> 1)];
+            }
+        } else {
+            return 0;
+        }
+    } else {
+        if (sbr->Q[ch][k][l] >= 0 && sbr->Q[ch][k][l] <= 30)
+        {
+            return log_Qplus1[sbr->Q[ch][k][l]];
+        } else {
+            return 0;
+        }
+    }
+}
+
+static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
+{
+    /* log2 values of limiter gains */
+    static real_t limGain[] = {
+        REAL_CONST(-1.0), REAL_CONST(0.0), REAL_CONST(1.0), REAL_CONST(33.219)
+    };
+    uint8_t m, l, k;
+
+    uint8_t current_t_noise_band = 0;
+    uint8_t S_mapped;
+
+    ALIGN real_t Q_M_lim[MAX_M];
+    ALIGN real_t G_lim[MAX_M];
+    ALIGN real_t G_boost;
+    ALIGN real_t S_M[MAX_M];
+
+
+    for (l = 0; l < sbr->L_E[ch]; l++)
+    {
+        uint8_t current_f_noise_band = 0;
+        uint8_t current_res_band = 0;
+        uint8_t current_res_band2 = 0;
+        uint8_t current_hi_res_band = 0;
+
+        real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1;
+
+        S_mapped = get_S_mapped(sbr, ch, l, current_res_band2);
+
+        if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1])
+        {
+            current_t_noise_band++;
+        }
+
+        for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++)
+        {
+            real_t Q_M = 0;
+            real_t G_max;
+            real_t den = 0;
+            real_t acc1 = 0;
+            real_t acc2 = 0;
+            uint8_t current_res_band_size = 0;
+            uint8_t Q_M_size = 0;
+
+            uint8_t ml1, ml2;
+
+            /* bounds of current limiter bands */
+            ml1 = sbr->f_table_lim[sbr->bs_limiter_bands][k];
+            ml2 = sbr->f_table_lim[sbr->bs_limiter_bands][k+1];
+
+
+            /* calculate the accumulated E_orig and E_curr over the limiter band */
+            for (m = ml1; m < ml2; m++)
+            {
+                if ((m + sbr->kx) < sbr->f_table_res[sbr->f[ch][l]][current_res_band+1])
+                {
+                    current_res_band_size++;
+                } else {
+                    acc1 += pow2_int(-REAL_CONST(10) + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch));
+
+                    current_res_band++;
+                    current_res_band_size = 1;
+                }
+
+                acc2 += sbr->E_curr[ch][m][l];
+            }
+            acc1 += pow2_int(-REAL_CONST(10) + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch));
+
+
+            if (acc1 == 0)
+                acc1 = LOG2_MIN_INF;
+            else
+                acc1 = log2_int(acc1);
+
+
+            /* calculate the maximum gain */
+            /* ratio of the energy of the original signal and the energy
+             * of the HF generated signal
+             */
+            G_max = acc1 - log2_int(acc2) + limGain[sbr->bs_limiter_gains];
+            G_max = min(G_max, limGain[3]);
+
+
+            for (m = ml1; m < ml2; m++)
+            {
+                real_t G;
+                real_t E_curr, E_orig;
+                real_t Q_orig, Q_orig_plus1;
+                uint8_t S_index_mapped;
+
+
+                /* check if m is on a noise band border */
+                if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1])
+                {
+                    /* step to next noise band */
+                    current_f_noise_band++;
+                }
+
+
+                /* check if m is on a resolution band border */
+                if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1])
+                {
+                    /* accumulate a whole range of equal Q_Ms */
+                    if (Q_M_size > 0)
+                        den += pow2_int(log2_int_tab[Q_M_size] + Q_M);
+                    Q_M_size = 0;
+
+                    /* step to next resolution band */
+                    current_res_band2++;
+
+                    /* if we move to a new resolution band, we should check if we are
+                     * going to add a sinusoid in this band
+                     */
+                    S_mapped = get_S_mapped(sbr, ch, l, current_res_band2);
+                }
+
+
+                /* check if m is on a HI_RES band border */
+                if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1])
+                {
+                    /* step to next HI_RES band */
+                    current_hi_res_band++;
+                }
+
+
+                /* find S_index_mapped
+                 * S_index_mapped can only be 1 for the m in the middle of the
+                 * current HI_RES band
+                 */
+                S_index_mapped = 0;
+                if ((l >= sbr->l_A[ch]) ||
+                    (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch]))
+                {
+                    /* find the middle subband of the HI_RES frequency band */
+                    if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1)
+                        S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band];
+                }
+
+
+                /* find bitstream parameters */
+                if (sbr->E_curr[ch][m][l] == 0)
+                    E_curr = LOG2_MIN_INF;
+                else
+                    E_curr = log2_int(sbr->E_curr[ch][m][l]);
+                E_orig = -REAL_CONST(10) + find_log2_E(sbr, current_res_band2, l, ch);
+
+
+                Q_orig = find_log2_Q(sbr, current_f_noise_band, current_t_noise_band, ch);
+                Q_orig_plus1 = find_log2_Qplus1(sbr, current_f_noise_band, current_t_noise_band, ch);
+
+
+                /* Q_M only depends on E_orig and Q_div2:
+                 * since N_Q <= N_Low <= N_High we only need to recalculate Q_M on
+                 * a change of current res band (HI or LO)
+                 */
+                Q_M = E_orig + Q_orig - Q_orig_plus1;
+
+
+                /* S_M only depends on E_orig, Q_div and S_index_mapped:
+                 * S_index_mapped can only be non-zero once per HI_RES band
+                 */
+                if (S_index_mapped == 0)
+                {
+                    S_M[m] = LOG2_MIN_INF; /* -inf */
+                } else {
+                    S_M[m] = E_orig - Q_orig_plus1;
+
+                    /* accumulate sinusoid part of the total energy */
+                    den += pow2_int(S_M[m]);
+                }
+
+
+                /* calculate gain */
+                /* ratio of the energy of the original signal and the energy
+                 * of the HF generated signal
+                 */
+                /* E_curr here is officially E_curr+1 so the log2() of that can never be < 0 */
+                /* scaled by -10 */
+                G = E_orig - max(-REAL_CONST(10), E_curr);
+                if ((S_mapped == 0) && (delta == 1))
+                {
+                    /* G = G * 1/(1+Q) */
+                    G -= Q_orig_plus1;
+                } else if (S_mapped == 1) {
+                    /* G = G * Q/(1+Q) */
+                    G += Q_orig - Q_orig_plus1;
+                }
+
+
+                /* limit the additional noise energy level */
+                /* and apply the limiter */
+                if (G_max > G)
+                {
+                    Q_M_lim[m] = Q_M;
+                    G_lim[m] = G;
+
+                    if ((S_index_mapped == 0) && (l != sbr->l_A[ch]))
+                    {
+                        Q_M_size++;
+                    }
+                } else {
+                    /* G > G_max */
+                    Q_M_lim[m] = Q_M + G_max - G;
+                    G_lim[m] = G_max;
+
+                    /* accumulate limited Q_M */
+                    if ((S_index_mapped == 0) && (l != sbr->l_A[ch]))
+                    {
+                        den += pow2_int(Q_M_lim[m]);
+                    }
+                }
+
+
+                /* accumulate the total energy */
+                /* E_curr changes for every m so we do need to accumulate every m */
+                den += pow2_int(E_curr + G_lim[m]);
+            }
+
+            /* accumulate last range of equal Q_Ms */
+            if (Q_M_size > 0)
+            {
+                den += pow2_int(log2_int_tab[Q_M_size] + Q_M);
+            }
+
+
+            /* calculate the final gain */
+            /* G_boost: [0..2.51188643] */
+            G_boost = acc1 - log2_int(den /*+ EPS*/);
+            G_boost = min(G_boost, REAL_CONST(1.328771237) /* log2(1.584893192 ^ 2) */);
+
+
+            for (m = ml1; m < ml2; m++)
+            {
+                /* apply compensation to gain, noise floor sf's and sinusoid levels */
+#ifndef SBR_LOW_POWER
+                adj->G_lim_boost[l][m] = pow2_fix((G_lim[m] + G_boost) >> 1);
+#else
+                /* sqrt() will be done after the aliasing reduction to save a
+                 * few multiplies
+                 */
+                adj->G_lim_boost[l][m] = pow2_fix(G_lim[m] + G_boost);
+#endif
+                adj->Q_M_lim_boost[l][m] = pow2_fix((Q_M_lim[m] + G_boost) >> 1);
+
+                if (S_M[m] != LOG2_MIN_INF)
+                {
+                    adj->S_M_boost[l][m] = pow2_int((S_M[m] + G_boost) >> 1);
+                } else {
+                    adj->S_M_boost[l][m] = 0;
+                }
+            }
+        }
+    }
+}
+
+#else
+
+//#define LOG2_TEST
+
+#ifdef LOG2_TEST
 
-#define ONE (1)
+#define LOG2_MIN_INF -100000
+
+__inline float pow2(float val)
+{
+    return pow(2.0, val);
+}
+__inline float log2(float val)
+{
+    return log(val)/log(2.0);
+}
+
+#define RB 14
+
+float QUANTISE2REAL(float val)
+{
+    __int32 ival = (__int32)(val * (1<<RB));
+    return (float)ival / (float)((1<<RB));
+}
+
+float QUANTISE2INT(float val)
+{
+    return floor(val);
+}
+
+/* log2 values of [0..63] */
+static const real_t log2_int_tab[] = {
+    LOG2_MIN_INF,      0.000000000000000, 1.000000000000000, 1.584962500721156,
+    2.000000000000000, 2.321928094887362, 2.584962500721156, 2.807354922057604,
+    3.000000000000000, 3.169925001442313, 3.321928094887363, 3.459431618637297,
+    3.584962500721156, 3.700439718141092, 3.807354922057604, 3.906890595608519,
+    4.000000000000000, 4.087462841250339, 4.169925001442312, 4.247927513443585,
+    4.321928094887362, 4.392317422778761, 4.459431618637297, 4.523561956057013,
+    4.584962500721156, 4.643856189774724, 4.700439718141093, 4.754887502163468,
+    4.807354922057604, 4.857980995127572, 4.906890595608519, 4.954196310386875,
+    5.000000000000000, 5.044394119358453, 5.087462841250340, 5.129283016944966,
+    5.169925001442312, 5.209453365628949, 5.247927513443585, 5.285402218862248,
+    5.321928094887363, 5.357552004618084, 5.392317422778761, 5.426264754702098,
+    5.459431618637297, 5.491853096329675, 5.523561956057013, 5.554588851677637,
+    5.584962500721156, 5.614709844115208, 5.643856189774724, 5.672425341971495,
+    5.700439718141093, 5.727920454563200, 5.754887502163469, 5.781359713524660,
+    5.807354922057605, 5.832890014164742, 5.857980995127572, 5.882643049361842,
+    5.906890595608518, 5.930737337562887, 5.954196310386876, 5.977279923499916
+};
+
+static const real_t pan_log2_tab[] = {
+    1.000000000000000, 0.584962500721156, 0.321928094887362, 0.169925001442312, 0.087462841250339,
+    0.044394119358453, 0.022367813028455, 0.011227255423254, 0.005624549193878, 0.002815015607054,
+    0.001408194392808, 0.000704269011247, 0.000352177480301, 0.000176099486443, 0.000088052430122,
+    0.000044026886827, 0.000022013611360, 0.000011006847667
+};
+
+static real_t find_log2_E(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
+{
+    /* check for coupled energy/noise data */
+    if (sbr->bs_coupling == 1)
+    {
+        real_t amp0 = (sbr->amp_res[0]) ? 1.0 : 0.5;
+        real_t amp1 = (sbr->amp_res[1]) ? 1.0 : 0.5;
+        float tmp = QUANTISE2REAL(7.0 + (real_t)sbr->E[0][k][l] * amp0);
+        float pan;
+
+        int E = (int)(sbr->E[1][k][l] * amp1);
+
+        if (ch == 0)
+        {
+            if (E > 12)
+            {
+                /* negative */
+                pan = QUANTISE2REAL(pan_log2_tab[-12 + E]);
+            } else {
+                /* positive */
+                pan = QUANTISE2REAL(pan_log2_tab[12 - E] + (12 - E));
+            }
+        } else {
+            if (E < 12)
+            {
+                /* negative */
+                pan = QUANTISE2REAL(pan_log2_tab[-E + 12]);
+            } else {
+                /* positive */
+                pan = QUANTISE2REAL(pan_log2_tab[E - 12] + (E - 12));
+            }
+        }
+
+        /* tmp / pan in log2 */
+        return QUANTISE2REAL(tmp - pan);
+    } else {
+        real_t amp = (sbr->amp_res[ch]) ? 1.0 : 0.5;
+
+        return QUANTISE2REAL(6.0 + (real_t)sbr->E[ch][k][l] * amp);
+    }
+}
+
+static real_t find_log2_Q(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
+{
+    /* check for coupled energy/noise data */
+    if (sbr->bs_coupling == 1)
+    {
+        float tmp = QUANTISE2REAL(7.0 - (real_t)sbr->Q[0][k][l]);
+        float pan;
+
+        int Q = (int)(sbr->Q[1][k][l]);
+
+        if (ch == 0)
+        {
+            if (Q > 12)
+            {
+                /* negative */
+                pan = QUANTISE2REAL(pan_log2_tab[-12 + Q]);
+            } else {
+                /* positive */
+                pan = QUANTISE2REAL(pan_log2_tab[12 - Q] + (12 - Q));
+            }
+        } else {
+            if (Q < 12)
+            {
+                /* negative */
+                pan = QUANTISE2REAL(pan_log2_tab[-Q + 12]);
+            } else {
+                /* positive */
+                pan = QUANTISE2REAL(pan_log2_tab[Q - 12] + (Q - 12));
+            }
+        }
+
+        /* tmp / pan in log2 */
+        return QUANTISE2REAL(tmp - pan);
+    } else {
+        return QUANTISE2REAL(6.0 - (real_t)sbr->Q[ch][k][l]);
+    }
+}
+
+static const real_t log_Qplus1_pan[31][13] = {
+    { REAL_CONST(0.044383447617292), REAL_CONST(0.169768601655960), REAL_CONST(0.583090126514435), REAL_CONST(1.570089221000671), REAL_CONST(3.092446088790894), REAL_CONST(4.733354568481445), REAL_CONST(6.022367954254150), REAL_CONST(6.692092418670654), REAL_CONST(6.924463272094727), REAL_CONST(6.989034175872803), REAL_CONST(7.005646705627441), REAL_CONST(7.009829998016357), REAL_CONST(7.010877609252930) },
+    { REAL_CONST(0.022362394258380), REAL_CONST(0.087379962205887), REAL_CONST(0.320804953575134), REAL_CONST(0.988859415054321), REAL_CONST(2.252387046813965), REAL_CONST(3.786596298217773), REAL_CONST(5.044394016265869), REAL_CONST(5.705977916717529), REAL_CONST(5.936291694641113), REAL_CONST(6.000346660614014), REAL_CONST(6.016829967498779), REAL_CONST(6.020981311798096), REAL_CONST(6.022020816802979) },
+    { REAL_CONST(0.011224525049329), REAL_CONST(0.044351425021887), REAL_CONST(0.169301137328148), REAL_CONST(0.577544987201691), REAL_CONST(1.527246952056885), REAL_CONST(2.887525320053101), REAL_CONST(4.087462902069092), REAL_CONST(4.733354568481445), REAL_CONST(4.959661006927490), REAL_CONST(5.022709369659424), REAL_CONST(5.038940429687500), REAL_CONST(5.043028831481934), REAL_CONST(5.044052600860596) },
+    { REAL_CONST(0.005623178556561), REAL_CONST(0.022346137091517), REAL_CONST(0.087132595479488), REAL_CONST(0.317482173442841), REAL_CONST(0.956931233406067), REAL_CONST(2.070389270782471), REAL_CONST(3.169924974441528), REAL_CONST(3.786596298217773), REAL_CONST(4.005294322967529), REAL_CONST(4.066420555114746), REAL_CONST(4.082170009613037), REAL_CONST(4.086137294769287), REAL_CONST(4.087131500244141) },
+    { REAL_CONST(0.002814328996465), REAL_CONST(0.011216334067285), REAL_CONST(0.044224001467228), REAL_CONST(0.167456731200218), REAL_CONST(0.556393325328827), REAL_CONST(1.378511548042297), REAL_CONST(2.321928024291992), REAL_CONST(2.887525320053101), REAL_CONST(3.092446088790894), REAL_CONST(3.150059700012207), REAL_CONST(3.164926528930664), REAL_CONST(3.168673276901245), REAL_CONST(3.169611930847168) },
+    { REAL_CONST(0.001407850766554), REAL_CONST(0.005619067233056), REAL_CONST(0.022281449288130), REAL_CONST(0.086156636476517), REAL_CONST(0.304854571819305), REAL_CONST(0.847996890544891), REAL_CONST(1.584962487220764), REAL_CONST(2.070389270782471), REAL_CONST(2.252387046813965), REAL_CONST(2.304061651229858), REAL_CONST(2.317430257797241), REAL_CONST(2.320801734924316), REAL_CONST(2.321646213531494) },
+    { REAL_CONST(0.000704097095877), REAL_CONST(0.002812269143760), REAL_CONST(0.011183738708496), REAL_CONST(0.043721374124289), REAL_CONST(0.160464659333229), REAL_CONST(0.485426813364029), REAL_CONST(1.000000000000000), REAL_CONST(1.378511548042297), REAL_CONST(1.527246952056885), REAL_CONST(1.570089221000671), REAL_CONST(1.581215262413025), REAL_CONST(1.584023833274841), REAL_CONST(1.584727644920349) },
+    { REAL_CONST(0.000352177477907), REAL_CONST(0.001406819908880), REAL_CONST(0.005602621007711), REAL_CONST(0.022026389837265), REAL_CONST(0.082462236285210), REAL_CONST(0.263034462928772), REAL_CONST(0.584962487220764), REAL_CONST(0.847996890544891), REAL_CONST(0.956931233406067), REAL_CONST(0.988859415054321), REAL_CONST(0.997190535068512), REAL_CONST(0.999296069145203), REAL_CONST(0.999823868274689) },
+    { REAL_CONST(0.000176099492819), REAL_CONST(0.000703581434209), REAL_CONST(0.002804030198604), REAL_CONST(0.011055230163038), REAL_CONST(0.041820213198662), REAL_CONST(0.137503549456596), REAL_CONST(0.321928083896637), REAL_CONST(0.485426813364029), REAL_CONST(0.556393325328827), REAL_CONST(0.577544987201691), REAL_CONST(0.583090126514435), REAL_CONST(0.584493279457092), REAL_CONST(0.584845066070557) },
+    { REAL_CONST(0.000088052431238), REAL_CONST(0.000351833587047), REAL_CONST(0.001402696361765), REAL_CONST(0.005538204684854), REAL_CONST(0.021061634644866), REAL_CONST(0.070389263331890), REAL_CONST(0.169925004243851), REAL_CONST(0.263034462928772), REAL_CONST(0.304854571819305), REAL_CONST(0.317482173442841), REAL_CONST(0.320804953575134), REAL_CONST(0.321646571159363), REAL_CONST(0.321857661008835) },
+    { REAL_CONST(0.000044026888645), REAL_CONST(0.000175927518285), REAL_CONST(0.000701518612914), REAL_CONST(0.002771759871393), REAL_CONST(0.010569252073765), REAL_CONST(0.035623874515295), REAL_CONST(0.087462842464447), REAL_CONST(0.137503549456596), REAL_CONST(0.160464659333229), REAL_CONST(0.167456731200218), REAL_CONST(0.169301137328148), REAL_CONST(0.169768601655960), REAL_CONST(0.169885858893394) },
+    { REAL_CONST(0.000022013611670), REAL_CONST(0.000088052431238), REAL_CONST(0.000350801943569), REAL_CONST(0.001386545598507), REAL_CONST(0.005294219125062), REAL_CONST(0.017921976745129), REAL_CONST(0.044394120573997), REAL_CONST(0.070389263331890), REAL_CONST(0.082462236285210), REAL_CONST(0.086156636476517), REAL_CONST(0.087132595479488), REAL_CONST(0.087379962205887), REAL_CONST(0.087442122399807) },
+    { REAL_CONST(0.000011006847672), REAL_CONST(0.000044026888645), REAL_CONST(0.000175411638338), REAL_CONST(0.000693439331371), REAL_CONST(0.002649537986144), REAL_CONST(0.008988817222416), REAL_CONST(0.022367812693119), REAL_CONST(0.035623874515295), REAL_CONST(0.041820213198662), REAL_CONST(0.043721374124289), REAL_CONST(0.044224001467228), REAL_CONST(0.044351425021887), REAL_CONST(0.044383447617292) },
+    { REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000087708482170), REAL_CONST(0.000346675369656), REAL_CONST(0.001325377263129), REAL_CONST(0.004501323681325), REAL_CONST(0.011227255687118), REAL_CONST(0.017921976745129), REAL_CONST(0.021061634644866), REAL_CONST(0.022026389837265), REAL_CONST(0.022281449288130), REAL_CONST(0.022346137091517), REAL_CONST(0.022362394258380) },
+    { REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043854910473), REAL_CONST(0.000173348103999), REAL_CONST(0.000662840844598), REAL_CONST(0.002252417383716), REAL_CONST(0.005624548997730), REAL_CONST(0.008988817222416), REAL_CONST(0.010569252073765), REAL_CONST(0.011055230163038), REAL_CONST(0.011183738708496), REAL_CONST(0.011216334067285), REAL_CONST(0.011224525049329) },
+    { REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000086676649516), REAL_CONST(0.000331544462824), REAL_CONST(0.001126734190620), REAL_CONST(0.002815015614033), REAL_CONST(0.004501323681325), REAL_CONST(0.005294219125062), REAL_CONST(0.005538204684854), REAL_CONST(0.005602621007711), REAL_CONST(0.005619067233056), REAL_CONST(0.005623178556561) },
+    { REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043338975956), REAL_CONST(0.000165781748365), REAL_CONST(0.000563477107789), REAL_CONST(0.001408194424585), REAL_CONST(0.002252417383716), REAL_CONST(0.002649537986144), REAL_CONST(0.002771759871393), REAL_CONST(0.002804030198604), REAL_CONST(0.002812269143760), REAL_CONST(0.002814328996465) },
+    { REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000021669651687), REAL_CONST(0.000082893253420), REAL_CONST(0.000281680084299), REAL_CONST(0.000704268983100), REAL_CONST(0.001126734190620), REAL_CONST(0.001325377263129), REAL_CONST(0.001386545598507), REAL_CONST(0.001402696361765), REAL_CONST(0.001406819908880), REAL_CONST(0.001407850766554) },
+    { REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010834866771), REAL_CONST(0.000041447223339), REAL_CONST(0.000140846910654), REAL_CONST(0.000352177477907), REAL_CONST(0.000563477107789), REAL_CONST(0.000662840844598), REAL_CONST(0.000693439331371), REAL_CONST(0.000701518612914), REAL_CONST(0.000703581434209), REAL_CONST(0.000704097095877) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000020637769921), REAL_CONST(0.000070511166996), REAL_CONST(0.000176099492819), REAL_CONST(0.000281680084299), REAL_CONST(0.000331544462824), REAL_CONST(0.000346675369656), REAL_CONST(0.000350801943569), REAL_CONST(0.000351833587047), REAL_CONST(0.000352177477907) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010318922250), REAL_CONST(0.000035256012779), REAL_CONST(0.000088052431238), REAL_CONST(0.000140846910654), REAL_CONST(0.000165781748365), REAL_CONST(0.000173348103999), REAL_CONST(0.000175411638338), REAL_CONST(0.000175927518285), REAL_CONST(0.000176099492819) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005159470220), REAL_CONST(0.000017542124624), REAL_CONST(0.000044026888645), REAL_CONST(0.000070511166996), REAL_CONST(0.000082893253420), REAL_CONST(0.000086676649516), REAL_CONST(0.000087708482170), REAL_CONST(0.000088052431238), REAL_CONST(0.000088052431238) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002579737384), REAL_CONST(0.000008771088687), REAL_CONST(0.000022013611670), REAL_CONST(0.000035256012779), REAL_CONST(0.000041447223339), REAL_CONST(0.000043338975956), REAL_CONST(0.000043854910473), REAL_CONST(0.000044026888645), REAL_CONST(0.000044026888645) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000004471542070), REAL_CONST(0.000011006847672), REAL_CONST(0.000017542124624), REAL_CONST(0.000020637769921), REAL_CONST(0.000021669651687), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002235772627), REAL_CONST(0.000005503434295), REAL_CONST(0.000008771088687), REAL_CONST(0.000010318922250), REAL_CONST(0.000010834866771), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001031895522), REAL_CONST(0.000002751719876), REAL_CONST(0.000004471542070), REAL_CONST(0.000005159470220), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000515947875), REAL_CONST(0.000001375860506), REAL_CONST(0.000002235772627), REAL_CONST(0.000002579737384), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000000687930424), REAL_CONST(0.000001031895522), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000515947875), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634) }
+};
+
+static const real_t log_Qplus1[31] = {
+    REAL_CONST(6.022367813028454), REAL_CONST(5.044394119358453), REAL_CONST(4.087462841250339), 
+    REAL_CONST(3.169925001442313), REAL_CONST(2.321928094887362), REAL_CONST(1.584962500721156), 
+    REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362), 
+    REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339), REAL_CONST(0.044394119358453), 
+    REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878), 
+    REAL_CONST(0.002815015607054), REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247), 
+    REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122), 
+    REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667), 
+    REAL_CONST(0.000005503434331), REAL_CONST(0.000002751719790), REAL_CONST(0.000001375860551), 
+    REAL_CONST(0.000000687930439), REAL_CONST(0.000000343965261), REAL_CONST(0.000000171982641), 
+    REAL_CONST(0.000000000000000)
+};
+
+static real_t find_log2_Qplus1(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
+{
+    /* check for coupled energy/noise data */
+    if (sbr->bs_coupling == 1)
+    {
+        if ((sbr->Q[0][k][l] >= 0) && (sbr->Q[0][k][l] <= 30) &&
+            (sbr->Q[1][k][l] >= 0) && (sbr->Q[1][k][l] <= 24))
+        {
+            if (ch == 0)
+            {
+                return QUANTISE2REAL(log_Qplus1_pan[sbr->Q[0][k][l]][sbr->Q[1][k][l] >> 1]);
+            } else {
+                return QUANTISE2REAL(log_Qplus1_pan[sbr->Q[0][k][l]][12 - (sbr->Q[1][k][l] >> 1)]);
+            }
+        } else {
+            return 0;
+        }
+    } else {
+        if (sbr->Q[ch][k][l] >= 0 && sbr->Q[ch][k][l] <= 30)
+        {
+            return QUANTISE2REAL(log_Qplus1[sbr->Q[ch][k][l]]);
+        } else {
+            return 0;
+        }
+    }
+}
+
+static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
+{
+    /* log2 values of limiter gains */
+    static real_t limGain[] = { -1.0, 0.0, 1.0, 33.219 };
+    uint8_t m, l, k;
+
+    uint8_t current_t_noise_band = 0;
+    uint8_t S_mapped;
+
+    ALIGN real_t Q_M_lim[MAX_M];
+    ALIGN real_t G_lim[MAX_M];
+    ALIGN real_t G_boost;
+    ALIGN real_t S_M[MAX_M];
+
 
+    for (l = 0; l < sbr->L_E[ch]; l++)
+    {
+        uint8_t current_f_noise_band = 0;
+        uint8_t current_res_band = 0;
+        uint8_t current_res_band2 = 0;
+        uint8_t current_hi_res_band = 0;
+
+        real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1;
+
+        S_mapped = get_S_mapped(sbr, ch, l, current_res_band2);
+
+        if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1])
+        {
+            current_t_noise_band++;
+        }
+
+        for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++)
+        {
+            real_t Q_M = 0;
+            real_t G_max;
+            real_t den = 0;
+            real_t acc1 = 0;
+            real_t acc2 = 0;
+            uint8_t current_res_band_size = 0;
+            uint8_t Q_M_size = 0;
+
+            uint8_t ml1, ml2;
+
+            /* bounds of current limiter bands */
+            ml1 = sbr->f_table_lim[sbr->bs_limiter_bands][k];
+            ml2 = sbr->f_table_lim[sbr->bs_limiter_bands][k+1];
+
+
+            /* calculate the accumulated E_orig and E_curr over the limiter band */
+            for (m = ml1; m < ml2; m++)
+            {
+                if ((m + sbr->kx) < sbr->f_table_res[sbr->f[ch][l]][current_res_band+1])
+                {
+                    current_res_band_size++;
+                } else {
+                    acc1 += QUANTISE2INT(pow2(-10 + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch)));
+
+                    current_res_band++;
+                    current_res_band_size = 1;
+                }
+
+                acc2 += QUANTISE2INT(sbr->E_curr[ch][m][l]/1024.0);
+            }
+            acc1 += QUANTISE2INT(pow2(-10 + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch)));
+
+            acc1 = QUANTISE2REAL( log2(EPS + acc1) );
+
+
+            /* calculate the maximum gain */
+            /* ratio of the energy of the original signal and the energy
+             * of the HF generated signal
+             */
+            G_max = acc1 - QUANTISE2REAL(log2(EPS + acc2)) + QUANTISE2REAL(limGain[sbr->bs_limiter_gains]);
+            G_max = min(G_max, QUANTISE2REAL(limGain[3]));
+
+
+            for (m = ml1; m < ml2; m++)
+            {
+                real_t G;
+                real_t E_curr, E_orig;
+                real_t Q_orig, Q_orig_plus1;
+                uint8_t S_index_mapped;
+
+
+                /* check if m is on a noise band border */
+                if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1])
+                {
+                    /* step to next noise band */
+                    current_f_noise_band++;
+                }
+
+
+                /* check if m is on a resolution band border */
+                if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1])
+                {
+                    /* accumulate a whole range of equal Q_Ms */
+                    if (Q_M_size > 0)
+                        den += QUANTISE2INT(pow2(log2_int_tab[Q_M_size] + Q_M));
+                    Q_M_size = 0;
+
+                    /* step to next resolution band */
+                    current_res_band2++;
+
+                    /* if we move to a new resolution band, we should check if we are
+                     * going to add a sinusoid in this band
+                     */
+                    S_mapped = get_S_mapped(sbr, ch, l, current_res_band2);
+                }
+
+
+                /* check if m is on a HI_RES band border */
+                if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1])
+                {
+                    /* step to next HI_RES band */
+                    current_hi_res_band++;
+                }
+
+
+                /* find S_index_mapped
+                 * S_index_mapped can only be 1 for the m in the middle of the
+                 * current HI_RES band
+                 */
+                S_index_mapped = 0;
+                if ((l >= sbr->l_A[ch]) ||
+                    (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch]))
+                {
+                    /* find the middle subband of the HI_RES frequency band */
+                    if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1)
+                        S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band];
+                }
+
+
+                /* find bitstream parameters */
+                if (sbr->E_curr[ch][m][l] == 0)
+                    E_curr = LOG2_MIN_INF;
+                else
+                    E_curr = -10 + log2(sbr->E_curr[ch][m][l]);
+                E_orig = -10 + find_log2_E(sbr, current_res_band2, l, ch);
+
+                Q_orig = find_log2_Q(sbr, current_f_noise_band, current_t_noise_band, ch);
+                Q_orig_plus1 = find_log2_Qplus1(sbr, current_f_noise_band, current_t_noise_band, ch);
+
+
+                /* Q_M only depends on E_orig and Q_div2:
+                 * since N_Q <= N_Low <= N_High we only need to recalculate Q_M on
+                 * a change of current res band (HI or LO)
+                 */
+                Q_M = E_orig + Q_orig - Q_orig_plus1;
+
+
+                /* S_M only depends on E_orig, Q_div and S_index_mapped:
+                 * S_index_mapped can only be non-zero once per HI_RES band
+                 */
+                if (S_index_mapped == 0)
+                {
+                    S_M[m] = LOG2_MIN_INF; /* -inf */
+                } else {
+                    S_M[m] = E_orig - Q_orig_plus1;
+
+                    /* accumulate sinusoid part of the total energy */
+                    den += pow2(S_M[m]);
+                }
+
+
+                /* calculate gain */
+                /* ratio of the energy of the original signal and the energy
+                 * of the HF generated signal
+                 */
+                /* E_curr here is officially E_curr+1 so the log2() of that can never be < 0 */
+                /* scaled by -10 */
+                G = E_orig - max(-10, E_curr);
+                if ((S_mapped == 0) && (delta == 1))
+                {
+                    /* G = G * 1/(1+Q) */
+                    G -= Q_orig_plus1;
+                } else if (S_mapped == 1) {
+                    /* G = G * Q/(1+Q) */
+                    G += Q_orig - Q_orig_plus1;
+                }
+
+
+                /* limit the additional noise energy level */
+                /* and apply the limiter */
+                if (G_max > G)
+                {
+                    Q_M_lim[m] = QUANTISE2REAL(Q_M);
+                    G_lim[m] = QUANTISE2REAL(G);
+
+                    if ((S_index_mapped == 0) && (l != sbr->l_A[ch]))
+                    {
+                        Q_M_size++;
+                    }
+                } else {
+                    /* G > G_max */
+                    Q_M_lim[m] = QUANTISE2REAL(Q_M) + G_max - QUANTISE2REAL(G);
+                    G_lim[m] = G_max;
+
+                    /* accumulate limited Q_M */
+                    if ((S_index_mapped == 0) && (l != sbr->l_A[ch]))
+                    {
+                        den += QUANTISE2INT(pow2(Q_M_lim[m]));
+                    }
+                }
+
+
+                /* accumulate the total energy */
+                /* E_curr changes for every m so we do need to accumulate every m */
+                den += QUANTISE2INT(pow2(E_curr + G_lim[m]));
+            }
+
+            /* accumulate last range of equal Q_Ms */
+            if (Q_M_size > 0)
+            {
+                den += QUANTISE2INT(pow2(log2_int_tab[Q_M_size] + Q_M));
+            }
+
+
+            /* calculate the final gain */
+            /* G_boost: [0..2.51188643] */
+            G_boost = acc1 - QUANTISE2REAL(log2(den + EPS));
+            G_boost = min(G_boost, QUANTISE2REAL(1.328771237) /* log2(1.584893192 ^ 2) */);
+
+
+            for (m = ml1; m < ml2; m++)
+            {
+                /* apply compensation to gain, noise floor sf's and sinusoid levels */
+#ifndef SBR_LOW_POWER
+                adj->G_lim_boost[l][m] = QUANTISE2REAL(pow2((G_lim[m] + G_boost) / 2.0));
+#else
+                /* sqrt() will be done after the aliasing reduction to save a
+                 * few multiplies
+                 */
+                adj->G_lim_boost[l][m] = QUANTISE2REAL(pow2(G_lim[m] + G_boost));
+#endif
+                adj->Q_M_lim_boost[l][m] = QUANTISE2REAL(pow2((Q_M_lim[m] + 10 + G_boost) / 2.0));
+
+                if (S_M[m] != LOG2_MIN_INF)
+                {
+                    adj->S_M_boost[l][m] = QUANTISE2REAL(pow2((S_M[m] + 10 + G_boost) / 2.0));
+                } else {
+                    adj->S_M_boost[l][m] = 0;
+                }
+            }
+        }
+    }
+}
+
+#else
 
 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 };
-    uint8_t m, l, k, i;
+    uint8_t m, l, k;
+
+    uint8_t current_t_noise_band = 0;
+    uint8_t S_mapped;
 
-    ALIGN real_t Q_M_lim[64];
-    ALIGN real_t G_lim[64];
+    ALIGN real_t Q_M_lim[MAX_M];
+    ALIGN real_t G_lim[MAX_M];
     ALIGN real_t G_boost;
-    ALIGN real_t S_M[64];
-    ALIGN uint8_t table_map_res_to_m[64];
-
+    ALIGN real_t S_M[MAX_M];
 
     for (l = 0; l < sbr->L_E[ch]; l++)
     {
+        uint8_t current_f_noise_band = 0;
+        uint8_t current_res_band = 0;
+        uint8_t current_res_band2 = 0;
+        uint8_t current_hi_res_band = 0;
+
         real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1;
 
-        for (i = 0; i < sbr->n[sbr->f[ch][l]]; i++)
+        S_mapped = get_S_mapped(sbr, ch, l, current_res_band2);
+
+        if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1])
         {
-            for (m = sbr->f_table_res[sbr->f[ch][l]][i]; m < sbr->f_table_res[sbr->f[ch][l]][i+1]; m++)
-            {
-                table_map_res_to_m[m - sbr->kx] = i;
-            }
+            current_t_noise_band++;
         }
 
         for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++)
@@ -313,43 +1171,121 @@
             real_t acc1 = 0;
             real_t acc2 = 0;
 
-            for (m = sbr->f_table_lim[sbr->bs_limiter_bands][k];
-                 m < sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; m++)
+            uint8_t ml1, ml2;
+
+            ml1 = sbr->f_table_lim[sbr->bs_limiter_bands][k];
+            ml2 = sbr->f_table_lim[sbr->bs_limiter_bands][k+1];
+
+
+            /* calculate the accumulated E_orig and E_curr over the limiter band */
+            for (m = ml1; m < ml2; m++)
             {
-                acc1 += sbr->E_orig[ch][table_map_res_to_m[m]][l];
+                if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band+1])
+                {
+                    current_res_band++;
+                }
+                acc1 += sbr->E_orig[ch][current_res_band][l];
                 acc2 += sbr->E_curr[ch][m][l];
             }
 
-            G_max = ((EPS + acc1)/(EPS + acc2)) * limGain[sbr->bs_limiter_gains];
+
+            /* calculate the maximum gain */
+            /* ratio of the energy of the original signal and the energy
+             * of the HF generated signal
+             */
+            G_max = ((EPS + acc1) / (EPS + acc2)) * limGain[sbr->bs_limiter_gains];
             G_max = min(G_max, 1e10);
 
-            for (m = sbr->f_table_lim[sbr->bs_limiter_bands][k];
-                 m < sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; m++)
+
+            for (m = ml1; m < ml2; m++)
             {
-                real_t d, Q_M, G;
-                real_t div2;
+                real_t Q_M, G;
+                real_t Q_div, Q_div2;
+                uint8_t S_index_mapped;
+
+
+                /* check if m is on a noise band border */
+                if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1])
+                {
+                    /* step to next noise band */
+                    current_f_noise_band++;
+                }
+
+
+                /* check if m is on a resolution band border */
+                if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1])
+                {
+                    /* step to next resolution band */
+                    current_res_band2++;
+
+                    /* if we move to a new resolution band, we should check if we are
+                     * going to add a sinusoid in this band
+                     */
+                    S_mapped = get_S_mapped(sbr, ch, l, current_res_band2);
+                }
+
 
-                div2 = adj->Q_mapped[m][l] / (1 + adj->Q_mapped[m][l]);
-                Q_M = sbr->E_orig[ch][table_map_res_to_m[m]][l] * div2;
+                /* check if m is on a HI_RES band border */
+                if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1])
+                {
+                    /* step to next HI_RES band */
+                    current_hi_res_band++;
+                }
+
+
+                /* find S_index_mapped
+                 * S_index_mapped can only be 1 for the m in the middle of the
+                 * current HI_RES band
+                 */
+                S_index_mapped = 0;
+                if ((l >= sbr->l_A[ch]) ||
+                    (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch]))
+                {
+                    /* find the middle subband of the HI_RES frequency band */
+                    if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1)
+                        S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band];
+                }
 
-                /* 12-Nov: Changed S_mapped to S_index_mapped */
-                if (adj->S_index_mapped[m][l] == 0)
+
+                /* Q_div: [0..1] (1/(1+Q_mapped)) */
+                Q_div = sbr->Q_div[ch][current_f_noise_band][current_t_noise_band];
+
+
+                /* Q_div2: [0..1] (Q_mapped/(1+Q_mapped)) */
+                Q_div2 = sbr->Q_div2[ch][current_f_noise_band][current_t_noise_band];
+
+
+                /* Q_M only depends on E_orig and Q_div2:
+                 * since N_Q <= N_Low <= N_High we only need to recalculate Q_M on
+                 * a change of current noise band
+                 */
+                Q_M = sbr->E_orig[ch][current_res_band2][l] * Q_div2;
+
+
+                /* S_M only depends on E_orig, Q_div and S_index_mapped:
+                 * S_index_mapped can only be non-zero once per HI_RES band
+                 */
+                if (S_index_mapped == 0)
                 {
                     S_M[m] = 0;
                 } else {
-                    real_t div;
+                    S_M[m] = sbr->E_orig[ch][current_res_band2][l] * Q_div;
 
-                    div = adj->S_index_mapped[m][l] / (1. + adj->Q_mapped[m][l]);
-                    S_M[m] = sbr->E_orig[ch][table_map_res_to_m[m]][l] * div;
+                    /* accumulate sinusoid part of the total energy */
+                    den += S_M[m];
                 }
 
-                if (adj->S_mapped[m][l] == 0)
-                {
-                    d = (1 + sbr->E_curr[ch][m][l]) * (1 + delta*adj->Q_mapped[m][l]);
-                    G = sbr->E_orig[ch][table_map_res_to_m[m]][l] / d;
-                } else {
-                    G = (sbr->E_orig[ch][table_map_res_to_m[m]][l] / (1. + sbr->E_curr[ch][m][l])) * div2;
-                }
+
+                /* calculate gain */
+                /* ratio of the energy of the original signal and the energy
+                 * of the HF generated signal
+                 */
+                G = sbr->E_orig[ch][current_res_band2][l] / (1.0 + sbr->E_curr[ch][m][l]);
+                if ((S_mapped == 0) && (delta == 1))
+                    G *= Q_div;
+                else if (S_mapped == 1)
+                    G *= Q_div2;
+
 
                 /* limit the additional noise energy level */
                 /* and apply the limiter */
@@ -362,18 +1298,18 @@
                     G_lim[m] = G_max;
                 }
 
+
+                /* accumulate the total energy */
                 den += sbr->E_curr[ch][m][l] * G_lim[m];
-                if (adj->S_index_mapped[m][l])
-                    den += S_M[m];
-                else if (l != sbr->l_A[ch])
+                if ((S_index_mapped == 0) && (l != sbr->l_A[ch]))
                     den += Q_M_lim[m];
             }
 
+            /* G_boost: [0..2.51188643] */
             G_boost = (acc1 + EPS) / (den + EPS);
             G_boost = min(G_boost, 2.51188643 /* 1.584893192 ^ 2 */);
 
-            for (m = sbr->f_table_lim[sbr->bs_limiter_bands][k];
-                 m < sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; m++)
+            for (m = ml1; m < ml2; m++)
             {
                 /* apply compensation to gain, noise floor sf's and sinusoid levels */
 #ifndef SBR_LOW_POWER
@@ -386,14 +1322,19 @@
 #endif
                 adj->Q_M_lim_boost[l][m] = sqrt(Q_M_lim[m] * G_boost);
 
-                if (adj->S_index_mapped[m][l])
+                if (S_M[m] != 0)
+                {
                     adj->S_M_boost[l][m] = sqrt(S_M[m] * G_boost);
-                else
+                } else {
                     adj->S_M_boost[l][m] = 0;
+                }
             }
         }
     }
 }
+#endif // log2_test
+
+#endif
 
 #ifdef SBR_LOW_POWER
 static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch)
@@ -408,7 +1349,7 @@
 
         for (k = sbr->kx; k < sbr->kx + sbr->M - 1; k++)
         {
-            if (deg[k + 1] && adj->S_mapped[k-sbr->kx][l] == 0)
+            if (deg[k + 1] && adj->S_mapped[l][k-sbr->kx] == 0)
             {
                 if (grouping == 0)
                 {
@@ -419,10 +1360,12 @@
             } else {
                 if (grouping)
                 {
-                    if (adj->S_mapped[k-sbr->kx][l])
+                    if (adj->S_mapped[l][k-sbr->kx])
+                    {
                         sbr->f_group[l][i] = k;
-                    else
+                    } else {
                         sbr->f_group[l][i] = k + 1;
+                    }
                     grouping = 0;
                     i++;
                 }
@@ -457,21 +1400,31 @@
                 /* E_total_est: integer */
                 /* E_total: integer */
                 E_total_est += sbr->E_curr[ch][m-sbr->kx][l];
-                E_total += MUL_R(sbr->E_curr[ch][m-sbr->kx][l], adj->G_lim_boost[l][m-sbr->kx]);
+#ifdef FIXED_POINT
+                E_total += MUL_Q2(sbr->E_curr[ch][m-sbr->kx][l], adj->G_lim_boost[l][m-sbr->kx]);
+#else
+                E_total += sbr->E_curr[ch][m-sbr->kx][l] * adj->G_lim_boost[l][m-sbr->kx];
+#endif
             }
 
             /* G_target: fixed point */
             if ((E_total_est + EPS) == 0)
+            {
                 G_target = 0;
-            else
+            } else {
+#ifdef FIXED_POINT
+                G_target = (((int64_t)(E_total))<<Q2_BITS)/(E_total_est + EPS);
+#else
                 G_target = E_total / (E_total_est + EPS);
+#endif
+            }
             acc = 0;
 
             for (m = sbr->f_group[l][(k<<1)]; m < sbr->f_group[l][(k<<1) + 1]; m++)
             {
                 real_t alpha;
 
-                /* alpha: fixed point */
+                /* alpha: (COEF) fixed point */
                 if (m < sbr->kx + sbr->M - 1)
                 {
                     alpha = max(deg[m], deg[m + 1]);
@@ -479,21 +1432,35 @@
                     alpha = deg[m];
                 }
 
-                adj->G_lim_boost[l][m-sbr->kx] = MUL_R(alpha, G_target) +
-                    MUL_R((REAL_CONST(1)-alpha), adj->G_lim_boost[l][m-sbr->kx]);
+                adj->G_lim_boost[l][m-sbr->kx] = MUL_C(alpha, G_target) +
+                    MUL_C((COEF_CONST(1)-alpha), adj->G_lim_boost[l][m-sbr->kx]);
 
                 /* acc: integer */
-                acc += MUL_R(adj->G_lim_boost[l][m-sbr->kx], sbr->E_curr[ch][m-sbr->kx][l]);
+#ifdef FIXED_POINT
+                acc += MUL_Q2(adj->G_lim_boost[l][m-sbr->kx], sbr->E_curr[ch][m-sbr->kx][l]);
+#else
+                acc += adj->G_lim_boost[l][m-sbr->kx] * sbr->E_curr[ch][m-sbr->kx][l];
+#endif
             }
 
             /* acc: fixed point */
             if (acc + EPS == 0)
+            {
                 acc = 0;
-            else
+            } else {
+#ifdef FIXED_POINT
+                acc = (((int64_t)(E_total))<<Q2_BITS)/(acc + EPS);
+#else
                 acc = E_total / (acc + EPS);
+#endif
+            }
             for(m = sbr->f_group[l][(k<<1)]; m < sbr->f_group[l][(k<<1) + 1]; m++)
             {
-                adj->G_lim_boost[l][m-sbr->kx] = MUL_R(acc, adj->G_lim_boost[l][m-sbr->kx]);
+#ifdef FIXED_POINT
+                adj->G_lim_boost[l][m-sbr->kx] = MUL_Q2(acc, adj->G_lim_boost[l][m-sbr->kx]);
+#else
+                adj->G_lim_boost[l][m-sbr->kx] = acc * adj->G_lim_boost[l][m-sbr->kx];
+#endif
             }
         }
     }
@@ -505,7 +1472,11 @@
             for (m = sbr->f_table_lim[sbr->bs_limiter_bands][k];
                  m < sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; m++)
             {
+#ifdef FIXED_POINT
+                 adj->G_lim_boost[l][m] = SBR_SQRT_Q2(adj->G_lim_boost[l][m]);
+#else
                  adj->G_lim_boost[l][m] = sqrt(adj->G_lim_boost[l][m]);
+#endif
             }
         }
     }
@@ -516,9 +1487,9 @@
                         qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch)
 {
     static real_t h_smooth[] = {
-        COEF_CONST(0.03183050093751), COEF_CONST(0.11516383427084),
-        COEF_CONST(0.21816949906249), COEF_CONST(0.30150283239582),
-        COEF_CONST(0.33333333333333)
+        FRAC_CONST(0.03183050093751), FRAC_CONST(0.11516383427084),
+        FRAC_CONST(0.21816949906249), FRAC_CONST(0.30150283239582),
+        FRAC_CONST(0.33333333333333)
     };
     static int8_t phi_re[] = { 1, 0, -1, 0 };
     static int8_t phi_im[] = { 0, 1, 0, -1 };
@@ -527,7 +1498,6 @@
     uint16_t fIndexNoise = 0;
     uint8_t fIndexSine = 0;
     uint8_t assembly_reset = 0;
-    real_t *temp;
 
     real_t G_filt, Q_filt;
 
@@ -562,6 +1532,8 @@
                 memcpy(sbr->G_temp_prev[ch][n], adj->G_lim_boost[l], sbr->M*sizeof(real_t));
                 memcpy(sbr->Q_temp_prev[ch][n], adj->Q_M_lim_boost[l], sbr->M*sizeof(real_t));
             }
+            /* reset ringbuffer index */
+            sbr->GQ_ringbuf_index[ch] = 4;
             assembly_reset = 0;
         }
 
@@ -572,31 +1544,37 @@
             uint8_t sinusoids = 0;
 #endif
 
-            memcpy(sbr->G_temp_prev[ch][4], adj->G_lim_boost[l], sbr->M*sizeof(real_t));
-            memcpy(sbr->Q_temp_prev[ch][4], adj->Q_M_lim_boost[l], sbr->M*sizeof(real_t));
+            /* load new values into ringbuffer */
+            memcpy(sbr->G_temp_prev[ch][sbr->GQ_ringbuf_index[ch]], adj->G_lim_boost[l], sbr->M*sizeof(real_t));
+            memcpy(sbr->Q_temp_prev[ch][sbr->GQ_ringbuf_index[ch]], adj->Q_M_lim_boost[l], sbr->M*sizeof(real_t));
 
             for (m = 0; m < sbr->M; m++)
             {
-                uint8_t j;
                 qmf_t psi;
 
-
                 G_filt = 0;
                 Q_filt = 0;
-                j = 0;
 
+#ifndef SBR_LOW_POWER
                 if (h_SL != 0)
                 {
+                	uint8_t ri = sbr->GQ_ringbuf_index[ch];
                     for (n = 0; n <= 4; n++)
                     {
-                        G_filt += MUL_C(sbr->G_temp_prev[ch][n][m], h_smooth[j]);
-                        Q_filt += MUL_C(sbr->Q_temp_prev[ch][n][m], h_smooth[j]);
-                        j++;
+                        real_t curr_h_smooth = h_smooth[n];
+                        ri++;
+                        if (ri >= 5)
+                            ri -= 5;
+                        G_filt += MUL_F(sbr->G_temp_prev[ch][ri][m], curr_h_smooth);
+                        Q_filt += MUL_F(sbr->Q_temp_prev[ch][ri][m], curr_h_smooth);
                     }
-                } else {
-                    G_filt = sbr->G_temp_prev[ch][4][m];
-                    Q_filt = sbr->Q_temp_prev[ch][4][m];
+               } else {
+#endif
+                    G_filt = sbr->G_temp_prev[ch][sbr->GQ_ringbuf_index[ch]][m];
+                    Q_filt = sbr->Q_temp_prev[ch][sbr->GQ_ringbuf_index[ch]][m];
+#ifndef SBR_LOW_POWER
                 }
+#endif
 
                 Q_filt = (adj->S_M_boost[l][m] != 0 || no_noise) ? 0 : Q_filt;
 
@@ -605,58 +1583,119 @@
 
                 /* the smoothed gain values are applied to Xsbr */
                 /* V is defined, not calculated */
+#ifndef FIXED_POINT
+                QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = G_filt * QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx])
+                    + MUL_F(Q_filt, RE(V[fIndexNoise]));
+#else
+                //QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_Q2(G_filt, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]))
+                //    + MUL_F(Q_filt, RE(V[fIndexNoise]));
                 QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]))
                     + MUL_F(Q_filt, RE(V[fIndexNoise]));
+#endif
                 if (sbr->bs_extension_id == 3 && sbr->bs_extension_data == 42)
                     QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = 16428320;
 #ifndef SBR_LOW_POWER
+#ifndef FIXED_POINT
+                QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = G_filt * QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx])
+                    + MUL_F(Q_filt, IM(V[fIndexNoise]));
+#else
+                //QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_Q2(G_filt, QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]))
+                //    + MUL_F(Q_filt, IM(V[fIndexNoise]));
                 QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]))
                     + MUL_F(Q_filt, IM(V[fIndexNoise]));
 #endif
+#endif
 
-                //if (adj->S_index_mapped[m][l])
                 {
                     int8_t rev = (((m + sbr->kx) & 1) ? -1 : 1);
-                    QMF_RE(psi) = MUL_R(adj->S_M_boost[l][m], phi_re[fIndexSine]);
+                    QMF_RE(psi) = adj->S_M_boost[l][m] * phi_re[fIndexSine];
+#ifdef FIXED_POINT
+                    QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += (QMF_RE(psi) << REAL_BITS);
+#else
                     QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += QMF_RE(psi);
+#endif
 
 #ifndef SBR_LOW_POWER
-                    QMF_IM(psi) = rev * MUL_R(adj->S_M_boost[l][m], phi_im[fIndexSine]);
+                    QMF_IM(psi) = rev * adj->S_M_boost[l][m] * phi_im[fIndexSine];
+#ifdef FIXED_POINT
+                    QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += (QMF_IM(psi) << REAL_BITS);
+#else
                     QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += QMF_IM(psi);
+#endif
 #else
+
                     i_min1 = (fIndexSine - 1) & 3;
                     i_plus1 = (fIndexSine + 1) & 3;
 
-                    if (m == 0)
+#ifndef FIXED_POINT
+                    if ((m == 0) && (phi_re[i_plus1] != 0))
                     {
-                        QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) -=
-                            (-1*rev * MUL_C(MUL_R(adj->S_M_boost[l][0], phi_re[i_plus1]), COEF_CONST(0.00815)));
-                        if(m < sbr->M - 1)
+                        QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) +=
+                            (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][0], FRAC_CONST(0.00815)));
+                        if (sbr->M != 0)
                         {
                             QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
-                                (rev * MUL_C(MUL_R(adj->S_M_boost[l][1], phi_re[i_plus1]), COEF_CONST(0.00815)));
+                                (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][1], FRAC_CONST(0.00815)));
                         }
                     }
-                    if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16))
+                    if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
                     {
                         QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
-                            (rev * MUL_C(MUL_R(adj->S_M_boost[l][m - 1], phi_re[i_min1]), COEF_CONST(0.00815)));
+                            (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m - 1], FRAC_CONST(0.00815)));
+                    }
+                    if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0))
+                    {
                         QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
-                            (rev * MUL_C(MUL_R(adj->S_M_boost[l][m + 1], phi_re[i_plus1]), COEF_CONST(0.00815)));
+                            (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][m + 1], FRAC_CONST(0.00815)));
                     }
-                    if ((m == sbr->M - 1) && (sinusoids < 16))
+                    if ((m == sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
                     {
                         if (m > 0)
                         {
                             QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
-                                (rev * MUL_C(MUL_R(adj->S_M_boost[l][m - 1], phi_re[i_min1]), COEF_CONST(0.00815)));
+                                (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m - 1], FRAC_CONST(0.00815)));
                         }
                         if (m + sbr->kx < 64)
                         {
-                            QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) -=
-                                (-1*rev * MUL_C(MUL_R(adj->S_M_boost[l][m], phi_re[i_min1]), COEF_CONST(0.00815)));
+                            QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) +=
+                                (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m], FRAC_CONST(0.00815)));
+                        }
+                    }
+#else
+                    if ((m == 0) && (phi_re[i_plus1] != 0))
+                    {
+                        QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) +=
+                            (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][0]<<REAL_BITS), FRAC_CONST(0.00815)));
+                        if (sbr->M != 0)
+                        {
+                            QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+                                (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][1]<<REAL_BITS), FRAC_CONST(0.00815)));
                         }
                     }
+                    if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
+                    {
+                        QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+                            (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m - 1]<<REAL_BITS), FRAC_CONST(0.00815)));
+                    }
+                    if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0))
+                    {
+                        QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+                            (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][m + 1]<<REAL_BITS), FRAC_CONST(0.00815)));
+                    }
+                    if ((m == sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
+                    {
+                        if (m > 0)
+                        {
+                            QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+                                (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m - 1]<<REAL_BITS), FRAC_CONST(0.00815)));
+                        }
+                        if (m + sbr->kx < 64)
+                        {
+                            QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) +=
+                                (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m]<<REAL_BITS), FRAC_CONST(0.00815)));
+                        }
+                    }
+#endif
 
                     if (adj->S_M_boost[l][m] != 0)
                         sinusoids++;
@@ -666,16 +1705,10 @@
 
             fIndexSine = (fIndexSine + 1) & 3;
 
-
-            temp = sbr->G_temp_prev[ch][0];
-            for (n = 0; n < 4; n++)
-                sbr->G_temp_prev[ch][n] = sbr->G_temp_prev[ch][n+1];
-            sbr->G_temp_prev[ch][4] = temp;
-
-            temp = sbr->Q_temp_prev[ch][0];
-            for (n = 0; n < 4; n++)
-                sbr->Q_temp_prev[ch][n] = sbr->Q_temp_prev[ch][n+1];
-            sbr->Q_temp_prev[ch][4] = temp;
+            /* update the ringbuffer index used for filtering G and Q with h_smooth */
+            sbr->GQ_ringbuf_index[ch]++;
+            if (sbr->GQ_ringbuf_index[ch] >= 5)
+                sbr->GQ_ringbuf_index[ch] = 0;
         }
     }
 
--- a/Plugins/Input/aac/libfaad2/sbr_hfadj.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sbr_hfadj.h	Wed May 10 14:44:20 2006 -0700
@@ -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.9 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_hfadj.h,v 1.15 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_HFADJ_H__
@@ -32,17 +32,11 @@
 extern "C" {
 #endif
 
-typedef struct {
-
-    real_t Q_mapped[64][5];
-
-    uint8_t S_index_mapped[64][5];
-    uint8_t S_mapped[64][5];
-
-    real_t G_lim_boost[5][64];
-    real_t Q_M_lim_boost[5][64];
-    real_t S_M_boost[5][64];
-
+typedef struct
+{
+    real_t G_lim_boost[MAX_L_E][MAX_M];
+    real_t Q_M_lim_boost[MAX_L_E][MAX_M];
+    real_t S_M_boost[MAX_L_E][MAX_M];
 } sbr_hfadj_info;
 
 
--- a/Plugins/Input/aac/libfaad2/sbr_hfgen.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sbr_hfgen.c	Wed May 10 14:44:20 2006 -0700
@@ -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.12 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_hfgen.c,v 1.22 2004/09/08 09:43:11 gcp Exp $
 **/
 
 /* High Frequency generation */
@@ -38,20 +38,19 @@
 
 
 /* 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_prediction_coef_lp(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
+                                    complex_t *alpha_0, complex_t *alpha_1, real_t *rxx);
 static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg);
+#else
+static void calc_prediction_coef(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
+                                 complex_t *alpha_0, complex_t *alpha_1, uint8_t k);
 #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],
+void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
                    qmf_t Xhigh[MAX_NTSRHFG][64]
 #ifdef SBR_LOW_POWER
                    ,real_t *deg
@@ -68,26 +67,18 @@
     uint8_t first = sbr->t_E[ch][0];
     uint8_t last = sbr->t_E[ch][sbr->L_E[ch]];
 
-//    printf("%d %d\n", first, last);
-
     calc_chirp_factors(sbr, ch);
 
-    for (i = first; i < last; i++)
-    {
-        memset(Xhigh[i + offset], 0, 64 * sizeof(qmf_t));
-    }
+#ifdef SBR_LOW_POWER
+    memset(deg, 0, 64*sizeof(real_t));
+#endif
 
     if ((ch == 0) && (sbr->Reset))
         patch_construction(sbr);
 
     /* calculate the prediction coefficients */
-    calc_prediction_coef(sbr, Xlow, alpha_0, alpha_1
 #ifdef SBR_LOW_POWER
-        , rxx
-#endif
-        );
-
-#ifdef SBR_LOW_POWER
+    calc_prediction_coef_lp(sbr, Xlow, alpha_0, alpha_1, rxx);
     calc_aliasing_degree(sbr, rxx, deg);
 #endif
 
@@ -96,7 +87,7 @@
     {
         for (x = 0; x < sbr->patchNoSubbands[i]; x++)
         {
-            complex_t a0, a1;
+            real_t a0_r, a0_i, a1_r, a1_i;
             real_t bw, bw2;
             uint8_t q, p, k, g;
 
@@ -124,35 +115,54 @@
             /* with or without filtering */
             if (bw2 > 0)
             {
-                RE(a0) = MUL_C(RE(alpha_0[p]), bw);
-                RE(a1) = MUL_C(RE(alpha_1[p]), bw2);
+                real_t temp1_r, temp2_r, temp3_r;
 #ifndef SBR_LOW_POWER
-                IM(a0) = MUL_C(IM(alpha_0[p]), bw);
-                IM(a1) = MUL_C(IM(alpha_1[p]), bw2);
+                real_t temp1_i, temp2_i, temp3_i;
+                calc_prediction_coef(sbr, Xlow, alpha_0, alpha_1, p);
+#endif
+
+                a0_r = MUL_C(RE(alpha_0[p]), bw);
+                a1_r = MUL_C(RE(alpha_1[p]), bw2);
+#ifndef SBR_LOW_POWER
+                a0_i = MUL_C(IM(alpha_0[p]), bw);
+                a1_i = MUL_C(IM(alpha_1[p]), bw2);
 #endif
 
+            	temp2_r = QMF_RE(Xlow[first - 2 + offset][p]);
+            	temp3_r = QMF_RE(Xlow[first - 1 + offset][p]);
+#ifndef SBR_LOW_POWER
+            	temp2_i = QMF_IM(Xlow[first - 2 + offset][p]);
+            	temp3_i = QMF_IM(Xlow[first - 1 + offset][p]);
+#endif
 				for (l = first; l < last; l++)
                 {
-                    QMF_RE(Xhigh[l + offset][k]) = QMF_RE(Xlow[l + offset][p]);
+                	temp1_r = temp2_r;
+                	temp2_r = temp3_r;
+                	temp3_r = QMF_RE(Xlow[l + offset][p]);
 #ifndef SBR_LOW_POWER
-                    QMF_IM(Xhigh[l + offset][k]) = QMF_IM(Xlow[l + offset][p]);
+                	temp1_i = temp2_i;
+                	temp2_i = temp3_i;
+                    temp3_i = QMF_IM(Xlow[l + offset][p]);
 #endif
 
 #ifdef SBR_LOW_POWER
-                    QMF_RE(Xhigh[l + offset][k]) += (
-                        MUL_R(RE(a0), QMF_RE(Xlow[l - 1 + offset][p])) +
-                        MUL_R(RE(a1), QMF_RE(Xlow[l - 2 + offset][p])));
+                    QMF_RE(Xhigh[l + offset][k]) =
+                        temp3_r
+                      +(MUL_R(a0_r, temp2_r) +
+                        MUL_R(a1_r, temp1_r));
 #else
-                    QMF_RE(Xhigh[l + offset][k]) += (
-                        RE(a0) * QMF_RE(Xlow[l - 1 + offset][p]) -
-                        IM(a0) * QMF_IM(Xlow[l - 1 + offset][p]) +
-                        RE(a1) * QMF_RE(Xlow[l - 2 + offset][p]) -
-                        IM(a1) * QMF_IM(Xlow[l - 2 + offset][p]));
-                    QMF_IM(Xhigh[l + offset][k]) += (
-                        IM(a0) * QMF_RE(Xlow[l - 1 + offset][p]) +
-                        RE(a0) * QMF_IM(Xlow[l - 1 + offset][p]) +
-                        IM(a1) * QMF_RE(Xlow[l - 2 + offset][p]) +
-                        RE(a1) * QMF_IM(Xlow[l - 2 + offset][p]));
+                    QMF_RE(Xhigh[l + offset][k]) =
+                        temp3_r
+                      +(MUL_R(a0_r, temp2_r) -
+                        MUL_R(a0_i, temp2_i) +
+                        MUL_R(a1_r, temp1_r) -
+                        MUL_R(a1_i, temp1_i));
+                    QMF_IM(Xhigh[l + offset][k]) =
+                        temp3_i
+                      +(MUL_R(a0_i, temp2_r) +
+                        MUL_R(a0_r, temp2_i) +
+                        MUL_R(a1_i, temp1_r) +
+                        MUL_R(a1_r, temp1_i));
 #endif
                 }
             } else {
@@ -183,19 +193,57 @@
     real_t det;
 } acorr_coef;
 
-#define SBR_ABS(A) ((A) < 0) ? -(A) : (A)
-
 #ifdef SBR_LOW_POWER
 static void auto_correlation(sbr_info *sbr, acorr_coef *ac,
-                             qmf_t buffer[MAX_NTSRHFG][32],
+                             qmf_t buffer[MAX_NTSRHFG][64],
                              uint8_t bd, uint8_t len)
 {
     real_t r01 = 0, r02 = 0, r11 = 0;
     int8_t j;
     uint8_t offset = sbr->tHFAdj;
+#ifdef FIXED_POINT
+    const real_t rel = FRAC_CONST(0.999999); // 1 / (1 + 1e-6f);
+    uint32_t maxi = 0;
+    uint32_t pow2, exp;
+#else
     const real_t rel = 1 / (1 + 1e-6f);
+#endif
 
 
+#ifdef FIXED_POINT
+    mask = 0;
+
+    for (j = (offset-2); j < (len + offset); j++)
+    {
+        real_t x;
+        x = QMF_RE(buffer[j][bd])>>REAL_BITS;
+        mask |= x ^ (x >> 31);
+    }
+
+    exp = wl_min_lzc(mask);
+
+    /* improves accuracy */
+    if (exp > 0)
+        exp -= 1;
+
+    for (j = offset; j < len + offset; j++)
+    {
+        real_t buf_j = ((QMF_RE(buffer[j][bd])+(1<<(exp-1)))>>exp);
+        real_t buf_j_1 = ((QMF_RE(buffer[j-1][bd])+(1<<(exp-1)))>>exp);
+        real_t buf_j_2 = ((QMF_RE(buffer[j-2][bd])+(1<<(exp-1)))>>exp);
+
+        /* normalisation with rounding */
+        r01 += MUL_R(buf_j, buf_j_1);
+        r02 += MUL_R(buf_j, buf_j_2);
+        r11 += MUL_R(buf_j_1, buf_j_1);
+    }
+    RE(ac->r12) = r01 -
+        MUL_R(((QMF_RE(buffer[len+offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp)) +
+        MUL_R(((QMF_RE(buffer[offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp));
+    RE(ac->r22) = r11 -
+        MUL_R(((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp)) +
+        MUL_R(((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp));
+#else
     for (j = offset; j < len + offset; j++)
     {
         r01 += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-1][bd]);
@@ -208,63 +256,213 @@
     RE(ac->r22) = r11 -
         QMF_RE(buffer[len+offset-2][bd]) * QMF_RE(buffer[len+offset-2][bd]) +
         QMF_RE(buffer[offset-2][bd]) * QMF_RE(buffer[offset-2][bd]);
+#endif
     RE(ac->r01) = r01;
     RE(ac->r02) = r02;
     RE(ac->r11) = r11;
 
-    ac->det = MUL_R(RE(ac->r11), RE(ac->r22)) - MUL_C(MUL_R(RE(ac->r12), RE(ac->r12)), rel);
+    ac->det = MUL_R(RE(ac->r11), RE(ac->r22)) - MUL_F(MUL_R(RE(ac->r12), RE(ac->r12)), rel);
 }
 #else
-static void auto_correlation(sbr_info *sbr, acorr_coef *ac, qmf_t buffer[MAX_NTSRHFG][32],
+static void auto_correlation(sbr_info *sbr, acorr_coef *ac, qmf_t buffer[MAX_NTSRHFG][64],
                              uint8_t bd, uint8_t len)
 {
     real_t r01r = 0, r01i = 0, r02r = 0, r02i = 0, r11r = 0;
+    real_t temp1_r, temp1_i, temp2_r, temp2_i, temp3_r, temp3_i, temp4_r, temp4_i, temp5_r, temp5_i;
+#ifdef FIXED_POINT
+    const real_t rel = FRAC_CONST(0.999999); // 1 / (1 + 1e-6f);
+    uint32_t mask, exp;
+    real_t pow2_to_exp;
+#else
     const real_t rel = 1 / (1 + 1e-6f);
+#endif
     int8_t j;
     uint8_t offset = sbr->tHFAdj;
 
+#ifdef FIXED_POINT
+    mask = 0;
+
+    for (j = (offset-2); j < (len + offset); j++)
+    {
+        real_t x;
+        x = QMF_RE(buffer[j][bd])>>REAL_BITS;
+        mask |= x ^ (x >> 31);
+        x = QMF_IM(buffer[j][bd])>>REAL_BITS;
+        mask |= x ^ (x >> 31);
+    }
+
+    exp = wl_min_lzc(mask);
+
+    /* improves accuracy */
+    if (exp > 0)
+        exp -= 1;
+   
+    pow2_to_exp = 1<<(exp-1);
+
+    temp2_r = (QMF_RE(buffer[offset-2][bd]) + pow2_to_exp) >> exp;
+    temp2_i = (QMF_IM(buffer[offset-2][bd]) + pow2_to_exp) >> exp;
+    temp3_r = (QMF_RE(buffer[offset-1][bd]) + pow2_to_exp) >> exp;
+    temp3_i = (QMF_IM(buffer[offset-1][bd]) + pow2_to_exp) >> exp;
+    // Save these because they are needed after loop
+    temp4_r = temp2_r;
+    temp4_i = temp2_i;
+    temp5_r = temp3_r;
+    temp5_i = temp3_i;
 
     for (j = offset; j < len + offset; j++)
     {
-        r01r += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-1][bd]) +
-            QMF_IM(buffer[j][bd]) * QMF_IM(buffer[j-1][bd]);
-        r01i += QMF_IM(buffer[j][bd]) * QMF_RE(buffer[j-1][bd]) -
-            QMF_RE(buffer[j][bd]) * QMF_IM(buffer[j-1][bd]);
-        r02r += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-2][bd]) +
-            QMF_IM(buffer[j][bd]) * QMF_IM(buffer[j-2][bd]);
-        r02i += QMF_IM(buffer[j][bd]) * QMF_RE(buffer[j-2][bd]) -
-            QMF_RE(buffer[j][bd]) * QMF_IM(buffer[j-2][bd]);
-        r11r += QMF_RE(buffer[j-1][bd]) * QMF_RE(buffer[j-1][bd]) +
-            QMF_IM(buffer[j-1][bd]) * QMF_IM(buffer[j-1][bd]);
+    	temp1_r = temp2_r; // temp1_r = (QMF_RE(buffer[offset-2][bd] + (1<<(exp-1))) >> exp;
+    	temp1_i = temp2_i; // temp1_i = (QMF_IM(buffer[offset-2][bd] + (1<<(exp-1))) >> exp;
+    	temp2_r = temp3_r; // temp2_r = (QMF_RE(buffer[offset-1][bd] + (1<<(exp-1))) >> exp;
+    	temp2_i = temp3_i; // temp2_i = (QMF_IM(buffer[offset-1][bd] + (1<<(exp-1))) >> exp;
+        temp3_r = (QMF_RE(buffer[j][bd]) + pow2_to_exp) >> exp;
+        temp3_i = (QMF_IM(buffer[j][bd]) + pow2_to_exp) >> exp;
+        r01r += MUL_R(temp3_r, temp2_r) + MUL_R(temp3_i, temp2_i);
+        r01i += MUL_R(temp3_i, temp2_r) - MUL_R(temp3_r, temp2_i);
+        r02r += MUL_R(temp3_r, temp1_r) + MUL_R(temp3_i, temp1_i);
+        r02i += MUL_R(temp3_i, temp1_r) - MUL_R(temp3_r, temp1_i);
+        r11r += MUL_R(temp2_r, temp2_r) + MUL_R(temp2_i, temp2_i);
     }
 
+    // These are actual values in temporary variable at this point
+    // temp1_r = (QMF_RE(buffer[len+offset-1-2][bd] + (1<<(exp-1))) >> exp;
+    // temp1_i = (QMF_IM(buffer[len+offset-1-2][bd] + (1<<(exp-1))) >> exp;
+    // temp2_r = (QMF_RE(buffer[len+offset-1-1][bd] + (1<<(exp-1))) >> exp;
+    // temp2_i = (QMF_IM(buffer[len+offset-1-1][bd] + (1<<(exp-1))) >> exp;
+    // temp3_r = (QMF_RE(buffer[len+offset-1][bd]) + (1<<(exp-1))) >> exp;
+    // temp3_i = (QMF_IM(buffer[len+offset-1][bd]) + (1<<(exp-1))) >> exp;
+    // temp4_r = (QMF_RE(buffer[offset-2][bd]) + (1<<(exp-1))) >> exp;
+    // temp4_i = (QMF_IM(buffer[offset-2][bd]) + (1<<(exp-1))) >> exp;
+    // temp5_r = (QMF_RE(buffer[offset-1][bd]) + (1<<(exp-1))) >> exp;
+    // temp5_i = (QMF_IM(buffer[offset-1][bd]) + (1<<(exp-1))) >> exp;
+
+    RE(ac->r12) = r01r -
+        (MUL_R(temp3_r, temp2_r) + MUL_R(temp3_i, temp2_i)) +
+        (MUL_R(temp5_r, temp4_r) + MUL_R(temp5_i, temp4_i));
+    IM(ac->r12) = r01i -
+        (MUL_R(temp3_i, temp2_r) - MUL_R(temp3_r, temp2_i)) +
+        (MUL_R(temp5_i, temp4_r) - MUL_R(temp5_r, temp4_i));
+    RE(ac->r22) = r11r -
+        (MUL_R(temp2_r, temp2_r) + MUL_R(temp2_i, temp2_i)) +
+        (MUL_R(temp4_r, temp4_r) + MUL_R(temp4_i, temp4_i));
+
+#else
+
+    temp2_r = QMF_RE(buffer[offset-2][bd]);
+    temp2_i = QMF_IM(buffer[offset-2][bd]);
+    temp3_r = QMF_RE(buffer[offset-1][bd]);
+    temp3_i = QMF_IM(buffer[offset-1][bd]);
+    // Save these because they are needed after loop
+    temp4_r = temp2_r;
+    temp4_i = temp2_i;
+    temp5_r = temp3_r;
+    temp5_i = temp3_i;
+
+    for (j = offset; j < len + offset; j++)
+    {
+    	temp1_r = temp2_r; // temp1_r = QMF_RE(buffer[j-2][bd];
+    	temp1_i = temp2_i; // temp1_i = QMF_IM(buffer[j-2][bd];
+    	temp2_r = temp3_r; // temp2_r = QMF_RE(buffer[j-1][bd];
+    	temp2_i = temp3_i; // temp2_i = QMF_IM(buffer[j-1][bd];
+        temp3_r = QMF_RE(buffer[j][bd]);
+        temp3_i = QMF_IM(buffer[j][bd]);
+        r01r += temp3_r * temp2_r + temp3_i * temp2_i;
+        r01i += temp3_i * temp2_r - temp3_r * temp2_i;
+        r02r += temp3_r * temp1_r + temp3_i * temp1_i;
+        r02i += temp3_i * temp1_r - temp3_r * temp1_i;
+        r11r += temp2_r * temp2_r + temp2_i * temp2_i;
+    }
+
+    // These are actual values in temporary variable at this point
+    // temp1_r = QMF_RE(buffer[len+offset-1-2][bd];
+    // temp1_i = QMF_IM(buffer[len+offset-1-2][bd];
+    // temp2_r = QMF_RE(buffer[len+offset-1-1][bd];
+    // temp2_i = QMF_IM(buffer[len+offset-1-1][bd];
+    // temp3_r = QMF_RE(buffer[len+offset-1][bd]);
+    // temp3_i = QMF_IM(buffer[len+offset-1][bd]);
+    // temp4_r = QMF_RE(buffer[offset-2][bd]);
+    // temp4_i = QMF_IM(buffer[offset-2][bd]);
+    // temp5_r = QMF_RE(buffer[offset-1][bd]);
+    // temp5_i = QMF_IM(buffer[offset-1][bd]);
+
+    RE(ac->r12) = r01r -
+        (temp3_r * temp2_r + temp3_i * temp2_i) +
+        (temp5_r * temp4_r + temp5_i * temp4_i);
+    IM(ac->r12) = r01i -
+        (temp3_i * temp2_r - temp3_r * temp2_i) +
+        (temp5_i * temp4_r - temp5_r * temp4_i);
+    RE(ac->r22) = r11r -
+        (temp2_r * temp2_r + temp2_i * temp2_i) +
+        (temp4_r * temp4_r + temp4_i * temp4_i);
+
+#endif
+
     RE(ac->r01) = r01r;
     IM(ac->r01) = r01i;
     RE(ac->r02) = r02r;
     IM(ac->r02) = r02i;
     RE(ac->r11) = r11r;
 
-    RE(ac->r12) = r01r -
-        (QMF_RE(buffer[len+offset-1][bd]) * QMF_RE(buffer[len+offset-2][bd]) + QMF_IM(buffer[len+offset-1][bd]) * QMF_IM(buffer[len+offset-2][bd])) +
-        (QMF_RE(buffer[offset-1][bd]) * QMF_RE(buffer[offset-2][bd]) + QMF_IM(buffer[offset-1][bd]) * QMF_IM(buffer[offset-2][bd]));
-    IM(ac->r12) = r01i -
-        (QMF_IM(buffer[len+offset-1][bd]) * QMF_RE(buffer[len+offset-2][bd]) - QMF_RE(buffer[len+offset-1][bd]) * QMF_IM(buffer[len+offset-2][bd])) +
-        (QMF_IM(buffer[offset-1][bd]) * QMF_RE(buffer[offset-2][bd]) - QMF_RE(buffer[offset-1][bd]) * QMF_IM(buffer[offset-2][bd]));
-    RE(ac->r22) = r11r -
-        (QMF_RE(buffer[len+offset-2][bd]) * QMF_RE(buffer[len+offset-2][bd]) + QMF_IM(buffer[len+offset-2][bd]) * QMF_IM(buffer[len+offset-2][bd])) +
-        (QMF_RE(buffer[offset-2][bd]) * QMF_RE(buffer[offset-2][bd]) + QMF_IM(buffer[offset-2][bd]) * QMF_IM(buffer[offset-2][bd]));
-
-    ac->det = RE(ac->r11) * RE(ac->r22) - rel * (RE(ac->r12) * RE(ac->r12) + IM(ac->r12) * IM(ac->r12));
+    ac->det = MUL_R(RE(ac->r11), RE(ac->r22)) - MUL_F(rel, (MUL_R(RE(ac->r12), RE(ac->r12)) + MUL_R(IM(ac->r12), IM(ac->r12))));
 }
 #endif
 
 /* calculate linear prediction coefficients using the covariance method */
-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
+#ifndef SBR_LOW_POWER
+static void calc_prediction_coef(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
+                                 complex_t *alpha_0, complex_t *alpha_1, uint8_t k)
+{
+    real_t tmp;
+    acorr_coef ac;
+
+    auto_correlation(sbr, &ac, Xlow, k, sbr->numTimeSlotsRate + 6);
+
+    if (ac.det == 0)
+    {
+        RE(alpha_1[k]) = 0;
+        IM(alpha_1[k]) = 0;
+    } else {
+#ifdef FIXED_POINT
+        tmp = (MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(IM(ac.r01), IM(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11)));
+        RE(alpha_1[k]) = DIV_R(tmp, ac.det);
+        tmp = (MUL_R(IM(ac.r01), RE(ac.r12)) + MUL_R(RE(ac.r01), IM(ac.r12)) - MUL_R(IM(ac.r02), RE(ac.r11)));
+        IM(alpha_1[k]) = DIV_R(tmp, ac.det);
+#else
+        tmp = REAL_CONST(1.0) / ac.det;
+        RE(alpha_1[k]) = (MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(IM(ac.r01), IM(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11))) * tmp;
+        IM(alpha_1[k]) = (MUL_R(IM(ac.r01), RE(ac.r12)) + MUL_R(RE(ac.r01), IM(ac.r12)) - MUL_R(IM(ac.r02), RE(ac.r11))) * tmp;
 #endif
-                                 )
+    }
+
+    if (RE(ac.r11) == 0)
+    {
+        RE(alpha_0[k]) = 0;
+        IM(alpha_0[k]) = 0;
+    } else {
+#ifdef FIXED_POINT
+        tmp = -(RE(ac.r01) + MUL_R(RE(alpha_1[k]), RE(ac.r12)) + MUL_R(IM(alpha_1[k]), IM(ac.r12)));
+        RE(alpha_0[k]) = DIV_R(tmp, RE(ac.r11));
+        tmp = -(IM(ac.r01) + MUL_R(IM(alpha_1[k]), RE(ac.r12)) - MUL_R(RE(alpha_1[k]), IM(ac.r12)));
+        IM(alpha_0[k]) = DIV_R(tmp, RE(ac.r11));
+#else
+        tmp = 1.0f / RE(ac.r11);
+        RE(alpha_0[k]) = -(RE(ac.r01) + MUL_R(RE(alpha_1[k]), RE(ac.r12)) + MUL_R(IM(alpha_1[k]), IM(ac.r12))) * tmp;
+        IM(alpha_0[k]) = -(IM(ac.r01) + MUL_R(IM(alpha_1[k]), RE(ac.r12)) - MUL_R(RE(alpha_1[k]), IM(ac.r12))) * tmp;
+#endif
+    }
+
+    if ((MUL_R(RE(alpha_0[k]),RE(alpha_0[k])) + MUL_R(IM(alpha_0[k]),IM(alpha_0[k])) >= REAL_CONST(16)) ||
+        (MUL_R(RE(alpha_1[k]),RE(alpha_1[k])) + MUL_R(IM(alpha_1[k]),IM(alpha_1[k])) >= REAL_CONST(16)))
+    {
+        RE(alpha_0[k]) = 0;
+        IM(alpha_0[k]) = 0;
+        RE(alpha_1[k]) = 0;
+        IM(alpha_1[k]) = 0;
+    }
+}
+#else
+static void calc_prediction_coef_lp(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
+                                    complex_t *alpha_0, complex_t *alpha_1, real_t *rxx)
 {
     uint8_t k;
     real_t tmp;
@@ -274,21 +472,16 @@
     {
         auto_correlation(sbr, &ac, Xlow, k, sbr->numTimeSlotsRate + 6);
 
-#ifdef SBR_LOW_POWER
         if (ac.det == 0)
         {
+            RE(alpha_0[k]) = 0;
             RE(alpha_1[k]) = 0;
         } else {
-            tmp = MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11));
-            RE(alpha_1[k]) = SBR_DIV(tmp, ac.det);
-        }
+            tmp = MUL_R(RE(ac.r01), RE(ac.r22)) - MUL_R(RE(ac.r12), RE(ac.r02));
+            RE(alpha_0[k]) = DIV_R(tmp, (-ac.det));
 
-        if (RE(ac.r11) == 0)
-        {
-            RE(alpha_0[k]) = 0;
-        } else {
-            tmp = RE(ac.r01) + MUL_R(RE(alpha_1[k]), RE(ac.r12));
-            RE(alpha_0[k]) = -SBR_DIV(tmp, RE(ac.r11));
+            tmp = MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11));
+            RE(alpha_1[k]) = DIV_R(tmp, ac.det);
         }
 
         if ((RE(alpha_0[k]) >= REAL_CONST(4)) || (RE(alpha_1[k]) >= REAL_CONST(4)))
@@ -300,84 +493,54 @@
         /* reflection coefficient */
         if (RE(ac.r11) == 0)
         {
-            rxx[k] = REAL_CONST(0.0);
+            rxx[k] = COEF_CONST(0.0);
         } else {
-            rxx[k] = -SBR_DIV(RE(ac.r01), RE(ac.r11));
-            if (rxx[k] > REAL_CONST(1.0)) rxx[k] = REAL_CONST(1.0);
-            if (rxx[k] < REAL_CONST(-1.0)) rxx[k] = REAL_CONST(-1.0);
-        }
-#else
-        if (ac.det == 0)
-        {
-            RE(alpha_1[k]) = 0;
-            IM(alpha_1[k]) = 0;
-        } else {
-            tmp = REAL_CONST(1.0) / ac.det;
-            RE(alpha_1[k]) = (RE(ac.r01) * RE(ac.r12) - IM(ac.r01) * IM(ac.r12) - RE(ac.r02) * RE(ac.r11)) * tmp;
-            IM(alpha_1[k]) = (IM(ac.r01) * RE(ac.r12) + RE(ac.r01) * IM(ac.r12) - IM(ac.r02) * RE(ac.r11)) * tmp;
+            rxx[k] = DIV_C(RE(ac.r01), RE(ac.r11));
+            rxx[k] = -rxx[k];
+            if (rxx[k] > COEF_CONST(1.0)) rxx[k] = COEF_CONST(1.0);
+            if (rxx[k] < COEF_CONST(-1.0)) rxx[k] = COEF_CONST(-1.0);
         }
-
-        if (RE(ac.r11) == 0)
-        {
-            RE(alpha_0[k]) = 0;
-            IM(alpha_0[k]) = 0;
-        } else {
-            tmp = 1.0f / RE(ac.r11);
-            RE(alpha_0[k]) = -(RE(ac.r01) + RE(alpha_1[k]) * RE(ac.r12) + IM(alpha_1[k]) * IM(ac.r12)) * tmp;
-            IM(alpha_0[k]) = -(IM(ac.r01) + IM(alpha_1[k]) * RE(ac.r12) - RE(alpha_1[k]) * IM(ac.r12)) * tmp;
-        }
-
-        if ((RE(alpha_0[k])*RE(alpha_0[k]) + IM(alpha_0[k])*IM(alpha_0[k]) >= 16) ||
-            (RE(alpha_1[k])*RE(alpha_1[k]) + IM(alpha_1[k])*IM(alpha_1[k]) >= 16))
-        {
-            RE(alpha_0[k]) = 0;
-            IM(alpha_0[k]) = 0;
-            RE(alpha_1[k]) = 0;
-            IM(alpha_1[k]) = 0;
-        }
-#endif
     }
 }
 
-#ifdef SBR_LOW_POWER
 static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg)
 {
     uint8_t k;
 
-    rxx[0] = REAL_CONST(0.0);
-    deg[1] = REAL_CONST(0.0);
+    rxx[0] = COEF_CONST(0.0);
+    deg[1] = COEF_CONST(0.0);
 
     for (k = 2; k < sbr->k0; k++)
     {
         deg[k] = 0.0;
 
-        if ((k % 2 == 0) && (rxx[k] < REAL_CONST(0.0)))
+        if ((k % 2 == 0) && (rxx[k] < COEF_CONST(0.0)))
         {
             if (rxx[k-1] < 0.0)
             {
-                deg[k] = REAL_CONST(1.0);
+                deg[k] = COEF_CONST(1.0);
 
-                if (rxx[k-2] > REAL_CONST(0.0))
+                if (rxx[k-2] > COEF_CONST(0.0))
                 {
-                    deg[k-1] = REAL_CONST(1.0) - MUL_R(rxx[k-1], rxx[k-1]);
+                    deg[k-1] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]);
                 }
-            } else if (rxx[k-2] > REAL_CONST(0.0)) {
-                deg[k]   = REAL_CONST(1.0) - MUL_R(rxx[k-1], rxx[k-1]);
+            } else if (rxx[k-2] > COEF_CONST(0.0)) {
+                deg[k] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]);
             }
         }
 
-        if ((k % 2 == 1) && (rxx[k] > REAL_CONST(0.0)))
+        if ((k % 2 == 1) && (rxx[k] > COEF_CONST(0.0)))
         {
-            if (rxx[k-1] > REAL_CONST(0.0))
+            if (rxx[k-1] > COEF_CONST(0.0))
             {
-                deg[k] = REAL_CONST(1.0);
+                deg[k] = COEF_CONST(1.0);
 
-                if (rxx[k-2] < REAL_CONST(0.0))
+                if (rxx[k-2] < COEF_CONST(0.0))
                 {
-                    deg[k-1] = REAL_CONST(1.0) - MUL_R(rxx[k-1], rxx[k-1]);
+                    deg[k-1] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]);
                 }
-            } else if (rxx[k-2] < REAL_CONST(0.0)) {
-                deg[k] = REAL_CONST(1.0) - MUL_R(rxx[k-1], rxx[k-1]);
+            } else if (rxx[k-2] < COEF_CONST(0.0)) {
+                deg[k] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]);
             }
         }
     }
@@ -440,7 +603,7 @@
     uint8_t odd, sb;
     uint8_t msb = sbr->k0;
     uint8_t usb = sbr->kx;
-    uint8_t goalSbTab[] = { 21, 23, 43, 46, 64, 85, 93, 128, 0, 0, 0 };
+    uint8_t goalSbTab[] = { 21, 23, 32, 43, 46, 64, 85, 93, 128, 0, 0, 0 };
     /* (uint8_t)(2.048e6/sbr->sample_rate + 0.5); */
     uint8_t goalSb = goalSbTab[get_sr_index(sbr->sample_rate)];
 
@@ -454,6 +617,15 @@
         k = sbr->N_master;
     }
 
+    if (sbr->N_master == 0)
+    {
+        sbr->noPatches = 0;
+        sbr->patchNoSubbands[0] = 0;
+        sbr->patchStartSubband[0] = 0;
+
+        return;
+    }
+
     do
     {
         uint8_t j = k + 1;
--- a/Plugins/Input/aac/libfaad2/sbr_hfgen.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sbr_hfgen.h	Wed May 10 14:44:20 2006 -0700
@@ -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.10 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_hfgen.h,v 1.16 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_HFGEN_H__
@@ -32,7 +32,7 @@
 extern "C" {
 #endif
 
-void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][32],
+void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
                    qmf_t Xhigh[MAX_NTSRHFG][64]
 #ifdef SBR_LOW_POWER
                    ,real_t *deg
--- a/Plugins/Input/aac/libfaad2/sbr_huff.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sbr_huff.c	Wed May 10 14:44:20 2006 -0700
@@ -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.13 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_huff.c,v 1.17 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -190,7 +190,6 @@
     { -57, -56 },    {  22,  23 },    { -55, -54 },    { -53, -52 }
 };
 
-
 static const int8_t t_huffman_noise_3_0dB[62][2] = {
     { -64,   1 },    { -63,   2 },    { -65,   3 },    { -66,   4 },
     { -62,   5 },    { -67,   6 },    {   7,   8 },    { -61, -68 },
@@ -227,7 +226,7 @@
 
     while (index >= 0)
     {
-        bit = (uint8_t)faad_getbits(ld, 1);
+        bit = (uint8_t)faad_get1bit(ld);
         index = t_huff[index][bit];
     }
 
--- a/Plugins/Input/aac/libfaad2/sbr_huff.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sbr_huff.h	Wed May 10 14:44:20 2006 -0700
@@ -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.13 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_huff.h,v 1.17 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_HUFF_H__
--- a/Plugins/Input/aac/libfaad2/sbr_noise.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sbr_noise.h	Wed May 10 14:44:20 2006 -0700
@@ -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.9 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_noise.h,v 1.13 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_NOISE_H__
--- a/Plugins/Input/aac/libfaad2/sbr_qmf.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sbr_qmf.c	Wed May 10 14:44:20 2006 -0700
@@ -1,19 +1,19 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
 ** 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
 ** the Free Software Foundation; either version 2 of the License, or
 ** (at your option) any later version.
-** 
+**
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ** GNU General Public License for more details.
-** 
+**
 ** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software 
+** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
 ** Any non-GPL usage of this software or parts of this software is strictly
@@ -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.19 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_qmf.c,v 1.27 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -38,12 +38,16 @@
 #include "sbr_qmf_c.h"
 #include "sbr_syntax.h"
 
-
 qmfa_info *qmfa_init(uint8_t channels)
 {
     qmfa_info *qmfa = (qmfa_info*)faad_malloc(sizeof(qmfa_info));
-    qmfa->x = (real_t*)faad_malloc(channels * 10 * sizeof(real_t));
-    memset(qmfa->x, 0, channels * 10 * sizeof(real_t));
+
+	/* x is implemented as double ringbuffer */
+    qmfa->x = (real_t*)faad_malloc(2 * channels * 10 * sizeof(real_t));
+    memset(qmfa->x, 0, 2 * channels * 10 * sizeof(real_t));
+
+	/* ringbuffer index */
+	qmfa->x_index = 0;
 
     qmfa->channels = channels;
 
@@ -60,11 +64,11 @@
 }
 
 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)
+                         qmf_t X[MAX_NTSRHFG][64], uint8_t offset, uint8_t kx)
 {
     ALIGN real_t u[64];
 #ifndef SBR_LOW_POWER
-    ALIGN real_t x[64], y[64];
+    ALIGN real_t in_real[32], in_imag[32], out_real[32], out_imag[32];
 #else
     ALIGN real_t y[32];
 #endif
@@ -77,28 +81,34 @@
         int16_t n;
 
         /* shift input buffer x */
-        memmove(qmfa->x + 32, qmfa->x, (320-32)*sizeof(real_t));
+		/* input buffer is not shifted anymore, x is implemented as double ringbuffer */
+        //memmove(qmfa->x + 32, qmfa->x, (320-32)*sizeof(real_t));
 
         /* add new samples to input buffer x */
         for (n = 32 - 1; n >= 0; n--)
         {
 #ifdef FIXED_POINT
-            qmfa->x[n] = (input[in++]) >> 5;
+            qmfa->x[qmfa->x_index + n] = qmfa->x[qmfa->x_index + n + 320] = (input[in++]) >> 4;
 #else
-            qmfa->x[n] = input[in++];
+            qmfa->x[qmfa->x_index + n] = qmfa->x[qmfa->x_index + n + 320] = input[in++];
 #endif
         }
 
         /* window and summation to create array u */
         for (n = 0; n < 64; n++)
         {
-            u[n] = MUL_F(qmfa->x[n], qmf_c[2*n]) +
-                MUL_F(qmfa->x[n + 64], qmf_c[2*(n + 64)]) +
-                MUL_F(qmfa->x[n + 128], qmf_c[2*(n + 128)]) +
-                MUL_F(qmfa->x[n + 192], qmf_c[2*(n + 192)]) +
-                MUL_F(qmfa->x[n + 256], qmf_c[2*(n + 256)]);
+            u[n] = MUL_F(qmfa->x[qmfa->x_index + n], qmf_c[2*n]) +
+                MUL_F(qmfa->x[qmfa->x_index + n + 64], qmf_c[2*(n + 64)]) +
+                MUL_F(qmfa->x[qmfa->x_index + n + 128], qmf_c[2*(n + 128)]) +
+                MUL_F(qmfa->x[qmfa->x_index + n + 192], qmf_c[2*(n + 192)]) +
+                MUL_F(qmfa->x[qmfa->x_index + n + 256], qmf_c[2*(n + 256)]);
         }
 
+		/* update ringbuffer index */
+		qmfa->x_index -= 32;
+		if (qmfa->x_index < 0)
+			qmfa->x_index = (320-32);
+
         /* calculate 32 subband samples by introducing X */
 #ifdef SBR_LOW_POWER
         y[0] = u[48];
@@ -114,7 +124,7 @@
             if (n < kx)
             {
 #ifdef FIXED_POINT
-                QMF_RE(X[l + offset][n]) = u[n] << 1;
+                QMF_RE(X[l + offset][n]) = u[n] /*<< 1*/;
 #else
                 QMF_RE(X[l + offset][n]) = 2. * u[n];
 #endif
@@ -123,64 +133,105 @@
             }
         }
 #else
-        x[0] = u[0];
-        for (n = 0; n < 31; n++)
+
+        // Reordering of data moved from DCT_IV to here
+        in_imag[31] = u[1];
+        in_real[0] = u[0];
+        for (n = 1; n < 31; n++)
         {
-            x[2*n+1] = u[n+1] + u[63-n];
-            x[2*n+2] = u[n+1] - u[63-n];
+            in_imag[31 - n] = u[n+1];
+            in_real[n] = -u[64-n];
         }
-        x[63] = u[32];
-
-        DCT4_64_kernel(y, x);
+        in_imag[0] = u[32];
+        in_real[31] = -u[33];
 
-        for (n = 0; n < 32; n++)
-        {
-            if (n < kx)
-            {
+        // dct4_kernel is DCT_IV without reordering which is done before and after FFT
+        dct4_kernel(in_real, in_imag, out_real, out_imag);
+
+        // Reordering of data moved from DCT_IV to here
+        for (n = 0; n < 16; n++) {
+            if (2*n+1 < kx) {
 #ifdef FIXED_POINT
-                QMF_RE(X[l + offset][n]) = y[n] << 1;
-                QMF_IM(X[l + offset][n]) = -y[63-n] << 1;
+                QMF_RE(X[l + offset][2*n])   = out_real[n];
+                QMF_IM(X[l + offset][2*n])   = out_imag[n];
+                QMF_RE(X[l + offset][2*n+1]) = -out_imag[31-n];
+                QMF_IM(X[l + offset][2*n+1]) = -out_real[31-n];
 #else
-                QMF_RE(X[l + offset][n]) = 2. * y[n];
-                QMF_IM(X[l + offset][n]) = -2. * y[63-n];
+                QMF_RE(X[l + offset][2*n])   = 2. * out_real[n];
+                QMF_IM(X[l + offset][2*n])   = 2. * out_imag[n];
+                QMF_RE(X[l + offset][2*n+1]) = -2. * out_imag[31-n];
+                QMF_IM(X[l + offset][2*n+1]) = -2. * out_real[31-n];
 #endif
             } else {
-                QMF_RE(X[l + offset][n]) = 0;
-                QMF_IM(X[l + offset][n]) = 0;
+                if (2*n < kx) {
+#ifdef FIXED_POINT
+                    QMF_RE(X[l + offset][2*n])   = out_real[n];
+                    QMF_IM(X[l + offset][2*n])   = out_imag[n];
+#else
+                    QMF_RE(X[l + offset][2*n])   = 2. * out_real[n];
+                    QMF_IM(X[l + offset][2*n])   = 2. * out_imag[n];
+#endif
+                }
+                else {
+                    QMF_RE(X[l + offset][2*n]) = 0;
+                    QMF_IM(X[l + offset][2*n]) = 0;
+                }
+                QMF_RE(X[l + offset][2*n+1]) = 0;
+                QMF_IM(X[l + offset][2*n+1]) = 0;
             }
         }
 #endif
     }
 }
 
+static const complex_t qmf32_pre_twiddle[] =
+{
+    { FRAC_CONST(0.999924701839145), FRAC_CONST(-0.012271538285720) },
+    { FRAC_CONST(0.999322384588350), FRAC_CONST(-0.036807222941359) },
+    { FRAC_CONST(0.998118112900149), FRAC_CONST(-0.061320736302209) },
+    { FRAC_CONST(0.996312612182778), FRAC_CONST(-0.085797312344440) },
+    { FRAC_CONST(0.993906970002356), FRAC_CONST(-0.110222207293883) },
+    { FRAC_CONST(0.990902635427780), FRAC_CONST(-0.134580708507126) },
+    { FRAC_CONST(0.987301418157858), FRAC_CONST(-0.158858143333861) },
+    { FRAC_CONST(0.983105487431216), FRAC_CONST(-0.183039887955141) },
+    { FRAC_CONST(0.978317370719628), FRAC_CONST(-0.207111376192219) },
+    { FRAC_CONST(0.972939952205560), FRAC_CONST(-0.231058108280671) },
+    { FRAC_CONST(0.966976471044852), FRAC_CONST(-0.254865659604515) },
+    { FRAC_CONST(0.960430519415566), FRAC_CONST(-0.278519689385053) },
+    { FRAC_CONST(0.953306040354194), FRAC_CONST(-0.302005949319228) },
+    { FRAC_CONST(0.945607325380521), FRAC_CONST(-0.325310292162263) },
+    { FRAC_CONST(0.937339011912575), FRAC_CONST(-0.348418680249435) },
+    { FRAC_CONST(0.928506080473216), FRAC_CONST(-0.371317193951838) },
+    { FRAC_CONST(0.919113851690058), FRAC_CONST(-0.393992040061048) },
+    { FRAC_CONST(0.909167983090522), FRAC_CONST(-0.416429560097637) },
+    { FRAC_CONST(0.898674465693954), FRAC_CONST(-0.438616238538528) },
+    { FRAC_CONST(0.887639620402854), FRAC_CONST(-0.460538710958240) },
+    { FRAC_CONST(0.876070094195407), FRAC_CONST(-0.482183772079123) },
+    { FRAC_CONST(0.863972856121587), FRAC_CONST(-0.503538383725718) },
+    { FRAC_CONST(0.851355193105265), FRAC_CONST(-0.524589682678469) },
+    { FRAC_CONST(0.838224705554838), FRAC_CONST(-0.545324988422046) },
+    { FRAC_CONST(0.824589302785025), FRAC_CONST(-0.565731810783613) },
+    { FRAC_CONST(0.810457198252595), FRAC_CONST(-0.585797857456439) },
+    { FRAC_CONST(0.795836904608884), FRAC_CONST(-0.605511041404326) },
+    { FRAC_CONST(0.780737228572094), FRAC_CONST(-0.624859488142386) },
+    { FRAC_CONST(0.765167265622459), FRAC_CONST(-0.643831542889791) },
+    { FRAC_CONST(0.749136394523459), FRAC_CONST(-0.662415777590172) },
+    { FRAC_CONST(0.732654271672413), FRAC_CONST(-0.680600997795453) },
+    { FRAC_CONST(0.715730825283819), FRAC_CONST(-0.698376249408973) }
+};
+
 qmfs_info *qmfs_init(uint8_t channels)
 {
     qmfs_info *qmfs = (qmfs_info*)faad_malloc(sizeof(qmfs_info));
 
-#ifndef SBR_LOW_POWER
-    qmfs->v[0] = (real_t*)faad_malloc(channels * 10 * sizeof(real_t));
-    memset(qmfs->v[0], 0, channels * 10 * sizeof(real_t));
-    qmfs->v[1] = (real_t*)faad_malloc(channels * 10 * sizeof(real_t));
-    memset(qmfs->v[1], 0, channels * 10 * sizeof(real_t));
-#else
-    qmfs->v[0] = (real_t*)faad_malloc(channels * 20 * sizeof(real_t));
-    memset(qmfs->v[0], 0, channels * 20 * sizeof(real_t));
-    qmfs->v[1] = NULL;
-#endif
+	/* v is a double ringbuffer */
+    qmfs->v = (real_t*)faad_malloc(2 * channels * 20 * sizeof(real_t));
+    memset(qmfs->v, 0, 2 * channels * 20 * sizeof(real_t));
 
     qmfs->v_index = 0;
 
     qmfs->channels = channels;
 
-#ifdef USE_SSE
-    if (cpu_has_sse())
-    {
-        qmfs->qmf_func = sbr_qmf_synthesis_64_sse;
-    } else {
-        qmfs->qmf_func = sbr_qmf_synthesis_64;
-    }
-#endif
-
     return qmfs;
 }
 
@@ -188,15 +239,82 @@
 {
     if (qmfs)
     {
-        if (qmfs->v[0]) faad_free(qmfs->v[0]);
-#ifndef SBR_LOW_POWER
-        if (qmfs->v[1]) faad_free(qmfs->v[1]);
-#endif
+        if (qmfs->v) faad_free(qmfs->v);
         faad_free(qmfs);
     }
 }
 
 #ifdef SBR_LOW_POWER
+
+void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
+                          real_t *output)
+{
+    ALIGN real_t x[16];
+    ALIGN real_t y[16];
+    int16_t n, k, out = 0;
+    uint8_t l;
+
+    /* qmf subsample l */
+    for (l = 0; l < sbr->numTimeSlotsRate; l++)
+    {
+        /* shift buffers */
+        /* we are not shifting v, it is a double ringbuffer */
+        //memmove(qmfs->v + 64, qmfs->v, (640-64)*sizeof(real_t));
+
+        /* calculate 64 samples */
+        for (k = 0; k < 16; k++)
+        {
+#ifdef FIXED_POINT
+            y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][31 - k]));
+            x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][31 - k]));
+#else
+            y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][31 - k])) / 32.0;
+            x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][31 - k])) / 32.0;
+#endif
+        }
+
+        /* even n samples */
+        DCT2_16_unscaled(x, x);
+        /* odd n samples */
+        DCT4_16(y, y);
+
+        for (n = 8; n < 24; n++)
+        {
+            qmfs->v[qmfs->v_index + n*2] = qmfs->v[qmfs->v_index + 640 + n*2] = x[n-8];
+            qmfs->v[qmfs->v_index + n*2+1] = qmfs->v[qmfs->v_index + 640 + n*2+1] = y[n-8];
+        }
+        for (n = 0; n < 16; n++)
+        {
+            qmfs->v[qmfs->v_index + n] = qmfs->v[qmfs->v_index + 640 + n] = qmfs->v[qmfs->v_index + 32-n];
+        }
+        qmfs->v[qmfs->v_index + 48] = qmfs->v[qmfs->v_index + 640 + 48] = 0;
+        for (n = 1; n < 16; n++)
+        {
+            qmfs->v[qmfs->v_index + 48+n] = qmfs->v[qmfs->v_index + 640 + 48+n] = -qmfs->v[qmfs->v_index + 48-n];
+        }
+
+        /* calculate 32 output samples and window */
+        for (k = 0; k < 32; k++)
+        {
+            output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 96 + k], qmf_c[64 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 128 + k], qmf_c[128 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 224 + k], qmf_c[192 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[256 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 352 + k], qmf_c[320 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 384 + k], qmf_c[384 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 480 + k], qmf_c[448 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[512 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 608 + k], qmf_c[576 + 2*k]);
+        }
+
+        /* update the ringbuffer index */
+        qmfs->v_index -= 64;
+        if (qmfs->v_index < 0)
+            qmfs->v_index = (640-64);
+    }
+}
+
 void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
                           real_t *output)
 {
@@ -209,172 +327,71 @@
     /* qmf subsample l */
     for (l = 0; l < sbr->numTimeSlotsRate; l++)
     {
-        //real_t *v0, *v1;
-
         /* shift buffers */
-        //memmove(qmfs->v[0] + 64, qmfs->v[0], (640-64)*sizeof(real_t));
-        //memmove(qmfs->v[1] + 64, qmfs->v[1], (640-64)*sizeof(real_t));
-        memmove(qmfs->v[0] + 128, qmfs->v[0], (1280-128)*sizeof(real_t));
-
-        //v0 = qmfs->v[qmfs->v_index];
-        //v1 = qmfs->v[(qmfs->v_index + 1) & 0x1];
-        //qmfs->v_index = (qmfs->v_index + 1) & 0x1;
+        /* we are not shifting v, it is a double ringbuffer */
+        //memmove(qmfs->v + 128, qmfs->v, (1280-128)*sizeof(real_t));
 
         /* calculate 128 samples */
-        for (k = 0; k < 64; k++)
+        for (k = 0; k < 32; k++)
         {
 #ifdef FIXED_POINT
-            x[k] = QMF_RE(X[l][k]);
+            y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][63 - k]));
+            x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][63 - k]));
 #else
-            x[k] = QMF_RE(X[l][k]) / 32.;
+            y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][63 - k])) / 32.0;
+            x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][63 - k])) / 32.0;
 #endif
         }
 
-        for (n = 0; n < 32; n++)
-        {
-            y[2*n]   = -x[2*n];
-            y[2*n+1] =  x[2*n+1];
-        }
+        /* even n samples */
+        DCT2_32_unscaled(x, x);
+        /* odd n samples */
+        DCT4_32(y, y);
 
-        DCT2_64_unscaled(x, x);
-
-        for (n = 0; n < 64; n++)
+        for (n = 16; n < 48; n++)
         {
-            qmfs->v[0][n+32] = x[n];
+            qmfs->v[qmfs->v_index + n*2]   = qmfs->v[qmfs->v_index + 1280 + n*2]   = x[n-16];
+            qmfs->v[qmfs->v_index + n*2+1] = qmfs->v[qmfs->v_index + 1280 + n*2+1] = y[n-16];
         }
         for (n = 0; n < 32; n++)
         {
-            qmfs->v[0][31 - n] = x[n + 1];
+            qmfs->v[qmfs->v_index + n] = qmfs->v[qmfs->v_index + 1280 + n] = qmfs->v[qmfs->v_index + 64-n];
         }
-        DST2_64_unscaled(x, y);
-        qmfs->v[0][96] = 0;
+        qmfs->v[qmfs->v_index + 96] = qmfs->v[qmfs->v_index + 1280 + 96] = 0;
         for (n = 1; n < 32; n++)
         {
-            qmfs->v[0][n + 96] = x[n-1];
+            qmfs->v[qmfs->v_index + 96+n] = qmfs->v[qmfs->v_index + 1280 + 96+n] = -qmfs->v[qmfs->v_index + 96-n];
         }
 
         /* calculate 64 output samples and window */
         for (k = 0; k < 64; k++)
         {
-#if 1
-             output[out++] = MUL_F(qmfs->v[0][k], qmf_c[k]) +
-                 MUL_F(qmfs->v[0][192 + k], qmf_c[64 + k]) +
-                 MUL_F(qmfs->v[0][256 + k], qmf_c[128 + k]) +
-                 MUL_F(qmfs->v[0][256 + 192 + k], qmf_c[128 + 64 + k]) +
-                 MUL_F(qmfs->v[0][512 + k], qmf_c[256 + k]) +
-                 MUL_F(qmfs->v[0][512 + 192 + k], qmf_c[256 + 64 + k]) +
-                 MUL_F(qmfs->v[0][768 + k], qmf_c[384 + k]) +
-                 MUL_F(qmfs->v[0][768 + 192 + k], qmf_c[384 + 64 + k]) +
-                 MUL_F(qmfs->v[0][1024 + k], qmf_c[512 + k]) +
-                 MUL_F(qmfs->v[0][1024 + 192 + k], qmf_c[512 + 64 + k]);
-#else
-            output[out++] = MUL_F(v0[k], qmf_c[k]) +
-                MUL_F(v0[64 + k], qmf_c[64 + k]) +
-                MUL_F(v0[128 + k], qmf_c[128 + k]) +
-                MUL_F(v0[192 + k], qmf_c[192 + k]) +
-                MUL_F(v0[256 + k], qmf_c[256 + k]) +
-                MUL_F(v0[320 + k], qmf_c[320 + k]) +
-                MUL_F(v0[384 + k], qmf_c[384 + k]) +
-                MUL_F(v0[448 + k], qmf_c[448 + k]) +
-                MUL_F(v0[512 + k], qmf_c[512 + k]) +
-                MUL_F(v0[576 + k], qmf_c[576 + k]);
-#endif
-        }
-    }
-}
-
-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];
-    ALIGN real_t y[64];
-    ALIGN real_t y2[64];
-    int16_t n, k, out = 0;
-    uint8_t l;
-
-    /* qmf subsample l */
-    for (l = 0; l < sbr->numTimeSlotsRate; l++)
-    {
-        //real_t *v0, *v1;
-
-        /* shift buffers */
-        //memmove(qmfs->v[0] + 64, qmfs->v[0], (640-64)*sizeof(real_t));
-        //memmove(qmfs->v[1] + 64, qmfs->v[1], (640-64)*sizeof(real_t));
-        memmove(qmfs->v[0] + 128, qmfs->v[0], (1280-128)*sizeof(real_t));
-
-        //v0 = qmfs->v[qmfs->v_index];
-        //v1 = qmfs->v[(qmfs->v_index + 1) & 0x1];
-        //qmfs->v_index = (qmfs->v_index + 1) & 0x1;
-
-        /* 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
+            output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 192 + k], qmf_c[64 + k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[128 + k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 256 + 192 + k], qmf_c[128 + 64 + k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[256 + k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 512 + 192 + k], qmf_c[256 + 64 + k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 768 + k], qmf_c[384 + k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 768 + 192 + k], qmf_c[384 + 64 + k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 1024 + k], qmf_c[512 + k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 1024 + 192 + k], qmf_c[512 + 64 + k]);
         }
 
-        for (n = 0; n < 32; n++)
-        {
-            y[2*n]   = -x[2*n];
-            y[2*n+1] =  x[2*n+1];
-        }
-
-        DCT2_64_unscaled(x, x);
-
-        for (n = 0; n < 64; n++)
-        {
-            qmfs->v[0][n+32] = x[n];
-        }
-        for (n = 0; n < 32; n++)
-        {
-            qmfs->v[0][31 - n] = x[n + 1];
-        }
-
-        DST2_64_unscaled(x, y);
-        qmfs->v[0][96] = 0;
-        for (n = 1; n < 32; n++)
-        {
-            qmfs->v[0][n + 96] = x[n-1];
-        }
-
-        /* calculate 64 output samples and window */
-        for (k = 0; k < 64; k++)
-        {
-#if 1
-             output[out++] = MUL_F(qmfs->v[0][k], qmf_c[k]) +
-                 MUL_F(qmfs->v[0][192 + k], qmf_c[64 + k]) +
-                 MUL_F(qmfs->v[0][256 + k], qmf_c[128 + k]) +
-                 MUL_F(qmfs->v[0][256 + 192 + k], qmf_c[128 + 64 + k]) +
-                 MUL_F(qmfs->v[0][512 + k], qmf_c[256 + k]) +
-                 MUL_F(qmfs->v[0][512 + 192 + k], qmf_c[256 + 64 + k]) +
-                 MUL_F(qmfs->v[0][768 + k], qmf_c[384 + k]) +
-                 MUL_F(qmfs->v[0][768 + 192 + k], qmf_c[384 + 64 + k]) +
-                 MUL_F(qmfs->v[0][1024 + k], qmf_c[512 + k]) +
-                 MUL_F(qmfs->v[0][1024 + 192 + k], qmf_c[512 + 64 + k]);
-#else
-            output[out++] = MUL_F(v0[k], qmf_c[k]) +
-                MUL_F(v0[64 + k], qmf_c[64 + k]) +
-                MUL_F(v0[128 + k], qmf_c[128 + k]) +
-                MUL_F(v0[192 + k], qmf_c[192 + k]) +
-                MUL_F(v0[256 + k], qmf_c[256 + k]) +
-                MUL_F(v0[320 + k], qmf_c[320 + k]) +
-                MUL_F(v0[384 + k], qmf_c[384 + k]) +
-                MUL_F(v0[448 + k], qmf_c[448 + k]) +
-                MUL_F(v0[512 + k], qmf_c[512 + k]) +
-                MUL_F(v0[576 + k], qmf_c[576 + k]);
-#endif
-        }
+        /* update the ringbuffer index */
+        qmfs->v_index -= 128;
+        if (qmfs->v_index < 0)
+            qmfs->v_index = (1280-128);
     }
 }
 #else
-void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
+void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
                           real_t *output)
 {
-    ALIGN real_t x1[64], x2[64];
+    ALIGN real_t x1[32], x2[32];
+#ifndef FIXED_POINT
     real_t scale = 1.f/64.f;
+#endif
     int16_t n, k, out = 0;
     uint8_t l;
 
@@ -382,79 +399,82 @@
     /* qmf subsample l */
     for (l = 0; l < sbr->numTimeSlotsRate; l++)
     {
-        real_t *v0, *v1;
+        /* shift buffer v */
+        /* buffer is not shifted, we are using a ringbuffer */
+        //memmove(qmfs->v + 64, qmfs->v, (640-64)*sizeof(real_t));
 
-        /* shift buffers */
-        memmove(qmfs->v[0] + 64, qmfs->v[0], (640-64)*sizeof(real_t));
-        memmove(qmfs->v[1] + 64, qmfs->v[1], (640-64)*sizeof(real_t));
-
-        v0 = qmfs->v[qmfs->v_index];
-        v1 = qmfs->v[(qmfs->v_index + 1) & 0x1];
-        qmfs->v_index = (qmfs->v_index + 1) & 0x1;
+        /* calculate 64 samples */
+        /* complex pre-twiddle */
+        for (k = 0; k < 32; k++)
+        {
+            x1[k] = MUL_F(QMF_RE(X[l][k]), RE(qmf32_pre_twiddle[k])) - MUL_F(QMF_IM(X[l][k]), IM(qmf32_pre_twiddle[k]));
+            x2[k] = MUL_F(QMF_IM(X[l][k]), RE(qmf32_pre_twiddle[k])) + MUL_F(QMF_RE(X[l][k]), IM(qmf32_pre_twiddle[k]));
 
-        /* calculate 128 samples */
-        x1[0] = scale*QMF_RE(X[l][0]);
-        x2[63] = scale*QMF_IM(X[l][0]);
-        for (k = 0; k < 31; k++)
-        {
-            x1[2*k+1] = scale*(QMF_RE(X[l][2*k+1]) - QMF_RE(X[l][2*k+2]));
-            x1[2*k+2] = scale*(QMF_RE(X[l][2*k+1]) + QMF_RE(X[l][2*k+2]));
+#ifndef FIXED_POINT
+            x1[k] *= scale;
+            x2[k] *= scale;
+#else
+            x1[k] >>= 1;
+            x2[k] >>= 1;
+#endif
+        }
 
-            x2[61 - 2*k] = scale*(QMF_IM(X[l][2*k+2]) - QMF_IM(X[l][2*k+1]));
-            x2[62 - 2*k] = scale*(QMF_IM(X[l][2*k+2]) + QMF_IM(X[l][2*k+1]));
-        }
-        x1[63] = scale*QMF_RE(X[l][63]);
-        x2[0] = scale*QMF_IM(X[l][63]);
-
-        DCT4_64_kernel(x1, x1);
-        DCT4_64_kernel(x2, x2);
+        /* transform */
+        DCT4_32(x1, x1);
+        DST4_32(x2, x2);
 
         for (n = 0; n < 32; n++)
         {
-            v0[   2*n]   =  x2[2*n]   - x1[2*n];
-            v1[63-2*n]   =  x2[2*n]   + x1[2*n];
-            v0[   2*n+1] = -x2[2*n+1] - x1[2*n+1];
-            v1[62-2*n]   = -x2[2*n+1] + x1[2*n+1];
+            qmfs->v[qmfs->v_index + n]      = qmfs->v[qmfs->v_index + 640 + n]      = -x1[n] + x2[n];
+            qmfs->v[qmfs->v_index + 63 - n] = qmfs->v[qmfs->v_index + 640 + 63 - n] =  x1[n] + x2[n];
         }
 
-        /* calculate 64 output samples and window */
-        for (k = 0; k < 64; k++)
+        /* calculate 32 output samples and window */
+        for (k = 0; k < 32; k++)
         {
-            output[out++] = MUL_F(v0[k], qmf_c[k]) +
-                MUL_F(v0[64 + k], qmf_c[64 + k]) +
-                MUL_F(v0[128 + k], qmf_c[128 + k]) +
-                MUL_F(v0[192 + k], qmf_c[192 + k]) +
-                MUL_F(v0[256 + k], qmf_c[256 + k]) +
-                MUL_F(v0[320 + k], qmf_c[320 + k]) +
-                MUL_F(v0[384 + k], qmf_c[384 + k]) +
-                MUL_F(v0[448 + k], qmf_c[448 + k]) +
-                MUL_F(v0[512 + k], qmf_c[512 + k]) +
-                MUL_F(v0[576 + k], qmf_c[576 + k]);
+            output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 96 + k], qmf_c[64 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 128 + k], qmf_c[128 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 224 + k], qmf_c[192 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[256 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 352 + k], qmf_c[320 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 384 + k], qmf_c[384 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 480 + k], qmf_c[448 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[512 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 608 + k], qmf_c[576 + 2*k]);
         }
+
+        /* update ringbuffer index */
+        qmfs->v_index -= 64;
+        if (qmfs->v_index < 0)
+            qmfs->v_index = (640 - 64);
     }
 }
 
-#ifdef USE_SSE
-void memmove_sse_576(real_t *out, const real_t *in)
+void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
+                          real_t *output)
 {
-    __m128 m[144];
-    uint16_t i;
-
-    for (i = 0; i < 144; i++)
-    {
-        m[i] = _mm_load_ps(&in[i*4]);
-    }
-    for (i = 0; i < 144; i++)
-    {
-        _mm_store_ps(&out[i*4], m[i]);
-    }
-}
-
-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];
+//    ALIGN real_t x1[64], x2[64];
+#ifndef SBR_LOW_POWER
+    ALIGN real_t in_real1[32], in_imag1[32], out_real1[32], out_imag1[32];
+    ALIGN real_t in_real2[32], in_imag2[32], out_real2[32], out_imag2[32];
+#endif
+    qmf_t * pX;
+    real_t * pring_buffer_1, * pring_buffer_3;
+//    real_t * ptemp_1, * ptemp_2;
+#ifdef PREFER_POINTERS
+    // These pointers are used if target platform has autoinc address generators
+    real_t * pring_buffer_2, * pring_buffer_4;
+    real_t * pring_buffer_5, * pring_buffer_6;
+    real_t * pring_buffer_7, * pring_buffer_8;
+    real_t * pring_buffer_9, * pring_buffer_10;
+    const real_t * pqmf_c_1, * pqmf_c_2, * pqmf_c_3, * pqmf_c_4;
+    const real_t * pqmf_c_5, * pqmf_c_6, * pqmf_c_7, * pqmf_c_8;
+    const real_t * pqmf_c_9, * pqmf_c_10;
+#endif // #ifdef PREFER_POINTERS
+#ifndef FIXED_POINT
     real_t scale = 1.f/64.f;
+#endif
     int16_t n, k, out = 0;
     uint8_t l;
 
@@ -462,99 +482,152 @@
     /* qmf subsample l */
     for (l = 0; l < sbr->numTimeSlotsRate; l++)
     {
-        real_t *v0, *v1;
-
-        /* shift buffers */
-        memmove_sse_576(qmfs->v[0] + 64, qmfs->v[0]);
-        memmove_sse_576(qmfs->v[1] + 64, qmfs->v[1]);
-
-        v0 = qmfs->v[qmfs->v_index];
-        v1 = qmfs->v[(qmfs->v_index + 1) & 0x1];
-        qmfs->v_index = (qmfs->v_index + 1) & 0x1;
+        /* shift buffer v */
+		/* buffer is not shifted, we use double ringbuffer */
+		//memmove(qmfs->v + 128, qmfs->v, (1280-128)*sizeof(real_t));
 
         /* calculate 128 samples */
-        x1[0] = scale*QMF_RE(X[l][0]);
-        x2[63] = scale*QMF_IM(X[l][0]);
-        for (k = 0; k < 31; k++)
+#ifndef FIXED_POINT
+
+        pX = X[l];
+
+        in_imag1[31] = scale*QMF_RE(pX[1]);
+        in_real1[0]  = scale*QMF_RE(pX[0]);
+        in_imag2[31] = scale*QMF_IM(pX[63-1]);
+        in_real2[0]  = scale*QMF_IM(pX[63-0]);
+        for (k = 1; k < 31; k++)
         {
-            x1[2*k+1] = scale*(QMF_RE(X[l][2*k+1]) - QMF_RE(X[l][2*k+2]));
-            x1[2*k+2] = scale*(QMF_RE(X[l][2*k+1]) + QMF_RE(X[l][2*k+2]));
+            in_imag1[31 - k] = scale*QMF_RE(pX[2*k + 1]);
+            in_real1[     k] = scale*QMF_RE(pX[2*k    ]);
+            in_imag2[31 - k] = scale*QMF_IM(pX[63 - (2*k + 1)]);
+            in_real2[     k] = scale*QMF_IM(pX[63 - (2*k    )]);
+        }
+        in_imag1[0]  = scale*QMF_RE(pX[63]);
+        in_real1[31] = scale*QMF_RE(pX[62]);
+        in_imag2[0]  = scale*QMF_IM(pX[63-63]);
+        in_real2[31] = scale*QMF_IM(pX[63-62]);
+
+#else
+
+        pX = X[l];
 
-            x2[61 - 2*k] = scale*(QMF_IM(X[l][2*k+2]) - QMF_IM(X[l][2*k+1]));
-            x2[62 - 2*k] = scale*(QMF_IM(X[l][2*k+2]) + QMF_IM(X[l][2*k+1]));
+        in_imag1[31] = QMF_RE(pX[1]) >> 1;
+        in_real1[0]  = QMF_RE(pX[0]) >> 1;
+        in_imag2[31] = QMF_IM(pX[62]) >> 1;
+        in_real2[0]  = QMF_IM(pX[63]) >> 1;
+        for (k = 1; k < 31; k++)
+        {
+            in_imag1[31 - k] = QMF_RE(pX[2*k + 1]) >> 1;
+            in_real1[     k] = QMF_RE(pX[2*k    ]) >> 1;
+            in_imag2[31 - k] = QMF_IM(pX[63 - (2*k + 1)]) >> 1;
+            in_real2[     k] = QMF_IM(pX[63 - (2*k    )]) >> 1;
         }
-        x1[63] = scale*QMF_RE(X[l][63]);
-        x2[0] = scale*QMF_IM(X[l][63]);
+        in_imag1[0]  = QMF_RE(pX[63]) >> 1;
+        in_real1[31] = QMF_RE(pX[62]) >> 1;
+        in_imag2[0]  = QMF_IM(pX[0]) >> 1;
+        in_real2[31] = QMF_IM(pX[1]) >> 1;
+
+#endif
+
+
+        // dct4_kernel is DCT_IV without reordering which is done before and after FFT
+        dct4_kernel(in_real1, in_imag1, out_real1, out_imag1);
+        dct4_kernel(in_real2, in_imag2, out_real2, out_imag2);
+
 
-        DCT4_64_kernel(x1, x1);
-        DCT4_64_kernel(x2, x2);
+        pring_buffer_1 = qmfs->v + qmfs->v_index;
+        pring_buffer_3 = pring_buffer_1 + 1280;
+#ifdef PREFER_POINTERS
+        pring_buffer_2 = pring_buffer_1 + 127;
+        pring_buffer_4 = pring_buffer_1 + (1280 + 127);
+#endif // #ifdef PREFER_POINTERS
+//        ptemp_1 = x1;
+//        ptemp_2 = x2;
+#ifdef PREFER_POINTERS
+        for (n = 0; n < 32; n ++)
+        {
+            //real_t x1 = *ptemp_1++;
+            //real_t x2 = *ptemp_2++;
+            // pring_buffer_3 and pring_buffer_4 are needed only for double ring buffer
+            *pring_buffer_1++ = *pring_buffer_3++ = out_real2[n] - out_real1[n];
+            *pring_buffer_2-- = *pring_buffer_4-- = out_real2[n] + out_real1[n];
+            //x1 = *ptemp_1++;
+            //x2 = *ptemp_2++;
+            *pring_buffer_1++ = *pring_buffer_3++ = out_imag2[31-n] + out_imag1[31-n];
+            *pring_buffer_2-- = *pring_buffer_4-- = out_imag2[31-n] - out_imag1[31-n];
+        }
+#else // #ifdef PREFER_POINTERS
 
         for (n = 0; n < 32; n++)
         {
-            v0[    2*n   ] =  x2[2*n]   - x1[2*n];
-            v1[63- 2*n   ] =  x2[2*n]   + x1[2*n];
-            v0[    2*n+1 ] = -x2[2*n+1] - x1[2*n+1];
-            v1[63-(2*n+1)] = -x2[2*n+1] + x1[2*n+1];
+            // pring_buffer_3 and pring_buffer_4 are needed only for double ring buffer
+            pring_buffer_1[2*n]         = pring_buffer_3[2*n]         = out_real2[n] - out_real1[n];
+            pring_buffer_1[127-2*n]     = pring_buffer_3[127-2*n]     = out_real2[n] + out_real1[n];
+            pring_buffer_1[2*n+1]       = pring_buffer_3[2*n+1]       = out_imag2[31-n] + out_imag1[31-n];
+            pring_buffer_1[127-(2*n+1)] = pring_buffer_3[127-(2*n+1)] = out_imag2[31-n] - out_imag1[31-n];
         }
 
+#endif // #ifdef PREFER_POINTERS
+
+        pring_buffer_1 = qmfs->v + qmfs->v_index;
+#ifdef PREFER_POINTERS
+        pring_buffer_2 = pring_buffer_1 + 192;
+        pring_buffer_3 = pring_buffer_1 + 256;
+        pring_buffer_4 = pring_buffer_1 + (256 + 192);
+        pring_buffer_5 = pring_buffer_1 + 512;
+        pring_buffer_6 = pring_buffer_1 + (512 + 192);
+        pring_buffer_7 = pring_buffer_1 + 768;
+        pring_buffer_8 = pring_buffer_1 + (768 + 192);
+        pring_buffer_9 = pring_buffer_1 + 1024;
+        pring_buffer_10 = pring_buffer_1 + (1024 + 192);
+        pqmf_c_1 = qmf_c;
+        pqmf_c_2 = qmf_c + 64;
+        pqmf_c_3 = qmf_c + 128;
+        pqmf_c_4 = qmf_c + 192;
+        pqmf_c_5 = qmf_c + 256;
+        pqmf_c_6 = qmf_c + 320;
+        pqmf_c_7 = qmf_c + 384;
+        pqmf_c_8 = qmf_c + 448;
+        pqmf_c_9 = qmf_c + 512;
+        pqmf_c_10 = qmf_c + 576;
+#endif // #ifdef PREFER_POINTERS
+
         /* calculate 64 output samples and window */
-        for (k = 0; k < 64; k+=4)
+        for (k = 0; k < 64; k++)
         {
-            __m128 m0, m1, m2, m3, m4, m5, m6, m7, m8, m9;
-            __m128 c0, c1, c2, c3, c4, c5, c6, c7, c8, c9;
-            __m128 s1, s2, s3, s4, s5, s6, s7, s8, s9;
-
-            m0 = _mm_load_ps(&v0[k]);
-            m1 = _mm_load_ps(&v0[k + 64]);
-            m2 = _mm_load_ps(&v0[k + 128]);
-            m3 = _mm_load_ps(&v0[k + 192]);
-            m4 = _mm_load_ps(&v0[k + 256]);
-            c0 = _mm_load_ps(&qmf_c[k]);
-            c1 = _mm_load_ps(&qmf_c[k + 64]);
-            c2 = _mm_load_ps(&qmf_c[k + 128]);
-            c3 = _mm_load_ps(&qmf_c[k + 192]);
-            c4 = _mm_load_ps(&qmf_c[k + 256]);
-
-            m0 = _mm_mul_ps(m0, c0);
-            m1 = _mm_mul_ps(m1, c1);
-            m2 = _mm_mul_ps(m2, c2);
-            m3 = _mm_mul_ps(m3, c3);
-            m4 = _mm_mul_ps(m4, c4);
-
-            s1 = _mm_add_ps(m0, m1);
-            s2 = _mm_add_ps(m2, m3);
-            s6 = _mm_add_ps(s1, s2);
+#ifdef PREFER_POINTERS
+            output[out++] =
+                MUL_F(*pring_buffer_1++,  *pqmf_c_1++) +
+                MUL_F(*pring_buffer_2++,  *pqmf_c_2++) +
+                MUL_F(*pring_buffer_3++,  *pqmf_c_3++) +
+                MUL_F(*pring_buffer_4++,  *pqmf_c_4++) +
+                MUL_F(*pring_buffer_5++,  *pqmf_c_5++) +
+                MUL_F(*pring_buffer_6++,  *pqmf_c_6++) +
+                MUL_F(*pring_buffer_7++,  *pqmf_c_7++) +
+                MUL_F(*pring_buffer_8++,  *pqmf_c_8++) +
+                MUL_F(*pring_buffer_9++,  *pqmf_c_9++) +
+                MUL_F(*pring_buffer_10++, *pqmf_c_10++);
+#else // #ifdef PREFER_POINTERS
+            output[out++] =
+                MUL_F(pring_buffer_1[k+0],          qmf_c[k+0])   +
+                MUL_F(pring_buffer_1[k+192],        qmf_c[k+64])  +
+                MUL_F(pring_buffer_1[k+256],        qmf_c[k+128]) +
+                MUL_F(pring_buffer_1[k+(256+192)],  qmf_c[k+192]) +
+                MUL_F(pring_buffer_1[k+512],        qmf_c[k+256]) +
+                MUL_F(pring_buffer_1[k+(512+192)],  qmf_c[k+320]) +
+                MUL_F(pring_buffer_1[k+768],        qmf_c[k+384]) +
+                MUL_F(pring_buffer_1[k+(768+192)],  qmf_c[k+448]) +
+                MUL_F(pring_buffer_1[k+1024],       qmf_c[k+512]) +
+                MUL_F(pring_buffer_1[k+(1024+192)], qmf_c[k+576]);
+#endif // #ifdef PREFER_POINTERS
+        }
 
-            m5 = _mm_load_ps(&v0[k + 320]);
-            m6 = _mm_load_ps(&v0[k + 384]);
-            m7 = _mm_load_ps(&v0[k + 448]);
-            m8 = _mm_load_ps(&v0[k + 512]);
-            m9 = _mm_load_ps(&v0[k + 576]);
-            c5 = _mm_load_ps(&qmf_c[k + 320]);
-            c6 = _mm_load_ps(&qmf_c[k + 384]);
-            c7 = _mm_load_ps(&qmf_c[k + 448]);
-            c8 = _mm_load_ps(&qmf_c[k + 512]);
-            c9 = _mm_load_ps(&qmf_c[k + 576]);
-
-            m5 = _mm_mul_ps(m5, c5);
-            m6 = _mm_mul_ps(m6, c6);
-            m7 = _mm_mul_ps(m7, c7);
-            m8 = _mm_mul_ps(m8, c8);
-            m9 = _mm_mul_ps(m9, c9);
-
-            s3 = _mm_add_ps(m4, m5);
-            s4 = _mm_add_ps(m6, m7);
-            s5 = _mm_add_ps(m8, m9);
-            s7 = _mm_add_ps(s3, s4);
-            s8 = _mm_add_ps(s5, s6);
-            s9 = _mm_add_ps(s7, s8);
-
-            _mm_store_ps(&output[out], s9);
-            out += 4;
-        }
+        /* update ringbuffer index */
+        qmfs->v_index -= 128;
+        if (qmfs->v_index < 0)
+            qmfs->v_index = (1280 - 128);
     }
 }
 #endif
-#endif
 
 #endif
--- a/Plugins/Input/aac/libfaad2/sbr_qmf.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sbr_qmf.h	Wed May 10 14:44:20 2006 -0700
@@ -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.14 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_qmf.h,v 1.21 2004/09/08 09:43:11 gcp Exp $
 **/
 
 #ifndef __SBR_QMF_H__
@@ -38,13 +38,11 @@
 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);
+                         qmf_t X[MAX_NTSRHFG][64], uint8_t offset, uint8_t kx);
+void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
+                          real_t *output);
 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, qmf_t X[MAX_NTSRHFG][64],
-                              real_t *output);
-#endif
 
 
 #ifdef __cplusplus
--- a/Plugins/Input/aac/libfaad2/sbr_qmf_c.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sbr_qmf_c.h	Wed May 10 14:44:20 2006 -0700
@@ -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.9 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_qmf_c.h,v 1.13 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_QMF_C_H__
@@ -199,7 +199,7 @@
     FRAC_CONST(0.84803157770763), FRAC_CONST(0.84978051984268),
     FRAC_CONST(0.85119715249343), FRAC_CONST(0.85230470352147),
     FRAC_CONST(0.85310209497017), FRAC_CONST(0.85357205739107),
-    FRAC_CONST(0.85373856005937), FRAC_CONST(0.85357205739107),
+    FRAC_CONST(0.85373856005937 /*max*/), FRAC_CONST(0.85357205739107),
     FRAC_CONST(0.85310209497017), FRAC_CONST(0.85230470352147),
     FRAC_CONST(0.85119715249343), FRAC_CONST(0.84978051984268),
     FRAC_CONST(0.84803157770763), FRAC_CONST(0.84598184698206),
--- a/Plugins/Input/aac/libfaad2/sbr_syntax.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sbr_syntax.c	Wed May 10 14:44:20 2006 -0700
@@ -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.25 2004/01/29 11:31:11 menno Exp $
+** $Id: sbr_syntax.c,v 1.34 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -47,6 +47,9 @@
 
 /* static function declarations */
 static void sbr_header(bitfile *ld, sbr_info *sbr);
+static uint8_t calc_sbr_tables(sbr_info *sbr, uint8_t start_freq, uint8_t stop_freq,
+                               uint8_t samplerate_mode, uint8_t freq_scale,
+                               uint8_t alter_scale, uint8_t xover_band);
 static uint8_t sbr_data(bitfile *ld, sbr_info *sbr);
 static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr,
                               uint8_t bs_extension_id, uint16_t num_bits_left);
@@ -73,16 +76,6 @@
     if ((sbr->bs_start_freq != sbr->bs_start_freq_prev) ||
         (sbr->bs_stop_freq != sbr->bs_stop_freq_prev) ||
         (sbr->bs_freq_scale != sbr->bs_freq_scale_prev) ||
-        (sbr->bs_alter_scale != sbr->bs_alter_scale_prev))
-    {
-        sbr->Reset = 1;
-    } else {
-        sbr->Reset = 0;
-    }
-
-    if ((sbr->bs_start_freq != sbr->bs_start_freq_prev) ||
-        (sbr->bs_stop_freq != sbr->bs_stop_freq_prev) ||
-        (sbr->bs_freq_scale != sbr->bs_freq_scale_prev) ||
         (sbr->bs_alter_scale != sbr->bs_alter_scale_prev) ||
         (sbr->bs_xover_band != sbr->bs_xover_band_prev) ||
         (sbr->bs_noise_bands != sbr->bs_noise_bands_prev))
@@ -98,11 +91,43 @@
     sbr->bs_alter_scale_prev = sbr->bs_alter_scale;
     sbr->bs_xover_band_prev = sbr->bs_xover_band;
     sbr->bs_noise_bands_prev = sbr->bs_noise_bands;
+}
 
-    if (sbr->frame == 0)
+static uint8_t calc_sbr_tables(sbr_info *sbr, uint8_t start_freq, uint8_t stop_freq,
+                               uint8_t samplerate_mode, uint8_t freq_scale,
+                               uint8_t alter_scale, uint8_t xover_band)
+{
+    uint8_t result = 0;
+    uint8_t k2;
+
+    /* calculate the Master Frequency Table */
+    sbr->k0 = qmf_start_channel(start_freq, samplerate_mode, sbr->sample_rate);
+    k2 = qmf_stop_channel(stop_freq, sbr->sample_rate, sbr->k0);
+
+    /* check k0 and k2 */
+    if (sbr->sample_rate >= 48000)
     {
-        sbr->Reset = 1;
+        if ((k2 - sbr->k0) > 32)
+            result += 1;
+    } else if (sbr->sample_rate <= 32000) {
+        if ((k2 - sbr->k0) > 48)
+            result += 1;
+    } else { /* (sbr->sample_rate == 44100) */
+        if ((k2 - sbr->k0) > 45)
+            result += 1;
     }
+
+    if (freq_scale == 0)
+    {
+        result += master_frequency_table_fs0(sbr, sbr->k0, k2, alter_scale);
+    } else {
+        result += master_frequency_table(sbr, sbr->k0, k2, freq_scale, alter_scale);
+    }
+    result += derived_frequency_table(sbr, xover_band, k2);
+
+    result = (result > 0) ? 1 : 0;
+
+    return result;
 }
 
 /* table 2 */
@@ -112,6 +137,10 @@
     uint16_t num_align_bits = 0;
     uint16_t num_sbr_bits = (uint16_t)faad_get_processed_bits(ld);
 
+    uint8_t saved_start_freq, saved_samplerate_mode;
+    uint8_t saved_stop_freq, saved_freq_scale;
+    uint8_t saved_alter_scale, saved_xover_band;
+
 #ifdef DRM
     if (!sbr->Is_DRM_SBR)
 #endif
@@ -126,6 +155,14 @@
         }
     }
 
+    /* save old header values, in case the new ones are corrupted */
+    saved_start_freq = sbr->bs_start_freq;
+    saved_samplerate_mode = sbr->bs_samplerate_mode;
+    saved_stop_freq = sbr->bs_stop_freq;
+    saved_freq_scale = sbr->bs_freq_scale;
+    saved_alter_scale = sbr->bs_alter_scale;
+    saved_xover_band = sbr->bs_xover_band;
+
     sbr->bs_header_flag = faad_get1bit(ld
         DEBUGVAR(1,200,"sbr_bitstream(): bs_header_flag"));
 
@@ -141,41 +178,40 @@
     {
         if (sbr->Reset || (sbr->bs_header_flag && sbr->just_seeked))
         {
-            uint8_t k2;
+            uint8_t rt = calc_sbr_tables(sbr, sbr->bs_start_freq, sbr->bs_stop_freq,
+                sbr->bs_samplerate_mode, sbr->bs_freq_scale,
+                sbr->bs_alter_scale, sbr->bs_xover_band);
 
-            /* calculate the Master Frequency Table */
-            sbr->k0 = qmf_start_channel(sbr->bs_start_freq, sbr->bs_samplerate_mode,
-                sbr->sample_rate);
-            k2 = qmf_stop_channel(sbr->bs_stop_freq, sbr->sample_rate, sbr->k0);
-
-            /* check k0 and k2 */
-            if (sbr->sample_rate >= 48000)
+            /* if an error occured with the new header values revert to the old ones */
+            if (rt > 0)
             {
-                if ((k2 - sbr->k0) > 32)
-                    result += 1;
-            } else if (sbr->sample_rate <= 32000) {
-                if ((k2 - sbr->k0) > 48)
-                    result += 1;
-            } else { /* (sbr->sample_rate == 44100) */
-                if ((k2 - sbr->k0) > 45)
-                    result += 1;
+                calc_sbr_tables(sbr, saved_start_freq, saved_stop_freq,
+                    saved_samplerate_mode, saved_freq_scale,
+                    saved_alter_scale, saved_xover_band);
             }
-
-            if (sbr->bs_freq_scale == 0)
-            {
-                result += master_frequency_table_fs0(sbr, sbr->k0, k2,
-                    sbr->bs_alter_scale);
-            } else {
-                result += master_frequency_table(sbr, sbr->k0, k2, sbr->bs_freq_scale,
-                    sbr->bs_alter_scale);
-            }
-            result += derived_frequency_table(sbr, sbr->bs_xover_band, k2);
-
-            result = (result > 0) ? 1 : 0;
         }
 
         if (result == 0)
+        {
             result = sbr_data(ld, sbr);
+
+            /* sbr_data() returning an error means that there was an error in
+               envelope_time_border_vector().
+               In this case the old time border vector is saved and all the previous
+               data normally read after sbr_grid() is saved.
+            */
+            /* to be on the safe side, calculate old sbr tables in case of error */
+            if ((result > 0) &&
+                (sbr->Reset || (sbr->bs_header_flag && sbr->just_seeked)))
+            {
+                calc_sbr_tables(sbr, saved_start_freq, saved_stop_freq,
+                    saved_samplerate_mode, saved_freq_scale,
+                    saved_alter_scale, saved_xover_band);
+            }
+
+            /* we should be able to safely set result to 0 now */
+            result = 0;
+        }
     } else {
         result = 1;
     }
@@ -185,6 +221,11 @@
 #endif
     {
         num_sbr_bits = (uint16_t)faad_get_processed_bits(ld) - num_sbr_bits;
+
+        /* check if we read more bits then were available for sbr */
+        if (8*cnt < num_sbr_bits)
+            return 1;
+
         /* -4 does not apply, bs_extension_type is re-read in this function */
         num_align_bits = 8*cnt /*- 4*/ - num_sbr_bits;
 
@@ -333,7 +374,9 @@
     sbr_envelope(ld, sbr, 0);
     sbr_noise(ld, sbr, 0);
 
+#ifndef FIXED_POINT
     envelope_noise_dequantisation(sbr, 0);
+#endif
 
     memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t));
 
@@ -344,9 +387,13 @@
 
     sbr->bs_extended_data = faad_get1bit(ld
         DEBUGVAR(1,224,"sbr_single_channel_element(): bs_extended_data[0]"));
+
     if (sbr->bs_extended_data)
     {
         uint16_t nr_bits_left;
+#if (defined(PS_DEC) || defined(DRM_PS))
+        uint8_t ps_ext_read = 0;
+#endif
         uint16_t cnt = (uint16_t)faad_getbits(ld, 4
             DEBUGVAR(1,225,"sbr_single_channel_element(): bs_extension_size"));
         if (cnt == 15)
@@ -358,10 +405,44 @@
         nr_bits_left = 8 * cnt;
         while (nr_bits_left > 7)
         {
+            uint16_t tmp_nr_bits = 0;
+
             sbr->bs_extension_id = (uint8_t)faad_getbits(ld, 2
                 DEBUGVAR(1,227,"sbr_single_channel_element(): bs_extension_id"));
-            nr_bits_left -= 2;
-            nr_bits_left -= sbr_extension(ld, sbr, sbr->bs_extension_id, nr_bits_left);
+            tmp_nr_bits += 2;
+
+            /* allow only 1 PS extension element per extension data */
+#if (defined(PS_DEC) || defined(DRM_PS))
+#if (defined(PS_DEC) && defined(DRM_PS))
+            if (sbr->bs_extension_id == EXTENSION_ID_PS || sbr->bs_extension_id == DRM_PARAMETRIC_STEREO)
+#else
+#ifdef PS_DEC
+            if (sbr->bs_extension_id == EXTENSION_ID_PS)
+#else
+#ifdef DRM_PS
+            if (sbr->bs_extension_id == DRM_PARAMETRIC_STEREO)
+#endif
+#endif
+#endif
+            {
+                if (ps_ext_read == 0)
+                {
+                    ps_ext_read = 1;
+                } else {
+                    /* to be safe make it 3, will switch to "default"
+                     * in sbr_extension() */
+                    sbr->bs_extension_id = 3;
+                }
+            }
+#endif
+
+            tmp_nr_bits += sbr_extension(ld, sbr, sbr->bs_extension_id, nr_bits_left);
+
+            /* check if the data read is bigger than the number of available bits */
+            if (tmp_nr_bits > nr_bits_left)
+                return 1;
+
+            nr_bits_left -= tmp_nr_bits;
         }
 
         /* Corrigendum */
@@ -437,10 +518,31 @@
         if (sbr->bs_add_harmonic_flag[1])
             sinusoidal_coding(ld, sbr, 1);
     } else {
+        uint8_t saved_t_E[6] = {0}, saved_t_Q[3] = {0};
+        uint8_t saved_L_E = sbr->L_E[0];
+        uint8_t saved_L_Q = sbr->L_Q[0];
+        uint8_t saved_frame_class = sbr->bs_frame_class[0];
+
+        for (n = 0; n < saved_L_E; n++)
+            saved_t_E[n] = sbr->t_E[0][n];
+        for (n = 0; n < saved_L_Q; n++)
+            saved_t_Q[n] = sbr->t_Q[0][n];
+
         if ((result = sbr_grid(ld, sbr, 0)) > 0)
             return result;
         if ((result = sbr_grid(ld, sbr, 1)) > 0)
+        {
+            /* restore first channel data as well */
+            sbr->bs_frame_class[0] = saved_frame_class;
+            sbr->L_E[0] = saved_L_E;
+            sbr->L_Q[0] = saved_L_Q;
+            for (n = 0; n < 6; n++)
+                sbr->t_E[0][n] = saved_t_E[n];
+            for (n = 0; n < 3; n++)
+                sbr->t_Q[0][n] = saved_t_Q[n];
+
             return result;
+        }
         sbr_dtdf(ld, sbr, 0);
         sbr_dtdf(ld, sbr, 1);
         invf_mode(ld, sbr, 0);
@@ -463,11 +565,13 @@
         if (sbr->bs_add_harmonic_flag[1])
             sinusoidal_coding(ld, sbr, 1);
     }
+#ifndef FIXED_POINT
     envelope_noise_dequantisation(sbr, 0);
     envelope_noise_dequantisation(sbr, 1);
 
     if (sbr->bs_coupling)
         unmap_envelope_noise(sbr);
+#endif
 
     sbr->bs_extended_data = faad_get1bit(ld
         DEBUGVAR(1,233,"sbr_channel_pair_element(): bs_extended_data[0]"));
@@ -485,10 +589,18 @@
         nr_bits_left = 8 * cnt;
         while (nr_bits_left > 7)
         {
+            uint16_t tmp_nr_bits = 0;
+
             sbr->bs_extension_id = (uint8_t)faad_getbits(ld, 2
                 DEBUGVAR(1,236,"sbr_channel_pair_element(): bs_extension_id"));
-            nr_bits_left -= 2;
-            sbr_extension(ld, sbr, sbr->bs_extension_id, nr_bits_left);
+            tmp_nr_bits += 2;
+            tmp_nr_bits += sbr_extension(ld, sbr, sbr->bs_extension_id, nr_bits_left);
+
+            /* check if the data read is bigger than the number of available bits */
+            if (tmp_nr_bits > nr_bits_left)
+                return 1;
+
+            nr_bits_left -= tmp_nr_bits;
         }
 
         /* Corrigendum */
@@ -519,6 +631,9 @@
     uint8_t i, env, rel, result;
     uint8_t bs_abs_bord, bs_abs_bord_1;
     uint8_t bs_num_env = 0;
+    uint8_t saved_L_E = sbr->L_E[ch];
+    uint8_t saved_L_Q = sbr->L_Q[ch];
+    uint8_t saved_frame_class = sbr->bs_frame_class[ch];
 
     sbr->bs_frame_class[ch] = (uint8_t)faad_getbits(ld, 2
         DEBUGVAR(1,248,"sbr_grid(): bs_frame_class"));
@@ -650,9 +765,21 @@
 
     /* TODO: this code can probably be integrated into the code above! */
     if ((result = envelope_time_border_vector(sbr, ch)) > 0)
+    {
+        sbr->bs_frame_class[ch] = saved_frame_class;
+        sbr->L_E[ch] = saved_L_E;
+        sbr->L_Q[ch] = saved_L_Q;
         return result;
+    }
     noise_floor_time_border_vector(sbr, ch);
 
+#if 0
+    for (env = 0; env < bs_num_env; env++)
+    {
+        printf("freq_res[ch:%d][env:%d]: %d\n", ch, env, sbr->f[ch][env]);
+    }
+#endif
+
     return 0;
 }
 
@@ -689,17 +816,37 @@
 static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr,
                               uint8_t bs_extension_id, uint16_t num_bits_left)
 {
+#ifdef PS_DEC
+    uint8_t header;
+    uint16_t ret;
+#endif
+
     switch (bs_extension_id)
     {
 #ifdef PS_DEC
     case EXTENSION_ID_PS:
-        sbr->ps_used = 1;
-        return ps_data(&(sbr->ps), ld);
+        if (!sbr->ps)
+        {
+            sbr->ps = ps_init(get_sr_index(sbr->sample_rate));
+        }
+        ret = ps_data(sbr->ps, ld, &header);
+
+        /* enable PS if and only if: a header has been decoded */
+        if (sbr->ps_used == 0 && header == 1)
+        {
+            sbr->ps_used = 1;
+        }
+
+        return ret;
 #endif
 #ifdef DRM_PS
     case DRM_PARAMETRIC_STEREO:
         sbr->ps_used = 1;
-        return drm_ps_data(&(sbr->drm_ps), ld);
+        if (!sbr->drm_ps)
+        {
+            sbr->drm_ps = drm_ps_init();
+        }
+        return drm_ps_data(sbr->drm_ps, ld);
 #endif
     default:
         sbr->bs_extension_data = (uint8_t)faad_getbits(ld, 6
--- a/Plugins/Input/aac/libfaad2/sbr_syntax.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sbr_syntax.h	Wed May 10 14:44:20 2006 -0700
@@ -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.15 2004/01/10 18:52:47 menno Exp $
+** $Id: sbr_syntax.h,v 1.19 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_SYNTAX_H__
--- a/Plugins/Input/aac/libfaad2/sbr_tf_grid.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sbr_tf_grid.c	Wed May 10 14:44:20 2006 -0700
@@ -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.10 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_tf_grid.c,v 1.15 2004/09/04 14:56:28 menno Exp $
 **/
 
 /* Time/Frequency grid */
@@ -46,17 +46,15 @@
 static uint8_t middleBorder(sbr_info *sbr, uint8_t ch);
 
 
+/* function constructs new time border vector */
+/* first build into temp vector to be able to use previous vector on error */
 uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch)
 {
     uint8_t l, border, temp;
+    uint8_t t_E_temp[6] = {0};
 
-    for (l = 0; l <= sbr->L_E[ch]; l++)
-    {
-        sbr->t_E[ch][l] = 0;
-    }
-
-    sbr->t_E[ch][0] = sbr->rate * sbr->abs_bord_lead[ch];
-    sbr->t_E[ch][sbr->L_E[ch]] = sbr->rate * sbr->abs_bord_trail[ch];
+    t_E_temp[0] = sbr->rate * sbr->abs_bord_lead[ch];
+    t_E_temp[sbr->L_E[ch]] = sbr->rate * sbr->abs_bord_trail[ch];
 
     switch (sbr->bs_frame_class[ch])
     {
@@ -65,12 +63,12 @@
         {
         case 4:
             temp = (int) (sbr->numTimeSlots / 4);
-            sbr->t_E[ch][3] = sbr->rate * 3 * temp;
-            sbr->t_E[ch][2] = sbr->rate * 2 * temp;
-            sbr->t_E[ch][1] = sbr->rate * temp;
+            t_E_temp[3] = sbr->rate * 3 * temp;
+            t_E_temp[2] = sbr->rate * 2 * temp;
+            t_E_temp[1] = sbr->rate * temp;
             break;
         case 2:
-            sbr->t_E[ch][1] = sbr->rate * (int) (sbr->numTimeSlots / 2);
+            t_E_temp[1] = sbr->rate * (int) (sbr->numTimeSlots / 2);
             break;
         default:
             break;
@@ -89,7 +87,7 @@
                     return 1;
 
                 border -= sbr->bs_rel_bord[ch][l];
-                sbr->t_E[ch][--i] = sbr->rate * border;
+                t_E_temp[--i] = sbr->rate * border;
             }
         }
         break;
@@ -107,7 +105,7 @@
                 if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen)
                     return 1;
 
-                sbr->t_E[ch][i++] = sbr->rate * border;
+                t_E_temp[i++] = sbr->rate * border;
             }
         }
         break;
@@ -125,7 +123,7 @@
                 if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen)
                     return 1;
 
-                sbr->t_E[ch][i++] = sbr->rate * border;
+                t_E_temp[i++] = sbr->rate * border;
             }
         }
 
@@ -140,12 +138,18 @@
                     return 1;
 
                 border -= sbr->bs_rel_bord_1[ch][l];
-                sbr->t_E[ch][--i] = sbr->rate * border;
+                t_E_temp[--i] = sbr->rate * border;
             }
         }
         break;
     }
 
+    /* no error occured, we can safely use this t_E vector */
+    for (l = 0; l < 6; l++)
+    {
+        sbr->t_E[ch][l] = t_E_temp[l];
+    }
+
     return 0;
 }
 
--- a/Plugins/Input/aac/libfaad2/sbr_tf_grid.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sbr_tf_grid.h	Wed May 10 14:44:20 2006 -0700
@@ -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.9 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_tf_grid.h,v 1.13 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_TF_GRID_H__
--- a/Plugins/Input/aac/libfaad2/sine_win.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/sine_win.h	Wed May 10 14:44:20 2006 -0700
@@ -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.11 2004/01/05 14:05:12 menno Exp $
+** $Id: sine_win.h,v 1.15 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SINE_WIN_H__
--- a/Plugins/Input/aac/libfaad2/specrec.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/specrec.c	Wed May 10 14:44:20 2006 -0700
@@ -1,19 +1,19 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
 ** 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
 ** the Free Software Foundation; either version 2 of the License, or
 ** (at your option) any later version.
-** 
+**
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ** GNU General Public License for more details.
-** 
+**
 ** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software 
+** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
 ** Any non-GPL usage of this software or parts of this software is strictly
@@ -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.43 2004/01/29 11:31:11 menno Exp $
+** $Id: specrec.c,v 1.56 2004/09/08 09:43:11 gcp Exp $
 **/
 
 /*
@@ -38,6 +38,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include "specrec.h"
+#include "filtbank.h"
 #include "syntax.h"
 #include "iq_table.h"
 #include "ms.h"
@@ -54,8 +55,9 @@
 
 
 /* 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);
+static uint8_t quant_to_spec(NeAACDecHandle hDecoder,
+                             ic_stream *ics, int16_t *quant_data,
+                             real_t *spec_data, uint16_t frame_len);
 
 
 #ifdef LD_DEC
@@ -295,7 +297,7 @@
     in section named section. This offset depends on window_sequence and
     scale_factor_grouping and is needed to decode the spectral_data().
 */
-uint8_t window_grouping_info(faacDecHandle hDecoder, ic_stream *ics)
+uint8_t window_grouping_info(NeAACDecHandle hDecoder, ic_stream *ics)
 {
     uint8_t i, g;
 
@@ -407,75 +409,24 @@
     }
 }
 
-/*
-  For ONLY_LONG_SEQUENCE windows (num_window_groups = 1,
-  window_group_length[0] = 1) the spectral data is in ascending spectral
-  order.
-  For the EIGHT_SHORT_SEQUENCE window, the spectral order depends on the
-  grouping in the following manner:
-  - Groups are ordered sequentially
-  - Within a group, a scalefactor band consists of the spectral data of all
-    grouped SHORT_WINDOWs for the associated scalefactor window band. To
-    clarify via example, the length of a group is in the range of one to eight
-    SHORT_WINDOWs.
-  - If there are eight groups each with length one (num_window_groups = 8,
-    window_group_length[0..7] = 1), the result is a sequence of eight spectra,
-    each in ascending spectral order.
-  - If there is only one group with length eight (num_window_groups = 1,
-    window_group_length[0] = 8), the result is that spectral data of all eight
-    SHORT_WINDOWs is interleaved by scalefactor window bands.
-  - Within a scalefactor window band, the coefficients are in ascending
-    spectral order.
-*/
-static void quant_to_spec(ic_stream *ics, real_t *spec_data, uint16_t frame_len)
-{
-    uint8_t g, sfb, win;
-    uint16_t width, bin, k, gindex;
-
-    ALIGN real_t tmp_spec[1024] = {0};
-
-    k = 0;
-    gindex = 0;
-
-    for (g = 0; g < ics->num_window_groups; g++)
-    {
-        uint16_t j = 0;
-        uint16_t gincrease = 0;
-        uint16_t win_inc = ics->swb_offset[ics->num_swb];
-
-        for (sfb = 0; sfb < ics->num_swb; sfb++)
-        {
-            width = ics->swb_offset[sfb+1] - ics->swb_offset[sfb];
-
-            for (win = 0; win < ics->window_group_length[g]; win++)
-            {
-                for (bin = 0; bin < width; bin += 4)
-                {
-                    tmp_spec[gindex+(win*win_inc)+j+bin+0] = spec_data[k+0];
-                    tmp_spec[gindex+(win*win_inc)+j+bin+1] = spec_data[k+1];
-                    tmp_spec[gindex+(win*win_inc)+j+bin+2] = spec_data[k+2];
-                    tmp_spec[gindex+(win*win_inc)+j+bin+3] = spec_data[k+3];
-                    gincrease += 4;
-                    k += 4;
-                }
-            }
-            j += width;
-        }
-        gindex += gincrease;
-    }
-
-    memcpy(spec_data, tmp_spec, frame_len*sizeof(real_t));
-}
-
+/* iquant() *
+ * output = sign(input)*abs(input)^(4/3)
+ */
 static INLINE real_t iquant(int16_t q, const real_t *tab, uint8_t *error)
 {
 #ifdef FIXED_POINT
+/* For FIXED_POINT the iq_table is prescaled by 3 bits (iq_table[]/8) */
+/* BIG_IQ_TABLE allows you to use the full 8192 value table, if this is not
+ * defined a 1026 value table and interpolation will be used
+ */
+#ifndef BIG_IQ_TABLE
     static const real_t errcorr[] = {
         REAL_CONST(0), REAL_CONST(1.0/8.0), REAL_CONST(2.0/8.0), REAL_CONST(3.0/8.0),
         REAL_CONST(4.0/8.0),  REAL_CONST(5.0/8.0), REAL_CONST(6.0/8.0), REAL_CONST(7.0/8.0),
         REAL_CONST(0)
     };
     real_t x1, x2;
+#endif
     int16_t sgn = 1;
 
     if (q < 0)
@@ -485,13 +436,32 @@
     }
 
     if (q < IQ_TABLE_SIZE)
+    {
+//#define IQUANT_PRINT
+#ifdef IQUANT_PRINT
+        //printf("0x%.8X\n", sgn * tab[q]);
+        printf("%d\n", sgn * tab[q]);
+#endif
         return sgn * tab[q];
+    }
+
+#ifndef BIG_IQ_TABLE
+    if (q >= 8192)
+    {
+        *error = 17;
+        return 0;
+    }
 
     /* linear interpolation */
     x1 = tab[q>>3];
     x2 = tab[(q>>3) + 1];
     return sgn * 16 * (MUL_R(errcorr[q&7],(x2-x1)) + x1);
 #else
+    *error = 17;
+    return 0;
+#endif
+
+#else
     if (q < 0)
     {
         /* tab contains a value for all possible q [0,8192] */
@@ -511,23 +481,6 @@
 #endif
 }
 
-static uint8_t inverse_quantization(real_t *x_invquant, const int16_t *x_quant, const uint16_t frame_len)
-{
-    int16_t i;
-    uint8_t error = 0; /* Init error flag */
-    const real_t *tab = iq_table;
-
-    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);
-        x_invquant[i+2] = iquant(x_quant[i+2], tab, &error);
-        x_invquant[i+3] = iquant(x_quant[i+3], tab, &error);
-    }
-
-    return error;
-}
-
 #ifndef FIXED_POINT
 ALIGN static const real_t pow2sf_tab[] = {
     2.9802322387695313E-008, 5.9604644775390625E-008, 1.1920928955078125E-007,
@@ -554,39 +507,63 @@
 };
 #endif
 
-ALIGN static real_t pow2_table[] =
+/* quant_to_spec: perform dequantisation and scaling
+ * and in case of short block it also does the deinterleaving
+ */
+/*
+  For ONLY_LONG_SEQUENCE windows (num_window_groups = 1,
+  window_group_length[0] = 1) the spectral data is in ascending spectral
+  order.
+  For the EIGHT_SHORT_SEQUENCE window, the spectral order depends on the
+  grouping in the following manner:
+  - Groups are ordered sequentially
+  - Within a group, a scalefactor band consists of the spectral data of all
+    grouped SHORT_WINDOWs for the associated scalefactor window band. To
+    clarify via example, the length of a group is in the range of one to eight
+    SHORT_WINDOWs.
+  - If there are eight groups each with length one (num_window_groups = 8,
+    window_group_length[0..7] = 1), the result is a sequence of eight spectra,
+    each in ascending spectral order.
+  - If there is only one group with length eight (num_window_groups = 1,
+    window_group_length[0] = 8), the result is that spectral data of all eight
+    SHORT_WINDOWs is interleaved by scalefactor window bands.
+  - Within a scalefactor window band, the coefficients are in ascending
+    spectral order.
+*/
+static uint8_t quant_to_spec(NeAACDecHandle hDecoder,
+                             ic_stream *ics, int16_t *quant_data,
+                             real_t *spec_data, uint16_t frame_len)
 {
-#if 0
-    COEF_CONST(0.59460355750136053335874998528024), /* 2^-0.75 */
-    COEF_CONST(0.70710678118654752440084436210485), /* 2^-0.5 */
-    COEF_CONST(0.84089641525371454303112547623321), /* 2^-0.25 */
+    ALIGN static const real_t pow2_table[] =
+    {
+        COEF_CONST(1.0),
+        COEF_CONST(1.1892071150027210667174999705605), /* 2^0.25 */
+        COEF_CONST(1.4142135623730950488016887242097), /* 2^0.5 */
+        COEF_CONST(1.6817928305074290860622509524664) /* 2^0.75 */
+    };
+    const real_t *tab = iq_table;
+
+    uint8_t g, sfb, win;
+    uint16_t width, bin, k, gindex, wa, wb;
+    uint8_t error = 0; /* Init error flag */
+#ifndef FIXED_POINT
+    real_t scf;
 #endif
-    COEF_CONST(1.0),
-    COEF_CONST(1.1892071150027210667174999705605), /* 2^0.25 */
-    COEF_CONST(1.4142135623730950488016887242097), /* 2^0.5 */
-    COEF_CONST(1.6817928305074290860622509524664) /* 2^0.75 */
-};
 
-void apply_scalefactors(faacDecHandle hDecoder, ic_stream *ics,
-                        real_t *x_invquant, uint16_t frame_len)
-{
-    uint8_t g, sfb;
-    uint16_t top;
-    int32_t exp, frac;
-    uint8_t groups = 0;
-    uint16_t nshort = frame_len/8;
+    k = 0;
+    gindex = 0;
 
     for (g = 0; g < ics->num_window_groups; g++)
     {
-        uint16_t k = 0;
+        uint16_t j = 0;
+        uint16_t gincrease = 0;
+        uint16_t win_inc = ics->swb_offset[ics->num_swb];
 
-        /* using this nshort*groups doesn't hurt long blocks, because
-           long blocks only have 1 group, so that means 'groups' is
-           always 0 for long blocks
-        */
-        for (sfb = 0; sfb < ics->max_sfb; sfb++)
+        for (sfb = 0; sfb < ics->num_swb; sfb++)
         {
-            top = ics->sect_sfb_offset[g][sfb+1];
+            int32_t exp, frac;
+
+            width = ics->swb_offset[sfb+1] - ics->swb_offset[sfb];
 
             /* this could be scalefactor for IS or PNS, those can be negative or bigger then 255 */
             /* just ignore them */
@@ -597,6 +574,7 @@
             } else {
                 /* ics->scale_factors[g][sfb] must be between 0 and 255 */
                 exp = (ics->scale_factors[g][sfb] /* - 100 */) >> 2;
+                /* frac must always be > 0 */
                 frac = (ics->scale_factors[g][sfb] /* - 100 */) & 3;
             }
 
@@ -614,81 +592,79 @@
             }
 #endif
 
-            /* minimum size of a sf band is 4 and always a multiple of 4 */
-            for ( ; k < top; k += 4)
-            {
-#ifdef FIXED_POINT
-                if (exp < 0)
-                {
-                    x_invquant[k+(groups*nshort)] >>= -exp;
-                    x_invquant[k+(groups*nshort)+1] >>= -exp;
-                    x_invquant[k+(groups*nshort)+2] >>= -exp;
-                    x_invquant[k+(groups*nshort)+3] >>= -exp;
-                } else {
-                    x_invquant[k+(groups*nshort)] <<= exp;
-                    x_invquant[k+(groups*nshort)+1] <<= exp;
-                    x_invquant[k+(groups*nshort)+2] <<= exp;
-                    x_invquant[k+(groups*nshort)+3] <<= exp;
-                }
-#else
-                x_invquant[k+(groups*nshort)]   = x_invquant[k+(groups*nshort)]   * pow2sf_tab[exp/*+25*/];
-                x_invquant[k+(groups*nshort)+1] = x_invquant[k+(groups*nshort)+1] * pow2sf_tab[exp/*+25*/];
-                x_invquant[k+(groups*nshort)+2] = x_invquant[k+(groups*nshort)+2] * pow2sf_tab[exp/*+25*/];
-                x_invquant[k+(groups*nshort)+3] = x_invquant[k+(groups*nshort)+3] * pow2sf_tab[exp/*+25*/];
+            wa = gindex + j;
+
+#ifndef FIXED_POINT
+            scf = pow2sf_tab[exp/*+25*/] * pow2_table[frac];
 #endif
 
-                x_invquant[k+(groups*nshort)]   = MUL_C(x_invquant[k+(groups*nshort)],pow2_table[frac /* + 3*/]);
-                x_invquant[k+(groups*nshort)+1] = MUL_C(x_invquant[k+(groups*nshort)+1],pow2_table[frac /* + 3*/]);
-                x_invquant[k+(groups*nshort)+2] = MUL_C(x_invquant[k+(groups*nshort)+2],pow2_table[frac /* + 3*/]);
-                x_invquant[k+(groups*nshort)+3] = MUL_C(x_invquant[k+(groups*nshort)+3],pow2_table[frac /* + 3*/]);
+            for (win = 0; win < ics->window_group_length[g]; win++)
+            {
+                for (bin = 0; bin < width; bin += 4)
+                {
+#ifndef FIXED_POINT
+                    wb = wa + bin;
+
+                    spec_data[wb+0] = iquant(quant_data[k+0], tab, &error) * scf;
+                    spec_data[wb+1] = iquant(quant_data[k+1], tab, &error) * scf;                        
+                    spec_data[wb+2] = iquant(quant_data[k+2], tab, &error) * scf;                        
+                    spec_data[wb+3] = iquant(quant_data[k+3], tab, &error) * scf;
+                        
+#else
+                    real_t iq0 = iquant(quant_data[k+0], tab, &error);
+                    real_t iq1 = iquant(quant_data[k+1], tab, &error);
+                    real_t iq2 = iquant(quant_data[k+2], tab, &error);
+                    real_t iq3 = iquant(quant_data[k+3], tab, &error);
+
+                    wb = wa + bin;
+
+                    if (exp < 0)
+                    {
+                        spec_data[wb+0] = iq0 >>= -exp;
+                        spec_data[wb+1] = iq1 >>= -exp;
+                        spec_data[wb+2] = iq2 >>= -exp;
+                        spec_data[wb+3] = iq3 >>= -exp;
+                    } else {
+                        spec_data[wb+0] = iq0 <<= exp;
+                        spec_data[wb+1] = iq1 <<= exp;
+                        spec_data[wb+2] = iq2 <<= exp;
+                        spec_data[wb+3] = iq3 <<= exp;
+                    }
+                    if (frac != 0)
+                    {
+                        spec_data[wb+0] = MUL_C(spec_data[wb+0],pow2_table[frac]);
+                        spec_data[wb+1] = MUL_C(spec_data[wb+1],pow2_table[frac]);
+                        spec_data[wb+2] = MUL_C(spec_data[wb+2],pow2_table[frac]);
+                        spec_data[wb+3] = MUL_C(spec_data[wb+3],pow2_table[frac]);
+                    }
+
+//#define SCFS_PRINT
+#ifdef SCFS_PRINT
+                    printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+0]);
+                    printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+1]);
+                    printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+2]);
+                    printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+3]);
+                    //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+0]);
+                    //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+1]);
+                    //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+2]);
+                    //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+3]);
+#endif
+#endif
+
+                    gincrease += 4;
+                    k += 4;
+                }
+                wa += win_inc;
             }
+            j += width;
         }
-        groups += ics->window_group_length[g];
+        gindex += gincrease;
     }
+
+    return error;
 }
 
-#ifdef USE_SSE
-void apply_scalefactors_sse(faacDecHandle hDecoder, ic_stream *ics,
-                            real_t *x_invquant, uint16_t frame_len)
-{
-    uint8_t g, sfb;
-    uint16_t top;
-    int32_t exp, frac;
-    uint8_t groups = 0;
-    uint16_t nshort = frame_len/8;
-
-    for (g = 0; g < ics->num_window_groups; g++)
-    {
-        uint16_t k = 0;
-
-        /* using this nshort*groups doesn't hurt long blocks, because
-           long blocks only have 1 group, so that means 'groups' is
-           always 0 for long blocks
-        */
-        for (sfb = 0; sfb < ics->max_sfb; sfb++)
-        {
-            top = ics->sect_sfb_offset[g][sfb+1];
-
-            exp = (ics->scale_factors[g][sfb] /* - 100 */) >> 2;
-            frac = (ics->scale_factors[g][sfb] /* - 100 */) & 3;
-
-            /* minimum size of a sf band is 4 and always a multiple of 4 */
-            for ( ; k < top; k += 4)
-            {
-                __m128 m1 = _mm_load_ps(&x_invquant[k+(groups*nshort)]);
-                __m128 m2 = _mm_load_ps1(&pow2sf_tab[exp /*+25*/]);
-                __m128 m3 = _mm_load_ps1(&pow2_table[frac /* + 3*/]);
-                __m128 m4 = _mm_mul_ps(m1, m2);
-                __m128 m5 = _mm_mul_ps(m3, m4);
-                _mm_store_ps(&x_invquant[k+(groups*nshort)], m5);
-            }
-        }
-        groups += ics->window_group_length[g];
-    }
-}
-#endif
-
-static uint8_t allocate_single_channel(faacDecHandle hDecoder, uint8_t channel,
+static uint8_t allocate_single_channel(NeAACDecHandle hDecoder, uint8_t channel,
                                        uint8_t output_channels)
 {
     uint8_t mul = 1;
@@ -771,7 +747,7 @@
     return 0;
 }
 
-static uint8_t allocate_channel_pair(faacDecHandle hDecoder,
+static uint8_t allocate_channel_pair(NeAACDecHandle hDecoder,
                                      uint8_t channel, uint8_t paired_channel)
 {
     uint8_t mul = 1;
@@ -876,7 +852,7 @@
     return 0;
 }
 
-uint8_t reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics,
+uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics,
                                    element *sce, int16_t *spec_data)
 {
     uint8_t retval, output_channels;
@@ -887,12 +863,13 @@
 #endif
 
 
-    /* determine whether some mono->stereo tool is used */
+    /* always allocate 2 channels, PS can always "suddenly" turn up */
 #if (defined(PS_DEC) || defined(DRM_PS))
-    output_channels = hDecoder->ps_used[hDecoder->fr_ch_ele] ? 2 : 1;
+    output_channels = 2;
 #else
     output_channels = 1;
 #endif
+
     if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0)
     {
         /* element_output_channels not set yet */
@@ -902,7 +879,6 @@
         return 21;
     }
 
-
     if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0)
     {
         retval = allocate_single_channel(hDecoder, sce->channel, output_channels);
@@ -913,22 +889,11 @@
     }
 
 
-    /* inverse quantization */
-    retval = inverse_quantization(spec_coef, spec_data, hDecoder->frameLength);
+    /* dequantisation and scaling */
+    retval = quant_to_spec(hDecoder, ics, spec_data, spec_coef, hDecoder->frameLength);
     if (retval > 0)
         return retval;
 
-    /* apply scalefactors */
-#ifndef USE_SSE
-    apply_scalefactors(hDecoder, ics, spec_coef, hDecoder->frameLength);
-#else
-    hDecoder->apply_sf_func(hDecoder, ics, spec_coef, hDecoder->frameLength);
-#endif
-
-    /* deinterleave short block grouping */
-    if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
-        quant_to_spec(ics, spec_coef, hDecoder->frameLength);
-
 #ifdef PROFILE
     count = faad_get_ts() - count;
     hDecoder->requant_cycles += count;
@@ -987,22 +952,15 @@
             drc_decode(hDecoder->drc, spec_coef);
     }
 
-
     /* filter bank */
 #ifdef SSR_DEC
     if (hDecoder->object_type != SSR)
     {
 #endif
-#ifdef USE_SSE
-        hDecoder->fb->if_func(hDecoder->fb, ics->window_sequence, ics->window_shape,
-            hDecoder->window_shape_prev[sce->channel], spec_coef,
-            hDecoder->time_out[sce->channel], hDecoder->object_type, hDecoder->frameLength);
-#else
         ifilter_bank(hDecoder->fb, ics->window_sequence, ics->window_shape,
             hDecoder->window_shape_prev[sce->channel], spec_coef,
             hDecoder->time_out[sce->channel], hDecoder->fb_intermed[sce->channel],
             hDecoder->object_type, hDecoder->frameLength);
-#endif
 #ifdef SSR_DEC
     } else {
         ssr_decode(&(ics->ssr), hDecoder->fb, ics->window_sequence, ics->window_shape,
@@ -1034,25 +992,31 @@
         if (hDecoder->sbr[ele] == NULL)
         {
             hDecoder->sbr[ele] = sbrDecodeInit(hDecoder->frameLength,
-                sce->ele_id, 2*get_sample_rate(hDecoder->sf_index)
+                hDecoder->element_id[ele], 2*get_sample_rate(hDecoder->sf_index),
+                hDecoder->downSampledSBR
 #ifdef DRM
                 , 0
 #endif
                 );
         }
 
+        if (sce->ics1.window_sequence == EIGHT_SHORT_SEQUENCE)
+            hDecoder->sbr[ele]->maxAACLine = 8*sce->ics1.swb_offset[max(sce->ics1.max_sfb-1, 0)];
+        else
+            hDecoder->sbr[ele]->maxAACLine = sce->ics1.swb_offset[max(sce->ics1.max_sfb-1, 0)];
+
         /* check if any of the PS tools is used */
 #if (defined(PS_DEC) || defined(DRM_PS))
-        if (output_channels == 1)
+        if (hDecoder->ps_used[ele] == 0)
         {
 #endif
             retval = sbrDecodeSingleFrame(hDecoder->sbr[ele], hDecoder->time_out[ch],
-                hDecoder->postSeekResetFlag, hDecoder->forceUpSampling);
+                hDecoder->postSeekResetFlag, hDecoder->downSampledSBR);
 #if (defined(PS_DEC) || defined(DRM_PS))
         } else {
             retval = sbrDecodeSingleFramePS(hDecoder->sbr[ele], hDecoder->time_out[ch],
                 hDecoder->time_out[ch+1], hDecoder->postSeekResetFlag,
-                hDecoder->forceUpSampling);
+                hDecoder->downSampledSBR);
         }
 #endif
         if (retval > 0)
@@ -1064,10 +1028,23 @@
     }
 #endif
 
+    /* copy L to R when no PS is used */
+#if (defined(PS_DEC) || defined(DRM_PS))
+    if ((hDecoder->ps_used[hDecoder->fr_ch_ele] == 0))
+    {
+        uint8_t ele = hDecoder->fr_ch_ele;
+        uint8_t ch = sce->channel;
+        uint16_t frame_size = (hDecoder->sbr_alloced[ele]) ? 2 : 1;
+        frame_size *= hDecoder->frameLength*sizeof(real_t);
+
+        memcpy(hDecoder->time_out[ch+1], hDecoder->time_out[ch], frame_size);
+    }
+#endif
+
     return 0;
 }
 
-uint8_t reconstruct_channel_pair(faacDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2,
+uint8_t reconstruct_channel_pair(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2,
                                  element *cpe, int16_t *spec_data1, int16_t *spec_data2)
 {
     uint8_t retval;
@@ -1079,36 +1056,20 @@
 #endif
     if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0)
     {
-        retval = allocate_channel_pair(hDecoder, cpe->channel, cpe->paired_channel);
+        retval = allocate_channel_pair(hDecoder, cpe->channel, (uint8_t)cpe->paired_channel);
         if (retval > 0)
             return retval;
 
         hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1;
     }
 
-    /* inverse quantization */
-    retval = inverse_quantization(spec_coef1, spec_data1, hDecoder->frameLength);
-    if (retval > 0)
-        return retval;
-
-    retval = inverse_quantization(spec_coef2, spec_data2, hDecoder->frameLength);
+    /* dequantisation and scaling */
+    retval = quant_to_spec(hDecoder, ics1, spec_data1, spec_coef1, hDecoder->frameLength);
     if (retval > 0)
         return retval;
-
-    /* apply scalefactors */
-#ifndef USE_SSE
-    apply_scalefactors(hDecoder, ics1, spec_coef1, hDecoder->frameLength);
-    apply_scalefactors(hDecoder, ics2, spec_coef2, hDecoder->frameLength);
-#else
-    hDecoder->apply_sf_func(hDecoder, ics1, spec_coef1, hDecoder->frameLength);
-    hDecoder->apply_sf_func(hDecoder, ics2, spec_coef2, hDecoder->frameLength);
-#endif
-
-    /* deinterleave short block grouping */
-    if (ics1->window_sequence == EIGHT_SHORT_SEQUENCE)
-        quant_to_spec(ics1, spec_coef1, hDecoder->frameLength);
-    if (ics2->window_sequence == EIGHT_SHORT_SEQUENCE)
-        quant_to_spec(ics2, spec_coef2, hDecoder->frameLength);
+    retval = quant_to_spec(hDecoder, ics2, spec_data2, spec_coef2, hDecoder->frameLength);
+    if (retval > 0)
+        return retval;
 
 #ifdef PROFILE
     count = faad_get_ts() - count;
@@ -1128,9 +1089,41 @@
     /* mid/side decoding */
     ms_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength);
 
+#if 0
+    {
+        int i;
+        for (i = 0; i < 1024; i++)
+        {
+            //printf("%d\n", spec_coef1[i]);
+            printf("0x%.8X\n", spec_coef1[i]);
+        }
+        for (i = 0; i < 1024; i++)
+        {
+            //printf("%d\n", spec_coef2[i]);
+            printf("0x%.8X\n", spec_coef2[i]);
+        }
+    }
+#endif
+
     /* intensity stereo decoding */
     is_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength);
 
+#if 0
+    {
+        int i;
+        for (i = 0; i < 1024; i++)
+        {
+            printf("%d\n", spec_coef1[i]);
+            //printf("0x%.8X\n", spec_coef1[i]);
+        }
+        for (i = 0; i < 1024; i++)
+        {
+            printf("%d\n", spec_coef2[i]);
+            //printf("0x%.8X\n", spec_coef2[i]);
+        }
+    }
+#endif
+
 #ifdef MAIN_DEC
     /* MAIN object type prediction */
     if (hDecoder->object_type == MAIN)
@@ -1203,14 +1196,6 @@
     if (hDecoder->object_type != SSR)
     {
 #endif
-#ifdef USE_SSE
-        hDecoder->fb->if_func(hDecoder->fb, ics1->window_sequence, ics1->window_shape,
-            hDecoder->window_shape_prev[cpe->channel], spec_coef1,
-            hDecoder->time_out[cpe->channel], hDecoder->object_type, hDecoder->frameLength);
-        hDecoder->fb->if_func(hDecoder->fb, ics2->window_sequence, ics2->window_shape,
-            hDecoder->window_shape_prev[cpe->paired_channel], spec_coef2,
-            hDecoder->time_out[cpe->paired_channel], hDecoder->object_type, hDecoder->frameLength);
-#else
         ifilter_bank(hDecoder->fb, ics1->window_sequence, ics1->window_shape,
             hDecoder->window_shape_prev[cpe->channel], spec_coef1,
             hDecoder->time_out[cpe->channel], hDecoder->fb_intermed[cpe->channel],
@@ -1219,7 +1204,6 @@
             hDecoder->window_shape_prev[cpe->paired_channel], spec_coef2,
             hDecoder->time_out[cpe->paired_channel], hDecoder->fb_intermed[cpe->paired_channel],
             hDecoder->object_type, hDecoder->frameLength);
-#endif
 #ifdef SSR_DEC
     } else {
         ssr_decode(&(ics1->ssr), hDecoder->fb, ics1->window_sequence, ics1->window_shape,
@@ -1259,16 +1243,22 @@
         if (hDecoder->sbr[ele] == NULL)
         {
             hDecoder->sbr[ele] = sbrDecodeInit(hDecoder->frameLength,
-                cpe->ele_id, 2*get_sample_rate(hDecoder->sf_index)
+                hDecoder->element_id[ele], 2*get_sample_rate(hDecoder->sf_index),
+                hDecoder->downSampledSBR
 #ifdef DRM
                 , 0
 #endif
                 );
         }
 
+        if (cpe->ics1.window_sequence == EIGHT_SHORT_SEQUENCE)
+            hDecoder->sbr[ele]->maxAACLine = 8*cpe->ics1.swb_offset[max(cpe->ics1.max_sfb-1, 0)];
+        else
+            hDecoder->sbr[ele]->maxAACLine = cpe->ics1.swb_offset[max(cpe->ics1.max_sfb-1, 0)];
+
         retval = sbrDecodeCoupleFrame(hDecoder->sbr[ele],
             hDecoder->time_out[ch0], hDecoder->time_out[ch1],
-            hDecoder->postSeekResetFlag, hDecoder->forceUpSampling);
+            hDecoder->postSeekResetFlag, hDecoder->downSampledSBR);
         if (retval > 0)
             return retval;
     } else if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
--- a/Plugins/Input/aac/libfaad2/specrec.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/specrec.h	Wed May 10 14:44:20 2006 -0700
@@ -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.23 2004/01/05 14:05:12 menno Exp $
+** $Id: specrec.h,v 1.28 2004/09/04 14:56:29 menno Exp $
 **/
 
 #ifndef __SPECREC_H__
@@ -34,16 +34,10 @@
 
 #include "syntax.h"
 
-uint8_t window_grouping_info(faacDecHandle hDecoder, ic_stream *ics);
-void apply_scalefactors(faacDecHandle hDecoder, ic_stream *ics, real_t *x_invquant,
-                        uint16_t frame_len);
-#ifdef USE_SSE
-void apply_scalefactors_sse(faacDecHandle hDecoder, ic_stream *ics, real_t *x_invquant,
-                            uint16_t frame_len);
-#endif
-uint8_t reconstruct_channel_pair(faacDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2,
+uint8_t window_grouping_info(NeAACDecHandle hDecoder, ic_stream *ics);
+uint8_t reconstruct_channel_pair(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2,
                                  element *cpe, int16_t *spec_data1, int16_t *spec_data2);
-uint8_t reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics, element *sce,
+uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics, element *sce,
                                 int16_t *spec_data);
 
 #ifdef __cplusplus
--- a/Plugins/Input/aac/libfaad2/ssr.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/ssr.c	Wed May 10 14:44:20 2006 -0700
@@ -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.12 2004/01/05 14:05:12 menno Exp $
+** $Id: ssr.c,v 1.15 2004/09/04 14:56:29 menno Exp $
 **/
 
 #include "common.h"
--- a/Plugins/Input/aac/libfaad2/ssr.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/ssr.h	Wed May 10 14:44:20 2006 -0700
@@ -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.12 2004/01/05 14:05:12 menno Exp $
+** $Id: ssr.h,v 1.15 2004/09/04 14:56:29 menno Exp $
 **/
 
 #ifndef __SSR_H__
--- a/Plugins/Input/aac/libfaad2/ssr_fb.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/ssr_fb.c	Wed May 10 14:44:20 2006 -0700
@@ -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.10 2004/01/05 14:05:12 menno Exp $
+** $Id: ssr_fb.c,v 1.13 2004/09/04 14:56:29 menno Exp $
 **/
 
 #include "common.h"
--- a/Plugins/Input/aac/libfaad2/ssr_fb.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/ssr_fb.h	Wed May 10 14:44:20 2006 -0700
@@ -16,7 +16,7 @@
 ** along with this program; if not, write to the Free Software 
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
-** $Id: ssr_fb.h,v 1.10 2004/01/05 14:05:12 menno Exp $
+** $Id: ssr_fb.h,v 1.13 2004/09/04 14:56:29 menno Exp $
 **/
 
 #ifndef __SSR_FB_H__
--- a/Plugins/Input/aac/libfaad2/ssr_ipqf.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/ssr_ipqf.c	Wed May 10 14:44:20 2006 -0700
@@ -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.11 2004/01/05 14:05:12 menno Exp $
+** $Id: ssr_ipqf.c,v 1.14 2004/09/04 14:56:29 menno Exp $
 **/
 
 #include "common.h"
--- a/Plugins/Input/aac/libfaad2/ssr_ipqf.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/ssr_ipqf.h	Wed May 10 14:44:20 2006 -0700
@@ -16,7 +16,7 @@
 ** along with this program; if not, write to the Free Software 
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
-** $Id: ssr_ipqf.h,v 1.11 2004/01/05 14:05:12 menno Exp $
+** $Id: ssr_ipqf.h,v 1.14 2004/09/04 14:56:29 menno Exp $
 **/
 
 #ifndef __SSR_IPQF_H__
--- a/Plugins/Input/aac/libfaad2/ssr_win.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/ssr_win.h	Wed May 10 14:44:20 2006 -0700
@@ -16,7 +16,7 @@
 ** along with this program; if not, write to the Free Software 
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
-** $Id: ssr_win.h,v 1.10 2004/01/05 14:05:12 menno Exp $
+** $Id: ssr_win.h,v 1.13 2004/09/04 14:56:29 menno Exp $
 **/
 
 #ifndef __SSR_WIN_H__
--- a/Plugins/Input/aac/libfaad2/structs.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/structs.h	Wed May 10 14:44:20 2006 -0700
@@ -1,19 +1,19 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
 ** 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
 ** the Free Software Foundation; either version 2 of the License, or
 ** (at your option) any later version.
-** 
+**
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ** GNU General Public License for more details.
-** 
+**
 ** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software 
+** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
 ** Any non-GPL usage of this software or parts of this software is strictly
@@ -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.31 2004/01/29 11:31:11 menno Exp $
+** $Id: structs.h,v 1.42 2004/09/08 09:43:11 gcp Exp $
 **/
 
 #ifndef __STRUCTS_H__
@@ -46,13 +46,13 @@
 
 /* used to save the prediction state */
 typedef struct {
-    int16_t r[2];
-    int16_t COR[2];
-    int16_t VAR[2];
+    signed short r[2];
+    signed short COR[2];
+    signed short VAR[2];
 } pred_state;
 
 typedef struct {
-    uint16_t N;
+    unsigned short N;
     cfft_info *cfft;
     complex_t *sincos;
 #ifdef PROFILE
@@ -77,24 +77,21 @@
 #ifdef PROFILE
     int64_t cycles;
 #endif
-#ifdef USE_SSE
-    void (*if_func)(void *a, uint8_t b, uint8_t c, uint8_t d, real_t *e, real_t *f, uint8_t g, uint16_t h);
-#endif
 } fb_info;
 
 typedef struct
 {
-    uint8_t present;
+    unsigned char present;
 
-    uint8_t num_bands;
-    uint8_t pce_instance_tag;
-    uint8_t excluded_chns_present;
-    uint8_t band_top[17];
-    uint8_t prog_ref_level;
-    uint8_t dyn_rng_sgn[17];
-    uint8_t dyn_rng_ctl[17];
-    uint8_t exclude_mask[MAX_CHANNELS];
-    uint8_t additional_excluded_chns[MAX_CHANNELS];
+    unsigned char num_bands;
+    unsigned char pce_instance_tag;
+    unsigned char excluded_chns_present;
+    unsigned char band_top[17];
+    unsigned char prog_ref_level;
+    unsigned char dyn_rng_sgn[17];
+    unsigned char dyn_rng_ctl[17];
+    unsigned char exclude_mask[MAX_CHANNELS];
+    unsigned char additional_excluded_chns[MAX_CHANNELS];
 
     real_t ctrl1;
     real_t ctrl2;
@@ -102,203 +99,209 @@
 
 typedef struct
 {
-    uint8_t element_instance_tag;
-    uint8_t object_type;
-    uint8_t sf_index;
-    uint8_t num_front_channel_elements;
-    uint8_t num_side_channel_elements;
-    uint8_t num_back_channel_elements;
-    uint8_t num_lfe_channel_elements;
-    uint8_t num_assoc_data_elements;
-    uint8_t num_valid_cc_elements;
-    uint8_t mono_mixdown_present;
-    uint8_t mono_mixdown_element_number;
-    uint8_t stereo_mixdown_present;
-    uint8_t stereo_mixdown_element_number;
-    uint8_t matrix_mixdown_idx_present;
-    uint8_t pseudo_surround_enable;
-    uint8_t matrix_mixdown_idx;
-    uint8_t front_element_is_cpe[16];
-    uint8_t front_element_tag_select[16];
-    uint8_t side_element_is_cpe[16];
-    uint8_t side_element_tag_select[16];
-    uint8_t back_element_is_cpe[16];
-    uint8_t back_element_tag_select[16];
-    uint8_t lfe_element_tag_select[16];
-    uint8_t assoc_data_element_tag_select[16];
-    uint8_t cc_element_is_ind_sw[16];
-    uint8_t valid_cc_element_tag_select[16];
+    unsigned char element_instance_tag;
+    unsigned char object_type;
+    unsigned char sf_index;
+    unsigned char num_front_channel_elements;
+    unsigned char num_side_channel_elements;
+    unsigned char num_back_channel_elements;
+    unsigned char num_lfe_channel_elements;
+    unsigned char num_assoc_data_elements;
+    unsigned char num_valid_cc_elements;
+    unsigned char mono_mixdown_present;
+    unsigned char mono_mixdown_element_number;
+    unsigned char stereo_mixdown_present;
+    unsigned char stereo_mixdown_element_number;
+    unsigned char matrix_mixdown_idx_present;
+    unsigned char pseudo_surround_enable;
+    unsigned char matrix_mixdown_idx;
+    unsigned char front_element_is_cpe[16];
+    unsigned char front_element_tag_select[16];
+    unsigned char side_element_is_cpe[16];
+    unsigned char side_element_tag_select[16];
+    unsigned char back_element_is_cpe[16];
+    unsigned char back_element_tag_select[16];
+    unsigned char lfe_element_tag_select[16];
+    unsigned char assoc_data_element_tag_select[16];
+    unsigned char cc_element_is_ind_sw[16];
+    unsigned char valid_cc_element_tag_select[16];
 
-    uint8_t channels;
+    unsigned char channels;
 
-    uint8_t comment_field_bytes;
-    uint8_t comment_field_data[257];
+    unsigned char comment_field_bytes;
+    unsigned char comment_field_data[257];
 
     /* extra added values */
-    uint8_t num_front_channels;
-    uint8_t num_side_channels;
-    uint8_t num_back_channels;
-    uint8_t num_lfe_channels;
-    uint8_t sce_channel[16];
-    uint8_t cpe_channel[16];
+    unsigned char num_front_channels;
+    unsigned char num_side_channels;
+    unsigned char num_back_channels;
+    unsigned char num_lfe_channels;
+    unsigned char sce_channel[16];
+    unsigned char cpe_channel[16];
 } program_config;
 
 typedef struct
 {
-    uint16_t syncword;
-    uint8_t id;
-    uint8_t layer;
-    uint8_t protection_absent;
-    uint8_t profile;
-    uint8_t sf_index;
-    uint8_t private_bit;
-    uint8_t channel_configuration;
-    uint8_t original;
-    uint8_t home;
-    uint8_t emphasis;
-    uint8_t copyright_identification_bit;
-    uint8_t copyright_identification_start;
-    uint16_t aac_frame_length;
-    uint16_t adts_buffer_fullness;
-    uint8_t no_raw_data_blocks_in_frame;
-    uint16_t crc_check;
+    unsigned short syncword;
+    unsigned char id;
+    unsigned char layer;
+    unsigned char protection_absent;
+    unsigned char profile;
+    unsigned char sf_index;
+    unsigned char private_bit;
+    unsigned char channel_configuration;
+    unsigned char original;
+    unsigned char home;
+    unsigned char emphasis;
+    unsigned char copyright_identification_bit;
+    unsigned char copyright_identification_start;
+    unsigned short aac_frame_length;
+    unsigned short adts_buffer_fullness;
+    unsigned char no_raw_data_blocks_in_frame;
+    unsigned short crc_check;
 
     /* control param */
-    uint8_t old_format;
+    unsigned char old_format;
 } adts_header;
 
 typedef struct
 {
-    uint8_t copyright_id_present;
-    int8_t copyright_id[10];
-    uint8_t original_copy;
-    uint8_t home;
-    uint8_t bitstream_type;
-    uint32_t bitrate;
-    uint8_t num_program_config_elements;
-    uint32_t adif_buffer_fullness;
+    unsigned char copyright_id_present;
+    signed char copyright_id[10];
+    unsigned char original_copy;
+    unsigned char home;
+    unsigned char bitstream_type;
+    unsigned long bitrate;
+    unsigned char num_program_config_elements;
+    unsigned long adif_buffer_fullness;
 
     /* maximum of 16 PCEs */
     program_config pce[16];
 } adif_header;
 
+#ifdef LTP_DEC
 typedef struct
 {
-    uint8_t last_band;
-    uint8_t data_present;
-    uint16_t lag;
-    uint8_t lag_update;
-    uint8_t coef;
-    uint8_t long_used[MAX_SFB];
-    uint8_t short_used[8];
-    uint8_t short_lag_present[8];
-    uint8_t short_lag[8];
+    unsigned char last_band;
+    unsigned char data_present;
+    unsigned short lag;
+    unsigned char lag_update;
+    unsigned char coef;
+    unsigned char long_used[MAX_SFB];
+    unsigned char short_used[8];
+    unsigned char short_lag_present[8];
+    unsigned char short_lag[8];
 } ltp_info;
+#endif
+
+#ifdef MAIN_DEC
+typedef struct
+{
+    unsigned char limit;
+    unsigned char predictor_reset;
+    unsigned char predictor_reset_group_number;
+    unsigned char prediction_used[MAX_SFB];
+} pred_info;
+#endif
 
 typedef struct
 {
-    uint8_t limit;
-    uint8_t predictor_reset;
-    uint8_t predictor_reset_group_number;
-    uint8_t prediction_used[MAX_SFB];
-} pred_info;
-
-typedef struct
-{
-    uint8_t number_pulse;
-    uint8_t pulse_start_sfb;
-    uint8_t pulse_offset[4];
-    uint8_t pulse_amp[4];
+    unsigned char number_pulse;
+    unsigned char pulse_start_sfb;
+    unsigned char pulse_offset[4];
+    unsigned char pulse_amp[4];
 } pulse_info;
 
 typedef struct
 {
-    uint8_t n_filt[8];
-    uint8_t coef_res[8];
-    uint8_t length[8][4];
-    uint8_t order[8][4];
-    uint8_t direction[8][4];
-    uint8_t coef_compress[8][4];
-    uint8_t coef[8][4][32];
+    unsigned char n_filt[8];
+    unsigned char coef_res[8];
+    unsigned char length[8][4];
+    unsigned char order[8][4];
+    unsigned char direction[8][4];
+    unsigned char coef_compress[8][4];
+    unsigned char coef[8][4][32];
 } tns_info;
 
 #ifdef SSR_DEC
 typedef struct
 {
-    uint8_t max_band;
+    unsigned char max_band;
 
-    uint8_t adjust_num[4][8];
-    uint8_t alevcode[4][8][8];
-    uint8_t aloccode[4][8][8];
+    unsigned char adjust_num[4][8];
+    unsigned char alevcode[4][8][8];
+    unsigned char aloccode[4][8][8];
 } ssr_info;
 #endif
 
 typedef struct
 {
-    uint8_t max_sfb;
+    unsigned char max_sfb;
 
-    uint8_t num_swb;
-    uint8_t num_window_groups;
-    uint8_t num_windows;
-    uint8_t window_sequence;
-    uint8_t window_group_length[8];
-    uint8_t window_shape;
-    uint8_t scale_factor_grouping;
-    uint16_t sect_sfb_offset[8][15*8];
-    uint16_t swb_offset[52];
+    unsigned char num_swb;
+    unsigned char num_window_groups;
+    unsigned char num_windows;
+    unsigned char window_sequence;
+    unsigned char window_group_length[8];
+    unsigned char window_shape;
+    unsigned char scale_factor_grouping;
+    unsigned short sect_sfb_offset[8][15*8];
+    unsigned short swb_offset[52];
 
-    uint8_t sect_cb[8][15*8];
-    uint16_t sect_start[8][15*8];
-    uint16_t sect_end[8][15*8];
-    uint8_t sfb_cb[8][8*15];
-    uint8_t num_sec[8]; /* number of sections in a group */
+    unsigned char sect_cb[8][15*8];
+    unsigned short sect_start[8][15*8];
+    unsigned short sect_end[8][15*8];
+    unsigned char sfb_cb[8][8*15];
+    unsigned char num_sec[8]; /* number of sections in a group */
 
-    uint8_t global_gain;
-    int16_t scale_factors[8][51]; /* [0..255] */
+    unsigned char global_gain;
+    signed short scale_factors[8][51]; /* [0..255] */
 
-    uint8_t ms_mask_present;
-    uint8_t ms_used[MAX_WINDOW_GROUPS][MAX_SFB];
+    unsigned char ms_mask_present;
+    unsigned char ms_used[MAX_WINDOW_GROUPS][MAX_SFB];
 
-    uint8_t noise_used;
+    unsigned char noise_used;
 
-    uint8_t pulse_data_present;
-    uint8_t tns_data_present;
-    uint8_t gain_control_data_present;
-    uint8_t predictor_data_present;
+    unsigned char pulse_data_present;
+    unsigned char tns_data_present;
+    unsigned char gain_control_data_present;
+    unsigned char predictor_data_present;
 
     pulse_info pul;
     tns_info tns;
+#ifdef MAIN_DEC
     pred_info pred;
+#endif
+#ifdef LTP_DEC
     ltp_info ltp;
     ltp_info ltp2;
+#endif
 #ifdef SSR_DEC
     ssr_info ssr;
 #endif
 
 #ifdef ERROR_RESILIENCE
     /* ER HCR data */
-    uint16_t length_of_reordered_spectral_data;
-    uint8_t length_of_longest_codeword;
+    unsigned short length_of_reordered_spectral_data;
+    unsigned char length_of_longest_codeword;
     /* ER RLVC data */
-    uint8_t sf_concealment;
-    uint8_t rev_global_gain;
-    uint16_t length_of_rvlc_sf;
-    uint16_t dpcm_noise_nrg;
-    uint8_t sf_escapes_present;
-    uint8_t length_of_rvlc_escapes;
-    uint16_t dpcm_noise_last_position;
+    unsigned char sf_concealment;
+    unsigned char rev_global_gain;
+    unsigned short length_of_rvlc_sf;
+    unsigned short dpcm_noise_nrg;
+    unsigned char sf_escapes_present;
+    unsigned char length_of_rvlc_escapes;
+    unsigned short dpcm_noise_last_position;
 #endif
 } ic_stream; /* individual channel stream */
 
 typedef struct
 {
-    uint8_t ele_id;
+    unsigned char channel;
+    signed short paired_channel;
 
-    uint8_t channel;
-    int16_t paired_channel;
-
-    uint8_t element_instance_tag;
-    uint8_t common_window;
+    unsigned char element_instance_tag;
+    unsigned char common_window;
 
     ic_stream ics1;
     ic_stream ics2;
@@ -307,104 +310,109 @@
 typedef struct mp4AudioSpecificConfig
 {
     /* Audio Specific Info */
-    uint8_t objectTypeIndex;
-    uint8_t samplingFrequencyIndex;
-    uint32_t samplingFrequency;
-    uint8_t channelsConfiguration;
+    unsigned char objectTypeIndex;
+    unsigned char samplingFrequencyIndex;
+    unsigned long samplingFrequency;
+    unsigned char channelsConfiguration;
 
     /* GA Specific Info */
-    uint8_t frameLengthFlag;
-    uint8_t dependsOnCoreCoder;
-    uint16_t coreCoderDelay;
-    uint8_t extensionFlag;
-    uint8_t aacSectionDataResilienceFlag;
-    uint8_t aacScalefactorDataResilienceFlag;
-    uint8_t aacSpectralDataResilienceFlag;
-    uint8_t epConfig;
+    unsigned char frameLengthFlag;
+    unsigned char dependsOnCoreCoder;
+    unsigned short coreCoderDelay;
+    unsigned char extensionFlag;
+    unsigned char aacSectionDataResilienceFlag;
+    unsigned char aacScalefactorDataResilienceFlag;
+    unsigned char aacSpectralDataResilienceFlag;
+    unsigned char epConfig;
 
-    int8_t sbr_present_flag;
-    int8_t forceUpSampling;
+    signed char sbr_present_flag;
+    unsigned char forceUpSampling;
+    unsigned char downSampledSBR;
 } mp4AudioSpecificConfig;
 
-typedef struct faacDecConfiguration
+typedef struct NeAACDecConfiguration
 {
-    uint8_t defObjectType;
-    uint32_t defSampleRate;
-    uint8_t outputFormat;
-    uint8_t downMatrix;
-    uint8_t useOldADTSFormat;
-    uint8_t dontUpSampleImplicitSBR;
-} faacDecConfiguration, *faacDecConfigurationPtr;
+    unsigned char defObjectType;
+    unsigned long defSampleRate;
+    unsigned char outputFormat;
+    unsigned char downMatrix;
+    unsigned char useOldADTSFormat;
+    unsigned char dontUpSampleImplicitSBR;
+} NeAACDecConfiguration, *NeAACDecConfigurationPtr;
 
-typedef struct faacDecFrameInfo
+typedef struct NeAACDecFrameInfo
 {
-    uint32_t bytesconsumed;
-    uint32_t samples;
-    uint8_t channels;
-    uint8_t error;
-    uint32_t samplerate;
+    unsigned long bytesconsumed;
+    unsigned long samples;
+    unsigned char channels;
+    unsigned char error;
+    unsigned long samplerate;
 
     /* SBR: 0: off, 1: on; normal, 2: on; downsampled */
-    uint8_t sbr;
+    unsigned char sbr;
 
     /* MPEG-4 ObjectType */
-    uint8_t object_type;
+    unsigned char object_type;
 
     /* AAC header type; MP4 will be signalled as RAW also */
-    uint8_t header_type;
+    unsigned char header_type;
 
     /* multichannel configuration */
-    uint8_t num_front_channels;
-    uint8_t num_side_channels;
-    uint8_t num_back_channels;
-    uint8_t num_lfe_channels;
-    uint8_t channel_position[MAX_CHANNELS];
-} faacDecFrameInfo;
+    unsigned char num_front_channels;
+    unsigned char num_side_channels;
+    unsigned char num_back_channels;
+    unsigned char num_lfe_channels;
+    unsigned char channel_position[MAX_CHANNELS];
+
+    /* PS: 0: off, 1: on */
+    unsigned char ps;
+} NeAACDecFrameInfo;
 
 typedef struct
 {
-    uint8_t adts_header_present;
-    uint8_t adif_header_present;
-    uint8_t sf_index;
-    uint8_t object_type;
-    uint8_t channelConfiguration;
+    unsigned char adts_header_present;
+    unsigned char adif_header_present;
+    unsigned char sf_index;
+    unsigned char object_type;
+    unsigned char channelConfiguration;
 #ifdef ERROR_RESILIENCE
-    uint8_t aacSectionDataResilienceFlag;
-    uint8_t aacScalefactorDataResilienceFlag;
-    uint8_t aacSpectralDataResilienceFlag;
+    unsigned char aacSectionDataResilienceFlag;
+    unsigned char aacScalefactorDataResilienceFlag;
+    unsigned char aacSpectralDataResilienceFlag;
 #endif
-    uint16_t frameLength;
-    uint8_t postSeekResetFlag;
+    unsigned short frameLength;
+    unsigned char postSeekResetFlag;
 
-    uint32_t frame;
+    unsigned long frame;
 
-    uint8_t downMatrix;
-    uint8_t first_syn_ele;
-    uint8_t has_lfe;
+    unsigned char downMatrix;
+    unsigned char upMatrix;
+    unsigned char first_syn_ele;
+    unsigned char has_lfe;
     /* number of channels in current frame */
-    uint8_t fr_channels;
+    unsigned char fr_channels;
     /* number of elements in current frame */
-    uint8_t fr_ch_ele;
+    unsigned char fr_ch_ele;
 
     /* element_output_channels:
        determines the number of channels the element will output
     */
-    uint8_t element_output_channels[MAX_SYNTAX_ELEMENTS];
+    unsigned char element_output_channels[MAX_SYNTAX_ELEMENTS];
     /* element_alloced:
        determines whether the data needed for the element is allocated or not
     */
-    uint8_t element_alloced[MAX_SYNTAX_ELEMENTS];
+    unsigned char element_alloced[MAX_SYNTAX_ELEMENTS];
     /* alloced_channels:
        determines the number of channels where output data is allocated for
     */
-    uint8_t alloced_channels;
+    unsigned char alloced_channels;
 
     /* output data buffer */
     void *sample_buffer;
 
-    uint8_t window_shape_prev[MAX_CHANNELS];
+    unsigned char window_shape_prev[MAX_CHANNELS];
 #ifdef LTP_DEC
-    uint16_t ltp_lag[MAX_CHANNELS];
+    unsigned short ltp_lag[MAX_CHANNELS];
 #endif
     fb_info *fb;
     drc_info *drc;
@@ -413,18 +421,17 @@
     real_t *fb_intermed[MAX_CHANNELS];
 
 #ifdef SBR_DEC
-    int8_t sbr_present_flag;
-    int8_t forceUpSampling;
+    signed char sbr_present_flag;
+    signed char forceUpSampling;
+    signed char downSampledSBR;
     /* determines whether SBR data is allocated for the gives element */
-    uint8_t sbr_alloced[MAX_SYNTAX_ELEMENTS];
+    unsigned char sbr_alloced[MAX_SYNTAX_ELEMENTS];
 
     sbr_info *sbr[MAX_SYNTAX_ELEMENTS];
-#ifdef DRM
-    int8_t lcstereo_flag;
-#endif
 #endif
 #if (defined(PS_DEC) || defined(DRM_PS))
-    uint8_t ps_used[MAX_SYNTAX_ELEMENTS];
+    unsigned char ps_used[MAX_SYNTAX_ELEMENTS];
+    unsigned char ps_used_global;
 #endif
 
 #ifdef SSR_DEC
@@ -437,21 +444,17 @@
     pred_state *pred_stat[MAX_CHANNELS];
 #endif
 #ifdef LTP_DEC
-    int16_t *lt_pred_stat[MAX_CHANNELS];
+    signed short *lt_pred_stat[MAX_CHANNELS];
 #endif
 
     /* Program Config Element */
-    uint8_t pce_set;
+    unsigned char pce_set;
     program_config pce;
-    uint8_t element_id[MAX_CHANNELS];
-    uint8_t internal_channel[MAX_CHANNELS];
+    unsigned char element_id[MAX_CHANNELS];
+    unsigned char internal_channel[MAX_CHANNELS];
 
     /* Configuration data */
-    faacDecConfiguration config;
-
-#ifdef USE_SSE
-    void (*apply_sf_func)(void *a, void *b, void *c, uint16_t d);
-#endif
+    NeAACDecConfiguration config;
 
 #ifdef PROFILE
     int64_t cycles;
@@ -460,7 +463,7 @@
     int64_t scalefac_cycles;
     int64_t requant_cycles;
 #endif
-} faacDecStruct, *faacDecHandle;
+} NeAACDecStruct, *NeAACDecHandle;
 
 
 
--- a/Plugins/Input/aac/libfaad2/syntax.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/syntax.c	Wed May 10 14:44:20 2006 -0700
@@ -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.71 2004/02/04 19:55:03 menno Exp $
+** $Id: syntax.c,v 1.82 2004/09/04 14:56:29 menno Exp $
 **/
 
 /*
@@ -52,47 +52,49 @@
 
 
 /* static function declarations */
-static void decode_sce_lfe(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld,
+static void decode_sce_lfe(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld,
                            uint8_t id_syn_ele);
-static void decode_cpe(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld,
+static void decode_cpe(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld,
                        uint8_t id_syn_ele);
-static uint8_t single_lfe_channel_element(faacDecHandle hDecoder, bitfile *ld,
+static uint8_t single_lfe_channel_element(NeAACDecHandle hDecoder, bitfile *ld,
                                           uint8_t channel, uint8_t *tag);
-static uint8_t channel_pair_element(faacDecHandle hDecoder, bitfile *ld,
+static uint8_t channel_pair_element(NeAACDecHandle hDecoder, bitfile *ld,
                                     uint8_t channel, uint8_t *tag);
 #ifdef COUPLING_DEC
-static uint8_t coupling_channel_element(faacDecHandle hDecoder, bitfile *ld);
+static uint8_t coupling_channel_element(NeAACDecHandle hDecoder, bitfile *ld);
 #endif
-static uint16_t data_stream_element(faacDecHandle hDecoder, bitfile *ld);
+static uint16_t data_stream_element(NeAACDecHandle 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
+static uint8_t fill_element(NeAACDecHandle hDecoder, bitfile *ld, drc_info *drc
 #ifdef SBR_DEC
                             ,uint8_t sbr_ele
 #endif
                             );
-static uint8_t individual_channel_stream(faacDecHandle hDecoder, element *ele,
+static uint8_t individual_channel_stream(NeAACDecHandle 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,
+static uint8_t ics_info(NeAACDecHandle 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 uint8_t section_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld);
+static uint8_t scale_factor_data(NeAACDecHandle 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,
+static uint8_t spectral_data(NeAACDecHandle 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);
+#ifdef LTP_DEC
+static uint8_t ltp_data(NeAACDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld);
+#endif
 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,
+static int8_t aac_scalable_main_header(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2,
                                        bitfile *ld, uint8_t this_layer_stereo);
 #endif
 
@@ -314,8 +316,8 @@
     return 0;
 }
 
-static void decode_sce_lfe(faacDecHandle hDecoder,
-                           faacDecFrameInfo *hInfo, bitfile *ld,
+static void decode_sce_lfe(NeAACDecHandle hDecoder,
+                           NeAACDecFrameInfo *hInfo, bitfile *ld,
                            uint8_t id_syn_ele)
 {
     uint8_t channels = hDecoder->fr_channels;
@@ -359,7 +361,7 @@
     hDecoder->fr_ch_ele++;
 }
 
-static void decode_cpe(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld,
+static void decode_cpe(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld,
                        uint8_t id_syn_ele)
 {
     uint8_t channels = hDecoder->fr_channels;
@@ -407,7 +409,7 @@
     hDecoder->fr_ch_ele++;
 }
 
-void raw_data_block(faacDecHandle hDecoder, faacDecFrameInfo *hInfo,
+void raw_data_block(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
                     bitfile *ld, program_config *pce, drc_info *drc)
 {
     uint8_t id_syn_ele;
@@ -423,7 +425,7 @@
 #endif
         /* Table 4.4.3: raw_data_block() */
         while ((id_syn_ele = (uint8_t)faad_getbits(ld, LEN_SE_ID
-            DEBUGVAR(1,4,"faacDecDecode(): id_syn_ele"))) != ID_END)
+            DEBUGVAR(1,4,"NeAACDecDecode(): id_syn_ele"))) != ID_END)
         {
             switch (id_syn_ele) {
             case ID_SCE:
@@ -556,7 +558,7 @@
 
 /* Table 4.4.4 and */
 /* Table 4.4.9 */
-static uint8_t single_lfe_channel_element(faacDecHandle hDecoder, bitfile *ld,
+static uint8_t single_lfe_channel_element(NeAACDecHandle hDecoder, bitfile *ld,
                                           uint8_t channel, uint8_t *tag)
 {
     uint8_t retval = 0;
@@ -599,7 +601,7 @@
 }
 
 /* Table 4.4.5 */
-static uint8_t channel_pair_element(faacDecHandle hDecoder, bitfile *ld,
+static uint8_t channel_pair_element(NeAACDecHandle hDecoder, bitfile *ld,
                                     uint8_t channels, uint8_t *tag)
 {
     ALIGN int16_t spec_data1[1024] = {0};
@@ -641,13 +643,20 @@
 #ifdef ERROR_RESILIENCE
         if ((hDecoder->object_type >= ER_OBJECT_START) && (ics1->predictor_data_present))
         {
-            if ((ics1->ltp.data_present = faad_get1bit(ld
-                DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1)
+            if ((
+#ifdef LTP_DEC
+                ics1->ltp.data_present =
+#endif
+                faad_get1bit(ld DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1)
             {
+#ifdef LTP_DEC
                 if ((result = ltp_data(hDecoder, ics1, &(ics1->ltp), ld)) > 0)
                 {
                     return result;
                 }
+#else
+                return 26;
+#endif
             }
         }
 #endif
@@ -667,13 +676,20 @@
     if (cpe.common_window && (hDecoder->object_type >= ER_OBJECT_START) &&
         (ics1->predictor_data_present))
     {
-        if ((ics1->ltp2.data_present = faad_get1bit(ld
-            DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1)
+        if ((
+#ifdef LTP_DEC
+            ics1->ltp2.data_present =
+#endif
+            faad_get1bit(ld DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1)
         {
+#ifdef LTP_DEC
             if ((result = ltp_data(hDecoder, ics1, &(ics1->ltp2), ld)) > 0)
             {
                 return result;
             }
+#else
+            return 26;
+#endif
         }
     }
 #endif
@@ -710,7 +726,7 @@
 }
 
 /* Table 4.4.6 */
-static uint8_t ics_info(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld,
+static uint8_t ics_info(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld,
                         uint8_t common_window)
 {
     uint8_t retval = 0;
@@ -751,19 +767,29 @@
             {
                 uint8_t sfb;
 
-                ics->pred.limit = min(ics->max_sfb, max_pred_sfb(hDecoder->sf_index));
+                uint8_t limit = min(ics->max_sfb, max_pred_sfb(hDecoder->sf_index));
+#ifdef MAIN_DEC
+                ics->pred.limit = limit;
+#endif
 
-                if ((ics->pred.predictor_reset = faad_get1bit(ld
-                    DEBUGVAR(1,53,"ics_info(): pred.predictor_reset"))) & 1)
+                if ((
+#ifdef MAIN_DEC
+                    ics->pred.predictor_reset =
+#endif
+                    faad_get1bit(ld DEBUGVAR(1,53,"ics_info(): pred.predictor_reset"))) & 1)
                 {
-                    ics->pred.predictor_reset_group_number = (uint8_t)faad_getbits(ld, 5
-                        DEBUGVAR(1,54,"ics_info(): pred.predictor_reset_group_number"));
+#ifdef MAIN_DEC
+                    ics->pred.predictor_reset_group_number =
+#endif
+                        (uint8_t)faad_getbits(ld, 5 DEBUGVAR(1,54,"ics_info(): pred.predictor_reset_group_number"));
                 }
 
-                for (sfb = 0; sfb < ics->pred.limit; sfb++)
+                for (sfb = 0; sfb < limit; sfb++)
                 {
-                    ics->pred.prediction_used[sfb] = faad_get1bit(ld
-                        DEBUGVAR(1,55,"ics_info(): pred.prediction_used"));
+#ifdef MAIN_DEC
+                    ics->pred.prediction_used[sfb] =
+#endif
+                        faad_get1bit(ld DEBUGVAR(1,55,"ics_info(): pred.prediction_used"));
                 }
             }
 #ifdef LTP_DEC
@@ -826,8 +852,14 @@
     {
         pul->pulse_offset[i] = (uint8_t)faad_getbits(ld, 5
             DEBUGVAR(1,58,"pulse_data(): pulse_offset"));
+#if 0
+        printf("%d\n", pul->pulse_offset[i]);
+#endif
         pul->pulse_amp[i] = (uint8_t)faad_getbits(ld, 4
             DEBUGVAR(1,59,"pulse_data(): pulse_amp"));
+#if 0
+        printf("%d\n", pul->pulse_amp[i]);
+#endif
     }
 
     return 0;
@@ -835,7 +867,7 @@
 
 #ifdef COUPLING_DEC
 /* Table 4.4.8: Currently just for skipping the bits... */
-static uint8_t coupling_channel_element(faacDecHandle hDecoder, bitfile *ld)
+static uint8_t coupling_channel_element(NeAACDecHandle hDecoder, bitfile *ld)
 {
     uint8_t c, result = 0;
     uint8_t ind_sw_cce_flag = 0;
@@ -924,7 +956,7 @@
 #endif
 
 /* Table 4.4.10 */
-static uint16_t data_stream_element(faacDecHandle hDecoder, bitfile *ld)
+static uint16_t data_stream_element(NeAACDecHandle hDecoder, bitfile *ld)
 {
     uint8_t byte_aligned;
     uint16_t i, count;
@@ -953,7 +985,7 @@
 }
 
 /* Table 4.4.11 */
-static uint8_t fill_element(faacDecHandle hDecoder, bitfile *ld, drc_info *drc
+static uint8_t fill_element(NeAACDecHandle hDecoder, bitfile *ld, drc_info *drc
 #ifdef SBR_DEC
                             ,uint8_t sbr_ele
 #endif
@@ -986,7 +1018,8 @@
             if (!hDecoder->sbr[sbr_ele])
             {
                 hDecoder->sbr[sbr_ele] = sbrDecodeInit(hDecoder->frameLength,
-                    hDecoder->element_id[sbr_ele], 2*get_sample_rate(hDecoder->sf_index)
+                    hDecoder->element_id[sbr_ele], 2*get_sample_rate(hDecoder->sf_index),
+                    hDecoder->downSampledSBR
 #ifdef DRM
                     , 0
 #endif
@@ -997,10 +1030,21 @@
 
             /* parse the SBR data */
             hDecoder->sbr[sbr_ele]->ret = sbr_extension_data(ld, hDecoder->sbr[sbr_ele], count);
+
+#if 0
+            if (hDecoder->sbr[sbr_ele]->ret > 0)
+            {
+                printf("%s\n", NeAACDecGetErrorMessage(hDecoder->sbr[sbr_ele]->ret));
+            }
+#endif
+
 #if (defined(PS_DEC) || defined(DRM_PS))
             if (hDecoder->sbr[sbr_ele]->ps_used)
             {
                 hDecoder->ps_used[sbr_ele] = 1;
+
+                /* set element independent flag to 1 as well */
+                hDecoder->ps_used_global = 1;
             }
 #endif
         } else {
@@ -1115,7 +1159,7 @@
 
 #ifdef SCALABLE_DEC
 /* Table 4.4.13 ASME */
-void aac_scalable_main_element(faacDecHandle hDecoder, faacDecFrameInfo *hInfo,
+void aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
                                bitfile *ld, program_config *pce, drc_info *drc)
 {
     uint8_t retval = 0;
@@ -1137,11 +1181,13 @@
 
     cpe.common_window = 1;
     if (this_layer_stereo)
-        cpe.ele_id = ID_CPE;
-    else
-        cpe.ele_id = ID_SCE;
-
-    hDecoder->element_output_channels[hDecoder->fr_ch_ele] = (this_layer_stereo ? 2 : 0);
+    {
+        hDecoder->element_id[0] = ID_CPE;
+        if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0)
+            hDecoder->element_output_channels[hDecoder->fr_ch_ele] = 2;
+    } else {
+        hDecoder->element_id[0] = ID_SCE;
+    }
 
     for (ch = 0; ch < (this_layer_stereo ? 2 : 1); ch++)
     {
@@ -1185,8 +1231,8 @@
 
         if (!hDecoder->sbr[0])
         {
-            hDecoder->sbr[0] = sbrDecodeInit(hDecoder->frameLength, cpe.ele_id,
-                2*get_sample_rate(hDecoder->sf_index), 1);
+            hDecoder->sbr[0] = sbrDecodeInit(hDecoder->frameLength, hDecoder->element_id[0],
+                2*get_sample_rate(hDecoder->sf_index), 0 /* ds SBR */, 1);
         }
 
         /* Reverse bit reading of SBR data in DRM audio frame */
@@ -1201,8 +1247,6 @@
         count = (uint16_t)bit2byte(buffer_size*8 - bitsconsumed);
         faad_initbits(&ld_sbr, revbuffer, count);
 
-        hDecoder->sbr[0]->lcstereo_flag = hDecoder->lcstereo_flag;
-
         hDecoder->sbr[0]->sample_rate = get_sample_rate(hDecoder->sf_index);
         hDecoder->sbr[0]->sample_rate *= 2;
 
@@ -1213,13 +1257,20 @@
         if (hDecoder->sbr[0]->ps_used)
         {
             hDecoder->ps_used[0] = 1;
+            hDecoder->ps_used_global = 1;
         }
 #endif
 
         /* check CRC */
         /* no need to check it if there was already an error */
         if (hDecoder->sbr[0]->ret == 0)
-            hDecoder->sbr[0]->ret = faad_check_CRC(&ld_sbr, faad_get_processed_bits(&ld_sbr) - 8);
+            hDecoder->sbr[0]->ret = (uint8_t)faad_check_CRC(&ld_sbr, (uint16_t)faad_get_processed_bits(&ld_sbr) - 8);
+
+        /* SBR data was corrupted, disable it until the next header */
+        if (hDecoder->sbr[0]->ret != 0)
+        {
+            hDecoder->sbr[0]->header_count = 0;  
+        }
 
         faad_endbits(&ld_sbr);
 
@@ -1250,8 +1301,6 @@
         hDecoder->internal_channel[channels] = channels;
     }
 
-    hDecoder->element_id[hDecoder->fr_ch_ele] = cpe.ele_id;
-
     hDecoder->fr_channels += hDecoder->element_output_channels[hDecoder->fr_ch_ele];
     hDecoder->fr_ch_ele++;
 
@@ -1259,7 +1308,7 @@
 }
 
 /* Table 4.4.15 */
-static int8_t aac_scalable_main_header(faacDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2,
+static int8_t aac_scalable_main_header(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2,
                                        bitfile *ld, uint8_t this_layer_stereo)
 {
     uint8_t retval = 0;
@@ -1351,13 +1400,20 @@
                 diff_control_data_lr();
         } else {
 #endif
-            if ((ics->ltp.data_present = faad_get1bit(ld
-                DEBUGVAR(1,310,"aac_scalable_main_header(): ltp.data_present"))) & 1)
+            if ((
+#ifdef LTP_DEC
+                ics->ltp.data_present =
+#endif
+                faad_get1bit(ld DEBUGVAR(1,310,"aac_scalable_main_header(): ltp.data_present"))) & 1)
             {
+#ifdef LTP_DEC
                 if ((retval = ltp_data(hDecoder, ics, &(ics->ltp), ld)) > 0)
                 {
                     return retval;
                 }
+#else
+                return 26;
+#endif
             }
 #if 0
         }
@@ -1369,7 +1425,7 @@
 #endif
 
 /* Table 4.4.24 */
-static uint8_t individual_channel_stream(faacDecHandle hDecoder, element *ele,
+static uint8_t individual_channel_stream(NeAACDecHandle hDecoder, element *ele,
                                          bitfile *ld, ic_stream *ics, uint8_t scal_flag,
                                          int16_t *spec_data)
 {
@@ -1467,7 +1523,7 @@
 #ifdef DRM
     /* CRC check */
     if (hDecoder->object_type == DRM_ER_LC)
-        if ((result = faad_check_CRC(ld, faad_get_processed_bits(ld) - 8)) > 0)
+        if ((result = (uint8_t)faad_check_CRC(ld, (uint16_t)faad_get_processed_bits(ld) - 8)) > 0)
             return result;
 #endif
 
@@ -1505,7 +1561,7 @@
 }
 
 /* Table 4.4.25 */
-static uint8_t section_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld)
+static uint8_t section_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld)
 {
     uint8_t g;
     uint8_t sect_esc_val, sect_bits;
@@ -1549,6 +1605,10 @@
             ics->sect_cb[g][i] = (uint8_t)faad_getbits(ld, sect_cb_bits
                 DEBUGVAR(1,71,"section_data(): sect_cb"));
 
+#if 0
+            printf("%d\n", ics->sect_cb[g][i]);
+#endif
+
             if (ics->sect_cb[g][i] == NOISE_HCB)
                 ics->noise_used = 1;
 
@@ -1584,13 +1644,25 @@
             ics->sect_start[g][i] = k;
             ics->sect_end[g][i] = k + sect_len;
 
+#if 0
+            printf("%d\n", ics->sect_start[g][i]);
+#endif
+#if 0
+            printf("%d\n", ics->sect_end[g][i]);
+#endif
+
             if (k + sect_len >= 8*15)
                 return 15;
             if (i >= 8*15)
                 return 15;
 
             for (sfb = k; sfb < k + sect_len; sfb++)
+            {
                 ics->sfb_cb[g][sfb] = ics->sect_cb[g][i];
+#if 0
+                printf("%d\n", ics->sfb_cb[g][sfb]);
+#endif
+            }
 
 #if 0
             printf(" %6d %6d %6d\n",
@@ -1603,6 +1675,9 @@
             i++;
         }
         ics->num_sec[g] = i;
+#if 0
+        printf("%d\n", ics->num_sec[g]);
+#endif
     }
 
 #if 0
@@ -1641,6 +1716,10 @@
             {
             case ZERO_HCB: /* zero book */
                 ics->scale_factors[g][sfb] = 0;
+//#define SF_PRINT
+#ifdef SF_PRINT
+                printf("%d\n", ics->scale_factors[g][sfb]);
+#endif
                 break;
             case INTENSITY_HCB: /* intensity books */
             case INTENSITY_HCB2:
@@ -1649,6 +1728,9 @@
                 t = huffman_scale_factor(ld);
                 is_position += (t - 60);
                 ics->scale_factors[g][sfb] = is_position;
+#ifdef SF_PRINT
+                printf("%d\n", ics->scale_factors[g][sfb]);
+#endif
 
                 break;
             case NOISE_HCB: /* noise books */
@@ -1665,6 +1747,9 @@
                 }
                 noise_energy += t;
                 ics->scale_factors[g][sfb] = noise_energy;
+#ifdef SF_PRINT
+                printf("%d\n", ics->scale_factors[g][sfb]);
+#endif
 
                 break;
             default: /* spectral books */
@@ -1679,6 +1764,9 @@
                 if (scale_factor < 0 || scale_factor > 255)
                     return 4;
                 ics->scale_factors[g][sfb] = scale_factor;
+#ifdef SF_PRINT
+                printf("%d\n", ics->scale_factors[g][sfb]);
+#endif
 
                 break;
             }
@@ -1689,7 +1777,7 @@
 }
 
 /* Table 4.4.26 */
-static uint8_t scale_factor_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld)
+static uint8_t scale_factor_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld)
 {
     uint8_t ret = 0;
 #ifdef PROFILE
@@ -1738,6 +1826,9 @@
     {
         tns->n_filt[w] = (uint8_t)faad_getbits(ld, n_filt_bits
             DEBUGVAR(1,74,"tns_data(): n_filt"));
+#if 0
+        printf("%d\n", tns->n_filt[w]);
+#endif
 
         if (tns->n_filt[w])
         {
@@ -1748,26 +1839,44 @@
             } else {
                 start_coef_bits = 3;
             }
+#if 0
+            printf("%d\n", tns->coef_res[w]);
+#endif
         }
 
         for (filt = 0; filt < tns->n_filt[w]; filt++)
         {
             tns->length[w][filt] = (uint8_t)faad_getbits(ld, length_bits
                 DEBUGVAR(1,76,"tns_data(): length"));
+#if 0
+            printf("%d\n", tns->length[w][filt]);
+#endif
             tns->order[w][filt]  = (uint8_t)faad_getbits(ld, order_bits
                 DEBUGVAR(1,77,"tns_data(): order"));
+#if 0
+            printf("%d\n", tns->order[w][filt]);
+#endif
             if (tns->order[w][filt])
             {
                 tns->direction[w][filt] = faad_get1bit(ld
                     DEBUGVAR(1,78,"tns_data(): direction"));
+#if 0
+                printf("%d\n", tns->direction[w][filt]);
+#endif
                 tns->coef_compress[w][filt] = faad_get1bit(ld
                     DEBUGVAR(1,79,"tns_data(): coef_compress"));
+#if 0
+                printf("%d\n", tns->coef_compress[w][filt]);
+#endif
 
                 coef_bits = start_coef_bits - tns->coef_compress[w][filt];
                 for (i = 0; i < tns->order[w][filt]; i++)
                 {
                     tns->coef[w][filt][i] = (uint8_t)faad_getbits(ld, coef_bits
                         DEBUGVAR(1,80,"tns_data(): coef"));
+#if 0
+                    printf("%d\n", tns->coef[w][filt][i]);
+#endif
                 }
             }
         }
@@ -1776,7 +1885,7 @@
 
 #ifdef LTP_DEC
 /* Table 4.4.28 */
-static uint8_t ltp_data(faacDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld)
+static uint8_t ltp_data(NeAACDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld)
 {
     uint8_t sfb, w;
 
@@ -1839,7 +1948,7 @@
 #endif
 
 /* Table 4.4.29 */
-static uint8_t spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld,
+static uint8_t spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld,
                              int16_t *spectral_data)
 {
     int8_t i;
@@ -1870,15 +1979,41 @@
             case NOISE_HCB:
             case INTENSITY_HCB:
             case INTENSITY_HCB2:
+//#define SD_PRINT
+#ifdef SD_PRINT
+                {
+                    int j;
+                    for (j = ics->sect_sfb_offset[g][ics->sect_start[g][i]]; j < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; j++)
+                    {
+                        printf("%d\n", 0);
+                    }
+                }
+#endif
+//#define SFBO_PRINT
+#ifdef SFBO_PRINT
+                printf("%d\n", ics->sect_sfb_offset[g][ics->sect_start[g][i]]);
+#endif
                 p += (ics->sect_sfb_offset[g][ics->sect_end[g][i]] -
                     ics->sect_sfb_offset[g][ics->sect_start[g][i]]);
                 break;
             default:
+#ifdef SFBO_PRINT
+                printf("%d\n", ics->sect_sfb_offset[g][ics->sect_start[g][i]]);
+#endif
                 for (k = ics->sect_sfb_offset[g][ics->sect_start[g][i]];
                      k < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; k += inc)
                 {
                     if ((result = huffman_spectral_data(sect_cb, ld, &spectral_data[p])) > 0)
                         return result;
+#ifdef SD_PRINT
+                    {
+                        int j;
+                        for (j = p; j < p+inc; j++)
+                        {
+                            printf("%d\n", spectral_data[j]);
+                        }
+                    }
+#endif
                     p += inc;
                 }
                 break;
--- a/Plugins/Input/aac/libfaad2/syntax.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/syntax.h	Wed May 10 14:44:20 2006 -0700
@@ -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.48 2004/01/29 11:31:11 menno Exp $
+** $Id: syntax.h,v 1.54 2004/09/04 14:56:29 menno Exp $
 **/
 
 #ifndef __SYNTAX_H__
@@ -60,8 +60,8 @@
 #define DRMCH_MONO          1
 #define DRMCH_STEREO        2
 #define DRMCH_SBR_MONO      3
-#define DRMCH_SBR_LC_STEREO 4
-#define DRMCH_SBR_STEREO    5
+#define DRMCH_SBR_STEREO    4
+#define DRMCH_SBR_PS_STEREO 5
 
 
 /* First object type that has ER */
@@ -110,10 +110,12 @@
 
 uint8_t adts_frame(adts_header *adts, bitfile *ld);
 void get_adif_header(adif_header *adif, bitfile *ld);
-void raw_data_block(faacDecHandle hDecoder, faacDecFrameInfo *hInfo,
+void raw_data_block(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
                     bitfile *ld, program_config *pce, drc_info *drc);
-uint8_t reordered_spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld,
+uint8_t reordered_spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld,
                                 int16_t *spectral_data);
+void aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
+                               bitfile *ld, program_config *pce, drc_info *drc);
 
 
 #ifdef __cplusplus
--- a/Plugins/Input/aac/libfaad2/tns.c	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/tns.c	Wed May 10 14:44:20 2006 -0700
@@ -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.29 2004/01/05 14:05:12 menno Exp $
+** $Id: tns.c,v 1.35 2004/09/04 14:56:29 menno Exp $
 **/
 
 #include "common.h"
@@ -239,24 +239,32 @@
 
     uint8_t j;
     uint16_t i;
-    real_t y, state[TNS_MAX_ORDER];
-
-    for (i = 0; i < order; i++)
-        state[i] = 0;
+    real_t y;
+    /* state is stored as a double ringbuffer */
+    real_t state[2*TNS_MAX_ORDER] = {0};
+    int8_t state_index = 0;
 
     for (i = 0; i < size; i++)
     {
         y = *spectrum;
 
         for (j = 0; j < order; j++)
-            y -= MUL_C(state[j], lpc[j+1]);
+            y -= MUL_C(state[state_index+j], lpc[j+1]);
 
-        for (j = order-1; j > 0; j--)
-            state[j] = state[j-1];
+        /* double ringbuffer state */
+        state_index--;
+        if (state_index < 0)
+            state_index = order-1;
+        state[state_index] = state[state_index + order] = y;
 
-        state[0] = y;
         *spectrum = y;
         spectrum += inc;
+
+//#define TNS_PRINT
+#ifdef TNS_PRINT
+        //printf("%d\n", y);
+        printf("0x%.8X\n", y);
+#endif
     }
 }
 
@@ -274,10 +282,10 @@
 
     uint8_t j;
     uint16_t i;
-    real_t y, state[TNS_MAX_ORDER];
-
-    for (i = 0; i < order; i++)
-        state[i] = REAL_CONST(0.0);
+    real_t y;
+    /* state is stored as a double ringbuffer */
+    real_t state[2*TNS_MAX_ORDER] = {0};
+    int8_t state_index = 0;
 
     for (i = 0; i < size; i++)
     {
@@ -286,10 +294,12 @@
         for (j = 0; j < order; j++)
             y += MUL_C(state[j], lpc[j+1]);
 
-        for (j = order-1; j > 0; j--)
-            state[j] = state[j-1];
+        /* double ringbuffer state */
+        state_index--;
+        if (state_index < 0)
+            state_index = order-1;
+        state[state_index] = state[state_index + order] = *spectrum;
 
-        state[0] = *spectrum;
         *spectrum = y;
         spectrum += inc;
     }
--- a/Plugins/Input/aac/libfaad2/tns.h	Wed May 10 14:41:23 2006 -0700
+++ b/Plugins/Input/aac/libfaad2/tns.h	Wed May 10 14:44:20 2006 -0700
@@ -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.16 2004/01/05 14:05:12 menno Exp $
+** $Id: tns.h,v 1.19 2004/09/04 14:56:29 menno Exp $
 **/
 
 #ifndef __TNS_H__