changeset 10725:e989150f8216

libfaad2 v2.0rc1 imported
author arpi
date Sat, 30 Aug 2003 22:30:28 +0000
parents adf5697b9d83
children bae3e8c81ada
files libfaad2/Makefile libfaad2/README libfaad2/analysis.h libfaad2/bits.c libfaad2/bits.h libfaad2/cfft.c libfaad2/cfft.h libfaad2/cfft_tab.h libfaad2/codebook/hcb.h libfaad2/codebook/hcb_1.h libfaad2/codebook/hcb_10.h libfaad2/codebook/hcb_11.h libfaad2/codebook/hcb_2.h libfaad2/codebook/hcb_3.h libfaad2/codebook/hcb_4.h libfaad2/codebook/hcb_5.h libfaad2/codebook/hcb_6.h libfaad2/codebook/hcb_7.h libfaad2/codebook/hcb_8.h libfaad2/codebook/hcb_9.h libfaad2/codebook/hcb_sf.h libfaad2/common.c libfaad2/common.h libfaad2/config.h libfaad2/decoder.c libfaad2/decoder.h libfaad2/dither.c libfaad2/dither.h libfaad2/drc.c libfaad2/drc.h libfaad2/error.c libfaad2/error.h libfaad2/faad.h libfaad2/filtbank.c libfaad2/filtbank.h libfaad2/fixed.h libfaad2/hcr.c libfaad2/huffman.h libfaad2/ic_predict.c libfaad2/ic_predict.h libfaad2/iq_table.h libfaad2/is.c libfaad2/is.h libfaad2/kbd_win.h libfaad2/lt_predict.c libfaad2/lt_predict.h libfaad2/mdct.c libfaad2/mdct.h libfaad2/mp4.c libfaad2/mp4.h libfaad2/ms.c libfaad2/ms.h libfaad2/output.c libfaad2/output.h libfaad2/pns.c libfaad2/pns.h libfaad2/pulse.c libfaad2/pulse.h libfaad2/rvlc.c libfaad2/rvlc.h libfaad2/sbr_dct.c libfaad2/sbr_dct.h libfaad2/sbr_dec.c libfaad2/sbr_dec.h libfaad2/sbr_e_nf.c libfaad2/sbr_e_nf.h libfaad2/sbr_fbt.c libfaad2/sbr_fbt.h libfaad2/sbr_hfadj.c libfaad2/sbr_hfadj.h libfaad2/sbr_hfgen.c libfaad2/sbr_hfgen.h libfaad2/sbr_huff.c libfaad2/sbr_huff.h libfaad2/sbr_noise.h libfaad2/sbr_qmf.c libfaad2/sbr_qmf.h libfaad2/sbr_syntax.c libfaad2/sbr_syntax.h libfaad2/sbr_tf_grid.c libfaad2/sbr_tf_grid.h libfaad2/sine_win.h libfaad2/specrec.c libfaad2/specrec.h libfaad2/ssr.c libfaad2/ssr.h libfaad2/ssr_fb.c libfaad2/ssr_fb.h libfaad2/ssr_ipqf.c libfaad2/ssr_ipqf.h libfaad2/ssr_win.h libfaad2/structs.h libfaad2/syntax.c libfaad2/syntax.h libfaad2/tns.c libfaad2/tns.h
diffstat 96 files changed, 42879 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/Makefile	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,39 @@
+
+LIBNAME = libfaad2.a
+
+include ../config.mak
+
+SRCS    = bits.c cfft.c common.c decoder.c dither.c drc.c error.c filtbank.c hcr.c ic_predict.c is.c lt_predict.c mdct.c mp4.c ms.c output.c pns.c pulse.c rvlc.c sbr_dct.c sbr_dec.c sbr_e_nf.c sbr_fbt.c sbr_hfadj.c sbr_hfgen.c sbr_huff.c sbr_qmf.c sbr_syntax.c sbr_tf_grid.c specrec.c ssr.c ssr_fb.c ssr_ipqf.c syntax.c tns.c
+OBJS	= $(SRCS:.c=.o)
+
+CFLAGS  = -I. $(OPTFLAGS) 
+
+.SUFFIXES: .c .o
+
+# .PHONY: all clean
+
+.c.o:
+	$(CC) -c $(CFLAGS) -o $@ $<
+
+$(LIBNAME):	$(OBJS)
+	$(AR) r $(LIBNAME) $(OBJS)
+
+all:	$(LIBNAME)
+
+clean:
+	rm -f *.o *.a *~
+
+distclean:
+	rm -f test *.o *.a *~ .depend
+
+dep:    depend
+
+depend:
+	$(CC) -MM $(CFLAGS) $(SRCS) 1>.depend
+
+#
+# include dependency files if they exist
+#
+ifneq ($(wildcard .depend),)
+include .depend
+endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/README	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,1 @@
+files from libfaad v2.0rc1 tarball's libfaad/ and include/ subdir
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/analysis.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,49 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: analysis.h,v 1.3 2003/07/29 08:20:12 menno Exp $
+**/
+
+#ifndef __ANALYSIS_H__
+#define __ANALYSIS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#ifdef ANALYSIS
+#define DEBUGDEC        ,uint8_t print,uint16_t var,uint8_t *dbg
+#define DEBUGVAR(A,B,C) ,A,B,C
+extern uint16_t dbg_count;
+#else
+#define DEBUGDEC
+#define DEBUGVAR(A,B,C)
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/bits.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,173 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: bits.c,v 1.22 2003/07/29 08:20:12 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include "bits.h"
+
+/* initialize buffer, call once before first getbits or showbits */
+void faad_initbits(bitfile *ld, void *_buffer, uint32_t buffer_size)
+{
+    uint32_t tmp;
+
+    ld->buffer = malloc((buffer_size+12)*sizeof(uint8_t));
+    memset(ld->buffer, 0, (buffer_size+12)*sizeof(uint8_t));
+    memcpy(ld->buffer, _buffer, buffer_size*sizeof(uint8_t));
+
+    ld->buffer_size = buffer_size;
+
+    tmp = getdword((uint32_t*)ld->buffer);
+#ifndef ARCH_IS_BIG_ENDIAN
+    BSWAP(tmp);
+#endif
+    ld->bufa = tmp;
+
+    tmp = getdword((uint32_t*)ld->buffer + 1);
+#ifndef ARCH_IS_BIG_ENDIAN
+    BSWAP(tmp);
+#endif
+    ld->bufb = tmp;
+
+    ld->start = (uint32_t*)ld->buffer;
+    ld->tail = ((uint32_t*)ld->buffer + 2);
+
+    ld->bits_left = 32;
+
+    ld->bytes_used = 0;
+    ld->no_more_reading = 0;
+    ld->error = 0;
+}
+
+void faad_endbits(bitfile *ld)
+{
+    if (ld)
+        if (ld->buffer) free(ld->buffer);
+}
+
+
+uint32_t faad_get_processed_bits(bitfile *ld)
+{
+    return 8 * (4*(ld->tail - ld->start) - 4) - (ld->bits_left);
+}
+
+uint8_t faad_byte_align(bitfile *ld)
+{
+    uint8_t remainder = (uint8_t)((32 - ld->bits_left) % 8);
+
+    if (remainder)
+    {
+        faad_flushbits(ld, 8 - remainder);
+        return (8 - remainder);
+    }
+    return 0;
+}
+
+/* rewind to beginning */
+void faad_rewindbits(bitfile *ld)
+{
+    uint32_t tmp;
+
+    tmp = ld->start[0];
+#ifndef ARCH_IS_BIG_ENDIAN
+    BSWAP(tmp);
+#endif
+    ld->bufa = tmp;
+
+    tmp = ld->start[1];
+#ifndef ARCH_IS_BIG_ENDIAN
+    BSWAP(tmp);
+#endif
+    ld->bufb = tmp;
+    ld->bits_left = 32;
+    ld->tail = &ld->start[2];
+    ld->bytes_used = 0;
+    ld->no_more_reading = 0;
+}
+
+uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits
+                       DEBUGDEC)
+{
+    uint16_t i;
+    uint8_t temp;
+    uint16_t bytes = (uint16_t)bits / 8;
+    uint8_t remainder = (uint8_t)bits % 8;
+
+    uint8_t *buffer = (uint8_t*)malloc((bytes+1)*sizeof(uint8_t));
+
+    for (i = 0; i < bytes; i++)
+    {
+        buffer[i] = (uint8_t)faad_getbits(ld, 8 DEBUGVAR(print,var,dbg));
+    }
+
+    if (remainder)
+    {
+        temp = (uint8_t)faad_getbits(ld, remainder DEBUGVAR(print,var,dbg)) << (8-remainder);
+
+        buffer[bytes] = temp;
+    }
+
+    return buffer;
+}
+
+/* reversed bit reading routines, used for RVLC and HCR */
+void faad_initbits_rev(bitfile *ld, void *buffer,
+                       uint32_t bits_in_buffer)
+{
+    uint32_t tmp;
+    int32_t index;
+
+    ld->buffer_size = bit2byte(bits_in_buffer);
+
+    index = (bits_in_buffer+31)/32 - 1;
+
+    ld->start = (uint32_t*)buffer + index - 2;
+
+    tmp = getdword((uint32_t*)buffer + index);
+#ifndef ARCH_IS_BIG_ENDIAN
+    BSWAP(tmp);
+#endif
+    ld->bufa = tmp;
+
+    tmp = getdword((uint32_t*)buffer + index - 1);
+#ifndef ARCH_IS_BIG_ENDIAN
+    BSWAP(tmp);
+#endif
+    ld->bufb = tmp;
+
+    ld->tail = (uint32_t*)buffer + index;
+
+    ld->bits_left = bits_in_buffer % 32;
+    if (ld->bits_left == 0)
+        ld->bits_left = 32;
+
+    ld->bytes_used = 0;
+    ld->no_more_reading = 0;
+    ld->error = 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/bits.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,260 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id$
+**/
+
+#ifndef __BITS_H__
+#define __BITS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "analysis.h"
+#ifdef ANALYSIS
+#include <stdio.h>
+#endif
+
+#define BYTE_NUMBIT 8
+#define bit2byte(a) ((a+7)/BYTE_NUMBIT)
+
+typedef struct _bitfile
+{
+    /* bit input */
+    uint32_t bufa;
+    uint32_t bufb;
+    uint32_t bits_left;
+    uint32_t buffer_size; /* size of the buffer in bytes */
+    uint32_t bytes_used;
+    uint8_t no_more_reading;
+    uint8_t error;
+    uint32_t *tail;
+    uint32_t *start;
+    void *buffer;
+} bitfile;
+
+
+#if defined (_WIN32) && !defined(_WIN32_WCE)
+#define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax
+#elif defined(LINUX) || defined(DJGPP)
+#define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) )
+#else
+#define BSWAP(a) \
+    ((a) = ( ((a)&0xff)<<24) | (((a)&0xff00)<<8) | (((a)>>8)&0xff00) | (((a)>>24)&0xff))
+#endif
+
+static uint32_t bitmask[] = {
+    0x0, 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, 0x1FF,
+    0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF,
+    0x1FFFF, 0x3FFFF, 0x7FFFF, 0xFFFFF, 0x1FFFFF, 0x3FFFFF,
+    0x7FFFFF, 0xFFFFFF, 0x1FFFFFF, 0x3FFFFFF, 0x7FFFFFF,
+    0xFFFFFFF, 0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF
+};
+
+void faad_initbits(bitfile *ld, void *buffer, uint32_t buffer_size);
+void faad_endbits(bitfile *ld);
+void faad_initbits_rev(bitfile *ld, void *buffer,
+                       uint32_t bits_in_buffer);
+uint8_t faad_byte_align(bitfile *ld);
+uint32_t faad_get_processed_bits(bitfile *ld);
+void faad_rewindbits(bitfile *ld);
+uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits
+                       DEBUGDEC);
+
+/* circumvent memory alignment errors on ARM */
+static INLINE uint32_t getdword(void *mem)
+{
+#ifdef ARM
+    uint32_t tmp;
+    ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[0];
+    ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[1];
+    ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[2];
+    ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[3];
+
+    return tmp;
+#else
+    return *(uint32_t*)mem;
+#endif
+}
+
+static INLINE uint32_t faad_showbits(bitfile *ld, uint32_t bits)
+{
+    if (bits <= ld->bits_left)
+    {
+        return (ld->bufa >> (ld->bits_left - bits)) & bitmask[bits];
+    } else {
+        bits -= ld->bits_left;
+        return ((ld->bufa & bitmask[ld->bits_left]) << bits) | (ld->bufb >> (32 - bits));
+    }
+}
+
+static INLINE void faad_flushbits(bitfile *ld, uint32_t bits)
+{
+    /* do nothing if error */
+    if (ld->error != 0)
+        return;
+
+    if (bits < ld->bits_left)
+    {
+        ld->bits_left -= bits;
+    } else {
+        uint32_t tmp;
+
+        ld->bufa = ld->bufb;
+        tmp = getdword(ld->tail);
+        ld->tail++;
+#ifndef ARCH_IS_BIG_ENDIAN
+        BSWAP(tmp);
+#endif
+        ld->bufb = tmp;
+        ld->bits_left += (32 - bits);
+        ld->bytes_used += 4;
+        if (ld->bytes_used == ld->buffer_size)
+            ld->no_more_reading = 1;
+        if (ld->bytes_used > ld->buffer_size)
+            ld->error = 1;
+    }
+}
+
+/* return next n bits (right adjusted) */
+static INLINE uint32_t faad_getbits(bitfile *ld, uint32_t n DEBUGDEC)
+{
+    uint32_t ret;
+
+    if (ld->no_more_reading)
+        return 0;
+
+    if (n == 0)
+        return 0;
+
+    ret = faad_showbits(ld, n);
+    faad_flushbits(ld, n);
+
+#ifdef ANALYSIS
+    if (print)
+        fprintf(stdout, "%4d %2d bits, val: %4d, variable: %d %s\n", dbg_count++, n, ret, var, dbg);
+#endif
+
+    return ret;
+}
+
+static INLINE uint8_t faad_get1bit(bitfile *ld DEBUGDEC)
+{
+    uint8_t r;
+
+    if (ld->bits_left == 0)
+        return (uint8_t)faad_getbits(ld, 1 DEBUGVAR(print,var,dbg));
+
+    ld->bits_left--;
+    r = (uint8_t)((ld->bufa >> ld->bits_left) & 1);
+
+    return r;
+}
+
+/* reversed bitreading routines */
+static INLINE uint32_t faad_showbits_rev(bitfile *ld, uint32_t bits)
+{
+    uint8_t i;
+    uint32_t B = 0;
+
+    if (bits <= ld->bits_left)
+    {
+        for (i = 0; i < bits; i++)
+        {
+            if (ld->bufa & (1 << (i + (32 - ld->bits_left))))
+                B |= (1 << (bits - i - 1));
+        }
+        return B;
+    } else {
+        for (i = 0; i < ld->bits_left; i++)
+        {
+            if (ld->bufa & (1 << (i + (32 - ld->bits_left))))
+                B |= (1 << (bits - i - 1));
+        }
+        for (i = 0; i < bits - ld->bits_left; i++)
+        {
+            if (ld->bufb & (1 << (i + (32-ld->bits_left))))
+                B |= (1 << (bits - ld->bits_left - i - 1));
+        }
+        return B;
+    }
+}
+
+static INLINE void faad_flushbits_rev(bitfile *ld, uint32_t bits)
+{
+    /* do nothing if error */
+    if (ld->error != 0)
+        return;
+
+    if (bits < ld->bits_left)
+    {
+        ld->bits_left -= bits;
+    } else {
+        uint32_t tmp;
+
+        ld->bufa = ld->bufb;
+        tmp = getdword(ld->start);
+#ifndef ARCH_IS_BIG_ENDIAN
+        BSWAP(tmp);
+#endif
+        ld->bufb = tmp;
+        ld->start--;
+        ld->bits_left += (32 - bits);
+
+        ld->bytes_used += 4;
+        if (ld->bytes_used == ld->buffer_size)
+            ld->no_more_reading = 1;
+        if (ld->bytes_used > ld->buffer_size)
+            ld->error = 1;
+    }
+}
+
+static INLINE uint32_t faad_getbits_rev(bitfile *ld, uint32_t n
+                                        DEBUGDEC)
+{
+    uint32_t ret;
+
+    if (ld->no_more_reading)
+        return 0;
+
+    if (n == 0)
+        return 0;
+
+    ret = faad_showbits_rev(ld, n);
+    faad_flushbits_rev(ld, n);
+
+#ifdef ANALYSIS
+    if (print)
+        fprintf(stdout, "%4d %2d bits, val: %4d, variable: %d %s\n", dbg_count++, n, ret, var, dbg);
+#endif
+
+    return ret;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/cfft.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,556 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: cfft.c,v 1.11 2003/07/29 08:20:12 menno Exp $
+**/
+
+/*
+ * Algorithmically based on Fortran-77 FFTPACK
+ * by Paul N. Swarztrauber(Version 4, 1985).
+ *
+ * Does even sized fft only
+ */
+
+/* isign is +1 for backward and -1 for forward transforms */
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+#ifdef _WIN32_WCE
+#define assert(x)
+#else
+#include <assert.h>
+#endif
+
+#include "cfft.h"
+#include "cfft_tab.h"
+
+
+/*----------------------------------------------------------------------
+   passf2, passf3, passf4, passf5. Complex FFT passes fwd and bwd.
+  ----------------------------------------------------------------------*/
+
+static void passf2(uint16_t ido, uint16_t l1, complex_t *cc, complex_t *ch,
+                   complex_t *wa, int8_t isign)
+{
+    uint16_t i, k, ah, ac;
+
+    if (ido == 1)
+    {
+        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]);
+        }
+    } else {
+        for (k = 0; k < l1; k++)
+        {
+            ah = k*ido;
+            ac = 2*k*ido;
+
+            for (i = 0; i < ido; i++)
+            {
+                complex_t t2;
+
+                RE(ch[ah]) = RE(cc[ac]) + RE(cc[ac+ido]);
+                IM(ch[ah]) = IM(cc[ac]) + IM(cc[ac+ido]);
+
+                RE(t2) = RE(cc[ac]) - RE(cc[ac+ido]);
+                IM(t2) = IM(cc[ac]) - IM(cc[ac+ido]);
+
+                RE(ch[ah+l1*ido]) = MUL_R_C(RE(t2),RE(wa[i])) - MUL_R_C(IM(t2),IM(wa[i]))*isign;
+                IM(ch[ah+l1*ido]) = MUL_R_C(IM(t2),RE(wa[i])) + MUL_R_C(RE(t2),IM(wa[i]))*isign;
+                ah++;
+                ac++;
+            }
+        }
+    }
+}
+
+
+static void passf3(uint16_t ido, uint16_t l1, complex_t *cc, complex_t *ch,
+                   complex_t *wa1, complex_t *wa2, int8_t isign)
+{
+    static real_t taur = COEF_CONST(-0.5);
+    static real_t taui = COEF_CONST(0.866025403784439);
+    uint16_t i, k, ac, ah;
+    complex_t c2, c3, d2, d3, t2;
+
+    if (ido == 1)
+    {
+        for (k = 0; k < l1; k++)
+        {
+            ac = 3*k+1;
+            ah = k;
+
+            RE(t2) = RE(cc[ac]) + RE(cc[ac+1]);
+            IM(t2) = IM(cc[ac]) + IM(cc[ac+1]);
+            RE(c2) = RE(cc[ac-1]) + MUL_R_C(RE(t2),taur);
+            IM(c2) = IM(cc[ac-1]) + MUL_R_C(IM(t2),taur);
+
+            RE(ch[ah]) = RE(cc[ac-1]) + RE(t2);
+            IM(ch[ah]) = IM(cc[ac-1]) + IM(t2);
+
+            RE(c3) = MUL_R_C((RE(cc[ac]) - RE(cc[ac+1])), taui)*isign;
+            IM(c3) = MUL_R_C((IM(cc[ac]) - IM(cc[ac+1])), taui)*isign;
+
+            RE(ch[ah+l1]) = RE(c2) - IM(c3);
+            IM(ch[ah+l1]) = IM(c2) + RE(c3);
+            RE(ch[ah+2*l1]) = RE(c2) + IM(c3);
+            IM(ch[ah+2*l1]) = IM(c2) - RE(c3);
+        }
+    } else {
+        for (k = 0; k < l1; k++)
+        {
+            for (i = 0; i < ido; i++)
+            {
+                ac = i + (3*k+1)*ido;
+                ah = i + k * ido;
+
+                RE(t2) = RE(cc[ac]) + RE(cc[ac+ido]);
+                RE(c2) = RE(cc[ac-ido]) + MUL_R_C(RE(t2),taur);
+                IM(t2) = IM(cc[ac]) + IM(cc[ac+ido]);
+                IM(c2) = IM(cc[ac-ido]) + MUL_R_C(IM(t2),taur);
+
+                RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2);
+                IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2);
+
+                RE(c3) = MUL_R_C((RE(cc[ac]) - RE(cc[ac+ido])), taui)*isign;
+                IM(c3) = MUL_R_C((IM(cc[ac]) - IM(cc[ac+ido])), taui)*isign;
+
+                RE(d2) = RE(c2) - IM(c3);
+                IM(d3) = IM(c2) - RE(c3);
+                RE(d3) = RE(c2) + IM(c3);
+                IM(d2) = IM(c2) + RE(c3);
+
+                RE(ch[ah+l1*ido]) = MUL_R_C(RE(d2),RE(wa1[i])) - MUL_R_C(IM(d2),IM(wa1[i]))*isign;
+                IM(ch[ah+l1*ido]) = MUL_R_C(IM(d2),RE(wa1[i])) + MUL_R_C(RE(d2),IM(wa1[i]))*isign;
+                RE(ch[ah+l1*2*ido]) = MUL_R_C(RE(d3),RE(wa2[i])) - MUL_R_C(IM(d3),IM(wa2[i]))*isign;
+                IM(ch[ah+l1*2*ido]) = MUL_R_C(IM(d3),RE(wa2[i])) + MUL_R_C(RE(d3),IM(wa2[i]))*isign;
+            }
+        }
+    }
+}
+
+
+static void passf4(uint16_t ido, uint16_t l1, complex_t *cc, complex_t *ch,
+                   complex_t *wa1, complex_t *wa2, complex_t *wa3, int8_t isign)
+{
+    uint16_t i, k, ac, ah;
+    complex_t c2, c3, c4, t1, t2, t3, t4;
+
+    if (ido == 1)
+    {
+        for (k = 0; k < l1; k++)
+        {
+            ac = 4*k;
+            ah = k;
+
+            RE(t2) = RE(cc[ac]) + RE(cc[ac+2]);
+            IM(t2) = IM(cc[ac]) + IM(cc[ac+2]);
+            RE(t3) = RE(cc[ac+1]) + RE(cc[ac+3]);
+            IM(t3) = IM(cc[ac+1]) + IM(cc[ac+3]);
+            RE(t1) = RE(cc[ac]) - RE(cc[ac+2]);
+            IM(t1) = IM(cc[ac]) - IM(cc[ac+2]);
+            RE(t4) = IM(cc[ac+3]) - IM(cc[ac+1]);
+            IM(t4) = RE(cc[ac+1]) - RE(cc[ac+3]);
+
+            RE(ch[ah]) = RE(t2) + RE(t3);
+            IM(ch[ah]) = IM(t2) + IM(t3);
+            RE(ch[ah+l1]) = RE(t1) + RE(t4)*isign;
+            IM(ch[ah+l1]) = IM(t1) + IM(t4)*isign;
+            RE(ch[ah+2*l1]) = RE(t2) - RE(t3);
+            IM(ch[ah+2*l1]) = IM(t2) - IM(t3);
+            RE(ch[ah+3*l1]) = RE(t1) - RE(t4)*isign;
+            IM(ch[ah+3*l1]) = IM(t1) - IM(t4)*isign;
+        }
+    } else {
+        for (k = 0; k < l1; k++)
+        {
+            for (i = 0; i < ido; i++)
+            {
+                ac = i + 4*k*ido;
+                ah = i + k*ido;
+
+                RE(t2) = RE(cc[ac]) + RE(cc[ac+2*ido]);
+                IM(t2) = IM(cc[ac]) + IM(cc[ac+2*ido]);
+                RE(t3) = RE(cc[ac+ido]) + RE(cc[ac+3*ido]);
+                IM(t3) = IM(cc[ac+ido]) + IM(cc[ac+3*ido]);
+                RE(t1) = RE(cc[ac]) - RE(cc[ac+2*ido]);
+                IM(t1) = IM(cc[ac]) - IM(cc[ac+2*ido]);
+                RE(t4) = IM(cc[ac+3*ido]) - IM(cc[ac+ido]);
+                IM(t4) = RE(cc[ac+ido]) - RE(cc[ac+3*ido]);
+
+                RE(ch[ah]) = RE(t2) + RE(t3);
+                IM(ch[ah]) = IM(t2) + IM(t3);
+
+                RE(c2) = RE(t1) + RE(t4)*isign;
+                IM(c2) = IM(t1) + IM(t4)*isign;
+                RE(c3) = RE(t2) - RE(t3);
+                IM(c3) = IM(t2) - IM(t3);
+                RE(c4) = RE(t1) - RE(t4)*isign;
+                IM(c4) = IM(t1) - IM(t4)*isign;
+
+                RE(ch[ah+l1*ido]) = MUL_R_C(RE(c2),RE(wa1[i])) - MUL_R_C(IM(c2),IM(wa1[i]))*isign;
+                IM(ch[ah+l1*ido]) = MUL_R_C(IM(c2),RE(wa1[i])) + MUL_R_C(RE(c2),IM(wa1[i]))*isign;
+                RE(ch[ah+2*l1*ido]) = MUL_R_C(RE(c3),RE(wa2[i])) - MUL_R_C(IM(c3),IM(wa2[i]))*isign;
+                IM(ch[ah+2*l1*ido]) = MUL_R_C(IM(c3),RE(wa2[i])) + MUL_R_C(RE(c3),IM(wa2[i]))*isign;
+                RE(ch[ah+3*l1*ido]) = MUL_R_C(RE(c4),RE(wa3[i])) - MUL_R_C(IM(c4),IM(wa3[i]))*isign;
+                IM(ch[ah+3*l1*ido]) = MUL_R_C(IM(c4),RE(wa3[i])) + MUL_R_C(RE(c4),IM(wa3[i]))*isign;
+            }
+        }
+    }
+}
+
+
+static void passf5(uint16_t ido, uint16_t l1, complex_t *cc, complex_t *ch,
+                   complex_t *wa1, complex_t *wa2, complex_t *wa3, complex_t *wa4,
+                   int8_t isign)
+{
+    static real_t tr11 = COEF_CONST(0.309016994374947);
+    static real_t ti11 = COEF_CONST(0.951056516295154);
+    static real_t tr12 = COEF_CONST(-0.809016994374947);
+    static real_t ti12 = COEF_CONST(0.587785252292473);
+    uint16_t i, k, ac, ah;
+    complex_t c2, c3, c4, c5, d3, d4, d5, d2, t2, t3, t4, t5;
+
+    if (ido == 1)
+    {
+        for (k = 0; k < l1; k++)
+        {
+            ac = 5*k + 1;
+            ah = k;
+
+            RE(t2) = RE(cc[ac]) + RE(cc[ac+3]);
+            IM(t2) = IM(cc[ac]) + IM(cc[ac+3]);
+            RE(t3) = RE(cc[ac+1]) + RE(cc[ac+2]);
+            IM(t3) = IM(cc[ac+1]) + IM(cc[ac+2]);
+            RE(t4) = RE(cc[ac+1]) - RE(cc[ac+2]);
+            IM(t4) = IM(cc[ac+1]) - IM(cc[ac+2]);
+            RE(t5) = RE(cc[ac]) - RE(cc[ac+3]);
+            IM(t5) = IM(cc[ac]) - IM(cc[ac+3]);
+
+            RE(ch[ah]) = RE(cc[ac-1]) + RE(t2) + RE(t3);
+            IM(ch[ah]) = IM(cc[ac-1]) + IM(t2) + IM(t3);
+
+            RE(c2) = RE(cc[ac-1]) + MUL_R_C(RE(t2),tr11) + MUL_R_C(RE(t3),tr12);
+            IM(c2) = IM(cc[ac-1]) + MUL_R_C(IM(t2),tr11) + MUL_R_C(IM(t3),tr12);
+            RE(c3) = RE(cc[ac-1]) + MUL_R_C(RE(t2),tr12) + MUL_R_C(RE(t3),tr11);
+            IM(c3) = IM(cc[ac-1]) + MUL_R_C(IM(t2),tr12) + MUL_R_C(IM(t3),tr11);
+            RE(c4) = (MUL_R_C(RE(t5),ti12)*isign - MUL_R_C(RE(t4),ti11));
+            IM(c4) = (MUL_R_C(IM(t5),ti12)*isign - MUL_R_C(IM(t4),ti11));
+            RE(c5) = (MUL_R_C(RE(t5),ti11)*isign + MUL_R_C(RE(t4),ti12));
+            IM(c5) = (MUL_R_C(IM(t5),ti11)*isign + MUL_R_C(IM(t4),ti12));
+
+            RE(ch[ah+l1]) = RE(c2) - IM(c5);
+            IM(ch[ah+l1]) = IM(c2) + RE(c5);
+            RE(ch[ah+2*l1]) = RE(c3) - IM(c4);
+            IM(ch[ah+2*l1]) = IM(c3) + RE(c4);
+            RE(ch[ah+3*l1]) = RE(c3) + IM(c4);
+            IM(ch[ah+3*l1]) = IM(c3) - RE(c4);
+            RE(ch[ah+4*l1]) = RE(c2) + IM(c5);
+            IM(ch[ah+4*l1]) = IM(c2) - RE(c5);
+        }
+    } else {
+        for (k = 0; k < l1; k++)
+        {
+            for (i = 0; i < ido; i++)
+            {
+                ac = i + (k*5 + 1) * ido;
+                ah = i + k * ido;
+
+                RE(t2) = RE(cc[ac]) + RE(cc[ac+3*ido]);
+                IM(t2) = IM(cc[ac]) + IM(cc[ac+3*ido]);
+                RE(t3) = RE(cc[ac+ido]) + RE(cc[ac+2*ido]);
+                IM(t3) = IM(cc[ac+ido]) + IM(cc[ac+2*ido]);
+                RE(t4) = RE(cc[ac+ido]) - RE(cc[ac+2*ido]);
+                IM(t4) = IM(cc[ac+ido]) - IM(cc[ac+2*ido]);
+                RE(t5) = RE(cc[ac]) - RE(cc[ac+3*ido]);
+                IM(t5) = IM(cc[ac]) - IM(cc[ac+3*ido]);
+
+                RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2) + RE(t3);
+                IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2) + IM(t3);
+
+                RE(c2) = RE(cc[ac-ido]) + MUL_R_C(RE(t2),tr11) + MUL_R_C(RE(t3),tr12);
+                IM(c2) = IM(cc[ac-ido]) + MUL_R_C(IM(t2),tr11) + MUL_R_C(IM(t3),tr12);
+                RE(c3) = RE(cc[ac-ido]) + MUL_R_C(RE(t2),tr12) + MUL_R_C(RE(t3),tr11);
+                IM(c3) = IM(cc[ac-ido]) + MUL_R_C(IM(t2),tr12) + MUL_R_C(IM(t3),tr11);
+                RE(c4) = (MUL_R_C(RE(t5),ti12)*isign - MUL_R_C(RE(t4),ti11));
+                IM(c4) = (MUL_R_C(IM(t5),ti12)*isign - MUL_R_C(IM(t4),ti11));
+                RE(c5) = (MUL_R_C(RE(t5),ti11)*isign + MUL_R_C(RE(t4),ti12));
+                IM(c5) = (MUL_R_C(IM(t5),ti11)*isign + MUL_R_C(IM(t4),ti12));
+
+                IM(d2) = IM(c2) + RE(c5);
+                IM(d3) = IM(c3) + RE(c4);
+                RE(d4) = RE(c3) + IM(c4);
+                RE(d5) = RE(c2) + IM(c5);
+                RE(d2) = RE(c2) - IM(c5);
+                IM(d5) = IM(c2) - RE(c5);
+                RE(d3) = RE(c3) - IM(c4);
+                IM(d4) = IM(c3) - RE(c4);
+
+                RE(ch[ah+l1*ido]) = MUL_R_C(RE(d2),RE(wa1[i])) - MUL_R_C(IM(d2),IM(wa1[i]))*isign;
+                IM(ch[ah+l1*ido]) = MUL_R_C(IM(d2),RE(wa1[i])) + MUL_R_C(RE(d2),IM(wa1[i]))*isign;
+                RE(ch[ah+2*l1*ido]) = MUL_R_C(RE(d3),RE(wa2[i])) - MUL_R_C(IM(d3),IM(wa2[i]))*isign;
+                IM(ch[ah+2*l1*ido]) = MUL_R_C(IM(d3),RE(wa2[i])) + MUL_R_C(RE(d3),IM(wa2[i]))*isign;
+                RE(ch[ah+3*l1*ido]) = MUL_R_C(RE(d4),RE(wa3[i])) - MUL_R_C(IM(d4),IM(wa3[i]))*isign;
+                IM(ch[ah+3*l1*ido]) = MUL_R_C(IM(d4),RE(wa3[i])) + MUL_R_C(RE(d4),IM(wa3[i]))*isign;
+                RE(ch[ah+4*l1*ido]) = MUL_R_C(RE(d5),RE(wa4[i])) - MUL_R_C(IM(d5),IM(wa4[i]))*isign;
+                IM(ch[ah+4*l1*ido]) = MUL_R_C(IM(d5),RE(wa4[i])) + MUL_R_C(RE(d5),IM(wa4[i]))*isign;
+            }
+        }
+    }
+}
+
+
+/*----------------------------------------------------------------------
+   cfftf1, cfftf, cfftb, cffti1, cffti. Complex FFTs.
+  ----------------------------------------------------------------------*/
+
+INLINE void cfftf1(uint16_t n, complex_t *c, complex_t *ch,
+                   uint16_t *ifac, complex_t *wa, 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;
+
+        switch (ip)
+        {
+        case 2:
+            if (na == 0)
+                passf2(ido, l1, c, ch, &wa[iw], isign);
+            else
+                passf2(ido, l1, ch, c, &wa[iw], isign);
+
+            na = 1 - na;
+            break;
+        case 3:
+            ix2 = iw + ido;
+
+            if (na == 0)
+                passf3(ido, l1, c, ch, &wa[iw], &wa[ix2], isign);
+            else
+                passf3(ido, l1, ch, c, &wa[iw], &wa[ix2], isign);
+
+            na = 1 - na;
+            break;
+        case 4:
+            ix2 = iw + ido;
+            ix3 = ix2 + ido;
+
+            if (na == 0)
+                passf4(ido, l1, c, ch, &wa[iw], &wa[ix2], &wa[ix3], isign);
+            else
+                passf4(ido, l1, ch, c, &wa[iw], &wa[ix2], &wa[ix3], isign);
+
+            na = 1 - na;
+            break;
+        case 5:
+            ix2 = iw + ido;
+            ix3 = ix2 + ido;
+            ix4 = ix3 + ido;
+
+            if (na == 0)
+                passf5(ido, l1, c, ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
+            else
+                passf5(ido, l1, ch, c, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
+
+            na = 1 - na;
+            break;
+        }
+
+        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]);
+    }
+}
+
+void cfftf(cfft_info *cfft, complex_t *c)
+{
+    cfftf1(cfft->n, c, cfft->work, cfft->ifac, cfft->tab, -1);
+}
+
+void cfftb(cfft_info *cfft, complex_t *c)
+{
+    cfftf1(cfft->n, c, cfft->work, cfft->ifac, cfft->tab, +1);
+}
+
+static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac)
+{
+    static uint16_t ntryh[4] = {3, 4, 2, 5};
+#ifndef FIXED_POINT
+    real_t arg, argh, argld, fi;
+    uint16_t ido, ipm;
+    uint16_t i1, k1, l1, l2;
+    uint16_t ld, ii, ip;
+#endif
+    uint16_t ntry, i, j;
+    uint16_t ib;
+    uint16_t nf, nl, nq, nr;
+
+    nl = n;
+    nf = 0;
+    j = 0;
+
+startloop:
+    j++;
+
+    if (j <= 4)
+        ntry = ntryh[j-1];
+    else
+        ntry += 2;
+
+    do
+    {
+        nq = nl / ntry;
+        nr = nl - ntry*nq;
+
+        if (nr != 0)
+            goto startloop;
+
+        nf++;
+        ifac[nf+1] = ntry;
+        nl = nq;
+
+        if (ntry == 2 && nf != 1)
+        {
+            for (i = 2; i <= nf; i++)
+            {
+                ib = nf - i + 2;
+                ifac[ib+1] = ifac[ib];
+            }
+            ifac[2] = 2;
+        }
+    } while (nl != 1);
+
+    ifac[0] = n;
+    ifac[1] = nf;
+
+#ifndef FIXED_POINT
+    argh = 2.0*M_PI / (real_t)n;
+    i = 0;
+    l1 = 1;
+
+    for (k1 = 1; k1 <= nf; k1++)
+    {
+        ip = ifac[k1+1];
+        ld = 0;
+        l2 = l1*ip;
+        ido = n / l2;
+        ipm = ip - 1;
+
+        for (j = 0; j < ipm; j++)
+        {
+            i1 = i;
+            RE(wa[i]) = 1.0;
+            IM(wa[i]) = 0.0;
+            ld += l1;
+            fi = 0;
+            argld = ld*argh;
+
+            for (ii = 0; ii < ido; ii++)
+            {
+                i++;
+                fi++;
+                arg = fi * argld;
+                RE(wa[i]) = cos(arg);
+                IM(wa[i]) = sin(arg);
+            }
+
+            if (ip > 5)
+            {
+                RE(wa[i1]) = RE(wa[i]);
+                IM(wa[i1]) = IM(wa[i]);
+            }
+        }
+        l1 = l2;
+    }
+#endif
+}
+
+cfft_info *cffti(uint16_t n)
+{
+    cfft_info *cfft = (cfft_info*)malloc(sizeof(cfft_info));
+
+    cfft->n = n;
+    cfft->work = (complex_t*)malloc(n*sizeof(complex_t));
+
+#ifndef FIXED_POINT
+    cfft->tab = (complex_t*)malloc(n*sizeof(complex_t));
+
+    cffti1(n, cfft->tab, cfft->ifac);
+#else
+    cffti1(n, NULL, cfft->ifac);
+
+    switch (n)
+    {
+    case 60: cfft->tab = cfft_tab_60; break;
+    case 64: cfft->tab = cfft_tab_64; break;
+    case 480: cfft->tab = cfft_tab_480; break;
+    case 512: cfft->tab = cfft_tab_512; break;
+#ifdef LD_DEC
+    case 240: cfft->tab = cfft_tab_240; break;
+    case 256: cfft->tab = cfft_tab_256; break;
+#endif
+    }
+#endif
+
+    return cfft;
+}
+
+void cfftu(cfft_info *cfft)
+{
+    if (cfft->work) free(cfft->work);
+#ifndef FIXED_POINT
+    if (cfft->tab) free(cfft->tab);
+#endif
+
+    if (cfft) free(cfft);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/cfft.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,59 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: cfft.h,v 1.6 2003/07/29 08:20:12 menno Exp $
+**/
+
+#ifndef __CFFT_H__
+#define __CFFT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+void cfftf(cfft_info *cfft, complex_t *c);
+void cfftb(cfft_info *cfft, complex_t *c);
+cfft_info *cffti(uint16_t n);
+void cfftu(cfft_info *cfft);
+
+
+static void passf2(uint16_t ido, uint16_t l1, complex_t *cc, complex_t *ch,
+                   complex_t *wa, int8_t isign);
+static void passf3(uint16_t ido, uint16_t l1, complex_t *cc, complex_t *ch,
+                   complex_t *wa1, complex_t *wa2, int8_t isign);
+static void passf4(uint16_t ido, uint16_t l1, complex_t *cc, complex_t *ch,
+                   complex_t *wa1, complex_t *wa2, complex_t *wa3, int8_t isign);
+static void passf5(uint16_t ido, uint16_t l1, complex_t *cc, complex_t *ch,
+                   complex_t *wa1, complex_t *wa2, complex_t *wa3, complex_t *wa4,
+                   int8_t isign);
+INLINE void cfftf1(uint16_t n, complex_t *c, complex_t *ch,
+                   uint16_t *ifac, complex_t *wa, int8_t isign);
+static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/cfft_tab.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,1682 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** 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.3 2003/07/29 08:20:12 menno Exp $
+**/
+
+#ifndef __CFFT_TAB_H__
+#define __CFFT_TAB_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef FIXED_POINT
+
+complex_t cfft_tab_512[] =
+{
+    { 0x10000000, 0x0 },
+    { 0xFFFB110, 0x3243A4 },
+    { 0xFFEC430, 0x648558 },
+    { 0xFFD3970, 0x96C32C },
+    { 0xFFB10F0, 0xC8FB30 },
+    { 0xFF84AB0, 0xFB2B75 },
+    { 0xFF4E6D0, 0x12D520A },
+    { 0xFF0E580, 0x15F6D02 },
+    { 0xFEC46D0, 0x1917A6C },
+    { 0xFE70B00, 0x1C3785C },
+    { 0xFE13240, 0x1F564E6 },
+    { 0xFDABCC0, 0x2273E1C },
+    { 0xFD3AAC0, 0x259020C },
+    { 0xFCBFC90, 0x28AAED8 },
+    { 0xFC3B280, 0x2BC428C },
+    { 0xFBACCD0, 0x2EDBB3C },
+    { 0xFB14BE0, 0x31F1708 },
+    { 0xFA73020, 0x3505408 },
+    { 0xF9C79D0, 0x381704C },
+    { 0xF912980, 0x3B26A00 },
+    { 0xF853F80, 0x3E33F34 },
+    { 0xF78BC50, 0x413EE08 },
+    { 0xF6BA070, 0x44474A0 },
+    { 0xF5DEC60, 0x474D110 },
+    { 0xF4FA0B0, 0x4A50188 },
+    { 0xF40BDD0, 0x4D50430 },
+    { 0xF314470, 0x504D728 },
+    { 0xF213520, 0x5347898 },
+    { 0xF109080, 0x563E6A0 },
+    { 0xEFF5730, 0x5931F78 },
+    { 0xEED89E0, 0x5C22150 },
+    { 0xEDB2930, 0x5F0EA50 },
+    { 0xEC835E0, 0x61F78B0 },
+    { 0xEB4B0C0, 0x64DCAA0 },
+    { 0xEA09A60, 0x67BDE58 },
+    { 0xE8BF3B0, 0x6A9B210 },
+    { 0xE76BD80, 0x6D74400 },
+    { 0xE60F880, 0x7049278 },
+    { 0xE4AA590, 0x7319BA8 },
+    { 0xE33C5A0, 0x75E5DD8 },
+    { 0xE1C5970, 0x78AD750 },
+    { 0xE046210, 0x7B70650 },
+    { 0xDEBE050, 0x7E2E940 },
+    { 0xDD2D530, 0x80E7E40 },
+    { 0xDB941A0, 0x839C3D0 },
+    { 0xD9F26A0, 0x864B830 },
+    { 0xD848530, 0x88F59B0 },
+    { 0xD695E50, 0x8B9A6B0 },
+    { 0xD4DB310, 0x8E39DA0 },
+    { 0xD318480, 0x90D3CD0 },
+    { 0xD14D3D0, 0x93682B0 },
+    { 0xCF7A1F0, 0x95F6DA0 },
+    { 0xCD9F020, 0x987FC00 },
+    { 0xCBBBF80, 0x9B02C50 },
+    { 0xC9D1120, 0x9D7FD20 },
+    { 0xC7DE650, 0x9FF6CB0 },
+    { 0xC5E4030, 0xA2679A0 },
+    { 0xC3E2000, 0xA4D2250 },
+    { 0xC1D8700, 0xA736560 },
+    { 0xBFC7670, 0xA994150 },
+    { 0xBDAEF90, 0xABEB4A0 },
+    { 0xBB8F3B0, 0xAE3BDE0 },
+    { 0xB968420, 0xB085BB0 },
+    { 0xB73A220, 0xB2C8CA0 },
+    { 0xB504F30, 0xB504F30 },
+    { 0xB2C8C90, 0xB73A230 },
+    { 0xB085BA0, 0xB968420 },
+    { 0xAE3BDE0, 0xBB8F3B0 },
+    { 0xABEB490, 0xBDAEFA0 },
+    { 0xA994140, 0xBFC7670 },
+    { 0xA736550, 0xC1D8710 },
+    { 0xA4D2250, 0xC3E2010 },
+    { 0xA267990, 0xC5E4030 },
+    { 0x9FF6CA0, 0xC7DE660 },
+    { 0x9D7FD10, 0xC9D1120 },
+    { 0x9B02C50, 0xCBBBF80 },
+    { 0x987FC00, 0xCD9F020 },
+    { 0x95F6D90, 0xCF7A1F0 },
+    { 0x93682A0, 0xD14D3D0 },
+    { 0x90D3CD0, 0xD318490 },
+    { 0x8E39D90, 0xD4DB320 },
+    { 0x8B9A6B0, 0xD695E50 },
+    { 0x88F59B0, 0xD848530 },
+    { 0x864B820, 0xD9F26A0 },
+    { 0x839C3C0, 0xDB941B0 },
+    { 0x80E7E50, 0xDD2D530 },
+    { 0x7E2E938, 0xDEBE050 },
+    { 0x7B70648, 0xE046220 },
+    { 0x78AD738, 0xE1C5980 },
+    { 0x75E5DD8, 0xE33C5A0 },
+    { 0x7319BA0, 0xE4AA590 },
+    { 0x7049268, 0xE60F880 },
+    { 0x6D74408, 0xE76BD80 },
+    { 0x6A9B208, 0xE8BF3C0 },
+    { 0x67BDE48, 0xEA09A70 },
+    { 0x64DCA80, 0xEB4B0C0 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x5F0EA40, 0xEDB2930 },
+    { 0x5C22138, 0xEED89E0 },
+    { 0x5931F78, 0xEFF5730 },
+    { 0x563E698, 0xF109080 },
+    { 0x5347880, 0xF213530 },
+    { 0x504D710, 0xF314480 },
+    { 0x4D50430, 0xF40BDD0 },
+    { 0x4A50180, 0xF4FA0B0 },
+    { 0x474D0F8, 0xF5DEC70 },
+    { 0x4447498, 0xF6BA070 },
+    { 0x413EE00, 0xF78BC50 },
+    { 0x3E33F20, 0xF853F80 },
+    { 0x3B26A04, 0xF912980 },
+    { 0x3817048, 0xF9C79D0 },
+    { 0x35053F8, 0xFA73020 },
+    { 0x31F16F0, 0xFB14BF0 },
+    { 0x2EDBB3C, 0xFBACCD0 },
+    { 0x2BC4280, 0xFC3B280 },
+    { 0x28AAEC4, 0xFCBFC90 },
+    { 0x2590214, 0xFD3AAC0 },
+    { 0x2273E14, 0xFDABCC0 },
+    { 0x1F564D8, 0xFE13240 },
+    { 0x1C37844, 0xFE70B00 },
+    { 0x1917A6A, 0xFEC46D0 },
+    { 0x15F6CF6, 0xFF0E580 },
+    { 0x12D51F6, 0xFF4E6D0 },
+    { 0xFB2B77, 0xFF84AB0 },
+    { 0xC8FB29, 0xFFB10F0 },
+    { 0x96C31C, 0xFFD3980 },
+    { 0x64853F, 0xFFEC430 },
+    { 0x3243A1, 0xFFFB110 },
+    { 0xFFFFFFF5, 0x10000000 },
+    { 0xFFCDBC47, 0xFFFB110 },
+    { 0xFF9B7AAA, 0xFFEC430 },
+    { 0xFF693CCD, 0xFFD3970 },
+    { 0xFF3704BF, 0xFFB10F0 },
+    { 0xFF04D472, 0xFF84AB0 },
+    { 0xFED2ADF4, 0xFF4E6D0 },
+    { 0xFEA092F2, 0xFF0E580 },
+    { 0xFE6E857E, 0xFEC46D0 },
+    { 0xFE3C87A4, 0xFE70B00 },
+    { 0xFE0A9B12, 0xFE13230 },
+    { 0xFDD8C1D4, 0xFDABCB0 },
+    { 0xFDA6FDD8, 0xFD3AAC0 },
+    { 0xFD755124, 0xFCBFC90 },
+    { 0xFD43BD68, 0xFC3B280 },
+    { 0xFD1244AC, 0xFBACCD0 },
+    { 0xFCE0E8F8, 0xFB14BE0 },
+    { 0xFCAFABF0, 0xFA73020 },
+    { 0xFC7E8FA0, 0xF9C79D0 },
+    { 0xFC4D95E8, 0xF912970 },
+    { 0xFC1CC0CC, 0xF853F80 },
+    { 0xFBEC11F0, 0xF78BC50 },
+    { 0xFBBB8B50, 0xF6BA070 },
+    { 0xFB8B2EF0, 0xF5DEC60 },
+    { 0xFB5AFE68, 0xF4FA0A0 },
+    { 0xFB2AFBB8, 0xF40BDD0 },
+    { 0xFAFB28E0, 0xF314470 },
+    { 0xFACB8768, 0xF213520 },
+    { 0xFA9C1950, 0xF109080 },
+    { 0xFA6CE070, 0xEFF5720 },
+    { 0xFA3DDEB0, 0xEED89E0 },
+    { 0xFA0F15A8, 0xEDB2930 },
+    { 0xF9E08740, 0xEC835E0 },
+    { 0xF9B23568, 0xEB4B0C0 },
+    { 0xF98421A8, 0xEA09A60 },
+    { 0xF9564E00, 0xE8BF3C0 },
+    { 0xF928BC00, 0xE76BD80 },
+    { 0xF8FB6D88, 0xE60F870 },
+    { 0xF8CE6450, 0xE4AA590 },
+    { 0xF8A1A210, 0xE33C590 },
+    { 0xF8752898, 0xE1C5970 },
+    { 0xF848F988, 0xE046200 },
+    { 0xF81D16D0, 0xDEBE060 },
+    { 0xF7F181C0, 0xDD2D530 },
+    { 0xF7C63C30, 0xDB941A0 },
+    { 0xF79B47D0, 0xD9F2690 },
+    { 0xF770A640, 0xD848520 },
+    { 0xF7465930, 0xD695E40 },
+    { 0xF71C6240, 0xD4DB300 },
+    { 0xF6F2C340, 0xD318490 },
+    { 0xF6C97D60, 0xD14D3D0 },
+    { 0xF6A09260, 0xCF7A1F0 },
+    { 0xF67803F0, 0xCD9F020 },
+    { 0xF64FD390, 0xCBBBF70 },
+    { 0xF62802D0, 0xC9D1110 },
+    { 0xF6009330, 0xC7DE630 },
+    { 0xF5D98670, 0xC5E4040 },
+    { 0xF5B2DDB0, 0xC3E2000 },
+    { 0xF58C9AA0, 0xC1D8700 },
+    { 0xF566BEB0, 0xBFC7660 },
+    { 0xF5414B50, 0xBDAEF80 },
+    { 0xF51C4200, 0xBB8F390 },
+    { 0xF4F7A430, 0xB968400 },
+    { 0xF4D37370, 0xB73A230 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0xF48C5DD0, 0xB2C8C90 },
+    { 0xF4697BD0, 0xB085BA0 },
+    { 0xF4470C40, 0xAE3BDD0 },
+    { 0xF4251050, 0xABEB480 },
+    { 0xF4038970, 0xA994120 },
+    { 0xF3E27900, 0xA736560 },
+    { 0xF3C1DFF0, 0xA4D2250 },
+    { 0xF3A1BFC0, 0xA267990 },
+    { 0xF38219A0, 0x9FF6CA0 },
+    { 0xF362EED0, 0x9D7FD00 },
+    { 0xF3444070, 0x9B02C40 },
+    { 0xF3260FC0, 0x987FBD0 },
+    { 0xF3085E10, 0x95F6D90 },
+    { 0xF2EB2C30, 0x93682A0 },
+    { 0xF2CE7B70, 0x90D3CC0 },
+    { 0xF2B24CE0, 0x8E39D90 },
+    { 0xF296A1A0, 0x8B9A690 },
+    { 0xF27B7AC0, 0x88F5980 },
+    { 0xF260D940, 0x864B800 },
+    { 0xF246BE60, 0x839C3D0 },
+    { 0xF22D2AD0, 0x80E7E40 },
+    { 0xF2141FA0, 0x7E2E928 },
+    { 0xF1FB9DE0, 0x7B70640 },
+    { 0xF1E3A670, 0x78AD730 },
+    { 0xF1CC3A50, 0x75E5DB0 },
+    { 0xF1B55A70, 0x7319BB0 },
+    { 0xF19F0780, 0x7049278 },
+    { 0xF1894280, 0x6D743F8 },
+    { 0xF1740C40, 0x6A9B1F8 },
+    { 0xF15F6590, 0x67BDE38 },
+    { 0xF14B4F40, 0x64DCA78 },
+    { 0xF137CA00, 0x61F7880 },
+    { 0xF124D6D0, 0x5F0EA58 },
+    { 0xF1127620, 0x5C22150 },
+    { 0xF100A8D0, 0x5931F70 },
+    { 0xF0EF6F70, 0x563E690 },
+    { 0xF0DECAD0, 0x5347878 },
+    { 0xF0CEBB80, 0x504D700 },
+    { 0xF0BF4220, 0x4D50408 },
+    { 0xF0B05F50, 0x4A50198 },
+    { 0xF0A213A0, 0x474D110 },
+    { 0xF0945F90, 0x4447490 },
+    { 0xF08743B0, 0x413EDF0 },
+    { 0xF07AC080, 0x3E33F14 },
+    { 0xF06ED680, 0x3B269D8 },
+    { 0xF0638620, 0x3817020 },
+    { 0xF058CFE0, 0x350540C },
+    { 0xF04EB410, 0x31F1704 },
+    { 0xF0453330, 0x2EDBB30 },
+    { 0xF03C4D80, 0x2BC4274 },
+    { 0xF0340370, 0x28AAEB8 },
+    { 0xF02C5540, 0x25901E8 },
+    { 0xF0254340, 0x2273DE8 },
+    { 0xF01ECDD0, 0x1F564EC },
+    { 0xF018F500, 0x1C3785A },
+    { 0xF013B930, 0x1917A60 },
+    { 0xF00F1A80, 0x15F6CEA },
+    { 0xF00B1920, 0x12D51EA },
+    { 0xF007B550, 0xFB2B4B },
+    { 0xF004EF10, 0xC8FAFD },
+    { 0xF002C690, 0x96C330 },
+    { 0xF0013BD0, 0x648553 },
+    { 0xF0004EF0, 0x324395 },
+    { 0x10000000, 0x0 },
+    { 0xFFEC430, 0x648558 },
+    { 0xFFB10F0, 0xC8FB30 },
+    { 0xFF4E6D0, 0x12D520A },
+    { 0xFEC46D0, 0x1917A6C },
+    { 0xFE13240, 0x1F564E6 },
+    { 0xFD3AAC0, 0x259020C },
+    { 0xFC3B280, 0x2BC428C },
+    { 0xFB14BE0, 0x31F1708 },
+    { 0xF9C79D0, 0x381704C },
+    { 0xF853F80, 0x3E33F34 },
+    { 0xF6BA070, 0x44474A0 },
+    { 0xF4FA0B0, 0x4A50188 },
+    { 0xF314470, 0x504D728 },
+    { 0xF109080, 0x563E6A0 },
+    { 0xEED89E0, 0x5C22150 },
+    { 0xEC835E0, 0x61F78B0 },
+    { 0xEA09A60, 0x67BDE58 },
+    { 0xE76BD80, 0x6D74400 },
+    { 0xE4AA590, 0x7319BA8 },
+    { 0xE1C5970, 0x78AD750 },
+    { 0xDEBE050, 0x7E2E940 },
+    { 0xDB941A0, 0x839C3D0 },
+    { 0xD848530, 0x88F59B0 },
+    { 0xD4DB310, 0x8E39DA0 },
+    { 0xD14D3D0, 0x93682B0 },
+    { 0xCD9F020, 0x987FC00 },
+    { 0xC9D1120, 0x9D7FD20 },
+    { 0xC5E4030, 0xA2679A0 },
+    { 0xC1D8700, 0xA736560 },
+    { 0xBDAEF90, 0xABEB4A0 },
+    { 0xB968420, 0xB085BB0 },
+    { 0xB504F30, 0xB504F30 },
+    { 0xB085BA0, 0xB968420 },
+    { 0xABEB490, 0xBDAEFA0 },
+    { 0xA736550, 0xC1D8710 },
+    { 0xA267990, 0xC5E4030 },
+    { 0x9D7FD10, 0xC9D1120 },
+    { 0x987FC00, 0xCD9F020 },
+    { 0x93682A0, 0xD14D3D0 },
+    { 0x8E39D90, 0xD4DB320 },
+    { 0x88F59B0, 0xD848530 },
+    { 0x839C3C0, 0xDB941B0 },
+    { 0x7E2E938, 0xDEBE050 },
+    { 0x78AD738, 0xE1C5980 },
+    { 0x7319BA0, 0xE4AA590 },
+    { 0x6D74408, 0xE76BD80 },
+    { 0x67BDE48, 0xEA09A70 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x5C22138, 0xEED89E0 },
+    { 0x563E698, 0xF109080 },
+    { 0x504D710, 0xF314480 },
+    { 0x4A50180, 0xF4FA0B0 },
+    { 0x4447498, 0xF6BA070 },
+    { 0x3E33F20, 0xF853F80 },
+    { 0x3817048, 0xF9C79D0 },
+    { 0x31F16F0, 0xFB14BF0 },
+    { 0x2BC4280, 0xFC3B280 },
+    { 0x2590214, 0xFD3AAC0 },
+    { 0x1F564D8, 0xFE13240 },
+    { 0x1917A6A, 0xFEC46D0 },
+    { 0x12D51F6, 0xFF4E6D0 },
+    { 0xC8FB29, 0xFFB10F0 },
+    { 0x64853F, 0xFFEC430 },
+    { 0x10000000, 0x0 },
+    { 0xFFB10F0, 0xC8FB30 },
+    { 0xFEC46D0, 0x1917A6C },
+    { 0xFD3AAC0, 0x259020C },
+    { 0xFB14BE0, 0x31F1708 },
+    { 0xF853F80, 0x3E33F34 },
+    { 0xF4FA0B0, 0x4A50188 },
+    { 0xF109080, 0x563E6A0 },
+    { 0xEC835E0, 0x61F78B0 },
+    { 0xE76BD80, 0x6D74400 },
+    { 0xE1C5970, 0x78AD750 },
+    { 0xDB941A0, 0x839C3D0 },
+    { 0xD4DB310, 0x8E39DA0 },
+    { 0xCD9F020, 0x987FC00 },
+    { 0xC5E4030, 0xA2679A0 },
+    { 0xBDAEF90, 0xABEB4A0 },
+    { 0xB504F30, 0xB504F30 },
+    { 0xABEB490, 0xBDAEFA0 },
+    { 0xA267990, 0xC5E4030 },
+    { 0x987FC00, 0xCD9F020 },
+    { 0x8E39D90, 0xD4DB320 },
+    { 0x839C3C0, 0xDB941B0 },
+    { 0x78AD738, 0xE1C5980 },
+    { 0x6D74408, 0xE76BD80 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x563E698, 0xF109080 },
+    { 0x4A50180, 0xF4FA0B0 },
+    { 0x3E33F20, 0xF853F80 },
+    { 0x31F16F0, 0xFB14BF0 },
+    { 0x2590214, 0xFD3AAC0 },
+    { 0x1917A6A, 0xFEC46D0 },
+    { 0xC8FB29, 0xFFB10F0 },
+    { 0xFFFFFFF5, 0x10000000 },
+    { 0xFF3704BF, 0xFFB10F0 },
+    { 0xFE6E857E, 0xFEC46D0 },
+    { 0xFDA6FDD8, 0xFD3AAC0 },
+    { 0xFCE0E8F8, 0xFB14BE0 },
+    { 0xFC1CC0CC, 0xF853F80 },
+    { 0xFB5AFE68, 0xF4FA0A0 },
+    { 0xFA9C1950, 0xF109080 },
+    { 0xF9E08740, 0xEC835E0 },
+    { 0xF928BC00, 0xE76BD80 },
+    { 0xF8752898, 0xE1C5970 },
+    { 0xF7C63C30, 0xDB941A0 },
+    { 0xF71C6240, 0xD4DB300 },
+    { 0xF67803F0, 0xCD9F020 },
+    { 0xF5D98670, 0xC5E4040 },
+    { 0xF5414B50, 0xBDAEF80 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0xF4251050, 0xABEB480 },
+    { 0xF3A1BFC0, 0xA267990 },
+    { 0xF3260FC0, 0x987FBD0 },
+    { 0xF2B24CE0, 0x8E39D90 },
+    { 0xF246BE60, 0x839C3D0 },
+    { 0xF1E3A670, 0x78AD730 },
+    { 0xF1894280, 0x6D743F8 },
+    { 0xF137CA00, 0x61F7880 },
+    { 0xF0EF6F70, 0x563E690 },
+    { 0xF0B05F50, 0x4A50198 },
+    { 0xF07AC080, 0x3E33F14 },
+    { 0xF04EB410, 0x31F1704 },
+    { 0xF02C5540, 0x25901E8 },
+    { 0xF013B930, 0x1917A60 },
+    { 0xF004EF10, 0xC8FAFD },
+    { 0x10000000, 0x0 },
+    { 0xFF4E6D0, 0x12D520A },
+    { 0xFD3AAC0, 0x259020C },
+    { 0xF9C79D0, 0x381704C },
+    { 0xF4FA0B0, 0x4A50188 },
+    { 0xEED89E0, 0x5C22150 },
+    { 0xE76BD80, 0x6D74400 },
+    { 0xDEBE050, 0x7E2E940 },
+    { 0xD4DB310, 0x8E39DA0 },
+    { 0xC9D1130, 0x9D7FD10 },
+    { 0xBDAEF90, 0xABEB4A0 },
+    { 0xB085BA0, 0xB968420 },
+    { 0xA267990, 0xC5E4030 },
+    { 0x93682B0, 0xD14D3D0 },
+    { 0x839C3C0, 0xDB941B0 },
+    { 0x7319BA0, 0xE4AA590 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x504D728, 0xF314470 },
+    { 0x3E33F40, 0xF853F80 },
+    { 0x2BC4280, 0xFC3B280 },
+    { 0x1917A6A, 0xFEC46D0 },
+    { 0x64855F, 0xFFEC430 },
+    { 0xFF3704BF, 0xFFB10F0 },
+    { 0xFE0A9B12, 0xFE13230 },
+    { 0xFCE0E8F8, 0xFB14BE0 },
+    { 0xFBBB8B70, 0xF6BA070 },
+    { 0xFA9C1970, 0xF109080 },
+    { 0xF98421A8, 0xEA09A60 },
+    { 0xF8752898, 0xE1C5970 },
+    { 0xF770A640, 0xD848520 },
+    { 0xF67803F0, 0xCD9F020 },
+    { 0xF58C9AA0, 0xC1D8700 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0xF3E27900, 0xA736560 },
+    { 0xF3260FE0, 0x987FC10 },
+    { 0xF27B7AE0, 0x88F59C0 },
+    { 0xF1E3A690, 0x78AD768 },
+    { 0xF15F6590, 0x67BDE38 },
+    { 0xF0EF6F70, 0x563E690 },
+    { 0xF0945F90, 0x4447490 },
+    { 0xF04EB410, 0x31F1704 },
+    { 0xF01ECDD0, 0x1F564EC },
+    { 0xF004EF10, 0xC8FB3D },
+    { 0xF0013BD0, 0xFF9B7ABE },
+    { 0xF013B930, 0xFE6E8572 },
+    { 0xF03C4D80, 0xFD43BD5C },
+    { 0xF07AC080, 0xFC1CC0C0 },
+    { 0xF0CEBB90, 0xFAFB28D0 },
+    { 0xF137CA20, 0xF9E08758 },
+    { 0xF1B55A70, 0xF8CE6460 },
+    { 0xF246BE50, 0xF7C63C40 },
+    { 0xF2EB2C20, 0xF6C97D70 },
+    { 0xF3A1BFB0, 0xF5D98680 },
+    { 0xF4697BF0, 0xF4F7A440 },
+    { 0xF5414B70, 0xF4251060 },
+    { 0xF62802F0, 0xF362EED0 },
+    { 0xF71C62A0, 0xF2B24CC0 },
+    { 0xF81D16C8, 0xF2141FB0 },
+    { 0xF928BC28, 0xF1894270 },
+    { 0xFA3DDEA0, 0xF1127630 },
+    { 0xFB5AFE98, 0xF0B05F50 },
+    { 0xFC7E8F90, 0xF0638630 },
+    { 0xFDA6FE04, 0xF02C5540 },
+    { 0xFED2ADC2, 0xF00B1930 },
+    { 0x10000000, 0x0 },
+    { 0xFEC46D0, 0x1917A6C },
+    { 0xFB14BE0, 0x31F1708 },
+    { 0xF4FA0B0, 0x4A50188 },
+    { 0xEC835E0, 0x61F78B0 },
+    { 0xE1C5970, 0x78AD750 },
+    { 0xD4DB310, 0x8E39DA0 },
+    { 0xC5E4030, 0xA2679A0 },
+    { 0xB504F30, 0xB504F30 },
+    { 0xA267990, 0xC5E4030 },
+    { 0x8E39D90, 0xD4DB320 },
+    { 0x78AD738, 0xE1C5980 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x4A50180, 0xF4FA0B0 },
+    { 0x31F16F0, 0xFB14BF0 },
+    { 0x1917A6A, 0xFEC46D0 },
+    { 0x10000000, 0x0 },
+    { 0xFB14BE0, 0x31F1708 },
+    { 0xEC835E0, 0x61F78B0 },
+    { 0xD4DB310, 0x8E39DA0 },
+    { 0xB504F30, 0xB504F30 },
+    { 0x8E39D90, 0xD4DB320 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x31F16F0, 0xFB14BF0 },
+    { 0xFFFFFFF5, 0x10000000 },
+    { 0xFCE0E8F8, 0xFB14BE0 },
+    { 0xF9E08740, 0xEC835E0 },
+    { 0xF71C6240, 0xD4DB300 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0xF2B24CE0, 0x8E39D90 },
+    { 0xF137CA00, 0x61F7880 },
+    { 0xF04EB410, 0x31F1704 },
+    { 0x10000000, 0x0 },
+    { 0xF4FA0B0, 0x4A50188 },
+    { 0xD4DB310, 0x8E39DA0 },
+    { 0xA267990, 0xC5E4030 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x1917A6A, 0xFEC46D0 },
+    { 0xFCE0E8F8, 0xFB14BE0 },
+    { 0xF8752898, 0xE1C5970 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0xF1E3A690, 0x78AD768 },
+    { 0xF04EB410, 0x31F1704 },
+    { 0xF013B930, 0xFE6E8572 },
+    { 0xF137CA20, 0xF9E08758 },
+    { 0xF3A1BFB0, 0xF5D98680 },
+    { 0xF71C62A0, 0xF2B24CC0 },
+    { 0xFB5AFE98, 0xF0B05F50 },
+    { 0x10000000, 0x0 },
+    { 0xEC835E0, 0x61F78B0 },
+    { 0xB504F30, 0xB504F30 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x10000000, 0x0 },
+    { 0xB504F30, 0xB504F30 },
+    { 0xFFFFFFF5, 0x10000000 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0x10000000, 0x0 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0xF137CA20, 0xF9E08758 },
+    { 0x10000000, 0x0 },
+    { 0x10000000, 0x0 },
+    { 0x10000000, 0x0 },
+    { 0x3, 0xF0000000 }
+};
+
+complex_t cfft_tab_480[] =
+{
+    { 0x10000000, 0x0 },
+    { 0xFFFA630, 0x359D6F },
+    { 0xFFE98B0, 0x6B3885 },
+    { 0xFFCD790, 0xA0CEE7 },
+    { 0xFFA62F0, 0xD65E3B },
+    { 0xFF73AF0, 0x10BE428 },
+    { 0xFF35F90, 0x1415E54 },
+    { 0xFEED120, 0x176CA68 },
+    { 0xFE98FD0, 0x1AC260A },
+    { 0xFE39BC0, 0x1E16EE6 },
+    { 0xFDCF550, 0x216A2A4 },
+    { 0xFD59CB0, 0x24BBEEC },
+    { 0xFCD9250, 0x280C170 },
+    { 0xFC4D670, 0x2B5A7D4 },
+    { 0xFBB6980, 0x2EA6FCC },
+    { 0xFB14BE0, 0x31F1708 },
+    { 0xFA67E20, 0x3539B38 },
+    { 0xF9B0090, 0x387FA0C },
+    { 0xF8ED3C0, 0x3BC3138 },
+    { 0xF81F840, 0x3F03E70 },
+    { 0xF746EA0, 0x4241F70 },
+    { 0xF663770, 0x457D1F0 },
+    { 0xF575360, 0x48B53B0 },
+    { 0xF47C300, 0x4BEA268 },
+    { 0xF378710, 0x4F1BBD0 },
+    { 0xF26A030, 0x5249DB0 },
+    { 0xF150F40, 0x55745E0 },
+    { 0xF02D4F0, 0x589B210 },
+    { 0xEEFF200, 0x5BBE008 },
+    { 0xEDC6770, 0x5EDCDA0 },
+    { 0xEC835E0, 0x61F78B0 },
+    { 0xEB35E60, 0x650DEF8 },
+    { 0xE9DE1D0, 0x681FE48 },
+    { 0xE87C120, 0x6B2D490 },
+    { 0xE70FD40, 0x6E35FA0 },
+    { 0xE599740, 0x7139D58 },
+    { 0xE419010, 0x7438B90 },
+    { 0xE28E8D0, 0x7732838 },
+    { 0xE0FA280, 0x7A27140 },
+    { 0xDF5BE60, 0x7D16488 },
+    { 0xDDB3D70, 0x8000000 },
+    { 0xDC020F0, 0x82E41B0 },
+    { 0xDA46A00, 0x85C2770 },
+    { 0xD8819E0, 0x889AF60 },
+    { 0xD6B31D0, 0x8B6D770 },
+    { 0xD4DB310, 0x8E39DA0 },
+    { 0xD2F9EF0, 0x9100000 },
+    { 0xD10F6B0, 0x93BFCA0 },
+    { 0xCF1BBD0, 0x9679180 },
+    { 0xCD1EF80, 0x992BCD0 },
+    { 0xCB19340, 0x9BD7CA0 },
+    { 0xC90A870, 0x9E7CF10 },
+    { 0xC6F3090, 0xA11B240 },
+    { 0xC4D2D10, 0xA3B2460 },
+    { 0xC2A9F70, 0xA6423B0 },
+    { 0xC078920, 0xA8CAE40 },
+    { 0xBE3EBD0, 0xAB4C250 },
+    { 0xBBFC8F0, 0xADC5E30 },
+    { 0xB9B2230, 0xB038010 },
+    { 0xB75F900, 0xB2A2660 },
+    { 0xB504F30, 0xB504F30 },
+    { 0xB2A2650, 0xB75F910 },
+    { 0xB038010, 0xB9B2230 },
+    { 0xADC5E20, 0xBBFC900 },
+    { 0xAB4C240, 0xBE3EBE0 },
+    { 0xA8CAE30, 0xC078930 },
+    { 0xA6423A0, 0xC2A9F70 },
+    { 0xA3B2460, 0xC4D2D20 },
+    { 0xA11B240, 0xC6F30A0 },
+    { 0x9E7CF10, 0xC90A880 },
+    { 0x9BD7C90, 0xCB19350 },
+    { 0x992BCD0, 0xCD1EF90 },
+    { 0x9679180, 0xCF1BBD0 },
+    { 0x93BFC90, 0xD10F6C0 },
+    { 0x9100000, 0xD2F9EF0 },
+    { 0x8E39D90, 0xD4DB320 },
+    { 0x8B6D760, 0xD6B31E0 },
+    { 0x889AF60, 0xD8819E0 },
+    { 0x85C2760, 0xDA46A10 },
+    { 0x82E41B0, 0xDC020F0 },
+    { 0x7FFFFF8, 0xDDB3D80 },
+    { 0x7D16470, 0xDF5BE70 },
+    { 0x7A27138, 0xE0FA290 },
+    { 0x7732828, 0xE28E8D0 },
+    { 0x7438B90, 0xE419010 },
+    { 0x7139D48, 0xE599740 },
+    { 0x6E35F88, 0xE70FD50 },
+    { 0x6B2D490, 0xE87C120 },
+    { 0x681FE40, 0xE9DE1E0 },
+    { 0x650DEE0, 0xEB35E70 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x5EDCD98, 0xEDC6770 },
+    { 0x5BBDFF0, 0xEEFF210 },
+    { 0x589B208, 0xF02D4F0 },
+    { 0x55745D0, 0xF150F40 },
+    { 0x5249DB8, 0xF26A030 },
+    { 0x4F1BBC8, 0xF378710 },
+    { 0x4BEA250, 0xF47C300 },
+    { 0x48B53A8, 0xF575360 },
+    { 0x457D1E0, 0xF663780 },
+    { 0x4241F78, 0xF746EA0 },
+    { 0x3F03E68, 0xF81F840 },
+    { 0x3BC3124, 0xF8ED3C0 },
+    { 0x387FA0C, 0xF9B0090 },
+    { 0x3539B2C, 0xFA67E20 },
+    { 0x31F16F0, 0xFB14BF0 },
+    { 0x2EA6FCC, 0xFBB6980 },
+    { 0x2B5A7C4, 0xFC4D670 },
+    { 0x280C154, 0xFCD9250 },
+    { 0x24BBEE4, 0xFD59CB0 },
+    { 0x216A290, 0xFDCF550 },
+    { 0x1E16EE6, 0xFE39BC0 },
+    { 0x1AC25FE, 0xFE98FD0 },
+    { 0x176CA50, 0xFEED120 },
+    { 0x1415E50, 0xFF35F90 },
+    { 0x10BE418, 0xFF73AF0 },
+    { 0xD65E3F, 0xFFA62F0 },
+    { 0xA0CEDF, 0xFFCD790 },
+    { 0x6B3871, 0xFFE98B0 },
+    { 0x359D70, 0xFFFA630 },
+    { 0xFFFFFFF5, 0x10000000 },
+    { 0xFFCA6279, 0xFFFA630 },
+    { 0xFF94C777, 0xFFE98B0 },
+    { 0xFF5F3109, 0xFFCD790 },
+    { 0xFF29A1AA, 0xFFA62F0 },
+    { 0xFEF41BD0, 0xFF73AF0 },
+    { 0xFEBEA198, 0xFF35F90 },
+    { 0xFE893598, 0xFEED120 },
+    { 0xFE53D9EA, 0xFE98FD0 },
+    { 0xFE1E9102, 0xFE39BC0 },
+    { 0xFDE95D58, 0xFDCF550 },
+    { 0xFDB44104, 0xFD59CB0 },
+    { 0xFD7F3E98, 0xFCD9250 },
+    { 0xFD4A5824, 0xFC4D670 },
+    { 0xFD159020, 0xFBB6980 },
+    { 0xFCE0E8F8, 0xFB14BE0 },
+    { 0xFCAC64BC, 0xFA67E10 },
+    { 0xFC7805E0, 0xF9B0080 },
+    { 0xFC43CEC4, 0xF8ED3C0 },
+    { 0xFC0FC180, 0xF81F840 },
+    { 0xFBDBE070, 0xF746EA0 },
+    { 0xFBA82E08, 0xF663770 },
+    { 0xFB74AC40, 0xF575350 },
+    { 0xFB415DA0, 0xF47C300 },
+    { 0xFB0E4428, 0xF378700 },
+    { 0xFADB6230, 0xF26A030 },
+    { 0xFAA8BA20, 0xF150F40 },
+    { 0xFA764DE8, 0xF02D4E0 },
+    { 0xFA441FF8, 0xEEFF210 },
+    { 0xFA123250, 0xEDC6760 },
+    { 0xF9E08740, 0xEC835E0 },
+    { 0xF9AF2110, 0xEB35E70 },
+    { 0xF97E01A8, 0xE9DE1D0 },
+    { 0xF94D2B58, 0xE87C110 },
+    { 0xF91CA060, 0xE70FD40 },
+    { 0xF8EC62C0, 0xE599740 },
+    { 0xF8BC7458, 0xE419000 },
+    { 0xF88CD7C0, 0xE28E8C0 },
+    { 0xF85D8ED0, 0xE0FA290 },
+    { 0xF82E9B60, 0xDF5BE50 },
+    { 0xF7FFFFF0, 0xDDB3D70 },
+    { 0xF7D1BE60, 0xDC020F0 },
+    { 0xF7A3D870, 0xDA469F0 },
+    { 0xF7765090, 0xD8819E0 },
+    { 0xF7492890, 0xD6B31D0 },
+    { 0xF71C6240, 0xD4DB300 },
+    { 0xF6EFFFF0, 0xD2F9EE0 },
+    { 0xF6C40360, 0xD10F6C0 },
+    { 0xF6986E90, 0xCF1BBD0 },
+    { 0xF66D4320, 0xCD1EF70 },
+    { 0xF6428360, 0xCB19340 },
+    { 0xF6183100, 0xC90A880 },
+    { 0xF5EE4DA0, 0xC6F3080 },
+    { 0xF5C4DB90, 0xC4D2D10 },
+    { 0xF59BDC60, 0xC2A9F70 },
+    { 0xF57351B0, 0xC078910 },
+    { 0xF54B3DA0, 0xBE3EBD0 },
+    { 0xF523A1D0, 0xBBFC8F0 },
+    { 0xF4FC7FD0, 0xB9B2210 },
+    { 0xF4D5D9A0, 0xB75F8F0 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0xF48A06E0, 0xB2A2630 },
+    { 0xF464DDC0, 0xB038000 },
+    { 0xF4403700, 0xADC5E20 },
+    { 0xF41C1410, 0xAB4C220 },
+    { 0xF3F876C0, 0xA8CAE20 },
+    { 0xF3D56080, 0xA6423A0 },
+    { 0xF3B2D2F0, 0xA3B2470 },
+    { 0xF390CF50, 0xA11B220 },
+    { 0xF36F5780, 0x9E7CF00 },
+    { 0xF34E6CC0, 0x9BD7CA0 },
+    { 0xF32E1060, 0x992BCB0 },
+    { 0xF30E4420, 0x9679170 },
+    { 0xF2EF0940, 0x93BFCA0 },
+    { 0xF2D060F0, 0x90FFFE0 },
+    { 0xF2B24CE0, 0x8E39D90 },
+    { 0xF294CE30, 0x8B6D770 },
+    { 0xF277E600, 0x889AF30 },
+    { 0xF25B95F0, 0x85C2760 },
+    { 0xF23FDF10, 0x82E41A0 },
+    { 0xF224C290, 0x8000010 },
+    { 0xF20A4190, 0x7D16468 },
+    { 0xF1F05D70, 0x7A27130 },
+    { 0xF1D71730, 0x7732840 },
+    { 0xF1BE6FE0, 0x7438B68 },
+    { 0xF1A668C0, 0x7139D40 },
+    { 0xF18F02C0, 0x6E35FA0 },
+    { 0xF1783ED0, 0x6B2D468 },
+    { 0xF1621E20, 0x681FE38 },
+    { 0xF14CA190, 0x650DEF0 },
+    { 0xF137CA00, 0x61F7880 },
+    { 0xF1239890, 0x5EDCD88 },
+    { 0xF1100DF0, 0x5BBE000 },
+    { 0xF0FD2B00, 0x589B1E0 },
+    { 0xF0EAF0B0, 0x55745C0 },
+    { 0xF0D95FC0, 0x5249DB0 },
+    { 0xF0C878E0, 0x4F1BB98 },
+    { 0xF0B83CF0, 0x4BEA240 },
+    { 0xF0A8ACA0, 0x48B53A0 },
+    { 0xF099C890, 0x457D1F8 },
+    { 0xF08B9150, 0x4241F50 },
+    { 0xF07E07B0, 0x3F03E60 },
+    { 0xF0712C40, 0x3BC3138 },
+    { 0xF064FF70, 0x387F9E0 },
+    { 0xF05981E0, 0x3539B20 },
+    { 0xF04EB410, 0x31F1704 },
+    { 0xF0449680, 0x2EA6FA0 },
+    { 0xF03B2990, 0x2B5A7B8 },
+    { 0xF0326DB0, 0x280C168 },
+    { 0xF02A6340, 0x24BBEB8 },
+    { 0xF0230AB0, 0x216A284 },
+    { 0xF01C6440, 0x1E16EDA },
+    { 0xF0167030, 0x1AC2612 },
+    { 0xF0112ED0, 0x176CA44 },
+    { 0xF00CA060, 0x1415E44 },
+    { 0xF008C510, 0x10BE42C },
+    { 0xF0059D00, 0xD65E13 },
+    { 0xF0032870, 0xA0CED3 },
+    { 0xF0016750, 0x6B3886 },
+    { 0xF00059D0, 0x359D44 },
+    { 0x10000000, 0x0 },
+    { 0xFFE98B0, 0x6B3885 },
+    { 0xFFA62F0, 0xD65E3B },
+    { 0xFF35F90, 0x1415E54 },
+    { 0xFE98FD0, 0x1AC260A },
+    { 0xFDCF550, 0x216A2A4 },
+    { 0xFCD9250, 0x280C170 },
+    { 0xFBB6980, 0x2EA6FCC },
+    { 0xFA67E20, 0x3539B38 },
+    { 0xF8ED3C0, 0x3BC3138 },
+    { 0xF746EA0, 0x4241F70 },
+    { 0xF575360, 0x48B53B0 },
+    { 0xF378710, 0x4F1BBD0 },
+    { 0xF150F40, 0x55745E0 },
+    { 0xEEFF200, 0x5BBE008 },
+    { 0xEC835E0, 0x61F78B0 },
+    { 0xE9DE1D0, 0x681FE48 },
+    { 0xE70FD40, 0x6E35FA0 },
+    { 0xE419010, 0x7438B90 },
+    { 0xE0FA280, 0x7A27140 },
+    { 0xDDB3D70, 0x8000000 },
+    { 0xDA46A00, 0x85C2770 },
+    { 0xD6B31D0, 0x8B6D770 },
+    { 0xD2F9EF0, 0x9100000 },
+    { 0xCF1BBD0, 0x9679180 },
+    { 0xCB19340, 0x9BD7CA0 },
+    { 0xC6F3090, 0xA11B240 },
+    { 0xC2A9F70, 0xA6423B0 },
+    { 0xBE3EBD0, 0xAB4C250 },
+    { 0xB9B2230, 0xB038010 },
+    { 0xB504F30, 0xB504F30 },
+    { 0xB038010, 0xB9B2230 },
+    { 0xAB4C240, 0xBE3EBE0 },
+    { 0xA6423A0, 0xC2A9F70 },
+    { 0xA11B240, 0xC6F30A0 },
+    { 0x9BD7C90, 0xCB19350 },
+    { 0x9679180, 0xCF1BBD0 },
+    { 0x9100000, 0xD2F9EF0 },
+    { 0x8B6D760, 0xD6B31E0 },
+    { 0x85C2760, 0xDA46A10 },
+    { 0x7FFFFF8, 0xDDB3D80 },
+    { 0x7A27138, 0xE0FA290 },
+    { 0x7438B90, 0xE419010 },
+    { 0x6E35F88, 0xE70FD50 },
+    { 0x681FE40, 0xE9DE1E0 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x5BBDFF0, 0xEEFF210 },
+    { 0x55745D0, 0xF150F40 },
+    { 0x4F1BBC8, 0xF378710 },
+    { 0x48B53A8, 0xF575360 },
+    { 0x4241F78, 0xF746EA0 },
+    { 0x3BC3124, 0xF8ED3C0 },
+    { 0x3539B2C, 0xFA67E20 },
+    { 0x2EA6FCC, 0xFBB6980 },
+    { 0x280C154, 0xFCD9250 },
+    { 0x216A290, 0xFDCF550 },
+    { 0x1AC25FE, 0xFE98FD0 },
+    { 0x1415E50, 0xFF35F90 },
+    { 0xD65E3F, 0xFFA62F0 },
+    { 0x6B3871, 0xFFE98B0 },
+    { 0xFFFFFFF5, 0x10000000 },
+    { 0xFF94C777, 0xFFE98B0 },
+    { 0xFF29A1AA, 0xFFA62F0 },
+    { 0xFEBEA198, 0xFF35F90 },
+    { 0xFE53D9EA, 0xFE98FD0 },
+    { 0xFDE95D58, 0xFDCF550 },
+    { 0xFD7F3E98, 0xFCD9250 },
+    { 0xFD159020, 0xFBB6980 },
+    { 0xFCAC64BC, 0xFA67E10 },
+    { 0xFC43CEC4, 0xF8ED3C0 },
+    { 0xFBDBE070, 0xF746EA0 },
+    { 0xFB74AC40, 0xF575350 },
+    { 0xFB0E4428, 0xF378700 },
+    { 0xFAA8BA20, 0xF150F40 },
+    { 0xFA441FF8, 0xEEFF210 },
+    { 0xF9E08740, 0xEC835E0 },
+    { 0xF97E01A8, 0xE9DE1D0 },
+    { 0xF91CA060, 0xE70FD40 },
+    { 0xF8BC7458, 0xE419000 },
+    { 0xF85D8ED0, 0xE0FA290 },
+    { 0x10000000, 0x0 },
+    { 0xFFA62F0, 0xD65E3B },
+    { 0xFE98FD0, 0x1AC260A },
+    { 0xFCD9250, 0x280C170 },
+    { 0xFA67E20, 0x3539B38 },
+    { 0xF746EA0, 0x4241F70 },
+    { 0xF378710, 0x4F1BBD0 },
+    { 0xEEFF200, 0x5BBE008 },
+    { 0xE9DE1D0, 0x681FE48 },
+    { 0xE419010, 0x7438B90 },
+    { 0xDDB3D70, 0x8000000 },
+    { 0xD6B31D0, 0x8B6D770 },
+    { 0xCF1BBD0, 0x9679180 },
+    { 0xC6F3090, 0xA11B240 },
+    { 0xBE3EBD0, 0xAB4C250 },
+    { 0xB504F30, 0xB504F30 },
+    { 0xAB4C240, 0xBE3EBE0 },
+    { 0xA11B240, 0xC6F30A0 },
+    { 0x9679180, 0xCF1BBD0 },
+    { 0x8B6D760, 0xD6B31E0 },
+    { 0x7FFFFF8, 0xDDB3D80 },
+    { 0x7438B90, 0xE419010 },
+    { 0x681FE40, 0xE9DE1E0 },
+    { 0x5BBDFF0, 0xEEFF210 },
+    { 0x4F1BBC8, 0xF378710 },
+    { 0x4241F78, 0xF746EA0 },
+    { 0x3539B2C, 0xFA67E20 },
+    { 0x280C154, 0xFCD9250 },
+    { 0x1AC25FE, 0xFE98FD0 },
+    { 0xD65E3F, 0xFFA62F0 },
+    { 0xFFFFFFF5, 0x10000000 },
+    { 0xFF29A1AA, 0xFFA62F0 },
+    { 0xFE53D9EA, 0xFE98FD0 },
+    { 0xFD7F3E98, 0xFCD9250 },
+    { 0xFCAC64BC, 0xFA67E10 },
+    { 0xFBDBE070, 0xF746EA0 },
+    { 0xFB0E4428, 0xF378700 },
+    { 0xFA441FF8, 0xEEFF210 },
+    { 0xF97E01A8, 0xE9DE1D0 },
+    { 0xF8BC7458, 0xE419000 },
+    { 0xF7FFFFF0, 0xDDB3D70 },
+    { 0xF7492890, 0xD6B31D0 },
+    { 0xF6986E90, 0xCF1BBD0 },
+    { 0xF5EE4DA0, 0xC6F3080 },
+    { 0xF54B3DA0, 0xBE3EBD0 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0xF41C1410, 0xAB4C220 },
+    { 0xF390CF50, 0xA11B220 },
+    { 0xF30E4420, 0x9679170 },
+    { 0xF294CE30, 0x8B6D770 },
+    { 0xF224C290, 0x8000010 },
+    { 0xF1BE6FE0, 0x7438B68 },
+    { 0xF1621E20, 0x681FE38 },
+    { 0xF1100DF0, 0x5BBE000 },
+    { 0xF0C878E0, 0x4F1BB98 },
+    { 0xF08B9150, 0x4241F50 },
+    { 0xF05981E0, 0x3539B20 },
+    { 0xF0326DB0, 0x280C168 },
+    { 0xF0167030, 0x1AC2612 },
+    { 0xF0059D00, 0xD65E13 },
+    { 0xF0000000, 0xFFFFFFE9 },
+    { 0xF0059D10, 0xFF29A1BE },
+    { 0xF0167040, 0xFE53D9BE },
+    { 0xF0326DC0, 0xFD7F3E6C },
+    { 0xF05981F0, 0xFCAC64B0 },
+    { 0xF08B9160, 0xFBDBE088 },
+    { 0xF0C878F0, 0xFB0E4438 },
+    { 0xF1100E00, 0xFA441FD0 },
+    { 0xF1621E30, 0xF97E01A0 },
+    { 0xF1BE6FF0, 0xF8BC7468 },
+    { 0xF224C2B0, 0xF7FFFFD0 },
+    { 0xF294CE40, 0xF7492870 },
+    { 0xF30E4440, 0xF6986E60 },
+    { 0xF390CF70, 0xF5EE4DB0 },
+    { 0xF41C1430, 0xF54B3DB0 },
+    { 0xF4AFB0F0, 0xF4AFB0B0 },
+    { 0xF54B3DD0, 0xF41C1420 },
+    { 0xF5EE4DD0, 0xF390CF60 },
+    { 0xF6986EB0, 0xF30E4410 },
+    { 0xF7492880, 0xF294CE30 },
+    { 0x10000000, 0x0 },
+    { 0xFF35F90, 0x1415E54 },
+    { 0xFCD9250, 0x280C170 },
+    { 0xF8ED3C0, 0x3BC3138 },
+    { 0xF378710, 0x4F1BBD0 },
+    { 0xEC835E0, 0x61F78B0 },
+    { 0xE419010, 0x7438B90 },
+    { 0xDA46A00, 0x85C2770 },
+    { 0xCF1BBD0, 0x9679180 },
+    { 0xC2A9F70, 0xA6423B0 },
+    { 0xB504F30, 0xB504F30 },
+    { 0xA6423A0, 0xC2A9F70 },
+    { 0x9679180, 0xCF1BBD0 },
+    { 0x85C2760, 0xDA46A10 },
+    { 0x7438B90, 0xE419010 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x4F1BBC8, 0xF378710 },
+    { 0x3BC3124, 0xF8ED3C0 },
+    { 0x280C154, 0xFCD9250 },
+    { 0x1415E50, 0xFF35F90 },
+    { 0x10000000, 0x0 },
+    { 0xFCD9250, 0x280C170 },
+    { 0xF378710, 0x4F1BBD0 },
+    { 0xE419010, 0x7438B90 },
+    { 0xCF1BBD0, 0x9679180 },
+    { 0xB504F30, 0xB504F30 },
+    { 0x9679180, 0xCF1BBD0 },
+    { 0x7438B90, 0xE419010 },
+    { 0x4F1BBC8, 0xF378710 },
+    { 0x280C154, 0xFCD9250 },
+    { 0xFFFFFFF5, 0x10000000 },
+    { 0xFD7F3E98, 0xFCD9250 },
+    { 0xFB0E4428, 0xF378700 },
+    { 0xF8BC7458, 0xE419000 },
+    { 0xF6986E90, 0xCF1BBD0 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0xF30E4420, 0x9679170 },
+    { 0xF1BE6FE0, 0x7438B68 },
+    { 0xF0C878E0, 0x4F1BB98 },
+    { 0xF0326DB0, 0x280C168 },
+    { 0x10000000, 0x0 },
+    { 0xF8ED3C0, 0x3BC3138 },
+    { 0xE419010, 0x7438B90 },
+    { 0xC2A9F70, 0xA6423B0 },
+    { 0x9679180, 0xCF1BBD0 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x280C154, 0xFCD9250 },
+    { 0xFEBEA198, 0xFF35F90 },
+    { 0xFB0E4428, 0xF378700 },
+    { 0xF7A3D870, 0xDA469F0 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0xF25B95F0, 0x85C2760 },
+    { 0xF0C878E0, 0x4F1BB98 },
+    { 0xF00CA060, 0x1415E44 },
+    { 0xF0326DC0, 0xFD7F3E6C },
+    { 0xF137CA20, 0xF9E08758 },
+    { 0xF30E4440, 0xF6986E60 },
+    { 0xF59BDC80, 0xF3D56070 },
+    { 0xF8BC74C0, 0xF1BE6FD0 },
+    { 0xFC43CEB4, 0xF0712C40 },
+    { 0x10000000, 0x0 },
+    { 0xF378710, 0x4F1BBD0 },
+    { 0xCF1BBD0, 0x9679180 },
+    { 0x9679180, 0xCF1BBD0 },
+    { 0x4F1BBC8, 0xF378710 },
+    { 0x10000000, 0x0 },
+    { 0xCF1BBD0, 0x9679180 },
+    { 0x4F1BBC8, 0xF378710 },
+    { 0xFB0E4428, 0xF378700 },
+    { 0xF30E4420, 0x9679170 },
+    { 0x10000000, 0x0 },
+    { 0x9679180, 0xCF1BBD0 },
+    { 0xFB0E4428, 0xF378700 },
+    { 0xF0C878E0, 0x4F1BB98 },
+    { 0xF30E4440, 0xF6986E60 },
+    { 0x10000000, 0x0 },
+    { 0x10000000, 0x0 },
+    { 0x10000000, 0x0 },
+    { 0x10000000, 0x0 },
+    { 0x4F1BBF0, 0xF0C87900 }
+};
+
+complex_t cfft_tab_64[] =
+{
+    { 0x10000000, 0x0 },
+    { 0xFEC46D0, 0x1917A6C },
+    { 0xFB14BE0, 0x31F1708 },
+    { 0xF4FA0B0, 0x4A50188 },
+    { 0xEC835E0, 0x61F78B0 },
+    { 0xE1C5970, 0x78AD750 },
+    { 0xD4DB310, 0x8E39DA0 },
+    { 0xC5E4030, 0xA2679A0 },
+    { 0xB504F30, 0xB504F30 },
+    { 0xA267990, 0xC5E4030 },
+    { 0x8E39D90, 0xD4DB320 },
+    { 0x78AD738, 0xE1C5980 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x4A50180, 0xF4FA0B0 },
+    { 0x31F16F0, 0xFB14BF0 },
+    { 0x1917A6A, 0xFEC46D0 },
+    { 0x10000000, 0x0 },
+    { 0xFB14BE0, 0x31F1708 },
+    { 0xEC835E0, 0x61F78B0 },
+    { 0xD4DB310, 0x8E39DA0 },
+    { 0xB504F30, 0xB504F30 },
+    { 0x8E39D90, 0xD4DB320 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x31F16F0, 0xFB14BF0 },
+    { 0xFFFFFFF5, 0x10000000 },
+    { 0xFCE0E8F8, 0xFB14BE0 },
+    { 0xF9E08740, 0xEC835E0 },
+    { 0xF71C6240, 0xD4DB300 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0xF2B24CE0, 0x8E39D90 },
+    { 0xF137CA00, 0x61F7880 },
+    { 0xF04EB410, 0x31F1704 },
+    { 0x10000000, 0x0 },
+    { 0xF4FA0B0, 0x4A50188 },
+    { 0xD4DB310, 0x8E39DA0 },
+    { 0xA267990, 0xC5E4030 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x1917A6A, 0xFEC46D0 },
+    { 0xFCE0E8F8, 0xFB14BE0 },
+    { 0xF8752898, 0xE1C5970 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0xF1E3A690, 0x78AD768 },
+    { 0xF04EB410, 0x31F1704 },
+    { 0xF013B930, 0xFE6E8572 },
+    { 0xF137CA20, 0xF9E08758 },
+    { 0xF3A1BFB0, 0xF5D98680 },
+    { 0xF71C62A0, 0xF2B24CC0 },
+    { 0xFB5AFE98, 0xF0B05F50 },
+    { 0x10000000, 0x0 },
+    { 0xEC835E0, 0x61F78B0 },
+    { 0xB504F30, 0xB504F30 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x10000000, 0x0 },
+    { 0xB504F30, 0xB504F30 },
+    { 0xFFFFFFF5, 0x10000000 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0x10000000, 0x0 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0xF137CA20, 0xF9E08758 },
+    { 0x10000000, 0x0 },
+    { 0x10000000, 0x0 },
+    { 0x10000000, 0x0 },
+    { 0x3, 0xF0000000 }
+};
+
+complex_t cfft_tab_60[] =
+{
+    { 0x10000000, 0x0 },
+    { 0xFE98FD0, 0x1AC260A },
+    { 0xFA67E20, 0x3539B38 },
+    { 0xF378710, 0x4F1BBD0 },
+    { 0xE9DE1D0, 0x681FE48 },
+    { 0xDDB3D70, 0x8000000 },
+    { 0xCF1BBD0, 0x9679180 },
+    { 0xBE3EBD0, 0xAB4C250 },
+    { 0xAB4C240, 0xBE3EBE0 },
+    { 0x9679180, 0xCF1BBD0 },
+    { 0x7FFFFF8, 0xDDB3D80 },
+    { 0x681FE40, 0xE9DE1E0 },
+    { 0x4F1BBC8, 0xF378710 },
+    { 0x3539B2C, 0xFA67E20 },
+    { 0x1AC25FE, 0xFE98FD0 },
+    { 0xFFFFFFF5, 0x10000000 },
+    { 0xFE53D9EA, 0xFE98FD0 },
+    { 0xFCAC64BC, 0xFA67E10 },
+    { 0xFB0E4428, 0xF378700 },
+    { 0xF97E01A8, 0xE9DE1D0 },
+    { 0x10000000, 0x0 },
+    { 0xFA67E20, 0x3539B38 },
+    { 0xE9DE1D0, 0x681FE48 },
+    { 0xCF1BBD0, 0x9679180 },
+    { 0xAB4C240, 0xBE3EBE0 },
+    { 0x7FFFFF8, 0xDDB3D80 },
+    { 0x4F1BBC8, 0xF378710 },
+    { 0x1AC25FE, 0xFE98FD0 },
+    { 0xFE53D9EA, 0xFE98FD0 },
+    { 0xFB0E4428, 0xF378700 },
+    { 0xF7FFFFF0, 0xDDB3D70 },
+    { 0xF54B3DA0, 0xBE3EBD0 },
+    { 0xF30E4420, 0x9679170 },
+    { 0xF1621E20, 0x681FE38 },
+    { 0xF05981E0, 0x3539B20 },
+    { 0xF0000000, 0xFFFFFFE9 },
+    { 0xF05981F0, 0xFCAC64B0 },
+    { 0xF1621E30, 0xF97E01A0 },
+    { 0xF30E4440, 0xF6986E60 },
+    { 0xF54B3DD0, 0xF41C1420 },
+    { 0x10000000, 0x0 },
+    { 0xF378710, 0x4F1BBD0 },
+    { 0xCF1BBD0, 0x9679180 },
+    { 0x9679180, 0xCF1BBD0 },
+    { 0x4F1BBC8, 0xF378710 },
+    { 0x10000000, 0x0 },
+    { 0xCF1BBD0, 0x9679180 },
+    { 0x4F1BBC8, 0xF378710 },
+    { 0xFB0E4428, 0xF378700 },
+    { 0xF30E4420, 0x9679170 },
+    { 0x10000000, 0x0 },
+    { 0x9679180, 0xCF1BBD0 },
+    { 0xFB0E4428, 0xF378700 },
+    { 0xF0C878E0, 0x4F1BB98 },
+    { 0xF30E4440, 0xF6986E60 },
+    { 0x10000000, 0x0 },
+    { 0x10000000, 0x0 },
+    { 0x10000000, 0x0 },
+    { 0x10000000, 0x0 },
+    { 0x4F1BBF0, 0xF0C87900 }
+};
+
+#ifdef LD_DEC
+
+complex_t cfft_tab_256[] =
+{
+    { 0x10000000, 0x0 },
+    { 0xFFEC430, 0x648558 },
+    { 0xFFB10F0, 0xC8FB30 },
+    { 0xFF4E6D0, 0x12D520A },
+    { 0xFEC46D0, 0x1917A6C },
+    { 0xFE13240, 0x1F564E6 },
+    { 0xFD3AAC0, 0x259020C },
+    { 0xFC3B280, 0x2BC428C },
+    { 0xFB14BE0, 0x31F1708 },
+    { 0xF9C79D0, 0x381704C },
+    { 0xF853F80, 0x3E33F34 },
+    { 0xF6BA070, 0x44474A0 },
+    { 0xF4FA0B0, 0x4A50188 },
+    { 0xF314470, 0x504D728 },
+    { 0xF109080, 0x563E6A0 },
+    { 0xEED89E0, 0x5C22150 },
+    { 0xEC835E0, 0x61F78B0 },
+    { 0xEA09A60, 0x67BDE58 },
+    { 0xE76BD80, 0x6D74400 },
+    { 0xE4AA590, 0x7319BA8 },
+    { 0xE1C5970, 0x78AD750 },
+    { 0xDEBE050, 0x7E2E940 },
+    { 0xDB941A0, 0x839C3D0 },
+    { 0xD848530, 0x88F59B0 },
+    { 0xD4DB310, 0x8E39DA0 },
+    { 0xD14D3D0, 0x93682B0 },
+    { 0xCD9F020, 0x987FC00 },
+    { 0xC9D1120, 0x9D7FD20 },
+    { 0xC5E4030, 0xA2679A0 },
+    { 0xC1D8700, 0xA736560 },
+    { 0xBDAEF90, 0xABEB4A0 },
+    { 0xB968420, 0xB085BB0 },
+    { 0xB504F30, 0xB504F30 },
+    { 0xB085BA0, 0xB968420 },
+    { 0xABEB490, 0xBDAEFA0 },
+    { 0xA736550, 0xC1D8710 },
+    { 0xA267990, 0xC5E4030 },
+    { 0x9D7FD10, 0xC9D1120 },
+    { 0x987FC00, 0xCD9F020 },
+    { 0x93682A0, 0xD14D3D0 },
+    { 0x8E39D90, 0xD4DB320 },
+    { 0x88F59B0, 0xD848530 },
+    { 0x839C3C0, 0xDB941B0 },
+    { 0x7E2E938, 0xDEBE050 },
+    { 0x78AD738, 0xE1C5980 },
+    { 0x7319BA0, 0xE4AA590 },
+    { 0x6D74408, 0xE76BD80 },
+    { 0x67BDE48, 0xEA09A70 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x5C22138, 0xEED89E0 },
+    { 0x563E698, 0xF109080 },
+    { 0x504D710, 0xF314480 },
+    { 0x4A50180, 0xF4FA0B0 },
+    { 0x4447498, 0xF6BA070 },
+    { 0x3E33F20, 0xF853F80 },
+    { 0x3817048, 0xF9C79D0 },
+    { 0x31F16F0, 0xFB14BF0 },
+    { 0x2BC4280, 0xFC3B280 },
+    { 0x2590214, 0xFD3AAC0 },
+    { 0x1F564D8, 0xFE13240 },
+    { 0x1917A6A, 0xFEC46D0 },
+    { 0x12D51F6, 0xFF4E6D0 },
+    { 0xC8FB29, 0xFFB10F0 },
+    { 0x64853F, 0xFFEC430 },
+    { 0x10000000, 0x0 },
+    { 0xFFB10F0, 0xC8FB30 },
+    { 0xFEC46D0, 0x1917A6C },
+    { 0xFD3AAC0, 0x259020C },
+    { 0xFB14BE0, 0x31F1708 },
+    { 0xF853F80, 0x3E33F34 },
+    { 0xF4FA0B0, 0x4A50188 },
+    { 0xF109080, 0x563E6A0 },
+    { 0xEC835E0, 0x61F78B0 },
+    { 0xE76BD80, 0x6D74400 },
+    { 0xE1C5970, 0x78AD750 },
+    { 0xDB941A0, 0x839C3D0 },
+    { 0xD4DB310, 0x8E39DA0 },
+    { 0xCD9F020, 0x987FC00 },
+    { 0xC5E4030, 0xA2679A0 },
+    { 0xBDAEF90, 0xABEB4A0 },
+    { 0xB504F30, 0xB504F30 },
+    { 0xABEB490, 0xBDAEFA0 },
+    { 0xA267990, 0xC5E4030 },
+    { 0x987FC00, 0xCD9F020 },
+    { 0x8E39D90, 0xD4DB320 },
+    { 0x839C3C0, 0xDB941B0 },
+    { 0x78AD738, 0xE1C5980 },
+    { 0x6D74408, 0xE76BD80 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x563E698, 0xF109080 },
+    { 0x4A50180, 0xF4FA0B0 },
+    { 0x3E33F20, 0xF853F80 },
+    { 0x31F16F0, 0xFB14BF0 },
+    { 0x2590214, 0xFD3AAC0 },
+    { 0x1917A6A, 0xFEC46D0 },
+    { 0xC8FB29, 0xFFB10F0 },
+    { 0xFFFFFFF5, 0x10000000 },
+    { 0xFF3704BF, 0xFFB10F0 },
+    { 0xFE6E857E, 0xFEC46D0 },
+    { 0xFDA6FDD8, 0xFD3AAC0 },
+    { 0xFCE0E8F8, 0xFB14BE0 },
+    { 0xFC1CC0CC, 0xF853F80 },
+    { 0xFB5AFE68, 0xF4FA0A0 },
+    { 0xFA9C1950, 0xF109080 },
+    { 0xF9E08740, 0xEC835E0 },
+    { 0xF928BC00, 0xE76BD80 },
+    { 0xF8752898, 0xE1C5970 },
+    { 0xF7C63C30, 0xDB941A0 },
+    { 0xF71C6240, 0xD4DB300 },
+    { 0xF67803F0, 0xCD9F020 },
+    { 0xF5D98670, 0xC5E4040 },
+    { 0xF5414B50, 0xBDAEF80 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0xF4251050, 0xABEB480 },
+    { 0xF3A1BFC0, 0xA267990 },
+    { 0xF3260FC0, 0x987FBD0 },
+    { 0xF2B24CE0, 0x8E39D90 },
+    { 0xF246BE60, 0x839C3D0 },
+    { 0xF1E3A670, 0x78AD730 },
+    { 0xF1894280, 0x6D743F8 },
+    { 0xF137CA00, 0x61F7880 },
+    { 0xF0EF6F70, 0x563E690 },
+    { 0xF0B05F50, 0x4A50198 },
+    { 0xF07AC080, 0x3E33F14 },
+    { 0xF04EB410, 0x31F1704 },
+    { 0xF02C5540, 0x25901E8 },
+    { 0xF013B930, 0x1917A60 },
+    { 0xF004EF10, 0xC8FAFD },
+    { 0x10000000, 0x0 },
+    { 0xFF4E6D0, 0x12D520A },
+    { 0xFD3AAC0, 0x259020C },
+    { 0xF9C79D0, 0x381704C },
+    { 0xF4FA0B0, 0x4A50188 },
+    { 0xEED89E0, 0x5C22150 },
+    { 0xE76BD80, 0x6D74400 },
+    { 0xDEBE050, 0x7E2E940 },
+    { 0xD4DB310, 0x8E39DA0 },
+    { 0xC9D1130, 0x9D7FD10 },
+    { 0xBDAEF90, 0xABEB4A0 },
+    { 0xB085BA0, 0xB968420 },
+    { 0xA267990, 0xC5E4030 },
+    { 0x93682B0, 0xD14D3D0 },
+    { 0x839C3C0, 0xDB941B0 },
+    { 0x7319BA0, 0xE4AA590 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x504D728, 0xF314470 },
+    { 0x3E33F40, 0xF853F80 },
+    { 0x2BC4280, 0xFC3B280 },
+    { 0x1917A6A, 0xFEC46D0 },
+    { 0x64855F, 0xFFEC430 },
+    { 0xFF3704BF, 0xFFB10F0 },
+    { 0xFE0A9B12, 0xFE13230 },
+    { 0xFCE0E8F8, 0xFB14BE0 },
+    { 0xFBBB8B70, 0xF6BA070 },
+    { 0xFA9C1970, 0xF109080 },
+    { 0xF98421A8, 0xEA09A60 },
+    { 0xF8752898, 0xE1C5970 },
+    { 0xF770A640, 0xD848520 },
+    { 0xF67803F0, 0xCD9F020 },
+    { 0xF58C9AA0, 0xC1D8700 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0xF3E27900, 0xA736560 },
+    { 0xF3260FE0, 0x987FC10 },
+    { 0xF27B7AE0, 0x88F59C0 },
+    { 0xF1E3A690, 0x78AD768 },
+    { 0xF15F6590, 0x67BDE38 },
+    { 0xF0EF6F70, 0x563E690 },
+    { 0xF0945F90, 0x4447490 },
+    { 0xF04EB410, 0x31F1704 },
+    { 0xF01ECDD0, 0x1F564EC },
+    { 0xF004EF10, 0xC8FB3D },
+    { 0xF0013BD0, 0xFF9B7ABE },
+    { 0xF013B930, 0xFE6E8572 },
+    { 0xF03C4D80, 0xFD43BD5C },
+    { 0xF07AC080, 0xFC1CC0C0 },
+    { 0xF0CEBB90, 0xFAFB28D0 },
+    { 0xF137CA20, 0xF9E08758 },
+    { 0xF1B55A70, 0xF8CE6460 },
+    { 0xF246BE50, 0xF7C63C40 },
+    { 0xF2EB2C20, 0xF6C97D70 },
+    { 0xF3A1BFB0, 0xF5D98680 },
+    { 0xF4697BF0, 0xF4F7A440 },
+    { 0xF5414B70, 0xF4251060 },
+    { 0xF62802F0, 0xF362EED0 },
+    { 0xF71C62A0, 0xF2B24CC0 },
+    { 0xF81D16C8, 0xF2141FB0 },
+    { 0xF928BC28, 0xF1894270 },
+    { 0xFA3DDEA0, 0xF1127630 },
+    { 0xFB5AFE98, 0xF0B05F50 },
+    { 0xFC7E8F90, 0xF0638630 },
+    { 0xFDA6FE04, 0xF02C5540 },
+    { 0xFED2ADC2, 0xF00B1930 },
+    { 0x10000000, 0x0 },
+    { 0xFEC46D0, 0x1917A6C },
+    { 0xFB14BE0, 0x31F1708 },
+    { 0xF4FA0B0, 0x4A50188 },
+    { 0xEC835E0, 0x61F78B0 },
+    { 0xE1C5970, 0x78AD750 },
+    { 0xD4DB310, 0x8E39DA0 },
+    { 0xC5E4030, 0xA2679A0 },
+    { 0xB504F30, 0xB504F30 },
+    { 0xA267990, 0xC5E4030 },
+    { 0x8E39D90, 0xD4DB320 },
+    { 0x78AD738, 0xE1C5980 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x4A50180, 0xF4FA0B0 },
+    { 0x31F16F0, 0xFB14BF0 },
+    { 0x1917A6A, 0xFEC46D0 },
+    { 0x10000000, 0x0 },
+    { 0xFB14BE0, 0x31F1708 },
+    { 0xEC835E0, 0x61F78B0 },
+    { 0xD4DB310, 0x8E39DA0 },
+    { 0xB504F30, 0xB504F30 },
+    { 0x8E39D90, 0xD4DB320 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x31F16F0, 0xFB14BF0 },
+    { 0xFFFFFFF5, 0x10000000 },
+    { 0xFCE0E8F8, 0xFB14BE0 },
+    { 0xF9E08740, 0xEC835E0 },
+    { 0xF71C6240, 0xD4DB300 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0xF2B24CE0, 0x8E39D90 },
+    { 0xF137CA00, 0x61F7880 },
+    { 0xF04EB410, 0x31F1704 },
+    { 0x10000000, 0x0 },
+    { 0xF4FA0B0, 0x4A50188 },
+    { 0xD4DB310, 0x8E39DA0 },
+    { 0xA267990, 0xC5E4030 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x1917A6A, 0xFEC46D0 },
+    { 0xFCE0E8F8, 0xFB14BE0 },
+    { 0xF8752898, 0xE1C5970 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0xF1E3A690, 0x78AD768 },
+    { 0xF04EB410, 0x31F1704 },
+    { 0xF013B930, 0xFE6E8572 },
+    { 0xF137CA20, 0xF9E08758 },
+    { 0xF3A1BFB0, 0xF5D98680 },
+    { 0xF71C62A0, 0xF2B24CC0 },
+    { 0xFB5AFE98, 0xF0B05F50 },
+    { 0x10000000, 0x0 },
+    { 0xEC835E0, 0x61F78B0 },
+    { 0xB504F30, 0xB504F30 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x10000000, 0x0 },
+    { 0xB504F30, 0xB504F30 },
+    { 0xFFFFFFF5, 0x10000000 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0x10000000, 0x0 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0xF137CA20, 0xF9E08758 },
+    { 0x10000000, 0x0 },
+    { 0x10000000, 0x0 },
+    { 0x10000000, 0x0 },
+    { 0x3, 0xF0000000 }
+};
+
+complex_t cfft_tab_240[] =
+{
+    { 0x10000000, 0x0 },
+    { 0xFFE98B0, 0x6B3885 },
+    { 0xFFA62F0, 0xD65E3B },
+    { 0xFF35F90, 0x1415E54 },
+    { 0xFE98FD0, 0x1AC260A },
+    { 0xFDCF550, 0x216A2A4 },
+    { 0xFCD9250, 0x280C170 },
+    { 0xFBB6980, 0x2EA6FCC },
+    { 0xFA67E20, 0x3539B38 },
+    { 0xF8ED3C0, 0x3BC3138 },
+    { 0xF746EA0, 0x4241F70 },
+    { 0xF575360, 0x48B53B0 },
+    { 0xF378710, 0x4F1BBD0 },
+    { 0xF150F40, 0x55745E0 },
+    { 0xEEFF200, 0x5BBE008 },
+    { 0xEC835E0, 0x61F78B0 },
+    { 0xE9DE1D0, 0x681FE48 },
+    { 0xE70FD40, 0x6E35FA0 },
+    { 0xE419010, 0x7438B90 },
+    { 0xE0FA280, 0x7A27140 },
+    { 0xDDB3D70, 0x8000000 },
+    { 0xDA46A00, 0x85C2770 },
+    { 0xD6B31D0, 0x8B6D770 },
+    { 0xD2F9EF0, 0x9100000 },
+    { 0xCF1BBD0, 0x9679180 },
+    { 0xCB19340, 0x9BD7CA0 },
+    { 0xC6F3090, 0xA11B240 },
+    { 0xC2A9F70, 0xA6423B0 },
+    { 0xBE3EBD0, 0xAB4C250 },
+    { 0xB9B2230, 0xB038010 },
+    { 0xB504F30, 0xB504F30 },
+    { 0xB038010, 0xB9B2230 },
+    { 0xAB4C240, 0xBE3EBE0 },
+    { 0xA6423A0, 0xC2A9F70 },
+    { 0xA11B240, 0xC6F30A0 },
+    { 0x9BD7C90, 0xCB19350 },
+    { 0x9679180, 0xCF1BBD0 },
+    { 0x9100000, 0xD2F9EF0 },
+    { 0x8B6D760, 0xD6B31E0 },
+    { 0x85C2760, 0xDA46A10 },
+    { 0x7FFFFF8, 0xDDB3D80 },
+    { 0x7A27138, 0xE0FA290 },
+    { 0x7438B90, 0xE419010 },
+    { 0x6E35F88, 0xE70FD50 },
+    { 0x681FE40, 0xE9DE1E0 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x5BBDFF0, 0xEEFF210 },
+    { 0x55745D0, 0xF150F40 },
+    { 0x4F1BBC8, 0xF378710 },
+    { 0x48B53A8, 0xF575360 },
+    { 0x4241F78, 0xF746EA0 },
+    { 0x3BC3124, 0xF8ED3C0 },
+    { 0x3539B2C, 0xFA67E20 },
+    { 0x2EA6FCC, 0xFBB6980 },
+    { 0x280C154, 0xFCD9250 },
+    { 0x216A290, 0xFDCF550 },
+    { 0x1AC25FE, 0xFE98FD0 },
+    { 0x1415E50, 0xFF35F90 },
+    { 0xD65E3F, 0xFFA62F0 },
+    { 0x6B3871, 0xFFE98B0 },
+    { 0xFFFFFFF5, 0x10000000 },
+    { 0xFF94C777, 0xFFE98B0 },
+    { 0xFF29A1AA, 0xFFA62F0 },
+    { 0xFEBEA198, 0xFF35F90 },
+    { 0xFE53D9EA, 0xFE98FD0 },
+    { 0xFDE95D58, 0xFDCF550 },
+    { 0xFD7F3E98, 0xFCD9250 },
+    { 0xFD159020, 0xFBB6980 },
+    { 0xFCAC64BC, 0xFA67E10 },
+    { 0xFC43CEC4, 0xF8ED3C0 },
+    { 0xFBDBE070, 0xF746EA0 },
+    { 0xFB74AC40, 0xF575350 },
+    { 0xFB0E4428, 0xF378700 },
+    { 0xFAA8BA20, 0xF150F40 },
+    { 0xFA441FF8, 0xEEFF210 },
+    { 0xF9E08740, 0xEC835E0 },
+    { 0xF97E01A8, 0xE9DE1D0 },
+    { 0xF91CA060, 0xE70FD40 },
+    { 0xF8BC7458, 0xE419000 },
+    { 0xF85D8ED0, 0xE0FA290 },
+    { 0x10000000, 0x0 },
+    { 0xFFA62F0, 0xD65E3B },
+    { 0xFE98FD0, 0x1AC260A },
+    { 0xFCD9250, 0x280C170 },
+    { 0xFA67E20, 0x3539B38 },
+    { 0xF746EA0, 0x4241F70 },
+    { 0xF378710, 0x4F1BBD0 },
+    { 0xEEFF200, 0x5BBE008 },
+    { 0xE9DE1D0, 0x681FE48 },
+    { 0xE419010, 0x7438B90 },
+    { 0xDDB3D70, 0x8000000 },
+    { 0xD6B31D0, 0x8B6D770 },
+    { 0xCF1BBD0, 0x9679180 },
+    { 0xC6F3090, 0xA11B240 },
+    { 0xBE3EBD0, 0xAB4C250 },
+    { 0xB504F30, 0xB504F30 },
+    { 0xAB4C240, 0xBE3EBE0 },
+    { 0xA11B240, 0xC6F30A0 },
+    { 0x9679180, 0xCF1BBD0 },
+    { 0x8B6D760, 0xD6B31E0 },
+    { 0x7FFFFF8, 0xDDB3D80 },
+    { 0x7438B90, 0xE419010 },
+    { 0x681FE40, 0xE9DE1E0 },
+    { 0x5BBDFF0, 0xEEFF210 },
+    { 0x4F1BBC8, 0xF378710 },
+    { 0x4241F78, 0xF746EA0 },
+    { 0x3539B2C, 0xFA67E20 },
+    { 0x280C154, 0xFCD9250 },
+    { 0x1AC25FE, 0xFE98FD0 },
+    { 0xD65E3F, 0xFFA62F0 },
+    { 0xFFFFFFF5, 0x10000000 },
+    { 0xFF29A1AA, 0xFFA62F0 },
+    { 0xFE53D9EA, 0xFE98FD0 },
+    { 0xFD7F3E98, 0xFCD9250 },
+    { 0xFCAC64BC, 0xFA67E10 },
+    { 0xFBDBE070, 0xF746EA0 },
+    { 0xFB0E4428, 0xF378700 },
+    { 0xFA441FF8, 0xEEFF210 },
+    { 0xF97E01A8, 0xE9DE1D0 },
+    { 0xF8BC7458, 0xE419000 },
+    { 0xF7FFFFF0, 0xDDB3D70 },
+    { 0xF7492890, 0xD6B31D0 },
+    { 0xF6986E90, 0xCF1BBD0 },
+    { 0xF5EE4DA0, 0xC6F3080 },
+    { 0xF54B3DA0, 0xBE3EBD0 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0xF41C1410, 0xAB4C220 },
+    { 0xF390CF50, 0xA11B220 },
+    { 0xF30E4420, 0x9679170 },
+    { 0xF294CE30, 0x8B6D770 },
+    { 0xF224C290, 0x8000010 },
+    { 0xF1BE6FE0, 0x7438B68 },
+    { 0xF1621E20, 0x681FE38 },
+    { 0xF1100DF0, 0x5BBE000 },
+    { 0xF0C878E0, 0x4F1BB98 },
+    { 0xF08B9150, 0x4241F50 },
+    { 0xF05981E0, 0x3539B20 },
+    { 0xF0326DB0, 0x280C168 },
+    { 0xF0167030, 0x1AC2612 },
+    { 0xF0059D00, 0xD65E13 },
+    { 0xF0000000, 0xFFFFFFE9 },
+    { 0xF0059D10, 0xFF29A1BE },
+    { 0xF0167040, 0xFE53D9BE },
+    { 0xF0326DC0, 0xFD7F3E6C },
+    { 0xF05981F0, 0xFCAC64B0 },
+    { 0xF08B9160, 0xFBDBE088 },
+    { 0xF0C878F0, 0xFB0E4438 },
+    { 0xF1100E00, 0xFA441FD0 },
+    { 0xF1621E30, 0xF97E01A0 },
+    { 0xF1BE6FF0, 0xF8BC7468 },
+    { 0xF224C2B0, 0xF7FFFFD0 },
+    { 0xF294CE40, 0xF7492870 },
+    { 0xF30E4440, 0xF6986E60 },
+    { 0xF390CF70, 0xF5EE4DB0 },
+    { 0xF41C1430, 0xF54B3DB0 },
+    { 0xF4AFB0F0, 0xF4AFB0B0 },
+    { 0xF54B3DD0, 0xF41C1420 },
+    { 0xF5EE4DD0, 0xF390CF60 },
+    { 0xF6986EB0, 0xF30E4410 },
+    { 0xF7492880, 0xF294CE30 },
+    { 0x10000000, 0x0 },
+    { 0xFF35F90, 0x1415E54 },
+    { 0xFCD9250, 0x280C170 },
+    { 0xF8ED3C0, 0x3BC3138 },
+    { 0xF378710, 0x4F1BBD0 },
+    { 0xEC835E0, 0x61F78B0 },
+    { 0xE419010, 0x7438B90 },
+    { 0xDA46A00, 0x85C2770 },
+    { 0xCF1BBD0, 0x9679180 },
+    { 0xC2A9F70, 0xA6423B0 },
+    { 0xB504F30, 0xB504F30 },
+    { 0xA6423A0, 0xC2A9F70 },
+    { 0x9679180, 0xCF1BBD0 },
+    { 0x85C2760, 0xDA46A10 },
+    { 0x7438B90, 0xE419010 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x4F1BBC8, 0xF378710 },
+    { 0x3BC3124, 0xF8ED3C0 },
+    { 0x280C154, 0xFCD9250 },
+    { 0x1415E50, 0xFF35F90 },
+    { 0x10000000, 0x0 },
+    { 0xFCD9250, 0x280C170 },
+    { 0xF378710, 0x4F1BBD0 },
+    { 0xE419010, 0x7438B90 },
+    { 0xCF1BBD0, 0x9679180 },
+    { 0xB504F30, 0xB504F30 },
+    { 0x9679180, 0xCF1BBD0 },
+    { 0x7438B90, 0xE419010 },
+    { 0x4F1BBC8, 0xF378710 },
+    { 0x280C154, 0xFCD9250 },
+    { 0xFFFFFFF5, 0x10000000 },
+    { 0xFD7F3E98, 0xFCD9250 },
+    { 0xFB0E4428, 0xF378700 },
+    { 0xF8BC7458, 0xE419000 },
+    { 0xF6986E90, 0xCF1BBD0 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0xF30E4420, 0x9679170 },
+    { 0xF1BE6FE0, 0x7438B68 },
+    { 0xF0C878E0, 0x4F1BB98 },
+    { 0xF0326DB0, 0x280C168 },
+    { 0x10000000, 0x0 },
+    { 0xF8ED3C0, 0x3BC3138 },
+    { 0xE419010, 0x7438B90 },
+    { 0xC2A9F70, 0xA6423B0 },
+    { 0x9679180, 0xCF1BBD0 },
+    { 0x61F78A8, 0xEC835E0 },
+    { 0x280C154, 0xFCD9250 },
+    { 0xFEBEA198, 0xFF35F90 },
+    { 0xFB0E4428, 0xF378700 },
+    { 0xF7A3D870, 0xDA469F0 },
+    { 0xF4AFB0D0, 0xB504F30 },
+    { 0xF25B95F0, 0x85C2760 },
+    { 0xF0C878E0, 0x4F1BB98 },
+    { 0xF00CA060, 0x1415E44 },
+    { 0xF0326DC0, 0xFD7F3E6C },
+    { 0xF137CA20, 0xF9E08758 },
+    { 0xF30E4440, 0xF6986E60 },
+    { 0xF59BDC80, 0xF3D56070 },
+    { 0xF8BC74C0, 0xF1BE6FD0 },
+    { 0xFC43CEB4, 0xF0712C40 },
+    { 0x10000000, 0x0 },
+    { 0xF378710, 0x4F1BBD0 },
+    { 0xCF1BBD0, 0x9679180 },
+    { 0x9679180, 0xCF1BBD0 },
+    { 0x4F1BBC8, 0xF378710 },
+    { 0x10000000, 0x0 },
+    { 0xCF1BBD0, 0x9679180 },
+    { 0x4F1BBC8, 0xF378710 },
+    { 0xFB0E4428, 0xF378700 },
+    { 0xF30E4420, 0x9679170 },
+    { 0x10000000, 0x0 },
+    { 0x9679180, 0xCF1BBD0 },
+    { 0xFB0E4428, 0xF378700 },
+    { 0xF0C878E0, 0x4F1BB98 },
+    { 0xF30E4440, 0xF6986E60 },
+    { 0x10000000, 0x0 },
+    { 0x10000000, 0x0 },
+    { 0x10000000, 0x0 },
+    { 0x10000000, 0x0 },
+    { 0x4F1BBF0, 0xF0C87900 }
+};
+
+#endif
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/codebook/hcb.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,142 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb.h,v 1.5 2003/07/29 08:20:14 menno Exp $
+**/
+
+#ifndef __HCB_H__
+#define __HCB_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ *  Optimal huffman decoding for AAC taken from:
+ *  "SELECTING AN OPTIMAL HUFFMAN DECODER FOR AAC" by
+ *  VLADIMIR Z. MESAROVIC , RAGHUNATH RAO, MIROSLAV V. DOKIC, and SACHIN DEO
+ *  AES paper 5436
+ *
+ *   2 methods are used for huffman decoding:
+ *   - binary search
+ *   - 2-step table lookup
+ *
+ *   The choice of the "optimal" method is based on the fact that if the
+ *   memory size for the Two-step is exorbitantly high then the decision
+ *   is Binary search for that codebook. However, for marginally more memory
+ *   size, if Twostep outperforms even the best case of Binary then the
+ *   decision is Two-step for that codebook.
+ *
+ *   The following methods are used for the different tables.
+ *   codebook   "optimal" method
+ *    HCB_1      2-Step
+ *    HCB_2      2-Step
+ *    HCB_3      Binary
+ *    HCB_4      2-Step
+ *    HCB_5      Binary
+ *    HCB_6      2-Step
+ *    HCB_7      Binary
+ *    HCB_8      2-Step
+ *    HCB_9      Binary
+ *    HCB_10     2-Step
+ *    HCB_11     2-Step
+ *    HCB_SF     Binary
+ *
+ */
+
+
+#define ZERO_HCB       0
+#define FIRST_PAIR_HCB 5
+#define ESC_HCB        11
+#define QUAD_LEN       4
+#define PAIR_LEN       2
+#define NOISE_HCB      13
+#define INTENSITY_HCB2 14
+#define INTENSITY_HCB  15
+
+/* 1st step table */
+typedef struct
+{
+    uint8_t offset;
+    uint8_t extra_bits;
+} hcb;
+
+/* 2nd step table with quadruple data */
+typedef struct
+{
+    uint8_t bits;
+    int8_t x;
+    int8_t y;
+} hcb_2_pair;
+
+typedef struct
+{
+    uint8_t bits;
+    int8_t x;
+    int8_t y;
+    int8_t v;
+    int8_t w;
+} hcb_2_quad;
+
+/* binary search table */
+typedef struct
+{
+    uint8_t is_leaf;
+    int8_t data[4];
+} hcb_bin_quad;
+
+typedef struct
+{
+    uint8_t is_leaf;
+    int8_t data[2];
+} hcb_bin_pair;
+
+hcb *hcb_table[];
+hcb_2_quad *hcb_2_quad_table[];
+hcb_2_pair *hcb_2_pair_table[];
+hcb_bin_pair *hcb_bin_table[];
+uint8_t hcbN[];
+uint8_t unsigned_cb[];
+int hcb_2_quad_table_size[];
+int hcb_2_pair_table_size[];
+int hcb_bin_table_size[];
+
+#include "codebook/hcb_1.h"
+#include "codebook/hcb_2.h"
+#include "codebook/hcb_3.h"
+#include "codebook/hcb_4.h"
+#include "codebook/hcb_5.h"
+#include "codebook/hcb_6.h"
+#include "codebook/hcb_7.h"
+#include "codebook/hcb_8.h"
+#include "codebook/hcb_9.h"
+#include "codebook/hcb_10.h"
+#include "codebook/hcb_11.h"
+#include "codebook/hcb_sf.h"
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/codebook/hcb_1.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,183 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_1.h,v 1.2 2003/07/29 08:20:14 menno Exp $
+**/
+
+/* 2-step huffman table HCB_1 */
+
+
+/* 1st step: 5 bits
+ *           2^5 = 32 entries
+ *
+ * Used to find offset into 2nd step table and number of extra bits to get
+ */
+static hcb hcb1_1[] = {
+    { /* 00000 */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /* 10000 */ 1, 0 },
+    { /* 10001 */ 2, 0 },
+    { /* 10010 */ 3, 0 },
+    { /* 10011 */ 4, 0 },
+    { /* 10100 */ 5, 0 },
+    { /* 10101 */ 6, 0 },
+    { /* 10110 */ 7, 0 },
+    { /* 10111 */ 8, 0 },
+
+    /* 7 bit codewords */
+    { /* 11000 */ 9,  2 },
+    { /* 11001 */ 13, 2 },
+    { /* 11010 */ 17, 2 },
+    { /* 11011 */ 21, 2 },
+    { /* 11100 */ 25, 2 },
+    { /* 11101 */ 29, 2 },
+
+    /* 9 bit codewords */
+    { /* 11110 */ 33, 4 },
+
+    /* 9/10/11 bit codewords */
+    { /* 11111 */ 49, 6 }
+};
+
+/* 2nd step table
+ *
+ * Gives size of codeword and actual data (x,y,v,w)
+ */
+static hcb_2_quad hcb1_2[] = {
+    /* 1 bit codeword */
+    { 1,  0,  0,  0,  0 },
+
+    /* 5 bit codewords */
+    { 5,  1,  0,  0,  0 },
+    { 5, -1,  0,  0,  0 },
+    { 5,  0,  0,  0, -1 },
+    { 5,  0,  1,  0,  0 },
+    { 5,  0,  0,  0,  1 },
+    { 5,  0,  0, -1,  0 },
+    { 5,  0,  0,  1,  0 },
+    { 5,  0, -1,  0,  0 },
+
+    /* 7 bit codewords */
+    /* first 5 bits: 11000 */
+    { 7,  1, -1,  0,  0 },
+    { 7, -1,  1,  0,  0 },
+    { 7,  0,  0, -1,  1 },
+    { 7,  0,  1, -1,  0 },
+    /* first 5 bits: 11001 */
+    { 7,  0, -1,  1,  0 },
+    { 7,  0,  0,  1, -1 },
+    { 7,  1,  1,  0,  0 },
+    { 7,  0,  0, -1, -1 },
+    /* first 5 bits: 11010 */
+    { 7, -1, -1,  0,  0 },
+    { 7,  0, -1, -1,  0 },
+    { 7,  1,  0, -1,  0 },
+    { 7,  0,  1,  0, -1 },
+    /* first 5 bits: 11011 */
+    { 7, -1,  0,  1,  0 },
+    { 7,  0,  0,  1,  1 },
+    { 7,  1,  0,  1,  0 },
+    { 7,  0, -1,  0,  1 },
+    /* first 5 bits: 11100 */
+    { 7,  0,  1,  1,  0 },
+    { 7,  0,  1,  0,  1 },
+    { 7, -1,  0, -1,  0 },
+    { 7,  1,  0,  0,  1 },
+    /* first 5 bits: 11101 */
+    { 7, -1,  0,  0, -1 },
+    { 7,  1,  0,  0, -1 },
+    { 7, -1,  0,  0,  1 },
+    { 7,  0, -1,  0, -1 },
+
+    /* 9 bit codeword */
+    /* first 5 bits: 11110 */
+    { 9,  1,  1, -1,  0 },
+    { 9, -1,  1, -1,  0 },
+    { 9,  1, -1,  1,  0 },
+    { 9,  0,  1,  1, -1 },
+    { 9,  0,  1, -1,  1 },
+    { 9,  0, -1,  1,  1 },
+    { 9,  0, -1,  1, -1 },
+    { 9,  1, -1, -1,  0 },
+    { 9,  1,  0, -1,  1 },
+    { 9,  0,  1, -1, -1 },
+    { 9, -1,  1,  1,  0 },
+    { 9, -1,  0,  1, -1 },
+    { 9, -1, -1,  1,  0 },
+    { 9,  0, -1, -1,  1 },
+    { 9,  1, -1,  0,  1 },
+    { 9,  1, -1,  0, -1 },
+
+    /* 9/10/11 bit codewords */
+    /* first 5 bits: 11111 */
+    /* 9 bit: reading 11 bits -> 2 too much so 4 entries for each codeword */
+    { 9, -1,  1,  0, -1 }, { 9, -1,  1,  0, -1 }, { 9, -1,  1,  0, -1 }, { 9, -1,  1,  0, -1 },
+    { 9, -1, -1, -1,  0 }, { 9, -1, -1, -1,  0 }, { 9, -1, -1, -1,  0 }, { 9, -1, -1, -1,  0 },
+    { 9,  0, -1, -1, -1 }, { 9,  0, -1, -1, -1 }, { 9,  0, -1, -1, -1 }, { 9,  0, -1, -1, -1 },
+    { 9,  0,  1,  1,  1 }, { 9,  0,  1,  1,  1 }, { 9,  0,  1,  1,  1 }, { 9,  0,  1,  1,  1 },
+    { 9,  1,  0,  1, -1 }, { 9,  1,  0,  1, -1 }, { 9,  1,  0,  1, -1 }, { 9,  1,  0,  1, -1 },
+    { 9,  1,  1,  0,  1 }, { 9,  1,  1,  0,  1 }, { 9,  1,  1,  0,  1 }, { 9,  1,  1,  0,  1 },
+    { 9, -1,  1,  0,  1 }, { 9, -1,  1,  0,  1 }, { 9, -1,  1,  0,  1 }, { 9, -1,  1,  0,  1 },
+    { 9,  1,  1,  1,  0 }, { 9,  1,  1,  1,  0 }, { 9,  1,  1,  1,  0 }, { 9,  1,  1,  1,  0 },
+    /* 10 bit: reading 11 bits -> 1 too much so 2 entries for each codeword */
+    { 10, -1, -1,  0,  1 }, { 10, -1, -1,  0,  1 },
+    { 10, -1,  0, -1, -1 }, { 10, -1,  0, -1, -1 },
+    { 10,  1,  1,  0, -1 }, { 10,  1,  1,  0, -1 },
+    { 10,  1,  0, -1, -1 }, { 10,  1,  0, -1, -1 },
+    { 10, -1,  0, -1,  1 }, { 10, -1,  0, -1,  1 },
+    { 10, -1, -1,  0, -1 }, { 10, -1, -1,  0, -1 },
+    { 10, -1,  0,  1,  1 }, { 10, -1,  0,  1,  1 },
+    { 10,  1,  0,  1,  1 }, { 10,  1,  0,  1,  1 },
+    /* 11 bit */
+    { 11,  1, -1,  1, -1 },
+    { 11, -1,  1, -1,  1 },
+    { 11, -1,  1,  1, -1 },
+    { 11,  1, -1, -1,  1 },
+    { 11,  1,  1,  1,  1 },
+    { 11, -1, -1,  1,  1 },
+    { 11,  1,  1, -1, -1 },
+    { 11, -1, -1,  1, -1 },
+    { 11, -1, -1, -1, -1 },
+    { 11,  1,  1, -1,  1 },
+    { 11,  1, -1,  1,  1 },
+    { 11, -1,  1,  1,  1 },
+    { 11, -1,  1, -1, -1 },
+    { 11, -1, -1, -1,  1 },
+    { 11,  1, -1, -1, -1 },
+    { 11,  1,  1,  1, -1 }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/codebook/hcb_10.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,309 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_10.h,v 1.2 2003/07/29 08:20:14 menno Exp $
+**/
+
+/* 2-step huffman table HCB_10 */
+
+
+/* 1st step: 6 bits
+ *           2^6 = 64 entries
+ *
+ * Used to find offset into 2nd step table and number of extra bits to get
+ */
+static hcb hcb10_1[] = {
+    /* 4 bit codewords */
+    { /* 000000 */ 0, 0 },
+    { /*        */ 0, 0 },
+    { /*        */ 0, 0 },
+    { /*        */ 0, 0 },
+    { /* 000100 */ 1, 0 },
+    { /*        */ 1, 0 },
+    { /*        */ 1, 0 },
+    { /*        */ 1, 0 },
+    { /* 001000 */ 2, 0 },
+    { /*        */ 2, 0 },
+    { /*        */ 2, 0 },
+    { /*        */ 2, 0 },
+    /* 5 bit codewords */
+    { /* 001100 */ 3, 0 },
+    { /*        */ 3, 0 },
+    { /* 001110 */ 4, 0 },
+    { /*        */ 4, 0 },
+    { /* 010000 */ 5, 0 },
+    { /*        */ 5, 0 },
+    { /* 010010 */ 6, 0 },
+    { /*        */ 6, 0 },
+    { /* 010100 */ 7, 0 },
+    { /*        */ 7, 0 },
+    { /* 010110 */ 8, 0 },
+    { /*        */ 8, 0 },
+    { /* 011000 */ 9, 0 },
+    { /*        */ 9, 0 },
+    { /* 011010 */ 10, 0 },
+    { /*        */ 10, 0 },
+    /* 6 bit codewords */
+    { /* 011100 */ 11, 0 },
+    { /* 011101 */ 12, 0 },
+    { /* 011110 */ 13, 0 },
+    { /* 011111 */ 14, 0 },
+    { /* 100000 */ 15, 0 },
+    { /* 100001 */ 16, 0 },
+    { /* 100010 */ 17, 0 },
+    { /* 100011 */ 18, 0 },
+    { /* 100100 */ 19, 0 },
+    { /* 100101 */ 20, 0 },
+    { /* 100110 */ 21, 0 },
+    { /* 100111 */ 22, 0 },
+    { /* 101000 */ 23, 0 },
+    { /* 101001 */ 24, 0 },
+    /* 7 bit codewords */
+    { /* 101010 */ 25, 1 },
+    { /* 101011 */ 27, 1 },
+    { /* 101100 */ 29, 1 },
+    { /* 101101 */ 31, 1 },
+    { /* 101110 */ 33, 1 },
+    { /* 101111 */ 35, 1 },
+    { /* 110000 */ 37, 1 },
+    { /* 110001 */ 39, 1 },
+    /* 7/8 bit codewords */
+    { /* 110010 */ 41, 2 },
+    /* 8 bit codewords */
+    { /* 110011 */ 45, 2 },
+    { /* 110100 */ 49, 2 },
+    { /* 110101 */ 53, 2 },
+    { /* 110110 */ 57, 2 },
+    { /* 110111 */ 61, 2 },
+    /* 8/9 bit codewords */
+    { /* 111000 */ 65, 3 },
+    /* 9 bit codewords */
+    { /* 111001 */ 73, 3 },
+    { /* 111010 */ 81, 3 },
+    { /* 111011 */ 89, 3 },
+    /* 9/10 bit codewords */
+    { /* 111100 */ 97, 4 },
+    /* 10 bit codewords */
+    { /* 111101 */ 113, 4 },
+    { /* 111110 */ 129, 4 },
+    /* 10/11/12 bit codewords */
+    { /* 111111 */ 145, 6 }
+};
+
+/* 2nd step table
+ *
+ * Gives size of codeword and actual data (x,y,v,w)
+ */
+static hcb_2_pair hcb10_2[] = {
+    /* 4 bit codewords */
+    { 4,  1,  1 },
+    { 4,  1,  2 },
+    { 4,  2,  1 },
+
+    /* 5 bit codewords */
+    { 5,  2,  2 },
+    { 5,  1,  0 },
+    { 5,  0,  1 },
+    { 5,  1,  3 },
+    { 5,  3,  2 },
+    { 5,  3,  1 },
+    { 5,  2,  3 },
+    { 5,  3,  3 },
+
+    /* 6 bit codewords */
+    { 6,  2,  0 },
+    { 6,  0,  2 },
+    { 6,  2,  4 },
+    { 6,  4,  2 },
+    { 6,  1,  4 },
+    { 6,  4,  1 },
+    { 6,  0,  0 },
+    { 6,  4,  3 },
+    { 6,  3,  4 },
+    { 6,  3,  0 },
+    { 6,  0,  3 },
+    { 6,  4,  4 },
+    { 6,  2,  5 },
+    { 6,  5,  2 },
+
+    /* 7 bit codewords */
+    { 7,  1,  5 },
+    { 7,  5,  1 },
+    { 7,  5,  3 },
+    { 7,  3,  5 },
+    { 7,  5,  4 },
+    { 7,  4,  5 },
+    { 7,  6,  2 },
+    { 7,  2,  6 },
+    { 7,  6,  3 },
+    { 7,  4,  0 },
+    { 7,  6,  1 },
+    { 7,  0,  4 },
+    { 7,  1,  6 },
+    { 7,  3,  6 },
+    { 7,  5,  5 },
+    { 7,  6,  4 },
+
+    /* 7/8 bit codewords */
+    { 7,  4,  6 }, { 7,  4,  6 },
+    { 8,  6,  5 },
+    { 8,  7,  2 },
+
+    /* 8 bit codewords */
+    { 8,  3,  7 },
+    { 8,  2,  7 },
+    { 8,  5,  6 },
+    { 8,  8,  2 },
+    { 8,  7,  3 },
+    { 8,  5,  0 },
+    { 8,  7,  1 },
+    { 8,  0,  5 },
+    { 8,  8,  1 },
+    { 8,  1,  7 },
+    { 8,  8,  3 },
+    { 8,  7,  4 },
+    { 8,  4,  7 },
+    { 8,  2,  8 },
+    { 8,  6,  6 },
+    { 8,  7,  5 },
+    { 8,  1,  8 },
+    { 8,  3,  8 },
+    { 8,  8,  4 },
+    { 8,  4,  8 },
+
+    /* 8/9 bit codewords */
+    { 8,  5,  7 }, { 8,  5,  7 },
+    { 8,  8,  5 }, { 8,  8,  5 },
+    { 8,  5,  8 }, { 8,  5,  8 },
+    { 9,  7,  6 },
+    { 9,  6,  7 },
+
+    /* 9 bit codewords */
+    { 9,  9,  2 },
+    { 9,  6,  0 },
+    { 9,  6,  8 },
+    { 9,  9,  3 },
+    { 9,  3,  9 },
+    { 9,  9,  1 },
+    { 9,  2,  9 },
+    { 9,  0,  6 },
+    { 9,  8,  6 },
+    { 9,  9,  4 },
+    { 9,  4,  9 },
+    { 9, 10,  2 },
+    { 9,  1,  9 },
+    { 9,  7,  7 },
+    { 9,  8,  7 },
+    { 9,  9,  5 },
+    { 9,  7,  8 },
+    { 9, 10,  3 },
+    { 9,  5,  9 },
+    { 9, 10,  4 },
+    { 9,  2, 10 },
+    { 9, 10,  1 },
+    { 9,  3, 10 },
+    { 9,  9,  6 },
+
+    /* 9/10 bit codewords */
+    { 9,  6,  9 }, { 9,  6,  9 },
+    { 9,  8,  0 }, { 9,  8,  0 },
+    { 9,  4, 10 }, { 9,  4, 10 },
+    { 9,  7,  0 }, { 9,  7,  0 },
+    { 9, 11,  2 }, { 9, 11,  2 },
+    { 10,  7,  9 },
+    { 10, 11,  3 },
+    { 10, 10,  6 },
+    { 10,  1, 10 },
+    { 10, 11,  1 },
+    { 10,  9,  7 },
+
+    /* 10 bit codewords */
+    { 10,  0,  7 },
+    { 10,  8,  8 },
+    { 10, 10,  5 },
+    { 10,  3, 11 },
+    { 10,  5, 10 },
+    { 10,  8,  9 },
+    { 10, 11,  5 },
+    { 10,  0,  8 },
+    { 10, 11,  4 },
+    { 10,  2, 11 },
+    { 10,  7, 10 },
+    { 10,  6, 10 },
+    { 10, 10,  7 },
+    { 10,  4, 11 },
+    { 10,  1, 11 },
+    { 10, 12,  2 },
+    { 10,  9,  8 },
+    { 10, 12,  3 },
+    { 10, 11,  6 },
+    { 10,  5, 11 },
+    { 10, 12,  4 },
+    { 10, 11,  7 },
+    { 10, 12,  5 },
+    { 10,  3, 12 },
+    { 10,  6, 11 },
+    { 10,  9,  0 },
+    { 10, 10,  8 },
+    { 10, 10,  0 },
+    { 10, 12,  1 },
+    { 10,  0,  9 },
+    { 10,  4, 12 },
+    { 10,  9,  9 },
+
+    /* 10/11/12 bit codewords */
+    { 10, 12,  6 }, { 10, 12,  6 }, { 10, 12,  6 }, { 10, 12,  6 },
+    { 10,  2, 12 }, { 10,  2, 12 }, { 10,  2, 12 }, { 10,  2, 12 },
+    { 10,  8, 10 }, { 10,  8, 10 }, { 10,  8, 10 }, { 10,  8, 10 },
+    { 11,  9, 10 }, { 11,  9, 10 },
+    { 11,  1, 12 }, { 11,  1, 12 },
+    { 11, 11,  8 }, { 11, 11,  8 },
+    { 11, 12,  7 }, { 11, 12,  7 },
+    { 11,  7, 11 }, { 11,  7, 11 },
+    { 11,  5, 12 }, { 11,  5, 12 },
+    { 11,  6, 12 }, { 11,  6, 12 },
+    { 11, 10,  9 }, { 11, 10,  9 },
+    { 11,  8, 11 }, { 11,  8, 11 },
+    { 11, 12,  8 }, { 11, 12,  8 },
+    { 11,  0, 10 }, { 11,  0, 10 },
+    { 11,  7, 12 }, { 11,  7, 12 },
+    { 11, 11,  0 }, { 11, 11,  0 },
+    { 11, 10, 10 }, { 11, 10, 10 },
+    { 11, 11,  9 }, { 11, 11,  9 },
+    { 11, 11, 10 }, { 11, 11, 10 },
+    { 11,  0, 11 }, { 11,  0, 11 },
+    { 11, 11, 11 }, { 11, 11, 11 },
+    { 11,  9, 11 }, { 11,  9, 11 },
+    { 11, 10, 11 }, { 11, 10, 11 },
+    { 11, 12,  0 }, { 11, 12,  0 },
+    { 11,  8, 12 }, { 11,  8, 12 },
+    { 12, 12,  9 },
+    { 12, 10, 12 },
+    { 12,  9, 12 },
+    { 12, 11, 12 },
+    { 12, 12, 11 },
+    { 12,  0, 12 },
+    { 12, 12, 10 },
+    { 12, 12, 12 }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/codebook/hcb_11.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,412 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_11.h,v 1.2 2003/07/29 08:20:14 menno Exp $
+**/
+
+/* 2-step huffman table HCB_11 */
+
+
+/* 1st step: 5 bits
+ *           2^5 = 32 entries
+ *
+ * Used to find offset into 2nd step table and number of extra bits to get
+ */
+static hcb hcb11_1[] = {
+    /* 4 bits */
+    { /* 00000 */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /* 00010 */ 1, 0 },
+    { /*       */ 1, 0 },
+
+    /* 5 bits */
+    { /* 00100 */ 2, 0 },
+    { /* 00101 */ 3, 0 },
+    { /* 00110 */ 4, 0 },
+    { /* 00111 */ 5, 0 },
+    { /* 01000 */ 6, 0 },
+    { /* 01001 */ 7, 0 },
+
+    /* 6 bits */
+    { /* 01010 */ 8,  1 },
+    { /* 01011 */ 10, 1 },
+    { /* 01100 */ 12, 1 },
+
+    /* 6/7 bits */
+    { /* 01101 */ 14, 2 },
+
+    /* 7 bits */
+    { /* 01110 */ 18, 2 },
+    { /* 01111 */ 22, 2 },
+    { /* 10000 */ 26, 2 },
+
+    /* 7/8 bits */
+    { /* 10001 */ 30, 3 },
+
+    /* 8 bits */
+    { /* 10010 */ 38, 3 },
+    { /* 10011 */ 46, 3 },
+    { /* 10100 */ 54, 3 },
+    { /* 10101 */ 62, 3 },
+    { /* 10110 */ 70, 3 },
+    { /* 10111 */ 78, 3 },
+
+    /* 8/9 bits */
+    { /* 11000 */ 86, 4 },
+
+    /* 9 bits */
+    { /* 11001 */ 102, 4 },
+    { /* 11010 */ 118, 4 },
+    { /* 11011 */ 134, 4 },
+
+    /* 9/10 bits */
+    { /* 11100 */ 150, 5 },
+
+    /* 10 bits */
+    { /* 11101 */ 182, 5 },
+    { /* 11110 */ 214, 5 },
+
+    /* 10/11/12 bits */
+    { /* 11111 */ 246, 7 }
+};
+
+/* 2nd step table
+ *
+ * Gives size of codeword and actual data (x,y,v,w)
+ */
+static hcb_2_pair hcb11_2[] = {
+    /* 4 */
+    { 4,  0,  0 },
+    { 4,  1,  1 },
+
+    /* 5 */
+    { 5, 16, 16 },
+    { 5,  1,  0 },
+    { 5,  0,  1 },
+    { 5,  2,  1 },
+    { 5,  1,  2 },
+    { 5,  2,  2 },
+
+    /* 6 */
+    { 6,  1,  3 },
+    { 6,  3,  1 },
+    { 6,  3,  2 },
+    { 6,  2,  0 },
+    { 6,  2,  3 },
+    { 6,  0,  2 },
+
+    /* 6/7 */
+    { 6,  3,  3 }, { 6,  3,  3 },
+    { 7,  4,  1 },
+    { 7,  1,  4 },
+
+    /* 7 */
+    { 7,  4,  2 },
+    { 7,  2,  4 },
+    { 7,  4,  3 },
+    { 7,  3,  4 },
+    { 7,  3,  0 },
+    { 7,  0,  3 },
+    { 7,  5,  1 },
+    { 7,  5,  2 },
+    { 7,  2,  5 },
+    { 7,  4,  4 },
+    { 7,  1,  5 },
+    { 7,  5,  3 },
+
+    /* 7/8 */
+    { 7,  3,  5 }, { 7,  3,  5 },
+    { 7,  5,  4 }, { 7,  5,  4 },
+    { 8,  4,  5 },
+    { 8,  6,  2 },
+    { 8,  2,  6 },
+    { 8,  6,  1 },
+
+    /* 8 */
+    { 8,  6,  3 },
+    { 8,  3,  6 },
+    { 8,  1,  6 },
+    { 8,  4, 16 },
+    { 8,  3, 16 },
+    { 8, 16,  5 },
+    { 8, 16,  3 },
+    { 8, 16,  4 },
+    { 8,  6,  4 },
+    { 8, 16,  6 },
+    { 8,  4,  0 },
+    { 8,  4,  6 },
+    { 8,  0,  4 },
+    { 8,  2, 16 },
+    { 8,  5,  5 },
+    { 8,  5, 16 },
+    { 8, 16,  7 },
+    { 8, 16,  2 },
+    { 8, 16,  8 },
+    { 8,  2,  7 },
+    { 8,  7,  2 },
+    { 8,  3,  7 },
+    { 8,  6,  5 },
+    { 8,  5,  6 },
+    { 8,  6, 16 },
+    { 8, 16, 10 },
+    { 8,  7,  3 },
+    { 8,  7,  1 },
+    { 8, 16,  9 },
+    { 8,  7, 16 },
+    { 8,  1, 16 },
+    { 8,  1,  7 },
+    { 8,  4,  7 },
+    { 8, 16, 11 },
+    { 8,  7,  4 },
+    { 8, 16, 12 },
+    { 8,  8, 16 },
+    { 8, 16,  1 },
+    { 8,  6,  6 },
+    { 8,  9, 16 },
+    { 8,  2,  8 },
+    { 8,  5,  7 },
+    { 8, 10, 16 },
+    { 8, 16, 13 },
+    { 8,  8,  3 },
+    { 8,  8,  2 },
+    { 8,  3,  8 },
+    { 8,  5,  0 },
+
+    /* 8/9 */
+    { 8, 16, 14 }, { 8, 16, 14 },
+    { 8, 11, 16 }, { 8, 11, 16 },
+    { 8,  7,  5 }, { 8,  7,  5 },
+    { 8,  4,  8 }, { 8,  4,  8 },
+    { 8,  6,  7 }, { 8,  6,  7 },
+    { 8,  7,  6 }, { 8,  7,  6 },
+    { 8,  0,  5 }, { 8,  0,  5 },
+    { 9,  8,  4 },
+    { 9, 16, 15 },
+
+    /* 9 */
+    { 9, 12, 16 },
+    { 9,  1,  8 },
+    { 9,  8,  1 },
+    { 9, 14, 16 },
+    { 9,  5,  8 },
+    { 9, 13, 16 },
+    { 9,  3,  9 },
+    { 9,  8,  5 },
+    { 9,  7,  7 },
+    { 9,  2,  9 },
+    { 9,  8,  6 },
+    { 9,  9,  2 },
+    { 9,  9,  3 },
+    { 9, 15, 16 },
+    { 9,  4,  9 },
+    { 9,  6,  8 },
+    { 9,  6,  0 },
+    { 9,  9,  4 },
+    { 9,  5,  9 },
+    { 9,  8,  7 },
+    { 9,  7,  8 },
+    { 9,  1,  9 },
+    { 9, 10,  3 },
+    { 9,  0,  6 },
+    { 9, 10,  2 },
+    { 9,  9,  1 },
+    { 9,  9,  5 },
+    { 9,  4, 10 },
+    { 9,  2, 10 },
+    { 9,  9,  6 },
+    { 9,  3, 10 },
+    { 9,  6,  9 },
+    { 9, 10,  4 },
+    { 9,  8,  8 },
+    { 9, 10,  5 },
+    { 9,  9,  7 },
+    { 9, 11,  3 },
+    { 9,  1, 10 },
+    { 9,  7,  0 },
+    { 9, 10,  6 },
+    { 9,  7,  9 },
+    { 9,  3, 11 },
+    { 9,  5, 10 },
+    { 9, 10,  1 },
+    { 9,  4, 11 },
+    { 9, 11,  2 },
+    { 9, 13,  2 },
+    { 9,  6, 10 },
+
+    /* 9/10 */
+    { 9, 13,  3 }, { 9, 13,  3 },
+    { 9,  2, 11 }, { 9,  2, 11 },
+    { 9, 16,  0 }, { 9, 16,  0 },
+    { 9,  5, 11 }, { 9,  5, 11 },
+    { 9, 11,  5 }, { 9, 11,  5 },
+    { 10, 11,  4 },
+    { 10,  9,  8 },
+    { 10,  7, 10 },
+    { 10,  8,  9 },
+    { 10,  0, 16 },
+    { 10,  4, 13 },
+    { 10,  0,  7 },
+    { 10,  3, 13 },
+    { 10, 11,  6 },
+    { 10, 13,  1 },
+    { 10, 13,  4 },
+    { 10, 12,  3 },
+    { 10,  2, 13 },
+    { 10, 13,  5 },
+    { 10,  8, 10 },
+    { 10,  6, 11 },
+    { 10, 10,  8 },
+    { 10, 10,  7 },
+    { 10, 14,  2 },
+    { 10, 12,  4 },
+    { 10,  1, 11 },
+    { 10,  4, 12 },
+
+    /* 10 */
+    { 10, 11,  1 },
+    { 10,  3, 12 },
+    { 10,  1, 13 },
+    { 10, 12,  2 },
+    { 10,  7, 11 },
+    { 10,  3, 14 },
+    { 10,  5, 12 },
+    { 10,  5, 13 },
+    { 10, 14,  4 },
+    { 10,  4, 14 },
+    { 10, 11,  7 },
+    { 10, 14,  3 },
+    { 10, 12,  5 },
+    { 10, 13,  6 },
+    { 10, 12,  6 },
+    { 10,  8,  0 },
+    { 10, 11,  8 },
+    { 10,  2, 12 },
+    { 10,  9,  9 },
+    { 10, 14,  5 },
+    { 10,  6, 13 },
+    { 10, 10, 10 },
+    { 10, 15,  2 },
+    { 10,  8, 11 },
+    { 10,  9, 10 },
+    { 10, 14,  6 },
+    { 10, 10,  9 },
+    { 10,  5, 14 },
+    { 10, 11,  9 },
+    { 10, 14,  1 },
+    { 10,  2, 14 },
+    { 10,  6, 12 },
+    { 10,  1, 12 },
+    { 10, 13,  8 },
+    { 10,  0,  8 },
+    { 10, 13,  7 },
+    { 10,  7, 12 },
+    { 10, 12,  7 },
+    { 10,  7, 13 },
+    { 10, 15,  3 },
+    { 10, 12,  1 },
+    { 10,  6, 14 },
+    { 10,  2, 15 },
+    { 10, 15,  5 },
+    { 10, 15,  4 },
+    { 10,  1, 14 },
+    { 10,  9, 11 },
+    { 10,  4, 15 },
+    { 10, 14,  7 },
+    { 10,  8, 13 },
+    { 10, 13,  9 },
+    { 10,  8, 12 },
+    { 10,  5, 15 },
+    { 10,  3, 15 },
+    { 10, 10, 11 },
+    { 10, 11, 10 },
+    { 10, 12,  8 },
+    { 10, 15,  6 },
+    { 10, 15,  7 },
+    { 10,  8, 14 },
+    { 10, 15,  1 },
+    { 10,  7, 14 },
+    { 10,  9,  0 },
+    { 10,  0,  9 },
+
+    /* 10/11/12 */
+    { 10,  9, 13 }, { 10,  9, 13 }, { 10,  9, 13 }, { 10,  9, 13 },
+    { 10,  9, 12 }, { 10,  9, 12 }, { 10,  9, 12 }, { 10,  9, 12 },
+    { 10, 12,  9 }, { 10, 12,  9 }, { 10, 12,  9 }, { 10, 12,  9 },
+    { 10, 14,  8 }, { 10, 14,  8 }, { 10, 14,  8 }, { 10, 14,  8 },
+    { 10, 10, 13 }, { 10, 10, 13 }, { 10, 10, 13 }, { 10, 10, 13 },
+    { 10, 14,  9 }, { 10, 14,  9 }, { 10, 14,  9 }, { 10, 14,  9 },
+    { 10, 12, 10 }, { 10, 12, 10 }, { 10, 12, 10 }, { 10, 12, 10 },
+    { 10,  6, 15 }, { 10,  6, 15 }, { 10,  6, 15 }, { 10,  6, 15 },
+    { 10,  7, 15 }, { 10,  7, 15 }, { 10,  7, 15 }, { 10,  7, 15 },
+
+    { 11,  9, 14 }, { 11,  9, 14 },
+    { 11, 15,  8 }, { 11, 15,  8 },
+    { 11, 11, 11 }, { 11, 11, 11 },
+    { 11, 11, 14 }, { 11, 11, 14 },
+    { 11,  1, 15 }, { 11,  1, 15 },
+    { 11, 10, 12 }, { 11, 10, 12 },
+    { 11, 10, 14 }, { 11, 10, 14 },
+    { 11, 13, 11 }, { 11, 13, 11 },
+    { 11, 13, 10 }, { 11, 13, 10 },
+    { 11, 11, 13 }, { 11, 11, 13 },
+    { 11, 11, 12 }, { 11, 11, 12 },
+    { 11,  8, 15 }, { 11,  8, 15 },
+    { 11, 14, 11 }, { 11, 14, 11 },
+    { 11, 13, 12 }, { 11, 13, 12 },
+    { 11, 12, 13 }, { 11, 12, 13 },
+    { 11, 15,  9 }, { 11, 15,  9 },
+    { 11, 14, 10 }, { 11, 14, 10 },
+    { 11, 10,  0 }, { 11, 10,  0 },
+    { 11, 12, 11 }, { 11, 12, 11 },
+    { 11,  9, 15 }, { 11,  9, 15 },
+    { 11,  0, 10 }, { 11,  0, 10 },
+    { 11, 12, 12 }, { 11, 12, 12 },
+    { 11, 11,  0 }, { 11, 11,  0 },
+    { 11, 12, 14 }, { 11, 12, 14 },
+    { 11, 10, 15 }, { 11, 10, 15 },
+    { 11, 13, 13 }, { 11, 13, 13 },
+    { 11,  0, 13 }, { 11,  0, 13 },
+    { 11, 14, 12 }, { 11, 14, 12 },
+    { 11, 15, 10 }, { 11, 15, 10 },
+    { 11, 15, 11 }, { 11, 15, 11 },
+    { 11, 11, 15 }, { 11, 11, 15 },
+    { 11, 14, 13 }, { 11, 14, 13 },
+    { 11, 13,  0 }, { 11, 13,  0 },
+    { 11,  0, 11 }, { 11,  0, 11 },
+    { 11, 13, 14 }, { 11, 13, 14 },
+    { 11, 15, 12 }, { 11, 15, 12 },
+    { 11, 15, 13 }, { 11, 15, 13 },
+    { 11, 12, 15 }, { 11, 12, 15 },
+    { 11, 14,  0 }, { 11, 14,  0 },
+    { 11, 14, 14 }, { 11, 14, 14 },
+    { 11, 13, 15 }, { 11, 13, 15 },
+    { 11, 12,  0 }, { 11, 12,  0 },
+    { 11, 14, 15 }, { 11, 14, 15 },
+    { 12,  0, 14 },
+    { 12,  0, 12 },
+    { 12, 15, 14 },
+    { 12, 15,  0 },
+    { 12,  0, 15 },
+    { 12, 15, 15 }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/codebook/hcb_2.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,182 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_2.h,v 1.2 2003/07/29 08:20:14 menno Exp $
+**/
+
+/* 2-step huffman table HCB_2 */
+
+
+/* 1st step: 5 bits
+ *           2^5 = 32 entries
+ *
+ * Used to find offset into 2nd step table and number of extra bits to get
+ */
+static hcb hcb2_1[] = {
+    { /* 00000 */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /* 00100 */ 1, 0 },
+    { /*       */ 1, 0 },
+    { /* 00110 */ 2, 0 },
+    { /* 00111 */ 3, 0 },
+    { /* 01000 */ 4, 0 },
+    { /* 01001 */ 5, 0 },
+    { /* 01010 */ 6, 0 },
+    { /* 01011 */ 7, 0 },
+    { /* 01100 */ 8, 0 },
+
+    /* 6 bit codewords */
+    { /* 01101 */ 9,  1 },
+    { /* 01110 */ 11, 1 },
+    { /* 01111 */ 13, 1 },
+    { /* 10000 */ 15, 1 },
+    { /* 10001 */ 17, 1 },
+    { /* 10010 */ 19, 1 },
+    { /* 10011 */ 21, 1 },
+    { /* 10100 */ 23, 1 },
+    { /* 10101 */ 25, 1 },
+    { /* 10110 */ 27, 1 },
+    { /* 10111 */ 29, 1 },
+    { /* 11000 */ 31, 1 },
+
+    /* 7 bit codewords */
+    { /* 11001 */ 33, 2 },
+    { /* 11010 */ 37, 2 },
+    { /* 11011 */ 41, 2 },
+
+    /* 7/8 bit codewords */
+    { /* 11100 */ 45, 3 },
+
+    /* 8 bit codewords */
+    { /* 11101 */ 53, 3 },
+    { /* 11110 */ 61, 3 },
+
+    /* 8/9 bit codewords */
+    { /* 11111 */ 69, 4 }
+};
+
+/* 2nd step table
+ *
+ * Gives size of codeword and actual data (x,y,v,w)
+ */
+static hcb_2_quad hcb2_2[] = {
+    /* 3 bit codeword */
+    { 3,  0,  0,  0,  0 },
+
+    /* 4 bit codeword */
+    { 4,  1,  0,  0,  0 },
+
+    /* 5 bit codewords */
+    { 5, -1,  0,  0,  0 },
+    { 5,  0,  0,  0,  1 },
+    { 5,  0,  0, -1,  0 },
+    { 5,  0,  0,  0, -1 },
+    { 5,  0, -1,  0,  0 },
+    { 5,  0,  0,  1,  0 },
+    { 5,  0,  1,  0,  0 },
+
+    /* 6 bit codewords */
+    { 6,  0, -1,  1,  0 },
+    { 6, -1,  1,  0,  0 },
+    { 6,  0,  1, -1,  0 },
+    { 6,  0,  0,  1, -1 },
+    { 6,  0,  1,  0, -1 },
+    { 6,  0,  0, -1,  1 },
+    { 6, -1,  0,  0, -1 },
+    { 6,  1, -1,  0,  0 },
+    { 6,  1,  0, -1,  0 },
+    { 6, -1, -1,  0,  0 },
+    { 6,  0,  0, -1, -1 },
+    { 6,  1,  0,  1,  0 },
+    { 6,  1,  0,  0,  1 },
+    { 6,  0, -1,  0,  1 },
+    { 6, -1,  0,  1,  0 },
+    { 6,  0,  1,  0,  1 },
+    { 6,  0, -1, -1,  0 },
+    { 6, -1,  0,  0,  1 },
+    { 6,  0, -1,  0, -1 },
+    { 6, -1,  0, -1,  0 },
+    { 6,  1,  1,  0,  0 },
+    { 6,  0,  1,  1,  0 },
+    { 6,  0,  0,  1,  1 },
+    { 6,  1,  0,  0, -1 },
+
+    /* 7 bit codewords */
+    { 7,  0,  1, -1,  1 },
+    { 7,  1,  0, -1,  1 },
+    { 7, -1,  1, -1,  0 },
+    { 7,  0, -1,  1, -1 },
+    { 7,  1, -1,  1,  0 },
+    { 7,  1,  1,  0, -1 },
+    { 7,  1,  0,  1,  1 },
+    { 7, -1,  1,  1,  0 },
+    { 7,  0, -1, -1,  1 },
+    { 7,  1,  1,  1,  0 },
+    { 7, -1,  0,  1, -1 },
+    { 7, -1, -1, -1,  0 },
+
+    /* 7/8 bit codewords */
+    { 7, -1,  0, -1,  1 }, { 7, -1,  0, -1,  1 },
+    { 7,  1, -1, -1,  0 }, { 7,  1, -1, -1,  0 },
+    { 7,  1,  1, -1,  0 }, { 7,  1,  1, -1,  0 },
+    { 8,  1, -1,  0,  1 },
+    { 8, -1,  1,  0, -1 },
+
+    /* 8 bit codewords */
+    { 8, -1, -1,  1,  0 },
+    { 8, -1,  0,  1,  1 },
+    { 8, -1, -1,  0,  1 },
+    { 8, -1, -1,  0, -1 },
+    { 8,  0, -1, -1, -1 },
+    { 8,  1,  0,  1, -1 },
+    { 8,  1,  0, -1, -1 },
+    { 8,  0,  1, -1, -1 },
+    { 8,  0,  1,  1,  1 },
+    { 8, -1,  1,  0,  1 },
+    { 8, -1,  0, -1, -1 },
+    { 8,  0,  1,  1, -1 },
+    { 8,  1, -1,  0, -1 },
+    { 8,  0, -1,  1,  1 },
+    { 8,  1,  1,  0,  1 },
+    { 8,  1, -1,  1, -1 },
+
+    /* 8/9 bit codewords */
+    { 8, -1,  1, -1,  1 }, { 8, -1,  1, -1,  1 },
+    { 9,  1, -1, -1,  1 },
+    { 9, -1, -1, -1, -1 },
+    { 9, -1,  1,  1, -1 },
+    { 9, -1,  1,  1,  1 },
+    { 9,  1,  1,  1,  1 },
+    { 9, -1, -1,  1, -1 },
+    { 9,  1, -1,  1,  1 },
+    { 9, -1,  1, -1, -1 },
+    { 9, -1, -1,  1,  1 },
+    { 9,  1,  1, -1, -1 },
+    { 9,  1, -1, -1, -1 },
+    { 9, -1, -1, -1,  1 },
+    { 9,  1,  1, -1,  1 },
+    { 9,  1,  1,  1, -1 }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/codebook/hcb_3.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,193 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_3.h,v 1.2 2003/07/29 08:20:14 menno Exp $
+**/
+
+/* Binary search huffman table HCB_3 */
+
+
+static hcb_bin_quad hcb3[] = {
+    { /*  0 */ 0, {  1,  2, 0, 0 } },
+    { /*  1 */ 1, {  0,  0, 0, 0 } }, /* 0 */
+    { /*  2 */ 0, {  1,  2, 0, 0 } },
+    { /*  3 */ 0, {  2,  3, 0, 0 } },
+    { /*  4 */ 0, {  3,  4, 0, 0 } },
+    { /*  5 */ 0, {  4,  5, 0, 0 } },
+    { /*  6 */ 0, {  5,  6, 0, 0 } },
+    { /*  7 */ 0, {  6,  7, 0, 0 } },
+    { /*  8 */ 0, {  7,  8, 0, 0 } },
+    { /*  9 */ 1, {  1,  0, 0, 0 } }, /* 1000 */
+    { /* 10 */ 1, {  0,  0, 0, 1 } }, /* 1001 */
+    { /* 11 */ 1, {  0,  1, 0, 0 } }, /* 1010 */
+    { /* 12 */ 1, {  0,  0, 1, 0 } }, /* 1011 */
+    { /* 13 */ 0, {  4,  5, 0, 0 } },
+    { /* 14 */ 0, {  5,  6, 0, 0 } },
+    { /* 15 */ 0, {  6,  7, 0, 0 } },
+    { /* 16 */ 0, {  7,  8, 0, 0 } },
+    { /* 17 */ 1, {  1,  1, 0, 0 } },
+    { /* 18 */ 1, {  0,  0, 1, 1 } },
+    { /* 19 */ 0, {  6,  7, 0, 0 } },
+    { /* 20 */ 0, {  7,  8, 0, 0 } },
+    { /* 21 */ 0, {  8,  9, 0, 0 } },
+    { /* 22 */ 0, {  9, 10, 0, 0 } },
+    { /* 23 */ 0, { 10, 11, 0, 0 } },
+    { /* 24 */ 0, { 11, 12, 0, 0 } },
+    { /* 25 */ 1, {  0,  1, 1, 0 } }, /* 110100 */
+    { /* 26 */ 1, {  0,  1, 0, 1 } }, /* 110101 */
+    { /* 27 */ 1, {  1,  0, 1, 0 } }, /* 110110 */
+    { /* 28 */ 1, {  0,  1, 1, 1 } }, /* 110111 */
+    { /* 29 */ 1, {  1,  0, 0, 1 } }, /* 111000 */
+    { /* 30 */ 1, {  1,  1, 1, 0 } }, /* 111001 */
+    { /* 31 */ 0, {  6,  7, 0, 0 } },
+    { /* 32 */ 0, {  7,  8, 0, 0 } },
+    { /* 33 */ 0, {  8,  9, 0, 0 } },
+    { /* 34 */ 0, {  9, 10, 0, 0 } },
+    { /* 35 */ 0, { 10, 11, 0, 0 } },
+    { /* 36 */ 0, { 11, 12, 0, 0 } },
+    { /* 37 */ 1, {  1,  1, 1, 1 } }, /* 1110100 */
+    { /* 38 */ 1, {  1,  0, 1, 1 } }, /* 1110101 */
+    { /* 39 */ 1, {  1,  1, 0, 1 } }, /* 1110110 */
+    { /* 40 */ 0, {  9, 10, 0, 0 } },
+    { /* 41 */ 0, { 10, 11, 0, 0 } },
+    { /* 42 */ 0, { 11, 12, 0, 0 } },
+    { /* 43 */ 0, { 12, 13, 0, 0 } },
+    { /* 44 */ 0, { 13, 14, 0, 0 } },
+    { /* 45 */ 0, { 14, 15, 0, 0 } },
+    { /* 46 */ 0, { 15, 16, 0, 0 } },
+    { /* 47 */ 0, { 16, 17, 0, 0 } },
+    { /* 48 */ 0, { 17, 18, 0, 0 } },
+    { /* 49 */ 1, {  2,  0, 0, 0 } }, /* 11101110 */
+    { /* 50 */ 1, {  0,  0, 0, 2 } }, /* 11101111 */
+    { /* 51 */ 1, {  0,  0, 1, 2 } }, /* 11110000 */
+    { /* 52 */ 1, {  2,  1, 0, 0 } }, /* 11110001 */
+    { /* 53 */ 1, {  1,  2, 1, 0 } }, /* 11110010 */
+    { /* 54 */ 0, { 13, 14, 0, 0 } },
+    { /* 55 */ 0, { 14, 15, 0, 0 } },
+    { /* 56 */ 0, { 15, 16, 0, 0 } },
+    { /* 57 */ 0, { 16, 17, 0, 0 } },
+    { /* 58 */ 0, { 17, 18, 0, 0 } },
+    { /* 59 */ 0, { 18, 19, 0, 0 } },
+    { /* 60 */ 0, { 19, 20, 0, 0 } },
+    { /* 61 */ 0, { 20, 21, 0, 0 } },
+    { /* 62 */ 0, { 21, 22, 0, 0 } },
+    { /* 63 */ 0, { 22, 23, 0, 0 } },
+    { /* 64 */ 0, { 23, 24, 0, 0 } },
+    { /* 65 */ 0, { 24, 25, 0, 0 } },
+    { /* 66 */ 0, { 25, 26, 0, 0 } },
+    { /* 67 */ 1, {  0,  0, 2, 1 } },
+    { /* 68 */ 1, {  0,  1, 2, 1 } },
+    { /* 69 */ 1, {  1,  2, 0, 0 } },
+    { /* 70 */ 1, {  0,  1, 1, 2 } },
+    { /* 71 */ 1, {  2,  1, 1, 0 } },
+    { /* 72 */ 1, {  0,  0, 2, 0 } },
+    { /* 73 */ 1, {  0,  2, 1, 0 } },
+    { /* 74 */ 1, {  0,  1, 2, 0 } },
+    { /* 75 */ 1, {  0,  2, 0, 0 } },
+    { /* 76 */ 1, {  0,  1, 0, 2 } },
+    { /* 77 */ 1, {  2,  0, 1, 0 } },
+    { /* 78 */ 1, {  1,  2, 1, 1 } },
+    { /* 79 */ 1, {  0,  2, 1, 1 } },
+    { /* 80 */ 1, {  1,  1, 2, 0 } },
+    { /* 81 */ 1, {  1,  1, 2, 1 } },
+    { /* 82 */ 0, { 11, 12, 0, 0 } },
+    { /* 83 */ 0, { 12, 13, 0, 0 } },
+    { /* 84 */ 0, { 13, 14, 0, 0 } },
+    { /* 85 */ 0, { 14, 15, 0, 0 } },
+    { /* 86 */ 0, { 15, 16, 0, 0 } },
+    { /* 87 */ 0, { 16, 17, 0, 0 } },
+    { /* 88 */ 0, { 17, 18, 0, 0 } },
+    { /* 89 */ 0, { 18, 19, 0, 0 } },
+    { /* 90 */ 0, { 19, 20, 0, 0 } },
+    { /* 91 */ 0, { 20, 21, 0, 0 } },
+    { /* 92 */ 0, { 21, 22, 0, 0 } },
+    { /* 93 */ 1, {  1,  2,  0,  1 } }, /* 1111101010 */
+    { /* 94 */ 1, {  1,  0,  2,  0 } }, /* 1111101011 */
+    { /* 95 */ 1, {  1,  0,  2,  1 } }, /* 1111101100 */
+    { /* 96 */ 1, {  0,  2,  0,  1 } }, /* 1111101101 */
+    { /* 97 */ 1, {  2,  1,  1,  1 } }, /* 1111101110 */
+    { /* 98 */ 1, {  1,  1,  1,  2 } }, /* 1111101111 */
+    { /* 99 */ 1, {  2,  1,  0,  1 } }, /* 1111110000 */
+    { /* 00 */ 1, {  1,  0,  1,  2 } }, /* 1111110001 */
+    { /* 01 */ 1, {  0,  0,  2,  2 } }, /* 1111110010 */
+    { /* 02 */ 1, {  0,  1,  2,  2 } }, /* 1111110011 */
+    { /* 03 */ 1, {  2,  2,  1,  0 } }, /* 1111110100 */
+    { /* 04 */ 1, {  1,  2,  2,  0 } }, /* 1111110101 */
+    { /* 05 */ 1, {  1,  0,  0,  2 } }, /* 1111110110 */
+    { /* 06 */ 1, {  2,  0,  0,  1 } }, /* 1111110111 */
+    { /* 07 */ 1, {  0,  2,  2,  1 } }, /* 1111111000 */
+    { /* 08 */ 0, {  7,  8, 0, 0 } },
+    { /* 09 */ 0, {  8,  9, 0, 0 } },
+    { /* 10 */ 0, {  9, 10, 0, 0 } },
+    { /* 11 */ 0, { 10, 11, 0, 0 } },
+    { /* 12 */ 0, { 11, 12, 0, 0 } },
+    { /* 13 */ 0, { 12, 13, 0, 0 } },
+    { /* 14 */ 0, { 13, 14, 0, 0 } },
+    { /* 15 */ 1, {  2,  2,  0,  0 } }, /* 11111110010 */
+    { /* 16 */ 1, {  1,  2,  2,  1 } }, /* 11111110011 */
+    { /* 17 */ 1, {  1,  1,  0,  2 } }, /* 11111110100 */
+    { /* 18 */ 1, {  2,  0,  1,  1 } }, /* 11111110101 */
+    { /* 19 */ 1, {  1,  1,  2,  2 } }, /* 11111110110 */
+    { /* 20 */ 1, {  2,  2,  1,  1 } }, /* 11111110111 */
+    { /* 21 */ 1, {  0,  2,  2,  0 } }, /* 11111111000 */
+    { /* 22 */ 1, {  0,  2,  1,  2 } }, /* 11111111001 */
+    { /* 23 */ 0, {  6,  7, 0, 0 } },
+    { /* 24 */ 0, {  7,  8, 0, 0 } },
+    { /* 25 */ 0, {  8,  9, 0, 0 } },
+    { /* 26 */ 0, {  9, 10, 0, 0 } },
+    { /* 27 */ 0, { 10, 11, 0, 0 } },
+    { /* 28 */ 0, { 11, 12, 0, 0 } },
+    { /* 29 */ 1, {  1,  0,  2,  2 } }, /* 111111110100 */
+    { /* 30 */ 1, {  2,  2,  0,  1 } }, /* 111111110101 */
+    { /* 31 */ 1, {  2,  1,  2,  0 } }, /* 111111110110 */
+    { /* 32 */ 1, {  2,  2,  2,  0 } }, /* 111111110111 */
+    { /* 33 */ 1, {  0,  2,  2,  2 } }, /* 111111111000 */
+    { /* 34 */ 1, {  2,  2,  2,  1 } }, /* 111111111001 */
+    { /* 35 */ 1, {  2,  1,  2,  1 } }, /* 111111111010 */
+    { /* 36 */ 1, {  1,  2,  1,  2 } }, /* 111111111011 */
+    { /* 37 */ 1, {  1,  2,  2,  2 } }, /* 111111111100 */
+    { /* 38 */ 0, {  3,  4, 0, 0 } },
+    { /* 39 */ 0, {  4,  5, 0, 0 } },
+    { /* 40 */ 0, {  5,  6, 0, 0 } },
+    { /* 41 */ 1, {  0,  2,  0,  2 } }, /* 1111111111010 */
+    { /* 42 */ 1, {  2,  0,  2,  0 } }, /* 1111111111011 */
+    { /* 43 */ 1, {  1,  2,  0,  2 } }, /* 1111111111100 */
+    { /* 44 */ 0, {  3, 4, 0, 0 } },
+    { /* 45 */ 0, {  4, 5, 0, 0 } },
+    { /* 46 */ 0, {  5, 6, 0, 0 } },
+    { /* 47 */ 1, {  2,  0,  2,  1 } }, /* 11111111111010 */
+    { /* 48 */ 1, {  2,  1,  1,  2 } }, /* 11111111111011 */
+    { /* 49 */ 1, {  2,  1,  0,  2 } }, /* 11111111111100 */
+    { /* 50 */ 0, { 3, 4, 0, 0 } },
+    { /* 51 */ 0, { 4, 5, 0, 0 } },
+    { /* 52 */ 0, { 5, 6, 0, 0 } },
+    { /* 53 */ 1, {  2,  2,  2,  2 } }, /* 111111111111010 */
+    { /* 54 */ 1, {  2,  2,  1,  2 } }, /* 111111111111011 */
+    { /* 55 */ 1, {  2,  1,  2,  2 } }, /* 111111111111100 */
+    { /* 56 */ 1, {  2,  0,  1,  2 } }, /* 111111111111101 */
+    { /* 57 */ 1, {  2,  0,  0,  2 } }, /* 111111111111110 */
+    { /* 58 */ 0, { 1, 2, 0, 0 } },
+    { /* 59 */ 1, {  2,  2,  0,  2 } }, /* 1111111111111110 */
+    { /* 60 */ 1, {  2,  0,  2,  2 } }  /* 1111111111111111 */
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/codebook/hcb_4.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,196 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_4.h,v 1.2 2003/07/29 08:20:14 menno Exp $
+**/
+
+/* 2-step huffman table HCB_4 */
+
+
+/* 1st step: 5 bits
+ *           2^5 = 32 entries
+ *
+ * Used to find offset into 2nd step table and number of extra bits to get
+ */
+static hcb hcb4_1[] = {
+    /* 4 bit codewords */
+    { /* 00000 */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /* 00010 */ 1, 0 },
+    { /*       */ 1, 0 },
+    { /* 00100 */ 2, 0 },
+    { /*       */ 2, 0 },
+    { /* 00110 */ 3, 0 },
+    { /*       */ 3, 0 },
+    { /* 01000 */ 4, 0 },
+    { /*       */ 4, 0 },
+    { /* 01010 */ 5, 0 },
+    { /*       */ 5, 0 },
+    { /* 01100 */ 6, 0 },
+    { /*       */ 6, 0 },
+    { /* 01110 */ 7, 0 },
+    { /*       */ 7, 0 },
+    { /* 10000 */ 8, 0 },
+    { /*       */ 8, 0 },
+    { /* 10010 */ 9, 0 },
+    { /*       */ 9, 0 },
+
+    /* 5 bit codewords */
+    { /* 10100 */ 10, 0 },
+    { /* 10101 */ 11, 0 },
+    { /* 10110 */ 12, 0 },
+    { /* 10111 */ 13, 0 },
+    { /* 11000 */ 14, 0 },
+    { /* 11001 */ 15, 0 },
+
+    /* 7 bit codewords */
+    { /* 11010 */ 16, 2 },
+    { /* 11011 */ 20, 2 },
+
+    /* 7/8 bit codewords */
+    { /* 11100 */ 24, 3 },
+
+    /* 8 bit codewords */
+    { /* 11101 */ 32, 3 },
+
+    /* 8/9 bit codewords */
+    { /* 11110 */ 40, 4 },
+
+    /* 9/10/11/12 bit codewords */
+    { /* 11111 */ 56, 7 }
+};
+
+/* 2nd step table
+ *
+ * Gives size of codeword and actual data (x,y,v,w)
+ */
+static hcb_2_quad hcb4_2[] = {
+    /* 4 bit codewords */
+    { 4,  1,  1,  1,  1 },
+    { 4,  0,  1,  1,  1 },
+    { 4,  1,  1,  0,  1 },
+    { 4,  1,  1,  1,  0 },
+    { 4,  1,  0,  1,  1 },
+    { 4,  1,  0,  0,  0 },
+    { 4,  1,  1,  0,  0 },
+    { 4,  0,  0,  0,  0 },
+    { 4,  0,  0,  1,  1 },
+    { 4,  1,  0,  1,  0 },
+
+    /* 5 bit codewords */
+    { 5,  1,  0,  0,  1 },
+    { 5,  0,  1,  1,  0 },
+    { 5,  0,  0,  0,  1 },
+    { 5,  0,  1,  0,  1 },
+    { 5,  0,  0,  1,  0 },
+    { 5,  0,  1,  0,  0 },
+
+    /* 7 bit codewords */
+    /* first 5 bits: 11010 */
+    { 7,  2,  1,  1,  1 },
+    { 7,  1,  1,  2,  1 },
+    { 7,  1,  2,  1,  1 },
+    { 7,  1,  1,  1,  2 },
+    /* first 5 bits: 11011 */
+    { 7,  2,  1,  1,  0 },
+    { 7,  2,  1,  0,  1 },
+    { 7,  1,  2,  1,  0 },
+    { 7,  2,  0,  1,  1 },
+
+    /* 7/8 bit codewords */
+    /* first 5 bits: 11100 */
+    { 7,  0,  1,  2,  1 }, { 7,  0,  1,  2,  1 },
+    { 8,  0,  1,  1,  2 },
+    { 8,  1,  1,  2,  0 },
+    { 8,  0,  2,  1,  1 },
+    { 8,  1,  0,  1,  2 },
+    { 8,  1,  2,  0,  1 },
+    { 8,  1,  1,  0,  2 },
+
+    /* 8 bit codewords */
+    { 8,  1,  0,  2,  1 },
+    { 8,  2,  1,  0,  0 },
+    { 8,  2,  0,  1,  0 },
+    { 8,  1,  2,  0,  0 },
+    { 8,  2,  0,  0,  1 },
+    { 8,  0,  1,  0,  2 },
+    { 8,  0,  2,  1,  0 },
+    { 8,  0,  0,  1,  2 },
+
+    /* 8/9 bit codewords */
+    { 8,  0,  1,  2,  0 }, { 8,  0,  1,  2,  0 },
+    { 8,  0,  2,  0,  1 }, { 8,  0,  2,  0,  1 },
+    { 8,  1,  0,  0,  2 }, { 8,  1,  0,  0,  2 },
+    { 8,  0,  0,  2,  1 }, { 8,  0,  0,  2,  1 },
+    { 8,  1,  0,  2,  0 }, { 8,  1,  0,  2,  0 },
+    { 8,  2,  0,  0,  0 }, { 8,  2,  0,  0,  0 },
+    { 8,  0,  0,  0,  2 }, { 8,  0,  0,  0,  2 },
+    { 9,  0,  2,  0,  0 },
+    { 9,  0,  0,  2,  0 },
+
+    /* 9/10/11 bit codewords */
+    /* 9 bit codewords repeated 2^3 = 8 times */
+    { 9,  1,  2,  2,  1 }, { 9,  1,  2,  2,  1 }, { 9,  1,  2,  2,  1 }, { 9,  1,  2,  2,  1 },
+    { 9,  1,  2,  2,  1 }, { 9,  1,  2,  2,  1 }, { 9,  1,  2,  2,  1 }, { 9,  1,  2,  2,  1 },
+    { 9,  2,  2,  1,  1 }, { 9,  2,  2,  1,  1 }, { 9,  2,  2,  1,  1 }, { 9,  2,  2,  1,  1 },
+    { 9,  2,  2,  1,  1 }, { 9,  2,  2,  1,  1 }, { 9,  2,  2,  1,  1 }, { 9,  2,  2,  1,  1 },
+    { 9,  2,  1,  2,  1 }, { 9,  2,  1,  2,  1 }, { 9,  2,  1,  2,  1 }, { 9,  2,  1,  2,  1 },
+    { 9,  2,  1,  2,  1 }, { 9,  2,  1,  2,  1 }, { 9,  2,  1,  2,  1 }, { 9,  2,  1,  2,  1 },
+    { 9,  1,  1,  2,  2 }, { 9,  1,  1,  2,  2 }, { 9,  1,  1,  2,  2 }, { 9,  1,  1,  2,  2 },
+    { 9,  1,  1,  2,  2 }, { 9,  1,  1,  2,  2 }, { 9,  1,  1,  2,  2 }, { 9,  1,  1,  2,  2 },
+    { 9,  1,  2,  1,  2 }, { 9,  1,  2,  1,  2 }, { 9,  1,  2,  1,  2 }, { 9,  1,  2,  1,  2 },
+    { 9,  1,  2,  1,  2 }, { 9,  1,  2,  1,  2 }, { 9,  1,  2,  1,  2 }, { 9,  1,  2,  1,  2 },
+    { 9,  2,  1,  1,  2 }, { 9,  2,  1,  1,  2 }, { 9,  2,  1,  1,  2 }, { 9,  2,  1,  1,  2 },
+    { 9,  2,  1,  1,  2 }, { 9,  2,  1,  1,  2 }, { 9,  2,  1,  1,  2 }, { 9,  2,  1,  1,  2 },
+    /* 10 bit codewords repeated 2^2 = 4 times */
+    { 10,  1,  2,  2,  0 }, { 10,  1,  2,  2,  0 }, { 10,  1,  2,  2,  0 }, { 10,  1,  2,  2,  0 },
+    { 10,  2,  2,  1,  0 }, { 10,  2,  2,  1,  0 }, { 10,  2,  2,  1,  0 }, { 10,  2,  2,  1,  0 },
+    { 10,  2,  1,  2,  0 }, { 10,  2,  1,  2,  0 }, { 10,  2,  1,  2,  0 }, { 10,  2,  1,  2,  0 },
+    { 10,  0,  2,  2,  1 }, { 10,  0,  2,  2,  1 }, { 10,  0,  2,  2,  1 }, { 10,  0,  2,  2,  1 },
+    { 10,  0,  1,  2,  2 }, { 10,  0,  1,  2,  2 }, { 10,  0,  1,  2,  2 }, { 10,  0,  1,  2,  2 },
+    { 10,  2,  2,  0,  1 }, { 10,  2,  2,  0,  1 }, { 10,  2,  2,  0,  1 }, { 10,  2,  2,  0,  1 },
+    { 10,  0,  2,  1,  2 }, { 10,  0,  2,  1,  2 }, { 10,  0,  2,  1,  2 }, { 10,  0,  2,  1,  2 },
+    { 10,  2,  0,  2,  1 }, { 10,  2,  0,  2,  1 }, { 10,  2,  0,  2,  1 }, { 10,  2,  0,  2,  1 },
+    { 10,  1,  0,  2,  2 }, { 10,  1,  0,  2,  2 }, { 10,  1,  0,  2,  2 }, { 10,  1,  0,  2,  2 },
+    { 10,  2,  2,  2,  1 }, { 10,  2,  2,  2,  1 }, { 10,  2,  2,  2,  1 }, { 10,  2,  2,  2,  1 },
+    { 10,  1,  2,  0,  2 }, { 10,  1,  2,  0,  2 }, { 10,  1,  2,  0,  2 }, { 10,  1,  2,  0,  2 },
+    { 10,  2,  0,  1,  2 }, { 10,  2,  0,  1,  2 }, { 10,  2,  0,  1,  2 }, { 10,  2,  0,  1,  2 },
+    { 10,  2,  1,  0,  2 }, { 10,  2,  1,  0,  2 }, { 10,  2,  1,  0,  2 }, { 10,  2,  1,  0,  2 },
+    { 10,  1,  2,  2,  2 }, { 10,  1,  2,  2,  2 }, { 10,  1,  2,  2,  2 }, { 10,  1,  2,  2,  2 },
+    /* 11 bit codewords repeated 2^1 = 2 times */
+    { 11,  2,  1,  2,  2 }, { 11,  2,  1,  2,  2 },
+    { 11,  2,  2,  1,  2 }, { 11,  2,  2,  1,  2 },
+    { 11,  0,  2,  2,  0 }, { 11,  0,  2,  2,  0 },
+    { 11,  2,  2,  0,  0 }, { 11,  2,  2,  0,  0 },
+    { 11,  0,  0,  2,  2 }, { 11,  0,  0,  2,  2 },
+    { 11,  2,  0,  2,  0 }, { 11,  2,  0,  2,  0 },
+    { 11,  0,  2,  0,  2 }, { 11,  0,  2,  0,  2 },
+    { 11,  2,  0,  0,  2 }, { 11,  2,  0,  0,  2 },
+    { 11,  2,  2,  2,  2 }, { 11,  2,  2,  2,  2 },
+    { 11,  0,  2,  2,  2 }, { 11,  0,  2,  2,  2 },
+    { 11,  2,  2,  2,  0 }, { 11,  2,  2,  2,  0 },
+    /* 12 bit codewords */
+    { 12,  2,  2,  0,  2 },
+    { 12,  2,  0,  2,  2 },
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/codebook/hcb_5.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,193 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_5.h,v 1.2 2003/07/29 08:20:14 menno Exp $
+**/
+
+/* Binary search huffman table HCB_5 */
+
+
+static hcb_bin_pair hcb5[] = {
+    { /*  0 */ 0, {  1,  2 } },
+    { /*  1 */ 1, {  0,  0 } }, /* 0 */
+    { /*  2 */ 0, {  1,  2 } },
+    { /*  3 */ 0, {  2,  3 } },
+    { /*  4 */ 0, {  3,  4 } },
+    { /*  5 */ 0, {  4,  5 } },
+    { /*  6 */ 0, {  5,  6 } },
+    { /*  7 */ 0, {  6,  7 } },
+    { /*  8 */ 0, {  7,  8 } },
+    { /*  9 */ 1, { -1,  0 } }, /* 1000 */
+    { /* 10 */ 1, {  1,  0 } }, /* 1001 */
+    { /* 11 */ 1, {  0,  1 } }, /* 1010 */
+    { /* 12 */ 1, {  0, -1 } }, /* 1011 */
+    { /* 13 */ 0, {  4,  5 } },
+    { /* 14 */ 0, {  5,  6 } },
+    { /* 15 */ 0, {  6,  7 } },
+    { /* 16 */ 0, {  7,  8 } },
+    { /* 17 */ 1, {  1, -1 } },
+    { /* 18 */ 1, { -1,  1 } },
+    { /* 19 */ 1, { -1, -1 } },
+    { /* 20 */ 1, {  1,  1 } },
+    { /* 21 */ 0, {  4,  5 } },
+    { /* 22 */ 0, {  5,  6 } },
+    { /* 23 */ 0, {  6,  7 } },
+    { /* 24 */ 0, {  7,  8 } },
+    { /* 25 */ 0, {  8,  9 } },
+    { /* 26 */ 0, {  9, 10 } },
+    { /* 27 */ 0, { 10, 11 } },
+    { /* 28 */ 0, { 11, 12 } },
+    { /* 29 */ 0, { 12, 13 } },
+    { /* 30 */ 0, { 13, 14 } },
+    { /* 31 */ 0, { 14, 15 } },
+    { /* 32 */ 0, { 15, 16 } },
+    { /* 33 */ 1, { -2,  0 } },
+    { /* 34 */ 1, {  0,  2 } },
+    { /* 35 */ 1, {  2,  0 } },
+    { /* 36 */ 1, {  0, -2 } },
+    { /* 37 */ 0, { 12, 13 } },
+    { /* 38 */ 0, { 13, 14 } },
+    { /* 39 */ 0, { 14, 15 } },
+    { /* 40 */ 0, { 15, 16 } },
+    { /* 41 */ 0, { 16, 17 } },
+    { /* 42 */ 0, { 17, 18 } },
+    { /* 43 */ 0, { 18, 19 } },
+    { /* 44 */ 0, { 19, 20 } },
+    { /* 45 */ 0, { 20, 21 } },
+    { /* 46 */ 0, { 21, 22 } },
+    { /* 47 */ 0, { 22, 23 } },
+    { /* 48 */ 0, { 23, 24 } },
+    { /* 49 */ 1, { -2, -1 } },
+    { /* 50 */ 1, {  2,  1 } },
+    { /* 51 */ 1, { -1, -2 } },
+    { /* 52 */ 1, {  1,  2 } },
+    { /* 53 */ 1, { -2,  1 } },
+    { /* 54 */ 1, {  2, -1 } },
+    { /* 55 */ 1, { -1,  2 } },
+    { /* 56 */ 1, {  1, -2 } },
+    { /* 57 */ 1, { -3,  0 } },
+    { /* 58 */ 1, {  3,  0 } },
+    { /* 59 */ 1, {  0, -3 } },
+    { /* 60 */ 1, {  0,  3 } },
+    { /* 61 */ 0, { 12, 13 } },
+    { /* 62 */ 0, { 13, 14 } },
+    { /* 63 */ 0, { 14, 15 } },
+    { /* 64 */ 0, { 15, 16 } },
+    { /* 65 */ 0, { 16, 17 } },
+    { /* 66 */ 0, { 17, 18 } },
+    { /* 67 */ 0, { 18, 19 } },
+    { /* 68 */ 0, { 19, 20 } },
+    { /* 69 */ 0, { 20, 21 } },
+    { /* 70 */ 0, { 21, 22 } },
+    { /* 71 */ 0, { 22, 23 } },
+    { /* 72 */ 0, { 23, 24 } },
+    { /* 73 */ 1, { -3, -1 } },
+    { /* 74 */ 1, {  1,  3 } },
+    { /* 75 */ 1, {  3,  1 } },
+    { /* 76 */ 1, { -1, -3 } },
+    { /* 77 */ 1, { -3,  1 } },
+    { /* 78 */ 1, {  3, -1 } },
+    { /* 79 */ 1, {  1, -3 } },
+    { /* 80 */ 1, { -1,  3 } },
+    { /* 81 */ 1, { -2,  2 } },
+    { /* 82 */ 1, {  2,  2 } },
+    { /* 83 */ 1, { -2, -2 } },
+    { /* 84 */ 1, {  2, -2 } },
+    { /* 85 */ 0, { 12, 13 } },
+    { /* 86 */ 0, { 13, 14 } },
+    { /* 87 */ 0, { 14, 15 } },
+    { /* 88 */ 0, { 15, 16 } },
+    { /* 89 */ 0, { 16, 17 } },
+    { /* 90 */ 0, { 17, 18 } },
+    { /* 91 */ 0, { 18, 19 } },
+    { /* 92 */ 0, { 19, 20 } },
+    { /* 93 */ 0, { 20, 21 } },
+    { /* 94 */ 0, { 21, 22 } },
+    { /* 95 */ 0, { 22, 23 } },
+    { /* 96 */ 0, { 23, 24 } },
+    { /* 97 */ 1, { -3, -2 } },
+    { /* 98 */ 1, {  3, -2 } },
+    { /* 99 */ 1, { -2,  3 } },
+    { /* 00 */ 1, {  2, -3 } },
+    { /* 01 */ 1, {  3,  2 } },
+    { /* 02 */ 1, {  2,  3 } },
+    { /* 03 */ 1, { -3,  2 } },
+    { /* 04 */ 1, { -2, -3 } },
+    { /* 05 */ 1, {  0, -4 } },
+    { /* 06 */ 1, { -4,  0 } },
+    { /* 07 */ 1, {  4,  1 } },
+    { /* 08 */ 1, {  4,  0 } },
+    { /* 09 */ 0, { 12, 13 } },
+    { /* 10 */ 0, { 13, 14 } },
+    { /* 11 */ 0, { 14, 15 } },
+    { /* 12 */ 0, { 15, 16 } },
+    { /* 13 */ 0, { 16, 17 } },
+    { /* 14 */ 0, { 17, 18 } },
+    { /* 15 */ 0, { 18, 19 } },
+    { /* 16 */ 0, { 19, 20 } },
+    { /* 17 */ 0, { 20, 21 } },
+    { /* 18 */ 0, { 21, 22 } },
+    { /* 19 */ 0, { 22, 23 } },
+    { /* 20 */ 0, { 23, 24 } },
+    { /* 21 */ 1, { -4, -1 } },
+    { /* 22 */ 1, {  0,  4 } },
+    { /* 23 */ 1, {  4, -1 } },
+    { /* 24 */ 1, { -1, -4 } },
+    { /* 25 */ 1, {  1,  4 } },
+    { /* 26 */ 1, { -1,  4 } },
+    { /* 27 */ 1, { -4,  1 } },
+    { /* 28 */ 1, {  1, -4 } },
+    { /* 29 */ 1, {  3, -3 } },
+    { /* 30 */ 1, { -3, -3 } },
+    { /* 31 */ 1, { -3,  3 } },
+    { /* 32 */ 1, { -2,  4 } },
+    { /* 33 */ 1, { -4, -2 } },
+    { /* 34 */ 1, {  4,  2 } },
+    { /* 35 */ 1, {  2, -4 } },
+    { /* 36 */ 1, {  2,  4 } },
+    { /* 37 */ 1, {  3,  3 } },
+    { /* 38 */ 1, { -4,  2 } },
+    { /* 39 */ 0, { 6, 7 } },
+    { /* 40 */ 0, { 7, 8 } },
+    { /* 41 */ 0, { 8, 9 } },
+    { /* 42 */ 0, { 9, 10 } },
+    { /* 43 */ 0, { 10, 11 } },
+    { /* 44 */ 0, { 11, 12 } },
+    { /* 45 */ 1, { -2, -4 } },
+    { /* 46 */ 1, {  4, -2 } },
+    { /* 47 */ 1, {  3, -4 } },
+    { /* 48 */ 1, { -4, -3 } },
+    { /* 49 */ 1, { -4,  3 } },
+    { /* 50 */ 1, {  3,  4 } },
+    { /* 51 */ 1, { -3,  4 } },
+    { /* 52 */ 1, {  4,  3 } },
+    { /* 53 */ 1, {  4, -3 } },
+    { /* 54 */ 1, { -3, -4 } },
+    { /* 55 */ 0, { 2, 3 } },
+    { /* 56 */ 0, { 3, 4 } },
+    { /* 57 */ 1, {  4, -4 } },
+    { /* 58 */ 1, { -4,  4 } },
+    { /* 59 */ 1, {  4,  4 } },
+    { /* 60 */ 1, { -4, -4 } }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/codebook/hcb_6.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,179 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_6.h,v 1.2 2003/07/29 08:20:14 menno Exp $
+**/
+
+/* 2-step huffman table HCB_6 */
+
+
+/* 1st step: 5 bits
+ *           2^5 = 32 entries
+ *
+ * Used to find offset into 2nd step table and number of extra bits to get
+ */
+static hcb hcb6_1[] = {
+    /* 4 bit codewords */
+    { /* 00000 */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /* 00010 */ 1, 0 },
+    { /*       */ 1, 0 },
+    { /* 00100 */ 2, 0 },
+    { /*       */ 2, 0 },
+    { /* 00110 */ 3, 0 },
+    { /*       */ 3, 0 },
+    { /* 01000 */ 4, 0 },
+    { /*       */ 4, 0 },
+    { /* 01010 */ 5, 0 },
+    { /*       */ 5, 0 },
+    { /* 01100 */ 6, 0 },
+    { /*       */ 6, 0 },
+    { /* 01110 */ 7, 0 },
+    { /*       */ 7, 0 },
+    { /* 10000 */ 8, 0 },
+    { /*       */ 8, 0 },
+
+    /* 6 bit codewords */
+    { /* 10010 */ 9, 1 },
+    { /* 10011 */ 11, 1 },
+    { /* 10100 */ 13, 1 },
+    { /* 10101 */ 15, 1 },
+    { /* 10110 */ 17, 1 },
+    { /* 10111 */ 19, 1 },
+    { /* 11000 */ 21, 1 },
+    { /* 11001 */ 23, 1 },
+
+    /* 7 bit codewords */
+    { /* 11010 */ 25, 2 },
+    { /* 11011 */ 29, 2 },
+    { /* 11100 */ 33, 2 },
+
+    /* 7/8 bit codewords */
+    { /* 11101 */ 37, 3 },
+
+    /* 8/9 bit codewords */
+    { /* 11110 */ 45, 4 },
+
+    /* 9/10/11 bit codewords */
+    { /* 11111 */ 61, 6 }
+};
+
+/* 2nd step table
+ *
+ * Gives size of codeword and actual data (x,y,v,w)
+ */
+static hcb_2_pair hcb6_2[] = {
+    /* 4 bit codewords */
+    { 4,  0,  0 },
+    { 4,  1,  0 },
+    { 4,  0, -1 },
+    { 4,  0,  1 },
+    { 4, -1,  0 },
+    { 4,  1,  1 },
+    { 4, -1,  1 },
+    { 4,  1, -1 },
+    { 4, -1, -1 },
+
+    /* 6 bit codewords */
+    { 6,  2, -1 },
+    { 6,  2,  1 },
+    { 6, -2,  1 },
+    { 6, -2, -1 },
+    { 6, -2,  0 },
+    { 6, -1,  2 },
+    { 6,  2,  0 },
+    { 6,  1, -2 },
+    { 6,  1,  2 },
+    { 6,  0, -2 },
+    { 6, -1, -2 },
+    { 6,  0,  2 },
+    { 6,  2, -2 },
+    { 6, -2,  2 },
+    { 6, -2, -2 },
+    { 6,  2,  2 },
+
+    /* 7 bit codewords */
+    { 7, -3,  1 },
+    { 7,  3,  1 },
+    { 7,  3, -1 },
+    { 7, -1,  3 },
+    { 7, -3, -1 },
+    { 7,  1,  3 },
+    { 7,  1, -3 },
+    { 7, -1, -3 },
+    { 7,  3,  0 },
+    { 7, -3,  0 },
+    { 7,  0, -3 },
+    { 7,  0,  3 },
+
+    /* 7/8 bit codewords */
+    { 7,  3,  2 }, { 7,  3,  2 },
+    { 8, -3, -2 },
+    { 8, -2,  3 },
+    { 8,  2,  3 },
+    { 8,  3, -2 },
+    { 8,  2, -3 },
+    { 8, -2, -3 },
+
+    /* 8 bit codewords */
+    { 8, -3,  2 }, { 8, -3,  2 },
+    { 8,  3,  3 }, { 8,  3,  3 },
+    { 9,  3, -3 },
+    { 9, -3, -3 },
+    { 9, -3,  3 },
+    { 9,  1, -4 },
+    { 9, -1, -4 },
+    { 9,  4,  1 },
+    { 9, -4,  1 },
+    { 9, -4, -1 },
+    { 9,  1,  4 },
+    { 9,  4, -1 },
+    { 9, -1,  4 },
+    { 9,  0, -4 },
+
+    /* 9/10/11 bit codewords */
+    { 9, -4,  2 }, { 9, -4,  2 }, { 9, -4,  2 }, { 9, -4,  2 },
+    { 9, -4, -2 }, { 9, -4, -2 }, { 9, -4, -2 }, { 9, -4, -2 },
+    { 9,  2,  4 }, { 9,  2,  4 }, { 9,  2,  4 }, { 9,  2,  4 },
+    { 9, -2, -4 }, { 9, -2, -4 }, { 9, -2, -4 }, { 9, -2, -4 },
+    { 9, -4,  0 }, { 9, -4,  0 }, { 9, -4,  0 }, { 9, -4,  0 },
+    { 9,  4,  2 }, { 9,  4,  2 }, { 9,  4,  2 }, { 9,  4,  2 },
+    { 9,  4, -2 }, { 9,  4, -2 }, { 9,  4, -2 }, { 9,  4, -2 },
+    { 9, -2,  4 }, { 9, -2,  4 }, { 9, -2,  4 }, { 9, -2,  4 },
+    { 9,  4,  0 }, { 9,  4,  0 }, { 9,  4,  0 }, { 9,  4,  0 },
+    { 9,  2, -4 }, { 9,  2, -4 }, { 9,  2, -4 }, { 9,  2, -4 },
+    { 9,  0,  4 }, { 9,  0,  4 }, { 9,  0,  4 }, { 9,  0,  4 },
+    { 10, -3, -4 }, { 10, -3, -4 },
+    { 10, -3,  4 }, { 10, -3,  4 },
+    { 10,  3, -4 }, { 10,  3, -4 },
+    { 10,  4, -3 }, { 10,  4, -3 },
+    { 10,  3,  4 }, { 10,  3,  4 },
+    { 10,  4,  3 }, { 10,  4,  3 },
+    { 10, -4,  3 }, { 10, -4,  3 },
+    { 10, -4, -3 }, { 10, -4, -3 },
+    { 11,  4,  4 },
+    { 11, -4,  4 },
+    { 11, -4, -4 },
+    { 11,  4, -4 }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/codebook/hcb_7.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,159 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_7.h,v 1.2 2003/07/29 08:20:14 menno Exp $
+**/
+
+/* Binary search huffman table HCB_7 */
+
+
+static hcb_bin_pair hcb7[] = {
+    { /*  0 */ 0, { 1, 2 } },
+    { /*  1 */ 1, { 0, 0 } },
+    { /*  2 */ 0, { 1, 2 } },
+    { /*  3 */ 0, { 2, 3 } },
+    { /*  4 */ 0, { 3, 4 } },
+    { /*  5 */ 1, { 1, 0 } },
+    { /*  6 */ 1, { 0, 1 } },
+    { /*  7 */ 0, { 2, 3 } },
+    { /*  8 */ 0, { 3, 4 } },
+    { /*  9 */ 1, { 1,  1 } },
+    { /* 10 */ 0, { 3, 4 } },
+    { /* 11 */ 0, { 4, 5 } },
+    { /* 12 */ 0, { 5, 6 } },
+    { /* 13 */ 0, { 6, 7 } },
+    { /* 14 */ 0, { 7, 8 } },
+    { /* 15 */ 0, { 8, 9 } },
+    { /* 16 */ 0, { 9, 10 } },
+    { /* 17 */ 0, { 10, 11 } },
+    { /* 18 */ 0, { 11, 12 } },
+    { /* 19 */ 1, { 2,  1 } },
+    { /* 20 */ 1, { 1,  2 } },
+    { /* 21 */ 1, { 2,  0 } },
+    { /* 22 */ 1, { 0,  2 } },
+    { /* 23 */ 0, { 8, 9 } },
+    { /* 24 */ 0, { 9, 10 } },
+    { /* 25 */ 0, { 10, 11 } },
+    { /* 26 */ 0, { 11, 12 } },
+    { /* 27 */ 0, { 12, 13 } },
+    { /* 28 */ 0, { 13, 14 } },
+    { /* 29 */ 0, { 14, 15 } },
+    { /* 30 */ 0, { 15, 16 } },
+    { /* 31 */ 1, { 3,  1 } },
+    { /* 32 */ 1, { 1,  3 } },
+    { /* 33 */ 1, { 2,  2 } },
+    { /* 34 */ 1, { 3,  0 } },
+    { /* 35 */ 1, { 0,  3 } },
+    { /* 36 */ 0, { 11, 12 } },
+    { /* 37 */ 0, { 12, 13 } },
+    { /* 38 */ 0, { 13, 14 } },
+    { /* 39 */ 0, { 14, 15 } },
+    { /* 40 */ 0, { 15, 16 } },
+    { /* 41 */ 0, { 16, 17 } },
+    { /* 42 */ 0, { 17, 18 } },
+    { /* 43 */ 0, { 18, 19 } },
+    { /* 44 */ 0, { 19, 20 } },
+    { /* 45 */ 0, { 20, 21 } },
+    { /* 46 */ 0, { 21, 22 } },
+    { /* 47 */ 1, { 2,  3 } },
+    { /* 48 */ 1, { 3,  2 } },
+    { /* 49 */ 1, { 1,  4 } },
+    { /* 50 */ 1, { 4,  1 } },
+    { /* 51 */ 1, { 1,  5 } },
+    { /* 52 */ 1, { 5,  1 } },
+    { /* 53 */ 1, { 3,  3 } },
+    { /* 54 */ 1, { 2,  4 } },
+    { /* 55 */ 1, { 0,  4 } },
+    { /* 56 */ 1, { 4,  0 } },
+    { /* 57 */ 0, { 12, 13 } },
+    { /* 58 */ 0, { 13, 14 } },
+    { /* 59 */ 0, { 14, 15 } },
+    { /* 60 */ 0, { 15, 16 } },
+    { /* 61 */ 0, { 16, 17 } },
+    { /* 62 */ 0, { 17, 18 } },
+    { /* 63 */ 0, { 18, 19 } },
+    { /* 64 */ 0, { 19, 20 } },
+    { /* 65 */ 0, { 20, 21 } },
+    { /* 66 */ 0, { 21, 22 } },
+    { /* 67 */ 0, { 22, 23 } },
+    { /* 68 */ 0, { 23, 24 } },
+    { /* 69 */ 1, { 4,  2 } },
+    { /* 70 */ 1, { 2,  5 } },
+    { /* 71 */ 1, { 5,  2 } },
+    { /* 72 */ 1, { 0,  5 } },
+    { /* 73 */ 1, { 6,  1 } },
+    { /* 74 */ 1, { 5,  0 } },
+    { /* 75 */ 1, { 1,  6 } },
+    { /* 76 */ 1, { 4,  3 } },
+    { /* 77 */ 1, { 3,  5 } },
+    { /* 78 */ 1, { 3,  4 } },
+    { /* 79 */ 1, { 5,  3 } },
+    { /* 80 */ 1, { 2,  6 } },
+    { /* 81 */ 1, { 6,  2 } },
+    { /* 82 */ 1, { 1,  7 } },
+    { /* 83 */ 0, { 10, 11 } },
+    { /* 84 */ 0, { 11, 12 } },
+    { /* 85 */ 0, { 12, 13 } },
+    { /* 86 */ 0, { 13, 14 } },
+    { /* 87 */ 0, { 14, 15 } },
+    { /* 88 */ 0, { 15, 16 } },
+    { /* 89 */ 0, { 16, 17 } },
+    { /* 90 */ 0, { 17, 18 } },
+    { /* 91 */ 0, { 18, 19 } },
+    { /* 92 */ 0, { 19, 20 } },
+    { /* 93 */ 1, { 3,  6 } },
+    { /* 94 */ 1, { 0,  6 } },
+    { /* 95 */ 1, { 6,  0 } },
+    { /* 96 */ 1, { 4,  4 } },
+    { /* 97 */ 1, { 7,  1 } },
+    { /* 98 */ 1, { 4,  5 } },
+    { /* 99 */ 1, { 7,  2 } },
+    { /* 00 */ 1, { 5,  4 } },
+    { /* 01 */ 1, { 6,  3 } },
+    { /* 02 */ 1, { 2,  7 } },
+    { /* 03 */ 1, { 7,  3 } },
+    { /* 04 */ 1, { 6,  4 } },
+    { /* 05 */ 1, { 5,  5 } },
+    { /* 06 */ 1, { 4,  6 } },
+    { /* 07 */ 1, { 3,  7 } },
+    { /* 08 */ 0, { 5, 6 } },
+    { /* 09 */ 0, { 6, 7 } },
+    { /* 10 */ 0, { 7, 8 } },
+    { /* 11 */ 0, { 8, 9 } },
+    { /* 12 */ 0, { 9, 10 } },
+    { /* 13 */ 1, { 7,  0 } },
+    { /* 14 */ 1, { 0,  7 } },
+    { /* 15 */ 1, { 6,  5 } },
+    { /* 16 */ 1, { 5,  6 } },
+    { /* 17 */ 1, { 7,  4 } },
+    { /* 18 */ 1, { 4,  7 } },
+    { /* 19 */ 1, { 5,  7 } },
+    { /* 20 */ 1, { 7,  5 } },
+    { /* 21 */ 0, { 2, 3 } },
+    { /* 22 */ 0, { 3, 4 } },
+    { /* 23 */ 1, { 7,  6 } },
+    { /* 24 */ 1, { 6,  6 } },
+    { /* 25 */ 1, { 6,  7 } },
+    { /* 26 */ 1, { 7,  7 } }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/codebook/hcb_8.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,170 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_8.h,v 1.2 2003/07/29 08:20:14 menno Exp $
+**/
+
+/* 2-step huffman table HCB_8 */
+
+
+/* 1st step: 5 bits
+ *           2^5 = 32 entries
+ *
+ * Used to find offset into 2nd step table and number of extra bits to get
+ */
+static hcb hcb8_1[] = {
+    /* 3 bit codeword */
+    { /* 00000 */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /*       */ 0, 0 },
+    { /*       */ 0, 0 },
+
+    /* 4 bit codewords */
+    { /* 00100 */ 1, 0 },
+    { /*       */ 1, 0 },
+    { /* 00110 */ 2, 0 },
+    { /*       */ 2, 0 },
+    { /* 01000 */ 3, 0 },
+    { /*       */ 3, 0 },
+    { /* 01010 */ 4, 0 },
+    { /*       */ 4, 0 },
+    { /* 01100 */ 5, 0 },
+    { /*       */ 5, 0 },
+
+    /* 5 bit codewords */
+    { /* 01110 */ 6, 0 },
+    { /* 01111 */ 7, 0 },
+    { /* 10000 */ 8, 0 },
+    { /* 10001 */ 9, 0 },
+    { /* 10010 */ 10, 0 },
+    { /* 10011 */ 11, 0 },
+    { /* 10100 */ 12, 0 },
+
+    /* 6 bit codewords */
+    { /* 10101 */ 13, 1 },
+    { /* 10110 */ 15, 1 },
+    { /* 10111 */ 17, 1 },
+    { /* 11000 */ 19, 1 },
+    { /* 11001 */ 21, 1 },
+
+    /* 7 bit codewords */
+    { /* 11010 */ 23, 2 },
+    { /* 11011 */ 27, 2 },
+    { /* 11100 */ 31, 2 },
+
+    /* 7/8 bit codewords */
+    { /* 11101 */ 35, 3 },
+
+    /* 8 bit codewords */
+    { /* 11110 */ 43, 3 },
+
+    /* 8/9/10 bit codewords */
+    { /* 11111 */ 51, 5 }
+};
+
+/* 2nd step table
+ *
+ * Gives size of codeword and actual data (x,y,v,w)
+ */
+static hcb_2_pair hcb8_2[] = {
+    /* 3 bit codeword */
+    { 3,  1,  1 },
+
+    /* 4 bit codewords */
+    { 4,  2,  1 },
+    { 4,  1,  0 },
+    { 4,  1,  2 },
+    { 4,  0,  1 },
+    { 4,  2,  2 },
+
+    /* 5 bit codewords */
+    { 5,  0,  0 },
+    { 5,  2,  0 },
+    { 5,  0,  2 },
+    { 5,  3,  1 },
+    { 5,  1,  3 },
+    { 5,  3,  2 },
+    { 5,  2,  3 },
+
+    /* 6 bit codewords */
+    { 6,  3,  3 },
+    { 6,  4,  1 },
+    { 6,  1,  4 },
+    { 6,  4,  2 },
+    { 6,  2,  4 },
+    { 6,  3,  0 },
+    { 6,  0,  3 },
+    { 6,  4,  3 },
+    { 6,  3,  4 },
+    { 6,  5,  2 },
+
+    /* 7 bit codewords */
+    { 7,  5,  1 },
+    { 7,  2,  5 },
+    { 7,  1,  5 },
+    { 7,  5,  3 },
+    { 7,  3,  5 },
+    { 7,  4,  4 },
+    { 7,  5,  4 },
+    { 7,  0,  4 },
+    { 7,  4,  5 },
+    { 7,  4,  0 },
+    { 7,  2,  6 },
+    { 7,  6,  2 },
+
+    /* 7/8 bit codewords */
+    { 7,  6,  1 }, { 7,  6,  1 },
+    { 7,  1,  6 }, { 7,  1,  6 },
+    { 8,  3,  6 },
+    { 8,  6,  3 },
+    { 8,  5,  5 },
+    { 8,  5,  0 },
+
+    /* 8 bit codewords */
+    { 8,  6,  4 },
+    { 8,  0,  5 },
+    { 8,  4,  6 },
+    { 8,  7,  1 },
+    { 8,  7,  2 },
+    { 8,  2,  7 },
+    { 8,  6,  5 },
+    { 8,  7,  3 },
+
+    /* 8/9/10 bit codewords */
+    { 8,  1,  7 }, { 8,  1,  7 }, { 8,  1,  7 }, { 8,  1,  7 },
+    { 8,  5,  6 }, { 8,  5,  6 }, { 8,  5,  6 }, { 8,  5,  6 },
+    { 8,  3,  7 }, { 8,  3,  7 }, { 8,  3,  7 }, { 8,  3,  7 },
+    { 9,  6,  6 }, { 9,  6,  6 },
+    { 9,  7,  4 }, { 9,  7,  4 },
+    { 9,  6,  0 }, { 9,  6,  0 },
+    { 9,  4,  7 }, { 9,  4,  7 },
+    { 9,  0,  6 }, { 9,  0,  6 },
+    { 9,  7,  5 }, { 9,  7,  5 },
+    { 9,  7,  6 }, { 9,  7,  6 },
+    { 9,  6,  7 }, { 9,  6,  7 },
+    { 10,  5,  7 },
+    { 10,  7,  0 },
+    { 10,  0,  7 },
+    { 10,  7,  7 }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/codebook/hcb_9.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,369 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_9.h,v 1.2 2003/07/29 08:20:14 menno Exp $
+**/
+
+/* Binary search huffman table HCB_9 */
+
+
+static hcb_bin_pair hcb9[] = {
+    { /*  0 */ 0, { 1, 2 } },
+    { /*  1 */ 1, { 0, 0 } },
+    { /*  2 */ 0, { 1, 2 } },
+    { /*  3 */ 0, { 2, 3 } },
+    { /*  4 */ 0, { 3, 4 } },
+    { /*  5 */ 1, { 1,  0 } },
+    { /*  6 */ 1, { 0,  1 } },
+    { /*  7 */ 0, { 2, 3 } },
+    { /*  8 */ 0, { 3, 4 } },
+    { /*  9 */ 1, { 1,  1 } },
+    { /* 10 */ 0, { 3, 4 } },
+    { /* 11 */ 0, { 4, 5 } },
+    { /* 12 */ 0, { 5, 6 } },
+    { /* 13 */ 0, { 6, 7 } },
+    { /* 14 */ 0, { 7, 8 } },
+    { /* 15 */ 0, { 8, 9 } },
+    { /* 16 */ 0, { 9, 10 } },
+    { /* 17 */ 0, { 10, 11 } },
+    { /* 18 */ 0, { 11, 12 } },
+    { /* 19 */ 1, { 2,  1 } },
+    { /* 20 */ 1, { 1,  2 } },
+    { /* 21 */ 1, { 2,  0 } },
+    { /* 22 */ 1, { 0,  2 } },
+    { /* 23 */ 0, { 8, 9 } },
+    { /* 24 */ 0, { 9, 10 } },
+    { /* 25 */ 0, { 10, 11 } },
+    { /* 26 */ 0, { 11, 12 } },
+    { /* 27 */ 0, { 12, 13 } },
+    { /* 28 */ 0, { 13, 14 } },
+    { /* 29 */ 0, { 14, 15 } },
+    { /* 30 */ 0, { 15, 16 } },
+    { /* 31 */ 1, { 3,  1 } },
+    { /* 32 */ 1, { 2,  2 } },
+    { /* 33 */ 1, { 1,  3 } },
+    { /* 34 */ 0, { 13, 14 } },
+    { /* 35 */ 0, { 14, 15 } },
+    { /* 36 */ 0, { 15, 16 } },
+    { /* 37 */ 0, { 16, 17 } },
+    { /* 38 */ 0, { 17, 18 } },
+    { /* 39 */ 0, { 18, 19 } },
+    { /* 40 */ 0, { 19, 20 } },
+    { /* 41 */ 0, { 20, 21 } },
+    { /* 42 */ 0, { 21, 22 } },
+    { /* 43 */ 0, { 22, 23 } },
+    { /* 44 */ 0, { 23, 24 } },
+    { /* 45 */ 0, { 24, 25 } },
+    { /* 46 */ 0, { 25, 26 } },
+    { /* 47 */ 1, { 3,  0 } },
+    { /* 48 */ 1, { 0,  3 } },
+    { /* 49 */ 1, { 2,  3 } },
+    { /* 50 */ 1, { 3,  2 } },
+    { /* 51 */ 1, { 1,  4 } },
+    { /* 52 */ 1, { 4,  1 } },
+    { /* 53 */ 1, { 2,  4 } },
+    { /* 54 */ 1, { 1,  5 } },
+    { /* 55 */ 0, { 18, 19 } },
+    { /* 56 */ 0, { 19, 20 } },
+    { /* 57 */ 0, { 20, 21 } },
+    { /* 58 */ 0, { 21, 22 } },
+    { /* 59 */ 0, { 22, 23 } },
+    { /* 60 */ 0, { 23, 24 } },
+    { /* 61 */ 0, { 24, 25 } },
+    { /* 62 */ 0, { 25, 26 } },
+    { /* 63 */ 0, { 26, 27 } },
+    { /* 64 */ 0, { 27, 28 } },
+    { /* 65 */ 0, { 28, 29 } },
+    { /* 66 */ 0, { 29, 30 } },
+    { /* 67 */ 0, { 30, 31 } },
+    { /* 68 */ 0, { 31, 32 } },
+    { /* 69 */ 0, { 32, 33 } },
+    { /* 70 */ 0, { 33, 34 } },
+    { /* 71 */ 0, { 34, 35 } },
+    { /* 72 */ 0, { 35, 36 } },
+    { /* 73 */ 1, { 4,  2 } },
+    { /* 74 */ 1, { 3,  3 } },
+    { /* 75 */ 1, { 0,  4 } },
+    { /* 76 */ 1, { 4,  0 } },
+    { /* 77 */ 1, { 5,  1 } },
+    { /* 78 */ 1, { 2,  5 } },
+    { /* 79 */ 1, { 1,  6 } },
+    { /* 80 */ 1, { 3,  4 } },
+    { /* 81 */ 1, { 5,  2 } },
+    { /* 82 */ 1, { 6,  1 } },
+    { /* 83 */ 1, { 4,  3 } },
+    { /* 84 */ 0, { 25, 26 } },
+    { /* 85 */ 0, { 26, 27 } },
+    { /* 86 */ 0, { 27, 28 } },
+    { /* 87 */ 0, { 28, 29 } },
+    { /* 88 */ 0, { 29, 30 } },
+    { /* 89 */ 0, { 30, 31 } },
+    { /* 90 */ 0, { 31, 32 } },
+    { /* 91 */ 0, { 32, 33 } },
+    { /* 92 */ 0, { 33, 34 } },
+    { /* 93 */ 0, { 34, 35 } },
+    { /* 94 */ 0, { 35, 36 } },
+    { /* 95 */ 0, { 36, 37 } },
+    { /* 96 */ 0, { 37, 38 } },
+    { /* 97 */ 0, { 38, 39 } },
+    { /* 98 */ 0, { 39, 40 } },
+    { /* 99 */ 0, { 40, 41 } },
+    { /* 00 */ 0, { 41, 42 } },
+    { /* 01 */ 0, { 42, 43 } },
+    { /* 02 */ 0, { 43, 44 } },
+    { /* 03 */ 0, { 44, 45 } },
+    { /* 04 */ 0, { 45, 46 } },
+    { /* 05 */ 0, { 46, 47 } },
+    { /* 06 */ 0, { 47, 48 } },
+    { /* 07 */ 0, { 48, 49 } },
+    { /* 08 */ 0, { 49, 50 } },
+    { /* 09 */ 1, { 0,  5 } },
+    { /* 10 */ 1, { 2,  6 } },
+    { /* 11 */ 1, { 5,  0 } },
+    { /* 12 */ 1, { 1,  7 } },
+    { /* 13 */ 1, { 3,  5 } },
+    { /* 14 */ 1, { 1,  8 } },
+    { /* 15 */ 1, { 8,  1 } },
+    { /* 16 */ 1, { 4,  4 } },
+    { /* 17 */ 1, { 5,  3 } },
+    { /* 18 */ 1, { 6,  2 } },
+    { /* 19 */ 1, { 7,  1 } },
+    { /* 20 */ 1, { 0,  6 } },
+    { /* 21 */ 1, { 8,  2 } },
+    { /* 22 */ 1, { 2,  8 } },
+    { /* 23 */ 1, { 3,  6 } },
+    { /* 24 */ 1, { 2,  7 } },
+    { /* 25 */ 1, { 4,  5 } },
+    { /* 26 */ 1, { 9,  1 } },
+    { /* 27 */ 1, { 1,  9 } },
+    { /* 28 */ 1, { 7,  2 } },
+    { /* 29 */ 0, { 30, 31 } },
+    { /* 30 */ 0, { 31, 32 } },
+    { /* 31 */ 0, { 32, 33 } },
+    { /* 32 */ 0, { 33, 34 } },
+    { /* 33 */ 0, { 34, 35 } },
+    { /* 34 */ 0, { 35, 36 } },
+    { /* 35 */ 0, { 36, 37 } },
+    { /* 36 */ 0, { 37, 38 } },
+    { /* 37 */ 0, { 38, 39 } },
+    { /* 38 */ 0, { 39, 40 } },
+    { /* 39 */ 0, { 40, 41 } },
+    { /* 40 */ 0, { 41, 42 } },
+    { /* 41 */ 0, { 42, 43 } },
+    { /* 42 */ 0, { 43, 44 } },
+    { /* 43 */ 0, { 44, 45 } },
+    { /* 44 */ 0, { 45, 46 } },
+    { /* 45 */ 0, { 46, 47 } },
+    { /* 46 */ 0, { 47, 48 } },
+    { /* 47 */ 0, { 48, 49 } },
+    { /* 48 */ 0, { 49, 50 } },
+    { /* 49 */ 0, { 50, 51 } },
+    { /* 50 */ 0, { 51, 52 } },
+    { /* 51 */ 0, { 52, 53 } },
+    { /* 52 */ 0, { 53, 54 } },
+    { /* 53 */ 0, { 54, 55 } },
+    { /* 54 */ 0, { 55, 56 } },
+    { /* 55 */ 0, { 56, 57 } },
+    { /* 56 */ 0, { 57, 58 } },
+    { /* 57 */ 0, { 58, 59 } },
+    { /* 58 */ 0, { 59, 60 } },
+    { /* 59 */ 1, {  6,  0 } },
+    { /* 60 */ 1, {  5,  4 } },
+    { /* 61 */ 1, {  6,  3 } },
+    { /* 62 */ 1, {  8,  3 } },
+    { /* 63 */ 1, {  0,  7 } },
+    { /* 64 */ 1, {  9,  2 } },
+    { /* 65 */ 1, {  3,  8 } },
+    { /* 66 */ 1, {  4,  6 } },
+    { /* 67 */ 1, {  3,  7 } },
+    { /* 68 */ 1, {  0,  8 } },
+    { /* 69 */ 1, { 10,  1 } },
+    { /* 70 */ 1, {  6,  4 } },
+    { /* 71 */ 1, {  2,  9 } },
+    { /* 72 */ 1, {  5,  5 } },
+    { /* 73 */ 1, {  8,  0 } },
+    { /* 74 */ 1, {  7,  0 } },
+    { /* 75 */ 1, {  7,  3 } },
+    { /* 76 */ 1, { 10,  2 } },
+    { /* 77 */ 1, {  9,  3 } },
+    { /* 78 */ 1, {  8,  4 } },
+    { /* 79 */ 1, {  1, 10 } },
+    { /* 80 */ 1, {  7,  4 } },
+    { /* 81 */ 1, {  6,  5 } },
+    { /* 82 */ 1, {  5,  6 } },
+    { /* 83 */ 1, {  4,  8 } },
+    { /* 84 */ 1, {  4,  7 } },
+    { /* 85 */ 1, {  3,  9 } },
+    { /* 86 */ 1, { 11,  1 } },
+    { /* 87 */ 1, {  5,  8 } },
+    { /* 88 */ 1, {  9,  0 } },
+    { /* 89 */ 1, {  8,  5 } },
+    { /* 90 */ 0, { 29, 30 } },
+    { /* 91 */ 0, { 30, 31 } },
+    { /* 92 */ 0, { 31, 32 } },
+    { /* 93 */ 0, { 32, 33 } },
+    { /* 94 */ 0, { 33, 34 } },
+    { /* 95 */ 0, { 34, 35 } },
+    { /* 96 */ 0, { 35, 36 } },
+    { /* 97 */ 0, { 36, 37 } },
+    { /* 98 */ 0, { 37, 38 } },
+    { /* 99 */ 0, { 38, 39 } },
+    { /* 00 */ 0, { 39, 40 } },
+    { /* 01 */ 0, { 40, 41 } },
+    { /* 02 */ 0, { 41, 42 } },
+    { /* 03 */ 0, { 42, 43 } },
+    { /* 04 */ 0, { 43, 44 } },
+    { /* 05 */ 0, { 44, 45 } },
+    { /* 06 */ 0, { 45, 46 } },
+    { /* 07 */ 0, { 46, 47 } },
+    { /* 08 */ 0, { 47, 48 } },
+    { /* 09 */ 0, { 48, 49 } },
+    { /* 10 */ 0, { 49, 50 } },
+    { /* 11 */ 0, { 50, 51 } },
+    { /* 12 */ 0, { 51, 52 } },
+    { /* 13 */ 0, { 52, 53 } },
+    { /* 14 */ 0, { 53, 54 } },
+    { /* 15 */ 0, { 54, 55 } },
+    { /* 16 */ 0, { 55, 56 } },
+    { /* 17 */ 0, { 56, 57 } },
+    { /* 18 */ 0, { 57, 58 } },
+    { /* 19 */ 1, { 10,  3 } },
+    { /* 20 */ 1, {  2, 10 } },
+    { /* 21 */ 1, {  0,  9 } },
+    { /* 22 */ 1, { 11,  2 } },
+    { /* 23 */ 1, {  9,  4 } },
+    { /* 24 */ 1, {  6,  6 } },
+    { /* 25 */ 1, { 12,  1 } },
+    { /* 26 */ 1, {  4,  9 } },
+    { /* 27 */ 1, {  8,  6 } },
+    { /* 28 */ 1, {  1, 11 } },
+    { /* 29 */ 1, {  9,  5 } },
+    { /* 30 */ 1, { 10,  4 } },
+    { /* 31 */ 1, {  5,  7 } },
+    { /* 32 */ 1, {  7,  5 } },
+    { /* 33 */ 1, {  2, 11 } },
+    { /* 34 */ 1, {  1, 12 } },
+    { /* 35 */ 1, { 12,  2 } },
+    { /* 36 */ 1, { 11,  3 } },
+    { /* 37 */ 1, {  3, 10 } },
+    { /* 38 */ 1, {  5,  9 } },
+    { /* 39 */ 1, {  6,  7 } },
+    { /* 40 */ 1, {  8,  7 } },
+    { /* 41 */ 1, { 11,  4 } },
+    { /* 42 */ 1, {  0, 10 } },
+    { /* 43 */ 1, {  7,  6 } },
+    { /* 44 */ 1, { 12,  3 } },
+    { /* 45 */ 1, { 10,  0 } },
+    { /* 46 */ 1, { 10,  5 } },
+    { /* 47 */ 1, {  4, 10 } },
+    { /* 48 */ 1, {  6,  8 } },
+    { /* 49 */ 1, {  2, 12 } },
+    { /* 50 */ 1, {  9,  6 } },
+    { /* 51 */ 1, {  9,  7 } },
+    { /* 52 */ 1, {  4, 11 } },
+    { /* 53 */ 1, { 11,  0 } },
+    { /* 54 */ 1, {  6,  9 } },
+    { /* 55 */ 1, {  3, 11 } },
+    { /* 56 */ 1, {  5, 10 } },
+    { /* 57 */ 0, { 20, 21 } },
+    { /* 58 */ 0, { 21, 22 } },
+    { /* 59 */ 0, { 22, 23 } },
+    { /* 60 */ 0, { 23, 24 } },
+    { /* 61 */ 0, { 24, 25 } },
+    { /* 62 */ 0, { 25, 26 } },
+    { /* 63 */ 0, { 26, 27 } },
+    { /* 64 */ 0, { 27, 28 } },
+    { /* 65 */ 0, { 28, 29 } },
+    { /* 66 */ 0, { 29, 30 } },
+    { /* 67 */ 0, { 30, 31 } },
+    { /* 68 */ 0, { 31, 32 } },
+    { /* 69 */ 0, { 32, 33 } },
+    { /* 70 */ 0, { 33, 34 } },
+    { /* 71 */ 0, { 34, 35 } },
+    { /* 72 */ 0, { 35, 36 } },
+    { /* 73 */ 0, { 36, 37 } },
+    { /* 74 */ 0, { 37, 38 } },
+    { /* 75 */ 0, { 38, 39 } },
+    { /* 76 */ 0, { 39, 40 } },
+    { /* 77 */ 1, {  8,  8 } },
+    { /* 78 */ 1, {  7,  8 } },
+    { /* 79 */ 1, { 12,  5 } },
+    { /* 80 */ 1, {  3, 12 } },
+    { /* 81 */ 1, { 11,  5 } },
+    { /* 82 */ 1, {  7,  7 } },
+    { /* 83 */ 1, { 12,  4 } },
+    { /* 84 */ 1, { 11,  6 } },
+    { /* 85 */ 1, { 10,  6 } },
+    { /* 86 */ 1, {  4, 12 } },
+    { /* 87 */ 1, {  7,  9 } },
+    { /* 88 */ 1, {  5, 11 } },
+    { /* 89 */ 1, {  0, 11 } },
+    { /* 90 */ 1, { 12,  6 } },
+    { /* 91 */ 1, {  6, 10 } },
+    { /* 92 */ 1, { 12,  0 } },
+    { /* 93 */ 1, { 10,  7 } },
+    { /* 94 */ 1, {  5, 12 } },
+    { /* 95 */ 1, {  7, 10 } },
+    { /* 96 */ 1, {  9,  8 } },
+    { /* 97 */ 1, {  0, 12 } },
+    { /* 98 */ 1, { 11,  7 } },
+    { /* 99 */ 1, {  8,  9 } },
+    { /* 00 */ 1, {  9,  9 } },
+    { /* 01 */ 1, { 10,  8 } },
+    { /* 02 */ 1, {  7, 11 } },
+    { /* 03 */ 1, { 12,  7 } },
+    { /* 04 */ 1, {  6, 11 } },
+    { /* 05 */ 1, {  8, 11 } },
+    { /* 06 */ 1, { 11,  8 } },
+    { /* 07 */ 1, {  7, 12 } },
+    { /* 08 */ 1, {  6, 12 } },
+    { /* 09 */ 0, { 8, 9 } },
+    { /* 10 */ 0, { 9, 10 } },
+    { /* 11 */ 0, { 10, 11 } },
+    { /* 12 */ 0, { 11, 12 } },
+    { /* 13 */ 0, { 12, 13 } },
+    { /* 14 */ 0, { 13, 14 } },
+    { /* 15 */ 0, { 14, 15 } },
+    { /* 16 */ 0, { 15, 16 } },
+    { /* 17 */ 1, {  8, 10 } },
+    { /* 18 */ 1, { 10,  9 } },
+    { /* 19 */ 1, {  8, 12 } },
+    { /* 20 */ 1, {  9, 10 } },
+    { /* 21 */ 1, {  9, 11 } },
+    { /* 22 */ 1, {  9, 12 } },
+    { /* 23 */ 1, { 10, 11 } },
+    { /* 24 */ 1, { 12,  9 } },
+    { /* 25 */ 1, { 10, 10 } },
+    { /* 26 */ 1, { 11,  9 } },
+    { /* 27 */ 1, { 12,  8 } },
+    { /* 28 */ 1, { 11, 10 } },
+    { /* 29 */ 1, { 12, 10 } },
+    { /* 30 */ 1, { 12, 11 } },
+    { /* 31 */ 0, { 2, 3 } },
+    { /* 32 */ 0, { 3, 4 } },
+    { /* 33 */ 1, { 10, 12 } },
+    { /* 34 */ 1, { 11, 11 } },
+    { /* 35 */ 1, { 11, 12 } },
+    { /* 36 */ 1, { 12, 12 } }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/codebook/hcb_sf.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,273 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_sf.h,v 1.2 2003/07/29 08:20:14 menno Exp $
+**/
+
+/* Binary search huffman table HCB_SF */
+
+
+static uint8_t hcb_sf[][2] = {
+    { /*  0 */  1, 2 },
+    { /*  1 */  60, 0 },
+    { /*  2 */  1, 2 },
+    { /*  3 */  2, 3 },
+    { /*  4 */  3, 4 },
+    { /*  5 */  59, 0 },
+    { /*  6 */  3, 4 },
+    { /*  7 */  4, 5 },
+    { /*  8 */  5, 6 },
+    { /*  9 */  61, 0 },
+    { /* 10 */  58, 0 },
+    { /* 11 */  62, 0 },
+    { /* 12 */  3, 4 },
+    { /* 13 */  4, 5 },
+    { /* 14 */  5, 6 },
+    { /* 15 */  57, 0 },
+    { /* 16 */  63, 0 },
+    { /* 17 */  4, 5 },
+    { /* 18 */  5, 6 },
+    { /* 19 */  6, 7 },
+    { /* 20 */  7, 8 },
+    { /* 21 */  56, 0 },
+    { /* 22 */  64, 0 },
+    { /* 23 */  55, 0 },
+    { /* 24 */  65, 0 },
+    { /* 25 */  4, 5 },
+    { /* 26 */  5, 6 },
+    { /* 27 */  6, 7 },
+    { /* 28 */  7, 8 },
+    { /* 29 */  66, 0 },
+    { /* 30 */  54, 0 },
+    { /* 31 */  67, 0 },
+    { /* 32 */  5, 6 },
+    { /* 33 */  6, 7 },
+    { /* 34 */  7, 8 },
+    { /* 35 */  8, 9 },
+    { /* 36 */  9, 10 },
+    { /* 37 */  53, 0 },
+    { /* 38 */  68, 0 },
+    { /* 39 */  52, 0 },
+    { /* 40 */  69, 0 },
+    { /* 41 */  51, 0 },
+    { /* 42 */  5, 6 },
+    { /* 43 */  6, 7 },
+    { /* 44 */  7, 8 },
+    { /* 45 */  8, 9 },
+    { /* 46 */  9, 10 },
+    { /* 47 */  70, 0 },
+    { /* 48 */  50, 0 },
+    { /* 49 */  49, 0 },
+    { /* 50 */  71, 0 },
+    { /* 51 */  6, 7 },
+    { /* 52 */  7, 8 },
+    { /* 53 */  8, 9 },
+    { /* 54 */  9, 10 },
+    { /* 55 */  10, 11 },
+    { /* 56 */  11, 12 },
+    { /* 57 */  72, 0 },
+    { /* 58 */  48, 0 },
+    { /* 59 */  73, 0 },
+    { /* 60 */  47, 0 },
+    { /* 61 */  74, 0 },
+    { /* 62 */  46, 0 },
+    { /* 63 */  6, 7 },
+    { /* 64 */  7, 8 },
+    { /* 65 */  8, 9 },
+    { /* 66 */  9, 10 },
+    { /* 67 */  10, 11 },
+    { /* 68 */  11, 12 },
+    { /* 69 */  76, 0 },
+    { /* 70 */  75, 0 },
+    { /* 71 */  77, 0 },
+    { /* 72 */  78, 0 },
+    { /* 73 */  45, 0 },
+    { /* 74 */  43, 0 },
+    { /* 75 */  6, 7 },
+    { /* 76 */  7, 8 },
+    { /* 77 */  8, 9 },
+    { /* 78 */  9, 10 },
+    { /* 79 */  10, 11 },
+    { /* 80 */  11, 12 },
+    { /* 81 */  44, 0 },
+    { /* 82 */  79, 0 },
+    { /* 83 */  42, 0 },
+    { /* 84 */  41, 0 },
+    { /* 85 */  80, 0 },
+    { /* 86 */  40, 0 },
+    { /* 87 */  6, 7 },
+    { /* 88 */  7, 8 },
+    { /* 89 */  8, 9 },
+    { /* 90 */  9, 10 },
+    { /* 91 */  10, 11 },
+    { /* 92 */  11, 12 },
+    { /* 93 */  81, 0 },
+    { /* 94 */  39, 0 },
+    { /* 95 */  82, 0 },
+    { /* 96 */  38, 0 },
+    { /* 97 */  83, 0 },
+    { /* 98 */  7, 8 },
+    { /* 99 */  8, 9 },
+    { /* 00 */  9, 10 },
+    { /* 01 */  10, 11 },
+    { /* 02 */  11, 12 },
+    { /* 03 */  12, 13 },
+    { /* 04 */  13, 14 },
+    { /* 05 */  37, 0 },
+    { /* 06 */  35, 0 },
+    { /* 07 */  85, 0 },
+    { /* 08 */  33, 0 },
+    { /* 09 */  36, 0 },
+    { /* 10 */  34, 0 },
+    { /* 11 */  84, 0 },
+    { /* 12 */  32, 0 },
+    { /* 13 */  6, 7 },
+    { /* 14 */  7, 8 },
+    { /* 15 */  8, 9 },
+    { /* 16 */  9, 10 },
+    { /* 17 */  10, 11 },
+    { /* 18 */  11, 12 },
+    { /* 19 */  87, 0 },
+    { /* 20 */  89, 0 },
+    { /* 21 */  30, 0 },
+    { /* 22 */  31, 0 },
+    { /* 23 */  8, 9 },
+    { /* 24 */  9, 10 },
+    { /* 25 */  10, 11 },
+    { /* 26 */  11, 12 },
+    { /* 27 */  12, 13 },
+    { /* 28 */  13, 14 },
+    { /* 29 */  14, 15 },
+    { /* 30 */  15, 16 },
+    { /* 31 */  86, 0 },
+    { /* 32 */  29, 0 },
+    { /* 33 */  26, 0 },
+    { /* 34 */  27, 0 },
+    { /* 35 */  28, 0 },
+    { /* 36 */  24, 0 },
+    { /* 37 */  88, 0 },
+    { /* 38 */  9, 10 },
+    { /* 39 */  10, 11 },
+    { /* 40 */  11, 12 },
+    { /* 41 */  12, 13 },
+    { /* 42 */  13, 14 },
+    { /* 43 */  14, 15 },
+    { /* 44 */  15, 16 },
+    { /* 45 */  16, 17 },
+    { /* 46 */  17, 18 },
+    { /* 47 */  25, 0 },
+    { /* 48 */  22, 0 },
+    { /* 49 */  23, 0 },
+    { /* 50 */  15, 16 },
+    { /* 51 */  16, 17 },
+    { /* 52 */  17, 18 },
+    { /* 53 */  18, 19 },
+    { /* 54 */  19, 20 },
+    { /* 55 */  20, 21 },
+    { /* 56 */  21, 22 },
+    { /* 57 */  22, 23 },
+    { /* 58 */  23, 24 },
+    { /* 59 */  24, 25 },
+    { /* 60 */  25, 26 },
+    { /* 61 */  26, 27 },
+    { /* 62 */  27, 28 },
+    { /* 63 */  28, 29 },
+    { /* 64 */  29, 30 },
+    { /* 65 */  90, 0 },
+    { /* 66 */  21, 0 },
+    { /* 67 */  19, 0 },
+    { /* 68 */   3, 0 },
+    { /* 69 */   1, 0 },
+    { /* 70 */   2, 0 },
+    { /* 71 */   0, 0 },
+    { /* 72 */  23, 24 },
+    { /* 73 */  24, 25 },
+    { /* 74 */  25, 26 },
+    { /* 75 */  26, 27 },
+    { /* 76 */  27, 28 },
+    { /* 77 */  28, 29 },
+    { /* 78 */  29, 30 },
+    { /* 79 */  30, 31 },
+    { /* 80 */  31, 32 },
+    { /* 81 */  32, 33 },
+    { /* 82 */  33, 34 },
+    { /* 83 */  34, 35 },
+    { /* 84 */  35, 36 },
+    { /* 85 */  36, 37 },
+    { /* 86 */  37, 38 },
+    { /* 87 */  38, 39 },
+    { /* 88 */  39, 40 },
+    { /* 89 */  40, 41 },
+    { /* 90 */  41, 42 },
+    { /* 91 */  42, 43 },
+    { /* 92 */  43, 44 },
+    { /* 93 */  44, 45 },
+    { /* 94 */  45, 46 },
+    { /* 95 */   98, 0 },
+    { /* 96 */   99, 0 },
+    { /* 97 */  100, 0 },
+    { /* 98 */  101, 0 },
+    { /* 99 */  102, 0 },
+    { /* 00 */  117, 0 },
+    { /* 01 */   97, 0 },
+    { /* 02 */   91, 0 },
+    { /* 03 */   92, 0 },
+    { /* 04 */   93, 0 },
+    { /* 05 */   94, 0 },
+    { /* 06 */   95, 0 },
+    { /* 07 */   96, 0 },
+    { /* 08 */  104, 0 },
+    { /* 09 */  111, 0 },
+    { /* 10 */  112, 0 },
+    { /* 11 */  113, 0 },
+    { /* 12 */  114, 0 },
+    { /* 13 */  115, 0 },
+    { /* 14 */  116, 0 },
+    { /* 15 */  110, 0 },
+    { /* 16 */  105, 0 },
+    { /* 17 */  106, 0 },
+    { /* 18 */  107, 0 },
+    { /* 19 */  108, 0 },
+    { /* 20 */  109, 0 },
+    { /* 21 */  118, 0 },
+    { /* 22 */    6, 0 },
+    { /* 23 */    8, 0 },
+    { /* 24 */    9, 0 },
+    { /* 25 */   10, 0 },
+    { /* 26 */    5, 0 },
+    { /* 27 */  103, 0 },
+    { /* 28 */  120, 0 },
+    { /* 29 */  119, 0 },
+    { /* 30 */    4, 0 },
+    { /* 31 */    7, 0 },
+    { /* 32 */   15, 0 },
+    { /* 33 */   16, 0 },
+    { /* 34 */   18, 0 },
+    { /* 35 */   20, 0 },
+    { /* 36 */   17, 0 },
+    { /* 37 */   11, 0 },
+    { /* 38 */   12, 0 },
+    { /* 39 */   14, 0 },
+    { /* 40 */   13, 0 }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/common.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,165 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: common.c,v 1.6 2003/07/29 08:20:12 menno Exp $
+**/
+
+/* just some common functions that could be used anywhere */
+
+#include "common.h"
+#include "structs.h"
+
+#include "syntax.h"
+
+/* Returns the sample rate index based on the samplerate */
+uint8_t get_sr_index(uint32_t samplerate)
+{
+    if (16428320 <= samplerate) return 11;
+    if (92017 <= samplerate) return 0;
+    if (75132 <= samplerate) return 1;
+    if (55426 <= samplerate) return 2;
+    if (46009 <= samplerate) return 3;
+    if (37566 <= samplerate) return 4;
+    if (27713 <= samplerate) return 5;
+    if (23004 <= samplerate) return 6;
+    if (18783 <= samplerate) return 7;
+    if (13856 <= samplerate) return 8;
+    if (11502 <= samplerate) return 9;
+    if (9391 <= samplerate) return 10;
+
+    return 11;
+}
+
+/* Returns 0 if an object type is decodable, otherwise returns -1 */
+int8_t can_decode_ot(uint8_t object_type)
+{
+    switch (object_type)
+    {
+    case LC:
+        return 0;
+    case MAIN:
+#ifdef MAIN_DEC
+        return 0;
+#else
+        return -1;
+#endif
+    case SSR:
+#ifdef SSR_DEC
+        return 0;
+#else
+        return -1;
+#endif
+    case LTP:
+#ifdef LTP_DEC
+        return 0;
+#else
+        return -1;
+#endif
+
+    /* ER object types */
+#ifdef ERROR_RESILIENCE
+    case ER_LC:
+#ifdef DRM
+    case DRM_ER_LC:
+#endif
+        return 0;
+    case ER_LTP:
+#ifdef LTP_DEC
+        return 0;
+#else
+        return -1;
+#endif
+    case LD:
+#ifdef LD_DEC
+        return 0;
+#else
+        return -1;
+#endif
+#endif
+    }
+
+    return -1;
+}
+
+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
+};
+
+static uint32_t  __r1 = 1;
+static uint32_t  __r2 = 1;
+
+
+/*
+ *  This is a simple random number generator with good quality for audio purposes.
+ *  It consists of two polycounters with opposite rotation direction and different
+ *  periods. The periods are coprime, so the total period is the product of both.
+ *
+ *     -------------------------------------------------------------------------------------------------
+ * +-> |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0|
+ * |   -------------------------------------------------------------------------------------------------
+ * |                                                                          |  |  |  |     |        |
+ * |                                                                          +--+--+--+-XOR-+--------+
+ * |                                                                                      |
+ * +--------------------------------------------------------------------------------------+
+ *
+ *     -------------------------------------------------------------------------------------------------
+ *     |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| <-+
+ *     -------------------------------------------------------------------------------------------------   |
+ *       |  |           |  |                                                                               |
+ *       +--+----XOR----+--+                                                                               |
+ *                |                                                                                        |
+ *                +----------------------------------------------------------------------------------------+
+ *
+ *
+ *  The first has an period of 3*5*17*257*65537, the second of 7*47*73*178481,
+ *  which gives a period of 18.410.713.077.675.721.215. The result is the
+ *  XORed values of both generators.
+ */
+uint32_t random_int(void)
+{
+    static const uint32_t rnd_seed = 16428320;
+	uint32_t  t1, t2, t3, t4;
+
+	t3   = t1 = __r1;   t4   = t2 = __r2;       // Parity calculation is done via table lookup, this is also available
+	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 );
+}
+
+#define LOG2 0.30102999566398
+
+int32_t int_log2(int32_t val)
+{
+    return (int32_t)ceil(log(val)/log(2));
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/common.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,320 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id$
+**/
+
+#ifndef __COMMON_H__
+#define __COMMON_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#  include "../config.h"
+
+#define INLINE __inline
+
+#ifndef max
+#define max(a, b) (((a) > (b)) ? (a) : (b))
+#endif
+#ifndef min
+#define min(a, b) (((a) < (b)) ? (a) : (b))
+#endif
+
+
+/* COMPILE TIME DEFINITIONS */
+
+/* use double precision */
+/* #define USE_DOUBLE_PRECISION */
+/* use fixed point reals */
+//#define FIXED_POINT
+
+#define ERROR_RESILIENCE
+
+
+/* Allow decoding of MAIN profile AAC */
+#define MAIN_DEC
+/* Allow decoding of SSR profile AAC */
+//#define SSR_DEC
+/* Allow decoding of LTP profile AAC */
+#define LTP_DEC
+/* Allow decoding of LD profile AAC */
+#define LD_DEC
+
+/* LD can't do without LTP */
+#ifdef LD_DEC
+#ifndef ERROR_RESILIENCE
+#define ERROR_RESILIENCE
+#endif
+#ifndef LTP_DEC
+#define LTP_DEC
+#endif
+#endif
+
+
+#define SBR_DEC
+//#define SBR_LOW_POWER
+
+#ifdef FIXED_POINT
+#ifndef SBR_LOW_POWER
+#define SBR_LOW_POWER
+#endif
+#endif
+
+#ifdef FIXED_POINT
+#define SBR_DIV(A, B) (((int64_t)A << REAL_BITS)/B)
+#else
+#define SBR_DIV(A, B) ((A)/(B))
+#endif
+
+#ifndef SBR_LOW_POWER
+#define qmf_t complex_t
+#define QMF_RE(A) RE(A)
+#define QMF_IM(A) IM(A)
+#else
+#define qmf_t real_t
+#define QMF_RE(A) (A)
+#define QMF_IM(A) 0
+#endif
+
+
+/* END COMPILE TIME DEFINITIONS */
+
+#ifndef FIXED_POINT
+#define POW_TABLE_SIZE 200
+#endif
+
+
+#if defined(_WIN32)
+
+
+typedef unsigned __int64 uint64_t;
+typedef unsigned __int32 uint32_t;
+typedef unsigned __int16 uint16_t;
+typedef unsigned __int8 uint8_t;
+typedef __int64 int64_t;
+typedef __int32 int32_t;
+typedef __int16 int16_t;
+typedef __int8  int8_t;
+typedef float float32_t;
+
+
+#else
+
+/* Define if needed */
+/* #undef HAVE_FLOAT32_T */
+
+/* Define if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define if you have the `memcpy' function. */
+#define HAVE_MEMCPY 1
+
+/* Define if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define if you have the `strchr' function. */
+#define HAVE_STRCHR 1
+
+/* Define if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+
+
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# else
+/* we need these... */
+typedef unsigned long long uint64_t;
+typedef unsigned long uint32_t;
+typedef unsigned short uint16_t;
+typedef unsigned char uint8_t;
+typedef long long int64_t;
+typedef long int32_t;
+typedef short int16_t;
+typedef char int8_t;
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#ifndef HAVE_FLOAT32_T
+typedef float float32_t;
+#endif
+
+#if STDC_HEADERS
+# include <string.h>
+#else
+# if !HAVE_STRCHR
+#  define strchr index
+#  define strrchr rindex
+# endif
+char *strchr(), *strrchr();
+# if !HAVE_MEMCPY
+#  define memcpy(d, s, n) bcopy((s), (d), (n))
+#  define memmove(d, s, n) bcopy((s), (d), (n))
+# endif
+#endif
+
+#endif
+
+#ifdef WORDS_BIGENDIAN
+#define ARCH_IS_BIG_ENDIAN
+#endif
+
+/* FIXED_POINT doesn't work with MAIN and SSR yet */
+#ifdef FIXED_POINT
+  #undef MAIN_DEC
+  #undef SSR_DEC
+#endif
+
+
+#if defined(FIXED_POINT)
+
+  #ifdef HAS_MATHF_H
+    #include <mathf.h>
+  #else
+    #include <math.h>
+  #endif
+
+  #include "fixed.h"
+
+#elif defined(USE_DOUBLE_PRECISION)
+
+  typedef double real_t;
+
+  #include <math.h>
+
+  #define MUL(A,B) ((A)*(B))
+  #define MUL_C_C(A,B) ((A)*(B))
+  #define MUL_R_C(A,B) ((A)*(B))
+
+  #define REAL_CONST(A) ((real_t)A)
+  #define COEF_CONST(A) ((real_t)A)
+
+#else /* Normal floating point operation */
+
+  typedef float real_t;
+
+  #define MUL(A,B) ((A)*(B))
+  #define MUL_C_C(A,B) ((A)*(B))
+  #define MUL_R_C(A,B) ((A)*(B))
+
+  #define REAL_CONST(A) ((real_t)A)
+  #define COEF_CONST(A) ((real_t)A)
+
+  #ifdef __ICL /* only Intel C compiler has fmath ??? */
+
+    #include <mathf.h>
+
+    #define sin sinf
+    #define cos cosf
+    #define log logf
+    #define floor floorf
+    #define ceil ceilf
+    #define sqrt sqrtf
+
+  #else
+
+    #include <math.h>
+
+#ifdef HAVE_SINF
+#  define sin sinf
+#error
+#endif
+#ifdef HAVE_COSF
+#  define cos cosf
+#endif
+#ifdef HAVE_LOGF
+#  define log logf
+#endif
+#ifdef HAVE_EXPF
+#  define exp expf
+#endif
+#ifdef HAVE_FLOORF
+#  define floor floorf
+#endif
+#ifdef HAVE_CEILF
+#  define ceil ceilf
+#endif
+#ifdef HAVE_SQRTF
+#  define sqrt sqrtf
+#endif
+
+  #endif
+
+#endif
+
+typedef real_t complex_t[2];
+#define RE(A) A[0]
+#define IM(A) A[1]
+
+
+/* common functions */
+int32_t int_log2(int32_t val);
+uint32_t random_int(void);
+uint8_t get_sr_index(uint32_t samplerate);
+int8_t can_decode_ot(uint8_t object_type);
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846f
+#endif
+#ifndef M_PI_2 /* PI/2 */
+#define M_PI_2 1.57079632679489661923
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/config.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,28 @@
+/* config.h.  Generated automatically by configure.  */
+/* config.h.in.  Generated automatically from configure.in by autoheader.  */
+
+/* Define if needed */
+/* #undef HAVE_FLOAT32_T */
+
+/* Define if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define if you have the `memcpy' function. */
+#define HAVE_MEMCPY 1
+
+/* Define if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define if you have the `strchr' function. */
+#define HAVE_STRCHR 1
+
+/* Define if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define if your processor stores words with the most significant byte first
+   (like Motorola and SPARC, unlike Intel and VAX). */
+/* #undef WORDS_BIGENDIAN */
+
+/* Define as `__inline' if that's what the C compiler calls it, or to nothing
+   if it is not supported. */
+/* #undef inline */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/decoder.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,1122 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: decoder.c,v 1.62 2003/07/29 08:20:12 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "decoder.h"
+#include "mp4.h"
+#include "syntax.h"
+#include "specrec.h"
+#include "tns.h"
+#include "pns.h"
+#include "is.h"
+#include "ms.h"
+#include "ic_predict.h"
+#include "lt_predict.h"
+#include "drc.h"
+#include "error.h"
+#include "output.h"
+#include "dither.h"
+#ifdef SSR_DEC
+#include "ssr.h"
+#include "ssr_fb.h"
+#endif
+#ifdef SBR_DEC
+#include "sbr_dec.h"
+#endif
+
+#ifdef ANALYSIS
+uint16_t dbg_count;
+#endif
+
+int8_t* FAADAPI faacDecGetErrorMessage(uint8_t errcode)
+{
+    if (errcode >= NUM_ERROR_MESSAGES)
+        return NULL;
+    return err_msg[errcode];
+}
+
+uint32_t FAADAPI faacDecGetCapabilities()
+{
+    uint32_t cap = 0;
+
+    /* can't do without it */
+    cap += LC_DEC_CAP;
+
+#ifdef MAIN_DEC
+    cap += MAIN_DEC_CAP;
+#endif
+#ifdef LTP_DEC
+    cap += LTP_DEC_CAP;
+#endif
+#ifdef LD_DEC
+    cap += LD_DEC_CAP;
+#endif
+#ifdef ERROR_RESILIENCE
+    cap += ERROR_RESILIENCE_CAP;
+#endif
+#ifdef FIXED_POINT
+    cap += FIXED_POINT_CAP;
+#endif
+
+    return cap;
+}
+
+faacDecHandle FAADAPI faacDecOpen()
+{
+    uint8_t i;
+    faacDecHandle hDecoder = NULL;
+
+    if ((hDecoder = (faacDecHandle)malloc(sizeof(faacDecStruct))) == NULL)
+        return NULL;
+
+    memset(hDecoder, 0, sizeof(faacDecStruct));
+
+    hDecoder->config.outputFormat  = FAAD_FMT_16BIT;
+    hDecoder->config.defObjectType = MAIN;
+    hDecoder->config.defSampleRate = 44100; /* Default: 44.1kHz */
+    hDecoder->adts_header_present = 0;
+    hDecoder->adif_header_present = 0;
+#ifdef ERROR_RESILIENCE
+    hDecoder->aacSectionDataResilienceFlag = 0;
+    hDecoder->aacScalefactorDataResilienceFlag = 0;
+    hDecoder->aacSpectralDataResilienceFlag = 0;
+#endif
+    hDecoder->frameLength = 1024;
+
+    hDecoder->frame = 0;
+    hDecoder->sample_buffer = NULL;
+
+    for (i = 0; i < MAX_CHANNELS; i++)
+    {
+        hDecoder->window_shape_prev[i] = 0;
+        hDecoder->time_out[i] = NULL;
+#ifdef SBR_DEC
+        hDecoder->time_out2[i] = NULL;
+#endif
+#ifdef SSR_DEC
+        hDecoder->ssr_overlap[i] = NULL;
+        hDecoder->prev_fmd[i] = NULL;
+#endif
+#ifdef MAIN_DEC
+        hDecoder->pred_stat[i] = NULL;
+#endif
+#ifdef LTP_DEC
+        hDecoder->ltp_lag[i] = 0;
+        hDecoder->lt_pred_stat[i] = NULL;
+#endif
+    }
+
+#ifdef SBR_DEC
+    for (i = 0; i < 32; i++)
+    {
+        hDecoder->sbr[i] = NULL;
+    }
+#endif
+
+    hDecoder->drc = drc_init(REAL_CONST(1.0), REAL_CONST(1.0));
+
+#if POW_TABLE_SIZE
+    hDecoder->pow2_table = (real_t*)malloc(POW_TABLE_SIZE*sizeof(real_t));
+    build_tables(hDecoder->pow2_table);
+#endif
+
+    return hDecoder;
+}
+
+faacDecConfigurationPtr FAADAPI faacDecGetCurrentConfiguration(faacDecHandle hDecoder)
+{
+    faacDecConfigurationPtr config = &(hDecoder->config);
+
+    return config;
+}
+
+uint8_t FAADAPI faacDecSetConfiguration(faacDecHandle hDecoder,
+                                    faacDecConfigurationPtr config)
+{
+    hDecoder->config.defObjectType = config->defObjectType;
+    hDecoder->config.defSampleRate = config->defSampleRate;
+    hDecoder->config.outputFormat  = config->outputFormat;
+    hDecoder->config.downMatrix    = config->downMatrix;
+
+    /* OK */
+    return 1;
+}
+
+int32_t FAADAPI faacDecInit(faacDecHandle hDecoder, uint8_t *buffer,
+                            uint32_t buffer_size,
+                            uint32_t *samplerate, uint8_t *channels)
+{
+    uint32_t bits = 0;
+    bitfile ld;
+    adif_header adif;
+    adts_header adts;
+
+    hDecoder->sf_index = get_sr_index(hDecoder->config.defSampleRate);
+    hDecoder->object_type = hDecoder->config.defObjectType;
+    *samplerate = sample_rates[hDecoder->sf_index];
+    *channels = 1;
+
+    if (buffer != NULL)
+    {
+        faad_initbits(&ld, buffer, buffer_size);
+
+        /* Check if an ADIF header is present */
+        if ((buffer[0] == 'A') && (buffer[1] == 'D') &&
+            (buffer[2] == 'I') && (buffer[3] == 'F'))
+        {
+            hDecoder->adif_header_present = 1;
+
+            get_adif_header(&adif, &ld);
+            faad_byte_align(&ld);
+
+            hDecoder->sf_index = adif.pce[0].sf_index;
+            hDecoder->object_type = adif.pce[0].object_type;
+
+            *samplerate = sample_rates[hDecoder->sf_index];
+            *channels = adif.pce[0].channels;
+
+            memcpy(&(hDecoder->pce), &(adif.pce[0]), sizeof(program_config));
+            hDecoder->pce_set = 1;
+
+            bits = bit2byte(faad_get_processed_bits(&ld));
+
+        /* Check if an ADTS header is present */
+        } else if (faad_showbits(&ld, 12) == 0xfff) {
+            hDecoder->adts_header_present = 1;
+
+            adts_frame(&adts, &ld);
+
+            hDecoder->sf_index = adts.sf_index;
+            hDecoder->object_type = adts.profile;
+
+            *samplerate = sample_rates[hDecoder->sf_index];
+            *channels = (adts.channel_configuration > 6) ?
+                2 : adts.channel_configuration;
+        }
+
+        if (ld.error)
+        {
+            faad_endbits(&ld);
+            return -1;
+        }
+        faad_endbits(&ld);
+    }
+    hDecoder->channelConfiguration = *channels;
+
+    /* must be done before frameLength is divided by 2 for LD */
+#ifdef SSR_DEC
+    if (hDecoder->object_type == SSR)
+        hDecoder->fb = ssr_filter_bank_init(hDecoder->frameLength/SSR_BANDS);
+    else
+#endif
+        hDecoder->fb = filter_bank_init(hDecoder->frameLength);
+
+#ifdef LD_DEC
+    if (hDecoder->object_type == LD)
+        hDecoder->frameLength >>= 1;
+#endif
+
+    if (can_decode_ot(hDecoder->object_type) < 0)
+        return -1;
+
+#ifndef FIXED_POINT
+    if (hDecoder->config.outputFormat >= FAAD_FMT_DITHER_LOWEST)
+        Init_Dither(16, hDecoder->config.outputFormat - FAAD_FMT_DITHER_LOWEST);
+#endif
+
+    return bits;
+}
+
+/* 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 rc;
+    mp4AudioSpecificConfig mp4ASC;
+
+    hDecoder->adif_header_present = 0;
+    hDecoder->adts_header_present = 0;
+
+    if((hDecoder == NULL)
+        || (pBuffer == NULL)
+        || (SizeOfDecoderSpecificInfo < 2)
+        || (samplerate == NULL)
+        || (channels == NULL))
+    {
+        return -1;
+    }
+
+    /* decode the audio specific config */
+    rc = AudioSpecificConfig2(pBuffer, SizeOfDecoderSpecificInfo, &mp4ASC,
+        &(hDecoder->pce));
+
+    /* copy the relevant info to the decoder handle */
+    *samplerate = mp4ASC.samplingFrequency;
+    if (mp4ASC.channelsConfiguration)
+    {
+        *channels = mp4ASC.channelsConfiguration;
+    } else {
+        *channels = hDecoder->pce.channels;
+        hDecoder->pce_set = 1;
+    }
+    hDecoder->sf_index = mp4ASC.samplingFrequencyIndex;
+    hDecoder->object_type = mp4ASC.objectTypeIndex;
+    hDecoder->aacSectionDataResilienceFlag = mp4ASC.aacSectionDataResilienceFlag;
+    hDecoder->aacScalefactorDataResilienceFlag = mp4ASC.aacScalefactorDataResilienceFlag;
+    hDecoder->aacSpectralDataResilienceFlag = mp4ASC.aacSpectralDataResilienceFlag;
+#ifdef SBR_DEC
+    hDecoder->sbr_present_flag = mp4ASC.sbr_present_flag;
+
+    /* AAC core decoder samplerate is 2 times as low */
+    if (hDecoder->sbr_present_flag == 1)
+    {
+        hDecoder->sf_index = get_sr_index(mp4ASC.samplingFrequency / 2);
+    }
+#endif
+
+    if (hDecoder->object_type < 5)
+        hDecoder->object_type--; /* For AAC differs from MPEG-4 */
+    if (rc != 0)
+    {
+        return rc;
+    }
+    hDecoder->channelConfiguration = mp4ASC.channelsConfiguration;
+    if (mp4ASC.frameLengthFlag)
+        hDecoder->frameLength = 960;
+
+    /* must be done before frameLength is divided by 2 for LD */
+#ifdef SSR_DEC
+    if (hDecoder->object_type == SSR)
+        hDecoder->fb = ssr_filter_bank_init(hDecoder->frameLength/SSR_BANDS);
+    else
+#endif
+        hDecoder->fb = filter_bank_init(hDecoder->frameLength);
+
+#ifdef LD_DEC
+    if (hDecoder->object_type == LD)
+        hDecoder->frameLength >>= 1;
+#endif
+
+#ifndef FIXED_POINT
+    if (hDecoder->config.outputFormat >= FAAD_FMT_DITHER_LOWEST)
+        Init_Dither(16, hDecoder->config.outputFormat - FAAD_FMT_DITHER_LOWEST);
+#endif
+
+    return 0;
+}
+
+int8_t FAADAPI faacDecInitDRM(faacDecHandle hDecoder, uint32_t samplerate,
+                              uint8_t channels)
+{
+    /* Special object type defined for DRM */
+    hDecoder->config.defObjectType = DRM_ER_LC;
+
+    hDecoder->config.defSampleRate = samplerate;
+    hDecoder->aacSectionDataResilienceFlag = 1; /* VCB11 */
+    hDecoder->aacScalefactorDataResilienceFlag = 0; /* no RVLC */
+    hDecoder->aacSpectralDataResilienceFlag = 1; /* HCR */
+    hDecoder->frameLength = 960;
+    hDecoder->sf_index = get_sr_index(hDecoder->config.defSampleRate);
+    hDecoder->object_type = hDecoder->config.defObjectType;
+    hDecoder->channelConfiguration = channels;
+
+    /* must be done before frameLength is divided by 2 for LD */
+    hDecoder->fb = filter_bank_init(hDecoder->frameLength);
+
+#ifndef FIXED_POINT
+    if (hDecoder->config.outputFormat >= FAAD_FMT_DITHER_LOWEST)
+        Init_Dither(16, hDecoder->config.outputFormat - FAAD_FMT_DITHER_LOWEST);
+#endif
+
+    return 0;
+}
+
+void FAADAPI faacDecClose(faacDecHandle hDecoder)
+{
+    uint8_t i;
+
+    if (hDecoder == NULL)
+        return;
+
+    for (i = 0; i < MAX_CHANNELS; i++)
+    {
+        if (hDecoder->time_out[i]) free(hDecoder->time_out[i]);
+#ifdef SBR_DEC
+        if (hDecoder->time_out2[i]) free(hDecoder->time_out2[i]);
+#endif
+#ifdef SSR_DEC
+        if (hDecoder->ssr_overlap[i]) free(hDecoder->ssr_overlap[i]);
+        if (hDecoder->prev_fmd[i]) free(hDecoder->prev_fmd[i]);
+#endif
+#ifdef MAIN_DEC
+        if (hDecoder->pred_stat[i]) free(hDecoder->pred_stat[i]);
+#endif
+#ifdef LTP_DEC
+        if (hDecoder->lt_pred_stat[i]) free(hDecoder->lt_pred_stat[i]);
+#endif
+    }
+
+#ifdef SSR_DEC
+    if (hDecoder->object_type == SSR)
+        ssr_filter_bank_end(hDecoder->fb);
+    else
+#endif
+        filter_bank_end(hDecoder->fb);
+
+    drc_end(hDecoder->drc);
+
+#ifndef FIXED_POINT
+#if POW_TABLE_SIZE
+    if (hDecoder->pow2_table) free(hDecoder->pow2_table);
+#endif
+#endif
+
+    if (hDecoder->sample_buffer) free(hDecoder->sample_buffer);
+
+#ifdef SBR_DEC
+    for (i = 0; i < 32; i++)
+    {
+        if (hDecoder->sbr[i])
+            sbrDecodeEnd(hDecoder->sbr[i]);
+    }
+#endif
+
+    if (hDecoder) free(hDecoder);
+}
+
+void FAADAPI faacDecPostSeekReset(faacDecHandle hDecoder, int32_t frame)
+{
+    if (hDecoder)
+    {
+        hDecoder->postSeekResetFlag = 1;
+
+        if (frame != -1)
+            hDecoder->frame = frame;
+    }
+}
+
+void create_channel_config(faacDecHandle hDecoder, faacDecFrameInfo *hInfo)
+{
+    hInfo->num_front_channels = 0;
+    hInfo->num_side_channels = 0;
+    hInfo->num_back_channels = 0;
+    hInfo->num_lfe_channels = 0;
+    memset(hInfo->channel_position, 0, MAX_CHANNELS*sizeof(uint8_t));
+
+    if (hDecoder->downMatrix)
+    {
+        hInfo->num_front_channels = 2;
+        hInfo->channel_position[0] = FRONT_CHANNEL_LEFT;
+        hInfo->channel_position[1] = FRONT_CHANNEL_RIGHT;
+        return;
+    }
+
+    /* check if there is a PCE */
+    if (hDecoder->pce_set)
+    {
+        uint8_t i, chpos = 0;
+        uint8_t chdir, back_center = 0;
+
+        hInfo->num_front_channels = hDecoder->pce.num_front_channels;
+        hInfo->num_side_channels = hDecoder->pce.num_side_channels;
+        hInfo->num_back_channels = hDecoder->pce.num_back_channels;
+        hInfo->num_lfe_channels = hDecoder->pce.num_lfe_channels;
+
+        chdir = hInfo->num_front_channels;
+        if (chdir & 1)
+        {
+            hInfo->channel_position[chpos++] = FRONT_CHANNEL_CENTER;
+            chdir--;
+        }
+        for (i = 0; i < chdir; i += 2)
+        {
+            hInfo->channel_position[chpos++] = FRONT_CHANNEL_LEFT;
+            hInfo->channel_position[chpos++] = FRONT_CHANNEL_RIGHT;
+        }
+
+        for (i = 0; i < hInfo->num_side_channels; i += 2)
+        {
+            hInfo->channel_position[chpos++] = SIDE_CHANNEL_LEFT;
+            hInfo->channel_position[chpos++] = SIDE_CHANNEL_RIGHT;
+        }
+
+        chdir = hInfo->num_back_channels;
+        if (chdir & 1)
+        {
+            back_center = 1;
+            chdir--;
+        }
+        for (i = 0; i < chdir; i += 2)
+        {
+            hInfo->channel_position[chpos++] = BACK_CHANNEL_LEFT;
+            hInfo->channel_position[chpos++] = BACK_CHANNEL_RIGHT;
+        }
+        if (back_center)
+        {
+            hInfo->channel_position[chpos++] = BACK_CHANNEL_CENTER;
+        }
+
+        for (i = 0; i < hInfo->num_lfe_channels; i++)
+        {
+            hInfo->channel_position[chpos++] = LFE_CHANNEL;
+        }
+
+    } else {
+        switch (hDecoder->channelConfiguration)
+        {
+        case 1:
+            hInfo->num_front_channels = 1;
+            hInfo->channel_position[0] = FRONT_CHANNEL_CENTER;
+            break;
+        case 2:
+            hInfo->num_front_channels = 2;
+            hInfo->channel_position[0] = FRONT_CHANNEL_LEFT;
+            hInfo->channel_position[1] = FRONT_CHANNEL_RIGHT;
+            break;
+        case 3:
+            hInfo->num_front_channels = 3;
+            hInfo->channel_position[0] = FRONT_CHANNEL_CENTER;
+            hInfo->channel_position[1] = FRONT_CHANNEL_LEFT;
+            hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT;
+            break;
+        case 4:
+            hInfo->num_front_channels = 3;
+            hInfo->num_back_channels = 1;
+            hInfo->channel_position[0] = FRONT_CHANNEL_CENTER;
+            hInfo->channel_position[1] = FRONT_CHANNEL_LEFT;
+            hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT;
+            hInfo->channel_position[3] = BACK_CHANNEL_CENTER;
+            break;
+        case 5:
+            hInfo->num_front_channels = 3;
+            hInfo->num_back_channels = 2;
+            hInfo->channel_position[0] = FRONT_CHANNEL_CENTER;
+            hInfo->channel_position[1] = FRONT_CHANNEL_LEFT;
+            hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT;
+            hInfo->channel_position[3] = BACK_CHANNEL_LEFT;
+            hInfo->channel_position[4] = BACK_CHANNEL_RIGHT;
+            break;
+        case 6:
+            hInfo->num_front_channels = 3;
+            hInfo->num_back_channels = 2;
+            hInfo->num_lfe_channels = 1;
+            hInfo->channel_position[0] = FRONT_CHANNEL_CENTER;
+            hInfo->channel_position[1] = FRONT_CHANNEL_LEFT;
+            hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT;
+            hInfo->channel_position[3] = BACK_CHANNEL_LEFT;
+            hInfo->channel_position[4] = BACK_CHANNEL_RIGHT;
+            hInfo->channel_position[5] = LFE_CHANNEL;
+            break;
+        case 7:
+            hInfo->num_front_channels = 3;
+            hInfo->num_side_channels = 2;
+            hInfo->num_back_channels = 2;
+            hInfo->num_lfe_channels = 1;
+            hInfo->channel_position[0] = FRONT_CHANNEL_CENTER;
+            hInfo->channel_position[1] = FRONT_CHANNEL_LEFT;
+            hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT;
+            hInfo->channel_position[3] = SIDE_CHANNEL_LEFT;
+            hInfo->channel_position[4] = SIDE_CHANNEL_RIGHT;
+            hInfo->channel_position[5] = BACK_CHANNEL_LEFT;
+            hInfo->channel_position[6] = BACK_CHANNEL_RIGHT;
+            hInfo->channel_position[7] = LFE_CHANNEL;
+            break;
+        default: /* channelConfiguration == 0 || channelConfiguration > 7 */
+            {
+                uint8_t i;
+                uint8_t ch = hDecoder->fr_channels - hDecoder->has_lfe;
+                if (ch & 1) /* there's either a center front or a center back channel */
+                {
+                    uint8_t ch1 = (ch-1)/2;
+                    if (hDecoder->first_syn_ele == ID_SCE)
+                    {
+                        hInfo->num_front_channels = ch1 + 1;
+                        hInfo->num_back_channels = ch1;
+                        hInfo->channel_position[0] = FRONT_CHANNEL_CENTER;
+                        for (i = 1; i <= ch1; i+=2)
+                        {
+                            hInfo->channel_position[i] = FRONT_CHANNEL_LEFT;
+                            hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT;
+                        }
+                        for (i = ch1+1; i < ch; i+=2)
+                        {
+                            hInfo->channel_position[i] = BACK_CHANNEL_LEFT;
+                            hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT;
+                        }
+                    } else {
+                        hInfo->num_front_channels = ch1;
+                        hInfo->num_back_channels = ch1 + 1;
+                        for (i = 0; i < ch1; i+=2)
+                        {
+                            hInfo->channel_position[i] = FRONT_CHANNEL_LEFT;
+                            hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT;
+                        }
+                        for (i = ch1; i < ch-1; i+=2)
+                        {
+                            hInfo->channel_position[i] = BACK_CHANNEL_LEFT;
+                            hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT;
+                        }
+                        hInfo->channel_position[ch-1] = BACK_CHANNEL_CENTER;
+                    }
+                } else {
+                    uint8_t ch1 = (ch)/2;
+                    hInfo->num_front_channels = ch1;
+                    hInfo->num_back_channels = ch1;
+                    if (ch1 & 1)
+                    {
+                        hInfo->channel_position[0] = FRONT_CHANNEL_CENTER;
+                        for (i = 1; i <= ch1; i+=2)
+                        {
+                            hInfo->channel_position[i] = FRONT_CHANNEL_LEFT;
+                            hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT;
+                        }
+                        for (i = ch1+1; i < ch-1; i+=2)
+                        {
+                            hInfo->channel_position[i] = BACK_CHANNEL_LEFT;
+                            hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT;
+                        }
+                        hInfo->channel_position[ch-1] = BACK_CHANNEL_CENTER;
+                    } else {
+                        for (i = 0; i < ch1; i+=2)
+                        {
+                            hInfo->channel_position[i] = FRONT_CHANNEL_LEFT;
+                            hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT;
+                        }
+                        for (i = ch1; i < ch; i+=2)
+                        {
+                            hInfo->channel_position[i] = BACK_CHANNEL_LEFT;
+                            hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT;
+                        }
+                    }
+                }
+                hInfo->num_lfe_channels = hDecoder->has_lfe;
+                for (i = ch; i < hDecoder->fr_channels; i++)
+                {
+                    hInfo->channel_position[i] = LFE_CHANNEL;
+                }
+            }
+            break;
+        }
+    }
+}
+
+void* FAADAPI faacDecDecode(faacDecHandle hDecoder,
+                            faacDecFrameInfo *hInfo,
+                            uint8_t *buffer, uint32_t buffer_size)
+{
+    int32_t i;
+    uint8_t ch;
+    adts_header adts;
+    uint8_t channels = 0, ch_ele = 0;
+    uint8_t output_channels = 0;
+    bitfile *ld = (bitfile*)malloc(sizeof(bitfile));
+
+    /* local copys of globals */
+    uint8_t sf_index       =  hDecoder->sf_index;
+    uint8_t object_type    =  hDecoder->object_type;
+    uint8_t channelConfiguration = hDecoder->channelConfiguration;
+#ifdef MAIN_DEC
+    pred_state **pred_stat =  hDecoder->pred_stat;
+#endif
+#ifdef LTP_DEC
+    real_t **lt_pred_stat  =  hDecoder->lt_pred_stat;
+#endif
+#ifndef FIXED_POINT
+#if POW_TABLE_SIZE
+    real_t *pow2_table     =  hDecoder->pow2_table;
+#else
+    real_t *pow2_table     =  NULL;
+#endif
+#endif
+    uint8_t *window_shape_prev = hDecoder->window_shape_prev;
+    real_t **time_out      =  hDecoder->time_out;
+#ifdef SBR_DEC
+    real_t **time_out2     =  hDecoder->time_out2;
+#endif
+#ifdef SSR_DEC
+    real_t **ssr_overlap   =  hDecoder->ssr_overlap;
+    real_t **prev_fmd      =  hDecoder->prev_fmd;
+#endif
+    fb_info *fb            =  hDecoder->fb;
+    drc_info *drc          =  hDecoder->drc;
+    uint8_t outputFormat   =  hDecoder->config.outputFormat;
+#ifdef LTP_DEC
+    uint16_t *ltp_lag      =  hDecoder->ltp_lag;
+#endif
+    program_config *pce    = &hDecoder->pce;
+
+    element *syntax_elements[MAX_SYNTAX_ELEMENTS];
+    element **elements;
+    int16_t *spec_data[MAX_CHANNELS];
+    real_t *spec_coef[MAX_CHANNELS];
+
+    uint16_t frame_len = hDecoder->frameLength;
+
+    void *sample_buffer;
+
+
+    memset(hInfo, 0, sizeof(faacDecFrameInfo));
+
+    /* initialize the bitstream */
+    faad_initbits(ld, buffer, buffer_size);
+
+#ifdef DRM
+    if (object_type == DRM_ER_LC)
+    {
+        faad_getbits(ld, 8
+            DEBUGVAR(1,1,"faacDecDecode(): skip CRC"));
+    }
+#endif
+
+    if (hDecoder->adts_header_present)
+    {
+        if ((hInfo->error = adts_frame(&adts, ld)) > 0)
+            goto error;
+
+        /* MPEG2 does byte_alignment() here,
+         * but ADTS header is always multiple of 8 bits in MPEG2
+         * so not needed to actually do it.
+         */
+    }
+
+#ifdef ANALYSIS
+    dbg_count = 0;
+#endif
+
+    elements = syntax_elements;
+
+    /* decode the complete bitstream */
+    elements = raw_data_block(hDecoder, hInfo, ld, syntax_elements,
+        spec_data, spec_coef, pce, drc);
+
+    ch_ele = hDecoder->fr_ch_ele;
+    channels = hDecoder->fr_channels;
+
+    if (hInfo->error > 0)
+        goto error;
+
+
+    /* no more bit reading after this */
+    hInfo->bytesconsumed = bit2byte(faad_get_processed_bits(ld));
+    if (ld->error)
+    {
+        hInfo->error = 14;
+        goto error;
+    }
+    faad_endbits(ld);
+    if (ld) free(ld);
+    ld = NULL;
+
+    if (!hDecoder->adts_header_present && !hDecoder->adif_header_present)
+    {
+        if (channels != hDecoder->channelConfiguration)
+            hDecoder->channelConfiguration = channels;
+
+        if (channels == 8) /* 7.1 */
+            hDecoder->channelConfiguration = 7;
+        if (channels == 7) /* not a standard channelConfiguration */
+            hDecoder->channelConfiguration = 0;
+    }
+
+    if ((channels == 5 || channels == 6) && hDecoder->config.downMatrix)
+    {
+        hDecoder->downMatrix = 1;
+        output_channels = 2;
+    } else {
+        output_channels = channels;
+    }
+
+    /* Make a channel configuration based on either a PCE or a channelConfiguration */
+    create_channel_config(hDecoder, hInfo);
+
+    /* number of samples in this frame */
+    hInfo->samples = frame_len*output_channels;
+    /* number of channels in this frame */
+    hInfo->channels = output_channels;
+    /* samplerate */
+    hInfo->samplerate = sample_rates[hDecoder->sf_index];
+
+    /* check if frame has channel elements */
+    if (channels == 0)
+    {
+        hDecoder->frame++;
+        return NULL;
+    }
+
+    if (hDecoder->sample_buffer == NULL)
+    {
+#ifdef SBR_DEC
+        if (hDecoder->sbr_present_flag == 1)
+        {
+            if (hDecoder->config.outputFormat == FAAD_FMT_DOUBLE)
+                hDecoder->sample_buffer = malloc(2*frame_len*channels*sizeof(double));
+            else
+                hDecoder->sample_buffer = malloc(2*frame_len*channels*sizeof(real_t));
+        } else {
+#endif
+            if (hDecoder->config.outputFormat == FAAD_FMT_DOUBLE)
+                hDecoder->sample_buffer = malloc(frame_len*channels*sizeof(double));
+            else
+                hDecoder->sample_buffer = malloc(frame_len*channels*sizeof(real_t));
+#ifdef SBR_DEC
+        }
+#endif
+    }
+
+    sample_buffer = hDecoder->sample_buffer;
+
+    /* noiseless coding is done, the rest of the tools come now */
+    for (ch = 0; ch < channels; ch++)
+    {
+        ic_stream *ics;
+
+        /* find the syntax element to which this channel belongs */
+        if (syntax_elements[hDecoder->channel_element[ch]]->channel == ch)
+            ics = &(syntax_elements[hDecoder->channel_element[ch]]->ics1);
+        else if (syntax_elements[hDecoder->channel_element[ch]]->paired_channel == ch)
+            ics = &(syntax_elements[hDecoder->channel_element[ch]]->ics2);
+
+        /* inverse quantization */
+        inverse_quantization(spec_coef[ch], spec_data[ch], frame_len);
+
+        /* apply scalefactors */
+#ifdef FIXED_POINT
+        apply_scalefactors(hDecoder, ics, spec_coef[ch], frame_len);
+#else
+        apply_scalefactors(ics, spec_coef[ch], pow2_table, frame_len);
+#endif
+
+        /* deinterleave short block grouping */
+        if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+            quant_to_spec(ics, spec_coef[ch], frame_len);
+    }
+
+    /* Because for ms, is and pns both channels spectral coefficients are needed
+       we have to restart running through all channels here.
+    */
+    for (ch = 0; ch < channels; ch++)
+    {
+        int16_t pch = -1;
+        uint8_t right_channel;
+        ic_stream *ics, *icsr;
+        ltp_info *ltp;
+
+        /* find the syntax element to which this channel belongs */
+        if (syntax_elements[hDecoder->channel_element[ch]]->channel == ch)
+        {
+            ics = &(syntax_elements[hDecoder->channel_element[ch]]->ics1);
+            icsr = &(syntax_elements[hDecoder->channel_element[ch]]->ics2);
+            ltp = &(ics->ltp);
+            pch = syntax_elements[hDecoder->channel_element[ch]]->paired_channel;
+            right_channel = 0;
+        } else if (syntax_elements[hDecoder->channel_element[ch]]->paired_channel == ch) {
+            ics = &(syntax_elements[hDecoder->channel_element[ch]]->ics2);
+            if (syntax_elements[hDecoder->channel_element[ch]]->common_window)
+                ltp = &(ics->ltp2);
+            else
+                ltp = &(ics->ltp);
+            right_channel = 1;
+        }
+
+        /* pns decoding */
+        if ((!right_channel) && (pch != -1) && (ics->ms_mask_present))
+            pns_decode(ics, icsr, spec_coef[ch], spec_coef[pch], frame_len, 1);
+        else if ((pch == -1) || ((pch != -1) && (!ics->ms_mask_present)))
+            pns_decode(ics, NULL, spec_coef[ch], NULL, frame_len, 0);
+
+        if (!right_channel && (pch != -1))
+        {
+            /* mid/side decoding */
+            ms_decode(ics, icsr, spec_coef[ch], spec_coef[pch], frame_len);
+
+            /* intensity stereo decoding */
+            is_decode(ics, icsr, spec_coef[ch], spec_coef[pch], frame_len);
+        }
+
+#ifdef MAIN_DEC
+        /* MAIN object type prediction */
+        if (object_type == MAIN)
+        {
+            /* allocate the state only when needed */
+            if (pred_stat[ch] == NULL)
+            {
+                pred_stat[ch] = (pred_state*)malloc(frame_len * sizeof(pred_state));
+                reset_all_predictors(pred_stat[ch], frame_len);
+            }
+
+            /* intra channel prediction */
+            ic_prediction(ics, spec_coef[ch], pred_stat[ch], frame_len);
+
+            /* In addition, for scalefactor bands coded by perceptual
+               noise substitution the predictors belonging to the
+               corresponding spectral coefficients are reset.
+            */
+            pns_reset_pred_state(ics, pred_stat[ch]);
+        }
+#endif
+#ifdef LTP_DEC
+        if ((object_type == LTP)
+#ifdef ERROR_RESILIENCE
+            || (object_type == ER_LTP)
+#endif
+#ifdef LD_DEC
+            || (object_type == LD)
+#endif
+            )
+        {
+#ifdef LD_DEC
+            if (object_type == LD)
+            {
+                if (ltp->data_present)
+                {
+                    if (ltp->lag_update)
+                        ltp_lag[ch] = ltp->lag;
+                }
+                ltp->lag = ltp_lag[ch];
+            }
+#endif
+
+            /* allocate the state only when needed */
+            if (lt_pred_stat[ch] == NULL)
+            {
+                lt_pred_stat[ch] = (real_t*)malloc(frame_len*4 * sizeof(real_t));
+                memset(lt_pred_stat[ch], 0, frame_len*4 * sizeof(real_t));
+            }
+
+            /* long term prediction */
+            lt_prediction(ics, ltp, spec_coef[ch], lt_pred_stat[ch], fb,
+                ics->window_shape, window_shape_prev[ch],
+                sf_index, object_type, frame_len);
+        }
+#endif
+
+        /* tns decoding */
+        tns_decode_frame(ics, &(ics->tns), sf_index, object_type,
+            spec_coef[ch], frame_len);
+
+        /* drc decoding */
+        if (drc->present)
+        {
+            if (!drc->exclude_mask[ch] || !drc->excluded_chns_present)
+                drc_decode(drc, spec_coef[ch]);
+        }
+
+        if (time_out[ch] == NULL)
+        {
+            time_out[ch] = (real_t*)malloc(frame_len*2*sizeof(real_t));
+            memset(time_out[ch], 0, frame_len*2*sizeof(real_t));
+        }
+#ifdef SBR_DEC
+        if (time_out2[ch] == NULL)
+        {
+            time_out2[ch] = (real_t*)malloc(frame_len*2*sizeof(real_t));
+            memset(time_out2[ch], 0, frame_len*2*sizeof(real_t));
+        }
+#endif
+
+        /* filter bank */
+#ifdef SSR_DEC
+        if (object_type != SSR)
+        {
+#endif
+            ifilter_bank(fb, ics->window_sequence, ics->window_shape,
+                window_shape_prev[ch], spec_coef[ch],
+                time_out[ch], object_type, frame_len);
+#ifdef SSR_DEC
+        } else {
+            if (ssr_overlap[ch] == NULL)
+            {
+                ssr_overlap[ch] = (real_t*)malloc(2*frame_len*sizeof(real_t));
+                memset(ssr_overlap[ch], 0, 2*frame_len*sizeof(real_t));
+            }
+            if (prev_fmd[ch] == NULL)
+            {
+                uint16_t k;
+                prev_fmd[ch] = (real_t*)malloc(2*frame_len*sizeof(real_t));
+                for (k = 0; k < 2*frame_len; k++)
+                    prev_fmd[ch][k] = REAL_CONST(-1);
+            }
+
+            ssr_decode(&(ics->ssr), fb, ics->window_sequence, ics->window_shape,
+                window_shape_prev[ch], spec_coef[ch], time_out[ch],
+                ssr_overlap[ch], hDecoder->ipqf_buffer[ch], prev_fmd[ch], frame_len);
+        }
+#endif
+        /* save window shape for next frame */
+        window_shape_prev[ch] = ics->window_shape;
+
+#ifdef LTP_DEC
+        if ((object_type == LTP)
+#ifdef ERROR_RESILIENCE
+            || (object_type == ER_LTP)
+#endif
+#ifdef LD_DEC
+            || (object_type == LD)
+#endif
+            )
+        {
+            lt_update_state(lt_pred_stat[ch], time_out[ch], time_out[ch]+frame_len,
+                frame_len, object_type);
+        }
+#endif
+    }
+
+#ifdef SBR_DEC
+    if (hDecoder->sbr_present_flag == 1)
+    {
+        for (i = 0; i < ch_ele; i++)
+        {
+            if (syntax_elements[i]->paired_channel != -1)
+            {
+                memcpy(time_out2[syntax_elements[i]->channel],
+                    time_out[syntax_elements[i]->channel], frame_len*sizeof(real_t));
+                memcpy(time_out2[syntax_elements[i]->paired_channel],
+                    time_out[syntax_elements[i]->paired_channel], frame_len*sizeof(real_t));
+                sbrDecodeFrame(hDecoder->sbr[i],
+                    time_out2[syntax_elements[i]->channel],
+                    time_out2[syntax_elements[i]->paired_channel], ID_CPE,
+                    hDecoder->postSeekResetFlag);
+            } else {
+                memcpy(time_out2[syntax_elements[i]->channel],
+                    time_out[syntax_elements[i]->channel], frame_len*sizeof(real_t));
+                sbrDecodeFrame(hDecoder->sbr[i],
+                    time_out2[syntax_elements[i]->channel],
+                    NULL, ID_SCE,
+                    hDecoder->postSeekResetFlag);
+            }
+        }
+        frame_len *= 2;
+        hInfo->samples *= 2;
+        hInfo->samplerate *= 2;
+
+        sample_buffer = output_to_PCM(hDecoder, time_out2, sample_buffer,
+            output_channels, frame_len, outputFormat);
+    } else {
+#endif
+        sample_buffer = output_to_PCM(hDecoder, time_out, sample_buffer,
+            output_channels, frame_len, outputFormat);
+#ifdef SBR_DEC
+    }
+#endif
+
+    /* gapless playback */
+    if (hDecoder->samplesLeft != 0)
+    {
+        hInfo->samples = hDecoder->samplesLeft*channels;
+    }
+    hDecoder->samplesLeft = 0;
+
+    hDecoder->postSeekResetFlag = 0;
+
+    hDecoder->frame++;
+#ifdef LD_DEC
+    if (object_type != LD)
+    {
+#endif
+        if (hDecoder->frame <= 1)
+            hInfo->samples = 0;
+
+#if 0
+        if (hDecoder->frame == 2 && hDecoder->sbr_present_flag == 1)
+        {
+            uint8_t samplesize;
+            switch (outputFormat)
+            {
+            case FAAD_FMT_16BIT: case FAAD_FMT_16BIT_DITHER:
+            case FAAD_FMT_16BIT_L_SHAPE: case FAAD_FMT_16BIT_M_SHAPE:
+            case FAAD_FMT_16BIT_H_SHAPE:
+                samplesize = 2;
+                break;
+            case FAAD_FMT_24BIT:
+            case FAAD_FMT_32BIT:
+            case FAAD_FMT_FLOAT:
+                samplesize = 4;
+                break;
+            case FAAD_FMT_DOUBLE:
+                samplesize = 8;
+                break;
+            }
+            hInfo->samples = 512*channels;
+            memmove(sample_buffer, (void*)((char*)sample_buffer + 1536*channels*samplesize), hInfo->samples*samplesize);
+        }
+#endif
+
+#ifdef LD_DEC
+    } else {
+        /* LD encoders will give lower delay */
+        if (hDecoder->frame <= 0)
+            hInfo->samples = 0;
+    }
+#endif
+
+    /* cleanup */
+    for (ch = 0; ch < channels; ch++)
+    {
+        if (spec_coef[ch]) free(spec_coef[ch]);
+        if (spec_data[ch]) free(spec_data[ch]);
+    }
+
+    for (i = 0; i < ch_ele; i++)
+    {
+        if (syntax_elements[i]) free(syntax_elements[i]);
+    }
+
+#ifdef ANALYSIS
+    fflush(stdout);
+#endif
+
+    return sample_buffer;
+
+error:
+    /* free all memory that could have been allocated */
+    faad_endbits(ld);
+    if (ld) free(ld);
+
+    /* cleanup */
+    for (ch = 0; ch < channels; ch++)
+    {
+        if (spec_coef[ch]) free(spec_coef[ch]);
+        if (spec_data[ch]) free(spec_data[ch]);
+    }
+
+    for (i = 0; i < ch_ele; i++)
+    {
+        if (syntax_elements[i]) free(syntax_elements[i]);
+    }
+
+#ifdef ANALYSIS
+    fflush(stdout);
+#endif
+
+    return NULL;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/decoder.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,139 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: decoder.h,v 1.26 2003/07/29 08:20:12 menno Exp $
+**/
+
+#ifndef __DECODER_H__
+#define __DECODER_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _WIN32
+  #pragma pack(push, 8)
+  #ifndef FAADAPI
+    #define FAADAPI __cdecl
+  #endif
+#else
+  #ifndef FAADAPI
+    #define FAADAPI
+  #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_DOUBLE 5
+#define FAAD_FMT_16BIT_DITHER  6
+#define FAAD_FMT_16BIT_L_SHAPE 7
+#define FAAD_FMT_16BIT_M_SHAPE 8
+#define FAAD_FMT_16BIT_H_SHAPE 9
+
+#define FAAD_FMT_DITHER_LOWEST FAAD_FMT_16BIT_DITHER
+
+#define LC_DEC_CAP            (1<<0)
+#define MAIN_DEC_CAP          (1<<1)
+#define LTP_DEC_CAP           (1<<2)
+#define LD_DEC_CAP            (1<<3)
+#define ERROR_RESILIENCE_CAP  (1<<4)
+#define FIXED_POINT_CAP       (1<<5)
+
+#define FRONT_CHANNEL_CENTER (1)
+#define FRONT_CHANNEL_LEFT   (2)
+#define FRONT_CHANNEL_RIGHT  (3)
+#define SIDE_CHANNEL_LEFT    (4)
+#define SIDE_CHANNEL_RIGHT   (5)
+#define BACK_CHANNEL_LEFT    (6)
+#define BACK_CHANNEL_RIGHT   (7)
+#define BACK_CHANNEL_CENTER  (8)
+#define LFE_CHANNEL          (9)
+#define UNKNOWN_CHANNEL      (0)
+
+int8_t* FAADAPI faacDecGetErrorMessage(uint8_t errcode);
+
+uint32_t FAADAPI faacDecGetCapabilities();
+
+faacDecHandle FAADAPI faacDecOpen();
+
+faacDecConfigurationPtr FAADAPI faacDecGetCurrentConfiguration(faacDecHandle hDecoder);
+
+uint8_t FAADAPI faacDecSetConfiguration(faacDecHandle hDecoder,
+                                    faacDecConfigurationPtr 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);
+
+/* Init the library using a DecoderSpecificInfo */
+int8_t FAADAPI faacDecInit2(faacDecHandle 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);
+
+void FAADAPI faacDecClose(faacDecHandle hDecoder);
+
+void* FAADAPI faacDecDecode(faacDecHandle hDecoder,
+                            faacDecFrameInfo *hInfo,
+                            uint8_t *buffer,
+                            uint32_t buffer_size);
+
+element *decode_sce_lfe(faacDecHandle hDecoder,
+                        faacDecFrameInfo *hInfo, bitfile *ld,
+                        int16_t **spec_data, real_t **spec_coef,
+                        uint8_t id_syn_ele);
+element *decode_cpe(faacDecHandle hDecoder,
+                    faacDecFrameInfo *hInfo, bitfile *ld,
+                    int16_t **spec_data, real_t **spec_coef,
+                    uint8_t id_syn_ele);
+element **raw_data_block(faacDecHandle hDecoder, faacDecFrameInfo *hInfo,
+                         bitfile *ld, element **elements,
+                         int16_t **spec_data, real_t **spec_coef,
+                         program_config *pce, drc_info *drc);
+
+#ifdef _WIN32
+  #pragma pack(pop)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/dither.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,130 @@
+/* This program is licensed under the GNU Library General Public License, version 2,
+ * a copy of which is included with this program (with filename LICENSE.LGPL).
+ *
+ * (c) 2002 John Edwards
+ * mostly lifted from work by Frank Klemm
+ * random functions for dithering.
+ *
+ * last modified:
+ * $Id$
+ */
+#include "common.h"
+
+#ifndef FIXED_POINT
+
+#include <string.h>
+#include "dither.h"
+#include "common.h"
+
+
+double
+Random_Equi ( double mult )                     // gives a equal distributed random number
+{                                               // between -2^31*mult and +2^31*mult
+	return mult * (int) random_int ();
+}
+
+double
+Random_Triangular ( double mult )               // gives a triangular distributed random number
+{                                               // between -2^32*mult and +2^32*mult
+	return mult * ( (double) (int) random_int () + (double) (int) random_int () );
+}
+
+/*********************************************************************************************************************/
+
+static const float32_t  F44_0 [16 + 32] = {
+	(float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0,
+	(float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0,
+
+	(float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0,
+	(float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0,
+
+	(float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0,
+	(float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0
+};
+
+
+static const float32_t  F44_1 [16 + 32] = {  /* SNR(w) = 4.843163 dB, SNR = -3.192134 dB */
+	(float) 0.85018292704024355931, (float) 0.29089597350995344721, (float)-0.05021866022121039450, (float)-0.23545456294599161833,
+	(float)-0.58362726442227032096, (float)-0.67038978965193036429, (float)-0.38566861572833459221, (float)-0.15218663390367969967,
+	(float)-0.02577543084864530676, (float) 0.14119295297688728127, (float) 0.22398848581628781612, (float) 0.15401727203382084116,
+	(float) 0.05216161232906000929, (float)-0.00282237820999675451, (float)-0.03042794608323867363, (float)-0.03109780942998826024,
+
+	(float) 0.85018292704024355931, (float) 0.29089597350995344721, (float)-0.05021866022121039450, (float)-0.23545456294599161833,
+	(float)-0.58362726442227032096, (float)-0.67038978965193036429, (float)-0.38566861572833459221, (float)-0.15218663390367969967,
+	(float)-0.02577543084864530676, (float) 0.14119295297688728127, (float) 0.22398848581628781612, (float) 0.15401727203382084116,
+	(float) 0.05216161232906000929, (float)-0.00282237820999675451, (float)-0.03042794608323867363, (float)-0.03109780942998826024,
+
+	(float) 0.85018292704024355931, (float) 0.29089597350995344721, (float)-0.05021866022121039450, (float)-0.23545456294599161833,
+	(float)-0.58362726442227032096, (float)-0.67038978965193036429, (float)-0.38566861572833459221, (float)-0.15218663390367969967,
+	(float)-0.02577543084864530676, (float) 0.14119295297688728127, (float) 0.22398848581628781612, (float) 0.15401727203382084116,
+	(float) 0.05216161232906000929, (float)-0.00282237820999675451, (float)-0.03042794608323867363, (float)-0.03109780942998826024,
+};
+
+
+static const float32_t  F44_2 [16 + 32] = {  /* SNR(w) = 10.060213 dB, SNR = -12.766730 dB */
+	(float) 1.78827593892108555290, (float) 0.95508210637394326553, (float)-0.18447626783899924429, (float)-0.44198126506275016437,
+	(float)-0.88404052492547413497, (float)-1.42218907262407452967, (float)-1.02037566838362314995, (float)-0.34861755756425577264,
+	(float)-0.11490230170431934434, (float) 0.12498899339968611803, (float) 0.38065885268563131927, (float) 0.31883491321310506562,
+	(float) 0.10486838686563442765, (float)-0.03105361685110374845, (float)-0.06450524884075370758, (float)-0.02939198261121969816,
+
+	(float) 1.78827593892108555290, (float) 0.95508210637394326553, (float)-0.18447626783899924429, (float)-0.44198126506275016437,
+	(float)-0.88404052492547413497, (float)-1.42218907262407452967, (float)-1.02037566838362314995, (float)-0.34861755756425577264,
+	(float)-0.11490230170431934434, (float) 0.12498899339968611803, (float) 0.38065885268563131927, (float) 0.31883491321310506562,
+	(float) 0.10486838686563442765, (float)-0.03105361685110374845, (float)-0.06450524884075370758, (float)-0.02939198261121969816,
+
+	(float) 1.78827593892108555290, (float) 0.95508210637394326553, (float)-0.18447626783899924429, (float)-0.44198126506275016437,
+	(float)-0.88404052492547413497, (float)-1.42218907262407452967, (float)-1.02037566838362314995, (float)-0.34861755756425577264,
+	(float)-0.11490230170431934434, (float) 0.12498899339968611803, (float) 0.38065885268563131927, (float) 0.31883491321310506562,
+	(float) 0.10486838686563442765, (float)-0.03105361685110374845, (float)-0.06450524884075370758, (float)-0.02939198261121969816,
+};
+
+
+static const float32_t  F44_3 [16 + 32] = {  /* SNR(w) = 15.382598 dB, SNR = -29.402334 dB */
+	(float) 2.89072132015058161445, (float) 2.68932810943698754106, (float) 0.21083359339410251227, (float)-0.98385073324997617515,
+	(float)-1.11047823227097316719, (float)-2.18954076314139673147, (float)-2.36498032881953056225, (float)-0.95484132880101140785,
+	(float)-0.23924057925542965158, (float)-0.13865235703915925642, (float) 0.43587843191057992846, (float) 0.65903257226026665927,
+	(float) 0.24361815372443152787, (float)-0.00235974960154720097, (float) 0.01844166574603346289, (float) 0.01722945988740875099,
+
+	(float) 2.89072132015058161445, (float) 2.68932810943698754106, (float) 0.21083359339410251227, (float)-0.98385073324997617515,
+	(float)-1.11047823227097316719, (float)-2.18954076314139673147, (float)-2.36498032881953056225, (float)-0.95484132880101140785,
+	(float)-0.23924057925542965158, (float)-0.13865235703915925642, (float) 0.43587843191057992846, (float) 0.65903257226026665927,
+	(float) 0.24361815372443152787, (float)-0.00235974960154720097, (float) 0.01844166574603346289, (float) 0.01722945988740875099,
+
+	(float) 2.89072132015058161445, (float) 2.68932810943698754106, (float) 0.21083359339410251227, (float)-0.98385073324997617515,
+	(float)-1.11047823227097316719, (float)-2.18954076314139673147, (float)-2.36498032881953056225, (float)-0.95484132880101140785,
+	(float)-0.23924057925542965158, (float)-0.13865235703915925642, (float) 0.43587843191057992846, (float) 0.65903257226026665927,
+	(float) 0.24361815372443152787, (float)-0.00235974960154720097, (float) 0.01844166574603346289, (float) 0.01722945988740875099
+};
+
+
+double
+scalar16 ( const float32_t* x, const float32_t* y )
+{
+	return x[ 0]*y[ 0] + x[ 1]*y[ 1] + x[ 2]*y[ 2] + x[ 3]*y[ 3]
+	     + x[ 4]*y[ 4] + x[ 5]*y[ 5] + x[ 6]*y[ 6] + x[ 7]*y[ 7]
+	     + x[ 8]*y[ 8] + x[ 9]*y[ 9] + x[10]*y[10] + x[11]*y[11]
+	     + x[12]*y[12] + x[13]*y[13] + x[14]*y[14] + x[15]*y[15];
+}
+
+
+void
+Init_Dither ( unsigned char bits, unsigned char shapingtype )
+{
+	static uint8_t          default_dither [] = { 92, 92, 88, 84, 81, 78, 74, 67,  0,  0 };
+	static const float32_t*              F [] = { F44_0, F44_1, F44_2, F44_3 };
+	uint8_t                 index;
+
+	if (shapingtype > 3) shapingtype = 3;
+	index = bits - 11 - shapingtype;
+	if (index > 9) index = 9;
+
+	memset ( Dither.ErrorHistory , 0, sizeof (Dither.ErrorHistory ) );
+	memset ( Dither.DitherHistory, 0, sizeof (Dither.DitherHistory) );
+
+	Dither.FilterCoeff = F [shapingtype];
+	Dither.Mask   = ((uint64_t)-1) << (32 - bits);
+	Dither.Add    = 0.5     * ((1L << (32 - bits)) - 1);
+	Dither.Dither = 0.01*default_dither[index] / (((int64_t)1) << bits);
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/dither.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,47 @@
+/* This program is licensed under the GNU Library General Public License, version 2,
+ * a copy of which is included with this program (with filename LICENSE.LGPL).
+ *
+ * (c) 2002 John Edwards
+ *
+ * rand_t header.
+ *
+ * last modified: $ID:$
+ */
+
+#include "common.h"
+
+#ifndef __RAND_T_H
+#define __RAND_T_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif 
+
+#ifndef FIXED_POINT
+
+typedef struct {
+    const float32_t*  FilterCoeff;
+    uint64_t          Mask;
+    double            Add;
+    float32_t         Dither;
+    float32_t         ErrorHistory     [2] [16];       // max. 2 channels, 16th order Noise shaping
+    float32_t         DitherHistory    [2] [16];
+    int32_t           LastRandomNumber [2];
+} dither_t;
+
+extern dither_t            Dither;
+extern double              doubletmp;
+//static const uint8_t       Parity [256];
+uint32_t                   random_int ( void );
+extern double              scalar16 ( const float32_t* x, const float32_t* y );
+extern double              Random_Equi ( double mult );
+extern double              Random_Triangular ( double mult );
+void                       Init_Dither ( unsigned char bits, unsigned char shapingtype );
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif 
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/drc.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,170 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: drc.c,v 1.13 2003/07/29 08:20:12 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include "syntax.h"
+#include "drc.h"
+
+drc_info *drc_init(real_t cut, real_t boost)
+{
+    drc_info *drc = (drc_info*)malloc(sizeof(drc_info));
+    memset(drc, 0, sizeof(drc_info));
+
+    drc->ctrl1 = cut;
+    drc->ctrl2 = boost;
+
+    drc->num_bands = 1;
+    drc->band_top[0] = 1024/4 - 1;
+    drc->dyn_rng_sgn[0] = 1;
+    drc->dyn_rng_ctl[0] = 0;
+
+    return drc;
+}
+
+void drc_end(drc_info *drc)
+{
+    if (drc) free(drc);
+}
+
+#ifdef FIXED_POINT
+static real_t drc_pow2_table[] =
+{
+    COEF_CONST(0.5146511183),
+    COEF_CONST(0.5297315472),
+    COEF_CONST(0.5452538663),
+    COEF_CONST(0.5612310242),
+    COEF_CONST(0.5776763484),
+    COEF_CONST(0.5946035575),
+    COEF_CONST(0.6120267717),
+    COEF_CONST(0.6299605249),
+    COEF_CONST(0.6484197773),
+    COEF_CONST(0.6674199271),
+    COEF_CONST(0.6869768237),
+    COEF_CONST(0.7071067812),
+    COEF_CONST(0.7278265914),
+    COEF_CONST(0.7491535384),
+    COEF_CONST(0.7711054127),
+    COEF_CONST(0.7937005260),
+    COEF_CONST(0.8169577266),
+    COEF_CONST(0.8408964153),
+    COEF_CONST(0.8655365610),
+    COEF_CONST(0.8908987181),
+    COEF_CONST(0.9170040432),
+    COEF_CONST(0.9438743127),
+    COEF_CONST(0.9715319412),
+    COEF_CONST(1.0000000000),
+    COEF_CONST(1.0293022366),
+    COEF_CONST(1.0594630944),
+    COEF_CONST(1.0905077327),
+    COEF_CONST(1.1224620483),
+    COEF_CONST(1.1553526969),
+    COEF_CONST(1.1892071150),
+    COEF_CONST(1.2240535433),
+    COEF_CONST(1.2599210499),
+    COEF_CONST(1.2968395547),
+    COEF_CONST(1.3348398542),
+    COEF_CONST(1.3739536475),
+    COEF_CONST(1.4142135624),
+    COEF_CONST(1.4556531828),
+    COEF_CONST(1.4983070769),
+    COEF_CONST(1.5422108254),
+    COEF_CONST(1.5874010520),
+    COEF_CONST(1.6339154532),
+    COEF_CONST(1.6817928305),
+    COEF_CONST(1.7310731220),
+    COEF_CONST(1.7817974363),
+    COEF_CONST(1.8340080864),
+    COEF_CONST(1.8877486254),
+    COEF_CONST(1.9430638823)
+};
+#endif
+
+void drc_decode(drc_info *drc, real_t *spec)
+{
+    uint16_t i, bd, top;
+#ifdef FIXED_POINT
+    int32_t exp, frac;
+#else
+    real_t factor, exp;
+#endif
+    uint16_t bottom = 0;
+
+    if (drc->num_bands == 1)
+        drc->band_top[0] = 1024/4 - 1;
+
+    for (bd = 0; bd < drc->num_bands; bd++)
+    {
+        top = 4 * (drc->band_top[bd] + 1);
+
+#ifndef FIXED_POINT
+        /* Decode DRC gain factor */
+        if (drc->dyn_rng_sgn[bd])  /* compress */
+            exp = -drc->ctrl1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/24.0;
+        else /* boost */
+            exp = drc->ctrl2 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/24.0;
+        factor = (real_t)pow(2.0, exp);
+
+        /* Apply gain factor */
+        for (i = bottom; i < top; i++)
+            spec[i] *= factor;
+#else
+        /* Decode DRC gain factor */
+        if (drc->dyn_rng_sgn[bd])  /* compress */
+        {
+            exp = -1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/ 24;
+            frac = -1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) % 24;
+        } else { /* boost */
+            exp = (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/ 24;
+            frac = (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) % 24;
+        }
+
+        /* Apply gain factor */
+        if (exp < 0)
+        {
+            for (i = bottom; i < top; i++)
+            {
+                spec[i] >>= -exp;
+                if (frac)
+                    spec[i] = MUL(spec[i],drc_pow2_table[frac+23]);
+            }
+        } else {
+            for (i = bottom; i < top; i++)
+            {
+                spec[i] <<= exp;
+                if (frac)
+                    spec[i] = MUL(spec[i],drc_pow2_table[frac+23]);
+            }
+        }
+#endif
+
+        bottom = top;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/drc.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,46 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: drc.h,v 1.7 2003/07/29 08:20:12 menno Exp $
+**/
+
+#ifndef __DRC_H__
+#define __DRC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define DRC_REF_LEVEL 20*4 /* -20 dB */
+
+
+drc_info *drc_init(real_t cut, real_t boost);
+void drc_end(drc_info *drc);
+void drc_decode(drc_info *drc, real_t *spec);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/error.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,49 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: error.c,v 1.10 2003/07/29 08:20:12 menno Exp $
+**/
+
+#include "common.h"
+#include "error.h"
+
+extern int8_t *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",
+    "Unable to find ADTS syncword",
+    "Channel coupling not yet implemented",
+    "Channel configuration not allowed in error resilient frame",
+    "Bit error in error resilient scalefactor decoding",
+    "Error decoding huffman scalefactor (bitstream error)",
+    "Error decoding huffman codeword (bitstream error)",
+    "Non existent huffman codebook number found",
+    "Maximum number of channels exceeded",
+    "Maximum number of bitstream elements exceeded",
+    "Input data buffer too small",
+    "Array index out of range",
+    "Maximum number of scalefactor bands exceeded"
+};
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/error.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,41 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: error.h,v 1.5 2003/07/29 08:20:12 menno Exp $
+**/
+
+#ifndef __ERROR_H__
+#define __ERROR_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define NUM_ERROR_MESSAGES 17
+extern int8_t *err_msg[];
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/faad.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,193 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: faad.h,v 1.26 2003/07/29 08:20:11 menno Exp $
+**/
+
+#ifndef __AACDEC_H__
+#define __AACDEC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifdef _WIN32
+  #pragma pack(push, 8)
+  #ifndef FAADAPI
+    #define FAADAPI __cdecl
+  #endif
+#else
+  #ifndef FAADAPI
+    #define FAADAPI
+  #endif
+#endif
+
+#define FAAD2_VERSION "2.0 RC1 "
+
+/* object types for AAC */
+#define MAIN       0
+#define LC         1
+#define SSR        2
+#define LTP        3
+#define ER_LC     17
+#define ER_LTP    19
+#define LD        23
+#define DRM_ER_LC 27 /* special object type for DRM */
+
+/* header types */
+#define RAW        0
+#define ADIF       1
+#define ADTS       2
+
+/* 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_DOUBLE 5
+#define FAAD_FMT_16BIT_DITHER  6
+#define FAAD_FMT_16BIT_L_SHAPE 7
+#define FAAD_FMT_16BIT_M_SHAPE 8
+#define FAAD_FMT_16BIT_H_SHAPE 9
+
+/* Capabilities */
+#define LC_DEC_CAP            (1<<0)
+#define MAIN_DEC_CAP          (1<<1)
+#define LTP_DEC_CAP           (1<<2)
+#define LD_DEC_CAP            (1<<3)
+#define ERROR_RESILIENCE_CAP  (1<<4)
+#define FIXED_POINT_CAP       (1<<5)
+
+/* Channel definitions */
+#define FRONT_CHANNEL_CENTER (1)
+#define FRONT_CHANNEL_LEFT   (2)
+#define FRONT_CHANNEL_RIGHT  (3)
+#define SIDE_CHANNEL_LEFT    (4)
+#define SIDE_CHANNEL_RIGHT   (5)
+#define BACK_CHANNEL_LEFT    (6)
+#define BACK_CHANNEL_RIGHT   (7)
+#define BACK_CHANNEL_CENTER  (8)
+#define LFE_CHANNEL          (9)
+#define UNKNOWN_CHANNEL      (0)
+
+
+/* A decode call can eat up to FAAD_MIN_STREAMSIZE bytes per decoded channel,
+   so at least so much bytes per channel should be available in this stream */
+#define FAAD_MIN_STREAMSIZE 768 /* 6144 bits/channel */
+
+
+typedef void *faacDecHandle;
+
+typedef struct mp4AudioSpecificConfig
+{
+    /* Audio Specific Info */
+    unsigned char objectTypeIndex;
+    unsigned char samplingFrequencyIndex;
+    unsigned long samplingFrequency;
+    unsigned char channelsConfiguration;
+
+    /* GA Specific Info */
+    unsigned char frameLengthFlag;
+    unsigned char dependsOnCoreCoder;
+    unsigned short coreCoderDelay;
+    unsigned char extensionFlag;
+    unsigned char aacSectionDataResilienceFlag;
+    unsigned char aacScalefactorDataResilienceFlag;
+    unsigned char aacSpectralDataResilienceFlag;
+    unsigned char epConfig;
+
+    char sbr_present_flag;
+} mp4AudioSpecificConfig;
+
+typedef struct faacDecConfiguration
+{
+    unsigned char defObjectType;
+    unsigned long defSampleRate;
+    unsigned char outputFormat;
+    unsigned char downMatrix;
+} faacDecConfiguration, *faacDecConfigurationPtr;
+
+typedef struct faacDecFrameInfo
+{
+    unsigned long bytesconsumed;
+    unsigned long samples;
+    unsigned char channels;
+    unsigned char error;
+    unsigned long samplerate;
+
+    /* multichannel configuration */
+    unsigned char num_front_channels;
+    unsigned char num_side_channels;
+    unsigned char num_back_channels;
+    unsigned char num_lfe_channels;
+    unsigned char channel_position[64];
+} faacDecFrameInfo;
+
+char* FAADAPI faacDecGetErrorMessage(unsigned char errcode);
+
+unsigned long FAADAPI faacDecGetCapabilities();
+
+faacDecHandle FAADAPI faacDecOpen();
+
+faacDecConfigurationPtr FAADAPI faacDecGetCurrentConfiguration(faacDecHandle hDecoder);
+
+unsigned char FAADAPI faacDecSetConfiguration(faacDecHandle hDecoder,
+                                    faacDecConfigurationPtr config);
+
+/* Init the library based on info from the AAC file (ADTS/ADIF) */
+long FAADAPI faacDecInit(faacDecHandle hDecoder,
+                        unsigned char *buffer,
+                        unsigned long buffer_size,
+                        unsigned long *samplerate,
+                        unsigned char *channels);
+
+/* Init the library using a DecoderSpecificInfo */
+char FAADAPI faacDecInit2(faacDecHandle hDecoder, unsigned char *pBuffer,
+                         unsigned long SizeOfDecoderSpecificInfo,
+                         unsigned long *samplerate, unsigned char *channels);
+
+/* Init the library for DRM */
+char FAADAPI faacDecInitDRM(faacDecHandle hDecoder, unsigned long samplerate,
+                            unsigned char channels);
+
+void FAADAPI faacDecClose(faacDecHandle hDecoder);
+
+void* FAADAPI faacDecDecode(faacDecHandle hDecoder,
+                            faacDecFrameInfo *hInfo,
+                            unsigned char *buffer,
+                            unsigned long buffer_size);
+
+char FAADAPI AudioSpecificConfig(unsigned char *pBuffer,
+                                 unsigned long buffer_size,
+                                 mp4AudioSpecificConfig *mp4ASC);
+
+#ifdef _WIN32
+  #pragma pack(pop)
+#endif
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/filtbank.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,334 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: filtbank.c,v 1.25 2003/07/29 08:20:12 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+#include <string.h>
+#ifdef _WIN32_WCE
+#define assert(x)
+#else
+#include <assert.h>
+#endif
+
+#include "filtbank.h"
+#include "decoder.h"
+#include "syntax.h"
+#include "kbd_win.h"
+#include "sine_win.h"
+#include "mdct.h"
+
+
+fb_info *filter_bank_init(uint16_t frame_len)
+{
+    uint16_t nshort = frame_len/8;
+#ifdef LD_DEC
+    uint16_t frame_len_ld = frame_len/2;
+#endif
+
+    fb_info *fb = (fb_info*)malloc(sizeof(fb_info));
+    memset(fb, 0, sizeof(fb_info));
+
+    /* normal */
+    fb->mdct256 = faad_mdct_init(2*nshort);
+    fb->mdct2048 = faad_mdct_init(2*frame_len);
+#ifdef LD_DEC
+    /* LD */
+    fb->mdct1024 = faad_mdct_init(2*frame_len_ld);
+#endif
+
+    if (frame_len == 1024)
+    {
+        fb->long_window[0]  = sine_long_1024;
+        fb->short_window[0] = sine_short_128;
+        fb->long_window[1]  = kbd_long_1024;
+        fb->short_window[1] = kbd_short_128;
+#ifdef LD_DEC
+        fb->ld_window[0] = sine_mid_512;
+        fb->ld_window[1] = ld_mid_512;
+#endif
+    } else /* (frame_len == 960) */ {
+        fb->long_window[0]  = sine_long_960;
+        fb->short_window[0] = sine_short_120;
+        fb->long_window[1]  = kbd_long_960;
+        fb->short_window[1] = kbd_short_120;
+#ifdef LD_DEC
+        fb->ld_window[0] = sine_mid_480;
+        fb->ld_window[1] = ld_mid_480;
+#endif
+    }
+
+    return fb;
+}
+
+void filter_bank_end(fb_info *fb)
+{
+    if (fb != NULL)
+    {
+        faad_mdct_end(fb->mdct256);
+        faad_mdct_end(fb->mdct2048);
+#ifdef LD_DEC
+        faad_mdct_end(fb->mdct1024);
+#endif
+
+        free(fb);
+    }
+}
+
+static INLINE void imdct(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len)
+{
+    mdct_info *mdct;
+
+    switch (len)
+    {
+    case 2048:
+    case 1920:
+        mdct = fb->mdct2048;
+        break;
+    case 256:
+    case 240:
+        mdct = fb->mdct256;
+        break;
+#ifdef LD_DEC
+    case 1024:
+    case 960:
+        mdct = fb->mdct1024;
+        break;
+#endif
+    }
+
+    faad_imdct(mdct, in_data, out_data);
+}
+
+#ifdef LTP_DEC
+static INLINE void mdct(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len)
+{
+    mdct_info *mdct;
+
+    switch (len)
+    {
+    case 2048:
+    case 1920:
+        mdct = fb->mdct2048;
+        break;
+    case 256:
+    case 240:
+        mdct = fb->mdct256;
+        break;
+#ifdef LD_DEC
+    case 1024:
+    case 960:
+        mdct = fb->mdct1024;
+        break;
+#endif
+    }
+
+    faad_mdct(mdct, in_data, out_data);
+}
+#endif
+
+void ifilter_bank(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;
+    real_t *transf_buf;
+
+    real_t *window_long;
+    real_t *window_long_prev;
+    real_t *window_short;
+    real_t *window_short_prev;
+
+    uint16_t nlong = frame_len;
+    uint16_t nshort = frame_len/8;
+    uint16_t trans = nshort/2;
+
+    uint16_t nflat_ls = (nlong-nshort)/2;
+
+    transf_buf = (real_t*)malloc(2*nlong*sizeof(real_t));
+
+#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(fb, freq_in, transf_buf, 2*nlong);
+        for (i = nlong-1; i >= 0; i--)
+        {
+            time_out[i] = time_out[nlong+i] + MUL_R_C(transf_buf[i],window_long_prev[i]);
+            time_out[nlong+i] = MUL_R_C(transf_buf[nlong+i],window_long[nlong-1-i]);
+        }
+        break;
+
+    case LONG_START_SEQUENCE:
+        imdct(fb, freq_in, transf_buf, 2*nlong);
+        for (i = 0; i < nlong; i++)
+            time_out[i] = time_out[nlong+i] + MUL_R_C(transf_buf[i],window_long_prev[i]);
+        for (i = 0; i < nflat_ls; i++)
+            time_out[nlong+i] = transf_buf[nlong+i];
+        for (i = 0; i < nshort; i++)
+            time_out[nlong+nflat_ls+i] = MUL_R_C(transf_buf[nlong+nflat_ls+i],window_short[nshort-i-1]);
+        for (i = 0; i < nflat_ls; i++)
+            time_out[nlong+nflat_ls+nshort+i] = 0;
+        break;
+
+    case EIGHT_SHORT_SEQUENCE:
+        imdct(fb, freq_in+0*nshort, transf_buf+2*nshort*0, 2*nshort);
+        imdct(fb, freq_in+1*nshort, transf_buf+2*nshort*1, 2*nshort);
+        imdct(fb, freq_in+2*nshort, transf_buf+2*nshort*2, 2*nshort);
+        imdct(fb, freq_in+3*nshort, transf_buf+2*nshort*3, 2*nshort);
+        imdct(fb, freq_in+4*nshort, transf_buf+2*nshort*4, 2*nshort);
+        imdct(fb, freq_in+5*nshort, transf_buf+2*nshort*5, 2*nshort);
+        imdct(fb, freq_in+6*nshort, transf_buf+2*nshort*6, 2*nshort);
+        imdct(fb, freq_in+7*nshort, transf_buf+2*nshort*7, 2*nshort);
+        for (i = 0; i < nflat_ls; i++)
+            time_out[i] = time_out[nlong+i];
+        for(i = nshort-1; i >= 0; i--)
+        {
+            time_out[nflat_ls+         i] = time_out[nlong+nflat_ls+         i] + MUL_R_C(transf_buf[nshort*0+i],window_short_prev[i]);
+            time_out[nflat_ls+1*nshort+i] = time_out[nlong+nflat_ls+nshort*1+i] + MUL_R_C(transf_buf[nshort*1+i],window_short[nshort-1-i]) + MUL_R_C(transf_buf[nshort*2+i],window_short[i]);
+            time_out[nflat_ls+2*nshort+i] = time_out[nlong+nflat_ls+nshort*2+i] + MUL_R_C(transf_buf[nshort*3+i],window_short[nshort-1-i]) + MUL_R_C(transf_buf[nshort*4+i],window_short[i]);
+            time_out[nflat_ls+3*nshort+i] = time_out[nlong+nflat_ls+nshort*3+i] + MUL_R_C(transf_buf[nshort*5+i],window_short[nshort-1-i]) + MUL_R_C(transf_buf[nshort*6+i],window_short[i]);
+            if (i < trans)
+                time_out[nflat_ls+4*nshort+i] = time_out[nlong+nflat_ls+nshort*4+i] + MUL_R_C(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_R_C(transf_buf[nshort*8+i],window_short[i]);
+            else
+                time_out[nflat_ls+4*nshort+i] = MUL_R_C(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_R_C(transf_buf[nshort*8+i],window_short[i]);
+            time_out[nflat_ls+5*nshort+i] = MUL_R_C(transf_buf[nshort*9+i],window_short[nshort-1-i]) + MUL_R_C(transf_buf[nshort*10+i],window_short[i]);
+            time_out[nflat_ls+6*nshort+i] = MUL_R_C(transf_buf[nshort*11+i],window_short[nshort-1-i]) + MUL_R_C(transf_buf[nshort*12+i],window_short[i]);
+            time_out[nflat_ls+7*nshort+i] = MUL_R_C(transf_buf[nshort*13+i],window_short[nshort-1-i]) + MUL_R_C(transf_buf[nshort*14+i],window_short[i]);
+            time_out[nflat_ls+8*nshort+i] = MUL_R_C(transf_buf[nshort*15+i],window_short[nshort-1-i]);
+        }
+        for (i = 0; i < nflat_ls; i++)
+            time_out[nlong+nflat_ls+nshort+i] = 0;
+        break;
+
+    case LONG_STOP_SEQUENCE:
+        imdct(fb, freq_in, transf_buf, 2*nlong);
+        for (i = 0; i < nflat_ls; i++)
+            time_out[i] = time_out[nlong+i];
+        for (i = 0; i < nshort; i++)
+            time_out[nflat_ls+i] = time_out[nlong+nflat_ls+i] + MUL_R_C(transf_buf[nflat_ls+i],window_short_prev[i]);
+        for (i = 0; i < nflat_ls; i++)
+            time_out[nflat_ls+nshort+i] = time_out[nlong+nflat_ls+nshort+i] + transf_buf[nflat_ls+nshort+i];
+        for (i = 0; i < nlong; i++)
+            time_out[nlong+i] = MUL_R_C(transf_buf[nlong+i],window_long[nlong-1-i]);
+		break;
+    }
+
+    free(transf_buf);
+}
+
+#ifdef LTP_DEC
+/* only works for LTP -> no overlapping, no short blocks */
+void filter_bank_ltp(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
+                     uint8_t window_shape_prev, real_t *in_data, real_t *out_mdct,
+                     uint8_t object_type, uint16_t frame_len)
+{
+    int16_t i;
+    real_t *windowed_buf;
+
+    real_t *window_long;
+    real_t *window_long_prev;
+    real_t *window_short;
+    real_t *window_short_prev;
+
+    uint16_t nlong = frame_len;
+    uint16_t nshort = frame_len/8;
+    uint16_t nflat_ls = (nlong-nshort)/2;
+
+    assert(window_sequence != EIGHT_SHORT_SEQUENCE);
+
+    windowed_buf = (real_t*)malloc(nlong*2*sizeof(real_t));
+
+#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:
+        for (i = nlong-1; i >= 0; i--)
+        {
+            windowed_buf[i] = MUL_R_C(in_data[i], window_long_prev[i]);
+            windowed_buf[i+nlong] = MUL_R_C(in_data[i+nlong], window_long[nlong-1-i]);
+        }
+        mdct(fb, windowed_buf, out_mdct, 2*nlong);
+        break;
+
+    case LONG_START_SEQUENCE:
+        for (i = 0; i < nlong; i++)
+            windowed_buf[i] = MUL_R_C(in_data[i], window_long_prev[i]);
+        for (i = 0; i < nflat_ls; i++)
+            windowed_buf[i+nlong] = in_data[i+nlong];
+        for (i = 0; i < nshort; i++)
+            windowed_buf[i+nlong+nflat_ls] = MUL_R_C(in_data[i+nlong+nflat_ls], window_short[nshort-1-i]);
+        for (i = 0; i < nflat_ls; i++)
+            windowed_buf[i+nlong+nflat_ls+nshort] = 0;
+        mdct(fb, windowed_buf, out_mdct, 2*nlong);
+        break;
+
+    case LONG_STOP_SEQUENCE:
+        for (i = 0; i < nflat_ls; i++)
+            windowed_buf[i] = 0;
+        for (i = 0; i < nshort; i++)
+            windowed_buf[i+nflat_ls] = MUL_R_C(in_data[i+nflat_ls], window_short_prev[i]);
+        for (i = 0; i < nflat_ls; i++)
+            windowed_buf[i+nflat_ls+nshort] = in_data[i+nflat_ls+nshort];
+        for (i = 0; i < nlong; i++)
+            windowed_buf[i+nlong] = MUL_R_C(in_data[i+nlong], window_long[nlong-1-i]);
+        mdct(fb, windowed_buf, out_mdct, 2*nlong);
+        break;
+    }
+
+    free(windowed_buf);
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/filtbank.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,63 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: filtbank.h,v 1.11 2003/07/29 08:20:12 menno Exp $
+**/
+
+#ifndef __FILTBANK_H__
+#define __FILTBANK_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "mdct.h"
+
+fb_info *filter_bank_init(uint16_t frame_len);
+void filter_bank_end(fb_info *fb);
+
+#ifdef LTP_DEC
+void filter_bank_ltp(fb_info *fb,
+                     uint8_t window_sequence,
+                     uint8_t window_shape,
+                     uint8_t window_shape_prev,
+                     real_t *in_data,
+                     real_t *out_mdct,
+                     uint8_t object_type,
+                     uint16_t frame_len);
+#endif
+
+void ifilter_bank(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);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/fixed.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,145 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: fixed.h,v 1.9 2003/07/29 08:20:12 menno Exp $
+**/
+
+#ifndef __FIXED_H__
+#define __FIXED_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define COEF_BITS 28
+#define COEF_PRECISION (1 << COEF_BITS)
+#define REAL_BITS 15 //7
+#define REAL_PRECISION (1 << REAL_BITS)
+
+
+typedef int32_t real_t;
+
+
+#define REAL_CONST(A) ((real_t)(A*(REAL_PRECISION)))
+#define COEF_CONST(A) ((real_t)(A*(COEF_PRECISION)))
+
+#if defined(_WIN32) && !defined(_WIN32_WCE)
+
+/* multiply real with real */
+static INLINE MUL(real_t A, real_t B)
+{
+    _asm {
+        mov eax,A
+        imul B
+#if 0
+        shrd eax,edx,REAL_BITS
+#else
+        shr eax,REAL_BITS
+        shl edx,(32-REAL_BITS)
+        or eax,edx
+#endif
+    }
+}
+
+/* multiply coef with coef */
+static INLINE MUL_C_C(real_t A, real_t B)
+{
+    _asm {
+        mov eax,A
+        imul B
+#if 0
+        shrd eax,edx,COEF_BITS
+#else
+        shr eax,COEF_BITS
+        shl edx,(32-COEF_BITS)
+        or eax,edx
+#endif
+    }
+}
+
+/* multiply real with coef */
+static INLINE MUL_R_C(real_t A, real_t B)
+{
+    _asm {
+        mov eax,A
+        imul B
+#if 0
+        shrd eax,edx,COEF_BITS
+#else
+        shr eax,COEF_BITS
+        shl edx,(32-COEF_BITS)
+        or eax,edx
+#endif
+    }
+}
+
+#elif defined(__GNUC__) && defined (__arm__)
+
+/* taken from MAD */
+#define arm_mul(x, y, SCALEBITS) \
+       ({      uint32_t __hi; \
+               uint32_t __lo; \
+               uint32_t __result; \
+               asm ("smull  %0, %1, %3, %4\n\t" \
+                    "movs   %0, %0, lsr %5\n\t" \
+                    "adc    %2, %0, %1, lsl %6" \
+                    : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \
+                    : "%r" (x), "r" (y), \
+                      "M" (SCALEBITS), "M" (32 - (SCALEBITS)) \
+                    : "cc"); \
+               __result; \
+       })
+
+static INLINE real_t MUL(real_t A, real_t B)
+{
+       return arm_mul( A, B, REAL_BITS);
+}
+
+static INLINE real_t MUL_C_C(real_t A, real_t B)
+{
+       return arm_mul( A, B, COEF_BITS);
+}
+
+static INLINE real_t MUL_R_C(real_t A, real_t B)
+{
+       return arm_mul( A, B, COEF_BITS);
+}
+
+#else
+
+  /* multiply real with real */
+  #define MUL(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (REAL_BITS-1))) >> REAL_BITS)
+  /* multiply coef with coef */
+  #define MUL_C_C(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (COEF_BITS-1))) >> COEF_BITS)
+  /* multiply real with coef */
+  #define MUL_R_C(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (COEF_BITS-1))) >> COEF_BITS)
+
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/hcr.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,628 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2002 A. Kurpiers
+**  
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcr.c,v 1.5 2003/07/29 08:20:12 menno Exp $
+**/
+
+
+#include "common.h"
+#include "structs.h"
+
+#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 "codebook/hcb.h"
+
+/* Implements the HCR11 tool as described in ISO/IEC 14496-3/Amd.1, 8.5.3.3 */
+
+#ifdef ERROR_RESILIENCE
+
+typedef struct
+{
+    /* bit input */
+    uint32_t bufa;
+    uint32_t bufb;
+    int8_t len; 
+} bits_t;
+
+
+static INLINE uint32_t showbits(bits_t *ld, uint8_t bits)
+{
+    if (bits == 0) return 0;
+    if (ld->len <= 32){
+        /* huffman_spectral_data_2 needs to read more than may be available, bits maybe
+           > ld->len, deliver 0 than */
+        if (ld->len >= bits)
+            return ((ld->bufa >> (ld->len - bits)) & (0xFFFFFFFF >> (32 - bits)));
+        else
+            return ((ld->bufa << (bits - ld->len)) & (0xFFFFFFFF >> (32 - bits)));        
+    } else {
+        if ((ld->len - bits) < 32)
+        {
+            return ( (ld->bufb & (0xFFFFFFFF >> (64 - ld->len))) << (bits - ld->len + 32)) |
+                (ld->bufa >> (ld->len - bits));
+        } else {
+            return ((ld->bufb >> (ld->len - bits - 32)) & (0xFFFFFFFF >> (32 - bits)));
+        }
+    }
+}
+
+/* return 1 if position is outside of buffer, 0 otherwise */
+static INLINE int8_t flushbits( bits_t *ld, uint8_t bits)
+{
+    ld->len -= bits;
+
+    if (ld->len <0)
+    {
+        ld->len = 0;
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+
+static INLINE int8_t getbits(bits_t *ld, uint8_t n, uint32_t *result)
+{
+    *result = showbits(ld, n);
+    return flushbits(ld, n);
+}
+
+static INLINE int8_t get1bit(bits_t *ld, uint8_t *result)
+{
+    uint32_t res;
+    int8_t ret;
+
+    ret = getbits(ld, 1, &res);
+    *result = (int8_t)(res & 1);
+    return ret;
+}
+
+/* Special version of huffman_spectral_data adapted from huffman.h
+Will not read from a bitfile but a bits_t structure.
+Will keep track of the bits decoded and return the number of bits remaining.
+Do not read more than ld->len, return -1 if codeword would be longer */
+
+static int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp )
+{
+    uint32_t cw;
+    uint16_t offset = 0;
+    uint8_t extra_bits;
+    uint8_t i;
+    uint8_t save_cb = cb;
+
+
+    switch (cb)
+    {
+    case 1: /* 2-step method for data quadruples */
+    case 2:
+    case 4:
+
+        cw = showbits(ld, hcbN[cb]);
+        offset = hcb_table[cb][cw].offset;
+        extra_bits = hcb_table[cb][cw].extra_bits;
+
+        if (extra_bits)
+        {
+            /* we know for sure it's more than hcbN[cb] bits long */
+            if ( flushbits(ld, hcbN[cb]) ) return -1;
+            offset += (uint16_t)showbits(ld, extra_bits);
+            if ( flushbits(ld, hcb_2_quad_table[cb][offset].bits - hcbN[cb]) ) return -1;
+        } else {
+            if ( flushbits(ld, hcb_2_quad_table[cb][offset].bits) ) return -1;
+        }
+
+        sp[0] = hcb_2_quad_table[cb][offset].x;
+        sp[1] = hcb_2_quad_table[cb][offset].y;
+        sp[2] = hcb_2_quad_table[cb][offset].v;
+        sp[3] = hcb_2_quad_table[cb][offset].w;
+        break;
+
+    case 6: /* 2-step method for data pairs */
+    case 8:
+    case 10:
+    case 11:
+    /* 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 */
+        if (cb >= 16)
+            cb = 11;
+            
+        cw = showbits(ld, hcbN[cb]);
+        offset = hcb_table[cb][cw].offset;
+        extra_bits = hcb_table[cb][cw].extra_bits;
+
+        if (extra_bits)
+        {
+            /* we know for sure it's more than hcbN[cb] bits long */
+            if ( flushbits(ld, hcbN[cb]) ) return -1;
+            offset += (uint16_t)showbits(ld, extra_bits);
+            if ( flushbits(ld, hcb_2_pair_table[cb][offset].bits - hcbN[cb]) ) return -1;
+        } else {
+            if ( flushbits(ld, hcb_2_pair_table[cb][offset].bits) ) return -1;
+        }
+        sp[0] = hcb_2_pair_table[cb][offset].x;
+        sp[1] = hcb_2_pair_table[cb][offset].y;
+        break;
+
+    case 3: /* binary search for data quadruples */
+
+        while (!hcb3[offset].is_leaf)
+        {
+            uint8_t b;
+            
+            if ( get1bit(ld, &b) ) return -1;
+            offset += hcb3[offset].data[b];
+        }
+
+        sp[0] = hcb3[offset].data[0];
+        sp[1] = hcb3[offset].data[1];
+        sp[2] = hcb3[offset].data[2];
+        sp[3] = hcb3[offset].data[3];
+
+        break;
+
+    case 5: /* binary search for data pairs */
+    case 7:
+    case 9:
+
+        while (!hcb_bin_table[cb][offset].is_leaf)
+        {
+            uint8_t b;
+            
+            if (get1bit(ld, &b) ) return -1;
+            offset += hcb_bin_table[cb][offset].data[b];
+        }
+
+        sp[0] = hcb_bin_table[cb][offset].data[0];
+        sp[1] = hcb_bin_table[cb][offset].data[1];
+
+        break;
+    }
+
+	/* decode sign bits */
+    if (unsigned_cb[cb]) {
+
+        for(i = 0; i < ((cb < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN); i++)
+        {
+            if(sp[i])
+            {
+            	uint8_t b;
+                if ( get1bit(ld, &b) ) return -1;
+                if (b != 0) {
+                    sp[i] = -sp[i];
+                }
+           }
+        }
+    }
+
+    /* decode huffman escape bits */
+    if ((cb == ESC_HCB) || (cb >= 16))
+    {
+        uint8_t k;
+        for (k = 0; k < 2; k++)
+        {
+            if ((sp[k] == 16) || (sp[k] == -16))
+            {
+                uint8_t neg, i;
+                int32_t j;
+                uint32_t off;
+
+                neg = (sp[k] < 0) ? 1 : 0; 
+
+                for (i = 4; ; i++)
+                {
+                    uint8_t b;
+                    if (get1bit(ld, &b))
+                        return -1;
+                    if (b == 0)
+                        break;
+                }
+// TODO: here we would need to test "off" if VCB11 is used!
+                if (getbits(ld, i, &off))
+                    return -1;
+                j = off + (1<<i);
+                sp[k] = (int16_t)((neg) ? -j : j);
+            }
+        }
+    }    
+    return ld->len;
+}
+
+/* rewind len (max. 32) bits so that the MSB becomes LSB */
+
+static uint32_t rewind_word( uint32_t W, uint8_t len)
+{
+    uint8_t i;
+    uint32_t tmp_W=0;
+
+    for ( i=0; i<len; i++ )
+    {
+        tmp_W<<=1;
+        if (W & (1<<i)) tmp_W |= 1;
+    }
+    return tmp_W;
+}
+
+static void rewind_lword( uint32_t *highW, uint32_t *lowW, uint8_t len)
+{
+    uint32_t tmp_lW=0;
+
+    if (len > 32)
+    {
+        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);
+    }
+}    
+
+/* 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;
+
+    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(r, r->len );
+        r->bufa = rewind_word( lw, r->len);
+        r->bufb = 0;
+    }
+}
+
+/* takes codewords from a and b, concatenate them and store them in b */
+static void concat_bits( bits_t * a, bits_t * b)
+{
+    uint32_t	hwa, lwa, hwb, lwb;
+
+    if (a->len == 0) return;
+
+    if (a->len >32)
+    {
+        lwa = a->bufa;
+        hwa = a->bufb & (0xFFFFFFFF >> (64 - a->len));
+    } else {
+        lwa = showbits(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(b, b->len ) | (lwa << (b->len));
+        hwb = (lwa >> (32 - b->len)) | (hwa << (b->len));
+    }
+
+    b->bufa = lwb;
+    b->bufb = hwb;
+    b->len += a->len;
+}
+
+/* 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
+{
+    bits_t		bits;
+    uint8_t		decoded;
+    uint16_t	sp_offset;
+    uint8_t		cb;
+} codeword_state;
+
+
+#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)
+{
+    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 segment_index=0, codeword_index=0;
+    uint16_t nshort = hDecoder->frameLength/8;
+
+
+    memset (spectral_data, 0, hDecoder->frameLength*sizeof(uint16_t));
+
+    if (ics->length_of_reordered_spectral_data == 0)
+        return 0; /* nothing to do */
+
+    /* 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 */
+
+    sp_offset[0] = 0;
+    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 ];
+
+        /* 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 ++)
+        {
+            uint8_t sect_cb, w;
+
+            for (w=0; w< (ics->swb_offset[sfb+1] - ics->swb_offset[sfb]); w+=4)
+            {
+                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))
+                            {
+                                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);
+
+                                    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 );
+
+                                            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 );
+
+                                            } 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 ]);
+
+                                            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);
+
+                                                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)
+                                                {
+                                                    Segment[ numberOfSegments-1 ].bufb = hw + 
+                                                        showbits(&Segment[ numberOfSegments-1 ], Segment[ numberOfSegments-1 ].len - 32);
+                                                    Segment[ numberOfSegments-1 ].bufa = lw + 
+                                                        showbits(&Segment[ numberOfSegments-1 ], 32);
+                                                } else {
+                                                    Segment[ numberOfSegments-1 ].bufa = lw + 
+                                                        showbits(&Segment[ numberOfSegments-1 ], Segment[ numberOfSegments-1 ].len);
+                                                    Segment[ numberOfSegments-1 ].bufb = hw;
+                                                }
+                                                Segment[ numberOfSegments-1 ].len += additional_bits;
+                                            }
+                                            BitsRead = ics->length_of_reordered_spectral_data;
+                                            PCW_decoded = 1;
+
+                                            Codewords[ 0 ].sp_offset = sp;
+                                            Codewords[ 0 ].cb = sect_cb;
+                                            Codewords[ 0 ].decoded = 0;
+                                            Codewords[ 0 ].bits.len = 0;
+                                        }
+                                    } 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 */
+                            }
+                        }
+                    } /* of i */
+                 } /* of g */
+             } /* of w */
+         } /* of sfb */
+    } /* of presort */
+
+    /* Avoid divide by zero */
+    if (numberOfSegments == 0)
+        return 10; /* this is not good... */
+
+    numberOfSets = NrCodeWords / numberOfSegments;     
+
+    /* second step: decode nonPCWs */
+
+    for (set = 1; set <= numberOfSets; set++)
+    {
+        uint16_t trial;
+
+        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;
+
+                        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[] */
+
+                            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 */
+
+                            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 */
+
+        /* 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 (c != 0)
+        {
+            printf("reordered_spectral_data: %d Undecoded Codewords remaining!\n",c );
+        }
+        if ((r !=0) || (c!=0))	return 10;
+    }
+#endif
+
+    return 0;
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/huffman.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,350 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: huffman.h,v 1.13 2003/07/29 08:20:12 menno Exp $
+**/
+
+#ifndef __HUFFMAN_H__
+#define __HUFFMAN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdlib.h>
+#ifdef ANALYSIS
+#include <stdio.h>
+#endif
+#include "bits.h"
+#include "codebook/hcb.h"
+
+
+static INLINE int8_t huffman_scale_factor(bitfile *ld)
+{
+    uint16_t offset = 0;
+
+    while (hcb_sf[offset][1])
+    {
+        uint8_t b = faad_get1bit(ld
+            DEBUGVAR(1,255,"huffman_scale_factor()"));
+        offset += hcb_sf[offset][b];
+
+        if (offset > 240)
+        {
+            /* printf("ERROR: offset into hcb_sf = %d >240!\n", offset); */
+            return -1;
+        }
+    }
+
+    return hcb_sf[offset][0];
+}
+
+
+hcb *hcb_table[] = {
+    0, hcb1_1, hcb2_1, 0, hcb4_1, 0, hcb6_1, 0, hcb8_1, 0, hcb10_1, hcb11_1
+};
+
+hcb_2_quad *hcb_2_quad_table[] = {
+    0, hcb1_2, hcb2_2, 0, hcb4_2, 0, 0, 0, 0, 0, 0, 0
+};
+
+hcb_2_pair *hcb_2_pair_table[] = {
+    0, 0, 0, 0, 0, 0, hcb6_2, 0, hcb8_2, 0, hcb10_2, hcb11_2
+};
+
+hcb_bin_pair *hcb_bin_table[] = {
+    0, 0, 0, 0, 0, hcb5, 0, hcb7, 0, hcb9, 0, 0
+};
+
+uint8_t hcbN[] = { 0, 5, 5, 0, 5, 0, 5, 0, 5, 0, 6, 5 };
+
+/* defines whether a huffman codebook is unsigned or not */
+/* Table 4.6.2 */
+uint8_t unsigned_cb[] = { 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
+         /* codebook 16 to 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+};
+
+int hcb_2_quad_table_size[] = { 0, 114, 86, 0, 185, 0, 0, 0, 0, 0, 0, 0 };
+int hcb_2_pair_table_size[] = { 0, 0, 0, 0, 0, 0, 126, 0, 83, 0, 210, 373 };
+int hcb_bin_table_size[] = { 0, 0, 0, 161, 0, 161, 0, 127, 0, 337, 0, 0 };
+
+static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len)
+{
+    uint8_t i;
+
+    for(i = 0; i < len; i++)
+    {
+        if(sp[i])
+        {
+            if(faad_get1bit(ld
+                DEBUGVAR(1,5,"huffman_sign_bits(): sign bit")) & 1)
+            {
+                sp[i] = -sp[i];
+            }
+        }
+    }
+}
+
+static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp)
+{
+    uint8_t neg, i;
+    int16_t j;
+	int32_t off;
+
+    if (sp < 0) {
+        if(sp != -16)
+            return sp;
+        neg = 1;
+    } else {
+        if(sp != 16)
+            return sp;
+        neg = 0;
+    }
+
+    for (i = 4; ; i++)
+    {
+        if (faad_get1bit(ld
+            DEBUGVAR(1,6,"huffman_getescape(): escape size")) == 0)
+        {
+            break;
+        }
+    }
+
+    off = faad_getbits(ld, i
+        DEBUGVAR(1,9,"huffman_getescape(): escape"));
+
+    j = off + (1<<i);
+    if (neg)
+        j = -j;
+
+    return j;
+}
+
+static uint8_t huffman_2step_quad(uint8_t cb, bitfile *ld, int16_t *sp)
+{
+    uint32_t cw;
+    uint16_t offset = 0;
+    uint8_t extra_bits;
+
+    cw = faad_showbits(ld, hcbN[cb]);
+    offset = hcb_table[cb][cw].offset;
+    extra_bits = hcb_table[cb][cw].extra_bits;
+
+    if (extra_bits)
+    {
+        /* we know for sure it's more than hcbN[cb] bits long */
+        faad_flushbits(ld, hcbN[cb]);
+        offset += (uint16_t)faad_showbits(ld, extra_bits);
+        faad_flushbits(ld, hcb_2_quad_table[cb][offset].bits - hcbN[cb]);
+    } else {
+        faad_flushbits(ld, hcb_2_quad_table[cb][offset].bits);
+    }
+
+    if (offset > hcb_2_quad_table_size[cb])
+    {
+        /* printf("ERROR: offset into hcb_2_quad_table = %d >%d!\n", offset,
+           hcb_2_quad_table_size[cb]); */
+        return 10;
+    }
+
+    sp[0] = hcb_2_quad_table[cb][offset].x;
+    sp[1] = hcb_2_quad_table[cb][offset].y;
+    sp[2] = hcb_2_quad_table[cb][offset].v;
+    sp[3] = hcb_2_quad_table[cb][offset].w;
+
+    return 0;
+}
+
+static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp)
+{
+    uint8_t err = huffman_2step_quad(cb, ld, sp);
+    huffman_sign_bits(ld, sp, QUAD_LEN);
+
+    return err;
+}
+
+static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp)
+{
+    uint32_t cw;
+    uint16_t offset = 0;
+    uint8_t extra_bits;
+
+    cw = faad_showbits(ld, hcbN[cb]);
+    offset = hcb_table[cb][cw].offset;
+    extra_bits = hcb_table[cb][cw].extra_bits;
+
+    if (extra_bits)
+    {
+        /* we know for sure it's more than hcbN[cb] bits long */
+        faad_flushbits(ld, hcbN[cb]);
+        offset += (uint16_t)faad_showbits(ld, extra_bits);
+        faad_flushbits(ld, hcb_2_pair_table[cb][offset].bits - hcbN[cb]);
+    } else {
+        faad_flushbits(ld, hcb_2_pair_table[cb][offset].bits);
+    }
+
+    if (offset > hcb_2_pair_table_size[cb])
+    {
+        /* printf("ERROR: offset into hcb_2_pair_table = %d >%d!\n", offset,
+           hcb_2_pair_table_size[cb]); */
+        return 10;
+    }
+
+    sp[0] = hcb_2_pair_table[cb][offset].x;
+    sp[1] = hcb_2_pair_table[cb][offset].y;
+
+    return 0;
+}
+
+static huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp)
+{
+    uint8_t err = huffman_2step_pair(cb, ld, sp);
+    huffman_sign_bits(ld, sp, PAIR_LEN);
+
+    return err;
+}
+
+static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp)
+{
+    uint16_t offset = 0;
+
+    while (!hcb3[offset].is_leaf)
+    {
+        uint8_t b = faad_get1bit(ld
+            DEBUGVAR(1,255,"huffman_spectral_data():3"));
+        offset += hcb3[offset].data[b];
+    }
+
+    if (offset > hcb_bin_table_size[cb])
+    {
+        /* printf("ERROR: offset into hcb_bin_table = %d >%d!\n", offset,
+           hcb_bin_table_size[cb]); */
+        return 10;
+    }
+
+    sp[0] = hcb3[offset].data[0];
+    sp[1] = hcb3[offset].data[1];
+    sp[2] = hcb3[offset].data[2];
+    sp[3] = hcb3[offset].data[3];
+
+    return 0;
+}
+
+static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp)
+{
+    uint8_t err = huffman_binary_quad(cb, ld, sp);
+    huffman_sign_bits(ld, sp, QUAD_LEN);
+
+    return err;
+}
+
+static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp)
+{
+    uint16_t offset = 0;
+
+    while (!hcb_bin_table[cb][offset].is_leaf)
+    {
+        uint8_t b = faad_get1bit(ld
+            DEBUGVAR(1,255,"huffman_spectral_data():9"));
+        offset += hcb_bin_table[cb][offset].data[b];
+    }
+
+    if (offset > hcb_bin_table_size[cb])
+    {
+        /* printf("ERROR: offset into hcb_bin_table = %d >%d!\n", offset,
+           hcb_bin_table_size[cb]); */
+        return 10;
+    }
+
+    sp[0] = hcb_bin_table[cb][offset].data[0];
+    sp[1] = hcb_bin_table[cb][offset].data[1];
+
+    return 0;
+}
+
+static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp)
+{
+    uint8_t err = huffman_binary_pair(cb, ld, sp);
+    huffman_sign_bits(ld, sp, PAIR_LEN);
+
+    return err;
+}
+
+static int16_t huffman_codebook(uint8_t i)
+{
+    static const uint32_t data = 16428320;
+    if (i == 0) return (int16_t)(data >> 16) & 0xFFFF;
+    else        return (int16_t)data & 0xFFFF;
+}
+
+static INLINE uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp)
+{
+    switch (cb)
+    {
+    case 1: /* 2-step method for data quadruples */
+    case 2:
+        return huffman_2step_quad(cb, ld, sp);
+    case 3: /* binary search for data quadruples */
+        return huffman_binary_quad_sign(cb, ld, sp);
+    case 4: /* 2-step method for data quadruples */
+        return huffman_2step_quad_sign(cb, ld, sp);
+    case 5: /* binary search for data pairs */
+        return huffman_binary_pair(cb, ld, sp);
+    case 6: /* 2-step method for data pairs */
+        return huffman_2step_pair(cb, ld, sp);
+    case 7: /* binary search for data pairs */
+    case 9:
+        return huffman_binary_pair_sign(cb, ld, sp);
+    case 8: /* 2-step method for data pairs */
+    case 10:
+        return huffman_2step_pair_sign(cb, ld, sp);
+    case 12: {
+        uint8_t err = huffman_2step_quad(1, ld, sp);
+        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;
+    }
+    default:
+        /* Non existent codebook number, something went wrong */
+        return 11;
+    }
+
+    return 0;
+}
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/ic_predict.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,196 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ic_predict.c,v 1.12 2003/07/29 08:20:12 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef MAIN_DEC
+
+#include "syntax.h"
+#include "ic_predict.h"
+#include "pns.h"
+
+static void flt_round(real_t *pf)
+{
+    /* more stable version for clever compilers like gcc 3.x */
+    int32_t flg;
+    uint32_t tmp, tmp1, tmp2;
+
+    tmp = *(uint32_t*)pf;
+    flg = tmp & (uint32_t)0x00008000;
+    tmp &= (uint32_t)0xffff0000;
+    tmp1 = tmp;
+
+    /* round 1/2 lsb toward infinity */
+    if (flg)
+    {
+        tmp &= (uint32_t)0xff800000;       /* extract exponent and sign */
+        tmp |= (uint32_t)0x00010000;       /* insert 1 lsb */
+        tmp2 = tmp;                             /* add 1 lsb and elided one */
+        tmp &= (uint32_t)0xff800000;       /* extract exponent and sign */
+        
+        *pf = *(real_t*)&tmp1+*(real_t*)&tmp2-*(real_t*)&tmp;/* subtract elided one */
+    } else {
+        *pf = *(real_t*)&tmp;
+    }
+}
+
+static void ic_predict(pred_state *state, real_t input, real_t *output, uint8_t pred)
+{
+    real_t dr1, predictedvalue;
+    real_t e0, e1;
+    real_t k1, k2;
+
+    real_t *r;
+    real_t *KOR;
+    real_t *VAR;
+
+    r   = state->r;   /* delay elements */
+    KOR = state->KOR; /* correlations */
+    VAR = state->VAR; /* variances */
+
+    if (VAR[0] <= 1)
+        k1 = 0;
+    else
+        k1 = KOR[0]/VAR[0]*B;
+
+    if (pred)
+    {
+        /* only needed for the actual predicted value, k1 is always needed */
+        if (VAR[1] <= 1)
+            k2 = 0;
+        else
+            k2 = KOR[1]/VAR[1]*B;
+
+        predictedvalue = MUL(k1, r[0]) + MUL(k2, r[1]);
+        flt_round(&predictedvalue);
+
+        *output = input + predictedvalue;
+    } else {
+        *output = input;
+    }
+
+    /* calculate new state data */
+    e0 = *output;
+    e1 = e0 - MUL(k1, r[0]);
+
+    dr1 = MUL(k1, e0);
+
+    VAR[0] = MUL(ALPHA, VAR[0]) + MUL(REAL_CONST(0.5), (MUL(r[0], r[0]) + MUL(e0, e0)));
+    KOR[0] = MUL(ALPHA, KOR[0]) + MUL(r[0], e0);
+    VAR[1] = MUL(ALPHA, VAR[1]) + MUL(REAL_CONST(0.5), (MUL(r[1], r[1]) + MUL(e1, e1)));
+    KOR[1] = MUL(ALPHA, KOR[1]) + MUL(r[1], e1);
+
+    r[1] = MUL(A, (r[0]-dr1));
+    r[0] = MUL(A, e0);
+}
+
+static void reset_pred_state(pred_state *state)
+{
+    state->r[0]   = 0;
+    state->r[1]   = 0;
+    state->KOR[0] = 0;
+    state->KOR[1] = 0;
+    state->VAR[0] = REAL_CONST(1.0);
+    state->VAR[1] = REAL_CONST(1.0);
+}
+
+void pns_reset_pred_state(ic_stream *ics, pred_state *state)
+{
+    uint8_t sfb, g, b;
+    uint16_t i, offs, offs2;
+
+    /* prediction only for long blocks */
+    if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+        return;
+
+    for (g = 0; g < ics->num_window_groups; g++)
+    {
+        for (b = 0; b < ics->window_group_length[g]; b++)
+        {
+            for (sfb = 0; sfb < ics->max_sfb; sfb++)
+            {
+                if (is_noise(ics, g, sfb))
+                {
+                    offs = ics->swb_offset[sfb];
+                    offs2 = ics->swb_offset[sfb+1];
+
+                    for (i = offs; i < offs2; i++)
+                        reset_pred_state(&state[i]);
+                }
+            }
+        }
+    }
+}
+
+void reset_all_predictors(pred_state *state, uint16_t frame_len)
+{
+    uint16_t i;
+
+    for (i = 0; i < frame_len; i++)
+        reset_pred_state(&state[i]);
+}
+
+/* intra channel prediction */
+void ic_prediction(ic_stream *ics, real_t *spec, pred_state *state,
+                   uint16_t frame_len)
+{
+    uint8_t sfb;
+    uint16_t bin;
+
+    if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+    {
+        reset_all_predictors(state, frame_len);
+    } else {
+        for (sfb = 0; sfb < ics->pred.limit; sfb++)
+        {
+            uint16_t low  = ics->swb_offset[sfb];
+            uint16_t high = ics->swb_offset[sfb+1];
+
+            for (bin = low; bin < high; bin++)
+            {
+                ic_predict(&state[bin], spec[bin], &spec[bin],
+                    (ics->predictor_data_present &&
+                    ics->pred.prediction_used[sfb]));
+            }
+        }
+
+        if (ics->predictor_data_present)
+        {
+            if (ics->pred.predictor_reset)
+            {
+                for (bin = ics->pred.predictor_reset_group_number - 1;
+                     bin < frame_len; bin += 30)
+                {
+                    reset_pred_state(&state[bin]);
+                }
+            }
+        }
+    }
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/ic_predict.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,53 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** 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.7 2003/07/29 08:20:12 menno Exp $
+**/
+
+#ifdef MAIN_DEC
+
+#ifndef __IC_PREDICT_H__
+#define __IC_PREDICT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ALPHA      REAL_CONST(0.90625)
+#define A          REAL_CONST(0.953125)
+#define B          REAL_CONST(0.953125)
+
+
+void pns_reset_pred_state(ic_stream *ics, pred_state *state);
+void reset_all_predictors(pred_state *state, uint16_t frame_len);
+void ic_prediction(ic_stream *ics, real_t *spec, pred_state *state,
+                   uint16_t frame_len);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/iq_table.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,2112 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** 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.4 2003/07/29 08:20:12 menno Exp $
+**/
+
+#ifndef IQ_TABLE_H__
+#define IQ_TABLE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* !!!DON'T CHANGE IQ_TABLE_SIZE!!! */
+#define IQ_TABLE_SIZE  1026
+
+#ifndef FIXED_POINT
+
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+
+static real_t iq_table[] =
+{
+    0.0000000000,
+    1.0000000000,
+    2.5198420998,
+    4.3267487109,
+    6.3496042079,
+    8.5498797334,
+    10.9027235570,
+    13.3905182794,
+    16.0000000000,
+    18.7207544075,
+    21.5443469003,
+    24.4637809963,
+    27.4731418213,
+    30.5673509404,
+    33.7419916985,
+    36.9931811150,
+    40.3174735966,
+    43.7117870412,
+    47.1733450958,
+    50.6996313257,
+    54.2883523319,
+    57.9374077040,
+    61.6448652744,
+    65.4089405366,
+    69.2279793748,
+    73.1004434553,
+    77.0248977786,
+    81.0000000000,
+    85.0244912125,
+    89.0971879449,
+    93.2169751786,
+    97.3828002241,
+    101.5936673260,
+    105.8486328899,
+    110.1468012434,
+    114.4873208566,
+    118.8693809602,
+    123.2922085109,
+    127.7550654584,
+    132.2572462776,
+    136.7980757341,
+    141.3769068557,
+    145.9931190852,
+    150.6461165966,
+    155.3353267543,
+    160.0601987021,
+    164.8202020667,
+    169.6148257665,
+    174.4435769119,
+    179.3059797911,
+    184.2015749320,
+    189.1299182326,
+    194.0905801545,
+    199.0831449737,
+    204.1072100830,
+    209.1623853419,
+    214.2482924705,
+    219.3645644828,
+    224.5108451564,
+    229.6867885365,
+    234.8920584701,
+    240.1263281692,
+    245.3892798002,
+    250.6806040975,
+    256.0000000000,
+    261.3471743083,
+    266.7218413611,
+    272.1237227299,
+    277.5525469304,
+    283.0080491495,
+    288.4899709866,
+    293.9980602090,
+    299.5320705195,
+    305.0917613358,
+    310.6768975818,
+    316.2872494882,
+    321.9225924034,
+    327.5827066139,
+    333.2673771724,
+    338.9763937351,
+    344.7095504051,
+    350.4666455847,
+    356.2474818330,
+    362.0518657308,
+    367.8796077506,
+    373.7305221334,
+    379.6044267700,
+    385.5011430873,
+    391.4204959402,
+    397.3623135070,
+    403.3264271901,
+    409.3126715201,
+    415.3208840636,
+    421.3509053358,
+    427.4025787150,
+    433.4757503618,
+    439.5702691405,
+    445.6859865441,
+    451.8227566217,
+    457.9804359091,
+    464.1588833613,
+    470.3579602882,
+    476.5775302922,
+    482.8174592083,
+    489.0776150459,
+    495.3578679332,
+    501.6580900633,
+    507.9781556420,
+    514.3179408377,
+    520.6773237328,
+    527.0561842769,
+    533.4544042413,
+    539.8718671753,
+    546.3084583636,
+    552.7640647857,
+    559.2385750758,
+    565.7318794845,
+    572.2438698415,
+    578.7744395198,
+    585.3234834006,
+    591.8908978393,
+    598.4765806331,
+    605.0804309888,
+    611.7023494920,
+    618.3422380776,
+    625.0000000000,
+    631.6755398055,
+    638.3687633048,
+    645.0795775462,
+    651.8078907899,
+    658.5536124831,
+    665.3166532354,
+    672.0969247951,
+    678.8943400262,
+    685.7088128862,
+    692.5402584041,
+    699.3885926590,
+    706.2537327602,
+    713.1355968262,
+    720.0341039659,
+    726.9491742592,
+    733.8807287386,
+    740.8286893712,
+    747.7929790411,
+    754.7735215322,
+    761.7702415115,
+    768.7830645130,
+    775.8119169219,
+    782.8567259587,
+    789.9174196648,
+    796.9939268870,
+    804.0861772639,
+    811.1941012115,
+    818.3176299096,
+    825.4566952887,
+    832.6112300164,
+    839.7811674856,
+    846.9664418012,
+    854.1669877685,
+    861.3827408814,
+    868.6136373104,
+    875.8596138918,
+    883.1206081164,
+    890.3965581189,
+    897.6874026669,
+    904.9930811514,
+    912.3135335758,
+    919.6487005467,
+    926.9985232641,
+    934.3629435117,
+    941.7419036483,
+    949.1353465979,
+    956.5432158417,
+    963.9654554089,
+    971.4020098686,
+    978.8528243212,
+    986.3178443907,
+    993.7970162163,
+    1001.2902864449,
+    1008.7976022234,
+    1016.3189111915,
+    1023.8541614739,
+    1031.4033016737,
+    1038.9662808647,
+    1046.5430485854,
+    1054.1335548314,
+    1061.7377500496,
+    1069.3555851309,
+    1076.9870114047,
+    1084.6319806319,
+    1092.2904449995,
+    1099.9623571140,
+    1107.6476699961,
+    1115.3463370744,
+    1123.0583121801,
+    1130.7835495416,
+    1138.5220037785,
+    1146.2736298969,
+    1154.0383832838,
+    1161.8162197020,
+    1169.6070952851,
+    1177.4109665328,
+    1185.2277903054,
+    1193.0575238198,
+    1200.9001246442,
+    1208.7555506939,
+    1216.6237602266,
+    1224.5047118380,
+    1232.3983644575,
+    1240.3046773436,
+    1248.2236100803,
+    1256.1551225723,
+    1264.0991750417,
+    1272.0557280230,
+    1280.0247423603,
+    1288.0061792024,
+    1296.0000000000,
+    1304.0061665011,
+    1312.0246407478,
+    1320.0553850728,
+    1328.0983620955,
+    1336.1535347188,
+    1344.2208661255,
+    1352.3003197751,
+    1360.3918594003,
+    1368.4954490040,
+    1376.6110528559,
+    1384.7386354892,
+    1392.8781616980,
+    1401.0295965338,
+    1409.1929053025,
+    1417.3680535619,
+    1425.5550071182,
+    1433.7537320236,
+    1441.9641945733,
+    1450.1863613025,
+    1458.4201989843,
+    1466.6656746263,
+    1474.9227554684,
+    1483.1914089801,
+    1491.4716028579,
+    1499.7633050227,
+    1508.0664836175,
+    1516.3811070048,
+    1524.7071437644,
+    1533.0445626906,
+    1541.3933327903,
+    1549.7534232806,
+    1558.1248035861,
+    1566.5074433375,
+    1574.9013123686,
+    1583.3063807145,
+    1591.7226186094,
+    1600.1499964846,
+    1608.5884849662,
+    1617.0380548732,
+    1625.4986772154,
+    1633.9703231917,
+    1642.4529641876,
+    1650.9465717736,
+    1659.4511177036,
+    1667.9665739122,
+    1676.4929125137,
+    1685.0301057998,
+    1693.5781262378,
+    1702.1369464690,
+    1710.7065393070,
+    1719.2868777356,
+    1727.8779349075,
+    1736.4796841426,
+    1745.0920989258,
+    1753.7151529063,
+    1762.3488198950,
+    1770.9930738636,
+    1779.6478889428,
+    1788.3132394207,
+    1796.9890997413,
+    1805.6754445031,
+    1814.3722484576,
+    1823.0794865074,
+    1831.7971337056,
+    1840.5251652535,
+    1849.2635564999,
+    1858.0122829390,
+    1866.7713202096,
+    1875.5406440938,
+    1884.3202305150,
+    1893.1100555371,
+    1901.9100953633,
+    1910.7203263343,
+    1919.5407249276,
+    1928.3712677557,
+    1937.2119315653,
+    1946.0626932359,
+    1954.9235297784,
+    1963.7944183344,
+    1972.6753361744,
+    1981.5662606973,
+    1990.4671694285,
+    1999.3780400196,
+    2008.2988502465,
+    2017.2295780088,
+    2026.1702013285,
+    2035.1206983489,
+    2044.0810473338,
+    2053.0512266659,
+    2062.0312148464,
+    2071.0209904936,
+    2080.0205323417,
+    2089.0298192403,
+    2098.0488301532,
+    2107.0775441570,
+    2116.1159404408,
+    2125.1639983049,
+    2134.2216971598,
+    2143.2890165253,
+    2152.3659360297,
+    2161.4524354089,
+    2170.5484945052,
+    2179.6540932666,
+    2188.7692117462,
+    2197.8938301007,
+    2207.0279285901,
+    2216.1714875766,
+    2225.3244875237,
+    2234.4869089955,
+    2243.6587326558,
+    2252.8399392674,
+    2262.0305096911,
+    2271.2304248850,
+    2280.4396659037,
+    2289.6582138977,
+    2298.8860501122,
+    2308.1231558868,
+    2317.3695126545,
+    2326.6251019409,
+    2335.8899053637,
+    2345.1639046317,
+    2354.4470815443,
+    2363.7394179907,
+    2373.0408959490,
+    2382.3514974860,
+    2391.6712047559,
+    2401.0000000000,
+    2410.3378655461,
+    2419.6847838074,
+    2429.0407372823,
+    2438.4057085534,
+    2447.7796802872,
+    2457.1626352330,
+    2466.5545562227,
+    2475.9554261700,
+    2485.3652280695,
+    2494.7839449968,
+    2504.2115601072,
+    2513.6480566352,
+    2523.0934178943,
+    2532.5476272760,
+    2542.0106682495,
+    2551.4825243609,
+    2560.9631792328,
+    2570.4526165636,
+    2579.9508201270,
+    2589.4577737714,
+    2598.9734614194,
+    2608.4978670675,
+    2618.0309747849,
+    2627.5727687136,
+    2637.1232330677,
+    2646.6823521328,
+    2656.2501102653,
+    2665.8264918923,
+    2675.4114815110,
+    2685.0050636878,
+    2694.6072230582,
+    2704.2179443264,
+    2713.8372122643,
+    2723.4650117115,
+    2733.1013275747,
+    2742.7461448270,
+    2752.3994485079,
+    2762.0612237221,
+    2771.7314556399,
+    2781.4101294962,
+    2791.0972305902,
+    2800.7927442847,
+    2810.4966560063,
+    2820.2089512442,
+    2829.9296155502,
+    2839.6586345385,
+    2849.3959938845,
+    2859.1416793251,
+    2868.8956766580,
+    2878.6579717413,
+    2888.4285504930,
+    2898.2073988909,
+    2907.9945029718,
+    2917.7898488313,
+    2927.5934226236,
+    2937.4052105607,
+    2947.2251989123,
+    2957.0533740053,
+    2966.8897222234,
+    2976.7342300070,
+    2986.5868838523,
+    2996.4476703115,
+    3006.3165759920,
+    3016.1935875562,
+    3026.0786917212,
+    3035.9718752584,
+    3045.8731249931,
+    3055.7824278041,
+    3065.6997706236,
+    3075.6251404365,
+    3085.5585242804,
+    3095.4999092450,
+    3105.4492824719,
+    3115.4066311543,
+    3125.3719425365,
+    3135.3452039137,
+    3145.3264026318,
+    3155.3155260867,
+    3165.3125617243,
+    3175.3174970403,
+    3185.3303195795,
+    3195.3510169356,
+    3205.3795767511,
+    3215.4159867169,
+    3225.4602345719,
+    3235.5123081028,
+    3245.5721951437,
+    3255.6398835758,
+    3265.7153613275,
+    3275.7986163735,
+    3285.8896367348,
+    3295.9884104787,
+    3306.0949257178,
+    3316.2091706107,
+    3326.3311333606,
+    3336.4608022160,
+    3346.5981654700,
+    3356.7432114599,
+    3366.8959285672,
+    3377.0563052172,
+    3387.2243298788,
+    3397.3999910641,
+    3407.5832773283,
+    3417.7741772695,
+    3427.9726795281,
+    3438.1787727870,
+    3448.3924457710,
+    3458.6136872466,
+    3468.8424860221,
+    3479.0788309468,
+    3489.3227109112,
+    3499.5741148464,
+    3509.8330317244,
+    3520.0994505573,
+    3530.3733603973,
+    3540.6547503364,
+    3550.9436095064,
+    3561.2399270783,
+    3571.5436922624,
+    3581.8548943078,
+    3592.1735225026,
+    3602.4995661730,
+    3612.8330146838,
+    3623.1738574377,
+    3633.5220838752,
+    3643.8776834744,
+    3654.2406457510,
+    3664.6109602577,
+    3674.9886165844,
+    3685.3736043574,
+    3695.7659132398,
+    3706.1655329312,
+    3716.5724531671,
+    3726.9866637191,
+    3737.4081543945,
+    3747.8369150361,
+    3758.2729355221,
+    3768.7162057659,
+    3779.1667157159,
+    3789.6244553551,
+    3800.0894147012,
+    3810.5615838063,
+    3821.0409527566,
+    3831.5275116724,
+    3842.0212507077,
+    3852.5221600504,
+    3863.0302299216,
+    3873.5454505757,
+    3884.0678123003,
+    3894.5973054159,
+    3905.1339202756,
+    3915.6776472653,
+    3926.2284768030,
+    3936.7863993390,
+    3947.3514053559,
+    3957.9234853677,
+    3968.5026299205,
+    3979.0888295917,
+    3989.6820749901,
+    4000.2823567557,
+    4010.8896655596,
+    4021.5039921036,
+    4032.1253271203,
+    4042.7536613729,
+    4053.3889856548,
+    4064.0312907898,
+    4074.6805676315,
+    4085.3368070638,
+    4096.0000000000,
+    4106.6701373831,
+    4117.3472101855,
+    4128.0312094089,
+    4138.7221260843,
+    4149.4199512713,
+    4160.1246760588,
+    4170.8362915639,
+    4181.5547889326,
+    4192.2801593392,
+    4203.0123939861,
+    4213.7514841039,
+    4224.4974209512,
+    4235.2501958144,
+    4246.0098000075,
+    4256.7762248721,
+    4267.5494617770,
+    4278.3295021186,
+    4289.1163373202,
+    4299.9099588321,
+    4310.7103581313,
+    4321.5175267219,
+    4332.3314561342,
+    4343.1521379251,
+    4353.9795636778,
+    4364.8137250016,
+    4375.6546135320,
+    4386.5022209304,
+    4397.3565388837,
+    4408.2175591050,
+    4419.0852733324,
+    4429.9596733298,
+    4440.8407508861,
+    4451.7284978156,
+    4462.6229059575,
+    4473.5239671759,
+    4484.4316733599,
+    4495.3460164231,
+    4506.2669883035,
+    4517.1945809640,
+    4528.1287863914,
+    4539.0695965968,
+    4550.0170036156,
+    4560.9709995068,
+    4571.9315763535,
+    4582.8987262626,
+    4593.8724413645,
+    4604.8527138130,
+    4615.8395357856,
+    4626.8328994828,
+    4637.8327971284,
+    4648.8392209693,
+    4659.8521632753,
+    4670.8716163390,
+    4681.8975724760,
+    4692.9300240243,
+    4703.9689633444,
+    4715.0143828193,
+    4726.0662748543,
+    4737.1246318771,
+    4748.1894463371,
+    4759.2607107062,
+    4770.3384174777,
+    4781.4225591672,
+    4792.5131283116,
+    4803.6101174696,
+    4814.7135192213,
+    4825.8233261683,
+    4836.9395309335,
+    4848.0621261609,
+    4859.1911045158,
+    4870.3264586842,
+    4881.4681813733,
+    4892.6162653110,
+    4903.7707032459,
+    4914.9314879474,
+    4926.0986122052,
+    4937.2720688295,
+    4948.4518506510,
+    4959.6379505206,
+    4970.8303613092,
+    4982.0290759079,
+    4993.2340872279,
+    5004.4453882001,
+    5015.6629717753,
+    5026.8868309241,
+    5038.1169586365,
+    5049.3533479223,
+    5060.5959918105,
+    5071.8448833497,
+    5083.1000156077,
+    5094.3613816714,
+    5105.6289746470,
+    5116.9027876595,
+    5128.1828138531,
+    5139.4690463907,
+    5150.7614784539,
+    5162.0601032433,
+    5173.3649139777,
+    5184.6759038949,
+    5195.9930662506,
+    5207.3163943194,
+    5218.6458813939,
+    5229.9815207850,
+    5241.3233058217,
+    5252.6712298510,
+    5264.0252862380,
+    5275.3854683656,
+    5286.7517696346,
+    5298.1241834635,
+    5309.5027032884,
+    5320.8873225631,
+    5332.2780347590,
+    5343.6748333647,
+    5355.0777118863,
+    5366.4866638472,
+    5377.9016827880,
+    5389.3227622665,
+    5400.7498958574,
+    5412.1830771527,
+    5423.6222997611,
+    5435.0675573082,
+    5446.5188434364,
+    5457.9761518049,
+    5469.4394760894,
+    5480.9088099822,
+    5492.3841471923,
+    5503.8654814448,
+    5515.3528064816,
+    5526.8461160606,
+    5538.3454039558,
+    5549.8506639579,
+    5561.3618898731,
+    5572.8790755240,
+    5584.4022147491,
+    5595.9313014028,
+    5607.4663293552,
+    5619.0072924923,
+    5630.5541847159,
+    5642.1069999431,
+    5653.6657321070,
+    5665.2303751559,
+    5676.8009230538,
+    5688.3773697797,
+    5699.9597093284,
+    5711.5479357096,
+    5723.1420429485,
+    5734.7420250850,
+    5746.3478761746,
+    5757.9595902874,
+    5769.5771615087,
+    5781.2005839386,
+    5792.8298516920,
+    5804.4649588987,
+    5816.1058997031,
+    5827.7526682643,
+    5839.4052587560,
+    5851.0636653664,
+    5862.7278822983,
+    5874.3979037688,
+    5886.0737240093,
+    5897.7553372658,
+    5909.4427377983,
+    5921.1359198811,
+    5932.8348778025,
+    5944.5396058651,
+    5956.2500983854,
+    5967.9663496940,
+    5979.6883541351,
+    5991.4161060672,
+    6003.1495998623,
+    6014.8888299063,
+    6026.6337905987,
+    6038.3844763527,
+    6050.1408815952,
+    6061.9030007664,
+    6073.6708283203,
+    6085.4443587241,
+    6097.2235864585,
+    6109.0085060174,
+    6120.7991119082,
+    6132.5953986513,
+    6144.3973607806,
+    6156.2049928426,
+    6168.0182893975,
+    6179.8372450182,
+    6191.6618542904,
+    6203.4921118132,
+    6215.3280121982,
+    6227.1695500700,
+    6239.0167200659,
+    6250.8695168361,
+    6262.7279350432,
+    6274.5919693627,
+    6286.4616144826,
+    6298.3368651034,
+    6310.2177159382,
+    6322.1041617124,
+    6333.9961971640,
+    6345.8938170431,
+    6357.7970161124,
+    6369.7057891466,
+    6381.6201309327,
+    6393.5400362700,
+    6405.4654999698,
+    6417.3965168555,
+    6429.3330817625,
+    6441.2751895383,
+    6453.2228350423,
+    6465.1760131457,
+    6477.1347187317,
+    6489.0989466952,
+    6501.0686919430,
+    6513.0439493936,
+    6525.0247139769,
+    6537.0109806350,
+    6549.0027443210,
+    6561.0000000000,
+    6573.0027426484,
+    6585.0109672541,
+    6597.0246688165,
+    6609.0438423464,
+    6621.0684828657,
+    6633.0985854079,
+    6645.1341450177,
+    6657.1751567510,
+    6669.2216156747,
+    6681.2735168671,
+    6693.3308554176,
+    6705.3936264265,
+    6717.4618250051,
+    6729.5354462759,
+    6741.6144853722,
+    6753.6989374383,
+    6765.7887976291,
+    6777.8840611107,
+    6789.9847230597,
+    6802.0907786636,
+    6814.2022231205,
+    6826.3190516394,
+    6838.4412594396,
+    6850.5688417513,
+    6862.7017938151,
+    6874.8401108821,
+    6886.9837882140,
+    6899.1328210829,
+    6911.2872047712,
+    6923.4469345719,
+    6935.6120057882,
+    6947.7824137335,
+    6959.9581537318,
+    6972.1392211169,
+    6984.3256112330,
+    6996.5173194347,
+    7008.7143410863,
+    7020.9166715624,
+    7033.1243062477,
+    7045.3372405367,
+    7057.5554698343,
+    7069.7789895548,
+    7082.0077951229,
+    7094.2418819728,
+    7106.4812455489,
+    7118.7258813051,
+    7130.9757847053,
+    7143.2309512230,
+    7155.4913763416,
+    7167.7570555538,
+    7180.0279843624,
+    7192.3041582795,
+    7204.5855728270,
+    7216.8722235361,
+    7229.1641059476,
+    7241.4612156120,
+    7253.7635480891,
+    7266.0710989478,
+    7278.3838637670,
+    7290.7018381344,
+    7303.0250176474,
+    7315.3533979125,
+    7327.6869745455,
+    7340.0257431713,
+    7352.3696994244,
+    7364.7188389480,
+    7377.0731573946,
+    7389.4326504259,
+    7401.7973137127,
+    7414.1671429346,
+    7426.5421337804,
+    7438.9222819480,
+    7451.3075831438,
+    7463.6980330837,
+    7476.0936274921,
+    7488.4943621024,
+    7500.9002326569,
+    7513.3112349065,
+    7525.7273646110,
+    7538.1486175390,
+    7550.5749894679,
+    7563.0064761834,
+    7575.4430734804,
+    7587.8847771619,
+    7600.3315830400,
+    7612.7834869349,
+    7625.2404846758,
+    7637.7025721001,
+    7650.1697450538,
+    7662.6419993914,
+    7675.1193309757,
+    7687.6017356782,
+    7700.0892093785,
+    7712.5817479647,
+    7725.0793473331,
+    7737.5820033885,
+    7750.0897120437,
+    7762.6024692201,
+    7775.1202708469,
+    7787.6431128620,
+    7800.1709912110,
+    7812.7039018478,
+    7825.2418407347,
+    7837.7848038416,
+    7850.3327871468,
+    7862.8857866366,
+    7875.4437983052,
+    7888.0068181548,
+    7900.5748421957,
+    7913.1478664460,
+    7925.7258869318,
+    7938.3088996870,
+    7950.8969007534,
+    7963.4898861807,
+    7976.0878520263,
+    7988.6907943555,
+    8001.2987092412,
+    8013.9115927643,
+    8026.5294410131,
+    8039.1522500838,
+    8051.7800160802,
+    8064.4127351138,
+    8077.0504033037,
+    8089.6930167764,
+    8102.3405716663,
+    8114.9930641151,
+    8127.6504902721,
+    8140.3128462940,
+    8152.9801283453,
+    8165.6523325976,
+    8178.3294552300,
+    8191.0114924292,
+    8203.6984403890,
+    8216.3902953107,
+    8229.0870534031,
+    8241.7887108821,
+    8254.4952639709,
+    8267.2067089000,
+    8279.9230419073,
+    8292.6442592376,
+    8305.3703571432,
+    8318.1013318835,
+    8330.8371797251,
+    8343.5778969415,
+    8356.3234798136,
+    8369.0739246292,
+    8381.8292276834,
+    8394.5893852780,
+    8407.3543937222,
+    8420.1242493321,
+    8432.8989484305,
+    8445.6784873475,
+    8458.4628624202,
+    8471.2520699922,
+    8484.0461064144,
+    8496.8449680444,
+    8509.6486512468,
+    8522.4571523928,
+    8535.2704678607,
+    8548.0885940353,
+    8560.9115273086,
+    8573.7392640788,
+    8586.5718007514,
+    8599.4091337382,
+    8612.2512594579,
+    8625.0981743359,
+    8637.9498748040,
+    8650.8063573010,
+    8663.6676182722,
+    8676.5336541692,
+    8689.4044614507,
+    8702.2800365815,
+    8715.1603760331,
+    8728.0454762838,
+    8740.9353338178,
+    8753.8299451264,
+    8766.7293067070,
+    8779.6334150636,
+    8792.5422667064,
+    8805.4558581523,
+    8818.3741859245,
+    8831.2972465524,
+    8844.2250365719,
+    8857.1575525253,
+    8870.0947909611,
+    8883.0367484340,
+    8895.9834215053,
+    8908.9348067421,
+    8921.8909007182,
+    8934.8517000133,
+    8947.8172012135,
+    8960.7874009109,
+    8973.7622957040,
+    8986.7418821972,
+    8999.7261570012,
+    9012.7151167328,
+    9025.7087580148,
+    9038.7070774762,
+    9051.7100717521,
+    9064.7177374833,
+    9077.7300713171,
+    9090.7470699065,
+    9103.7687299106,
+    9116.7950479945,
+    9129.8260208291,
+    9142.8616450914,
+    9155.9019174644,
+    9168.9468346367,
+    9181.9963933031,
+    9195.0505901642,
+    9208.1094219263,
+    9221.1728853017,
+    9234.2409770084,
+    9247.3136937704,
+    9260.3910323173,
+    9273.4729893846,
+    9286.5595617135,
+    9299.6507460510,
+    9312.7465391496,
+    9325.8469377679,
+    9338.9519386698,
+    9352.0615386252,
+    9365.1757344094,
+    9378.2945228036,
+    9391.4179005944,
+    9404.5458645741,
+    9417.6784115407,
+    9430.8155382977,
+    9443.9572416540,
+    9457.1035184244,
+    9470.2543654290,
+    9483.4097794934,
+    9496.5697574489,
+    9509.7342961321,
+    9522.9033923851,
+    9536.0770430556,
+    9549.2552449966,
+    9562.4379950666,
+    9575.6252901295,
+    9588.8171270546,
+    9602.0135027165,
+    9615.2144139955,
+    9628.4198577767,
+    9641.6298309511,
+    9654.8443304146,
+    9668.0633530688,
+    9681.2868958202,
+    9694.5149555808,
+    9707.7475292679,
+    9720.9846138040,
+    9734.2262061168,
+    9747.4723031393,
+    9760.7229018097,
+    9773.9779990712,
+    9787.2375918726,
+    9800.5016771674,
+    9813.7702519147,
+    9827.0433130783,
+    9840.3208576275,
+    9853.6028825365,
+    9866.8893847847,
+    9880.1803613565,
+    9893.4758092415,
+    9906.7757254342,
+    9920.0801069342,
+    9933.3889507462,
+    9946.7022538799,
+    9960.0200133500,
+    9973.3422261761,
+    9986.6688893829,
+    10000.0000000000,
+    10013.3355550619,
+    10026.6755516082,
+    10040.0199866833,
+    10053.3688573365,
+    10066.7221606221,
+    10080.0798935991,
+    10093.4420533317,
+    10106.8086368886,
+    10120.1796413436,
+    10133.5550637751,
+    10146.9349012666,
+    10160.3191509062,
+    10173.7078097869,
+    10187.1008750065,
+    10200.4983436674,
+    10213.9002128770,
+    10227.3064797472,
+    10240.7171413949,
+    10254.1321949415,
+    10267.5516375131,
+    10280.9754662408,
+    10294.4036782600,
+    10307.8362707111,
+    10321.2732407388,
+    10334.7145854928
+};
+
+#else
+
+static real_t iq_table[] =
+{
+    REAL_CONST(0.0000000000/8),
+    REAL_CONST(1.0000000000/8),
+    REAL_CONST(2.5198421478/8),
+    REAL_CONST(4.3267488480/8),
+    REAL_CONST(6.3496041298/8),
+    REAL_CONST(8.5498800278/8),
+    REAL_CONST(10.9027233124/8),
+    REAL_CONST(13.3905181885/8),
+    REAL_CONST(16.0000000000/8),
+    REAL_CONST(18.7207546234/8),
+    REAL_CONST(21.5443477631/8),
+    REAL_CONST(24.4637813568/8),
+    REAL_CONST(27.4731426239/8),
+    REAL_CONST(30.5673503876/8),
+    REAL_CONST(33.7419929504/8),
+    REAL_CONST(36.9931793213/8),
+    REAL_CONST(40.3174743652/8),
+    REAL_CONST(43.7117881775/8),
+    REAL_CONST(47.1733436584/8),
+    REAL_CONST(50.6996307373/8),
+    REAL_CONST(54.2883529663/8),
+    REAL_CONST(57.9374084473/8),
+    REAL_CONST(61.6448669434/8),
+    REAL_CONST(65.4089431763/8),
+    REAL_CONST(69.2279815674/8),
+    REAL_CONST(73.1004409790/8),
+    REAL_CONST(77.0248947144/8),
+    REAL_CONST(81.0000000000/8),
+    REAL_CONST(85.0244903564/8),
+    REAL_CONST(89.0971908569/8),
+    REAL_CONST(93.2169723511/8),
+    REAL_CONST(97.3827972412/8),
+    REAL_CONST(101.5936660767/8),
+    REAL_CONST(105.8486328125/8),
+    REAL_CONST(110.1468048096/8),
+    REAL_CONST(114.4873199463/8),
+    REAL_CONST(118.8693847656/8),
+    REAL_CONST(123.2922058105/8),
+    REAL_CONST(127.7550659180/8),
+    REAL_CONST(132.2572479248/8),
+    REAL_CONST(136.7980804443/8),
+    REAL_CONST(141.3769073486/8),
+    REAL_CONST(145.9931182861/8),
+    REAL_CONST(150.6461181641/8),
+    REAL_CONST(155.3353271484/8),
+    REAL_CONST(160.0601959229/8),
+    REAL_CONST(164.8202056885/8),
+    REAL_CONST(169.6148223877/8),
+    REAL_CONST(174.4435729980/8),
+    REAL_CONST(179.3059844971/8),
+    REAL_CONST(184.2015686035/8),
+    REAL_CONST(189.1299133301/8),
+    REAL_CONST(194.0905761719/8),
+    REAL_CONST(199.0831451416/8),
+    REAL_CONST(204.1072082520/8),
+    REAL_CONST(209.1623840332/8),
+    REAL_CONST(214.2482910156/8),
+    REAL_CONST(219.3645629883/8),
+    REAL_CONST(224.5108489990/8),
+    REAL_CONST(229.6867828369/8),
+    REAL_CONST(234.8920593262/8),
+    REAL_CONST(240.1263275146/8),
+    REAL_CONST(245.3892822266/8),
+    REAL_CONST(250.6806030273/8),
+    REAL_CONST(256.0000000000/8),
+    REAL_CONST(261.3471679688/8),
+    REAL_CONST(266.7218322754/8),
+    REAL_CONST(272.1237182617/8),
+    REAL_CONST(277.5525512695/8),
+    REAL_CONST(283.0080566406/8),
+    REAL_CONST(288.4899597168/8),
+    REAL_CONST(293.9980468750/8),
+    REAL_CONST(299.5320739746/8),
+    REAL_CONST(305.0917663574/8),
+    REAL_CONST(310.6769104004/8),
+    REAL_CONST(316.2872619629/8),
+    REAL_CONST(321.9226074219/8),
+    REAL_CONST(327.5827026367/8),
+    REAL_CONST(333.2673645020/8),
+    REAL_CONST(338.9763793945/8),
+    REAL_CONST(344.7095642090/8),
+    REAL_CONST(350.4666442871/8),
+    REAL_CONST(356.2474670410/8),
+    REAL_CONST(362.0518798828/8),
+    REAL_CONST(367.8796081543/8),
+    REAL_CONST(373.7305297852/8),
+    REAL_CONST(379.6044311523/8),
+    REAL_CONST(385.5011291504/8),
+    REAL_CONST(391.4205017090/8),
+    REAL_CONST(397.3623046875/8),
+    REAL_CONST(403.3264160156/8),
+    REAL_CONST(409.3126831055/8),
+    REAL_CONST(415.3208923340/8),
+    REAL_CONST(421.3508911133/8),
+    REAL_CONST(427.4025878906/8),
+    REAL_CONST(433.4757385254/8),
+    REAL_CONST(439.5702819824/8),
+    REAL_CONST(445.6859741211/8),
+    REAL_CONST(451.8227539063/8),
+    REAL_CONST(457.9804382324/8),
+    REAL_CONST(464.1588745117/8),
+    REAL_CONST(470.3579711914/8),
+    REAL_CONST(476.5775451660/8),
+    REAL_CONST(482.8174743652/8),
+    REAL_CONST(489.0776062012/8),
+    REAL_CONST(495.3578796387/8),
+    REAL_CONST(501.6580810547/8),
+    REAL_CONST(507.9781494141/8),
+    REAL_CONST(514.3179321289/8),
+    REAL_CONST(520.6773071289/8),
+    REAL_CONST(527.0562133789/8),
+    REAL_CONST(533.4544067383/8),
+    REAL_CONST(539.8718872070/8),
+    REAL_CONST(546.3084716797/8),
+    REAL_CONST(552.7640380859/8),
+    REAL_CONST(559.2385864258/8),
+    REAL_CONST(565.7318725586/8),
+    REAL_CONST(572.2438964844/8),
+    REAL_CONST(578.7744140625/8),
+    REAL_CONST(585.3234863281/8),
+    REAL_CONST(591.8908691406/8),
+    REAL_CONST(598.4765625000/8),
+    REAL_CONST(605.0804443359/8),
+    REAL_CONST(611.7023315430/8),
+    REAL_CONST(618.3422241211/8),
+    REAL_CONST(625.0000000000/8),
+    REAL_CONST(631.6755371094/8),
+    REAL_CONST(638.3687744141/8),
+    REAL_CONST(645.0795898438/8),
+    REAL_CONST(651.8078613281/8),
+    REAL_CONST(658.5535888672/8),
+    REAL_CONST(665.3166503906/8),
+    REAL_CONST(672.0969238281/8),
+    REAL_CONST(678.8943481445/8),
+    REAL_CONST(685.7088012695/8),
+    REAL_CONST(692.5402832031/8),
+    REAL_CONST(699.3886108398/8),
+    REAL_CONST(706.2537231445/8),
+    REAL_CONST(713.1356201172/8),
+    REAL_CONST(720.0341186523/8),
+    REAL_CONST(726.9491577148/8),
+    REAL_CONST(733.8807373047/8),
+    REAL_CONST(740.8286743164/8),
+    REAL_CONST(747.7929687500/8),
+    REAL_CONST(754.7734985352/8),
+    REAL_CONST(761.7702636719/8),
+    REAL_CONST(768.7830810547/8),
+    REAL_CONST(775.8118896484/8),
+    REAL_CONST(782.8567504883/8),
+    REAL_CONST(789.9174194336/8),
+    REAL_CONST(796.9938964844/8),
+    REAL_CONST(804.0861816406/8),
+    REAL_CONST(811.1940917969/8),
+    REAL_CONST(818.3176269531/8),
+    REAL_CONST(825.4566650391/8),
+    REAL_CONST(832.6112060547/8),
+    REAL_CONST(839.7811889648/8),
+    REAL_CONST(846.9664306641/8),
+    REAL_CONST(854.1669921875/8),
+    REAL_CONST(861.3827514648/8),
+    REAL_CONST(868.6136474609/8),
+    REAL_CONST(875.8596191406/8),
+    REAL_CONST(883.1206054688/8),
+    REAL_CONST(890.3965454102/8),
+    REAL_CONST(897.6873779297/8),
+    REAL_CONST(904.9931030273/8),
+    REAL_CONST(912.3135375977/8),
+    REAL_CONST(919.6486816406/8),
+    REAL_CONST(926.9985351563/8),
+    REAL_CONST(934.3629150391/8),
+    REAL_CONST(941.7418823242/8),
+    REAL_CONST(949.1353759766/8),
+    REAL_CONST(956.5432128906/8),
+    REAL_CONST(963.9654541016/8),
+    REAL_CONST(971.4020385742/8),
+    REAL_CONST(978.8528442383/8),
+    REAL_CONST(986.3178710938/8),
+    REAL_CONST(993.7969970703/8),
+    REAL_CONST(1001.2902832031/8),
+    REAL_CONST(1008.7976074219/8),
+    REAL_CONST(1016.3189086914/8),
+    REAL_CONST(1023.8541870117/8),
+    REAL_CONST(1031.4033203125/8),
+    REAL_CONST(1038.9663085938/8),
+    REAL_CONST(1046.5430908203/8),
+    REAL_CONST(1054.1335449219/8),
+    REAL_CONST(1061.7377929688/8),
+    REAL_CONST(1069.3555908203/8),
+    REAL_CONST(1076.9870605469/8),
+    REAL_CONST(1084.6319580078/8),
+    REAL_CONST(1092.2904052734/8),
+    REAL_CONST(1099.9624023438/8),
+    REAL_CONST(1107.6477050781/8),
+    REAL_CONST(1115.3463134766/8),
+    REAL_CONST(1123.0583496094/8),
+    REAL_CONST(1130.7835693359/8),
+    REAL_CONST(1138.5219726563/8),
+    REAL_CONST(1146.2736816406/8),
+    REAL_CONST(1154.0383300781/8),
+    REAL_CONST(1161.8161621094/8),
+    REAL_CONST(1169.6070556641/8),
+    REAL_CONST(1177.4110107422/8),
+    REAL_CONST(1185.2277832031/8),
+    REAL_CONST(1193.0574951172/8),
+    REAL_CONST(1200.9001464844/8),
+    REAL_CONST(1208.7554931641/8),
+    REAL_CONST(1216.6237792969/8),
+    REAL_CONST(1224.5047607422/8),
+    REAL_CONST(1232.3983154297/8),
+    REAL_CONST(1240.3046875000/8),
+    REAL_CONST(1248.2236328125/8),
+    REAL_CONST(1256.1551513672/8),
+    REAL_CONST(1264.0991210938/8),
+    REAL_CONST(1272.0557861328/8),
+    REAL_CONST(1280.0247802734/8),
+    REAL_CONST(1288.0062255859/8),
+    REAL_CONST(1296.0000000000/8),
+    REAL_CONST(1304.0062255859/8),
+    REAL_CONST(1312.0246582031/8),
+    REAL_CONST(1320.0554199219/8),
+    REAL_CONST(1328.0983886719/8),
+    REAL_CONST(1336.1535644531/8),
+    REAL_CONST(1344.2208251953/8),
+    REAL_CONST(1352.3002929688/8),
+    REAL_CONST(1360.3918457031/8),
+    REAL_CONST(1368.4954833984/8),
+    REAL_CONST(1376.6110839844/8),
+    REAL_CONST(1384.7386474609/8),
+    REAL_CONST(1392.8781738281/8),
+    REAL_CONST(1401.0295410156/8),
+    REAL_CONST(1409.1928710938/8),
+    REAL_CONST(1417.3680419922/8),
+    REAL_CONST(1425.5550537109/8),
+    REAL_CONST(1433.7537841797/8),
+    REAL_CONST(1441.9642333984/8),
+    REAL_CONST(1450.1864013672/8),
+    REAL_CONST(1458.4201660156/8),
+    REAL_CONST(1466.6656494141/8),
+    REAL_CONST(1474.9227294922/8),
+    REAL_CONST(1483.1914062500/8),
+    REAL_CONST(1491.4715576172/8),
+    REAL_CONST(1499.7633056641/8),
+    REAL_CONST(1508.0665283203/8),
+    REAL_CONST(1516.3811035156/8),
+    REAL_CONST(1524.7071533203/8),
+    REAL_CONST(1533.0445556641/8),
+    REAL_CONST(1541.3933105469/8),
+    REAL_CONST(1549.7534179688/8),
+    REAL_CONST(1558.1247558594/8),
+    REAL_CONST(1566.5074462891/8),
+    REAL_CONST(1574.9013671875/8),
+    REAL_CONST(1583.3063964844/8),
+    REAL_CONST(1591.7226562500/8),
+    REAL_CONST(1600.1500244141/8),
+    REAL_CONST(1608.5885009766/8),
+    REAL_CONST(1617.0380859375/8),
+    REAL_CONST(1625.4986572266/8),
+    REAL_CONST(1633.9703369141/8),
+    REAL_CONST(1642.4530029297/8),
+    REAL_CONST(1650.9465332031/8),
+    REAL_CONST(1659.4511718750/8),
+    REAL_CONST(1667.9665527344/8),
+    REAL_CONST(1676.4929199219/8),
+    REAL_CONST(1685.0301513672/8),
+    REAL_CONST(1693.5781250000/8),
+    REAL_CONST(1702.1369628906/8),
+    REAL_CONST(1710.7065429688/8),
+    REAL_CONST(1719.2868652344/8),
+    REAL_CONST(1727.8779296875/8),
+    REAL_CONST(1736.4797363281/8),
+    REAL_CONST(1745.0920410156/8),
+    REAL_CONST(1753.7152099609/8),
+    REAL_CONST(1762.3488769531/8),
+    REAL_CONST(1770.9930419922/8),
+    REAL_CONST(1779.6479492188/8),
+    REAL_CONST(1788.3132324219/8),
+    REAL_CONST(1796.9891357422/8),
+    REAL_CONST(1805.6754150391/8),
+    REAL_CONST(1814.3721923828/8),
+    REAL_CONST(1823.0794677734/8),
+    REAL_CONST(1831.7971191406/8),
+    REAL_CONST(1840.5251464844/8),
+    REAL_CONST(1849.2635498047/8),
+    REAL_CONST(1858.0123291016/8),
+    REAL_CONST(1866.7713623047/8),
+    REAL_CONST(1875.5406494141/8),
+    REAL_CONST(1884.3201904297/8),
+    REAL_CONST(1893.1101074219/8),
+    REAL_CONST(1901.9101562500/8),
+    REAL_CONST(1910.7203369141/8),
+    REAL_CONST(1919.5407714844/8),
+    REAL_CONST(1928.3712158203/8),
+    REAL_CONST(1937.2119140625/8),
+    REAL_CONST(1946.0627441406/8),
+    REAL_CONST(1954.9235839844/8),
+    REAL_CONST(1963.7944335938/8),
+    REAL_CONST(1972.6752929688/8),
+    REAL_CONST(1981.5662841797/8),
+    REAL_CONST(1990.4671630859/8),
+    REAL_CONST(1999.3780517578/8),
+    REAL_CONST(2008.2988281250/8),
+    REAL_CONST(2017.2296142578/8),
+    REAL_CONST(2026.1701660156/8),
+    REAL_CONST(2035.1207275391/8),
+    REAL_CONST(2044.0810546875/8),
+    REAL_CONST(2053.0512695313/8),
+    REAL_CONST(2062.0312500000/8),
+    REAL_CONST(2071.0209960938/8),
+    REAL_CONST(2080.0205078125/8),
+    REAL_CONST(2089.0297851563/8),
+    REAL_CONST(2098.0488281250/8),
+    REAL_CONST(2107.0776367188/8),
+    REAL_CONST(2116.1159667969/8),
+    REAL_CONST(2125.1640625000/8),
+    REAL_CONST(2134.2216796875/8),
+    REAL_CONST(2143.2890625000/8),
+    REAL_CONST(2152.3659667969/8),
+    REAL_CONST(2161.4523925781/8),
+    REAL_CONST(2170.5485839844/8),
+    REAL_CONST(2179.6540527344/8),
+    REAL_CONST(2188.7692871094/8),
+    REAL_CONST(2197.8937988281/8),
+    REAL_CONST(2207.0278320313/8),
+    REAL_CONST(2216.1713867188/8),
+    REAL_CONST(2225.3244628906/8),
+    REAL_CONST(2234.4868164063/8),
+    REAL_CONST(2243.6586914063/8),
+    REAL_CONST(2252.8398437500/8),
+    REAL_CONST(2262.0305175781/8),
+    REAL_CONST(2271.2304687500/8),
+    REAL_CONST(2280.4396972656/8),
+    REAL_CONST(2289.6582031250/8),
+    REAL_CONST(2298.8859863281/8),
+    REAL_CONST(2308.1230468750/8),
+    REAL_CONST(2317.3696289063/8),
+    REAL_CONST(2326.6250000000/8),
+    REAL_CONST(2335.8898925781/8),
+    REAL_CONST(2345.1638183594/8),
+    REAL_CONST(2354.4470214844/8),
+    REAL_CONST(2363.7395019531/8),
+    REAL_CONST(2373.0410156250/8),
+    REAL_CONST(2382.3515625000/8),
+    REAL_CONST(2391.6711425781/8),
+    REAL_CONST(2401.0000000000/8),
+    REAL_CONST(2410.3378906250/8),
+    REAL_CONST(2419.6848144531/8),
+    REAL_CONST(2429.0407714844/8),
+    REAL_CONST(2438.4057617188/8),
+    REAL_CONST(2447.7797851563/8),
+    REAL_CONST(2457.1625976563/8),
+    REAL_CONST(2466.5544433594/8),
+    REAL_CONST(2475.9553222656/8),
+    REAL_CONST(2485.3652343750/8),
+    REAL_CONST(2494.7839355469/8),
+    REAL_CONST(2504.2116699219/8),
+    REAL_CONST(2513.6479492188/8),
+    REAL_CONST(2523.0935058594/8),
+    REAL_CONST(2532.5476074219/8),
+    REAL_CONST(2542.0107421875/8),
+    REAL_CONST(2551.4824218750/8),
+    REAL_CONST(2560.9631347656/8),
+    REAL_CONST(2570.4526367188/8),
+    REAL_CONST(2579.9509277344/8),
+    REAL_CONST(2589.4577636719/8),
+    REAL_CONST(2598.9733886719/8),
+    REAL_CONST(2608.4978027344/8),
+    REAL_CONST(2618.0310058594/8),
+    REAL_CONST(2627.5727539063/8),
+    REAL_CONST(2637.1232910156/8),
+    REAL_CONST(2646.6823730469/8),
+    REAL_CONST(2656.2500000000/8),
+    REAL_CONST(2665.8264160156/8),
+    REAL_CONST(2675.4113769531/8),
+    REAL_CONST(2685.0051269531/8),
+    REAL_CONST(2694.6071777344/8),
+    REAL_CONST(2704.2180175781/8),
+    REAL_CONST(2713.8371582031/8),
+    REAL_CONST(2723.4650878906/8),
+    REAL_CONST(2733.1013183594/8),
+    REAL_CONST(2742.7460937500/8),
+    REAL_CONST(2752.3994140625/8),
+    REAL_CONST(2762.0612792969/8),
+    REAL_CONST(2771.7314453125/8),
+    REAL_CONST(2781.4101562500/8),
+    REAL_CONST(2791.0971679688/8),
+    REAL_CONST(2800.7927246094/8),
+    REAL_CONST(2810.4965820313/8),
+    REAL_CONST(2820.2089843750/8),
+    REAL_CONST(2829.9296875000/8),
+    REAL_CONST(2839.6586914063/8),
+    REAL_CONST(2849.3959960938/8),
+    REAL_CONST(2859.1416015625/8),
+    REAL_CONST(2868.8957519531/8),
+    REAL_CONST(2878.6579589844/8),
+    REAL_CONST(2888.4284667969/8),
+    REAL_CONST(2898.2075195313/8),
+    REAL_CONST(2907.9943847656/8),
+    REAL_CONST(2917.7897949219/8),
+    REAL_CONST(2927.5935058594/8),
+    REAL_CONST(2937.4052734375/8),
+    REAL_CONST(2947.2250976563/8),
+    REAL_CONST(2957.0534667969/8),
+    REAL_CONST(2966.8896484375/8),
+    REAL_CONST(2976.7341308594/8),
+    REAL_CONST(2986.5869140625/8),
+    REAL_CONST(2996.4477539063/8),
+    REAL_CONST(3006.3166503906/8),
+    REAL_CONST(3016.1936035156/8),
+    REAL_CONST(3026.0786132813/8),
+    REAL_CONST(3035.9719238281/8),
+    REAL_CONST(3045.8730468750/8),
+    REAL_CONST(3055.7824707031/8),
+    REAL_CONST(3065.6997070313/8),
+    REAL_CONST(3075.6252441406/8),
+    REAL_CONST(3085.5585937500/8),
+    REAL_CONST(3095.5000000000/8),
+    REAL_CONST(3105.4492187500/8),
+    REAL_CONST(3115.4067382813/8),
+    REAL_CONST(3125.3718261719/8),
+    REAL_CONST(3135.3452148438/8),
+    REAL_CONST(3145.3264160156/8),
+    REAL_CONST(3155.3154296875/8),
+    REAL_CONST(3165.3125000000/8),
+    REAL_CONST(3175.3173828125/8),
+    REAL_CONST(3185.3303222656/8),
+    REAL_CONST(3195.3510742188/8),
+    REAL_CONST(3205.3796386719/8),
+    REAL_CONST(3215.4160156250/8),
+    REAL_CONST(3225.4602050781/8),
+    REAL_CONST(3235.5122070313/8),
+    REAL_CONST(3245.5722656250/8),
+    REAL_CONST(3255.6398925781/8),
+    REAL_CONST(3265.7153320313/8),
+    REAL_CONST(3275.7985839844/8),
+    REAL_CONST(3285.8896484375/8),
+    REAL_CONST(3295.9885253906/8),
+    REAL_CONST(3306.0949707031/8),
+    REAL_CONST(3316.2092285156/8),
+    REAL_CONST(3326.3310546875/8),
+    REAL_CONST(3336.4606933594/8),
+    REAL_CONST(3346.5981445313/8),
+    REAL_CONST(3356.7431640625/8),
+    REAL_CONST(3366.8959960938/8),
+    REAL_CONST(3377.0563964844/8),
+    REAL_CONST(3387.2243652344/8),
+    REAL_CONST(3397.3999023438/8),
+    REAL_CONST(3407.5832519531/8),
+    REAL_CONST(3417.7741699219/8),
+    REAL_CONST(3427.9726562500/8),
+    REAL_CONST(3438.1787109375/8),
+    REAL_CONST(3448.3923339844/8),
+    REAL_CONST(3458.6137695313/8),
+    REAL_CONST(3468.8425292969/8),
+    REAL_CONST(3479.0788574219/8),
+    REAL_CONST(3489.3227539063/8),
+    REAL_CONST(3499.5742187500/8),
+    REAL_CONST(3509.8330078125/8),
+    REAL_CONST(3520.0993652344/8),
+    REAL_CONST(3530.3732910156/8),
+    REAL_CONST(3540.6547851563/8),
+    REAL_CONST(3550.9436035156/8),
+    REAL_CONST(3561.2399902344/8),
+    REAL_CONST(3571.5437011719/8),
+    REAL_CONST(3581.8549804688/8),
+    REAL_CONST(3592.1735839844/8),
+    REAL_CONST(3602.4995117188/8),
+    REAL_CONST(3612.8330078125/8),
+    REAL_CONST(3623.1738281250/8),
+    REAL_CONST(3633.5219726563/8),
+    REAL_CONST(3643.8776855469/8),
+    REAL_CONST(3654.2407226563/8),
+    REAL_CONST(3664.6108398438/8),
+    REAL_CONST(3674.9885253906/8),
+    REAL_CONST(3685.3735351563/8),
+    REAL_CONST(3695.7658691406/8),
+    REAL_CONST(3706.1655273438/8),
+    REAL_CONST(3716.5725097656/8),
+    REAL_CONST(3726.9865722656/8),
+    REAL_CONST(3737.4082031250/8),
+    REAL_CONST(3747.8369140625/8),
+    REAL_CONST(3758.2729492188/8),
+    REAL_CONST(3768.7163085938/8),
+    REAL_CONST(3779.1667480469/8),
+    REAL_CONST(3789.6245117188/8),
+    REAL_CONST(3800.0893554688/8),
+    REAL_CONST(3810.5615234375/8),
+    REAL_CONST(3821.0410156250/8),
+    REAL_CONST(3831.5275878906/8),
+    REAL_CONST(3842.0212402344/8),
+    REAL_CONST(3852.5222167969/8),
+    REAL_CONST(3863.0302734375/8),
+    REAL_CONST(3873.5454101563/8),
+    REAL_CONST(3884.0678710938/8),
+    REAL_CONST(3894.5974121094/8),
+    REAL_CONST(3905.1340332031/8),
+    REAL_CONST(3915.6777343750/8),
+    REAL_CONST(3926.2285156250/8),
+    REAL_CONST(3936.7863769531/8),
+    REAL_CONST(3947.3513183594/8),
+    REAL_CONST(3957.9235839844/8),
+    REAL_CONST(3968.5026855469/8),
+    REAL_CONST(3979.0888671875/8),
+    REAL_CONST(3989.6821289063/8),
+    REAL_CONST(4000.2824707031/8),
+    REAL_CONST(4010.8896484375/8),
+    REAL_CONST(4021.5039062500/8),
+    REAL_CONST(4032.1252441406/8),
+    REAL_CONST(4042.7536621094/8),
+    REAL_CONST(4053.3889160156/8),
+    REAL_CONST(4064.0312500000/8),
+    REAL_CONST(4074.6806640625/8),
+    REAL_CONST(4085.3369140625/8),
+    REAL_CONST(4096.0000000000/8),
+    REAL_CONST(4106.6699218750/8),
+    REAL_CONST(4117.3471679688/8),
+    REAL_CONST(4128.0312500000/8),
+    REAL_CONST(4138.7221679688/8),
+    REAL_CONST(4149.4199218750/8),
+    REAL_CONST(4160.1245117188/8),
+    REAL_CONST(4170.8364257813/8),
+    REAL_CONST(4181.5546875000/8),
+    REAL_CONST(4192.2802734375/8),
+    REAL_CONST(4203.0122070313/8),
+    REAL_CONST(4213.7514648438/8),
+    REAL_CONST(4224.4975585938/8),
+    REAL_CONST(4235.2500000000/8),
+    REAL_CONST(4246.0097656250/8),
+    REAL_CONST(4256.7763671875/8),
+    REAL_CONST(4267.5493164063/8),
+    REAL_CONST(4278.3295898438/8),
+    REAL_CONST(4289.1162109375/8),
+    REAL_CONST(4299.9101562500/8),
+    REAL_CONST(4310.7104492188/8),
+    REAL_CONST(4321.5175781250/8),
+    REAL_CONST(4332.3315429688/8),
+    REAL_CONST(4343.1523437500/8),
+    REAL_CONST(4353.9794921875/8),
+    REAL_CONST(4364.8139648438/8),
+    REAL_CONST(4375.6547851563/8),
+    REAL_CONST(4386.5024414063/8),
+    REAL_CONST(4397.3564453125/8),
+    REAL_CONST(4408.2177734375/8),
+    REAL_CONST(4419.0854492188/8),
+    REAL_CONST(4429.9594726563/8),
+    REAL_CONST(4440.8408203125/8),
+    REAL_CONST(4451.7285156250/8),
+    REAL_CONST(4462.6230468750/8),
+    REAL_CONST(4473.5239257813/8),
+    REAL_CONST(4484.4316406250/8),
+    REAL_CONST(4495.3461914063/8),
+    REAL_CONST(4506.2670898438/8),
+    REAL_CONST(4517.1948242188/8),
+    REAL_CONST(4528.1289062500/8),
+    REAL_CONST(4539.0698242188/8),
+    REAL_CONST(4550.0170898438/8),
+    REAL_CONST(4560.9711914063/8),
+    REAL_CONST(4571.9316406250/8),
+    REAL_CONST(4582.8989257813/8),
+    REAL_CONST(4593.8725585938/8),
+    REAL_CONST(4604.8525390625/8),
+    REAL_CONST(4615.8393554688/8),
+    REAL_CONST(4626.8330078125/8),
+    REAL_CONST(4637.8330078125/8),
+    REAL_CONST(4648.8393554688/8),
+    REAL_CONST(4659.8520507813/8),
+    REAL_CONST(4670.8715820313/8),
+    REAL_CONST(4681.8974609375/8),
+    REAL_CONST(4692.9301757813/8),
+    REAL_CONST(4703.9687500000/8),
+    REAL_CONST(4715.0141601563/8),
+    REAL_CONST(4726.0664062500/8),
+    REAL_CONST(4737.1245117188/8),
+    REAL_CONST(4748.1894531250/8),
+    REAL_CONST(4759.2607421875/8),
+    REAL_CONST(4770.3383789063/8),
+    REAL_CONST(4781.4223632813/8),
+    REAL_CONST(4792.5131835938/8),
+    REAL_CONST(4803.6103515625/8),
+    REAL_CONST(4814.7133789063/8),
+    REAL_CONST(4825.8232421875/8),
+    REAL_CONST(4836.9394531250/8),
+    REAL_CONST(4848.0620117188/8),
+    REAL_CONST(4859.1909179688/8),
+    REAL_CONST(4870.3266601563/8),
+    REAL_CONST(4881.4682617188/8),
+    REAL_CONST(4892.6162109375/8),
+    REAL_CONST(4903.7705078125/8),
+    REAL_CONST(4914.9316406250/8),
+    REAL_CONST(4926.0986328125/8),
+    REAL_CONST(4937.2719726563/8),
+    REAL_CONST(4948.4516601563/8),
+    REAL_CONST(4959.6381835938/8),
+    REAL_CONST(4970.8305664063/8),
+    REAL_CONST(4982.0292968750/8),
+    REAL_CONST(4993.2338867188/8),
+    REAL_CONST(5004.4453125000/8),
+    REAL_CONST(5015.6630859375/8),
+    REAL_CONST(5026.8867187500/8),
+    REAL_CONST(5038.1171875000/8),
+    REAL_CONST(5049.3535156250/8),
+    REAL_CONST(5060.5961914063/8),
+    REAL_CONST(5071.8447265625/8),
+    REAL_CONST(5083.1000976563/8),
+    REAL_CONST(5094.3613281250/8),
+    REAL_CONST(5105.6289062500/8),
+    REAL_CONST(5116.9028320313/8),
+    REAL_CONST(5128.1826171875/8),
+    REAL_CONST(5139.4692382813/8),
+    REAL_CONST(5150.7617187500/8),
+    REAL_CONST(5162.0600585938/8),
+    REAL_CONST(5173.3647460938/8),
+    REAL_CONST(5184.6757812500/8),
+    REAL_CONST(5195.9931640625/8),
+    REAL_CONST(5207.3164062500/8),
+    REAL_CONST(5218.6459960938/8),
+    REAL_CONST(5229.9814453125/8),
+    REAL_CONST(5241.3232421875/8),
+    REAL_CONST(5252.6713867188/8),
+    REAL_CONST(5264.0253906250/8),
+    REAL_CONST(5275.3852539063/8),
+    REAL_CONST(5286.7519531250/8),
+    REAL_CONST(5298.1240234375/8),
+    REAL_CONST(5309.5029296875/8),
+    REAL_CONST(5320.8872070313/8),
+    REAL_CONST(5332.2778320313/8),
+    REAL_CONST(5343.6748046875/8),
+    REAL_CONST(5355.0776367188/8),
+    REAL_CONST(5366.4868164063/8),
+    REAL_CONST(5377.9018554688/8),
+    REAL_CONST(5389.3227539063/8),
+    REAL_CONST(5400.7500000000/8),
+    REAL_CONST(5412.1831054688/8),
+    REAL_CONST(5423.6220703125/8),
+    REAL_CONST(5435.0673828125/8),
+    REAL_CONST(5446.5190429688/8),
+    REAL_CONST(5457.9760742188/8),
+    REAL_CONST(5469.4394531250/8),
+    REAL_CONST(5480.9086914063/8),
+    REAL_CONST(5492.3842773438/8),
+    REAL_CONST(5503.8657226563/8),
+    REAL_CONST(5515.3530273438/8),
+    REAL_CONST(5526.8461914063/8),
+    REAL_CONST(5538.3452148438/8),
+    REAL_CONST(5549.8505859375/8),
+    REAL_CONST(5561.3618164063/8),
+    REAL_CONST(5572.8789062500/8),
+    REAL_CONST(5584.4023437500/8),
+    REAL_CONST(5595.9311523438/8),
+    REAL_CONST(5607.4663085938/8),
+    REAL_CONST(5619.0073242188/8),
+    REAL_CONST(5630.5541992188/8),
+    REAL_CONST(5642.1069335938/8),
+    REAL_CONST(5653.6655273438/8),
+    REAL_CONST(5665.2304687500/8),
+    REAL_CONST(5676.8007812500/8),
+    REAL_CONST(5688.3774414063/8),
+    REAL_CONST(5699.9594726563/8),
+    REAL_CONST(5711.5478515625/8),
+    REAL_CONST(5723.1420898438/8),
+    REAL_CONST(5734.7421875000/8),
+    REAL_CONST(5746.3476562500/8),
+    REAL_CONST(5757.9594726563/8),
+    REAL_CONST(5769.5771484375/8),
+    REAL_CONST(5781.2006835938/8),
+    REAL_CONST(5792.8300781250/8),
+    REAL_CONST(5804.4648437500/8),
+    REAL_CONST(5816.1059570313/8),
+    REAL_CONST(5827.7524414063/8),
+    REAL_CONST(5839.4052734375/8),
+    REAL_CONST(5851.0634765625/8),
+    REAL_CONST(5862.7280273438/8),
+    REAL_CONST(5874.3979492188/8),
+    REAL_CONST(5886.0737304688/8),
+    REAL_CONST(5897.7553710938/8),
+    REAL_CONST(5909.4428710938/8),
+    REAL_CONST(5921.1357421875/8),
+    REAL_CONST(5932.8349609375/8),
+    REAL_CONST(5944.5395507813/8),
+    REAL_CONST(5956.2500000000/8),
+    REAL_CONST(5967.9663085938/8),
+    REAL_CONST(5979.6884765625/8),
+    REAL_CONST(5991.4160156250/8),
+    REAL_CONST(6003.1494140625/8),
+    REAL_CONST(6014.8886718750/8),
+    REAL_CONST(6026.6337890625/8),
+    REAL_CONST(6038.3842773438/8),
+    REAL_CONST(6050.1411132813/8),
+    REAL_CONST(6061.9028320313/8),
+    REAL_CONST(6073.6708984375/8),
+    REAL_CONST(6085.4443359375/8),
+    REAL_CONST(6097.2236328125/8),
+    REAL_CONST(6109.0083007813/8),
+    REAL_CONST(6120.7993164063/8),
+    REAL_CONST(6132.5952148438/8),
+    REAL_CONST(6144.3974609375/8),
+    REAL_CONST(6156.2050781250/8),
+    REAL_CONST(6168.0180664063/8),
+    REAL_CONST(6179.8374023438/8),
+    REAL_CONST(6191.6616210938/8),
+    REAL_CONST(6203.4921875000/8),
+    REAL_CONST(6215.3281250000/8),
+    REAL_CONST(6227.1694335938/8),
+    REAL_CONST(6239.0166015625/8),
+    REAL_CONST(6250.8696289063/8),
+    REAL_CONST(6262.7280273438/8),
+    REAL_CONST(6274.5917968750/8),
+    REAL_CONST(6286.4614257813/8),
+    REAL_CONST(6298.3369140625/8),
+    REAL_CONST(6310.2177734375/8),
+    REAL_CONST(6322.1040039063/8),
+    REAL_CONST(6333.9960937500/8),
+    REAL_CONST(6345.8940429688/8),
+    REAL_CONST(6357.7968750000/8),
+    REAL_CONST(6369.7055664063/8),
+    REAL_CONST(6381.6201171875/8),
+    REAL_CONST(6393.5400390625/8),
+    REAL_CONST(6405.4653320313/8),
+    REAL_CONST(6417.3964843750/8),
+    REAL_CONST(6429.3330078125/8),
+    REAL_CONST(6441.2753906250/8),
+    REAL_CONST(6453.2226562500/8),
+    REAL_CONST(6465.1757812500/8),
+    REAL_CONST(6477.1347656250/8),
+    REAL_CONST(6489.0991210938/8),
+    REAL_CONST(6501.0688476563/8),
+    REAL_CONST(6513.0439453125/8),
+    REAL_CONST(6525.0249023438/8),
+    REAL_CONST(6537.0107421875/8),
+    REAL_CONST(6549.0029296875/8),
+    REAL_CONST(6561.0000000000/8),
+    REAL_CONST(6573.0029296875/8),
+    REAL_CONST(6585.0107421875/8),
+    REAL_CONST(6597.0249023438/8),
+    REAL_CONST(6609.0439453125/8),
+    REAL_CONST(6621.0683593750/8),
+    REAL_CONST(6633.0986328125/8),
+    REAL_CONST(6645.1342773438/8),
+    REAL_CONST(6657.1752929688/8),
+    REAL_CONST(6669.2216796875/8),
+    REAL_CONST(6681.2734375000/8),
+    REAL_CONST(6693.3310546875/8),
+    REAL_CONST(6705.3935546875/8),
+    REAL_CONST(6717.4619140625/8),
+    REAL_CONST(6729.5356445313/8),
+    REAL_CONST(6741.6142578125/8),
+    REAL_CONST(6753.6987304688/8),
+    REAL_CONST(6765.7885742188/8),
+    REAL_CONST(6777.8842773438/8),
+    REAL_CONST(6789.9848632813/8),
+    REAL_CONST(6802.0908203125/8),
+    REAL_CONST(6814.2021484375/8),
+    REAL_CONST(6826.3188476563/8),
+    REAL_CONST(6838.4414062500/8),
+    REAL_CONST(6850.5688476563/8),
+    REAL_CONST(6862.7016601563/8),
+    REAL_CONST(6874.8403320313/8),
+    REAL_CONST(6886.9838867188/8),
+    REAL_CONST(6899.1328125000/8),
+    REAL_CONST(6911.2871093750/8),
+    REAL_CONST(6923.4467773438/8),
+    REAL_CONST(6935.6118164063/8),
+    REAL_CONST(6947.7822265625/8),
+    REAL_CONST(6959.9580078125/8),
+    REAL_CONST(6972.1391601563/8),
+    REAL_CONST(6984.3256835938/8),
+    REAL_CONST(6996.5170898438/8),
+    REAL_CONST(7008.7143554688/8),
+    REAL_CONST(7020.9165039063/8),
+    REAL_CONST(7033.1245117188/8),
+    REAL_CONST(7045.3374023438/8),
+    REAL_CONST(7057.5556640625/8),
+    REAL_CONST(7069.7788085938/8),
+    REAL_CONST(7082.0078125000/8),
+    REAL_CONST(7094.2416992188/8),
+    REAL_CONST(7106.4814453125/8),
+    REAL_CONST(7118.7260742188/8),
+    REAL_CONST(7130.9755859375/8),
+    REAL_CONST(7143.2309570313/8),
+    REAL_CONST(7155.4912109375/8),
+    REAL_CONST(7167.7568359375/8),
+    REAL_CONST(7180.0278320313/8),
+    REAL_CONST(7192.3041992188/8),
+    REAL_CONST(7204.5854492188/8),
+    REAL_CONST(7216.8720703125/8),
+    REAL_CONST(7229.1640625000/8),
+    REAL_CONST(7241.4614257813/8),
+    REAL_CONST(7253.7636718750/8),
+    REAL_CONST(7266.0712890625/8),
+    REAL_CONST(7278.3837890625/8),
+    REAL_CONST(7290.7016601563/8),
+    REAL_CONST(7303.0249023438/8),
+    REAL_CONST(7315.3535156250/8),
+    REAL_CONST(7327.6870117188/8),
+    REAL_CONST(7340.0258789063/8),
+    REAL_CONST(7352.3696289063/8),
+    REAL_CONST(7364.7187500000/8),
+    REAL_CONST(7377.0732421875/8),
+    REAL_CONST(7389.4326171875/8),
+    REAL_CONST(7401.7973632813/8),
+    REAL_CONST(7414.1669921875/8),
+    REAL_CONST(7426.5419921875/8),
+    REAL_CONST(7438.9223632813/8),
+    REAL_CONST(7451.3076171875/8),
+    REAL_CONST(7463.6982421875/8),
+    REAL_CONST(7476.0937500000/8),
+    REAL_CONST(7488.4941406250/8),
+    REAL_CONST(7500.9003906250/8),
+    REAL_CONST(7513.3110351563/8),
+    REAL_CONST(7525.7275390625/8),
+    REAL_CONST(7538.1484375000/8),
+    REAL_CONST(7550.5751953125/8),
+    REAL_CONST(7563.0063476563/8),
+    REAL_CONST(7575.4428710938/8),
+    REAL_CONST(7587.8847656250/8),
+    REAL_CONST(7600.3315429688/8),
+    REAL_CONST(7612.7836914063/8),
+    REAL_CONST(7625.2407226563/8),
+    REAL_CONST(7637.7026367188/8),
+    REAL_CONST(7650.1699218750/8),
+    REAL_CONST(7662.6420898438/8),
+    REAL_CONST(7675.1191406250/8),
+    REAL_CONST(7687.6015625000/8),
+    REAL_CONST(7700.0893554688/8),
+    REAL_CONST(7712.5815429688/8),
+    REAL_CONST(7725.0795898438/8),
+    REAL_CONST(7737.5820312500/8),
+    REAL_CONST(7750.0898437500/8),
+    REAL_CONST(7762.6025390625/8),
+    REAL_CONST(7775.1201171875/8),
+    REAL_CONST(7787.6430664063/8),
+    REAL_CONST(7800.1708984375/8),
+    REAL_CONST(7812.7041015625/8),
+    REAL_CONST(7825.2416992188/8),
+    REAL_CONST(7837.7846679688/8),
+    REAL_CONST(7850.3330078125/8),
+    REAL_CONST(7862.8857421875/8),
+    REAL_CONST(7875.4438476563/8),
+    REAL_CONST(7888.0068359375/8),
+    REAL_CONST(7900.5747070313/8),
+    REAL_CONST(7913.1479492188/8),
+    REAL_CONST(7925.7260742188/8),
+    REAL_CONST(7938.3090820313/8),
+    REAL_CONST(7950.8969726563/8),
+    REAL_CONST(7963.4897460938/8),
+    REAL_CONST(7976.0878906250/8),
+    REAL_CONST(7988.6909179688/8),
+    REAL_CONST(8001.2988281250/8),
+    REAL_CONST(8013.9116210938/8),
+    REAL_CONST(8026.5292968750/8),
+    REAL_CONST(8039.1523437500/8),
+    REAL_CONST(8051.7797851563/8),
+    REAL_CONST(8064.4125976563/8),
+    REAL_CONST(8077.0502929688/8),
+    REAL_CONST(8089.6928710938/8),
+    REAL_CONST(8102.3403320313/8),
+    REAL_CONST(8114.9931640625/8),
+    REAL_CONST(8127.6503906250/8),
+    REAL_CONST(8140.3129882813/8),
+    REAL_CONST(8152.9799804688/8),
+    REAL_CONST(8165.6523437500/8),
+    REAL_CONST(8178.3295898438/8),
+    REAL_CONST(8191.0117187500/8),
+    REAL_CONST(8203.6982421875/8),
+    REAL_CONST(8216.3906250000/8),
+    REAL_CONST(8229.0869140625/8),
+    REAL_CONST(8241.7890625000/8),
+    REAL_CONST(8254.4951171875/8),
+    REAL_CONST(8267.2070312500/8),
+    REAL_CONST(8279.9228515625/8),
+    REAL_CONST(8292.6445312500/8),
+    REAL_CONST(8305.3701171875/8),
+    REAL_CONST(8318.1015625000/8),
+    REAL_CONST(8330.8369140625/8),
+    REAL_CONST(8343.5781250000/8),
+    REAL_CONST(8356.3232421875/8),
+    REAL_CONST(8369.0742187500/8),
+    REAL_CONST(8381.8291015625/8),
+    REAL_CONST(8394.5898437500/8),
+    REAL_CONST(8407.3544921875/8),
+    REAL_CONST(8420.1240234375/8),
+    REAL_CONST(8432.8994140625/8),
+    REAL_CONST(8445.6787109375/8),
+    REAL_CONST(8458.4628906250/8),
+    REAL_CONST(8471.2519531250/8),
+    REAL_CONST(8484.0458984375/8),
+    REAL_CONST(8496.8447265625/8),
+    REAL_CONST(8509.6484375000/8),
+    REAL_CONST(8522.4570312500/8),
+    REAL_CONST(8535.2705078125/8),
+    REAL_CONST(8548.0888671875/8),
+    REAL_CONST(8560.9111328125/8),
+    REAL_CONST(8573.7392578125/8),
+    REAL_CONST(8586.5722656250/8),
+    REAL_CONST(8599.4091796875/8),
+    REAL_CONST(8612.2509765625/8),
+    REAL_CONST(8625.0986328125/8),
+    REAL_CONST(8637.9501953125/8),
+    REAL_CONST(8650.8066406250/8),
+    REAL_CONST(8663.6679687500/8),
+    REAL_CONST(8676.5332031250/8),
+    REAL_CONST(8689.4042968750/8),
+    REAL_CONST(8702.2802734375/8),
+    REAL_CONST(8715.1601562500/8),
+    REAL_CONST(8728.0458984375/8),
+    REAL_CONST(8740.9355468750/8),
+    REAL_CONST(8753.8300781250/8),
+    REAL_CONST(8766.7294921875/8),
+    REAL_CONST(8779.6337890625/8),
+    REAL_CONST(8792.5419921875/8),
+    REAL_CONST(8805.4560546875/8),
+    REAL_CONST(8818.3740234375/8),
+    REAL_CONST(8831.2968750000/8),
+    REAL_CONST(8844.2246093750/8),
+    REAL_CONST(8857.1572265625/8),
+    REAL_CONST(8870.0947265625/8),
+    REAL_CONST(8883.0371093750/8),
+    REAL_CONST(8895.9833984375/8),
+    REAL_CONST(8908.9345703125/8),
+    REAL_CONST(8921.8906250000/8),
+    REAL_CONST(8934.8515625000/8),
+    REAL_CONST(8947.8173828125/8),
+    REAL_CONST(8960.7871093750/8),
+    REAL_CONST(8973.7626953125/8),
+    REAL_CONST(8986.7421875000/8),
+    REAL_CONST(8999.7265625000/8),
+    REAL_CONST(9012.7148437500/8),
+    REAL_CONST(9025.7089843750/8),
+    REAL_CONST(9038.7070312500/8),
+    REAL_CONST(9051.7099609375/8),
+    REAL_CONST(9064.7177734375/8),
+    REAL_CONST(9077.7304687500/8),
+    REAL_CONST(9090.7470703125/8),
+    REAL_CONST(9103.7685546875/8),
+    REAL_CONST(9116.7949218750/8),
+    REAL_CONST(9129.8261718750/8),
+    REAL_CONST(9142.8613281250/8),
+    REAL_CONST(9155.9023437500/8),
+    REAL_CONST(9168.9472656250/8),
+    REAL_CONST(9181.9960937500/8),
+    REAL_CONST(9195.0507812500/8),
+    REAL_CONST(9208.1093750000/8),
+    REAL_CONST(9221.1728515625/8),
+    REAL_CONST(9234.2412109375/8),
+    REAL_CONST(9247.3134765625/8),
+    REAL_CONST(9260.3906250000/8),
+    REAL_CONST(9273.4726562500/8),
+    REAL_CONST(9286.5595703125/8),
+    REAL_CONST(9299.6503906250/8),
+    REAL_CONST(9312.7460937500/8),
+    REAL_CONST(9325.8466796875/8),
+    REAL_CONST(9338.9521484375/8),
+    REAL_CONST(9352.0615234375/8),
+    REAL_CONST(9365.1757812500/8),
+    REAL_CONST(9378.2949218750/8),
+    REAL_CONST(9391.4179687500/8),
+    REAL_CONST(9404.5458984375/8),
+    REAL_CONST(9417.6787109375/8),
+    REAL_CONST(9430.8154296875/8),
+    REAL_CONST(9443.9570312500/8),
+    REAL_CONST(9457.1035156250/8),
+    REAL_CONST(9470.2539062500/8),
+    REAL_CONST(9483.4101562500/8),
+    REAL_CONST(9496.5693359375/8),
+    REAL_CONST(9509.7343750000/8),
+    REAL_CONST(9522.9033203125/8),
+    REAL_CONST(9536.0771484375/8),
+    REAL_CONST(9549.2548828125/8),
+    REAL_CONST(9562.4384765625/8),
+    REAL_CONST(9575.6250000000/8),
+    REAL_CONST(9588.8173828125/8),
+    REAL_CONST(9602.0136718750/8),
+    REAL_CONST(9615.2148437500/8),
+    REAL_CONST(9628.4199218750/8),
+    REAL_CONST(9641.6298828125/8),
+    REAL_CONST(9654.8447265625/8),
+    REAL_CONST(9668.0634765625/8),
+    REAL_CONST(9681.2871093750/8),
+    REAL_CONST(9694.5146484375/8),
+    REAL_CONST(9707.7470703125/8),
+    REAL_CONST(9720.9843750000/8),
+    REAL_CONST(9734.2265625000/8),
+    REAL_CONST(9747.4726562500/8),
+    REAL_CONST(9760.7226562500/8),
+    REAL_CONST(9773.9775390625/8),
+    REAL_CONST(9787.2373046875/8),
+    REAL_CONST(9800.5019531250/8),
+    REAL_CONST(9813.7705078125/8),
+    REAL_CONST(9827.0429687500/8),
+    REAL_CONST(9840.3212890625/8),
+    REAL_CONST(9853.6025390625/8),
+    REAL_CONST(9866.8896484375/8),
+    REAL_CONST(9880.1806640625/8),
+    REAL_CONST(9893.4755859375/8),
+    REAL_CONST(9906.7753906250/8),
+    REAL_CONST(9920.0800781250/8),
+    REAL_CONST(9933.3886718750/8),
+    REAL_CONST(9946.7021484375/8),
+    REAL_CONST(9960.0195312500/8),
+    REAL_CONST(9973.3417968750/8),
+    REAL_CONST(9986.6689453125/8),
+    REAL_CONST(10000.0000000000/8),
+    REAL_CONST(10013.3359375000/8),
+    REAL_CONST(10026.6757812500/8),
+    REAL_CONST(10040.0195312500/8),
+    REAL_CONST(10053.3691406250/8),
+    REAL_CONST(10066.7216796875/8),
+    REAL_CONST(10080.0800781250/8),
+    REAL_CONST(10093.4423828125/8),
+    REAL_CONST(10106.8085937500/8),
+    REAL_CONST(10120.1796875000/8),
+    REAL_CONST(10133.5546875000/8),
+    REAL_CONST(10146.9345703125/8),
+    REAL_CONST(10160.3193359375/8),
+    REAL_CONST(10173.7080078125/8),
+    REAL_CONST(10187.1005859375/8),
+    REAL_CONST(10200.4980468750/8),
+    REAL_CONST(10213.9003906250/8),
+    REAL_CONST(10227.3066406250/8),
+    REAL_CONST(10240.7167968750/8),
+    REAL_CONST(10254.1318359375/8),
+    REAL_CONST(10267.5517578125/8),
+    REAL_CONST(10280.9755859375/8),
+    REAL_CONST(10294.4033203125/8),
+    REAL_CONST(10307.8359375000/8),
+    REAL_CONST(10321.2734375000/8),
+    REAL_CONST(10334.7148437500/8)
+};
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/is.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,105 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: is.c,v 1.11 2003/07/29 08:20:12 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include "syntax.h"
+#include "is.h"
+
+#ifdef FIXED_POINT
+static real_t pow05_table[] = {
+    COEF_CONST(1.68179283050743), /* 0.5^(-3/4) */
+    COEF_CONST(1.41421356237310), /* 0.5^(-2/4) */
+    COEF_CONST(1.18920711500272), /* 0.5^(-1/4) */
+    COEF_CONST(1.0),              /* 0.5^( 0/4) */
+    COEF_CONST(0.84089641525371), /* 0.5^(+1/4) */
+    COEF_CONST(0.70710678118655), /* 0.5^(+2/4) */
+    COEF_CONST(0.59460355750136)  /* 0.5^(+3/4) */
+};
+#endif
+
+void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
+               uint16_t frame_len)
+{
+    uint8_t g, sfb, b;
+    uint16_t i, k;
+#ifndef FIXED_POINT
+    real_t scale;
+#else
+    int32_t exp, frac;
+#endif
+
+    uint16_t nshort = frame_len/8;
+    uint8_t group = 0;
+
+    for (g = 0; g < icsr->num_window_groups; g++)
+    {
+        /* Do intensity stereo decoding */
+        for (b = 0; b < icsr->window_group_length[g]; b++)
+        {
+            for (sfb = 0; sfb < icsr->max_sfb; sfb++)
+            {
+                if (is_intensity(icsr, g, sfb))
+                {
+                    /* 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;
+
+#ifndef FIXED_POINT
+                    scale = (real_t)pow(0.5, (0.25*icsr->scale_factors[g][sfb]));
+#else
+                    exp = icsr->scale_factors[g][sfb] / 4;
+                    frac = icsr->scale_factors[g][sfb] % 4;
+#endif
+
+                    /* Scale from left to right channel,
+                       do not touch left channel */
+                    for (i = icsr->swb_offset[sfb]; i < icsr->swb_offset[sfb+1]; i++)
+                    {
+                        k = (group*nshort)+i;
+#ifndef FIXED_POINT
+                        r_spec[k] = MUL(l_spec[k], scale);
+#else
+                        if (exp < 0)
+                            r_spec[k] = l_spec[k] << -exp;
+                        else
+                            r_spec[k] = l_spec[k] >> exp;
+                        r_spec[k] = MUL_R_C(r_spec[k], pow05_table[frac + 3]);
+#endif
+                        if (is_intensity(icsr, g, sfb) != invert_intensity(ics, g, sfb))
+                            r_spec[k] = -r_spec[k];
+                    }
+                }
+            }
+            group++;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/is.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,64 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: is.h,v 1.5 2003/07/29 08:20:12 menno Exp $
+**/
+
+#ifndef __IS_H__
+#define __IS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "syntax.h"
+
+void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
+               uint16_t frame_len);
+
+static INLINE int8_t is_intensity(ic_stream *ics, uint8_t group, uint8_t sfb)
+{
+    switch (ics->sfb_cb[group][sfb])
+    {
+    case INTENSITY_HCB:
+        return 1;
+    case INTENSITY_HCB2:
+        return -1;
+    default:
+        return 0;
+    }
+}
+
+static INLINE int8_t invert_intensity(ic_stream *ics, uint8_t group, uint8_t sfb)
+{
+    if (ics->ms_mask_present == 1)
+        return (1-2*ics->ms_used[group][sfb]);
+    return 1;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/kbd_win.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,4544 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** 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.5 2003/07/29 08:20:12 menno Exp $
+**/
+
+#ifndef __KBD_WIN_H__
+#define __KBD_WIN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef FIXED_POINT
+
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+
+real_t kbd_long_1024[] =
+{
+    0.00029256153896361,
+    0.00042998567353047,
+    0.00054674074589540,
+    0.00065482304299792,
+    0.00075870195068747,
+    0.00086059331713336,
+    0.00096177541439010,
+    0.0010630609410878,
+    0.0011650036308132,
+    0.0012680012194148,
+    0.0013723517232956,
+    0.0014782864109136,
+    0.0015859901976719,
+    0.0016956148252373,
+    0.0018072876903517,
+    0.0019211179405514,
+    0.0020372007924215,
+    0.0021556206591754,
+    0.0022764534599614,
+    0.0023997683540995,
+    0.0025256290631156,
+    0.0026540948920831,
+    0.0027852215281403,
+    0.0029190616715331,
+    0.0030556655443223,
+    0.0031950812943391,
+    0.0033373553240392,
+    0.0034825325586930,
+    0.0036306566699199,
+    0.0037817702604646,
+    0.0039359150179719,
+    0.0040931318437260,
+    0.0042534609610026,
+    0.0044169420066964,
+    0.0045836141091341,
+    0.0047535159544086,
+    0.0049266858431214,
+    0.0051031617390698,
+    0.0052829813111335,
+    0.0054661819693975,
+    0.0056528008963682,
+    0.0058428750739943,
+    0.0060364413070882,
+    0.0062335362436492,
+    0.0064341963925079,
+    0.0066384581386503,
+    0.0068463577565218,
+    0.0070579314215715,
+    0.0072732152202559,
+    0.0074922451586909,
+    0.0077150571701162,
+    0.0079416871213115,
+    0.0081721708180857,
+    0.0084065440099458,
+    0.0086448423940363,
+    0.0088871016184291,
+    0.0091333572848345,
+    0.0093836449507939,
+    0.0096380001314086,
+    0.0098964583006517,
+    0.010159054892306,
+    0.010425825300561,
+    0.010696804880310,
+    0.010972028947167,
+    0.011251532777236,
+    0.011535351606646,
+    0.011823520630897,
+    0.012116075003993,
+    0.012413049837429,
+    0.012714480198999,
+    0.013020401111478,
+    0.013330847551161,
+    0.013645854446288,
+    0.013965456675352,
+    0.014289689065314,
+    0.014618586389712,
+    0.014952183366697,
+    0.015290514656976,
+    0.015633614861688,
+    0.015981518520214,
+    0.016334260107915,
+    0.016691874033817,
+    0.017054394638241,
+    0.017421856190380,
+    0.017794292885832,
+    0.018171738844085,
+    0.018554228105962,
+    0.018941794631032,
+    0.019334472294980,
+    0.019732294886947,
+    0.020135296106839,
+    0.020543509562604,
+    0.020956968767488,
+    0.021375707137257,
+    0.021799757987407,
+    0.022229154530343,
+    0.022663929872540,
+    0.023104117011689,
+    0.023549748833816,
+    0.024000858110398,
+    0.024457477495451,
+    0.024919639522613,
+    0.025387376602207,
+    0.025860721018295,
+    0.026339704925726,
+    0.026824360347160,
+    0.027314719170100,
+    0.027810813143900,
+    0.028312673876775,
+    0.028820332832801,
+    0.029333821328905,
+    0.029853170531859,
+    0.030378411455255,
+    0.030909574956490,
+    0.031446691733739,
+    0.031989792322926,
+    0.032538907094693,
+    0.033094066251369,
+    0.033655299823935,
+    0.034222637668991,
+    0.034796109465717,
+    0.035375744712844,
+    0.035961572725616,
+    0.036553622632758,
+    0.037151923373446,
+    0.037756503694277,
+    0.038367392146243,
+    0.038984617081711,
+    0.039608206651398,
+    0.040238188801359,
+    0.040874591269976,
+    0.041517441584950,
+    0.042166767060301,
+    0.042822594793376,
+    0.043484951661852,
+    0.044153864320760,
+    0.044829359199509,
+    0.045511462498913,
+    0.046200200188234,
+    0.046895598002228,
+    0.047597681438201,
+    0.048306475753074,
+    0.049022005960455,
+    0.049744296827725,
+    0.050473372873129,
+    0.051209258362879,
+    0.051951977308273,
+    0.052701553462813,
+    0.053458010319350,
+    0.054221371107223,
+    0.054991658789428,
+    0.055768896059787,
+    0.056553105340134,
+    0.057344308777513,
+    0.058142528241393,
+    0.058947785320893,
+    0.059760101322019,
+    0.060579497264926,
+    0.061405993881180,
+    0.062239611611049,
+    0.063080370600799,
+    0.063928290700012,
+    0.064783391458919,
+    0.065645692125747,
+    0.066515211644086,
+    0.067391968650269,
+    0.068275981470777,
+    0.069167268119652,
+    0.070065846295935,
+    0.070971733381121,
+    0.071884946436630,
+    0.072805502201299,
+    0.073733417088896,
+    0.074668707185649,
+    0.075611388247794,
+    0.076561475699152,
+    0.077518984628715,
+    0.078483929788261,
+    0.079456325589986,
+    0.080436186104162,
+    0.081423525056808,
+    0.082418355827392,
+    0.083420691446553,
+    0.084430544593841,
+    0.085447927595483,
+    0.086472852422178,
+    0.087505330686900,
+    0.088545373642744,
+    0.089592992180780,
+    0.090648196827937,
+    0.091710997744919,
+    0.092781404724131,
+    0.093859427187640,
+    0.094945074185163,
+    0.096038354392069,
+    0.097139276107423,
+    0.098247847252041,
+    0.099364075366580,
+    0.10048796760965,
+    0.10161953075597,
+    0.10275877119451,
+    0.10390569492671,
+    0.10506030756469,
+    0.10622261432949,
+    0.10739262004941,
+    0.10857032915821,
+    0.10975574569357,
+    0.11094887329534,
+    0.11214971520402,
+    0.11335827425914,
+    0.11457455289772,
+    0.11579855315274,
+    0.11703027665170,
+    0.11826972461510,
+    0.11951689785504,
+    0.12077179677383,
+    0.12203442136263,
+    0.12330477120008,
+    0.12458284545102,
+    0.12586864286523,
+    0.12716216177615,
+    0.12846340009971,
+    0.12977235533312,
+    0.13108902455375,
+    0.13241340441801,
+    0.13374549116025,
+    0.13508528059173,
+    0.13643276809961,
+    0.13778794864595,
+    0.13915081676677,
+    0.14052136657114,
+    0.14189959174027,
+    0.14328548552671,
+    0.14467904075349,
+    0.14608024981336,
+    0.14748910466804,
+    0.14890559684750,
+    0.15032971744929,
+    0.15176145713790,
+    0.15320080614414,
+    0.15464775426459,
+    0.15610229086100,
+    0.15756440485987,
+    0.15903408475193,
+    0.16051131859170,
+    0.16199609399712,
+    0.16348839814917,
+    0.16498821779156,
+    0.16649553923042,
+    0.16801034833404,
+    0.16953263053270,
+    0.17106237081842,
+    0.17259955374484,
+    0.17414416342714,
+    0.17569618354193,
+    0.17725559732720,
+    0.17882238758238,
+    0.18039653666830,
+    0.18197802650733,
+    0.18356683858343,
+    0.18516295394233,
+    0.18676635319174,
+    0.18837701650148,
+    0.18999492360384,
+    0.19162005379380,
+    0.19325238592940,
+    0.19489189843209,
+    0.19653856928714,
+    0.19819237604409,
+    0.19985329581721,
+    0.20152130528605,
+    0.20319638069594,
+    0.20487849785865,
+    0.20656763215298,
+    0.20826375852540,
+    0.20996685149083,
+    0.21167688513330,
+    0.21339383310678,
+    0.21511766863598,
+    0.21684836451719,
+    0.21858589311922,
+    0.22033022638425,
+    0.22208133582887,
+    0.22383919254503,
+    0.22560376720111,
+    0.22737503004300,
+    0.22915295089517,
+    0.23093749916189,
+    0.23272864382838,
+    0.23452635346201,
+    0.23633059621364,
+    0.23814133981883,
+    0.23995855159925,
+    0.24178219846403,
+    0.24361224691114,
+    0.24544866302890,
+    0.24729141249740,
+    0.24914046059007,
+    0.25099577217522,
+    0.25285731171763,
+    0.25472504328019,
+    0.25659893052556,
+    0.25847893671788,
+    0.26036502472451,
+    0.26225715701781,
+    0.26415529567692,
+    0.26605940238966,
+    0.26796943845439,
+    0.26988536478190,
+    0.27180714189742,
+    0.27373472994256,
+    0.27566808867736,
+    0.27760717748238,
+    0.27955195536071,
+    0.28150238094021,
+    0.28345841247557,
+    0.28542000785059,
+    0.28738712458038,
+    0.28935971981364,
+    0.29133775033492,
+    0.29332117256704,
+    0.29530994257338,
+    0.29730401606034,
+    0.29930334837974,
+    0.30130789453132,
+    0.30331760916521,
+    0.30533244658452,
+    0.30735236074785,
+    0.30937730527195,
+    0.31140723343430,
+    0.31344209817583,
+    0.31548185210356,
+    0.31752644749341,
+    0.31957583629288,
+    0.32162997012390,
+    0.32368880028565,
+    0.32575227775738,
+    0.32782035320134,
+    0.32989297696566,
+    0.33197009908736,
+    0.33405166929523,
+    0.33613763701295,
+    0.33822795136203,
+    0.34032256116495,
+    0.34242141494820,
+    0.34452446094547,
+    0.34663164710072,
+    0.34874292107143,
+    0.35085823023181,
+    0.35297752167598,
+    0.35510074222129,
+    0.35722783841160,
+    0.35935875652060,
+    0.36149344255514,
+    0.36363184225864,
+    0.36577390111444,
+    0.36791956434930,
+    0.37006877693676,
+    0.37222148360070,
+    0.37437762881878,
+    0.37653715682603,
+    0.37870001161834,
+    0.38086613695607,
+    0.38303547636766,
+    0.38520797315322,
+    0.38738357038821,
+    0.38956221092708,
+    0.39174383740701,
+    0.39392839225157,
+    0.39611581767449,
+    0.39830605568342,
+    0.40049904808370,
+    0.40269473648218,
+    0.40489306229101,
+    0.40709396673153,
+    0.40929739083810,
+    0.41150327546197,
+    0.41371156127524,
+    0.41592218877472,
+    0.41813509828594,
+    0.42035022996702,
+    0.42256752381274,
+    0.42478691965848,
+    0.42700835718423,
+    0.42923177591866,
+    0.43145711524314,
+    0.43368431439580,
+    0.43591331247564,
+    0.43814404844658,
+    0.44037646114161,
+    0.44261048926688,
+    0.44484607140589,
+    0.44708314602359,
+    0.44932165147057,
+    0.45156152598727,
+    0.45380270770813,
+    0.45604513466581,
+    0.45828874479543,
+    0.46053347593880,
+    0.46277926584861,
+    0.46502605219277,
+    0.46727377255861,
+    0.46952236445718,
+    0.47177176532752,
+    0.47402191254100,
+    0.47627274340557,
+    0.47852419517009,
+    0.48077620502869,
+    0.48302871012505,
+    0.48528164755674,
+    0.48753495437962,
+    0.48978856761212,
+    0.49204242423966,
+    0.49429646121898,
+    0.49655061548250,
+    0.49880482394273,
+    0.50105902349665,
+    0.50331315103004,
+    0.50556714342194,
+    0.50782093754901,
+    0.51007447028990,
+    0.51232767852971,
+    0.51458049916433,
+    0.51683286910489,
+    0.51908472528213,
+    0.52133600465083,
+    0.52358664419420,
+    0.52583658092832,
+    0.52808575190648,
+    0.53033409422367,
+    0.53258154502092,
+    0.53482804148974,
+    0.53707352087652,
+    0.53931792048690,
+    0.54156117769021,
+    0.54380322992385,
+    0.54604401469766,
+    0.54828346959835,
+    0.55052153229384,
+    0.55275814053768,
+    0.55499323217338,
+    0.55722674513883,
+    0.55945861747062,
+    0.56168878730842,
+    0.56391719289930,
+    0.56614377260214,
+    0.56836846489188,
+    0.57059120836390,
+    0.57281194173835,
+    0.57503060386439,
+    0.57724713372458,
+    0.57946147043912,
+    0.58167355327012,
+    0.58388332162591,
+    0.58609071506528,
+    0.58829567330173,
+    0.59049813620770,
+    0.59269804381879,
+    0.59489533633802,
+    0.59708995413996,
+    0.59928183777495,
+    0.60147092797329,
+    0.60365716564937,
+    0.60584049190582,
+    0.60802084803764,
+    0.61019817553632,
+    0.61237241609393,
+    0.61454351160718,
+    0.61671140418155,
+    0.61887603613527,
+    0.62103735000336,
+    0.62319528854167,
+    0.62534979473088,
+    0.62750081178042,
+    0.62964828313250,
+    0.63179215246597,
+    0.63393236370030,
+    0.63606886099946,
+    0.63820158877577,
+    0.64033049169379,
+    0.64245551467413,
+    0.64457660289729,
+    0.64669370180740,
+    0.64880675711607,
+    0.65091571480603,
+    0.65302052113494,
+    0.65512112263906,
+    0.65721746613689,
+    0.65930949873289,
+    0.66139716782102,
+    0.66348042108842,
+    0.66555920651892,
+    0.66763347239664,
+    0.66970316730947,
+    0.67176824015260,
+    0.67382864013196,
+    0.67588431676768,
+    0.67793521989751,
+    0.67998129968017,
+    0.68202250659876,
+    0.68405879146403,
+    0.68609010541774,
+    0.68811639993588,
+    0.69013762683195,
+    0.69215373826012,
+    0.69416468671849,
+    0.69617042505214,
+    0.69817090645634,
+    0.70016608447958,
+    0.70215591302664,
+    0.70414034636163,
+    0.70611933911096,
+    0.70809284626630,
+    0.71006082318751,
+    0.71202322560554,
+    0.71398000962530,
+    0.71593113172842,
+    0.71787654877613,
+    0.71981621801195,
+    0.72175009706445,
+    0.72367814394990,
+    0.72560031707496,
+    0.72751657523927,
+    0.72942687763803,
+    0.73133118386457,
+    0.73322945391280,
+    0.73512164817975,
+    0.73700772746796,
+    0.73888765298787,
+    0.74076138636020,
+    0.74262888961827,
+    0.74449012521027,
+    0.74634505600152,
+    0.74819364527663,
+    0.75003585674175,
+    0.75187165452661,
+    0.75370100318668,
+    0.75552386770515,
+    0.75734021349500,
+    0.75915000640095,
+    0.76095321270137,
+    0.76274979911019,
+    0.76453973277875,
+    0.76632298129757,
+    0.76809951269819,
+    0.76986929545481,
+    0.77163229848604,
+    0.77338849115651,
+    0.77513784327849,
+    0.77688032511340,
+    0.77861590737340,
+    0.78034456122283,
+    0.78206625827961,
+    0.78378097061667,
+    0.78548867076330,
+    0.78718933170643,
+    0.78888292689189,
+    0.79056943022564,
+    0.79224881607494,
+    0.79392105926949,
+    0.79558613510249,
+    0.79724401933170,
+    0.79889468818046,
+    0.80053811833858,
+    0.80217428696334,
+    0.80380317168028,
+    0.80542475058405,
+    0.80703900223920,
+    0.80864590568089,
+    0.81024544041560,
+    0.81183758642175,
+    0.81342232415032,
+    0.81499963452540,
+    0.81656949894467,
+    0.81813189927991,
+    0.81968681787738,
+    0.82123423755821,
+    0.82277414161874,
+    0.82430651383076,
+    0.82583133844180,
+    0.82734860017528,
+    0.82885828423070,
+    0.83036037628369,
+    0.83185486248609,
+    0.83334172946597,
+    0.83482096432759,
+    0.83629255465130,
+    0.83775648849344,
+    0.83921275438615,
+    0.84066134133716,
+    0.84210223882952,
+    0.84353543682130,
+    0.84496092574524,
+    0.84637869650833,
+    0.84778874049138,
+    0.84919104954855,
+    0.85058561600677,
+    0.85197243266520,
+    0.85335149279457,
+    0.85472279013653,
+    0.85608631890295,
+    0.85744207377513,
+    0.85879004990298,
+    0.86013024290422,
+    0.86146264886346,
+    0.86278726433124,
+    0.86410408632306,
+    0.86541311231838,
+    0.86671434025950,
+    0.86800776855046,
+    0.86929339605590,
+    0.87057122209981,
+    0.87184124646433,
+    0.87310346938840,
+    0.87435789156650,
+    0.87560451414719,
+    0.87684333873173,
+    0.87807436737261,
+    0.87929760257204,
+    0.88051304728038,
+    0.88172070489456,
+    0.88292057925645,
+    0.88411267465117,
+    0.88529699580537,
+    0.88647354788545,
+    0.88764233649580,
+    0.88880336767692,
+    0.88995664790351,
+    0.89110218408260,
+    0.89223998355154,
+    0.89337005407600,
+    0.89449240384793,
+    0.89560704148345,
+    0.89671397602074,
+    0.89781321691786,
+    0.89890477405053,
+    0.89998865770993,
+    0.90106487860034,
+    0.90213344783689,
+    0.90319437694315,
+    0.90424767784873,
+    0.90529336288690,
+    0.90633144479201,
+    0.90736193669708,
+    0.90838485213119,
+    0.90940020501694,
+    0.91040800966776,
+    0.91140828078533,
+    0.91240103345685,
+    0.91338628315231,
+    0.91436404572173,
+    0.91533433739238,
+    0.91629717476594,
+    0.91725257481564,
+    0.91820055488334,
+    0.91914113267664,
+    0.92007432626589,
+    0.92100015408120,
+    0.92191863490944,
+    0.92282978789113,
+    0.92373363251740,
+    0.92463018862687,
+    0.92551947640245,
+    0.92640151636824,
+    0.92727632938624,
+    0.92814393665320,
+    0.92900435969727,
+    0.92985762037477,
+    0.93070374086684,
+    0.93154274367610,
+    0.93237465162328,
+    0.93319948784382,
+    0.93401727578443,
+    0.93482803919967,
+    0.93563180214841,
+    0.93642858899043,
+    0.93721842438279,
+    0.93800133327637,
+    0.93877734091223,
+    0.93954647281807,
+    0.94030875480458,
+    0.94106421296182,
+    0.94181287365556,
+    0.94255476352362,
+    0.94328990947213,
+    0.94401833867184,
+    0.94474007855439,
+    0.94545515680855,
+    0.94616360137644,
+    0.94686544044975,
+    0.94756070246592,
+    0.94824941610434,
+    0.94893161028248,
+    0.94960731415209,
+    0.95027655709525,
+    0.95093936872056,
+    0.95159577885924,
+    0.95224581756115,
+    0.95288951509097,
+    0.95352690192417,
+    0.95415800874314,
+    0.95478286643320,
+    0.95540150607863,
+    0.95601395895871,
+    0.95662025654373,
+    0.95722043049100,
+    0.95781451264084,
+    0.95840253501260,
+    0.95898452980058,
+    0.95956052937008,
+    0.96013056625336,
+    0.96069467314557,
+    0.96125288290073,
+    0.96180522852773,
+    0.96235174318622,
+    0.96289246018262,
+    0.96342741296604,
+    0.96395663512424,
+    0.96448016037959,
+    0.96499802258499,
+    0.96551025571985,
+    0.96601689388602,
+    0.96651797130376,
+    0.96701352230768,
+    0.96750358134269,
+    0.96798818295998,
+    0.96846736181297,
+    0.96894115265327,
+    0.96940959032667,
+    0.96987270976912,
+    0.97033054600270,
+    0.97078313413161,
+    0.97123050933818,
+    0.97167270687887,
+    0.97210976208030,
+    0.97254171033525,
+    0.97296858709871,
+    0.97339042788392,
+    0.97380726825843,
+    0.97421914384017,
+    0.97462609029350,
+    0.97502814332534,
+    0.97542533868127,
+    0.97581771214160,
+    0.97620529951759,
+    0.97658813664749,
+    0.97696625939282,
+    0.97733970363445,
+    0.97770850526884,
+    0.97807270020427,
+    0.97843232435704,
+    0.97878741364771,
+    0.97913800399743,
+    0.97948413132414,
+    0.97982583153895,
+    0.98016314054243,
+    0.98049609422096,
+    0.98082472844313,
+    0.98114907905608,
+    0.98146918188197,
+    0.98178507271438,
+    0.98209678731477,
+    0.98240436140902,
+    0.98270783068385,
+    0.98300723078342,
+    0.98330259730589,
+    0.98359396579995,
+    0.98388137176152,
+    0.98416485063031,
+    0.98444443778651,
+    0.98472016854752,
+    0.98499207816463,
+    0.98526020181980,
+    0.98552457462240,
+    0.98578523160609,
+    0.98604220772560,
+    0.98629553785362,
+    0.98654525677772,
+    0.98679139919726,
+    0.98703399972035,
+    0.98727309286089,
+    0.98750871303556,
+    0.98774089456089,
+    0.98796967165036,
+    0.98819507841154,
+    0.98841714884323,
+    0.98863591683269,
+    0.98885141615285,
+    0.98906368045957,
+    0.98927274328896,
+    0.98947863805473,
+    0.98968139804554,
+    0.98988105642241,
+    0.99007764621618,
+    0.99027120032501,
+    0.99046175151186,
+    0.99064933240208,
+    0.99083397548099,
+    0.99101571309153,
+    0.99119457743191,
+    0.99137060055337,
+    0.99154381435784,
+    0.99171425059582,
+    0.99188194086414,
+    0.99204691660388,
+    0.99220920909823,
+    0.99236884947045,
+    0.99252586868186,
+    0.99268029752989,
+    0.99283216664606,
+    0.99298150649419,
+    0.99312834736847,
+    0.99327271939167,
+    0.99341465251338,
+    0.99355417650825,
+    0.99369132097430,
+    0.99382611533130,
+    0.99395858881910,
+    0.99408877049612,
+    0.99421668923778,
+    0.99434237373503,
+    0.99446585249289,
+    0.99458715382906,
+    0.99470630587254,
+    0.99482333656229,
+    0.99493827364600,
+    0.99505114467878,
+    0.99516197702200,
+    0.99527079784214,
+    0.99537763410962,
+    0.99548251259777,
+    0.99558545988178,
+    0.99568650233767,
+    0.99578566614138,
+    0.99588297726783,
+    0.99597846149005,
+    0.99607214437834,
+    0.99616405129947,
+    0.99625420741595,
+    0.99634263768527,
+    0.99642936685928,
+    0.99651441948352,
+    0.99659781989663,
+    0.99667959222978,
+    0.99675976040620,
+    0.99683834814063,
+    0.99691537893895,
+    0.99699087609774,
+    0.99706486270391,
+    0.99713736163442,
+    0.99720839555593,
+    0.99727798692461,
+    0.99734615798589,
+    0.99741293077431,
+    0.99747832711337,
+    0.99754236861541,
+    0.99760507668158,
+    0.99766647250181,
+    0.99772657705478,
+    0.99778541110799,
+    0.99784299521785,
+    0.99789934972976,
+    0.99795449477828,
+    0.99800845028730,
+    0.99806123597027,
+    0.99811287133042,
+    0.99816337566108,
+    0.99821276804596,
+    0.99826106735952,
+    0.99830829226732,
+    0.99835446122649,
+    0.99839959248609,
+    0.99844370408765,
+    0.99848681386566,
+    0.99852893944805,
+    0.99857009825685,
+    0.99861030750869,
+    0.99864958421549,
+    0.99868794518504,
+    0.99872540702178,
+    0.99876198612738,
+    0.99879769870160,
+    0.99883256074295,
+    0.99886658804953,
+    0.99889979621983,
+    0.99893220065356,
+    0.99896381655254,
+    0.99899465892154,
+    0.99902474256924,
+    0.99905408210916,
+    0.99908269196056,
+    0.99911058634952,
+    0.99913777930986,
+    0.99916428468421,
+    0.99919011612505,
+    0.99921528709576,
+    0.99923981087174,
+    0.99926370054150,
+    0.99928696900779,
+    0.99930962898876,
+    0.99933169301910,
+    0.99935317345126,
+    0.99937408245662,
+    0.99939443202674,
+    0.99941423397457,
+    0.99943349993572,
+    0.99945224136972,
+    0.99947046956130,
+    0.99948819562171,
+    0.99950543049000,
+    0.99952218493439,
+    0.99953846955355,
+    0.99955429477803,
+    0.99956967087154,
+    0.99958460793242,
+    0.99959911589494,
+    0.99961320453077,
+    0.99962688345035,
+    0.99964016210433,
+    0.99965304978499,
+    0.99966555562769,
+    0.99967768861231,
+    0.99968945756473,
+    0.99970087115825,
+    0.99971193791510,
+    0.99972266620792,
+    0.99973306426121,
+    0.99974314015288,
+    0.99975290181568,
+    0.99976235703876,
+    0.99977151346914,
+    0.99978037861326,
+    0.99978895983845,
+    0.99979726437448,
+    0.99980529931507,
+    0.99981307161943,
+    0.99982058811377,
+    0.99982785549283,
+    0.99983488032144,
+    0.99984166903600,
+    0.99984822794606,
+    0.99985456323584,
+    0.99986068096572,
+    0.99986658707386,
+    0.99987228737764,
+    0.99987778757524,
+    0.99988309324717,
+    0.99988820985777,
+    0.99989314275675,
+    0.99989789718072,
+    0.99990247825468,
+    0.99990689099357,
+    0.99991114030376,
+    0.99991523098456,
+    0.99991916772971,
+    0.99992295512891,
+    0.99992659766930,
+    0.99993009973692,
+    0.99993346561824,
+    0.99993669950161,
+    0.99993980547870,
+    0.99994278754604,
+    0.99994564960642,
+    0.99994839547033,
+    0.99995102885747,
+    0.99995355339809,
+    0.99995597263451,
+    0.99995829002249,
+    0.99996050893264,
+    0.99996263265183,
+    0.99996466438460,
+    0.99996660725452,
+    0.99996846430558,
+    0.99997023850356,
+    0.99997193273736,
+    0.99997354982037,
+    0.99997509249183,
+    0.99997656341810,
+    0.99997796519400,
+    0.99997930034415,
+    0.99998057132421,
+    0.99998178052220,
+    0.99998293025975,
+    0.99998402279338,
+    0.99998506031574,
+    0.99998604495686,
+    0.99998697878536,
+    0.99998786380966,
+    0.99998870197921,
+    0.99998949518567,
+    0.99999024526408,
+    0.99999095399401,
+    0.99999162310077,
+    0.99999225425649,
+    0.99999284908128,
+    0.99999340914435,
+    0.99999393596510,
+    0.99999443101421,
+    0.99999489571473,
+    0.99999533144314,
+    0.99999573953040,
+    0.99999612126300,
+    0.99999647788395,
+    0.99999681059383,
+    0.99999712055178,
+    0.99999740887647,
+    0.99999767664709,
+    0.99999792490431,
+    0.99999815465123,
+    0.99999836685427,
+    0.99999856244415,
+    0.99999874231676,
+    0.99999890733405,
+    0.99999905832493,
+    0.99999919608613,
+    0.99999932138304,
+    0.99999943495056,
+    0.99999953749392,
+    0.99999962968950,
+    0.99999971218563,
+    0.99999978560337,
+    0.99999985053727,
+    0.99999990755616,
+    0.99999995720387
+};
+
+real_t kbd_long_960[] = {
+    0.0003021562530949,
+    0.0004452267024786,
+    0.0005674947527496,
+    0.0006812465553466,
+    0.0007910496776387,
+    0.0008991655033895,
+    0.0010068978259384,
+    0.0011150758515751,
+    0.0012242653193642,
+    0.0013348735658205,
+    0.0014472068670273,
+    0.0015615039850448,
+    0.0016779568885263,
+    0.0017967241232412,
+    0.0019179397560955,
+    0.0020417195415393,
+    0.0021681652836642,
+    0.0022973679910599,
+    0.0024294102029937,
+    0.0025643677339078,
+    0.0027023110014772,
+    0.0028433060512612,
+    0.0029874153568025,
+    0.0031346984511728,
+    0.0032852124303662,
+    0.0034390123581190,
+    0.0035961515940931,
+    0.0037566820618961,
+    0.0039206544694386,
+    0.0040881184912194,
+    0.0042591229199617,
+    0.0044337157933972,
+    0.0046119445007641,
+    0.0047938558726415,
+    0.0049794962570131,
+    0.0051689115838900,
+    0.0053621474203763,
+    0.0055592490177131,
+    0.0057602613515573,
+    0.0059652291565289,
+    0.0061741969558843,
+    0.0063872090870253,
+    0.0066043097234387,
+    0.0068255428935640,
+    0.0070509524970088,
+    0.0072805823184660,
+    0.0075144760396340,
+    0.0077526772493942,
+    0.0079952294524673,
+    0.0082421760767325,
+    0.0084935604793733,
+    0.0087494259519870,
+    0.0090098157247792,
+    0.0092747729699467,
+    0.0095443408043399,
+    0.0098185622914832,
+    0.0100974804430226,
+    0.0103811382196612,
+    0.0106695785316351,
+    0.0109628442387771,
+    0.0112609781502091,
+    0.0115640230236993,
+    0.0118720215647169,
+    0.0121850164252137,
+    0.0125030502021561,
+    0.0128261654358321,
+    0.0131544046079532,
+    0.0134878101395681,
+    0.0138264243888068,
+    0.0141702896484671,
+    0.0145194481434592,
+    0.0148739420281182,
+    0.0152338133833959,
+    0.0155991042139432,
+    0.0159698564450882,
+    0.0163461119197227,
+    0.0167279123950996,
+    0.0171152995395520,
+    0.0175083149291368,
+    0.0179070000442104,
+    0.0183113962659409,
+    0.0187215448727609,
+    0.0191374870367659,
+    0.0195592638200623,
+    0.0199869161710679,
+    0.0204204849207691,
+    0.0208600107789370,
+    0.0213055343303066,
+    0.0217570960307201,
+    0.0222147362032386,
+    0.0226784950342228,
+    0.0231484125693867,
+    0.0236245287098244,
+    0.0241068832080138,
+    0.0245955156637973,
+    0.0250904655203431,
+    0.0255917720600868,
+    0.0260994744006559,
+    0.0266136114907790,
+    0.0271342221061795,
+    0.0276613448454576,
+    0.0281950181259587,
+    0.0287352801796329,
+    0.0292821690488833,
+    0.0298357225824074,
+    0.0303959784310299,
+    0.0309629740435296,
+    0.0315367466624615,
+    0.0321173333199732,
+    0.0327047708336193,
+    0.0332990958021720,
+    0.0339003446014307,
+    0.0345085533800302,
+    0.0351237580552491,
+    0.0357459943088193,
+    0.0363752975827358,
+    0.0370117030750704,
+    0.0376552457357870,
+    0.0383059602625614,
+    0.0389638810966056,
+    0.0396290424184964,
+    0.0403014781440112,
+    0.0409812219199691,
+    0.0416683071200799,
+    0.0423627668408009,
+    0.0430646338972016,
+    0.0437739408188385,
+    0.0444907198456388,
+    0.0452150029237951,
+    0.0459468217016708,
+    0.0466862075257170,
+    0.0474331914364021,
+    0.0481878041641539,
+    0.0489500761253148,
+    0.0497200374181119,
+    0.0504977178186404,
+    0.0512831467768636,
+    0.0520763534126273,
+    0.0528773665116913,
+    0.0536862145217772,
+    0.0545029255486345,
+    0.0553275273521232,
+    0.0561600473423164,
+    0.0570005125756209,
+    0.0578489497509179,
+    0.0587053852057233,
+    0.0595698449123695,
+    0.0604423544742077,
+    0.0613229391218317,
+    0.0622116237093247,
+    0.0631084327105284,
+    0.0640133902153352,
+    0.0649265199260043,
+    0.0658478451535027,
+    0.0667773888138695,
+    0.0677151734246072,
+    0.0686612211010977,
+    0.0696155535530446,
+    0.0705781920809429,
+    0.0715491575725758,
+    0.0725284704995383,
+    0.0735161509137906,
+    0.0745122184442388,
+    0.0755166922933461,
+    0.0765295912337720,
+    0.0775509336050437,
+    0.0785807373102561,
+    0.0796190198128044,
+    0.0806657981331473,
+    0.0817210888456026,
+    0.0827849080751753,
+    0.0838572714944183,
+    0.0849381943203265,
+    0.0860276913112652,
+    0.0871257767639319,
+    0.0882324645103534,
+    0.0893477679149177,
+    0.0904716998714418,
+    0.0916042728002747,
+    0.0927454986454381,
+    0.0938953888718020,
+    0.0950539544622996,
+    0.0962212059151784,
+    0.0973971532412897,
+    0.0985818059614169,
+    0.0997751731036425,
+    0.1009772632007537,
+    0.1021880842876888,
+    0.1034076438990227,
+    0.1046359490664932,
+    0.1058730063165681,
+    0.1071188216680533,
+    0.1083734006297428,
+    0.1096367481981100,
+    0.1109088688550422,
+    0.1121897665656167,
+    0.1134794447759207,
+    0.1147779064109143,
+    0.1160851538723372,
+    0.1174011890366591,
+    0.1187260132530751,
+    0.1200596273415457,
+    0.1214020315908810,
+    0.1227532257568719,
+    0.1241132090604651,
+    0.1254819801859856,
+    0.1268595372794049,
+    0.1282458779466558,
+    0.1296409992519942,
+    0.1310448977164081,
+    0.1324575693160745,
+    0.1338790094808633,
+    0.1353092130928902,
+    0.1367481744851168,
+    0.1381958874400010,
+    0.1396523451881945,
+    0.1411175404072910,
+    0.1425914652206223,
+    0.1440741111961058,
+    0.1455654693451402,
+    0.1470655301215526,
+    0.1485742834205956,
+    0.1500917185779945,
+    0.1516178243690463,
+    0.1531525890077689,
+    0.1546960001461024,
+    0.1562480448731608,
+    0.1578087097145364,
+    0.1593779806316558,
+    0.1609558430211876,
+    0.1625422817145027,
+    0.1641372809771871,
+    0.1657408245086070,
+    0.1673528954415270,
+    0.1689734763417811,
+    0.1706025492079969,
+    0.1722400954713725,
+    0.1738860959955082,
+    0.1755405310762898,
+    0.1772033804418275,
+    0.1788746232524467,
+    0.1805542381007349,
+    0.1822422030116404,
+    0.1839384954426268,
+    0.1856430922838810,
+    0.1873559698585756,
+    0.1890771039231862,
+    0.1908064696678625,
+    0.1925440417168546,
+    0.1942897941289937,
+    0.1960437003982277,
+    0.1978057334542116,
+    0.1995758656629525,
+    0.2013540688275098,
+    0.2031403141887507,
+    0.2049345724261595,
+    0.2067368136587033,
+    0.2085470074457521,
+    0.2103651227880538,
+    0.2121911281287646,
+    0.2140249913545346,
+    0.2158666797966480,
+    0.2177161602322188,
+    0.2195733988854414,
+    0.2214383614288963,
+    0.2233110129849106,
+    0.2251913181269740,
+    0.2270792408812093,
+    0.2289747447278976,
+    0.2308777926030592,
+    0.2327883469000885,
+    0.2347063694714437,
+    0.2366318216303919,
+    0.2385646641528076,
+    0.2405048572790267,
+    0.2424523607157545,
+    0.2444071336380283,
+    0.2463691346912334,
+    0.2483383219931741,
+    0.2503146531361985,
+    0.2522980851893767,
+    0.2542885747007335,
+    0.2562860776995335,
+    0.2582905496986215,
+    0.2603019456968142,
+    0.2623202201813464,
+    0.2643453271303700,
+    0.2663772200155053,
+    0.2684158518044454,
+    0.2704611749636135,
+    0.2725131414608710,
+    0.2745717027682799,
+    0.2766368098649151,
+    0.2787084132397296,
+    0.2807864628944707,
+    0.2828709083466482,
+    0.2849616986325523,
+    0.2870587823103237,
+    0.2891621074630737,
+    0.2912716217020546,
+    0.2933872721698803,
+    0.2955090055437973,
+    0.2976367680390041,
+    0.2997705054120213,
+    0.3019101629641097,
+    0.3040556855447379,
+    0.3062070175550981,
+    0.3083641029516701,
+    0.3105268852498334,
+    0.3126953075275265,
+    0.3148693124289546,
+    0.3170488421683428,
+    0.3192338385337370,
+    0.3214242428908514,
+    0.3236199961869606,
+    0.3258210389548392,
+    0.3280273113167459,
+    0.3302387529884521,
+    0.3324553032833160,
+    0.3346769011164010,
+    0.3369034850086373,
+    0.3391349930910280,
+    0.3413713631088974,
+    0.3436125324261830,
+    0.3458584380297697,
+    0.3481090165338656,
+    0.3503642041844199,
+    0.3526239368635820,
+    0.3548881500942010,
+    0.3571567790443668,
+    0.3594297585319891,
+    0.3617070230294185,
+    0.3639885066681048,
+    0.3662741432432950,
+    0.3685638662187693,
+    0.3708576087316147,
+    0.3731553035970366,
+    0.3754568833132069,
+    0.3777622800661488,
+    0.3800714257346570,
+    0.3823842518952546,
+    0.3847006898271841,
+    0.3870206705174334,
+    0.3893441246657958,
+    0.3916709826899639,
+    0.3940011747306560,
+    0.3963346306567764,
+    0.3986712800706062,
+    0.4010110523130271,
+    0.4033538764687756,
+    0.4056996813717284,
+    0.4080483956102172,
+    0.4103999475323736,
+    0.4127542652515031,
+    0.4151112766514873,
+    0.4174709093922143,
+    0.4198330909150365,
+    0.4221977484482556,
+    0.4245648090126334,
+    0.4269341994269293,
+    0.4293058463134616,
+    0.4316796761036958,
+    0.4340556150438547,
+    0.4364335892005536,
+    0.4388135244664580,
+    0.4411953465659639,
+    0.4435789810609000,
+    0.4459643533562509,
+    0.4483513887059016,
+    0.4507400122184019,
+    0.4531301488627497,
+    0.4555217234741947,
+    0.4579146607600593,
+    0.4603088853055777,
+    0.4627043215797521,
+    0.4651008939412254,
+    0.4674985266441709,
+    0.4698971438441951,
+    0.4722966696042580,
+    0.4746970279006055,
+    0.4770981426287164,
+    0.4794999376092619,
+    0.4819023365940778,
+    0.4843052632721476,
+    0.4867086412755978,
+    0.4891123941857028,
+    0.4915164455388997,
+    0.4939207188328126,
+    0.4963251375322855,
+    0.4987296250754225,
+    0.5011341048796359,
+    0.5035385003477012,
+    0.5059427348738168,
+    0.5083467318496706,
+    0.5107504146705106,
+    0.5131537067412193,
+    0.5155565314823923,
+    0.5179588123364193,
+    0.5203604727735667,
+    0.5227614362980630,
+    0.5251616264541841,
+    0.5275609668323384,
+    0.5299593810751532,
+    0.5323567928835578,
+    0.5347531260228663,
+    0.5371483043288580,
+    0.5395422517138538,
+    0.5419348921727899,
+    0.5443261497892862,
+    0.5467159487417104,
+    0.5491042133092364,
+    0.5514908678778958,
+    0.5538758369466227,
+    0.5562590451332913,
+    0.5586404171807443,
+    0.5610198779628133,
+    0.5633973524903286,
+    0.5657727659171199,
+    0.5681460435460047,
+    0.5705171108347663,
+    0.5728858934021188,
+    0.5752523170336598,
+    0.5776163076878088,
+    0.5799777915017323,
+    0.5823366947972535,
+    0.5846929440867458,
+    0.5870464660790119,
+    0.5893971876851449,
+    0.5917450360243719,
+    0.5940899384298793,
+    0.5964318224546208,
+    0.5987706158771039,
+    0.6011062467071583,
+    0.6034386431916822,
+    0.6057677338203681,
+    0.6080934473314057,
+    0.6104157127171639,
+    0.6127344592298474,
+    0.6150496163871310,
+    0.6173611139777690,
+    0.6196688820671789,
+    0.6219728510029997,
+    0.6242729514206247,
+    0.6265691142487051,
+    0.6288612707146283,
+    0.6311493523499663,
+    0.6334332909958958,
+    0.6357130188085891,
+    0.6379884682645743,
+    0.6402595721660647,
+    0.6425262636462578,
+    0.6447884761746012,
+    0.6470461435620266,
+    0.6492991999661505,
+    0.6515475798964411,
+    0.6537912182193508,
+    0.6560300501634142,
+    0.6582640113243098,
+    0.6604930376698862,
+    0.6627170655451516,
+    0.6649360316772256,
+    0.6671498731802533,
+    0.6693585275602818,
+    0.6715619327200959,
+    0.6737600269640164,
+    0.6759527490026566,
+    0.6781400379576392,
+    0.6803218333662715,
+    0.6824980751861787,
+    0.6846687037998949,
+    0.6868336600194123,
+    0.6889928850906855,
+    0.6911463206980928,
+    0.6932939089688525,
+    0.6954355924773949,
+    0.6975713142496884,
+    0.6997010177675195,
+    0.7018246469727265,
+    0.7039421462713862,
+    0.7060534605379528,
+    0.7081585351193496,
+    0.7102573158390105,
+    0.7123497490008750,
+    0.7144357813933307,
+    0.7165153602931092,
+    0.7185884334691287,
+    0.7206549491862871,
+    0.7227148562092042,
+    0.7247681038059106,
+    0.7268146417514855,
+    0.7288544203316418,
+    0.7308873903462577,
+    0.7329135031128549,
+    0.7349327104700221,
+    0.7369449647807855,
+    0.7389502189359237,
+    0.7409484263572271,
+    0.7429395410007016,
+    0.7449235173597176,
+    0.7469003104681008,
+    0.7488698759031670,
+    0.7508321697887005,
+    0.7527871487978728,
+    0.7547347701561059,
+    0.7566749916438754,
+    0.7586077715994560,
+    0.7605330689216074,
+    0.7624508430722016,
+    0.7643610540787891,
+    0.7662636625371070,
+    0.7681586296135255,
+    0.7700459170474343,
+    0.7719254871535672,
+    0.7737973028242671,
+    0.7756613275316875,
+    0.7775175253299340,
+    0.7793658608571425,
+    0.7812062993374951,
+    0.7830388065831744,
+    0.7848633489962533,
+    0.7866798935705233,
+    0.7884884078932579,
+    0.7902888601469138,
+    0.7920812191107668,
+    0.7938654541624850,
+    0.7956415352796368,
+    0.7974094330411343,
+    0.7991691186286133,
+    0.8009205638277465,
+    0.8026637410294932,
+    0.8043986232312831,
+    0.8061251840381346,
+    0.8078433976637077,
+    0.8095532389312917,
+    0.8112546832747255,
+    0.8129477067392539,
+    0.8146322859823164,
+    0.8163083982742698,
+    0.8179760214990457,
+    0.8196351341547393,
+    0.8212857153541345,
+    0.8229277448251595,
+    0.8245612029112778,
+    0.8261860705718113,
+    0.8278023293821971,
+    0.8294099615341773,
+    0.8310089498359212,
+    0.8325992777120815,
+    0.8341809292037831,
+    0.8357538889685445,
+    0.8373181422801330,
+    0.8388736750283521,
+    0.8404204737187619,
+    0.8419585254723335,
+    0.8434878180250348,
+    0.8450083397273509,
+    0.8465200795437368,
+    0.8480230270520029,
+    0.8495171724426350,
+    0.8510025065180464,
+    0.8524790206917633,
+    0.8539467069875448,
+    0.8554055580384357,
+    0.8568555670857525,
+    0.8582967279780043,
+    0.8597290351697464,
+    0.8611524837203691,
+    0.8625670692928198,
+    0.8639727881522599,
+    0.8653696371646555,
+    0.8667576137953045,
+    0.8681367161072958,
+    0.8695069427599065,
+    0.8708682930069319,
+    0.8722207666949527,
+    0.8735643642615368,
+    0.8748990867333771,
+    0.8762249357243662,
+    0.8775419134336067,
+    0.8788500226433579,
+    0.8801492667169208,
+    0.8814396495964587,
+    0.8827211758007560,
+    0.8839938504229149,
+    0.8852576791279895,
+    0.8865126681505587,
+    0.8877588242922386,
+    0.8889961549191320,
+    0.8902246679592184,
+    0.8914443718996848,
+    0.8926552757841945,
+    0.8938573892100969,
+    0.8950507223255798,
+    0.8962352858267605,
+    0.8974110909547198,
+    0.8985781494924783,
+    0.8997364737619142,
+    0.9008860766206249,
+    0.9020269714587307,
+    0.9031591721956235,
+    0.9042826932766591,
+    0.9053975496697941,
+    0.9065037568621681,
+    0.9076013308566311,
+    0.9086902881682180,
+    0.9097706458205682,
+    0.9108424213422940,
+    0.9119056327632955,
+    0.9129602986110235,
+    0.9140064379066919,
+    0.9150440701614393,
+    0.9160732153724396,
+    0.9170938940189634,
+    0.9181061270583908,
+    0.9191099359221748,
+    0.9201053425117579,
+    0.9210923691944400,
+    0.9220710387992010,
+    0.9230413746124764,
+    0.9240034003738882,
+    0.9249571402719298,
+    0.9259026189396085,
+    0.9268398614500427,
+    0.9277688933120170,
+    0.9286897404654957,
+    0.9296024292770939,
+    0.9305069865355076,
+    0.9314034394469048,
+    0.9322918156302762,
+    0.9331721431127471,
+    0.9340444503248519,
+    0.9349087660957711,
+    0.9357651196485313,
+    0.9366135405951697,
+    0.9374540589318637,
+    0.9382867050340261,
+    0.9391115096513655,
+    0.9399285039029165,
+    0.9407377192720349,
+    0.9415391876013639,
+    0.9423329410877687,
+    0.9431190122772415,
+    0.9438974340597782,
+    0.9446682396642262,
+    0.9454314626531054,
+    0.9461871369174033,
+    0.9469352966713429,
+    0.9476759764471278,
+    0.9484092110896616,
+    0.9491350357512457,
+    0.9498534858862532,
+    0.9505645972457831,
+    0.9512684058722927,
+    0.9519649480942105,
+    0.9526542605205314,
+    0.9533363800353921,
+    0.9540113437926313,
+    0.9546791892103320,
+    0.9553399539653500,
+    0.9559936759878265,
+    0.9566403934556893,
+    0.9572801447891388,
+    0.9579129686451244,
+    0.9585389039118085,
+    0.9591579897030224,
+    0.9597702653527108,
+    0.9603757704093711,
+    0.9609745446304828,
+    0.9615666279769324,
+    0.9621520606074324,
+    0.9627308828729358,
+    0.9633031353110477,
+    0.9638688586404335,
+    0.9644280937552258,
+    0.9649808817194311,
+    0.9655272637613366,
+    0.9660672812679171,
+    0.9666009757792454,
+    0.9671283889829055,
+    0.9676495627084089,
+    0.9681645389216160,
+    0.9686733597191652,
+    0.9691760673229058,
+    0.9696727040743406,
+    0.9701633124290767,
+    0.9706479349512860,
+    0.9711266143081750,
+    0.9715993932644684,
+    0.9720663146769026,
+    0.9725274214887337,
+    0.9729827567242596,
+    0.9734323634833574,
+    0.9738762849360358,
+    0.9743145643170059,
+    0.9747472449202687,
+    0.9751743700937215,
+    0.9755959832337850,
+    0.9760121277800496,
+    0.9764228472099433,
+    0.9768281850334235,
+    0.9772281847876897,
+    0.9776228900319223,
+    0.9780123443420448,
+    0.9783965913055132,
+    0.9787756745161313,
+    0.9791496375688939,
+    0.9795185240548578,
+    0.9798823775560431,
+    0.9802412416403639,
+    0.9805951598565897,
+    0.9809441757293399,
+    0.9812883327541090,
+    0.9816276743923267,
+    0.9819622440664515,
+    0.9822920851550995,
+    0.9826172409882086,
+    0.9829377548422400,
+    0.9832536699354163,
+    0.9835650294229984,
+    0.9838718763926001,
+    0.9841742538595437,
+    0.9844722047622547,
+    0.9847657719576983,
+    0.9850549982168574,
+    0.9853399262202529,
+    0.9856205985535073,
+    0.9858970577029519,
+    0.9861693460512790,
+    0.9864375058732389,
+    0.9867015793313820,
+    0.9869616084718489,
+    0.9872176352202061,
+    0.9874697013773301,
+    0.9877178486153397,
+    0.9879621184735767,
+    0.9882025523546365,
+    0.9884391915204485,
+    0.9886720770884069,
+    0.9889012500275530,
+    0.9891267511548089,
+    0.9893486211312621,
+    0.9895669004585049,
+    0.9897816294750255,
+    0.9899928483526520,
+    0.9902005970930525,
+    0.9904049155242876,
+    0.9906058432974180,
+    0.9908034198831690,
+    0.9909976845686489,
+    0.9911886764541239,
+    0.9913764344498495,
+    0.9915609972729590,
+    0.9917424034444086,
+    0.9919206912859797,
+    0.9920958989173397,
+    0.9922680642531603,
+    0.9924372250002933,
+    0.9926034186550070,
+    0.9927666825002789,
+    0.9929270536031491,
+    0.9930845688121325,
+    0.9932392647546895,
+    0.9933911778347579,
+    0.9935403442303433,
+    0.9936867998911693,
+    0.9938305805363887,
+    0.9939717216523539,
+    0.9941102584904481,
+    0.9942462260649764,
+    0.9943796591511174,
+    0.9945105922829353,
+    0.9946390597514524,
+    0.9947650956027824,
+    0.9948887336363228,
+    0.9950100074030103,
+    0.9951289502036336,
+    0.9952455950872091,
+    0.9953599748494155,
+    0.9954721220310890,
+    0.9955820689167787,
+    0.9956898475333619,
+    0.9957954896487196,
+    0.9958990267704713,
+    0.9960004901447701,
+    0.9960999107551559,
+    0.9961973193214694,
+    0.9962927462988245,
+    0.9963862218766388,
+    0.9964777759777242,
+    0.9965674382574342,
+    0.9966552381028704,
+    0.9967412046321465,
+    0.9968253666937095,
+    0.9969077528657186,
+    0.9969883914554805,
+    0.9970673104989413,
+    0.9971445377602348,
+    0.9972201007312871,
+    0.9972940266314749,
+    0.9973663424073412,
+    0.9974370747323638,
+    0.9975062500067785,
+    0.9975738943574574,
+    0.9976400336378379,
+    0.9977046934279079,
+    0.9977678990342401,
+    0.9978296754900812,
+    0.9978900475554902,
+    0.9979490397175296,
+    0.9980066761905056,
+    0.9980629809162593,
+    0.9981179775645063,
+    0.9981716895332257,
+    0.9982241399490979,
+    0.9982753516679893,
+    0.9983253472754841,
+    0.9983741490874634,
+    0.9984217791507299,
+    0.9984682592436778,
+    0.9985136108770075,
+    0.9985578552944850,
+    0.9986010134737439,
+    0.9986431061271304,
+    0.9986841537025921,
+    0.9987241763846056,
+    0.9987631940951476,
+    0.9988012264947044,
+    0.9988382929833222,
+    0.9988744127016956,
+    0.9989096045322947,
+    0.9989438871005292,
+    0.9989772787759494,
+    0.9990097976734847,
+    0.9990414616547146,
+    0.9990722883291779,
+    0.9991022950557125,
+    0.9991314989438310,
+    0.9991599168551279,
+    0.9991875654047181,
+    0.9992144609627068,
+    0.9992406196556911,
+    0.9992660573682882,
+    0.9992907897446957,
+    0.9993148321902777,
+    0.9993381998731797,
+    0.9993609077259696,
+    0.9993829704473038,
+    0.9994044025036201,
+    0.9994252181308537,
+    0.9994454313361775,
+    0.9994650558997651,
+    0.9994841053765757,
+    0.9995025930981609,
+    0.9995205321744921,
+    0.9995379354958073,
+    0.9995548157344778,
+    0.9995711853468930,
+    0.9995870565753632,
+    0.9996024414500382,
+    0.9996173517908444,
+    0.9996317992094352,
+    0.9996457951111574,
+    0.9996593506970310,
+    0.9996724769657434,
+    0.9996851847156547,
+    0.9996974845468164,
+    0.9997093868630000,
+    0.9997209018737374,
+    0.9997320395963699,
+    0.9997428098581069,
+    0.9997532222980933,
+    0.9997632863694836,
+    0.9997730113415246,
+    0.9997824063016426,
+    0.9997914801575380,
+    0.9998002416392840,
+    0.9998086993014300,
+    0.9998168615251084,
+    0.9998247365201450,
+    0.9998323323271717,
+    0.9998396568197407,
+    0.9998467177064404,
+    0.9998535225330116,
+    0.9998600786844637,
+    0.9998663933871905,
+    0.9998724737110845,
+    0.9998783265716498,
+    0.9998839587321121,
+    0.9998893768055266,
+    0.9998945872568815,
+    0.9998995964051983,
+    0.9999044104256269,
+    0.9999090353515359,
+    0.9999134770765971,
+    0.9999177413568642,
+    0.9999218338128448,
+    0.9999257599315647,
+    0.9999295250686255,
+    0.9999331344502529,
+    0.9999365931753376,
+    0.9999399062174669,
+    0.9999430784269460,
+    0.9999461145328103,
+    0.9999490191448277,
+    0.9999517967554878,
+    0.9999544517419835,
+    0.9999569883681778,
+    0.9999594107865607,
+    0.9999617230401926,
+    0.9999639290646355,
+    0.9999660326898712,
+    0.9999680376422052,
+    0.9999699475461585,
+    0.9999717659263435,
+    0.9999734962093266,
+    0.9999751417254756,
+    0.9999767057107922,
+    0.9999781913087290,
+    0.9999796015719915,
+    0.9999809394643231,
+    0.9999822078622751,
+    0.9999834095569596,
+    0.9999845472557860,
+    0.9999856235841805,
+    0.9999866410872889,
+    0.9999876022316609,
+    0.9999885094069193,
+    0.9999893649274085,
+    0.9999901710338274,
+    0.9999909298948430,
+    0.9999916436086862,
+    0.9999923142047299,
+    0.9999929436450469,
+    0.9999935338259505,
+    0.9999940865795161,
+    0.9999946036750835,
+    0.9999950868207405,
+    0.9999955376647868,
+    0.9999959577971798,
+    0.9999963487509599,
+    0.9999967120036571,
+    0.9999970489786785,
+    0.9999973610466748,
+    0.9999976495268890,
+    0.9999979156884846,
+    0.9999981607518545,
+    0.9999983858899099,
+    0.9999985922293493,
+    0.9999987808519092,
+    0.9999989527955938,
+    0.9999991090558848,
+    0.9999992505869332,
+    0.9999993783027293,
+    0.9999994930782556,
+    0.9999995957506171,
+    0.9999996871201549,
+    0.9999997679515386,
+    0.9999998389748399,
+    0.9999999008865869,
+    0.9999999543507984
+};
+
+real_t kbd_short_128[] =
+{
+    4.3795702929468881e-005,
+    0.00011867384265436617,
+    0.0002307165763996192,
+    0.00038947282760568383,
+    0.00060581272288302553,
+    0.00089199695169487453,
+    0.0012617254423430522,
+    0.0017301724373162003,
+    0.0023140071937421476,
+    0.0030313989666022221,
+    0.0039020049735530842,
+    0.0049469401815512024,
+    0.0061887279335368318,
+    0.0076512306364647726,
+    0.0093595599562652423,
+    0.011339966208377799,
+    0.013619706891715299,
+    0.016226894586323766,
+    0.019190324717288168,
+    0.022539283975960878,
+    0.026303340480472455,
+    0.030512117046644357,
+    0.03519504922365594,
+    0.040381130021856941,
+    0.046098643518702249,
+    0.052374889768730587,
+    0.059235903660769147,
+    0.066706170556282418,
+    0.074808341703430481,
+    0.083562952548726227,
+    0.092988147159339674,
+    0.1030994120216919,
+    0.11390932249409955,
+    0.12542730516149531,
+    0.13765941926783826,
+    0.15060816028651081,
+    0.16427228853114245,
+    0.17864668550988483,
+    0.19372224048676889,
+    0.20948576943658073,
+    0.22591996826744942,
+    0.24300340184133981,
+    0.26071052995068139,
+    0.27901177101369551,
+    0.29787360383626599,
+    0.3172587073594233,
+    0.33712613787396362,
+    0.35743154274286698,
+    0.37812740923363009,
+    0.39916334663203618,
+    0.42048639939189658,
+    0.4420413886774246,
+    0.4637712792815169,
+    0.4856175685594023,
+    0.50752069370766872,
+    0.52942045344797806,
+    0.55125643994680196,
+    0.57296847662071559,
+    0.59449705734411495,
+    0.61578378249506627,
+    0.63677178724712891,
+    0.65740615754163356,
+    0.67763432925662526,
+    0.69740646622548552,
+    0.71667581294953808,
+    0.73539901809352737,
+    0.75353642514900732,
+    0.77105232699609816,
+    0.78791518148597028,
+    0.80409778560147072,
+    0.81957740622770781,
+    0.83433586607383625,
+    0.84835958382689225,
+    0.86163956818294229,
+    0.87417136598406997,
+    0.88595496528524853,
+    0.89699465477567619,
+    0.90729884157670959,
+    0.91687983002436779,
+    0.92575356460899649,
+    0.93393934077779084,
+    0.94145948779657318,
+    0.94833902830402828,
+    0.95460531956280026,
+    0.96028768170574896,
+    0.96541701848104766,
+    0.97002543610646474,
+    0.97414586584250062,
+    0.97781169577969584,
+    0.98105641710392333,
+    0.98391328975491177,
+    0.98641503193166202,
+    0.98859353733226141,
+    0.99047962335771556,
+    0.9921028127769449,
+    0.99349115056397752,
+    0.99467105680259038,
+    0.9956672157341897,
+    0.99650250022834352,
+    0.99719793020823266,
+    0.99777266288955657,
+    0.99824401211201486,
+    0.99862749357391212,
+    0.99893689243401962,
+    0.99918434952623147,
+    0.99938046234161726,
+    0.99953439696357238,
+    0.99965400728430465,
+    0.99974595807027455,
+    0.99981584876278362,
+    0.99986833527824281,
+    0.99990724749057802,
+    0.99993570051598468,
+    0.99995619835942084,
+    0.99997072890647543,
+    0.9999808496399144,
+    0.99998776381655818,
+    0.99999238714961569,
+    0.99999540529959718,
+    0.99999732268176988,
+    0.99999850325054862,
+    0.99999920402413744,
+    0.9999996021706401,
+    0.99999981649545566,
+    0.99999992415545547,
+    0.99999997338493041,
+    0.99999999295825959,
+    0.99999999904096815
+};
+
+real_t kbd_short_120[] =
+{
+    0.0000452320086910,
+    0.0001274564692111,
+    0.0002529398385345,
+    0.0004335140496648,
+    0.0006827100966952,
+    0.0010158708222246,
+    0.0014502162869659,
+    0.0020048865156264,
+    0.0027009618393178,
+    0.0035614590925043,
+    0.0046113018122711,
+    0.0058772627936484,
+    0.0073878776584103,
+    0.0091733284512589,
+    0.0112652966728373,
+    0.0136967855861945,
+    0.0165019120857793,
+    0.0197156688892217,
+    0.0233736582950619,
+    0.0275117992367496,
+    0.0321660098468534,
+    0.0373718682174417,
+    0.0431642544948834,
+    0.0495769778717676,
+    0.0566423924273392,
+    0.0643910061132260,
+    0.0728510874761729,
+    0.0820482749475221,
+    0.0920051937045235,
+    0.1027410852163450,
+    0.1142714546239370,
+    0.1266077410648368,
+    0.1397570159398145,
+    0.1537217139274270,
+    0.1684994012857075,
+    0.1840825856392944,
+    0.2004585710384133,
+    0.2176093615976121,
+    0.2355116164824983,
+    0.2541366584185075,
+    0.2734505372545160,
+    0.2934141494343369,
+    0.3139834135200387,
+    0.3351095011824163,
+    0.3567391223361566,
+    0.3788148623608774,
+    0.4012755686250732,
+    0.4240567828288110,
+    0.4470912150133537,
+    0.4703092544619664,
+    0.4936395121456694,
+    0.5170093888596962,
+    0.5403456627591340,
+    0.5635750896430154,
+    0.5866250090612892,
+    0.6094239491338723,
+    0.6319022228794100,
+    0.6539925088563087,
+    0.6756304090216887,
+    0.6967549769155277,
+    0.7173092095766250,
+    0.7372404969921184,
+    0.7565010233699827,
+    0.7750481150999984,
+    0.7928445309277697,
+    0.8098586906021583,
+    0.8260648390616000,
+    0.8414431440907889,
+    0.8559797262966709,
+    0.8696666212110165,
+    0.8825016743142358,
+    0.8944883707784486,
+    0.9056356027326216,
+    0.9159573778427816,
+    0.9254724739583072,
+    0.9342040454819434,
+    0.9421791879559176,
+    0.9494284680976784,
+    0.9559854271440150,
+    0.9618860658493898,
+    0.9671683198119525,
+    0.9718715339497299,
+    0.9760359449042233,
+    0.9797021798981759,
+    0.9829107801140203,
+    0.9857017559923277,
+    0.9881141809867999,
+    0.9901858292742826,
+    0.9919528617340944,
+    0.9934495632180476,
+    0.9947081327749199,
+    0.9957585271195989,
+    0.9966283562984427,
+    0.9973428292485683,
+    0.9979247458259197,
+    0.9983945309245774,
+    0.9987703055583410,
+    0.9990679892449266,
+    0.9993014277313617,
+    0.9994825400228521,
+    0.9996214788122335,
+    0.9997267987294857,
+    0.9998056273097539,
+    0.9998638341781910,
+    0.9999061946325793,
+    0.9999365445321382,
+    0.9999579241373735,
+    0.9999727092594598,
+    0.9999827287418790,
+    0.9999893678912771,
+    0.9999936579844555,
+    0.9999963523959187,
+    0.9999979902130101,
+    0.9999989484358076,
+    0.9999994840031031,
+    0.9999997669534347,
+    0.9999999060327799,
+    0.9999999680107184,
+    0.9999999918774242,
+    0.9999999989770326
+};
+
+#else
+
+real_t kbd_long_1024[] =
+{
+    0x132C5,
+    0x1C2DF,
+    0x23D4C,
+    0x2AEA1,
+    0x31B8E,
+    0x38665,
+    0x3F07E,
+    0x45AB3,
+    0x4C598,
+    0x53198,
+    0x59F03,
+    0x60E18,
+    0x67F08,
+    0x6F1FB,
+    0x76714,
+    0x7DE70,
+    0x85828,
+    0x8D455,
+    0x95308,
+    0x9D456,
+    0xA5850,
+    0xADF05,
+    0xB6884,
+    0xBF4DB,
+    0xC8419,
+    0xD1649,
+    0xDAB78,
+    0xE43B3,
+    0xEDF05,
+    0xF7D79,
+    0x101F1B,
+    0x10C3F5,
+    0x116C13,
+    0x12177F,
+    0x12C644,
+    0x13786C,
+    0x142E01,
+    0x14E70D,
+    0x15A39B,
+    0x1663B5,
+    0x172764,
+    0x17EEB2,
+    0x18B9AA,
+    0x198856,
+    0x1A5ABE,
+    0x1B30ED,
+    0x1C0AED,
+    0x1CE8C7,
+    0x1DCA84,
+    0x1EB030,
+    0x1F99D2,
+    0x208776,
+    0x217924,
+    0x226EE6,
+    0x2368C6,
+    0x2466CD,
+    0x256905,
+    0x266F77,
+    0x277A2D,
+    0x288930,
+    0x299C8A,
+    0x2AB445,
+    0x2BD069,
+    0x2CF101,
+    0x2E1616,
+    0x2F3FB1,
+    0x306DDC,
+    0x31A0A0,
+    0x32D806,
+    0x341419,
+    0x3554E1,
+    0x369A68,
+    0x37E4B7,
+    0x3933D7,
+    0x3A87D3,
+    0x3BE0B3,
+    0x3D3E80,
+    0x3EA144,
+    0x400908,
+    0x4175D6,
+    0x42E7B6,
+    0x445EB3,
+    0x45DAD4,
+    0x475C24,
+    0x48E2AB,
+    0x4A6E73,
+    0x4BFF84,
+    0x4D95E9,
+    0x4F31AA,
+    0x50D2CF,
+    0x527963,
+    0x54256E,
+    0x55D6F9,
+    0x578E0D,
+    0x594AB4,
+    0x5B0CF5,
+    0x5CD4DA,
+    0x5EA26C,
+    0x6075B3,
+    0x624EB9,
+    0x642D86,
+    0x661223,
+    0x67FC98,
+    0x69ECEE,
+    0x6BE32E,
+    0x6DDF61,
+    0x6FE18F,
+    0x71E9C0,
+    0x73F7FD,
+    0x760C4F,
+    0x7826BD,
+    0x7A4751,
+    0x7C6E12,
+    0x7E9B0A,
+    0x80CE3F,
+    0x8307BA,
+    0x854784,
+    0x878DA5,
+    0x89DA24,
+    0x8C2D09,
+    0x8E865E,
+    0x90E628,
+    0x934C71,
+    0x95B940,
+    0x982C9D,
+    0x9AA690,
+    0x9D2720,
+    0x9FAE55,
+    0xA23C37,
+    0xA4D0CD,
+    0xA76C1E,
+    0xAA0E31,
+    0xACB70F,
+    0xAF66BF,
+    0xB21D47,
+    0xB4DAAF,
+    0xB79EFD,
+    0xBA6A3A,
+    0xBD3C6C,
+    0xC01599,
+    0xC2F5C9,
+    0xC5DD03,
+    0xC8CB4D,
+    0xCBC0AD,
+    0xCEBD2B,
+    0xD1C0CD,
+    0xD4CB99,
+    0xD7DD96,
+    0xDAF6C9,
+    0xDE173A,
+    0xE13EEF,
+    0xE46DED,
+    0xE7A43B,
+    0xEAE1DE,
+    0xEE26DC,
+    0xF1733C,
+    0xF4C702,
+    0xF82235,
+    0xFB84DA,
+    0xFEEEF7,
+    0x1026090,
+    0x105D9AC,
+    0x1095A50,
+    0x10CE280,
+    0x1107242,
+    0x114099A,
+    0x117A88E,
+    0x11B4F24,
+    0x11EFD5E,
+    0x122B342,
+    0x12670D4,
+    0x12A361A,
+    0x12E0318,
+    0x131D7D0,
+    0x135B44A,
+    0x1399886,
+    0x13D848C,
+    0x141785E,
+    0x14573FE,
+    0x1497774,
+    0x14D82C2,
+    0x15195E8,
+    0x155B0F0,
+    0x159D3D8,
+    0x15DFEA6,
+    0x162315C,
+    0x1666BFE,
+    0x16AAE8E,
+    0x16EF910,
+    0x1734B86,
+    0x177A5F4,
+    0x17C085A,
+    0x18072BE,
+    0x184E520,
+    0x1895F84,
+    0x18DE1EA,
+    0x1926C56,
+    0x196FEC8,
+    0x19B9946,
+    0x1A03BCE,
+    0x1A4E662,
+    0x1A99904,
+    0x1AE53B8,
+    0x1B3167C,
+    0x1B7E152,
+    0x1BCB43E,
+    0x1C18F3E,
+    0x1C67254,
+    0x1CB5D80,
+    0x1D050C4,
+    0x1D54C20,
+    0x1DA4F96,
+    0x1DF5B24,
+    0x1E46ECC,
+    0x1E98A8C,
+    0x1EEAE68,
+    0x1F3DA5E,
+    0x1F90E6C,
+    0x1FE4A94,
+    0x2038ED8,
+    0x208DB30,
+    0x20E2FA4,
+    0x2138C2C,
+    0x218F0D0,
+    0x21E5D84,
+    0x223D250,
+    0x2294F30,
+    0x22ED420,
+    0x2346124,
+    0x239F634,
+    0x23F9354,
+    0x2453880,
+    0x24AE5B8,
+    0x2509AF8,
+    0x2565840,
+    0x25C1D88,
+    0x261EAD4,
+    0x267C024,
+    0x26D9D6C,
+    0x27382B0,
+    0x2796FEC,
+    0x27F651C,
+    0x2856240,
+    0x28B6754,
+    0x2917450,
+    0x2978938,
+    0x29DA604,
+    0x2A3CAB0,
+    0x2A9F738,
+    0x2B02BA0,
+    0x2B667D8,
+    0x2BCABE4,
+    0x2C2F7C0,
+    0x2C94B64,
+    0x2CFA6CC,
+    0x2D609F8,
+    0x2DC74DC,
+    0x2E2E77C,
+    0x2E961CC,
+    0x2EFE3C8,
+    0x2F66D6C,
+    0x2FCFEB8,
+    0x30397A0,
+    0x30A381C,
+    0x310E030,
+    0x3178FD0,
+    0x31E46F8,
+    0x32505A0,
+    0x32BCBC4,
+    0x3329960,
+    0x3396E68,
+    0x3404AD8,
+    0x3472EAC,
+    0x34E19DC,
+    0x3550C60,
+    0x35C0634,
+    0x363074C,
+    0x36A0FA8,
+    0x3711F38,
+    0x37835FC,
+    0x37F53EC,
+    0x38678FC,
+    0x38DA528,
+    0x394D868,
+    0x39C12B4,
+    0x3A35400,
+    0x3AA9C48,
+    0x3B1EB84,
+    0x3B941AC,
+    0x3C09EB4,
+    0x3C80298,
+    0x3CF6D4C,
+    0x3D6DEC8,
+    0x3DE5704,
+    0x3E5D5F4,
+    0x3ED5B94,
+    0x3F4E7D8,
+    0x3FC7AB4,
+    0x4041428,
+    0x40BB418,
+    0x4135A90,
+    0x41B0778,
+    0x422BAD0,
+    0x42A7488,
+    0x4323490,
+    0x439FAE8,
+    0x441C780,
+    0x4499A50,
+    0x4517350,
+    0x4595270,
+    0x46137A8,
+    0x46922F0,
+    0x4711438,
+    0x4790B78,
+    0x48108A0,
+    0x4890BB0,
+    0x4911490,
+    0x4992340,
+    0x4A137A8,
+    0x4A951C8,
+    0x4B17188,
+    0x4B996E8,
+    0x4C1C1D8,
+    0x4C9F250,
+    0x4D22838,
+    0x4DA6390,
+    0x4E2A448,
+    0x4EAEA50,
+    0x4F335A0,
+    0x4FB8628,
+    0x503DBE0,
+    0x50C36B0,
+    0x51496A0,
+    0x51CFB90,
+    0x5256578,
+    0x52DD450,
+    0x5364808,
+    0x53EC090,
+    0x5473DD8,
+    0x54FBFE0,
+    0x5584690,
+    0x560D1D8,
+    0x56961B8,
+    0x571F610,
+    0x57A8EE0,
+    0x5832C18,
+    0x58BCDA0,
+    0x5947378,
+    0x59D1D88,
+    0x5A5CBC0,
+    0x5AE7E20,
+    0x5B73488,
+    0x5BFEEF8,
+    0x5C8AD58,
+    0x5D16FA0,
+    0x5DA35B8,
+    0x5E2FFA0,
+    0x5EBCD40,
+    0x5F49E80,
+    0x5FD7368,
+    0x6064BD0,
+    0x60F27C0,
+    0x6180718,
+    0x620E9D0,
+    0x629CFD8,
+    0x632B920,
+    0x63BA598,
+    0x6449530,
+    0x64D87D8,
+    0x6567D88,
+    0x65F7628,
+    0x66871B0,
+    0x6717008,
+    0x67A7128,
+    0x68374F8,
+    0x68C7B68,
+    0x6958478,
+    0x69E9000,
+    0x6A79E08,
+    0x6B0AE70,
+    0x6B9C128,
+    0x6C2D628,
+    0x6CBED60,
+    0x6D506B8,
+    0x6DE2220,
+    0x6E73F90,
+    0x6F05EF8,
+    0x6F98040,
+    0x702A358,
+    0x70BC830,
+    0x714EEC0,
+    0x71E16E8,
+    0x72740A8,
+    0x7306BE8,
+    0x7399898,
+    0x742C6A0,
+    0x74BF5F8,
+    0x7552698,
+    0x75E5858,
+    0x7678B38,
+    0x770BF28,
+    0x779F410,
+    0x78329E0,
+    0x78C6090,
+    0x7959800,
+    0x79ED028,
+    0x7A80900,
+    0x7B14260,
+    0x7BA7C50,
+    0x7C3B6B0,
+    0x7CCF170,
+    0x7D62C88,
+    0x7DF67E0,
+    0x7E8A368,
+    0x7F1DF10,
+    0x7FB1AC8,
+    0x8045670,
+    0x80D9210,
+    0x816CD90,
+    0x82008E0,
+    0x82943E0,
+    0x8327E80,
+    0x83BB8C0,
+    0x844F290,
+    0x84E2BD0,
+    0x8576470,
+    0x8609C60,
+    0x869D3A0,
+    0x8730A10,
+    0x87C3FA0,
+    0x8857440,
+    0x88EA7E0,
+    0x897DA60,
+    0x8A10BD0,
+    0x8AA3C10,
+    0x8B36B00,
+    0x8BC98A0,
+    0x8C5C4E0,
+    0x8CEEFB0,
+    0x8D818F0,
+    0x8E14090,
+    0x8EA6690,
+    0x8F38AE0,
+    0x8FCAD60,
+    0x905CE10,
+    0x90EECC0,
+    0x9180990,
+    0x9212440,
+    0x92A3CE0,
+    0x9335350,
+    0x93C6780,
+    0x9457960,
+    0x94E88F0,
+    0x9579610,
+    0x960A0B0,
+    0x969A8C0,
+    0x972AE30,
+    0x97BB0F0,
+    0x984B100,
+    0x98DAE30,
+    0x996A890,
+    0x99FA000,
+    0x9A89470,
+    0x9B185D0,
+    0x9BA7410,
+    0x9C35F30,
+    0x9CC4700,
+    0x9D52B90,
+    0x9DE0CC0,
+    0x9E6EA90,
+    0x9EFC4E0,
+    0x9F89BA0,
+    0xA016ED0,
+    0xA0A3E50,
+    0xA130A10,
+    0xA1BD210,
+    0xA249640,
+    0xA2D5690,
+    0xA3612E0,
+    0xA3ECB30,
+    0xA477F70,
+    0xA502F90,
+    0xA58DB80,
+    0xA618330,
+    0xA6A26A0,
+    0xA72C5A0,
+    0xA7B6050,
+    0xA83F670,
+    0xA8C8820,
+    0xA951530,
+    0xA9D9DA0,
+    0xAA62170,
+    0xAAEA070,
+    0xAB71AB0,
+    0xABF9010,
+    0xAC80090,
+    0xAD06C10,
+    0xAD8D2A0,
+    0xAE13410,
+    0xAE99070,
+    0xAF1E7A0,
+    0xAFA39A0,
+    0xB028650,
+    0xB0ACDC0,
+    0xB130FD0,
+    0xB1B4C70,
+    0xB2383A0,
+    0xB2BB540,
+    0xB33E160,
+    0xB3C07D0,
+    0xB4428B0,
+    0xB4C43D0,
+    0xB545930,
+    0xB5C68C0,
+    0xB647270,
+    0xB6C7650,
+    0xB747430,
+    0xB7C6C20,
+    0xB845E00,
+    0xB8C49D0,
+    0xB942F90,
+    0xB9C0F10,
+    0xBA3E870,
+    0xBABBB80,
+    0xBB38850,
+    0xBBB4ED0,
+    0xBC30EF0,
+    0xBCAC8A0,
+    0xBD27BE0,
+    0xBDA28A0,
+    0xBE1CED0,
+    0xBE96E80,
+    0xBF10780,
+    0xBF899E0,
+    0xC0025A0,
+    0xC07AA90,
+    0xC0F28D0,
+    0xC16A030,
+    0xC1E10C0,
+    0xC257A80,
+    0xC2CDD40,
+    0xC343920,
+    0xC3B8E00,
+    0xC42DBE0,
+    0xC4A22B0,
+    0xC516270,
+    0xC589B20,
+    0xC5FCCA0,
+    0xC66F6F0,
+    0xC6E1A10,
+    0xC7535F0,
+    0xC7C4A90,
+    0xC8357F0,
+    0xC8A5DF0,
+    0xC915C90,
+    0xC9853D0,
+    0xC9F43B0,
+    0xCA62C20,
+    0xCAD0D20,
+    0xCB3E690,
+    0xCBAB880,
+    0xCC182F0,
+    0xCC845D0,
+    0xCCF0110,
+    0xCD5B4B0,
+    0xCDC60B0,
+    0xCE30510,
+    0xCE9A1C0,
+    0xCF036B0,
+    0xCF6C3F0,
+    0xCFD4970,
+    0xD03C720,
+    0xD0A3D10,
+    0xD10AB30,
+    0xD171180,
+    0xD1D6FF0,
+    0xD23C680,
+    0xD2A1530,
+    0xD305C00,
+    0xD369AF0,
+    0xD3CD1E0,
+    0xD4300E0,
+    0xD4927F0,
+    0xD4F4710,
+    0xD555E20,
+    0xD5B6D40,
+    0xD617450,
+    0xD677360,
+    0xD6D6A60,
+    0xD735950,
+    0xD794030,
+    0xD7F1F00,
+    0xD84F5C0,
+    0xD8AC460,
+    0xD908AF0,
+    0xD964960,
+    0xD9BFFB0,
+    0xDA1ADE0,
+    0xDA753E0,
+    0xDACF1D0,
+    0xDB28790,
+    0xDB81530,
+    0xDBD9AA0,
+    0xDC317F0,
+    0xDC88D10,
+    0xDCDFA00,
+    0xDD35ED0,
+    0xDD8BB70,
+    0xDDE0FE0,
+    0xDE35C20,
+    0xDE8A030,
+    0xDEDDC10,
+    0xDF30FD0,
+    0xDF83B50,
+    0xDFD5EB0,
+    0xE0279E0,
+    0xE078CE0,
+    0xE0C97B0,
+    0xE119A60,
+    0xE1694E0,
+    0xE1B8730,
+    0xE207150,
+    0xE255350,
+    0xE2A2D30,
+    0xE2EFEE0,
+    0xE33C870,
+    0xE3889E0,
+    0xE3D4330,
+    0xE41F460,
+    0xE469D70,
+    0xE4B3E60,
+    0xE4FD740,
+    0xE546810,
+    0xE58F0C0,
+    0xE5D7160,
+    0xE61EA00,
+    0xE665A80,
+    0xE6AC300,
+    0xE6F2380,
+    0xE737BF0,
+    0xE77CC70,
+    0xE7C14E0,
+    0xE805560,
+    0xE848DF0,
+    0xE88BE90,
+    0xE8CE740,
+    0xE910800,
+    0xE9520E0,
+    0xE9931D0,
+    0xE9D3AF0,
+    0xEA13C30,
+    0xEA535A0,
+    0xEA92740,
+    0xEAD1110,
+    0xEB0F310,
+    0xEB4CD50,
+    0xEB89FE0,
+    0xEBC6AB0,
+    0xEC02DC0,
+    0xEC3E930,
+    0xEC79CF0,
+    0xECB4900,
+    0xECEED80,
+    0xED28A60,
+    0xED61FB0,
+    0xED9AD70,
+    0xEDD33B0,
+    0xEE0B260,
+    0xEE429A0,
+    0xEE79960,
+    0xEEB01B0,
+    0xEEE6290,
+    0xEF1BC20,
+    0xEF50E40,
+    0xEF85910,
+    0xEFB9C90,
+    0xEFED8C0,
+    0xF020DB0,
+    0xF053B60,
+    0xF0861E0,
+    0xF0B8130,
+    0xF0E9960,
+    0xF11AA60,
+    0xF14B450,
+    0xF17B730,
+    0xF1AB300,
+    0xF1DA7C0,
+    0xF209590,
+    0xF237C70,
+    0xF265C60,
+    0xF293570,
+    0xF2C0790,
+    0xF2ED2F0,
+    0xF319770,
+    0xF345530,
+    0xF370C30,
+    0xF39BC80,
+    0xF3C6620,
+    0xF3F0910,
+    0xF41A570,
+    0xF443B30,
+    0xF46CA60,
+    0xF495310,
+    0xF4BD550,
+    0xF4E5110,
+    0xF50C660,
+    0xF533550,
+    0xF559DE0,
+    0xF580030,
+    0xF5A5C20,
+    0xF5CB1E0,
+    0xF5F0160,
+    0xF614AB0,
+    0xF638DE0,
+    0xF65CAF0,
+    0xF6801F0,
+    0xF6A32E0,
+    0xF6C5DD0,
+    0xF6E82C0,
+    0xF70A1C0,
+    0xF72BAE0,
+    0xF74CE20,
+    0xF76DB90,
+    0xF78E330,
+    0xF7AE510,
+    0xF7CE130,
+    0xF7ED7A0,
+    0xF80C870,
+    0xF82B3A0,
+    0xF849940,
+    0xF867950,
+    0xF8853E0,
+    0xF8A2900,
+    0xF8BF8B0,
+    0xF8DC2F0,
+    0xF8F87E0,
+    0xF914780,
+    0xF9301D0,
+    0xF94B6F0,
+    0xF9666D0,
+    0xF981180,
+    0xF99B720,
+    0xF9B57A0,
+    0xF9CF310,
+    0xF9E8970,
+    0xFA01AE0,
+    0xFA1A760,
+    0xFA32EF0,
+    0xFA4B1B0,
+    0xFA62F90,
+    0xFA7A8A0,
+    0xFA91D00,
+    0xFAA8CA0,
+    0xFABF790,
+    0xFAD5DE0,
+    0xFAEBF90,
+    0xFB01CB0,
+    0xFB17540,
+    0xFB2C960,
+    0xFB41900,
+    0xFB56440,
+    0xFB6AB20,
+    0xFB7EDA0,
+    0xFB92BE0,
+    0xFBA65D0,
+    0xFBB9B80,
+    0xFBCCD00,
+    0xFBDFA60,
+    0xFBF23A0,
+    0xFC048D0,
+    0xFC169F0,
+    0xFC28710,
+    0xFC3A030,
+    0xFC4B570,
+    0xFC5C6C0,
+    0xFC6D430,
+    0xFC7DDD0,
+    0xFC8E3B0,
+    0xFC9E5C0,
+    0xFCAE430,
+    0xFCBDEE0,
+    0xFCCD5F0,
+    0xFCDC960,
+    0xFCEB950,
+    0xFCFA5A0,
+    0xFD08E80,
+    0xFD173E0,
+    0xFD255E0,
+    0xFD33470,
+    0xFD40FA0,
+    0xFD4E790,
+    0xFD5BC30,
+    0xFD68D80,
+    0xFD75BB0,
+    0xFD826A0,
+    0xFD8EE70,
+    0xFD9B320,
+    0xFDA74C0,
+    0xFDB3350,
+    0xFDBEEE0,
+    0xFDCA770,
+    0xFDD5D10,
+    0xFDE0FC0,
+    0xFDEBFA0,
+    0xFDF6C90,
+    0xFE016C0,
+    0xFE0BE30,
+    0xFE162D0,
+    0xFE204C0,
+    0xFE2A400,
+    0xFE34090,
+    0xFE3DA90,
+    0xFE471F0,
+    0xFE506C0,
+    0xFE59910,
+    0xFE628E0,
+    0xFE6B630,
+    0xFE74120,
+    0xFE7C9A0,
+    0xFE84FC0,
+    0xFE8D390,
+    0xFE95500,
+    0xFE9D440,
+    0xFEA5130,
+    0xFEACBE0,
+    0xFEB4460,
+    0xFEBBAC0,
+    0xFEC2EF0,
+    0xFECA110,
+    0xFED1120,
+    0xFED7F10,
+    0xFEDEB00,
+    0xFEE5500,
+    0xFEEBCF0,
+    0xFEF2300,
+    0xFEF8720,
+    0xFEFE960,
+    0xFF049B0,
+    0xFF0A840,
+    0xFF10500,
+    0xFF15FF0,
+    0xFF1B920,
+    0xFF21090,
+    0xFF26650,
+    0xFF2BA60,
+    0xFF30CC0,
+    0xFF35D90,
+    0xFF3ACB0,
+    0xFF3FA50,
+    0xFF44650,
+    0xFF490D0,
+    0xFF4D9C0,
+    0xFF52140,
+    0xFF56740,
+    0xFF5ABD0,
+    0xFF5EF00,
+    0xFF630C0,
+    0xFF67120,
+    0xFF6B020,
+    0xFF6EDD0,
+    0xFF72A30,
+    0xFF76550,
+    0xFF79F20,
+    0xFF7D7B0,
+    0xFF80F10,
+    0xFF84530,
+    0xFF87A30,
+    0xFF8ADF0,
+    0xFF8E0A0,
+    0xFF91220,
+    0xFF94280,
+    0xFF971E0,
+    0xFF9A020,
+    0xFF9CD50,
+    0xFF9F980,
+    0xFFA24A0,
+    0xFFA4ED0,
+    0xFFA7800,
+    0xFFAA030,
+    0xFFAC780,
+    0xFFAEDE0,
+    0xFFB1350,
+    0xFFB37E0,
+    0xFFB5B90,
+    0xFFB7E60,
+    0xFFBA050,
+    0xFFBC180,
+    0xFFBE1D0,
+    0xFFC0160,
+    0xFFC2020,
+    0xFFC3E20,
+    0xFFC5B60,
+    0xFFC77E0,
+    0xFFC93B0,
+    0xFFCAEC0,
+    0xFFCC930,
+    0xFFCE2E0,
+    0xFFCFBF0,
+    0xFFD1450,
+    0xFFD2C10,
+    0xFFD4340,
+    0xFFD59C0,
+    0xFFD6FB0,
+    0xFFD8500,
+    0xFFD99C0,
+    0xFFDAE00,
+    0xFFDC1A0,
+    0xFFDD4C0,
+    0xFFDE750,
+    0xFFDF970,
+    0xFFE0B00,
+    0xFFE1C10,
+    0xFFE2CA0,
+    0xFFE3CC0,
+    0xFFE4C70,
+    0xFFE5BA0,
+    0xFFE6A70,
+    0xFFE78C0,
+    0xFFE86B0,
+    0xFFE9430,
+    0xFFEA150,
+    0xFFEAE10,
+    0xFFEBA60,
+    0xFFEC650,
+    0xFFED1F0,
+    0xFFEDD30,
+    0xFFEE820,
+    0xFFEF2B0,
+    0xFFEFCE0,
+    0xFFF06D0,
+    0xFFF1070,
+    0xFFF19B0,
+    0xFFF22B0,
+    0xFFF2B70,
+    0xFFF33D0,
+    0xFFF3C00,
+    0xFFF43E0,
+    0xFFF4B80,
+    0xFFF52E0,
+    0xFFF5A00,
+    0xFFF60E0,
+    0xFFF6780,
+    0xFFF6DF0,
+    0xFFF7420,
+    0xFFF7A10,
+    0xFFF7FE0,
+    0xFFF8570,
+    0xFFF8AC0,
+    0xFFF8FF0,
+    0xFFF94F0,
+    0xFFF99C0,
+    0xFFF9E60,
+    0xFFFA2D0,
+    0xFFFA720,
+    0xFFFAB40,
+    0xFFFAF30,
+    0xFFFB310,
+    0xFFFB6B0,
+    0xFFFBA40,
+    0xFFFBDA0,
+    0xFFFC0E0,
+    0xFFFC400,
+    0xFFFC700,
+    0xFFFC9E0,
+    0xFFFCCA0,
+    0xFFFCF50,
+    0xFFFD1D0,
+    0xFFFD440,
+    0xFFFD690,
+    0xFFFD8D0,
+    0xFFFDAF0,
+    0xFFFDD00,
+    0xFFFDEF0,
+    0xFFFE0D0,
+    0xFFFE290,
+    0xFFFE440,
+    0xFFFE5E0,
+    0xFFFE770,
+    0xFFFE8E0,
+    0xFFFEA50,
+    0xFFFEBA0,
+    0xFFFECE0,
+    0xFFFEE20,
+    0xFFFEF40,
+    0xFFFF050,
+    0xFFFF160,
+    0xFFFF260,
+    0xFFFF340,
+    0xFFFF420,
+    0xFFFF500,
+    0xFFFF5C0,
+    0xFFFF680,
+    0xFFFF730,
+    0xFFFF7E0,
+    0xFFFF880,
+    0xFFFF910,
+    0xFFFF9A0,
+    0xFFFFA30,
+    0xFFFFAA0,
+    0xFFFFB20,
+    0xFFFFB90,
+    0xFFFFBF0,
+    0xFFFFC50,
+    0xFFFFCA0,
+    0xFFFFD00,
+    0xFFFFD50,
+    0xFFFFD90,
+    0xFFFFDD0,
+    0xFFFFE10,
+    0xFFFFE50,
+    0xFFFFE80,
+    0xFFFFEB0,
+    0xFFFFEE0,
+    0xFFFFF00,
+    0xFFFFF30,
+    0xFFFFF50,
+    0xFFFFF70,
+    0xFFFFF80,
+    0xFFFFFA0,
+    0xFFFFFB0,
+    0xFFFFFC0,
+    0xFFFFFD0,
+    0xFFFFFE0,
+    0xFFFFFF0
+};
+
+real_t kbd_long_960[] =
+{
+    0x13CD5,
+    0x1D2DA,
+    0x2530F,
+    0x2CA56,
+    0x33D79,
+    0x3AED7,
+    0x41FCF,
+    0x4913D,
+    0x503BC,
+    0x577B7,
+    0x5ED81,
+    0x6655B,
+    0x6DF77,
+    0x75C00,
+    0x7DB1B,
+    0x85CE5,
+    0x8E17C,
+    0x968F7,
+    0x9F36B,
+    0xA80EF,
+    0xB1194,
+    0xBA56C,
+    0xC3C88,
+    0xCD6F8,
+    0xD74CB,
+    0xE1610,
+    0xEBAD6,
+    0xF632A,
+    0x100F1A,
+    0x10BEB4,
+    0x117203,
+    0x122916,
+    0x12E3F9,
+    0x13A2B8,
+    0x146561,
+    0x152BFF,
+    0x15F69E,
+    0x16C54B,
+    0x179812,
+    0x186EFF,
+    0x194A1D,
+    0x1A2979,
+    0x1B0D1E,
+    0x1BF519,
+    0x1CE175,
+    0x1DD23E,
+    0x1EC77F,
+    0x1FC145,
+    0x20BF9B,
+    0x21C28C,
+    0x22CA24,
+    0x23D670,
+    0x24E77A,
+    0x25FD4E,
+    0x2717F7,
+    0x283782,
+    0x295BF9,
+    0x2A8569,
+    0x2BB3DD,
+    0x2CE760,
+    0x2E1FFD,
+    0x2F5DC1,
+    0x30A0B7,
+    0x31E8EA,
+    0x333666,
+    0x348935,
+    0x35E164,
+    0x373EFE,
+    0x38A20E,
+    0x3A0AA0,
+    0x3B78BE,
+    0x3CEC75,
+    0x3E65CF,
+    0x3FE4D8,
+    0x41699B,
+    0x42F424,
+    0x44847D,
+    0x461AB1,
+    0x47B6CC,
+    0x4958D9,
+    0x4B00E4,
+    0x4CAEF6,
+    0x4E631C,
+    0x501D60,
+    0x51DDCD,
+    0x53A46E,
+    0x55714E,
+    0x574479,
+    0x591DF8,
+    0x5AFDD7,
+    0x5CE420,
+    0x5ED0DE,
+    0x60C41D,
+    0x62BDE6,
+    0x64BE44,
+    0x66C542,
+    0x68D2EB,
+    0x6AE748,
+    0x6D0265,
+    0x6F244B,
+    0x714D05,
+    0x737C9E,
+    0x75B320,
+    0x77F094,
+    0x7A3506,
+    0x7C807E,
+    0x7ED308,
+    0x812CAD,
+    0x838D77,
+    0x85F570,
+    0x8864A2,
+    0x8ADB16,
+    0x8D58D7,
+    0x8FDDEE,
+    0x926A64,
+    0x94FE44,
+    0x979995,
+    0x9A3C63,
+    0x9CE6B6,
+    0x9F9897,
+    0xA25210,
+    0xA5132A,
+    0xA7DBED,
+    0xAAAC63,
+    0xAD8495,
+    0xB0648B,
+    0xB34C4E,
+    0xB63BE7,
+    0xB9335E,
+    0xBC32BC,
+    0xBF3A09,
+    0xC2494E,
+    0xC56093,
+    0xC87FE0,
+    0xCBA73D,
+    0xCED6B2,
+    0xD20E47,
+    0xD54E04,
+    0xD895F0,
+    0xDBE613,
+    0xDF3E76,
+    0xE29F1E,
+    0xE60814,
+    0xE9795F,
+    0xECF305,
+    0xF0750F,
+    0xF3FF82,
+    0xF79267,
+    0xFB2DC3,
+    0xFED19E,
+    0x1027DFC,
+    0x10632E8,
+    0x109F064,
+    0x10DB678,
+    0x111852A,
+    0x1155C82,
+    0x1193C82,
+    0x11D2532,
+    0x121169A,
+    0x12510BA,
+    0x129139E,
+    0x12D1F46,
+    0x13133BA,
+    0x13550FE,
+    0x1397718,
+    0x13DA60C,
+    0x141DDE0,
+    0x1461E98,
+    0x14A6838,
+    0x14EBAC6,
+    0x1531644,
+    0x1577AB8,
+    0x15BE826,
+    0x1605E92,
+    0x164DE00,
+    0x1696672,
+    0x16DF7EC,
+    0x1729274,
+    0x177360A,
+    0x17BE2B4,
+    0x1809874,
+    0x185574C,
+    0x18A1F40,
+    0x18EF052,
+    0x193CA84,
+    0x198ADDA,
+    0x19D9A56,
+    0x1A28FFA,
+    0x1A78EC6,
+    0x1AC96BE,
+    0x1B1A7E4,
+    0x1B6C23A,
+    0x1BBE5C0,
+    0x1C11276,
+    0x1C64860,
+    0x1CB8780,
+    0x1D0CFD2,
+    0x1D6215C,
+    0x1DB7C1C,
+    0x1E0E012,
+    0x1E64D40,
+    0x1EBC3A4,
+    0x1F14342,
+    0x1F6CC16,
+    0x1FC5E22,
+    0x201F964,
+    0x2079DDC,
+    0x20D4B8C,
+    0x2130270,
+    0x218C288,
+    0x21E8BD4,
+    0x2245E50,
+    0x22A3A00,
+    0x2301EDC,
+    0x2360CE4,
+    0x23C0418,
+    0x2420478,
+    0x2480DFC,
+    0x24E20A8,
+    0x2543C74,
+    0x25A6164,
+    0x2608F6C,
+    0x266C694,
+    0x26D06D0,
+    0x2735020,
+    0x279A284,
+    0x27FFDF4,
+    0x286626C,
+    0x28CCFEC,
+    0x2934670,
+    0x299C5F0,
+    0x2A04E68,
+    0x2A6DFD8,
+    0x2AD7A3C,
+    0x2B41D88,
+    0x2BAC9BC,
+    0x2C17ED4,
+    0x2C83CC8,
+    0x2CF0398,
+    0x2D5D338,
+    0x2DCABA4,
+    0x2E38CD8,
+    0x2EA76CC,
+    0x2F1697C,
+    0x2F864E4,
+    0x2FF68F8,
+    0x30675B8,
+    0x30D8B14,
+    0x314A910,
+    0x31BCF9C,
+    0x322FEB8,
+    0x32A3658,
+    0x3317678,
+    0x338BF0C,
+    0x3401010,
+    0x3476978,
+    0x34ECB44,
+    0x3563564,
+    0x35DA7D0,
+    0x3652288,
+    0x36CA578,
+    0x37430A0,
+    0x37BC3F0,
+    0x3835F64,
+    0x38B02F4,
+    0x392AE90,
+    0x39A6238,
+    0x3A21DD8,
+    0x3A9E16C,
+    0x3B1ACE8,
+    0x3B98048,
+    0x3C15B78,
+    0x3C93E74,
+    0x3D12930,
+    0x3D91BA0,
+    0x3E115BC,
+    0x3E91774,
+    0x3F120C4,
+    0x3F9319C,
+    0x40149F0,
+    0x40969B8,
+    0x41190E8,
+    0x419BF70,
+    0x421F548,
+    0x42A3260,
+    0x43276B0,
+    0x43AC228,
+    0x44314C0,
+    0x44B6E68,
+    0x453CF18,
+    0x45C36C0,
+    0x464A550,
+    0x46D1AB8,
+    0x47596F0,
+    0x47E19F0,
+    0x486A3A8,
+    0x48F3400,
+    0x497CAF0,
+    0x4A06870,
+    0x4A90C70,
+    0x4B1B6D8,
+    0x4BA67A8,
+    0x4C31EC8,
+    0x4CBDC28,
+    0x4D49FC0,
+    0x4DD6980,
+    0x4E63958,
+    0x4EF0F30,
+    0x4F7EB08,
+    0x500CCC8,
+    0x509B468,
+    0x512A1D0,
+    0x51B94F0,
+    0x5248DC0,
+    0x52D8C28,
+    0x5369020,
+    0x53F9990,
+    0x548A870,
+    0x551BCA8,
+    0x55AD628,
+    0x563F4E8,
+    0x56D18D0,
+    0x57641D0,
+    0x57F6FD8,
+    0x588A2D8,
+    0x591DAC0,
+    0x59B1780,
+    0x5A45900,
+    0x5AD9F30,
+    0x5B6EA08,
+    0x5C03968,
+    0x5C98D50,
+    0x5D2E5A0,
+    0x5DC4248,
+    0x5E5A338,
+    0x5EF0860,
+    0x5F871B0,
+    0x601DF10,
+    0x60B5078,
+    0x614C5C8,
+    0x61E3EF0,
+    0x627BBE8,
+    0x6313C98,
+    0x63AC0E8,
+    0x64448C8,
+    0x64DD430,
+    0x65762F8,
+    0x660F520,
+    0x66A8A90,
+    0x6742330,
+    0x67DBEF0,
+    0x6875DC0,
+    0x690FF88,
+    0x69AA438,
+    0x6A44BB8,
+    0x6ADF5F8,
+    0x6B7A2E8,
+    0x6C15270,
+    0x6CB0478,
+    0x6D4B8F8,
+    0x6DE6FD0,
+    0x6E828F0,
+    0x6F1E450,
+    0x6FBA1C8,
+    0x7056158,
+    0x70F22D8,
+    0x718E648,
+    0x722AB88,
+    0x72C7280,
+    0x7363B28,
+    0x7400568,
+    0x749D128,
+    0x7539E50,
+    0x75D6CD8,
+    0x7673CA8,
+    0x7710DA0,
+    0x77ADFC0,
+    0x784B2E0,
+    0x78E86F0,
+    0x7985BE8,
+    0x7A231A8,
+    0x7AC0820,
+    0x7B5DF38,
+    0x7BFB6E0,
+    0x7C98F00,
+    0x7D36788,
+    0x7DD4058,
+    0x7E71968,
+    0x7F0F2A0,
+    0x7FACBE8,
+    0x804A530,
+    0x80E7E60,
+    0x8185770,
+    0x8223030,
+    0x82C08A0,
+    0x835E0B0,
+    0x83FB830,
+    0x8498F30,
+    0x8536580,
+    0x85D3B20,
+    0x8670FE0,
+    0x870E3C0,
+    0x87AB6B0,
+    0x8848890,
+    0x88E5950,
+    0x89828D0,
+    0x8A1F710,
+    0x8ABC3F0,
+    0x8B58F50,
+    0x8BF5940,
+    0x8C92180,
+    0x8D2E810,
+    0x8DCACF0,
+    0x8E66FE0,
+    0x8F030F0,
+    0x8F9F000,
+    0x903ACF0,
+    0x90D67C0,
+    0x9172050,
+    0x920D690,
+    0x92A8A60,
+    0x9343BC0,
+    0x93DEAA0,
+    0x94796D0,
+    0x9514050,
+    0x95AE700,
+    0x9648AD0,
+    0x96E2BC0,
+    0x977C9A0,
+    0x9816470,
+    0x98AFC20,
+    0x9949080,
+    0x99E2190,
+    0x9A7AF40,
+    0x9B13980,
+    0x9BAC030,
+    0x9C44340,
+    0x9CDC2A0,
+    0x9D73E40,
+    0x9E0B610,
+    0x9EA29F0,
+    0x9F399D0,
+    0x9FD05A0,
+    0xA066D50,
+    0xA0FD0D0,
+    0xA193010,
+    0xA228AF0,
+    0xA2BE170,
+    0xA353360,
+    0xA3E80D0,
+    0xA47C9A0,
+    0xA510DC0,
+    0xA5A4D10,
+    0xA638790,
+    0xA6CBD20,
+    0xA75EDC0,
+    0xA7F1960,
+    0xA883FE0,
+    0xA916120,
+    0xA9A7D30,
+    0xAA393F0,
+    0xAACA560,
+    0xAB5B150,
+    0xABEB7C0,
+    0xAC7B8A0,
+    0xAD0B3D0,
+    0xAD9A960,
+    0xAE29920,
+    0xAEB8320,
+    0xAF46730,
+    0xAFD4550,
+    0xB061D60,
+    0xB0EEF70,
+    0xB17BB60,
+    0xB208110,
+    0xB294090,
+    0xB31F9B0,
+    0xB3AAC80,
+    0xB4358D0,
+    0xB4BFEB0,
+    0xB549E10,
+    0xB5D36C0,
+    0xB65C8E0,
+    0xB6E5430,
+    0xB76D8D0,
+    0xB7F5690,
+    0xB87CD80,
+    0xB903D70,
+    0xB98A670,
+    0xBA10860,
+    0xBA96340,
+    0xBB1B700,
+    0xBBA0380,
+    0xBC248D0,
+    0xBCA86D0,
+    0xBD2BD70,
+    0xBDAECC0,
+    0xBE31490,
+    0xBEB34F0,
+    0xBF34DC0,
+    0xBFB5F00,
+    0xC036890,
+    0xC0B6A90,
+    0xC1364C0,
+    0xC1B5740,
+    0xC2341E0,
+    0xC2B24C0,
+    0xC32FFA0,
+    0xC3AD2B0,
+    0xC429DB0,
+    0xC4A60B0,
+    0xC521BB0,
+    0xC59CE90,
+    0xC617940,
+    0xC691BE0,
+    0xC70B630,
+    0xC784850,
+    0xC7FD230,
+    0xC8753B0,
+    0xC8ECCE0,
+    0xC963DA0,
+    0xC9DA600,
+    0xCA505F0,
+    0xCAC5D60,
+    0xCB3AC40,
+    0xCBAF2A0,
+    0xCC23060,
+    0xCC96590,
+    0xCD09210,
+    0xCD7B5F0,
+    0xCDED110,
+    0xCE5E380,
+    0xCECED30,
+    0xCF3EE20,
+    0xCFAE630,
+    0xD01D570,
+    0xD08BBE0,
+    0xD0F9960,
+    0xD166E00,
+    0xD1D39C0,
+    0xD23FC80,
+    0xD2AB650,
+    0xD316710,
+    0xD380EE0,
+    0xD3EADA0,
+    0xD454360,
+    0xD4BD010,
+    0xD5253A0,
+    0xD58CE20,
+    0xD5F3F80,
+    0xD65A7B0,
+    0xD6C06D0,
+    0xD725CC0,
+    0xD78A980,
+    0xD7EED10,
+    0xD852770,
+    0xD8B58A0,
+    0xD918090,
+    0xD979F50,
+    0xD9DB4D0,
+    0xDA3C110,
+    0xDA9C400,
+    0xDAFBDC0,
+    0xDB5AE30,
+    0xDBB9560,
+    0xDC17340,
+    0xDC747D0,
+    0xDCD1320,
+    0xDD2D520,
+    0xDD88DD0,
+    0xDDE3D40,
+    0xDE3E350,
+    0xDE98020,
+    0xDEF1390,
+    0xDF49DC0,
+    0xDFA1EA0,
+    0xDFF9630,
+    0xE050470,
+    0xE0A6960,
+    0xE0FC510,
+    0xE151760,
+    0xE1A6070,
+    0xE1FA040,
+    0xE24D6C0,
+    0xE2A03F0,
+    0xE2F27F0,
+    0xE3442A0,
+    0xE395410,
+    0xE3E5C40,
+    0xE435B30,
+    0xE4850E0,
+    0xE4D3D60,
+    0xE5220B0,
+    0xE56FAD0,
+    0xE5BCBC0,
+    0xE609380,
+    0xE655210,
+    0xE6A0780,
+    0xE6EB3D0,
+    0xE735710,
+    0xE77F120,
+    0xE7C8220,
+    0xE810A10,
+    0xE858900,
+    0xE89FED0,
+    0xE8E6BB0,
+    0xE92CF80,
+    0xE972A60,
+    0xE9B7C40,
+    0xE9FC530,
+    0xEA40540,
+    0xEA83C60,
+    0xEAC6AA0,
+    0xEB09010,
+    0xEB4ACA0,
+    0xEB8C060,
+    0xEBCCB60,
+    0xEC0CD90,
+    0xEC4C710,
+    0xEC8B7D0,
+    0xECC9FE0,
+    0xED07F40,
+    0xED45610,
+    0xED82430,
+    0xEDBE9C0,
+    0xEDFA6D0,
+    0xEE35B50,
+    0xEE70750,
+    0xEEAAAD0,
+    0xEEE45F0,
+    0xEF1D890,
+    0xEF562E0,
+    0xEF8E4E0,
+    0xEFC5E80,
+    0xEFFCFD0,
+    0xF0338F0,
+    0xF0699D0,
+    0xF09F280,
+    0xF0D4300,
+    0xF108B60,
+    0xF13CBB0,
+    0xF1703F0,
+    0xF1A3430,
+    0xF1D5C70,
+    0xF207CC0,
+    0xF239520,
+    0xF26A5A0,
+    0xF29AE50,
+    0xF2CAF20,
+    0xF2FA840,
+    0xF329990,
+    0xF358340,
+    0xF386540,
+    0xF3B3FA0,
+    0xF3E1260,
+    0xF40DDA0,
+    0xF43A160,
+    0xF465DB0,
+    0xF491290,
+    0xF4BC000,
+    0xF4E6630,
+    0xF510500,
+    0xF539C90,
+    0xF562CE0,
+    0xF58B610,
+    0xF5B3810,
+    0xF5DB300,
+    0xF6026E0,
+    0xF6293B0,
+    0xF64F990,
+    0xF675880,
+    0xF69B090,
+    0xF6C01C0,
+    0xF6E4C20,
+    0xF708FD0,
+    0xF72CCB0,
+    0xF7502F0,
+    0xF773290,
+    0xF795BA0,
+    0xF7B7E20,
+    0xF7D9A20,
+    0xF7FAFA0,
+    0xF81BEC0,
+    0xF83C780,
+    0xF85C9F0,
+    0xF87C620,
+    0xF89BC10,
+    0xF8BABD0,
+    0xF8D9570,
+    0xF8F78F0,
+    0xF915660,
+    0xF932DD0,
+    0xF94FF50,
+    0xF96CAE0,
+    0xF989090,
+    0xF9A5070,
+    0xF9C0A90,
+    0xF9DBEE0,
+    0xF9F6D90,
+    0xFA11690,
+    0xFA2BA00,
+    0xFA457E0,
+    0xFA5F040,
+    0xFA78330,
+    0xFA910B0,
+    0xFAA98D0,
+    0xFAC1BA0,
+    0xFAD9920,
+    0xFAF1170,
+    0xFB08490,
+    0xFB1F280,
+    0xFB35B60,
+    0xFB4BF40,
+    0xFB61E10,
+    0xFB777E0,
+    0xFB8CCE0,
+    0xFBA1CF0,
+    0xFBB6830,
+    0xFBCAEB0,
+    0xFBDF070,
+    0xFBF2D80,
+    0xFC065F0,
+    0xFC199C0,
+    0xFC2C900,
+    0xFC3F3D0,
+    0xFC51A20,
+    0xFC63C00,
+    0xFC75980,
+    0xFC872B0,
+    0xFC987A0,
+    0xFCA9840,
+    0xFCBA4C0,
+    0xFCCAD00,
+    0xFCDB140,
+    0xFCEB160,
+    0xFCFAD80,
+    0xFD0A5A0,
+    0xFD199D0,
+    0xFD28A20,
+    0xFD37690,
+    0xFD45F40,
+    0xFD54420,
+    0xFD62540,
+    0xFD702C0,
+    0xFD7DC90,
+    0xFD8B2D0,
+    0xFD98580,
+    0xFDA54B0,
+    0xFDB2060,
+    0xFDBE8B0,
+    0xFDCAD90,
+    0xFDD6F10,
+    0xFDE2D50,
+    0xFDEE840,
+    0xFDF9FF0,
+    0xFE05480,
+    0xFE105E0,
+    0xFE1B420,
+    0xFE25F50,
+    0xFE30780,
+    0xFE3ACA0,
+    0xFE44EE0,
+    0xFE4EE20,
+    0xFE58A90,
+    0xFE62420,
+    0xFE6BAE0,
+    0xFE74EE0,
+    0xFE7E030,
+    0xFE86EC0,
+    0xFE8FAA0,
+    0xFE983F0,
+    0xFEA0AA0,
+    0xFEA8ED0,
+    0xFEB1070,
+    0xFEB8FA0,
+    0xFEC0C50,
+    0xFEC86A0,
+    0xFECFE90,
+    0xFED7430,
+    0xFEDE770,
+    0xFEE5880,
+    0xFEEC740,
+    0xFEF33D0,
+    0xFEF9E30,
+    0xFF00670,
+    0xFF06CA0,
+    0xFF0D0B0,
+    0xFF132B0,
+    0xFF192B0,
+    0xFF1F0B0,
+    0xFF24CC0,
+    0xFF2A6E0,
+    0xFF2FF20,
+    0xFF35590,
+    0xFF3AA20,
+    0xFF3FCE0,
+    0xFF44DD0,
+    0xFF49D10,
+    0xFF4EA90,
+    0xFF53670,
+    0xFF58090,
+    0xFF5C920,
+    0xFF61010,
+    0xFF65560,
+    0xFF69930,
+    0xFF6DB80,
+    0xFF71C40,
+    0xFF75B90,
+    0xFF79970,
+    0xFF7D5E0,
+    0xFF810E0,
+    0xFF84A90,
+    0xFF882E0,
+    0xFF8B9E0,
+    0xFF8EF90,
+    0xFF92400,
+    0xFF95730,
+    0xFF98920,
+    0xFF9B9E0,
+    0xFF9E970,
+    0xFFA17D0,
+    0xFFA4510,
+    0xFFA7130,
+    0xFFA9C40,
+    0xFFAC630,
+    0xFFAEF20,
+    0xFFB1700,
+    0xFFB3DE0,
+    0xFFB63C0,
+    0xFFB88A0,
+    0xFFBAC90,
+    0xFFBCFA0,
+    0xFFBF1B0,
+    0xFFC12E0,
+    0xFFC3340,
+    0xFFC52B0,
+    0xFFC7150,
+    0xFFC8F20,
+    0xFFCAC20,
+    0xFFCC850,
+    0xFFCE3C0,
+    0xFFCFE60,
+    0xFFD1850,
+    0xFFD3190,
+    0xFFD4A10,
+    0xFFD61E0,
+    0xFFD7900,
+    0xFFD8F80,
+    0xFFDA550,
+    0xFFDBA80,
+    0xFFDCF10,
+    0xFFDE310,
+    0xFFDF670,
+    0xFFE0940,
+    0xFFE1B80,
+    0xFFE2D30,
+    0xFFE3E60,
+    0xFFE4F00,
+    0xFFE5F20,
+    0xFFE6EC0,
+    0xFFE7DF0,
+    0xFFE8C90,
+    0xFFE9AD0,
+    0xFFEA890,
+    0xFFEB5E0,
+    0xFFEC2D0,
+    0xFFECF40,
+    0xFFEDB60,
+    0xFFEE700,
+    0xFFEF250,
+    0xFFEFD40,
+    0xFFF07D0,
+    0xFFF1200,
+    0xFFF1BD0,
+    0xFFF2560,
+    0xFFF2E90,
+    0xFFF3770,
+    0xFFF3FF0,
+    0xFFF4840,
+    0xFFF5030,
+    0xFFF57E0,
+    0xFFF5F40,
+    0xFFF6670,
+    0xFFF6D50,
+    0xFFF73E0,
+    0xFFF7A40,
+    0xFFF8070,
+    0xFFF8650,
+    0xFFF8C00,
+    0xFFF9170,
+    0xFFF96C0,
+    0xFFF9BC0,
+    0xFFFA0A0,
+    0xFFFA540,
+    0xFFFA9C0,
+    0xFFFAE10,
+    0xFFFB220,
+    0xFFFB620,
+    0xFFFB9E0,
+    0xFFFBD80,
+    0xFFFC100,
+    0xFFFC450,
+    0xFFFC780,
+    0xFFFCA90,
+    0xFFFCD70,
+    0xFFFD040,
+    0xFFFD2E0,
+    0xFFFD570,
+    0xFFFD7E0,
+    0xFFFDA30,
+    0xFFFDC60,
+    0xFFFDE80,
+    0xFFFE080,
+    0xFFFE260,
+    0xFFFE430,
+    0xFFFE5F0,
+    0xFFFE790,
+    0xFFFE920,
+    0xFFFEAA0,
+    0xFFFEC00,
+    0xFFFED50,
+    0xFFFEEA0,
+    0xFFFEFD0,
+    0xFFFF0F0,
+    0xFFFF200,
+    0xFFFF300,
+    0xFFFF3F0,
+    0xFFFF4E0,
+    0xFFFF5B0,
+    0xFFFF680,
+    0xFFFF740,
+    0xFFFF7F0,
+    0xFFFF8A0,
+    0xFFFF940,
+    0xFFFF9D0,
+    0xFFFFA50,
+    0xFFFFAE0,
+    0xFFFFB50,
+    0xFFFFBC0,
+    0xFFFFC30,
+    0xFFFFC90,
+    0xFFFFCE0,
+    0xFFFFD40,
+    0xFFFFD90,
+    0xFFFFDD0,
+    0xFFFFE10,
+    0xFFFFE50,
+    0xFFFFE80,
+    0xFFFFEC0,
+    0xFFFFEE0,
+    0xFFFFF10,
+    0xFFFFF30,
+    0xFFFFF60,
+    0xFFFFF70,
+    0xFFFFF90,
+    0xFFFFFB0,
+    0xFFFFFC0,
+    0xFFFFFD0,
+    0xFFFFFE0,
+    0xFFFFFF0
+};
+
+real_t kbd_short_128[] =
+{
+    0x2DEC,
+    0x7C70,
+    0xF1EC,
+    0x19864,
+    0x27B3D,
+    0x3A753,
+    0x52B03,
+    0x71637,
+    0x97A69,
+    0xC6AA6,
+    0xFFB8C,
+    0x14433E,
+    0x19595A,
+    0x1F56E5,
+    0x265635,
+    0x2E72D1,
+    0x37C94C,
+    0x427722,
+    0x4E9A83,
+    0x5C5227,
+    0x6BBD0D,
+    0x7CFA46,
+    0x9028AF,
+    0xA566AF,
+    0xBCD1EE,
+    0xD6870D,
+    0xF2A159,
+    0x1113A7E,
+    0x1326A3C,
+    0x156461C,
+    0x17CE124,
+    0x1A64B92,
+    0x1D29294,
+    0x201C010,
+    0x233DA5C,
+    0x268E41C,
+    0x2A0DBFC,
+    0x2DBBCA0,
+    0x3197C7C,
+    0x35A0DC0,
+    0x39D5E40,
+    0x3E35788,
+    0x42BDED0,
+    0x476D508,
+    0x4C41720,
+    0x5137DE0,
+    0x564DE60,
+    0x5B80A20,
+    0x60CCF50,
+    0x662F918,
+    0x6BA4FF0,
+    0x7129A00,
+    0x76B9B70,
+    0x7C516F0,
+    0x81ECE00,
+    0x8788190,
+    0x8D1F240,
+    0x92AE100,
+    0x9830F60,
+    0x9DA4020,
+    0xA3037A0,
+    0xA84BC50,
+    0xAD79720,
+    0xB2893B0,
+    0xB778110,
+    0xBC431C0,
+    0xC0E7C30,
+    0xC563AF0,
+    0xC9B4CF0,
+    0xCDD95A0,
+    0xD1CFD30,
+    0xD597090,
+    0xD92E180,
+    0xDC94690,
+    0xDFC9B20,
+    0xE2CDF20,
+    0xE5A1710,
+    0xE844BD0,
+    0xEAB8A30,
+    0xECFE300,
+    0xEF16A60,
+    0xF1037D0,
+    0xF2C6590,
+    0xF461040,
+    0xF5D56A0,
+    0xF725920,
+    0xF853960,
+    0xF961A00,
+    0xFA51DE0,
+    0xFB26830,
+    0xFBE1BE0,
+    0xFC85B20,
+    0xFD14770,
+    0xFD90130,
+    0xFDFA730,
+    0xFE55700,
+    0xFEA2C30,
+    0xFEE40C0,
+    0xFF1ACA0,
+    0xFF485D0,
+    0xFF6E070,
+    0xFF8CEB0,
+    0xFFA60D0,
+    0xFFBA540,
+    0xFFCA8C0,
+    0xFFD7660,
+    0xFFE17C0,
+    0xFFE9530,
+    0xFFEF5A0,
+    0xFFF3EE0,
+    0xFFF75F0,
+    0xFFF9EC0,
+    0xFFFBC90,
+    0xFFFD210,
+    0xFFFE150,
+    0xFFFEBF0,
+    0xFFFF330,
+    0xFFFF800,
+    0xFFFFB30,
+    0xFFFFD30,
+    0xFFFFE70,
+    0xFFFFF30,
+    0xFFFFF90,
+    0xFFFFFD0,
+    0xFFFFFF0,
+    0x10000000,
+    0x10000000,
+    0x10000000
+};
+
+real_t kbd_short_120[] =
+{
+    0x2F6D,
+    0x85A5,
+    0x1093A,
+    0x1C692,
+    0x2CBDF,
+    0x42937,
+    0x5F0A9,
+    0x83646,
+    0xB1029,
+    0xE9675,
+    0x12E34C,
+    0x1812C1,
+    0x1E42C0,
+    0x2592EE,
+    0x2E2485,
+    0x381A1F,
+    0x439782,
+    0x50C160,
+    0x5FBD0E,
+    0x70B036,
+    0x83C082,
+    0x99133E,
+    0xB0CD00,
+    0xCB113B,
+    0xE801DA,
+    0x107BEDE,
+    0x12A65E6,
+    0x15011DA,
+    0x178DA70,
+    0x1A4D3D6,
+    0x1D40E4E,
+    0x20695D8,
+    0x23C71DC,
+    0x275A4E8,
+    0x2B22C6C,
+    0x2F20094,
+    0x335140C,
+    0x37B53F4,
+    0x3C4A7D4,
+    0x410F198,
+    0x4600DA8,
+    0x4B1D308,
+    0x5061378,
+    0x55C9BC8,
+    0x5B53418,
+    0x60FA030,
+    0x66B9FF0,
+    0x6C8EFC0,
+    0x7274920,
+    0x7866300,
+    0x7E5F288,
+    0x845ABA0,
+    0x8A54180,
+    0x9046750,
+    0x962D0E0,
+    0x9C03350,
+    0xA1C4580,
+    0xA76C0E0,
+    0xACF61D0,
+    0xB25E890,
+    0xB7A1940,
+    0xBCBBCB0,
+    0xC1AA0D0,
+    0xC6698E0,
+    0xCAF7DC0,
+    0xCF52E60,
+    0xD378FC0,
+    0xD768D10,
+    0xDB217D0,
+    0xDEA2790,
+    0xE1EBA10,
+    0xE4FD310,
+    0xE7D7BC0,
+    0xEA7C2F0,
+    0xECEBC40,
+    0xEF27FF0,
+    0xF132A80,
+    0xF30DBE0,
+    0xF4BB760,
+    0xF63E2A0,
+    0xF798580,
+    0xF8CC930,
+    0xF9DD7E0,
+    0xFACDC30,
+    0xFBA00A0,
+    0xFC56F30,
+    0xFCF50D0,
+    0xFD7CD20,
+    0xFDF09F0,
+    0xFE52B60,
+    0xFEA5310,
+    0xFEEA080,
+    0xFF23090,
+    0xFF51DC0,
+    0xFF77FF0,
+    0xFF96C90,
+    0xFFAF690,
+    0xFFC2EB0,
+    0xFFD2380,
+    0xFFDE160,
+    0xFFE7310,
+    0xFFEE180,
+    0xFFF3430,
+    0xFFF7140,
+    0xFFF9DA0,
+    0xFFFBD70,
+    0xFFFD3E0,
+    0xFFFE360,
+    0xFFFEDE0,
+    0xFFFF4E0,
+    0xFFFF960,
+    0xFFFFC30,
+    0xFFFFDE0,
+    0xFFFFEE0,
+    0xFFFFF70,
+    0xFFFFFC0,
+    0xFFFFFE0,
+    0xFFFFFF0,
+    0x10000000,
+    0x10000000
+};
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/lt_predict.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,146 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** 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.11 2003/07/29 08:20:12 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef LTP_DEC
+
+#include <stdlib.h>
+#include "syntax.h"
+#include "lt_predict.h"
+#include "filtbank.h"
+#include "tns.h"
+
+static real_t codebook[8] =
+{
+    COEF_CONST(0.570829),
+    COEF_CONST(0.696616),
+    COEF_CONST(0.813004),
+    COEF_CONST(0.911304),
+    COEF_CONST(0.984900),
+    COEF_CONST(1.067894),
+    COEF_CONST(1.194601),
+    COEF_CONST(1.369533)
+};
+
+void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec,
+                   real_t *lt_pred_stat, fb_info *fb, uint8_t win_shape,
+                   uint8_t win_shape_prev, uint8_t sr_index,
+                   uint8_t object_type, uint16_t frame_len)
+{
+    uint8_t sfb;
+    uint16_t bin, i, num_samples;
+    real_t *x_est;
+    real_t *X_est;
+
+    if (ics->window_sequence != EIGHT_SHORT_SEQUENCE)
+    {
+        if (ltp->data_present)
+        {
+            num_samples = frame_len << 1;
+
+            x_est = (real_t*)malloc(num_samples*sizeof(real_t));
+            X_est = (real_t*)malloc(num_samples*sizeof(real_t));
+
+            for(i = 0; i < num_samples; i++)
+            {
+                /* The extra lookback M (N/2 for LD, 0 for LTP) is handled
+                   in the buffer updating */
+                x_est[i] = MUL_R_C(lt_pred_stat[num_samples + i - ltp->lag],
+                    codebook[ltp->coef]);
+            }
+
+            filter_bank_ltp(fb, ics->window_sequence, win_shape, win_shape_prev,
+                x_est, X_est, object_type, frame_len);
+
+            tns_encode_frame(ics, &(ics->tns), sr_index, object_type, X_est,
+                frame_len);
+
+            for (sfb = 0; sfb < ltp->last_band; sfb++)
+            {
+                if (ltp->long_used[sfb])
+                {
+                    uint16_t low  = ics->swb_offset[sfb];
+                    uint16_t high = ics->swb_offset[sfb+1];
+
+                    for (bin = low; bin < high; bin++)
+                    {
+                        spec[bin] += X_est[bin];
+                    }
+                }
+            }
+
+            free(x_est);
+            free(X_est);
+        }
+    }
+}
+
+void lt_update_state(real_t *lt_pred_stat, real_t *time, real_t *overlap,
+                     uint16_t frame_len, uint8_t object_type)
+{
+    uint16_t i;
+
+    /*
+     * The reference point for index i and the content of the buffer
+     * lt_pred_stat are arranged so that lt_pred_stat(0 ... N/2 - 1) contains the
+     * last aliased half window from the IMDCT, and lt_pred_stat(N/2 ... N-1)
+     * is always all zeros. The rest of lt_pred_stat (i<0) contains the previous
+     * fully reconstructed time domain samples, i.e., output of the decoder.
+     *
+     * These values are shifted up by N*2 to avoid (i<0)
+     *
+     * For the LD object type an extra 512 samples lookback is accomodated here.
+     */
+#ifdef LD_DEC
+    if (object_type == LD)
+    {
+        for (i = 0; i < frame_len; i++)
+        {
+            lt_pred_stat[i]  /* extra 512 */  = lt_pred_stat[i + frame_len];
+            lt_pred_stat[frame_len + i]       = lt_pred_stat[i + (frame_len * 2)];
+            lt_pred_stat[(frame_len * 2) + i] = time[i];
+            lt_pred_stat[(frame_len * 3) + i] = overlap[i];
+        }
+    } else {
+#endif
+        for (i = 0; i < frame_len; i++)
+        {
+            lt_pred_stat[i]                   = lt_pred_stat[i + frame_len];
+            lt_pred_stat[frame_len + i]       = time[i];
+            lt_pred_stat[(frame_len * 2) + i] = overlap[i];
+#if 0 /* set to zero once upon initialisation */
+            lt_pred_stat[(frame_len * 3) + i] = 0;
+#endif
+        }
+#ifdef LD_DEC
+    }
+#endif
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/lt_predict.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,61 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** 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.5 2003/07/29 08:20:12 menno Exp $
+**/
+
+#ifdef LTP_DEC
+
+#ifndef __LT_PREDICT_H__
+#define __LT_PREDICT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "filtbank.h"
+
+void lt_prediction(ic_stream *ics,
+                   ltp_info *ltp,
+                   real_t *spec,
+                   real_t *lt_pred_stat,
+                   fb_info *fb,
+                   uint8_t win_shape,
+                   uint8_t win_shape_prev,
+                   uint8_t sr_index,
+                   uint8_t object_type,
+                   uint16_t frame_len);
+
+void lt_update_state(real_t *lt_pred_stat,
+                     real_t *time,
+                     real_t *overlap,
+                     uint16_t frame_len,
+                     uint8_t object_type);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/mdct.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,284 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: mdct.c,v 1.26 2003/07/29 08:20:12 menno Exp $
+**/
+
+/*
+ * Fast (I)MDCT Implementation using (I)FFT ((Inverse) Fast Fourier Transform)
+ * and consists of three steps: pre-(I)FFT complex multiplication, complex
+ * (I)FFT, post-(I)FFT complex multiplication,
+ * 
+ * As described in:
+ *  P. Duhamel, Y. Mahieux, and J.P. Petit, "A Fast Algorithm for the
+ *  Implementation of Filter Banks Based on 'Time Domain Aliasing
+ *  Cancellation’," IEEE Proc. on ICASSP‘91, 1991, pp. 2209-2212.
+ *
+ *
+ * As of April 6th 2002 completely rewritten.
+ * This (I)MDCT can now be used for any data size n, where n is divisible by 8.
+ *
+ */
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+#ifdef _WIN32_WCE
+#define assert(x)
+#else
+#include <assert.h>
+#endif
+
+#include "cfft.h"
+#include "mdct.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)
+ */
+#ifndef FIXED_POINT
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+real_t const_tab[][5] =
+{
+    { COEF_CONST(0.0312500000), COEF_CONST(0.9999952938), COEF_CONST(0.0030679568),
+        COEF_CONST(0.9999999265), COEF_CONST(0.0003834952) }, /* 2048 */
+    { COEF_CONST(0.0322748612), COEF_CONST(0.9999946356), COEF_CONST(0.0032724866),
+        COEF_CONST(0.9999999404), COEF_CONST(0.0004090615) }, /* 1920 */
+    { COEF_CONST(0.0441941738), COEF_CONST(0.9999811649), COEF_CONST(0.0061358847),
+        COEF_CONST(0.9999997020), COEF_CONST(0.0007669903) }, /* 1024 */
+    { COEF_CONST(0.0456435465), COEF_CONST(0.9999786019), COEF_CONST(0.0065449383),
+        COEF_CONST(0.9999996424), COEF_CONST(0.0008181230) }, /* 960 */
+    { COEF_CONST(0.0883883476), COEF_CONST(0.9996988177), COEF_CONST(0.0245412290),
+        COEF_CONST(0.9999952912), COEF_CONST(0.0030679568) }, /* 256 */
+    { COEF_CONST(0.0912870929), COEF_CONST(0.9996573329), COEF_CONST(0.0261769500),
+        COEF_CONST(0.9999946356), COEF_CONST(0.0032724866) }  /* 240 */
+#ifdef SSR_DEC
+   ,{ COEF_CONST(0.062500000), COEF_CONST(0.999924702), COEF_CONST(0.012271538),
+        COEF_CONST(0.999998823), COEF_CONST(0.00153398) }, /* 512 */
+    { COEF_CONST(0.176776695), COEF_CONST(0.995184727), COEF_CONST(0.09801714),
+        COEF_CONST(0.999924702), COEF_CONST(0.012271538) }  /* 64 */
+#endif
+};
+#else
+real_t const_tab[][5] =
+{
+    { COEF_CONST(1), COEF_CONST(0.9999952938), COEF_CONST(0.0030679568),
+        COEF_CONST(0.9999999265), COEF_CONST(0.0003834952) }, /* 2048 */
+    { COEF_CONST(/* sqrt(1024/960) */ 1.03279556), COEF_CONST(0.9999946356), COEF_CONST(0.0032724866),
+        COEF_CONST(0), COEF_CONST(0.0004090615) }, /* 1920 */
+    { COEF_CONST(1), COEF_CONST(0.9999811649), COEF_CONST(0.0061358847),
+        COEF_CONST(0.9999997020), COEF_CONST(0.0007669903) }, /* 1024 */
+    { COEF_CONST(/* sqrt(512/480) */ 1.03279556), COEF_CONST(0.9999786019), COEF_CONST(0.0065449383),
+        COEF_CONST(0.9999996424), COEF_CONST(0.0008181230) }, /* 960 */
+    { COEF_CONST(1), COEF_CONST(0.9996988177), COEF_CONST(0.0245412290),
+        COEF_CONST(0.9999952912), COEF_CONST(0.0030679568) }, /* 256 */
+    { COEF_CONST(/* sqrt(256/240) */ 1.03279556), COEF_CONST(0.9996573329), COEF_CONST(0.0261769500),
+        COEF_CONST(0.9999946356), COEF_CONST(0.0032724866) }  /* 240 */
+#ifdef SSR_DEC
+   ,{ COEF_CONST(0), COEF_CONST(0.999924702), COEF_CONST(0.012271538),
+        COEF_CONST(0.999998823), COEF_CONST(0.00153398) }, /* 512 */
+    { COEF_CONST(0), COEF_CONST(0.995184727), COEF_CONST(0.09801714),
+        COEF_CONST(0.999924702), COEF_CONST(0.012271538) }  /* 64 */
+#endif
+};
+#endif
+
+uint8_t map_N_to_idx(uint16_t N)
+{
+    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;
+}
+
+mdct_info *faad_mdct_init(uint16_t N)
+{
+    uint16_t k, N_idx;
+    real_t cangle, sangle, c, s, cold;
+	real_t scale;
+
+    mdct_info *mdct = (mdct_info*)malloc(sizeof(mdct_info));
+
+    assert(N % 8 == 0);
+
+    mdct->N = N;
+    mdct->sincos = (complex_t*)malloc(N/4*sizeof(complex_t));
+    mdct->Z1 = (complex_t*)malloc(N/4*sizeof(complex_t));
+
+    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];
+
+    for (k = 0; k < N/4; k++)
+    {
+        RE(mdct->sincos[k]) = -1*MUL_C_C(c,scale);
+        IM(mdct->sincos[k]) = -1*MUL_C_C(s,scale);
+
+        cold = c;
+        c = MUL_C_C(c,cangle) - MUL_C_C(s,sangle);
+        s = MUL_C_C(s,cangle) + MUL_C_C(cold,sangle);
+    }
+
+    /* initialise fft */
+    mdct->cfft = cffti(N/4);
+
+    return mdct;
+}
+
+void faad_mdct_end(mdct_info *mdct)
+{
+    if (mdct != NULL)
+    {
+        cfftu(mdct->cfft);
+
+        if (mdct->Z1) free(mdct->Z1);
+        if (mdct->sincos) free(mdct->sincos);
+
+        free(mdct);
+    }
+}
+
+void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
+{
+    uint16_t k;
+
+    complex_t x;
+    complex_t *Z1 = mdct->Z1;
+    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;
+
+    /* pre-IFFT complex multiplication */
+    for (k = 0; k < N4; k++)
+    {
+        uint16_t n = k << 1;
+        RE(x) = X_in[         n];
+        IM(x) = X_in[N2 - 1 - n];
+        RE(Z1[k]) = MUL_R_C(IM(x), RE(sincos[k])) - MUL_R_C(RE(x), IM(sincos[k]));
+        IM(Z1[k]) = MUL_R_C(RE(x), RE(sincos[k])) + MUL_R_C(IM(x), IM(sincos[k]));
+    }
+
+    /* complex IFFT */
+    cfftb(mdct->cfft, Z1);
+
+    /* post-IFFT complex multiplication */
+    for (k = 0; k < N4; k++)
+    {
+        uint16_t n = k << 1;
+        RE(x) = RE(Z1[k]);
+        IM(x) = IM(Z1[k]);
+
+        RE(Z1[k]) = MUL_R_C(RE(x), RE(sincos[k])) - MUL_R_C(IM(x), IM(sincos[k]));
+        IM(Z1[k]) = MUL_R_C(IM(x), RE(sincos[k])) + MUL_R_C(RE(x), IM(sincos[k]));
+    }
+
+    /* reordering */
+    for (k = 0; k < N8; k++)
+    {
+        uint16_t n = k << 1;
+        X_out[              n] =  IM(Z1[N8 +     k]);
+        X_out[          1 + n] = -RE(Z1[N8 - 1 - k]);
+        X_out[N4 +          n] =  RE(Z1[         k]);
+        X_out[N4 +      1 + n] = -IM(Z1[N4 - 1 - k]);
+        X_out[N2 +          n] =  RE(Z1[N8 +     k]);
+        X_out[N2 +      1 + n] = -IM(Z1[N8 - 1 - k]);
+        X_out[N2 + N4 +     n] = -IM(Z1[         k]);
+        X_out[N2 + N4 + 1 + n] =  RE(Z1[N4 - 1 - k]);
+    }
+}
+
+#ifdef LTP_DEC
+void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
+{
+    uint16_t k;
+
+    complex_t x;
+    complex_t *Z1 = mdct->Z1;
+    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;
+
+	real_t scale = REAL_CONST(N);
+
+    /* pre-FFT complex multiplication */
+    for (k = 0; k < N8; k++)
+    {
+        uint16_t n = k << 1;
+        RE(x) = X_in[N - N4 - 1 - n] + X_in[N - N4 +     n];
+        IM(x) = X_in[    N4 +     n] - X_in[    N4 - 1 - n];
+
+        RE(Z1[k]) = -MUL_R_C(RE(x), RE(sincos[k])) - MUL_R_C(IM(x), IM(sincos[k]));
+        IM(Z1[k]) = -MUL_R_C(IM(x), RE(sincos[k])) + MUL_R_C(RE(x), IM(sincos[k]));
+
+        RE(x) =  X_in[N2 - 1 - n] - X_in[        n];
+        IM(x) =  X_in[N2 +     n] + X_in[N - 1 - n];
+
+        RE(Z1[k + N8]) = -MUL_R_C(RE(x), RE(sincos[k + N8])) - MUL_R_C(IM(x), IM(sincos[k + N8]));
+        IM(Z1[k + N8]) = -MUL_R_C(IM(x), RE(sincos[k + N8])) + MUL_R_C(RE(x), IM(sincos[k + N8]));
+    }
+
+    /* complex FFT */
+    cfftf(mdct->cfft, Z1);
+
+    /* post-FFT complex multiplication */
+    for (k = 0; k < N4; k++)
+    {
+        uint16_t n = k << 1;
+        RE(x) = MUL(MUL_R_C(RE(Z1[k]), RE(sincos[k])) + MUL_R_C(IM(Z1[k]), IM(sincos[k])), scale);
+        IM(x) = MUL(MUL_R_C(IM(Z1[k]), RE(sincos[k])) - MUL_R_C(RE(Z1[k]), IM(sincos[k])), scale);
+
+        X_out[         n] =  RE(x);
+        X_out[N2 - 1 - n] = -IM(x);
+        X_out[N2 +     n] =  IM(x);
+        X_out[N  - 1 - n] = -RE(x);
+    }
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/mdct.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,46 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: mdct.h,v 1.14 2003/07/29 08:20:12 menno Exp $
+**/
+
+#ifndef __MDCT_H__
+#define __MDCT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "cfft.h"
+
+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);
+void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/mp4.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,256 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: mp4.c,v 1.17 2003/07/29 08:20:12 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+
+#include "bits.h"
+#include "mp4.h"
+#include "syntax.h"
+
+/* defines if an object type can be decoded by this library or not */
+static uint8_t ObjectTypesTable[32] = {
+    0, /*  0 NULL */
+#ifdef MAIN_DEC
+    1, /*  1 AAC Main */
+#else
+    0, /*  1 AAC Main */
+#endif
+    1, /*  2 AAC LC */
+#ifdef SSR_DEC
+    1, /*  3 AAC SSR */
+#else
+    0, /*  3 AAC SSR */
+#endif
+#ifdef LTP_DEC
+    1, /*  4 AAC LTP */
+#else
+    0, /*  4 AAC LTP */
+#endif
+#ifdef SBR_DEC
+    1, /*  5 SBR */
+#else
+    0, /*  5 SBR */
+#endif
+    0, /*  6 AAC Scalable */
+    0, /*  7 TwinVQ */
+    0, /*  8 CELP */
+    0, /*  9 HVXC */
+    0, /* 10 Reserved */
+    0, /* 11 Reserved */
+    0, /* 12 TTSI */
+    0, /* 13 Main synthetic */
+    0, /* 14 Wavetable synthesis */
+    0, /* 15 General MIDI */
+    0, /* 16 Algorithmic Synthesis and Audio FX */
+
+    /* MPEG-4 Version 2 */
+#ifdef ERROR_RESILIENCE
+    1, /* 17 ER AAC LC */
+    0, /* 18 (Reserved) */
+#ifdef LTP_DEC
+    1, /* 19 ER AAC LTP */
+#else
+    0, /* 19 ER AAC LTP */
+#endif
+    0, /* 20 ER AAC scalable */
+    0, /* 21 ER TwinVQ */
+    0, /* 22 ER BSAC */
+#ifdef LD_DEC
+    1, /* 23 ER AAC LD */
+#else
+    0, /* 23 ER AAC LD */
+#endif
+    0, /* 24 ER CELP */
+    0, /* 25 ER HVXC */
+    0, /* 26 ER HILN */
+    0, /* 27 ER Parametric */
+#else /* No ER defined */
+    0, /* 17 ER AAC LC */
+    0, /* 18 (Reserved) */
+    0, /* 19 ER AAC LTP */
+    0, /* 20 ER AAC scalable */
+    0, /* 21 ER TwinVQ */
+    0, /* 22 ER BSAC */
+    0, /* 23 ER AAC LD */
+    0, /* 24 ER CELP */
+    0, /* 25 ER HVXC */
+    0, /* 26 ER HILN */
+    0, /* 27 ER Parametric */
+#endif
+    0, /* 28 (Reserved) */
+    0, /* 29 (Reserved) */
+    0, /* 30 (Reserved) */
+    0  /* 31 (Reserved) */
+};
+
+/* Table 1.6.1 */
+int8_t FAADAPI AudioSpecificConfig(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)
+{
+    bitfile ld;
+    int8_t result = 0;
+#ifdef SBR_DEC
+    int8_t bits_to_decode = 0;
+#endif
+
+    if (pBuffer == NULL)
+        return -7;
+    if (mp4ASC == NULL)
+        return -8;
+
+    memset(mp4ASC, 0, sizeof(mp4AudioSpecificConfig));
+
+    faad_initbits(&ld, pBuffer, buffer_size);
+    faad_byte_align(&ld);
+
+    mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(&ld, 5
+        DEBUGVAR(1,1,"parse_audio_decoder_specific_info(): ObjectTypeIndex"));
+
+    mp4ASC->samplingFrequencyIndex = (uint8_t)faad_getbits(&ld, 4
+        DEBUGVAR(1,2,"parse_audio_decoder_specific_info(): SamplingFrequencyIndex"));
+
+    mp4ASC->channelsConfiguration = (uint8_t)faad_getbits(&ld, 4
+        DEBUGVAR(1,3,"parse_audio_decoder_specific_info(): ChannelsConfiguration"));
+
+    mp4ASC->samplingFrequency = sample_rates[mp4ASC->samplingFrequencyIndex];
+
+    if (ObjectTypesTable[mp4ASC->objectTypeIndex] != 1)
+    {
+        faad_endbits(&ld);
+        return -1;
+    }
+
+    if (mp4ASC->samplingFrequency == 0)
+    {
+        faad_endbits(&ld);
+        return -2;
+    }
+
+    if (mp4ASC->channelsConfiguration > 7)
+    {
+        faad_endbits(&ld);
+        return -3;
+    }
+
+#ifdef SBR_DEC
+    mp4ASC->sbr_present_flag = -1;
+    if (mp4ASC->objectTypeIndex == 5)
+    {
+        mp4ASC->sbr_present_flag = 1;
+        mp4ASC->samplingFrequencyIndex = (uint8_t)faad_getbits(&ld, 4
+            DEBUGVAR(1,5,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
+        if (mp4ASC->samplingFrequencyIndex == 15)
+        {
+            mp4ASC->samplingFrequency = (uint32_t)faad_getbits(&ld, 24
+                DEBUGVAR(1,6,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
+        } else {
+            mp4ASC->samplingFrequency = sample_rates[mp4ASC->samplingFrequencyIndex];
+        }
+        mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(&ld, 5
+            DEBUGVAR(1,7,"parse_audio_decoder_specific_info(): ObjectTypeIndex"));
+    }
+#endif
+
+    /* get GASpecificConfig */
+    if (mp4ASC->objectTypeIndex == 1 || mp4ASC->objectTypeIndex == 2 ||
+        mp4ASC->objectTypeIndex == 3 || mp4ASC->objectTypeIndex == 4 ||
+        mp4ASC->objectTypeIndex == 6 || mp4ASC->objectTypeIndex == 7)
+    {
+        result = GASpecificConfig(&ld, mp4ASC, pce);
+
+#ifdef ERROR_RESILIENCE
+    } else if (mp4ASC->objectTypeIndex >= ER_OBJECT_START) { /* ER */
+        result = GASpecificConfig(&ld, mp4ASC, pce);
+        mp4ASC->epConfig = (uint8_t)faad_getbits(&ld, 2
+            DEBUGVAR(1,143,"parse_audio_decoder_specific_info(): epConfig"));
+
+        if (mp4ASC->epConfig != 0)
+            result = -5;
+#endif
+
+    } else {
+        result = -4;
+    }
+
+#ifdef SSR_DEC
+    /* shorter frames not allowed for SSR */
+    if ((mp4ASC->objectTypeIndex == 4) && mp4ASC->frameLengthFlag)
+        return -6;
+#endif
+
+
+#ifdef SBR_DEC
+    bits_to_decode = buffer_size*8 - faad_get_processed_bits(&ld);
+
+    if ((mp4ASC->objectTypeIndex != 5) && (bits_to_decode >= 16))
+    {
+        int16_t syncExtensionType = (int16_t)faad_getbits(&ld, 11
+            DEBUGVAR(1,9,"parse_audio_decoder_specific_info(): syncExtensionType"));
+
+        if (syncExtensionType == 0x2b7)
+        {
+            mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(&ld, 5
+                DEBUGVAR(1,10,"parse_audio_decoder_specific_info(): extensionAudioObjectType"));
+
+            if (mp4ASC->objectTypeIndex == 5)
+            {
+                mp4ASC->sbr_present_flag = (uint8_t)faad_get1bit(&ld
+                    DEBUGVAR(1,11,"parse_audio_decoder_specific_info(): sbr_present_flag"));
+
+                if (mp4ASC->sbr_present_flag)
+                {
+                    mp4ASC->samplingFrequencyIndex = (uint8_t)faad_getbits(&ld, 4
+                        DEBUGVAR(1,12,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
+                    if (mp4ASC->samplingFrequencyIndex == 15)
+                    {
+                        mp4ASC->samplingFrequency = (uint32_t)faad_getbits(&ld, 24
+                            DEBUGVAR(1,13,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
+                    } else {
+                        mp4ASC->samplingFrequency = sample_rates[mp4ASC->samplingFrequencyIndex];
+                    }
+                }
+            }
+        }
+    }
+#endif
+
+    faad_endbits(&ld);
+
+    return result;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/mp4.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,49 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: mp4.h,v 1.9 2003/07/29 08:20:12 menno Exp $
+**/
+
+#ifndef __MP4_H__
+#define __MP4_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "decoder.h"
+
+int8_t FAADAPI AudioSpecificConfig(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);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/ms.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,74 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ms.c,v 1.5 2003/07/29 08:20:12 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include "syntax.h"
+#include "ms.h"
+#include "is.h"
+#include "pns.h"
+
+void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
+               uint16_t frame_len)
+{
+    uint8_t g, b, sfb;
+    uint8_t group = 0;
+    uint16_t nshort = frame_len/8;
+
+    uint16_t i, k;
+    real_t tmp;
+
+    if (ics->ms_mask_present >= 1)
+    {
+        for (g = 0; g < ics->num_window_groups; g++) 
+        {
+            for (b = 0; b < ics->window_group_length[g]; b++)
+            {
+                for(sfb = 0; sfb < ics->max_sfb; sfb++)
+                {
+                    /* If intensity stereo coding or noise substitution is on
+                       for a particular scalefactor band, no M/S stereo decoding
+                       is carried out.
+                     */
+                    if ((ics->ms_used[g][sfb] || ics->ms_mask_present == 2) &&
+                        !is_intensity(icsr, g, sfb) && !is_noise(ics, g, sfb))
+                    {
+                        for (i = ics->swb_offset[sfb]; i < ics->swb_offset[sfb+1]; i++)
+                        {
+                            k = (group*nshort) + i;
+                            tmp = l_spec[k] - r_spec[k];
+                            l_spec[k] = l_spec[k] + r_spec[k];
+                            r_spec[k] = tmp;
+                        }
+                    }
+                }
+                group++;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/ms.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,41 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ms.h,v 1.4 2003/07/29 08:20:12 menno Exp $
+**/
+
+#ifndef __MS_H__
+#define __MS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
+               uint16_t frame_len);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/output.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,238 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id$
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include "output.h"
+#include "decoder.h"
+
+#ifndef FIXED_POINT
+
+#include "dither.h"
+
+
+#define ftol(A,B) {tmp = *(int32_t*) & A - 0x4B7F8000; \
+                   B = (int16_t)((tmp==(int16_t)tmp) ? tmp : (tmp>>31)^0x7FFF);}
+
+#define ROUND(x) ((x >= 0) ? (int32_t)floor((x) + 0.5) : (int32_t)ceil((x) + 0.5))
+
+#define ROUND32(x) ROUND(x)
+
+#define ROUND64(x) (doubletmp = (x) + Dither.Add + (int64_t)0x001FFFFD80000000L, *(int64_t*)(&doubletmp) - (int64_t)0x433FFFFD80000000L)
+
+#define FLOAT_SCALE (1.0f/(1<<15))
+
+dither_t Dither;
+double doubletmp;
+
+#define DM_MUL (1./(1.+sqrt(2.)))
+
+static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample,
+                                uint8_t downMatrix, uint8_t *internal_channel)
+{
+    if (downMatrix)
+    {
+        if (channel == 0)
+        {
+            return DM_MUL * (input[internal_channel[1]][sample] +
+                input[internal_channel[0]][sample]/sqrt(2.) +
+                input[internal_channel[3]][sample]/sqrt(2.));
+        } else {
+            return DM_MUL * (input[internal_channel[2]][sample] +
+                input[internal_channel[0]][sample]/sqrt(2.) +
+                input[internal_channel[4]][sample]/sqrt(2.));
+        }
+    } else {
+        return input[internal_channel[channel]][sample];
+    }
+}
+
+void* output_to_PCM(faacDecHandle hDecoder,
+                    real_t **input, void *sample_buffer, uint8_t channels,
+                    uint16_t frame_len, uint8_t format)
+{
+    uint8_t ch;
+    uint16_t i, j = 0;
+    uint8_t internal_channel;
+
+    int16_t   *short_sample_buffer = (int16_t*)sample_buffer;
+    int32_t   *int_sample_buffer = (int32_t*)sample_buffer;
+    float32_t *float_sample_buffer = (float32_t*)sample_buffer;
+    double    *double_sample_buffer = (double*)sample_buffer;
+
+    /* Copy output to a standard PCM buffer */
+    for (ch = 0; ch < channels; ch++)
+    {
+        internal_channel = hDecoder->internal_channel[ch];
+
+        switch (format)
+        {
+        case FAAD_FMT_16BIT:
+            for(i = 0; i < frame_len; i++)
+            {
+                int32_t tmp;
+                real_t ftemp;
+                //real_t inp = input[internal_channel][i];
+                real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
+
+                ftemp = inp + 0xff8000;
+                ftol(ftemp, short_sample_buffer[(i*channels)+ch]);
+            }
+            break;
+        case FAAD_FMT_16BIT_DITHER:
+            for(i = 0; i < frame_len; i++, j++)
+            {
+                real_t inp = input[internal_channel][i];
+                double Sum = inp * 65535.f;
+                int64_t val;
+                if(j > 31)
+                   j = 0;
+                val = dither_output(1, 0, j, Sum, ch) / 65536;
+                if (val > (1<<15)-1)
+                    val = (1<<15)-1;
+                else if (val < -(1<<15))
+                    val = -(1<<15);
+                short_sample_buffer[(i*channels)+ch] = (int16_t)val;
+            }
+            break;
+        case FAAD_FMT_16BIT_L_SHAPE:
+        case FAAD_FMT_16BIT_M_SHAPE:
+        case FAAD_FMT_16BIT_H_SHAPE:
+            for(i = 0; i < frame_len; i++, j++)
+            {
+                real_t inp = input[internal_channel][i];
+                double Sum = inp * 65535.f;
+                int64_t val;
+                if(j > 31)
+                   j = 0;
+                val = dither_output(1, 1, j, Sum, ch) / 65536;
+                if (val > (1<<15)-1)
+                    val = (1<<15)-1;
+                else if (val < -(1<<15))
+                    val = -(1<<15);
+                short_sample_buffer[(i*channels)+ch] = (int16_t)val;
+            }
+            break;
+        case FAAD_FMT_24BIT:
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp = input[internal_channel][i];
+                if (inp > (1<<15)-1)
+                    inp = (1<<15)-1;
+                else if (inp < -(1<<15))
+                    inp = -(1<<15);
+                int_sample_buffer[(i*channels)+ch] = ROUND(inp*(1<<8));
+            }
+            break;
+        case FAAD_FMT_32BIT:
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp = input[internal_channel][i];
+                if (inp > (1<<15)-1)
+                    inp = (1<<15)-1;
+                else if (inp < -(1<<15))
+                    inp = -(1<<15);
+                int_sample_buffer[(i*channels)+ch] = ROUND32(inp*(1<<16));
+            }
+            break;
+        case FAAD_FMT_FLOAT:
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp = input[internal_channel][i];
+                float_sample_buffer[(i*channels)+ch] = inp*FLOAT_SCALE;
+            }
+            break;
+        case FAAD_FMT_DOUBLE:
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp = input[internal_channel][i];
+                double_sample_buffer[(i*channels)+ch] = (double)inp*FLOAT_SCALE;
+            }
+            break;
+        }
+    }
+
+    return sample_buffer;
+}
+
+
+/* Dither output */
+static int64_t dither_output(uint8_t dithering, uint8_t shapingtype, uint16_t i, double Sum, uint8_t k)
+{
+    double Sum2;
+    int64_t val;
+    if(dithering)
+    {
+        if(!shapingtype)
+        {
+            double tmp = Random_Equi(Dither.Dither);
+            Sum2 = tmp - Dither.LastRandomNumber[k];
+            Dither.LastRandomNumber[k] = tmp;
+            Sum2 = Sum += Sum2;
+            val = ROUND64(Sum2)&Dither.Mask;
+        } else {
+            Sum2 = Random_Triangular(Dither.Dither) - scalar16(Dither.DitherHistory[k], Dither.FilterCoeff + i);
+            Sum += Dither.DitherHistory[k][(-1-i)&15] = Sum2;
+            Sum2 = Sum + scalar16(Dither.ErrorHistory[k], Dither.FilterCoeff + i );
+            val = ROUND64(Sum2)&Dither.Mask;
+            Dither.ErrorHistory[k][(-1-i)&15] = (float)(Sum - val);
+        }
+        return val;
+    }
+    else
+        return ROUND64 (Sum);
+}
+
+#else
+
+void* output_to_PCM(faacDecHandle hDecoder,
+                    real_t **input, void *sample_buffer, uint8_t channels,
+                    uint16_t frame_len, uint8_t format)
+{
+    uint8_t ch;
+    uint16_t i;
+    int16_t *short_sample_buffer = (int16_t*)sample_buffer;
+
+    /* Copy output to a standard PCM buffer */
+    for (ch = 0; ch < channels; ch++)
+    {
+        for(i = 0; i < frame_len; i++)
+        {
+            int32_t tmp = input[ch][i];
+            tmp += (1 << (REAL_BITS-1));
+            tmp >>= REAL_BITS;
+            if (tmp > 0x7fff)       tmp = 0x7fff;
+            else if (tmp <= -32768) tmp = -32768;
+            short_sample_buffer[(i*channels)+ch] = (int16_t)tmp;
+        }
+    }
+
+    return sample_buffer;
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/output.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,48 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: output.h,v 1.8 2003/07/29 08:20:12 menno Exp $
+**/
+
+#ifndef __OUTPUT_H__
+#define __OUTPUT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void* output_to_PCM(faacDecHandle hDecoder,
+                    real_t **input,
+                    void *samplebuffer,
+                    uint8_t channels,
+                    uint16_t frame_len,
+                    uint8_t format);
+
+static int64_t dither_output(uint8_t dithering, uint8_t shapingtype,
+                             uint16_t i, double Sum, uint8_t k);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/pns.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,234 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: pns.c,v 1.21 2003/07/29 08:20:12 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include "pns.h"
+
+
+#ifdef FIXED_POINT
+
+#define DIV(A, B) (((int64_t)A << COEF_BITS)/B)
+
+#define step(shift) \
+    if ((0x40000000l >> shift) + root <= value)       \
+    {                                                 \
+        value -= (0x40000000l >> shift) + root;       \
+        root = (root >> 1) | (0x40000000l >> shift);  \
+    } else {                                          \
+        root = root >> 1;                             \
+    }
+
+/* fixed point square root approximation */
+real_t fp_sqrt(real_t value)
+{
+    real_t root = 0;
+
+    step( 0); step( 2); step( 4); step( 6);
+    step( 8); step(10); step(12); step(14);
+    step(16); step(18); step(20); step(22);
+    step(24); step(26); step(28); step(30);
+
+    if (root < value)
+        ++root;
+
+    root <<= (COEF_BITS/2);
+
+    return root;
+}
+
+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),
+    COEF_CONST(1.68179283050743)
+};
+#endif
+
+/* The function gen_rand_vector(addr, size) generates a vector of length
+   <size> with signed random values of average energy MEAN_NRG per random
+   value. A suitable random number generator can be realized using one
+   multiplication/accumulation per random value.
+*/
+static INLINE void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size)
+{
+#ifndef FIXED_POINT
+    uint16_t i;
+    real_t energy = 0.0;
+
+    real_t scale = 1.0/(real_t)size * ISQRT_MEAN_NRG;
+
+    for (i = 0; i < size; i++)
+    {
+        real_t tmp = scale*(real_t)(int32_t)random_int();
+        spec[i] = tmp;
+        energy += tmp*tmp;
+    }
+
+    scale = 1.0/(real_t)sqrt(energy);
+    scale *= (real_t)pow(2.0, 0.25 * scale_factor);
+    for (i = 0; i < size; i++)
+    {
+        spec[i] *= scale;
+    }
+#else
+    uint16_t i;
+    real_t energy = 0, scale;
+    int32_t exp, frac;
+
+    for (i = 0; i < size; i++)
+    {
+        real_t tmp = ISQRT_MEAN_NRG * (int32_t)random_int();
+        tmp = MUL_C_C(COEF_CONST(1)/size, tmp);
+
+        energy += MUL_C_C(tmp,tmp);
+
+        /* convert COEF to REAL */
+        spec[i] = (tmp >> -(REAL_BITS-COEF_BITS));
+    }
+
+    energy = fp_sqrt(energy);
+    if (energy > 0)
+    {
+        scale = DIV(COEF_CONST(1),energy);
+
+        scale >>= -(REAL_BITS-COEF_BITS);
+
+        exp = scale_factor / 4;
+        frac = scale_factor % 4;
+
+        if (exp < 0)
+            scale >>= -exp;
+        else
+            scale <<= exp;
+
+        if (frac)
+            scale = MUL_R_C(scale, pow2_table[frac + 3]);
+
+        for (i = 0; i < size; i++)
+        {
+            spec[i] = MUL(spec[i], scale);
+        }
+    }
+#endif
+}
+
+void pns_decode(ic_stream *ics_left, ic_stream *ics_right,
+                real_t *spec_left, real_t *spec_right, uint16_t frame_len,
+                uint8_t channel_pair)
+{
+    uint8_t g, sfb, b;
+    uint16_t size, offs;
+
+    uint8_t group = 0;
+    uint16_t nshort = frame_len >> 3;
+
+    for (g = 0; g < ics_left->num_window_groups; g++)
+    {
+        /* Do perceptual noise substitution decoding */
+        for (b = 0; b < ics_left->window_group_length[g]; b++)
+        {
+            for (sfb = 0; sfb < ics_left->max_sfb; sfb++)
+            {
+                if (is_noise(ics_left, g, sfb))
+                {
+                    /* 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
+                       is applied to this band.
+                    */
+                    ics_left->ltp.long_used[sfb] = 0;
+                    ics_left->ltp2.long_used[sfb] = 0;
+
+                    /* For scalefactor bands coded using PNS the corresponding
+                       predictors are switched to "off".
+                    */
+                    ics_left->pred.prediction_used[sfb] = 0;
+
+                    offs = ics_left->swb_offset[sfb];
+                    size = ics_left->swb_offset[sfb+1] - offs;
+
+                    /* Generate random vector */
+                    gen_rand_vector(&spec_left[(group*nshort)+offs],
+                        ics_left->scale_factors[g][sfb], size);
+                }
+
+/* From the spec:
+   If the same scalefactor band and group is coded by perceptual noise
+   substitution in both channels of a channel pair, the correlation of
+   the noise signal can be controlled by means of the ms_used field: While
+   the default noise generation process works independently for each channel
+   (separate generation of random vectors), the same random vector is used
+   for both channels if ms_used[] is set for a particular scalefactor band
+   and group. In this case, no M/S stereo coding is carried out (because M/S
+   stereo coding and noise substitution coding are mutually exclusive).
+   If the same scalefactor band and group is coded by perceptual noise
+   substitution in only one channel of a channel pair the setting of ms_used[]
+   is not evaluated.
+*/
+                if (channel_pair)
+                {
+                    if (is_noise(ics_right, g, sfb))
+                    {
+                        if (((ics_left->ms_mask_present == 1) &&
+                            (ics_left->ms_used[g][sfb])) ||
+                            (ics_left->ms_mask_present == 2))
+                        {
+                            uint16_t c;
+
+                            offs = ics_right->swb_offset[sfb];
+                            size = ics_right->swb_offset[sfb+1] - offs;
+
+                            for (c = 0; c < size; c++)
+                            {
+                                spec_right[(group*nshort) + offs + c] =
+                                    spec_left[(group*nshort) + offs + c];
+                            }
+                        } else /*if (ics_left->ms_mask_present == 0)*/ {
+                            ics_right->ltp.long_used[sfb] = 0;
+                            ics_right->ltp2.long_used[sfb] = 0;
+                            ics_right->pred.prediction_used[sfb] = 0;
+
+                            offs = ics_right->swb_offset[sfb];
+                            size = ics_right->swb_offset[sfb+1] - offs;
+
+                            /* Generate random vector */
+                            gen_rand_vector(&spec_right[(group*nshort)+offs],
+                                ics_right->scale_factors[g][sfb], size);
+                        }
+                    }
+                }
+            } /* sfb */
+            group++;
+        } /* b */
+    } /* g */
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/pns.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,65 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: pns.h,v 1.11 2003/07/29 08:20:13 menno Exp $
+**/
+
+#ifndef __PNS_H__
+#define __PNS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "common.h"
+
+#include "syntax.h"
+
+#define NOISE_OFFSET 90
+/* #define MEAN_NRG 1.537228e+18 */ /* (2^31)^2 / 3 */
+#ifdef FIXED_POINT
+#define ISQRT_MEAN_NRG 0x1DC7 /* sqrt(1/sqrt(MEAN_NRG)) */
+#else
+#define ISQRT_MEAN_NRG 8.0655e-10 /* 1/sqrt(MEAN_NRG) */
+#endif
+
+
+void pns_decode(ic_stream *ics_left, ic_stream *ics_right,
+                real_t *spec_left, real_t *spec_right, uint16_t frame_len,
+                uint8_t channel_pair);
+
+static INLINE int32_t random2();
+static void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size);
+
+static INLINE uint8_t is_noise(ic_stream *ics, uint8_t group, uint8_t sfb)
+{
+    if (ics->sfb_cb[group][sfb] == NOISE_HCB)
+        return 1;
+    return 0;
+}
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/pulse.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,55 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: pulse.c,v 1.6 2003/07/29 08:20:13 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include "syntax.h"
+#include "pulse.h"
+
+uint8_t pulse_decode(ic_stream *ics, int16_t *spec_data, uint16_t framelen)
+{
+    uint8_t i;
+    uint16_t k;
+    pulse_info *pul = &(ics->pul);
+
+    k = ics->swb_offset[pul->pulse_start_sfb];
+
+    for(i = 0; i <= pul->number_pulse; i++) {
+        k += pul->pulse_offset[i];
+
+        if (k >= framelen)
+            return 15; /* should not be possible */
+
+        if (spec_data[k] > 0)
+            spec_data[k] += pul->pulse_amp[i];
+        else
+            spec_data[k] -= pul->pulse_amp[i];
+    }
+
+    return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/pulse.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,40 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: pulse.h,v 1.5 2003/07/29 08:20:13 menno Exp $
+**/
+
+#ifndef __PULSE_H__
+#define __PULSE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+uint8_t pulse_decode(ic_stream *ics, int16_t *spec_coef, uint16_t framelen);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/rvlc.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,514 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: rvlc.c,v 1.5 2003/07/29 08:20:13 menno Exp $
+**/
+
+/* RVLC scalefactor decoding
+ *
+ * RVLC works like this:
+ *  1. Only symmetric huffman codewords are used
+ *  2. Total length of the scalefactor data is stored in the bitsream
+ *  3. Scalefactors are DPCM coded
+ *  4. Next to the starting value for DPCM the ending value is also stored
+ *
+ * With all this it is possible to read the scalefactor data from 2 sides.
+ * If there is a bit error in the scalefactor data it is possible to start
+ * decoding from the other end of the data, to find all but 1 scalefactor.
+ */
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+
+#include "syntax.h"
+#include "bits.h"
+#include "rvlc.h"
+
+
+#ifdef ERROR_RESILIENCE
+
+//#define PRINT_RVLC
+
+uint8_t rvlc_scale_factor_data(ic_stream *ics, bitfile *ld)
+{
+    uint8_t bits = 9;
+
+    ics->sf_concealment = faad_get1bit(ld
+        DEBUGVAR(1,149,"rvlc_scale_factor_data(): sf_concealment"));
+    ics->rev_global_gain = faad_getbits(ld, 8
+        DEBUGVAR(1,150,"rvlc_scale_factor_data(): rev_global_gain"));
+
+    if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+        bits = 11;
+
+    /* the number of bits used for the huffman codewords */
+    ics->length_of_rvlc_sf = faad_getbits(ld, bits
+        DEBUGVAR(1,151,"rvlc_scale_factor_data(): length_of_rvlc_sf"));
+
+    if (ics->noise_used)
+    {
+        ics->dpcm_noise_nrg = faad_getbits(ld, 9
+            DEBUGVAR(1,152,"rvlc_scale_factor_data(): dpcm_noise_nrg"));
+
+        ics->length_of_rvlc_sf -= 9;
+    }
+
+    ics->sf_escapes_present = faad_get1bit(ld
+        DEBUGVAR(1,153,"rvlc_scale_factor_data(): sf_escapes_present"));
+
+    if (ics->sf_escapes_present)
+    {
+        ics->length_of_rvlc_escapes = faad_getbits(ld, 8
+            DEBUGVAR(1,154,"rvlc_scale_factor_data(): length_of_rvlc_escapes"));
+    }
+
+    if (ics->noise_used)
+    {
+        ics->dpcm_noise_last_position = faad_getbits(ld, 9
+            DEBUGVAR(1,155,"rvlc_scale_factor_data(): dpcm_noise_last_position"));
+    }
+
+    return 0;
+}
+
+uint8_t rvlc_decode_scale_factors(ic_stream *ics, bitfile *ld)
+{
+    uint8_t result;
+    uint8_t intensity_used = 0;
+    uint8_t *rvlc_sf_buffer = NULL;
+    uint8_t *rvlc_esc_buffer = NULL;
+    bitfile ld_rvlc_sf, ld_rvlc_esc;
+//    bitfile ld_rvlc_sf_rev, ld_rvlc_esc_rev;
+
+    if (ics->length_of_rvlc_sf > 0)
+    {
+        /* We read length_of_rvlc_sf bits here to put it in a
+           seperate bitfile.
+        */
+        rvlc_sf_buffer = faad_getbitbuffer(ld, ics->length_of_rvlc_sf
+            DEBUGVAR(1,156,"rvlc_decode_scale_factors(): bitbuffer: length_of_rvlc_sf"));
+
+        faad_initbits(&ld_rvlc_sf, (void*)rvlc_sf_buffer, bit2byte(ics->length_of_rvlc_sf));
+//        faad_initbits_rev(&ld_rvlc_sf_rev, (void*)rvlc_sf_buffer,
+//            ics->length_of_rvlc_sf);
+    }
+
+    if (ics->sf_escapes_present)
+    {
+        /* We read length_of_rvlc_escapes bits here to put it in a
+           seperate bitfile.
+        */
+        rvlc_esc_buffer = faad_getbitbuffer(ld, ics->length_of_rvlc_escapes
+            DEBUGVAR(1,157,"rvlc_decode_scale_factors(): bitbuffer: length_of_rvlc_escapes"));
+
+        faad_initbits(&ld_rvlc_esc, (void*)rvlc_esc_buffer, bit2byte(ics->length_of_rvlc_escapes));
+//        faad_initbits_rev(&ld_rvlc_esc_rev, (void*)rvlc_esc_buffer,
+//            ics->length_of_rvlc_escapes);
+    }
+
+    /* decode the rvlc scale factors and escapes */
+    result = rvlc_decode_sf_forward(ics, &ld_rvlc_sf,
+        &ld_rvlc_esc, &intensity_used);
+//    result = rvlc_decode_sf_reverse(ics, &ld_rvlc_sf_rev,
+//        &ld_rvlc_esc_rev, intensity_used);
+
+
+    if (rvlc_esc_buffer) free(rvlc_esc_buffer);
+    if (rvlc_sf_buffer) free(rvlc_sf_buffer);
+
+    if (ics->length_of_rvlc_sf > 0)
+        faad_endbits(&ld_rvlc_sf);
+    if (ics->sf_escapes_present)
+        faad_endbits(&ld_rvlc_esc);
+
+    return result;
+}
+
+static uint8_t rvlc_decode_sf_forward(ic_stream *ics, bitfile *ld_sf, bitfile *ld_esc,
+                                      uint8_t *intensity_used)
+{
+    int8_t g, sfb;
+    int8_t t = 0;
+    int8_t error = 0;
+    int8_t noise_pcm_flag = 1;
+
+    int16_t scale_factor = ics->global_gain;
+    int16_t is_position = 0;
+    int16_t noise_energy = ics->global_gain - 90 - 256;
+
+#ifdef PRINT_RVLC
+    printf("\nglobal_gain: %d\n", ics->global_gain);
+#endif
+
+    for (g = 0; g < ics->num_window_groups; g++)
+    {
+        for (sfb = 0; sfb < ics->max_sfb; sfb++)
+        {
+            if (error)
+            {
+                ics->scale_factors[g][sfb] = 0;
+            } else {
+                switch (ics->sfb_cb[g][sfb])
+                {
+                case ZERO_HCB: /* zero book */
+                    ics->scale_factors[g][sfb] = 0;
+                    break;
+                case INTENSITY_HCB: /* intensity books */
+                case INTENSITY_HCB2:
+
+                    *intensity_used = 1;
+
+                    /* decode intensity position */
+                    t = rvlc_huffman_sf(ld_sf, ld_esc, +1);
+
+                    is_position += t;
+                    ics->scale_factors[g][sfb] = is_position;
+
+                    break;
+                case NOISE_HCB: /* noise books */
+
+                    /* decode noise energy */
+                    if (noise_pcm_flag)
+                    {
+                        int16_t n = ics->dpcm_noise_nrg;
+                        noise_pcm_flag = 0;
+                        noise_energy += n;
+                    } else {
+                        t = rvlc_huffman_sf(ld_sf, ld_esc, +1);
+                        noise_energy += t;
+                    }
+
+                    ics->scale_factors[g][sfb] = noise_energy;
+
+                    break;
+                default: /* spectral books */
+
+                    /* decode scale factor */
+                    t = rvlc_huffman_sf(ld_sf, ld_esc, +1);
+
+                    scale_factor += t;
+                    if (scale_factor < 0)
+                        return 4;
+
+                    ics->scale_factors[g][sfb] = scale_factor;
+
+                    break;
+                }
+#ifdef PRINT_RVLC
+                printf("%3d:%4d%4d\n", sfb, ics->sfb_cb[g][sfb],
+                    ics->scale_factors[g][sfb]);
+#endif
+                if (t == 99)
+                {
+                    error = 1;
+                }
+            }
+        }
+    }
+#ifdef PRINT_RVLC
+    printf("\n\n");
+#endif
+
+    return 0;
+}
+
+static uint8_t rvlc_decode_sf_reverse(ic_stream *ics, bitfile *ld_sf, bitfile *ld_esc,
+                                      uint8_t intensity_used)
+{
+    int8_t g, sfb;
+    int8_t t = 0;
+    int8_t error = 0;
+    int8_t noise_pcm_flag = 1, is_pcm_flag = 1, sf_pcm_flag = 1;
+
+    int16_t scale_factor = ics->rev_global_gain;
+    int16_t is_position = 0;
+    int16_t noise_energy = ics->rev_global_gain;
+
+#ifdef PRINT_RVLC
+    printf("\nrev_global_gain: %d\n", ics->rev_global_gain);
+#endif
+
+    if (intensity_used)
+    {
+        is_position = rvlc_huffman_sf(ld_sf, ld_esc, -1);
+#ifdef PRINT_RVLC
+        printf("is_position: %d\n", is_position);
+#endif
+    }
+
+    for (g = ics->num_window_groups-1; g >= 0; g--)
+    {
+        for (sfb = ics->max_sfb-1; sfb >= 0; sfb--)
+        {
+            if (error)
+            {
+                ics->scale_factors[g][sfb] = 0;
+            } else {
+                switch (ics->sfb_cb[g][sfb])
+                {
+                case ZERO_HCB: /* zero book */
+                    ics->scale_factors[g][sfb] = 0;
+                    break;
+                case INTENSITY_HCB: /* intensity books */
+                case INTENSITY_HCB2:
+
+                    if (is_pcm_flag)
+                    {
+                        is_pcm_flag = 0;
+                        ics->scale_factors[g][sfb] = is_position;
+                    } else {
+                        t = rvlc_huffman_sf(ld_sf, ld_esc, -1);
+                        is_position -= t;
+
+                        ics->scale_factors[g][sfb] = is_position;
+                    }
+
+                    break;
+                case NOISE_HCB: /* noise books */
+
+                    /* decode noise energy */
+                    if (noise_pcm_flag)
+                    {
+                        noise_pcm_flag = 0;
+                        noise_energy = ics->dpcm_noise_last_position;
+                    } else {
+                        t = rvlc_huffman_sf(ld_sf, ld_esc, -1);
+                        noise_energy -= t;
+                    }
+
+                    ics->scale_factors[g][sfb] = noise_energy;
+
+                    break;
+                default: /* spectral books */
+
+                    if (sf_pcm_flag || (sfb == 0))
+                    {
+                        sf_pcm_flag = 0;
+                        if (sfb == 0)
+                            scale_factor = ics->global_gain;
+                    } else {
+                        /* decode scale factor */
+                        t = rvlc_huffman_sf(ld_sf, ld_esc, -1);
+                        scale_factor -= t;
+                    }
+
+                    ics->scale_factors[g][sfb] = scale_factor;
+
+                    if (scale_factor < 0)
+                        return 4;
+
+                    break;
+                }
+#ifdef PRINT_RVLC
+                printf("%3d:%4d%4d\n", sfb, ics->sfb_cb[g][sfb],
+                    ics->scale_factors[g][sfb]);
+#endif
+                if (t == 99)
+                {
+                    error = 1;
+                }
+            }
+        }
+    }
+
+#ifdef PRINT_RVLC
+    printf("\n\n");
+#endif
+
+    return 0;
+}
+
+/* index == 99 means not allowed codeword */
+static rvlc_huff_table book_rvlc[] = {
+    /*index  length  codeword */
+    {  0, 1,   0 }, /*         0 */
+    { -1, 3,   5 }, /*       101 */
+    {  1, 3,   7 }, /*       111 */
+    { -2, 4,   9 }, /*      1001 */
+    { -3, 5,  17 }, /*     10001 */
+    {  2, 5,  27 }, /*     11011 */
+    { -4, 6,  33 }, /*    100001 */
+    { 99, 6,  50 }, /*    110010 */
+    {  3, 6,  51 }, /*    110011 */
+    { 99, 6,  52 }, /*    110100 */
+    { -7, 7,  65 }, /*   1000001 */
+    { 99, 7,  96 }, /*   1100000 */
+    { 99, 7,  98 }, /*   1100010 */
+    {  7, 7,  99 }, /*   1100011 */
+    {  4, 7, 107 }, /*   1101011 */
+    { -5, 8, 129 }, /*  10000001 */
+    { 99, 8, 194 }, /*  11000010 */
+    {  5, 8, 195 }, /*  11000011 */
+    { 99, 8, 212 }, /*  11010100 */
+    { 99, 9, 256 }, /* 100000000 */
+    { -6, 9, 257 }, /* 100000001 */
+    { 99, 9, 426 }, /* 110101010 */
+    {  6, 9, 427 }, /* 110101011 */
+    { 99, 10,  0 } /* Shouldn't come this far */
+};
+
+static rvlc_huff_table book_escape[] = {
+    /*index  length  codeword */
+    { 1, 2, 0 },
+    { 0, 2, 2 },
+    { 3, 3, 2 },
+    { 2, 3, 6 },
+    { 4, 4, 14 },
+    { 7, 5, 13 },
+    { 6, 5, 15 },
+    { 5, 5, 31 },
+    { 11, 6, 24 },
+    { 10, 6, 25 },
+    { 9, 6, 29 },
+    { 8, 6, 61 },
+    { 13, 7, 56  },
+    { 12, 7, 120 },
+    { 15, 8, 114 },
+    { 14, 8, 242 },
+    { 17, 9, 230 },
+    { 16, 9, 486 },
+    { 19, 10, 463  },
+    { 18, 10, 974  },
+    { 22, 11, 925  },
+    { 20, 11, 1950 },
+    { 21, 11, 1951 },
+    { 23, 12, 1848 },
+    { 25, 13, 3698 },
+    { 24, 14, 7399 },
+    { 26, 15, 14797 },
+    { 49, 19, 236736 },
+    { 50, 19, 236737 },
+    { 51, 19, 236738 },
+    { 52, 19, 236739 },
+    { 53, 19, 236740 },
+    { 27, 20, 473482 },
+    { 28, 20, 473483 },
+    { 29, 20, 473484 },
+    { 30, 20, 473485 },
+    { 31, 20, 473486 },
+    { 32, 20, 473487 },
+    { 33, 20, 473488 },
+    { 34, 20, 473489 },
+    { 35, 20, 473490 },
+    { 36, 20, 473491 },
+    { 37, 20, 473492 },
+    { 38, 20, 473493 },
+    { 39, 20, 473494 },
+    { 40, 20, 473495 },
+    { 41, 20, 473496 },
+    { 42, 20, 473497 },
+    { 43, 20, 473498 },
+    { 44, 20, 473499 },
+    { 45, 20, 473500 },
+    { 46, 20, 473501 },
+    { 47, 20, 473502 },
+    { 48, 20, 473503 },
+    { 99, 21,  0 } /* Shouldn't come this far */
+};
+
+static int8_t rvlc_huffman_sf(bitfile *ld_sf, bitfile *ld_esc,
+                              int8_t direction)
+{
+    uint8_t i, j;
+    int8_t index;
+    uint32_t cw;
+    rvlc_huff_table *h = book_rvlc;
+    
+    i = h->len;
+    if (direction > 0)
+        cw = faad_getbits(ld_sf, i DEBUGVAR(1,0,""));
+    else
+        cw = faad_getbits_rev(ld_sf, i DEBUGVAR(1,0,""));
+
+    while ((cw != h->cw)
+        && (i < 10))
+    {
+        h++;
+        j = h->len-i;
+        i += j;
+        cw <<= j;
+        if (direction > 0)
+            cw |= faad_getbits(ld_sf, j DEBUGVAR(1,0,""));
+        else
+            cw |= faad_getbits_rev(ld_sf, j DEBUGVAR(1,0,""));
+    }
+
+    index = h->index;
+
+    if (index == +ESC_VAL)
+    {
+        int8_t esc = rvlc_huffman_esc(ld_esc, direction);
+        if (esc == 99)
+            return 99;
+        index += esc;
+#ifdef PRINT_RVLC
+        printf("esc: %d - ", esc);
+#endif
+    }
+    if (index == -ESC_VAL)
+    {
+        int8_t esc = rvlc_huffman_esc(ld_esc, direction);
+        if (esc == 99)
+            return 99;
+        index -= esc;
+#ifdef PRINT_RVLC
+        printf("esc: %d - ", esc);
+#endif
+    }
+
+    return index;
+}
+
+static int8_t rvlc_huffman_esc(bitfile *ld,
+                               int8_t direction)
+{
+    uint8_t i, j;
+    uint32_t cw;
+    rvlc_huff_table *h = book_escape;
+
+    i = h->len;
+    if (direction > 0)
+        cw = faad_getbits(ld, i DEBUGVAR(1,0,""));
+    else
+        cw = faad_getbits_rev(ld, i DEBUGVAR(1,0,""));
+
+    while ((cw != h->cw)
+        && (i < 21))
+    {
+        h++;
+        j = h->len-i;
+        i += j;
+        cw <<= j;
+        if (direction > 0)
+            cw |= faad_getbits(ld, j DEBUGVAR(1,0,""));
+        else
+            cw |= faad_getbits_rev(ld, j DEBUGVAR(1,0,""));
+    }
+
+    return h->index;
+}
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/rvlc.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,65 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: rvlc.h,v 1.2 2003/07/29 08:20:13 menno Exp $
+**/
+
+#ifndef __RVLC_SCF_H__
+#define __RVLC_SCF_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct
+{
+    int8_t index;
+    uint8_t len;
+    uint32_t cw;
+} rvlc_huff_table;
+
+
+#define ESC_VAL 7
+
+
+uint8_t rvlc_scale_factor_data(ic_stream *ics, bitfile *ld);
+uint8_t rvlc_decode_scale_factors(ic_stream *ics, bitfile *ld);
+
+static uint8_t rvlc_decode_sf_forward(ic_stream *ics,
+                                      bitfile *ld_sf,
+                                      bitfile *ld_esc,
+                                      uint8_t *is_used);
+static uint8_t rvlc_decode_sf_reverse(ic_stream *ics,
+                                      bitfile *ld_sf,
+                                      bitfile *ld_esc,
+                                      uint8_t is_used);
+static int8_t rvlc_huffman_sf(bitfile *ld_sf, bitfile *ld_esc,
+                              int8_t direction);
+static int8_t rvlc_huffman_esc(bitfile *ld_esc, int8_t direction);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/sbr_dct.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,4274 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_dct.c,v 1.1 2003/07/29 08:20:13 menno Exp $
+**/
+
+#include "common.h"
+
+#ifdef SBR_DEC
+
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+
+#define MUL_C_R(B,A) MUL_R_C(A,B)
+
+#include "sbr_dct.h"
+
+#ifdef SBR_LOW_POWER
+
+void DCT3_32_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, 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;
+
+    f0 = MUL_C_R(COEF_CONST(0.7071067811865476), x[16]);
+    f1 = x[0] - f0;
+    f2 = x[0] + f0;
+    f3 = x[8] + x[24];
+    f4 = MUL_C_R(COEF_CONST(1.3065629648763766), x[8]);
+    f5 = MUL_C_R(COEF_CONST((-0.9238795325112866)), f3);
+    f6 = MUL_C_R(COEF_CONST((-0.5411961001461967)), x[24]);
+    f7 = f4 + f5;
+    f8 = f6 - f5;
+    f9 = f2 - f8;
+    f10 = f2 + f8;
+    f11 = f1 - f7;
+    f12 = f1 + f7;
+    f13 = x[4] + x[28];
+    f14 = MUL_C_R(COEF_CONST(1.1758756024193588), x[4]);
+    f15 = MUL_C_R(COEF_CONST((-0.9807852804032304)), f13);
+    f16 = MUL_C_R(COEF_CONST((-0.7856949583871021)), x[28]);
+    f17 = f14 + f15;
+    f18 = f16 - f15;
+    f19 = x[12] + x[20];
+    f20 = MUL_C_R(COEF_CONST(1.3870398453221473), x[12]);
+    f21 = MUL_C_R(COEF_CONST((-0.8314696123025455)), f19);
+    f22 = MUL_C_R(COEF_CONST((-0.2758993792829436)), x[20]);
+    f23 = f20 + f21;
+    f24 = f22 - f21;
+    f25 = f18 - f24;
+    f26 = f18 + f24;
+    f27 = MUL_C_R(COEF_CONST(0.7071067811865476), f25);
+    f28 = f17 - f23;
+    f29 = f17 + f23;
+    f30 = MUL_C_R(COEF_CONST(0.7071067811865476), f29);
+    f31 = f27 - f30;
+    f32 = f27 + f30;
+    f33 = f10 - f26;
+    f34 = f10 + f26;
+    f35 = f12 - f32;
+    f36 = f12 + f32;
+    f37 = f11 - f31;
+    f38 = f11 + f31;
+    f39 = f9 - f28;
+    f40 = f9 + f28;
+    f41 = x[2] + x[30];
+    f42 = MUL_C_R(COEF_CONST(1.0932018670017569), x[2]);
+    f43 = MUL_C_R(COEF_CONST((-0.9951847266721969)), f41);
+    f44 = MUL_C_R(COEF_CONST((-0.8971675863426368)), x[30]);
+    f45 = f42 + f43;
+    f46 = f44 - f43;
+    f47 = x[6] + x[26];
+    f48 = MUL_C_R(COEF_CONST(1.2472250129866711), x[6]);
+    f49 = MUL_C_R(COEF_CONST((-0.9569403357322089)), f47);
+    f50 = MUL_C_R(COEF_CONST((-0.6666556584777469)), x[26]);
+    f51 = f48 + f49;
+    f52 = f50 - f49;
+    f53 = x[10] + x[22];
+    f54 = MUL_C_R(COEF_CONST(1.3533180011743526), x[10]);
+    f55 = MUL_C_R(COEF_CONST((-0.8819212643483551)), f53);
+    f56 = MUL_C_R(COEF_CONST((-0.4105245275223575)), x[22]);
+    f57 = f54 + f55;
+    f58 = f56 - f55;
+    f59 = x[14] + x[18];
+    f60 = MUL_C_R(COEF_CONST(1.4074037375263826), x[14]);
+    f61 = MUL_C_R(COEF_CONST((-0.7730104533627369)), f59);
+    f62 = MUL_C_R(COEF_CONST((-0.1386171691990913)), x[18]);
+    f63 = f60 + f61;
+    f64 = f62 - f61;
+    f65 = f46 - f64;
+    f66 = f46 + f64;
+    f67 = f52 - f58;
+    f68 = f52 + f58;
+    f69 = f66 - f68;
+    f70 = f66 + f68;
+    f71 = MUL_C_R(COEF_CONST(0.7071067811865476), f69);
+    f72 = f65 + f67;
+    f73 = MUL_C_R(COEF_CONST(1.3065629648763766), f65);
+    f74 = MUL_C_R(COEF_CONST((-0.9238795325112866)), f72);
+    f75 = MUL_C_R(COEF_CONST((-0.5411961001461967)), f67);
+    f76 = f73 + f74;
+    f77 = f75 - f74;
+    f78 = f45 - f63;
+    f79 = f45 + f63;
+    f80 = f51 - f57;
+    f81 = f51 + f57;
+    f82 = f79 + f81;
+    f83 = MUL_C_R(COEF_CONST(1.3065629648763770), f79);
+    f84 = MUL_C_R(COEF_CONST((-0.3826834323650904)), f82);
+    f85 = MUL_C_R(COEF_CONST(0.5411961001461961), f81);
+    f86 = f83 + f84;
+    f87 = f85 - f84;
+    f88 = f78 - f80;
+    f89 = f78 + f80;
+    f90 = MUL_C_R(COEF_CONST(0.7071067811865476), f89);
+    f91 = f77 - f87;
+    f92 = f77 + f87;
+    f93 = f71 - f90;
+    f94 = f71 + f90;
+    f95 = f76 - f86;
+    f96 = f76 + f86;
+    f97 = f34 - f70;
+    f98 = f34 + f70;
+    f99 = f36 - f92;
+    f100 = f36 + f92;
+    f101 = f38 - f91;
+    f102 = f38 + f91;
+    f103 = f40 - f94;
+    f104 = f40 + f94;
+    f105 = f39 - f93;
+    f106 = f39 + f93;
+    f107 = f37 - f96;
+    f108 = f37 + f96;
+    f109 = f35 - f95;
+    f110 = f35 + f95;
+    f111 = f33 - f88;
+    f112 = f33 + f88;
+    f113 = x[1] + x[31];
+    f114 = MUL_C_R(COEF_CONST(1.0478631305325901), x[1]);
+    f115 = MUL_C_R(COEF_CONST((-0.9987954562051724)), f113);
+    f116 = MUL_C_R(COEF_CONST((-0.9497277818777548)), x[31]);
+    f117 = f114 + f115;
+    f118 = f116 - f115;
+    f119 = x[5] + x[27];
+    f120 = MUL_C_R(COEF_CONST(1.2130114330978077), x[5]);
+    f121 = MUL_C_R(COEF_CONST((-0.9700312531945440)), f119);
+    f122 = MUL_C_R(COEF_CONST((-0.7270510732912803)), x[27]);
+    f123 = f120 + f121;
+    f124 = f122 - f121;
+    f125 = x[9] + x[23];
+    f126 = MUL_C_R(COEF_CONST(1.3315443865537255), x[9]);
+    f127 = MUL_C_R(COEF_CONST((-0.9039892931234433)), f125);
+    f128 = MUL_C_R(COEF_CONST((-0.4764341996931612)), x[23]);
+    f129 = f126 + f127;
+    f130 = f128 - f127;
+    f131 = x[13] + x[19];
+    f132 = MUL_C_R(COEF_CONST(1.3989068359730781), x[13]);
+    f133 = MUL_C_R(COEF_CONST((-0.8032075314806453)), f131);
+    f134 = MUL_C_R(COEF_CONST((-0.2075082269882124)), x[19]);
+    f135 = f132 + f133;
+    f136 = f134 - f133;
+    f137 = x[17] + x[15];
+    f138 = MUL_C_R(COEF_CONST(1.4125100802019777), x[17]);
+    f139 = MUL_C_R(COEF_CONST((-0.6715589548470187)), f137);
+    f140 = MUL_C_R(COEF_CONST(0.0693921705079402), x[15]);
+    f141 = f138 + f139;
+    f142 = f140 - f139;
+    f143 = x[21] + x[11];
+    f144 = MUL_C_R(COEF_CONST(1.3718313541934939), x[21]);
+    f145 = MUL_C_R(COEF_CONST((-0.5141027441932219)), f143);
+    f146 = MUL_C_R(COEF_CONST(0.3436258658070501), x[11]);
+    f147 = f144 + f145;
+    f148 = f146 - f145;
+    f149 = x[25] + x[7];
+    f150 = MUL_C_R(COEF_CONST(1.2784339185752409), x[25]);
+    f151 = MUL_C_R(COEF_CONST((-0.3368898533922200)), f149);
+    f152 = MUL_C_R(COEF_CONST(0.6046542117908008), x[7]);
+    f153 = f150 + f151;
+    f154 = f152 - f151;
+    f155 = x[29] + x[3];
+    f156 = MUL_C_R(COEF_CONST(1.1359069844201433), x[29]);
+    f157 = MUL_C_R(COEF_CONST((-0.1467304744553624)), f155);
+    f158 = MUL_C_R(COEF_CONST(0.8424460355094185), x[3]);
+    f159 = f156 + f157;
+    f160 = f158 - f157;
+    f161 = f118 - f142;
+    f162 = f118 + f142;
+    f163 = f117 - f141;
+    f164 = f117 + f141;
+    f165 = f124 - f148;
+    f166 = f124 + f148;
+    f167 = f123 - f147;
+    f168 = f123 + f147;
+    f169 = f130 - f154;
+    f170 = f130 + f154;
+    f171 = f129 - f153;
+    f172 = f129 + f153;
+    f173 = f136 - f160;
+    f174 = f136 + f160;
+    f175 = f135 - f159;
+    f176 = f135 + f159;
+    f177 = f161 + f163;
+    f178 = MUL_C_R(COEF_CONST(1.1758756024193588), f161);
+    f179 = MUL_C_R(COEF_CONST((-0.9807852804032304)), f177);
+    f180 = MUL_C_R(COEF_CONST((-0.7856949583871021)), f163);
+    f181 = f178 + f179;
+    f182 = f180 - f179;
+    f183 = f165 + f167;
+    f184 = MUL_C_R(COEF_CONST(1.3870398453221475), f165);
+    f185 = MUL_C_R(COEF_CONST((-0.5555702330196022)), f183);
+    f186 = MUL_C_R(COEF_CONST(0.2758993792829431), f167);
+    f187 = f184 + f185;
+    f188 = f186 - f185;
+    f189 = f169 + f171;
+    f190 = MUL_C_R(COEF_CONST(0.7856949583871022), f169);
+    f191 = MUL_C_R(COEF_CONST(0.1950903220161283), f189);
+    f192 = MUL_C_R(COEF_CONST(1.1758756024193586), f171);
+    f193 = f190 + f191;
+    f194 = f192 - f191;
+    f195 = f173 + f175;
+    f196 = MUL_C_R(COEF_CONST((-0.2758993792829430)), f173);
+    f197 = MUL_C_R(COEF_CONST(0.8314696123025452), f195);
+    f198 = MUL_C_R(COEF_CONST(1.3870398453221475), f175);
+    f199 = f196 + f197;
+    f200 = f198 - f197;
+    f201 = f162 - f170;
+    f202 = f162 + f170;
+    f203 = f164 - f172;
+    f204 = f164 + f172;
+    f205 = f166 - f174;
+    f206 = f166 + f174;
+    f207 = f168 - f176;
+    f208 = f168 + f176;
+    f209 = f182 - f194;
+    f210 = f182 + f194;
+    f211 = f181 - f193;
+    f212 = f181 + f193;
+    f213 = f188 - f200;
+    f214 = f188 + f200;
+    f215 = f187 - f199;
+    f216 = f187 + f199;
+    f217 = f201 + f203;
+    f218 = MUL_C_R(COEF_CONST(1.3065629648763766), f201);
+    f219 = MUL_C_R(COEF_CONST((-0.9238795325112866)), f217);
+    f220 = MUL_C_R(COEF_CONST((-0.5411961001461967)), f203);
+    f221 = f218 + f219;
+    f222 = f220 - f219;
+    f223 = f205 + f207;
+    f224 = MUL_C_R(COEF_CONST(0.5411961001461969), f205);
+    f225 = MUL_C_R(COEF_CONST(0.3826834323650898), f223);
+    f226 = MUL_C_R(COEF_CONST(1.3065629648763766), f207);
+    f227 = f224 + f225;
+    f228 = f226 - f225;
+    f229 = f209 + f211;
+    f230 = MUL_C_R(COEF_CONST(1.3065629648763766), f209);
+    f231 = MUL_C_R(COEF_CONST((-0.9238795325112866)), f229);
+    f232 = MUL_C_R(COEF_CONST((-0.5411961001461967)), f211);
+    f233 = f230 + f231;
+    f234 = f232 - f231;
+    f235 = f213 + f215;
+    f236 = MUL_C_R(COEF_CONST(0.5411961001461969), f213);
+    f237 = MUL_C_R(COEF_CONST(0.3826834323650898), f235);
+    f238 = MUL_C_R(COEF_CONST(1.3065629648763766), f215);
+    f239 = f236 + f237;
+    f240 = f238 - f237;
+    f241 = f202 - f206;
+    f242 = f202 + f206;
+    f243 = f204 - f208;
+    f244 = f204 + f208;
+    f245 = f222 - f228;
+    f246 = f222 + f228;
+    f247 = f221 - f227;
+    f248 = f221 + f227;
+    f249 = f210 - f214;
+    f250 = f210 + f214;
+    f251 = f212 - f216;
+    f252 = f212 + f216;
+    f253 = f234 - f240;
+    f254 = f234 + f240;
+    f255 = f233 - f239;
+    f256 = f233 + f239;
+    f257 = f241 - f243;
+    f258 = f241 + f243;
+    f259 = MUL_C_R(COEF_CONST(0.7071067811865474), f257);
+    f260 = MUL_C_R(COEF_CONST(0.7071067811865474), f258);
+    f261 = f245 - f247;
+    f262 = f245 + f247;
+    f263 = MUL_C_R(COEF_CONST(0.7071067811865474), f261);
+    f264 = MUL_C_R(COEF_CONST(0.7071067811865474), f262);
+    f265 = f249 - f251;
+    f266 = f249 + f251;
+    f267 = MUL_C_R(COEF_CONST(0.7071067811865474), f265);
+    f268 = MUL_C_R(COEF_CONST(0.7071067811865474), f266);
+    f269 = f253 - f255;
+    f270 = f253 + f255;
+    f271 = MUL_C_R(COEF_CONST(0.7071067811865474), f269);
+    f272 = MUL_C_R(COEF_CONST(0.7071067811865474), f270);
+    y[31] = f98 - f242;
+    y[0] = f98 + f242;
+    y[30] = f100 - f250;
+    y[1] = f100 + f250;
+    y[29] = f102 - f254;
+    y[2] = f102 + f254;
+    y[28] = f104 - f246;
+    y[3] = f104 + f246;
+    y[27] = f106 - f264;
+    y[4] = f106 + f264;
+    y[26] = f108 - f272;
+    y[5] = f108 + f272;
+    y[25] = f110 - f268;
+    y[6] = f110 + f268;
+    y[24] = f112 - f260;
+    y[7] = f112 + f260;
+    y[23] = f111 - f259;
+    y[8] = f111 + f259;
+    y[22] = f109 - f267;
+    y[9] = f109 + f267;
+    y[21] = f107 - f271;
+    y[10] = f107 + f271;
+    y[20] = f105 - f263;
+    y[11] = f105 + f263;
+    y[19] = f103 - f248;
+    y[12] = f103 + f248;
+    y[18] = f101 - f256;
+    y[13] = f101 + f256;
+    y[17] = f99 - f252;
+    y[14] = f99 + f252;
+    y[16] = f97 - f244;
+    y[15] = f97 + f244;
+}
+
+void DCT2_64_unscaled(real_t *y, real_t *x)
+{
+    int16_t i0;
+    real_t 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, f85, f86;
+    real_t f87, f88, 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, f127, f128;
+    real_t f129, f130, f133, f134, f135, f136, f139, f140, f141, f142;
+    real_t f145, f146, f147, f148, 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;
+    real_t f177, f178, f179, f180, f181, f182, f183, f184, f185, f186;
+    real_t f187, f188, f189, f190, f191, f192, f193, f194, f195, f196;
+    real_t f197, f198, f199, f200, f201, f202, f203, f204, f205, f206;
+    real_t f207, f208, f209, f210, f211, f213, f214, f215, f216, f217;
+    real_t f218, f219, f220, f221, f222, f223, f224, f225, f226, f227;
+    real_t f228, f229, f230, f231, f232, f233, f234, f235, f236, f237;
+    real_t f238, f239, f240, f241, f242, f243, f244, f245, f246, f247;
+    real_t f248, f249, f250, f251, f252, f253, f254, f255, f256, f257;
+    real_t f258, f259, f260, f261, f262, f263, f264, f265, f266, f267;
+    real_t f268, f269, f270, f271, f272, f273, f274, f275, f276, f277;
+    real_t f279, f280, f295, f296, f297, f298, f299, f300, f301, f302;
+    real_t f303, f304, f305, f306, 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, f432;
+    real_t f433, f434, f435, f436, f437, f438, f439, f440, f441, f442;
+    real_t f443, f444, f445, f446, f447, f448, f449, f450, f451, f452;
+    real_t f453, f454, f455, f456, f457, f458, f459, f460, f461, f462;
+    real_t f463, f464, f465, f466, f467, f468, f469, f470, f471, f472;
+    real_t f473, f474, f475, f476, f477, f478, f479, f480, f481, f482;
+    real_t f483, f484, f485, f486, f487, f488, f489, f490, f491, f492;
+    real_t f493, f494, f495, f496, f497, f498, f499, f500, f501, f502;
+    real_t f503, f504, f505, f506, f507, f508, f509, f510, f511, f512;
+    real_t f513, f514, f515, f516, f517, f518, f519, f520, f521, f522;
+    real_t f523, f524, f525, f526, f527, f528, f529, f530, f531, f532;
+    real_t f533, f534, f535, f536, f537, f538, f539, f540, f541, f542;
+    real_t f543, f544, f545, f546, f547, f548, f549, f550, f551, f552;
+    real_t f553, f554, f557, f558, f559, f560, f563, f564, f565, f566;
+    real_t f569, f570, f571, f572, f575, f576, f577, f578, f581, f582;
+    real_t f583, f584, f587, f588, f589, f590, f593, f594, f595, f596;
+    real_t f599, f600, f601, f602, f605, f606, f607, f608, f611, f612;
+    real_t f613, f614, f617, f618, f619, f620, f623, f624, f625, f626;
+    real_t f629, f630, f631, f632, f635, f636, f637, f638, f641, f642;
+    real_t f643, f644;
+    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[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_R(COEF_CONST(0.7071067811865476), f62);
+    f65 = f58 + f60;
+    f66 = MUL_C_R(COEF_CONST(1.3065629648763766), f58);
+    f67 = MUL_C_R(COEF_CONST((-0.9238795325112866)), f65);
+    f68 = MUL_C_R(COEF_CONST((-0.5411961001461967)), f60);
+    y[48] = f66 + f67;
+    y[16] = f68 - f67;
+    f71 = f52 - f54;
+    f72 = f52 + f54;
+    f73 = MUL_C_R(COEF_CONST(0.7071067811865476), f72);
+    f74 = MUL_C_R(COEF_CONST(0.7071067811865476), f71);
+    f75 = f50 - f73;
+    f76 = f50 + f73;
+    f77 = f56 - f74;
+    f78 = f56 + f74;
+    f79 = f78 + f76;
+    f80 = MUL_C_R(COEF_CONST((-0.7856949583871021)), f78);
+    f81 = MUL_C_R(COEF_CONST(0.9807852804032304), f79);
+    f82 = MUL_C_R(COEF_CONST(1.1758756024193588), f76);
+    y[8] = f80 + f81;
+    y[56] = f82 - f81;
+    f85 = f77 + f75;
+    f86 = MUL_C_R(COEF_CONST(0.2758993792829431), f77);
+    f87 = MUL_C_R(COEF_CONST(0.5555702330196022), f85);
+    f88 = MUL_C_R(COEF_CONST(1.3870398453221475), f75);
+    y[40] = f86 + f87;
+    y[24] = f88 - f87;
+    f91 = f40 - f42;
+    f92 = f40 + f42;
+    f93 = MUL_C_R(COEF_CONST(0.7071067811865476), f92);
+    f94 = MUL_C_R(COEF_CONST(0.7071067811865476), f91);
+    f95 = f38 - f44;
+    f96 = f38 + f44;
+    f97 = MUL_C_R(COEF_CONST(0.7071067811865476), f96);
+    f98 = MUL_C_R(COEF_CONST(0.7071067811865476), f95);
+    f99 = f34 - f93;
+    f100 = f34 + f93;
+    f101 = f48 - f94;
+    f102 = f48 + f94;
+    f103 = f36 - f97;
+    f104 = f36 + f97;
+    f105 = f46 - f98;
+    f106 = f46 + f98;
+    f107 = f106 + f104;
+    f108 = MUL_C_R(COEF_CONST((-0.5411961001461969)), f106);
+    f109 = MUL_C_R(COEF_CONST(0.9238795325112867), f107);
+    f110 = MUL_C_R(COEF_CONST(1.3065629648763766), f104);
+    f111 = f108 + f109;
+    f112 = f110 - f109;
+    f113 = f105 + f103;
+    f114 = MUL_C_R(COEF_CONST(1.3065629648763770), f105);
+    f115 = MUL_C_R(COEF_CONST((-0.3826834323650904)), f113);
+    f116 = MUL_C_R(COEF_CONST(0.5411961001461961), f103);
+    f117 = f114 + f115;
+    f118 = f116 - f115;
+    f119 = f100 - f111;
+    f120 = f100 + f111;
+    f121 = f102 - f112;
+    f122 = f102 + f112;
+    f123 = f99 - f117;
+    f124 = f99 + f117;
+    f125 = f101 - f118;
+    f126 = f101 + f118;
+    f127 = f122 + f120;
+    f128 = MUL_C_R(COEF_CONST((-0.8971675863426361)), f122);
+    f129 = MUL_C_R(COEF_CONST(0.9951847266721968), f127);
+    f130 = MUL_C_R(COEF_CONST(1.0932018670017576), f120);
+    y[4] = f128 + f129;
+    y[60] = f130 - f129;
+    f133 = f126 + f124;
+    f134 = MUL_C_R(COEF_CONST((-0.4105245275223571)), f126);
+    f135 = MUL_C_R(COEF_CONST(0.8819212643483549), f133);
+    f136 = MUL_C_R(COEF_CONST(1.3533180011743529), f124);
+    y[20] = f134 + f135;
+    y[44] = f136 - f135;
+    f139 = f121 + f119;
+    f140 = MUL_C_R(COEF_CONST(0.1386171691990915), f121);
+    f141 = MUL_C_R(COEF_CONST(0.6343932841636455), f139);
+    f142 = MUL_C_R(COEF_CONST(1.4074037375263826), f119);
+    y[36] = f140 + f141;
+    y[28] = f142 - f141;
+    f145 = f125 + f123;
+    f146 = MUL_C_R(COEF_CONST(0.6666556584777466), f125);
+    f147 = MUL_C_R(COEF_CONST(0.2902846772544623), f145);
+    f148 = MUL_C_R(COEF_CONST(1.2472250129866711), f123);
+    y[52] = f146 + f147;
+    y[12] = f148 - f147;
+    f151 = f2 + f32;
+    f152 = MUL_C_R(COEF_CONST(1.0478631305325901), f2);
+    f153 = MUL_C_R(COEF_CONST((-0.9987954562051724)), f151);
+    f154 = MUL_C_R(COEF_CONST((-0.9497277818777548)), f32);
+    f155 = f152 + f153;
+    f156 = f154 - f153;
+    f157 = f4 + f30;
+    f158 = MUL_C_R(COEF_CONST(1.1359069844201428), f4);
+    f159 = MUL_C_R(COEF_CONST((-0.9891765099647809)), f157);
+    f160 = MUL_C_R(COEF_CONST((-0.8424460355094190)), f30);
+    f161 = f158 + f159;
+    f162 = f160 - f159;
+    f163 = f6 + f28;
+    f164 = MUL_C_R(COEF_CONST(1.2130114330978077), f6);
+    f165 = MUL_C_R(COEF_CONST((-0.9700312531945440)), f163);
+    f166 = MUL_C_R(COEF_CONST((-0.7270510732912803)), f28);
+    f167 = f164 + f165;
+    f168 = f166 - f165;
+    f169 = f8 + f26;
+    f170 = MUL_C_R(COEF_CONST(1.2784339185752405), f8);
+    f171 = MUL_C_R(COEF_CONST((-0.9415440651830209)), f169);
+    f172 = MUL_C_R(COEF_CONST((-0.6046542117908014)), f26);
+    f173 = f170 + f171;
+    f174 = f172 - f171;
+    f175 = f10 + f24;
+    f176 = MUL_C_R(COEF_CONST(1.3315443865537255), f10);
+    f177 = MUL_C_R(COEF_CONST((-0.9039892931234433)), f175);
+    f178 = MUL_C_R(COEF_CONST((-0.4764341996931612)), f24);
+    f179 = f176 + f177;
+    f180 = f178 - f177;
+    f181 = f12 + f22;
+    f182 = MUL_C_R(COEF_CONST(1.3718313541934939), f12);
+    f183 = MUL_C_R(COEF_CONST((-0.8577286100002722)), f181);
+    f184 = MUL_C_R(COEF_CONST((-0.3436258658070507)), f22);
+    f185 = f182 + f183;
+    f186 = f184 - f183;
+    f187 = f14 + f20;
+    f188 = MUL_C_R(COEF_CONST(1.3989068359730781), f14);
+    f189 = MUL_C_R(COEF_CONST((-0.8032075314806453)), f187);
+    f190 = MUL_C_R(COEF_CONST((-0.2075082269882124)), f20);
+    f191 = f188 + f189;
+    f192 = f190 - f189;
+    f193 = f16 + f18;
+    f194 = MUL_C_R(COEF_CONST(1.4125100802019774), f16);
+    f195 = MUL_C_R(COEF_CONST((-0.7409511253549591)), f193);
+    f196 = MUL_C_R(COEF_CONST((-0.0693921705079408)), f18);
+    f197 = f194 + f195;
+    f198 = f196 - f195;
+    f199 = f156 - f198;
+    f200 = f156 + f198;
+    f201 = f162 - f192;
+    f202 = f162 + f192;
+    f203 = f168 - f186;
+    f204 = f168 + f186;
+    f205 = f174 - f180;
+    f206 = f174 + f180;
+    f207 = f200 - f206;
+    f208 = f200 + f206;
+    f209 = f202 - f204;
+    f210 = f202 + f204;
+    f211 = f208 - f210;
+    y[2] = f208 + f210;
+    f213 = MUL_C_R(COEF_CONST(0.7071067811865476), f211);
+    f214 = f207 + f209;
+    f215 = MUL_C_R(COEF_CONST(1.3065629648763766), f207);
+    f216 = MUL_C_R(COEF_CONST((-0.9238795325112866)), f214);
+    f217 = MUL_C_R(COEF_CONST((-0.5411961001461967)), f209);
+    f218 = f215 + f216;
+    f219 = f217 - f216;
+    f220 = f201 - f203;
+    f221 = f201 + f203;
+    f222 = MUL_C_R(COEF_CONST(0.7071067811865476), f221);
+    f223 = MUL_C_R(COEF_CONST(0.7071067811865476), f220);
+    f224 = f199 - f222;
+    f225 = f199 + f222;
+    f226 = f205 - f223;
+    f227 = f205 + f223;
+    f228 = f227 + f225;
+    f229 = MUL_C_R(COEF_CONST((-0.7856949583871021)), f227);
+    f230 = MUL_C_R(COEF_CONST(0.9807852804032304), f228);
+    f231 = MUL_C_R(COEF_CONST(1.1758756024193588), f225);
+    f232 = f229 + f230;
+    f233 = f231 - f230;
+    f234 = f226 + f224;
+    f235 = MUL_C_R(COEF_CONST(0.2758993792829431), f226);
+    f236 = MUL_C_R(COEF_CONST(0.5555702330196022), f234);
+    f237 = MUL_C_R(COEF_CONST(1.3870398453221475), f224);
+    f238 = f235 + f236;
+    f239 = f237 - f236;
+    f240 = f155 - f197;
+    f241 = f155 + f197;
+    f242 = f161 - f191;
+    f243 = f161 + f191;
+    f244 = f167 - f185;
+    f245 = f167 + f185;
+    f246 = f173 - f179;
+    f247 = f173 + f179;
+    f248 = f245 - f243;
+    f249 = f245 + f243;
+    f250 = MUL_C_R(COEF_CONST(0.7071067811865476), f249);
+    f251 = f247 - f250;
+    f252 = f247 + f250;
+    f253 = MUL_C_R(COEF_CONST(0.7071067811865476), f248);
+    f254 = f253 - f241;
+    f255 = f253 + f241;
+    f256 = f255 + f252;
+    f257 = MUL_C_R(COEF_CONST((-0.7856949583871021)), f255);
+    f258 = MUL_C_R(COEF_CONST(0.9807852804032304), f256);
+    f259 = MUL_C_R(COEF_CONST(1.1758756024193588), f252);
+    f260 = f257 + f258;
+    f261 = f259 - f258;
+    f262 = f254 + f251;
+    f263 = MUL_C_R(COEF_CONST((-0.2758993792829430)), f254);
+    f264 = MUL_C_R(COEF_CONST(0.8314696123025452), f262);
+    f265 = MUL_C_R(COEF_CONST(1.3870398453221475), f251);
+    f266 = f263 + f264;
+    f267 = f265 - f264;
+    f268 = f240 - f246;
+    f269 = f240 + f246;
+    f270 = f242 - f244;
+    f271 = f242 + f244;
+    f272 = f269 + f271;
+    f273 = MUL_C_R(COEF_CONST(1.3065629648763770), f269);
+    f274 = MUL_C_R(COEF_CONST((-0.3826834323650904)), f272);
+    f275 = MUL_C_R(COEF_CONST(0.5411961001461961), f271);
+    f276 = f273 + f274;
+    f277 = f275 - f274;
+    y[62] = f268 - f270;
+    f279 = f268 + f270;
+    f280 = MUL_C_R(COEF_CONST(0.7071067811865476), f279);
+    y[10] = f232 - f260;
+    y[6] = f232 + f260;
+    y[18] = f219 - f277;
+    y[14] = f219 + f277;
+    y[26] = f239 + f266;
+    y[22] = f239 - f266;
+    y[34] = f213 - f280;
+    y[30] = f213 + f280;
+    y[42] = f238 - f267;
+    y[38] = f238 + f267;
+    y[50] = f218 - f276;
+    y[46] = f218 + f276;
+    y[58] = f233 + f261;
+    y[54] = f233 - f261;
+    f295 = t2[3] - t2[5];
+    f296 = t2[3] + t2[5];
+    f297 = t2[7] - t2[9];
+    f298 = t2[7] + t2[9];
+    f299 = t2[11] - t2[13];
+    f300 = t2[11] + t2[13];
+    f301 = t2[15] - t2[17];
+    f302 = t2[15] + t2[17];
+    f303 = t2[19] - t2[21];
+    f304 = t2[19] + t2[21];
+    f305 = t2[23] - t2[25];
+    f306 = t2[23] + t2[25];
+    f307 = t2[27] - t2[29];
+    f308 = t2[27] + t2[29];
+    f309 = t2[31] - t2[33];
+    f310 = t2[31] + t2[33];
+    f311 = t2[35] - t2[37];
+    f312 = t2[35] + t2[37];
+    f313 = t2[39] - t2[41];
+    f314 = t2[39] + t2[41];
+    f315 = t2[43] - t2[45];
+    f316 = t2[43] + t2[45];
+    f317 = t2[47] - t2[49];
+    f318 = t2[47] + t2[49];
+    f319 = t2[51] - t2[53];
+    f320 = t2[51] + t2[53];
+    f321 = t2[55] - t2[57];
+    f322 = t2[55] + t2[57];
+    f323 = t2[59] - t2[61];
+    f324 = t2[59] + t2[61];
+    f325 = MUL_C_R(COEF_CONST(0.7071067811865476), f310);
+    f326 = t2[1] - f325;
+    f327 = t2[1] + f325;
+    f328 = f302 + f318;
+    f329 = MUL_C_R(COEF_CONST(1.3065629648763766), f302);
+    f330 = MUL_C_R(COEF_CONST((-0.9238795325112866)), f328);
+    f331 = MUL_C_R(COEF_CONST((-0.5411961001461967)), f318);
+    f332 = f329 + f330;
+    f333 = f331 - f330;
+    f334 = f327 - f333;
+    f335 = f327 + f333;
+    f336 = f326 - f332;
+    f337 = f326 + f332;
+    f338 = f306 - f314;
+    f339 = f306 + f314;
+    f340 = MUL_C_R(COEF_CONST(0.7071067811865476), f339);
+    f341 = f298 - f340;
+    f342 = f298 + f340;
+    f343 = MUL_C_R(COEF_CONST(0.7071067811865476), f338);
+    f344 = f343 - f322;
+    f345 = f343 + f322;
+    f346 = f345 + f342;
+    f347 = MUL_C_R(COEF_CONST((-0.7856949583871021)), f345);
+    f348 = MUL_C_R(COEF_CONST(0.9807852804032304), f346);
+    f349 = MUL_C_R(COEF_CONST(1.1758756024193588), f342);
+    f350 = f347 + f348;
+    f351 = f349 - f348;
+    f352 = f344 + f341;
+    f353 = MUL_C_R(COEF_CONST((-0.2758993792829430)), f344);
+    f354 = MUL_C_R(COEF_CONST(0.8314696123025452), f352);
+    f355 = MUL_C_R(COEF_CONST(1.3870398453221475), f341);
+    f356 = f353 + f354;
+    f357 = f355 - f354;
+    f358 = f335 - f350;
+    f359 = f335 + f350;
+    f360 = f337 - f356;
+    f361 = f337 + f356;
+    f362 = f336 - f357;
+    f363 = f336 + f357;
+    f364 = f334 - f351;
+    f365 = f334 + f351;
+    f366 = MUL_C_R(COEF_CONST(5.1011486186891641), f296);
+    f367 = MUL_C_R(COEF_CONST(1.7224470982383342), f300);
+    f368 = MUL_C_R(COEF_CONST(1.0606776859903475), f304);
+    f369 = MUL_C_R(COEF_CONST(0.7881546234512502), f308);
+    f370 = MUL_C_R(COEF_CONST(0.5024192861881557), f324);
+    f371 = MUL_C_R(COEF_CONST(0.5224986149396889), f320);
+    f372 = MUL_C_R(COEF_CONST(0.5669440348163577), f316);
+    f373 = MUL_C_R(COEF_CONST(0.6468217833599901), f312);
+    f374 = f366 - f370;
+    f375 = f366 + f370;
+    f376 = f367 - f371;
+    f377 = f367 + f371;
+    f378 = f368 - f372;
+    f379 = f368 + f372;
+    f380 = f369 - f373;
+    f381 = f369 + f373;
+    f382 = MUL_C_R(COEF_CONST(0.5097955791041592), f375);
+    f383 = MUL_C_R(COEF_CONST(0.6013448869350453), f377);
+    f384 = MUL_C_R(COEF_CONST(0.8999762231364156), f379);
+    f385 = MUL_C_R(COEF_CONST(2.5629154477415055), f381);
+    f386 = f382 + f385;
+    f387 = f382 - f385;
+    f388 = f383 + f384;
+    f389 = f384 - f383;
+    f390 = f387 - f389;
+    f391 = f387 + f389;
+    f392 = MUL_C_R(COEF_CONST(0.7071067811865476), f390);
+    f393 = f386 - f388;
+    f394 = MUL_C_R(COEF_CONST(1.3065629648763766), f386);
+    f395 = MUL_C_R(COEF_CONST((-0.9238795325112866)), f393);
+    f396 = MUL_C_R(COEF_CONST((-0.5411961001461967)), f388);
+    f397 = f394 + f395;
+    f398 = f395 + f396;
+    f399 = f391 - f398;
+    f400 = f392 - f398;
+    f401 = f392 + f397;
+    f402 = f380 - f374;
+    f403 = f374 + f380;
+    f404 = f378 - f376;
+    f405 = f376 + f378;
+    f406 = f403 + f405;
+    f407 = MUL_C_R(COEF_CONST(1.3065629648763770), f403);
+    f408 = MUL_C_R(COEF_CONST((-0.3826834323650904)), f406);
+    f409 = MUL_C_R(COEF_CONST(0.5411961001461961), f405);
+    f410 = f407 + f408;
+    f411 = f408 - f409;
+    f412 = f402 - f404;
+    f413 = f402 + f404;
+    f414 = MUL_C_R(COEF_CONST(0.7071067811865476), f413);
+    f415 = f411 + f397;
+    f416 = f401 + f411;
+    f417 = f414 + f401;
+    f418 = f400 + f414;
+    f419 = f400 - f410;
+    f420 = f399 - f410;
+    f421 = f412 + f399;
+    f422 = f359 - f397;
+    f423 = f359 + f397;
+    f424 = f361 + f415;
+    f425 = f361 - f415;
+    f426 = f363 - f416;
+    f427 = f363 + f416;
+    f428 = f365 + f417;
+    f429 = f365 - f417;
+    f430 = f364 - f418;
+    f431 = f364 + f418;
+    f432 = f362 + f419;
+    f433 = f362 - f419;
+    f434 = f360 - f420;
+    f435 = f360 + f420;
+    f436 = f358 + f421;
+    f437 = f358 - f421;
+    f438 = MUL_C_R(COEF_CONST(5.1011486186891641), f295);
+    f439 = MUL_C_R(COEF_CONST(1.7224470982383342), f299);
+    f440 = MUL_C_R(COEF_CONST(1.0606776859903475), f303);
+    f441 = MUL_C_R(COEF_CONST(0.7881546234512502), f307);
+    f442 = MUL_C_R(COEF_CONST(0.5024192861881557), f323);
+    f443 = MUL_C_R(COEF_CONST(0.5224986149396889), f319);
+    f444 = MUL_C_R(COEF_CONST(0.5669440348163577), f315);
+    f445 = MUL_C_R(COEF_CONST(0.6468217833599901), f311);
+    f446 = f438 + f442;
+    f447 = f438 - f442;
+    f448 = f439 + f443;
+    f449 = f443 - f439;
+    f450 = f440 + f444;
+    f451 = f440 - f444;
+    f452 = f441 + f445;
+    f453 = f445 - f441;
+    f454 = MUL_C_R(COEF_CONST(0.5097955791041592), f447);
+    f455 = MUL_C_R(COEF_CONST(0.6013448869350453), f449);
+    f456 = MUL_C_R(COEF_CONST(0.8999762231364156), f451);
+    f457 = MUL_C_R(COEF_CONST(2.5629154477415055), f453);
+    f458 = f454 + f457;
+    f459 = f454 - f457;
+    f460 = f455 + f456;
+    f461 = f456 - f455;
+    f462 = f459 - f461;
+    f463 = f459 + f461;
+    f464 = MUL_C_R(COEF_CONST(0.7071067811865476), f462);
+    f465 = f458 - f460;
+    f466 = MUL_C_R(COEF_CONST(1.3065629648763766), f458);
+    f467 = MUL_C_R(COEF_CONST((-0.9238795325112866)), f465);
+    f468 = MUL_C_R(COEF_CONST((-0.5411961001461967)), f460);
+    f469 = f466 + f467;
+    f470 = f467 + f468;
+    f471 = f463 - f470;
+    f472 = f464 - f470;
+    f473 = f464 + f469;
+    f474 = f446 + f452;
+    f475 = f452 - f446;
+    f476 = f448 + f450;
+    f477 = f448 - f450;
+    f478 = f475 + f477;
+    f479 = MUL_C_R(COEF_CONST(1.3065629648763770), f475);
+    f480 = MUL_C_R(COEF_CONST((-0.3826834323650904)), f478);
+    f481 = MUL_C_R(COEF_CONST(0.5411961001461961), f477);
+    f482 = f479 + f480;
+    f483 = f481 - f480;
+    f484 = f474 + f476;
+    f485 = f476 - f474;
+    f486 = MUL_C_R(COEF_CONST(0.7071067811865476), f485);
+    f487 = f483 + f469;
+    f488 = f473 + f483;
+    f489 = f486 + f473;
+    f490 = f472 + f486;
+    f491 = f482 + f472;
+    f492 = f471 + f482;
+    f493 = f471 - f484;
+    f494 = MUL_C_R(COEF_CONST(0.7071067811865476), f309);
+    f495 = t2[63] - f494;
+    f496 = t2[63] + f494;
+    f497 = f317 + f301;
+    f498 = MUL_C_R(COEF_CONST(1.3065629648763766), f317);
+    f499 = MUL_C_R(COEF_CONST((-0.9238795325112866)), f497);
+    f500 = MUL_C_R(COEF_CONST((-0.5411961001461967)), f301);
+    f501 = f498 + f499;
+    f502 = f500 - f499;
+    f503 = f496 - f502;
+    f504 = f496 + f502;
+    f505 = f495 - f501;
+    f506 = f495 + f501;
+    f507 = MUL_C_R(COEF_CONST(0.5097955791041592), f321);
+    f508 = MUL_C_R(COEF_CONST(0.6013448869350453), f313);
+    f509 = MUL_C_R(COEF_CONST(0.8999762231364156), f305);
+    f510 = MUL_C_R(COEF_CONST(2.5629154477415055), f297);
+    f511 = f507 - f510;
+    f512 = f507 + f510;
+    f513 = f508 - f509;
+    f514 = f508 + f509;
+    f515 = f512 - f514;
+    f516 = f512 + f514;
+    f517 = MUL_C_R(COEF_CONST(0.7071067811865476), f515);
+    f518 = f511 + f513;
+    f519 = MUL_C_R(COEF_CONST(1.3065629648763766), f511);
+    f520 = MUL_C_R(COEF_CONST((-0.9238795325112866)), f518);
+    f521 = MUL_C_R(COEF_CONST((-0.5411961001461967)), f513);
+    f522 = f519 + f520;
+    f523 = f521 - f520;
+    f524 = f516 + f523;
+    f525 = f523 + f517;
+    f526 = f517 + f522;
+    f527 = f504 - f524;
+    f528 = f504 + f524;
+    f529 = f506 - f525;
+    f530 = f506 + f525;
+    f531 = f505 - f526;
+    f532 = f505 + f526;
+    f533 = f503 - f522;
+    f534 = f503 + f522;
+    f535 = f493 + f528;
+    f536 = f528 - f493;
+    f537 = f492 + f530;
+    f538 = f492 - f530;
+    f539 = f491 + f532;
+    f540 = f532 - f491;
+    f541 = f490 + f534;
+    f542 = f490 - f534;
+    f543 = f489 + f533;
+    f544 = f533 - f489;
+    f545 = f488 + f531;
+    f546 = f488 - f531;
+    f547 = f487 + f529;
+    f548 = f529 - f487;
+    f549 = f469 + f527;
+    f550 = f469 - f527;
+    f551 = f536 + f423;
+    f552 = MUL_C_R(COEF_CONST((-0.9751575901732920)), f536);
+    f553 = MUL_C_R(COEF_CONST(0.9996988186962043), f551);
+    f554 = MUL_C_R(COEF_CONST(1.0242400472191164), f423);
+    y[1] = f552 + f553;
+    y[63] = f554 - f553;
+    f557 = f538 + f425;
+    f558 = MUL_C_R(COEF_CONST((-0.9237258930790228)), f538);
+    f559 = MUL_C_R(COEF_CONST(0.9972904566786902), f557);
+    f560 = MUL_C_R(COEF_CONST(1.0708550202783576), f425);
+    y[3] = f558 + f559;
+    y[61] = f560 - f559;
+    f563 = f540 + f427;
+    f564 = MUL_C_R(COEF_CONST((-0.8700688593994936)), f540);
+    f565 = MUL_C_R(COEF_CONST(0.9924795345987100), f563);
+    f566 = MUL_C_R(COEF_CONST(1.1148902097979263), f427);
+    y[5] = f564 + f565;
+    y[59] = f566 - f565;
+    f569 = f542 + f429;
+    f570 = MUL_C_R(COEF_CONST((-0.8143157536286398)), f542);
+    f571 = MUL_C_R(COEF_CONST(0.9852776423889412), f569);
+    f572 = MUL_C_R(COEF_CONST(1.1562395311492426), f429);
+    y[7] = f570 + f571;
+    y[57] = f572 - f571;
+    f575 = f544 + f431;
+    f576 = MUL_C_R(COEF_CONST((-0.7566008898816587)), f544);
+    f577 = MUL_C_R(COEF_CONST(0.9757021300385286), f575);
+    f578 = MUL_C_R(COEF_CONST(1.1948033701953984), f431);
+    y[9] = f576 + f577;
+    y[55] = f578 - f577;
+    f581 = f546 + f433;
+    f582 = MUL_C_R(COEF_CONST((-0.6970633083205414)), f546);
+    f583 = MUL_C_R(COEF_CONST(0.9637760657954398), f581);
+    f584 = MUL_C_R(COEF_CONST(1.2304888232703384), f433);
+    y[11] = f582 + f583;
+    y[53] = f584 - f583;
+    f587 = f548 + f435;
+    f588 = MUL_C_R(COEF_CONST((-0.6358464401941451)), f548);
+    f589 = MUL_C_R(COEF_CONST(0.9495281805930367), f587);
+    f590 = MUL_C_R(COEF_CONST(1.2632099209919283), f435);
+    y[13] = f588 + f589;
+    y[51] = f590 - f589;
+    f593 = f550 + f437;
+    f594 = MUL_C_R(COEF_CONST((-0.5730977622997506)), f550);
+    f595 = MUL_C_R(COEF_CONST(0.9329927988347389), f593);
+    f596 = MUL_C_R(COEF_CONST(1.2928878353697271), f437);
+    y[15] = f594 + f595;
+    y[49] = f596 - f595;
+    f599 = f549 + f436;
+    f600 = MUL_C_R(COEF_CONST((-0.5089684416985408)), f549);
+    f601 = MUL_C_R(COEF_CONST(0.9142097557035307), f599);
+    f602 = MUL_C_R(COEF_CONST(1.3194510697085207), f436);
+    y[17] = f600 + f601;
+    y[47] = f602 - f601;
+    f605 = f434 - f547;
+    f606 = MUL_C_R(COEF_CONST((-0.4436129715409087)), f547);
+    f607 = MUL_C_R(COEF_CONST(0.8932243011955153), f605);
+    f608 = MUL_C_R(COEF_CONST(1.3428356308501219), f434);
+    y[19] = f607 - f606;
+    y[45] = f608 - f607;
+    f611 = f545 + f432;
+    f612 = MUL_C_R(COEF_CONST((-0.3771887988789273)), f545);
+    f613 = MUL_C_R(COEF_CONST(0.8700869911087114), f611);
+    f614 = MUL_C_R(COEF_CONST(1.3629851833384954), f432);
+    y[21] = f612 + f613;
+    y[43] = f614 - f613;
+    f617 = f430 - f543;
+    f618 = MUL_C_R(COEF_CONST((-0.3098559453626097)), f543);
+    f619 = MUL_C_R(COEF_CONST(0.8448535652497070), f617);
+    f620 = MUL_C_R(COEF_CONST(1.3798511851368043), f430);
+    y[23] = f619 - f618;
+    y[41] = f620 - f619;
+    f623 = f541 + f428;
+    f624 = MUL_C_R(COEF_CONST((-0.2417766217337384)), f541);
+    f625 = MUL_C_R(COEF_CONST(0.8175848131515837), f623);
+    f626 = MUL_C_R(COEF_CONST(1.3933930045694289), f428);
+    y[25] = f624 + f625;
+    y[39] = f626 - f625;
+    f629 = f426 - f539;
+    f630 = MUL_C_R(COEF_CONST((-0.1731148370459794)), f539);
+    f631 = MUL_C_R(COEF_CONST(0.7883464276266062), f629);
+    f632 = MUL_C_R(COEF_CONST(1.4035780182072330), f426);
+    y[27] = f631 - f630;
+    y[37] = f632 - f631;
+    f635 = f537 + f424;
+    f636 = MUL_C_R(COEF_CONST((-0.1040360035527077)), f537);
+    f637 = MUL_C_R(COEF_CONST(0.7572088465064845), f635);
+    f638 = MUL_C_R(COEF_CONST(1.4103816894602612), f424);
+    y[29] = f636 + f637;
+    y[35] = f638 - f637;
+    f641 = f422 - f535;
+    f642 = MUL_C_R(COEF_CONST((-0.0347065382144000)), f535);
+    f643 = MUL_C_R(COEF_CONST(0.7242470829514669), f641);
+    f644 = MUL_C_R(COEF_CONST(1.4137876276885337), f422);
+    y[31] = f643 - f642;
+    y[33] = f644 - f643;
+}
+
+#else
+
+void DCT4_64(real_t *y, real_t *x)
+{
+    int16_t i0;
+    real_t f2;
+    real_t f3;
+    real_t f4;
+    real_t f5;
+    real_t f6;
+    real_t f7;
+    real_t f8;
+    real_t f9;
+    real_t f10;
+    real_t f11;
+    real_t f12;
+    real_t f13;
+    real_t f14;
+    real_t f15;
+    real_t f16;
+    real_t f17;
+    real_t f18;
+    real_t f19;
+    real_t f20;
+    real_t f21;
+    real_t f22;
+    real_t f23;
+    real_t f24;
+    real_t f25;
+    real_t f26;
+    real_t f27;
+    real_t f28;
+    real_t f29;
+    real_t f30;
+    real_t f31;
+    real_t f32;
+    real_t f33;
+    real_t f34;
+    real_t f35;
+    real_t f36;
+    real_t f37;
+    real_t f38;
+    real_t f39;
+    real_t f40;
+    real_t f41;
+    real_t f42;
+    real_t f43;
+    real_t f44;
+    real_t f45;
+    real_t f46;
+    real_t f47;
+    real_t f48;
+    real_t f49;
+    real_t f50;
+    real_t f51;
+    real_t f52;
+    real_t f53;
+    real_t f54;
+    real_t f55;
+    real_t f56;
+    real_t f57;
+    real_t f58;
+    real_t f59;
+    real_t f60;
+    real_t f61;
+    real_t f62;
+    real_t f63;
+    real_t f64;
+    real_t f65;
+    real_t f66;
+    real_t f67;
+    real_t f68;
+    real_t f69;
+    real_t f70;
+    real_t f71;
+    real_t f72;
+    real_t f73;
+    real_t f74;
+    real_t f75;
+    real_t f76;
+    real_t f77;
+    real_t f78;
+    real_t f79;
+    real_t f80;
+    real_t f81;
+    real_t f82;
+    real_t f83;
+    real_t f84;
+    real_t f85;
+    real_t f86;
+    real_t f87;
+    real_t f88;
+    real_t f89;
+    real_t f90;
+    real_t f91;
+    real_t f92;
+    real_t f93;
+    real_t f94;
+    real_t f95;
+    real_t f96;
+    real_t f97;
+    real_t f98;
+    real_t f99;
+    real_t f100;
+    real_t f101;
+    real_t f102;
+    real_t f103;
+    real_t f104;
+    real_t f105;
+    real_t f106;
+    real_t f107;
+    real_t f108;
+    real_t f109;
+    real_t f110;
+    real_t f111;
+    real_t f112;
+    real_t f113;
+    real_t f114;
+    real_t f115;
+    real_t f116;
+    real_t f117;
+    real_t f118;
+    real_t f119;
+    real_t f120;
+    real_t f121;
+    real_t f122;
+    real_t f123;
+    real_t f124;
+    real_t f125;
+    real_t f126;
+    real_t f127;
+    real_t f128;
+    real_t f129;
+    real_t f130;
+    real_t f131;
+    real_t f132;
+    real_t f133;
+    real_t f134;
+    real_t f135;
+    real_t f136;
+    real_t f137;
+    real_t f138;
+    real_t f139;
+    real_t f140;
+    real_t f141;
+    real_t f142;
+    real_t f143;
+    real_t f144;
+    real_t f145;
+    real_t f146;
+    real_t f147;
+    real_t f148;
+    real_t f149;
+    real_t f150;
+    real_t f151;
+    real_t f152;
+    real_t f153;
+    real_t f154;
+    real_t f155;
+    real_t f156;
+    real_t f157;
+    real_t f158;
+    real_t f159;
+    real_t f160;
+    real_t f161;
+    real_t f162;
+    real_t f163;
+    real_t f164;
+    real_t f165;
+    real_t f166;
+    real_t f167;
+    real_t f168;
+    real_t f169;
+    real_t f170;
+    real_t f171;
+    real_t f172;
+    real_t f173;
+    real_t f174;
+    real_t f175;
+    real_t f176;
+    real_t f177;
+    real_t f178;
+    real_t f179;
+    real_t f180;
+    real_t f181;
+    real_t f182;
+    real_t f183;
+    real_t f184;
+    real_t f185;
+    real_t f186;
+    real_t f187;
+    real_t f188;
+    real_t f189;
+    real_t f190;
+    real_t f191;
+    real_t f192;
+    real_t f193;
+    real_t f194;
+    real_t f195;
+    real_t f196;
+    real_t f197;
+    real_t f198;
+    real_t f199;
+    real_t f200;
+    real_t f201;
+    real_t f202;
+    real_t f203;
+    real_t f204;
+    real_t f205;
+    real_t f206;
+    real_t f207;
+    real_t f208;
+    real_t f209;
+    real_t f210;
+    real_t f211;
+    real_t f212;
+    real_t f213;
+    real_t f214;
+    real_t f215;
+    real_t f216;
+    real_t f217;
+    real_t f218;
+    real_t f219;
+    real_t f220;
+    real_t f221;
+    real_t f222;
+    real_t f223;
+    real_t f224;
+    real_t f225;
+    real_t f226;
+    real_t f227;
+    real_t f228;
+    real_t f229;
+    real_t f230;
+    real_t f231;
+    real_t f232;
+    real_t f233;
+    real_t f234;
+    real_t f235;
+    real_t f236;
+    real_t f237;
+    real_t f238;
+    real_t f239;
+    real_t f240;
+    real_t f241;
+    real_t f242;
+    real_t f243;
+    real_t f244;
+    real_t f245;
+    real_t f246;
+    real_t f247;
+    real_t f248;
+    real_t f249;
+    real_t f250;
+    real_t f251;
+    real_t f252;
+    real_t f253;
+    real_t f254;
+    real_t f255;
+    real_t f256;
+    real_t f257;
+    real_t f258;
+    real_t f259;
+    real_t f260;
+    real_t f261;
+    real_t f262;
+    real_t f263;
+    real_t f264;
+    real_t f265;
+    real_t f266;
+    real_t f267;
+    real_t f268;
+    real_t f269;
+    real_t f270;
+    real_t f271;
+    real_t f272;
+    real_t f273;
+    real_t f274;
+    real_t f275;
+    real_t f276;
+    real_t f277;
+    real_t f278;
+    real_t f279;
+    real_t f280;
+    real_t f281;
+    real_t f282;
+    real_t f283;
+    real_t f284;
+    real_t f285;
+    real_t f286;
+    real_t f287;
+    real_t f288;
+    real_t f289;
+    real_t f290;
+    real_t f291;
+    real_t f292;
+    real_t f293;
+    real_t f294;
+    real_t f295;
+    real_t f296;
+    real_t f297;
+    real_t f298;
+    real_t f299;
+    real_t f300;
+    real_t f301;
+    real_t f302;
+    real_t f303;
+    real_t f304;
+    real_t f305;
+    real_t f306;
+    real_t f307;
+    real_t f308;
+    real_t f309;
+    real_t f310;
+    real_t f311;
+    real_t f312;
+    real_t f313;
+    real_t f314;
+    real_t f315;
+    real_t f316;
+    real_t f317;
+    real_t f318;
+    real_t f319;
+    real_t f320;
+    real_t f321;
+    real_t f322;
+    real_t f323;
+    real_t f324;
+    real_t f325;
+    real_t f326;
+    real_t f327;
+    real_t f328;
+    real_t f329;
+    real_t f330;
+    real_t f331;
+    real_t f332;
+    real_t f333;
+    real_t f334;
+    real_t f335;
+    real_t f336;
+    real_t f337;
+    real_t f338;
+    real_t f339;
+    real_t f340;
+    real_t f341;
+    real_t f342;
+    real_t f343;
+    real_t f344;
+    real_t f345;
+    real_t f346;
+    real_t f347;
+    real_t f348;
+    real_t f349;
+    real_t f350;
+    real_t f351;
+    real_t f352;
+    real_t f353;
+    real_t f354;
+    real_t f355;
+    real_t f356;
+    real_t f357;
+    real_t f358;
+    real_t f359;
+    real_t f360;
+    real_t f361;
+    real_t f362;
+    real_t f363;
+    real_t f364;
+    real_t f365;
+    real_t f366;
+    real_t f367;
+    real_t f368;
+    real_t f369;
+    real_t f370;
+    real_t f371;
+    real_t f372;
+    real_t f373;
+    real_t f374;
+    real_t f375;
+    real_t f376;
+    real_t f377;
+    real_t f378;
+    real_t f379;
+    real_t f380;
+    real_t f381;
+    real_t f382;
+    real_t f383;
+    real_t f384;
+    real_t f385;
+    real_t f386;
+    real_t f387;
+    real_t f388;
+    real_t f389;
+    real_t f390;
+    real_t f391;
+    real_t f392;
+    real_t f393;
+    real_t f394;
+    real_t f395;
+    real_t f396;
+    real_t f397;
+    real_t f398;
+    real_t f399;
+    real_t f400;
+    real_t f401;
+    real_t f402;
+    real_t f403;
+    real_t f404;
+    real_t f405;
+    real_t f406;
+    real_t f407;
+    real_t f408;
+    real_t f409;
+    real_t f410;
+    real_t f411;
+    real_t f412;
+    real_t f413;
+    real_t f414;
+    real_t f415;
+    real_t f416;
+    real_t f417;
+    real_t f418;
+    real_t f419;
+    real_t f420;
+    real_t f421;
+    real_t f422;
+    real_t f423;
+    real_t f424;
+    real_t f425;
+    real_t f426;
+    real_t f427;
+    real_t f428;
+    real_t f429;
+    real_t f430;
+    real_t f431;
+    real_t f432;
+    real_t f433;
+    real_t f434;
+    real_t f435;
+    real_t f436;
+    real_t f437;
+    real_t f438;
+    real_t f439;
+    real_t f440;
+    real_t f441;
+    real_t f442;
+    real_t f443;
+    real_t f444;
+    real_t f445;
+    real_t f446;
+    real_t f447;
+    real_t f448;
+    real_t f449;
+    real_t f450;
+    real_t f451;
+    real_t f452;
+    real_t f453;
+    real_t f454;
+    real_t f455;
+    real_t f456;
+    real_t f457;
+    real_t f458;
+    real_t f459;
+    real_t f460;
+    real_t f461;
+    real_t f462;
+    real_t f463;
+    real_t f464;
+    real_t f465;
+    real_t f466;
+    real_t f467;
+    real_t f468;
+    real_t f469;
+    real_t f470;
+    real_t f471;
+    real_t f472;
+    real_t f473;
+    real_t f474;
+    real_t f475;
+    real_t f476;
+    real_t f477;
+    real_t f478;
+    real_t f479;
+    real_t f480;
+    real_t f481;
+    real_t f482;
+    real_t f483;
+    real_t f484;
+    real_t f485;
+    real_t f486;
+    real_t f487;
+    real_t f488;
+    real_t f489;
+    real_t f490;
+    real_t f491;
+    real_t f492;
+    real_t f493;
+    real_t f494;
+    real_t f495;
+    real_t f496;
+    real_t f497;
+    real_t f498;
+    real_t f499;
+    real_t f500;
+    real_t f501;
+    real_t f502;
+    real_t f503;
+    real_t f504;
+    real_t f505;
+    real_t f506;
+    real_t f507;
+    real_t f508;
+    real_t f509;
+    real_t f510;
+    real_t f511;
+    real_t f512;
+    real_t f513;
+    real_t f514;
+    real_t f515;
+    real_t f516;
+    real_t f517;
+    real_t f518;
+    real_t f519;
+    real_t f520;
+    real_t f521;
+    real_t f522;
+    real_t f523;
+    real_t f524;
+    real_t f525;
+    real_t f526;
+    real_t f527;
+    real_t f528;
+    real_t f529;
+    real_t f530;
+    real_t f531;
+    real_t f532;
+    real_t f533;
+    real_t f534;
+    real_t f535;
+    real_t f536;
+    real_t f537;
+    real_t f538;
+    real_t f539;
+    real_t f540;
+    real_t f541;
+    real_t f542;
+    real_t f543;
+    real_t f544;
+    real_t f545;
+    real_t f546;
+    real_t f547;
+    real_t f548;
+    real_t f549;
+    real_t f550;
+    real_t f551;
+    real_t f552;
+    real_t f553;
+    real_t f554;
+    real_t f555;
+    real_t f556;
+    real_t f557;
+    real_t f558;
+    real_t f559;
+    real_t f560;
+    real_t f561;
+    real_t f562;
+    real_t f563;
+    real_t f564;
+    real_t f565;
+    real_t f566;
+    real_t f567;
+    real_t f568;
+    real_t f569;
+    real_t f570;
+    real_t f571;
+    real_t f572;
+    real_t f573;
+    real_t f574;
+    real_t f575;
+    real_t f576;
+    real_t f577;
+    real_t f578;
+    real_t f579;
+    real_t f580;
+    real_t f581;
+    real_t f582;
+    real_t f583;
+    real_t f584;
+    real_t f585;
+    real_t f586;
+    real_t f587;
+    real_t f588;
+    real_t f589;
+    real_t f590;
+    real_t f591;
+    real_t f592;
+    real_t f593;
+    real_t f594;
+    real_t f595;
+    real_t f596;
+    real_t f597;
+    real_t f598;
+    real_t f599;
+    real_t f600;
+    real_t f601;
+    real_t f602;
+    real_t f603;
+    real_t f604;
+    real_t f605;
+    real_t f606;
+    real_t f607;
+    real_t f608;
+    real_t f609;
+    real_t f610;
+    real_t f611;
+    real_t f612;
+    real_t f613;
+    real_t f614;
+    real_t f615;
+    real_t f618;
+    real_t f619;
+    real_t f620;
+    real_t f621;
+    real_t f624;
+    real_t f625;
+    real_t f626;
+    real_t f627;
+    real_t f630;
+    real_t f631;
+    real_t f632;
+    real_t f633;
+    real_t f636;
+    real_t f637;
+    real_t f638;
+    real_t f639;
+    real_t f642;
+    real_t f643;
+    real_t f644;
+    real_t f645;
+    real_t f648;
+    real_t f649;
+    real_t f650;
+    real_t f651;
+    real_t f654;
+    real_t f655;
+    real_t f656;
+    real_t f657;
+    real_t f660;
+    real_t f661;
+    real_t f662;
+    real_t f663;
+    real_t f666;
+    real_t f667;
+    real_t f668;
+    real_t f669;
+    real_t f672;
+    real_t f673;
+    real_t f674;
+    real_t f675;
+    real_t f678;
+    real_t f679;
+    real_t f680;
+    real_t f681;
+    real_t f684;
+    real_t f685;
+    real_t f686;
+    real_t f687;
+    real_t f690;
+    real_t f691;
+    real_t f692;
+    real_t f693;
+    real_t f696;
+    real_t f697;
+    real_t f698;
+    real_t f699;
+    real_t f702;
+    real_t f703;
+    real_t f704;
+    real_t f705;
+    real_t f708;
+    real_t f709;
+    real_t f710;
+    real_t f711;
+    real_t f714;
+    real_t f715;
+    real_t f716;
+    real_t f717;
+    real_t f720;
+    real_t f721;
+    real_t f722;
+    real_t f723;
+    real_t f726;
+    real_t f727;
+    real_t f728;
+    real_t f729;
+    real_t f732;
+    real_t f733;
+    real_t f734;
+    real_t f735;
+    real_t f738;
+    real_t f739;
+    real_t f740;
+    real_t f741;
+    real_t f744;
+    real_t f745;
+    real_t f746;
+    real_t f747;
+    real_t f750;
+    real_t f751;
+    real_t f752;
+    real_t f753;
+    real_t f756;
+    real_t f757;
+    real_t f758;
+    real_t f759;
+    real_t f762;
+    real_t f763;
+    real_t f764;
+    real_t f765;
+    real_t f768;
+    real_t f769;
+    real_t f770;
+    real_t f771;
+    real_t f774;
+    real_t f775;
+    real_t f776;
+    real_t f777;
+    real_t f780;
+    real_t f781;
+    real_t f782;
+    real_t f783;
+    real_t f786;
+    real_t f787;
+    real_t f788;
+    real_t f789;
+    real_t f792;
+    real_t f793;
+    real_t f794;
+    real_t f795;
+    real_t f798;
+    real_t f799;
+    real_t f800;
+    real_t f801;
+    static real_t t2[64];
+
+    t2[0] = x[0];
+    for (i0=0; i0<31; i0++)
+    {
+        t2[2*i0+1] = x[2*i0+1] - x[2*i0+2];
+        t2[2*i0+2] = x[2*i0+1] + x[2*i0+2];
+    }
+    t2[63] = x[63];
+    f2 = 0.7071067811865476 * t2[32];
+    f3 = x[0] - f2;
+    f4 = x[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;
+    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 = x[63] - f467;
+    f469 = x[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;
+}
+
+void DST4_64(real_t *y, real_t *x)
+{
+    real_t f1;
+    real_t f3;
+    real_t f5;
+    real_t f7;
+    real_t f9;
+    real_t f11;
+    real_t f13;
+    real_t f15;
+    real_t f17;
+    real_t f19;
+    real_t f21;
+    real_t f23;
+    real_t f25;
+    real_t f27;
+    real_t f29;
+    real_t f31;
+    real_t f33;
+    real_t f35;
+    real_t f37;
+    real_t f39;
+    real_t f41;
+    real_t f43;
+    real_t f45;
+    real_t f47;
+    real_t f49;
+    real_t f51;
+    real_t f53;
+    real_t f55;
+    real_t f57;
+    real_t f59;
+    real_t f61;
+    real_t f63;
+    int16_t i0;
+    real_t f66;
+    real_t f67;
+    real_t f68;
+    real_t f69;
+    real_t f70;
+    real_t f71;
+    real_t f72;
+    real_t f73;
+    real_t f74;
+    real_t f75;
+    real_t f76;
+    real_t f77;
+    real_t f78;
+    real_t f79;
+    real_t f80;
+    real_t f81;
+    real_t f82;
+    real_t f83;
+    real_t f84;
+    real_t f85;
+    real_t f86;
+    real_t f87;
+    real_t f88;
+    real_t f89;
+    real_t f90;
+    real_t f91;
+    real_t f92;
+    real_t f93;
+    real_t f94;
+    real_t f95;
+    real_t f96;
+    real_t f97;
+    real_t f98;
+    real_t f99;
+    real_t f100;
+    real_t f101;
+    real_t f102;
+    real_t f103;
+    real_t f104;
+    real_t f105;
+    real_t f106;
+    real_t f107;
+    real_t f108;
+    real_t f109;
+    real_t f110;
+    real_t f111;
+    real_t f112;
+    real_t f113;
+    real_t f114;
+    real_t f115;
+    real_t f116;
+    real_t f117;
+    real_t f118;
+    real_t f119;
+    real_t f120;
+    real_t f121;
+    real_t f122;
+    real_t f123;
+    real_t f124;
+    real_t f125;
+    real_t f126;
+    real_t f127;
+    real_t f128;
+    real_t f129;
+    real_t f130;
+    real_t f131;
+    real_t f132;
+    real_t f133;
+    real_t f134;
+    real_t f135;
+    real_t f136;
+    real_t f137;
+    real_t f138;
+    real_t f139;
+    real_t f140;
+    real_t f141;
+    real_t f142;
+    real_t f143;
+    real_t f144;
+    real_t f145;
+    real_t f146;
+    real_t f147;
+    real_t f148;
+    real_t f149;
+    real_t f150;
+    real_t f151;
+    real_t f152;
+    real_t f153;
+    real_t f154;
+    real_t f155;
+    real_t f156;
+    real_t f157;
+    real_t f158;
+    real_t f159;
+    real_t f160;
+    real_t f161;
+    real_t f162;
+    real_t f163;
+    real_t f164;
+    real_t f165;
+    real_t f166;
+    real_t f167;
+    real_t f168;
+    real_t f169;
+    real_t f170;
+    real_t f171;
+    real_t f172;
+    real_t f173;
+    real_t f174;
+    real_t f175;
+    real_t f176;
+    real_t f177;
+    real_t f178;
+    real_t f179;
+    real_t f180;
+    real_t f181;
+    real_t f182;
+    real_t f183;
+    real_t f184;
+    real_t f185;
+    real_t f186;
+    real_t f187;
+    real_t f188;
+    real_t f189;
+    real_t f190;
+    real_t f191;
+    real_t f192;
+    real_t f193;
+    real_t f194;
+    real_t f195;
+    real_t f196;
+    real_t f197;
+    real_t f198;
+    real_t f199;
+    real_t f200;
+    real_t f201;
+    real_t f202;
+    real_t f203;
+    real_t f204;
+    real_t f205;
+    real_t f206;
+    real_t f207;
+    real_t f208;
+    real_t f209;
+    real_t f210;
+    real_t f211;
+    real_t f212;
+    real_t f213;
+    real_t f214;
+    real_t f215;
+    real_t f216;
+    real_t f217;
+    real_t f218;
+    real_t f219;
+    real_t f220;
+    real_t f221;
+    real_t f222;
+    real_t f223;
+    real_t f224;
+    real_t f225;
+    real_t f226;
+    real_t f227;
+    real_t f228;
+    real_t f229;
+    real_t f230;
+    real_t f231;
+    real_t f232;
+    real_t f233;
+    real_t f234;
+    real_t f235;
+    real_t f236;
+    real_t f237;
+    real_t f238;
+    real_t f239;
+    real_t f240;
+    real_t f241;
+    real_t f242;
+    real_t f243;
+    real_t f244;
+    real_t f245;
+    real_t f246;
+    real_t f247;
+    real_t f248;
+    real_t f249;
+    real_t f250;
+    real_t f251;
+    real_t f252;
+    real_t f253;
+    real_t f254;
+    real_t f255;
+    real_t f256;
+    real_t f257;
+    real_t f258;
+    real_t f259;
+    real_t f260;
+    real_t f261;
+    real_t f262;
+    real_t f263;
+    real_t f264;
+    real_t f265;
+    real_t f266;
+    real_t f267;
+    real_t f268;
+    real_t f269;
+    real_t f270;
+    real_t f271;
+    real_t f272;
+    real_t f273;
+    real_t f274;
+    real_t f275;
+    real_t f276;
+    real_t f277;
+    real_t f278;
+    real_t f279;
+    real_t f280;
+    real_t f281;
+    real_t f282;
+    real_t f283;
+    real_t f284;
+    real_t f285;
+    real_t f286;
+    real_t f287;
+    real_t f288;
+    real_t f289;
+    real_t f290;
+    real_t f291;
+    real_t f292;
+    real_t f293;
+    real_t f294;
+    real_t f295;
+    real_t f296;
+    real_t f297;
+    real_t f298;
+    real_t f299;
+    real_t f300;
+    real_t f301;
+    real_t f302;
+    real_t f303;
+    real_t f304;
+    real_t f305;
+    real_t f306;
+    real_t f307;
+    real_t f308;
+    real_t f309;
+    real_t f310;
+    real_t f311;
+    real_t f312;
+    real_t f313;
+    real_t f314;
+    real_t f315;
+    real_t f316;
+    real_t f317;
+    real_t f318;
+    real_t f319;
+    real_t f320;
+    real_t f321;
+    real_t f322;
+    real_t f323;
+    real_t f324;
+    real_t f325;
+    real_t f326;
+    real_t f327;
+    real_t f328;
+    real_t f329;
+    real_t f330;
+    real_t f331;
+    real_t f332;
+    real_t f333;
+    real_t f334;
+    real_t f335;
+    real_t f336;
+    real_t f337;
+    real_t f338;
+    real_t f339;
+    real_t f340;
+    real_t f341;
+    real_t f342;
+    real_t f343;
+    real_t f344;
+    real_t f345;
+    real_t f346;
+    real_t f347;
+    real_t f348;
+    real_t f349;
+    real_t f350;
+    real_t f351;
+    real_t f352;
+    real_t f353;
+    real_t f354;
+    real_t f355;
+    real_t f356;
+    real_t f357;
+    real_t f358;
+    real_t f359;
+    real_t f360;
+    real_t f361;
+    real_t f362;
+    real_t f363;
+    real_t f364;
+    real_t f365;
+    real_t f366;
+    real_t f367;
+    real_t f368;
+    real_t f369;
+    real_t f370;
+    real_t f371;
+    real_t f372;
+    real_t f373;
+    real_t f374;
+    real_t f375;
+    real_t f376;
+    real_t f377;
+    real_t f378;
+    real_t f379;
+    real_t f380;
+    real_t f381;
+    real_t f382;
+    real_t f383;
+    real_t f384;
+    real_t f385;
+    real_t f386;
+    real_t f387;
+    real_t f388;
+    real_t f389;
+    real_t f390;
+    real_t f391;
+    real_t f392;
+    real_t f393;
+    real_t f394;
+    real_t f395;
+    real_t f396;
+    real_t f397;
+    real_t f398;
+    real_t f399;
+    real_t f400;
+    real_t f401;
+    real_t f402;
+    real_t f403;
+    real_t f404;
+    real_t f405;
+    real_t f406;
+    real_t f407;
+    real_t f408;
+    real_t f409;
+    real_t f410;
+    real_t f411;
+    real_t f412;
+    real_t f413;
+    real_t f414;
+    real_t f415;
+    real_t f416;
+    real_t f417;
+    real_t f418;
+    real_t f419;
+    real_t f420;
+    real_t f421;
+    real_t f422;
+    real_t f423;
+    real_t f424;
+    real_t f425;
+    real_t f426;
+    real_t f427;
+    real_t f428;
+    real_t f429;
+    real_t f430;
+    real_t f431;
+    real_t f432;
+    real_t f433;
+    real_t f434;
+    real_t f435;
+    real_t f436;
+    real_t f437;
+    real_t f438;
+    real_t f439;
+    real_t f440;
+    real_t f441;
+    real_t f442;
+    real_t f443;
+    real_t f444;
+    real_t f445;
+    real_t f446;
+    real_t f447;
+    real_t f448;
+    real_t f449;
+    real_t f450;
+    real_t f451;
+    real_t f452;
+    real_t f453;
+    real_t f454;
+    real_t f455;
+    real_t f456;
+    real_t f457;
+    real_t f458;
+    real_t f459;
+    real_t f460;
+    real_t f461;
+    real_t f462;
+    real_t f463;
+    real_t f464;
+    real_t f465;
+    real_t f466;
+    real_t f467;
+    real_t f468;
+    real_t f469;
+    real_t f470;
+    real_t f471;
+    real_t f472;
+    real_t f473;
+    real_t f474;
+    real_t f475;
+    real_t f476;
+    real_t f477;
+    real_t f478;
+    real_t f479;
+    real_t f480;
+    real_t f481;
+    real_t f482;
+    real_t f483;
+    real_t f484;
+    real_t f485;
+    real_t f486;
+    real_t f487;
+    real_t f488;
+    real_t f489;
+    real_t f490;
+    real_t f491;
+    real_t f492;
+    real_t f493;
+    real_t f494;
+    real_t f495;
+    real_t f496;
+    real_t f497;
+    real_t f498;
+    real_t f499;
+    real_t f500;
+    real_t f501;
+    real_t f502;
+    real_t f503;
+    real_t f504;
+    real_t f505;
+    real_t f506;
+    real_t f507;
+    real_t f508;
+    real_t f509;
+    real_t f510;
+    real_t f511;
+    real_t f512;
+    real_t f513;
+    real_t f514;
+    real_t f515;
+    real_t f516;
+    real_t f517;
+    real_t f518;
+    real_t f519;
+    real_t f520;
+    real_t f521;
+    real_t f522;
+    real_t f523;
+    real_t f524;
+    real_t f525;
+    real_t f526;
+    real_t f527;
+    real_t f528;
+    real_t f529;
+    real_t f530;
+    real_t f531;
+    real_t f532;
+    real_t f533;
+    real_t f534;
+    real_t f535;
+    real_t f536;
+    real_t f537;
+    real_t f538;
+    real_t f539;
+    real_t f540;
+    real_t f541;
+    real_t f542;
+    real_t f543;
+    real_t f544;
+    real_t f545;
+    real_t f546;
+    real_t f547;
+    real_t f548;
+    real_t f549;
+    real_t f550;
+    real_t f551;
+    real_t f552;
+    real_t f553;
+    real_t f554;
+    real_t f555;
+    real_t f556;
+    real_t f557;
+    real_t f558;
+    real_t f559;
+    real_t f560;
+    real_t f561;
+    real_t f562;
+    real_t f563;
+    real_t f564;
+    real_t f565;
+    real_t f566;
+    real_t f567;
+    real_t f568;
+    real_t f569;
+    real_t f570;
+    real_t f571;
+    real_t f572;
+    real_t f573;
+    real_t f574;
+    real_t f575;
+    real_t f576;
+    real_t f577;
+    real_t f578;
+    real_t f579;
+    real_t f580;
+    real_t f581;
+    real_t f582;
+    real_t f583;
+    real_t f584;
+    real_t f585;
+    real_t f586;
+    real_t f587;
+    real_t f588;
+    real_t f589;
+    real_t f590;
+    real_t f591;
+    real_t f592;
+    real_t f593;
+    real_t f594;
+    real_t f595;
+    real_t f596;
+    real_t f597;
+    real_t f598;
+    real_t f599;
+    real_t f600;
+    real_t f601;
+    real_t f602;
+    real_t f603;
+    real_t f604;
+    real_t f605;
+    real_t f606;
+    real_t f607;
+    real_t f608;
+    real_t f609;
+    real_t f610;
+    real_t f611;
+    real_t f612;
+    real_t f613;
+    real_t f614;
+    real_t f615;
+    real_t f616;
+    real_t f617;
+    real_t f618;
+    real_t f619;
+    real_t f620;
+    real_t f621;
+    real_t f622;
+    real_t f623;
+    real_t f624;
+    real_t f625;
+    real_t f626;
+    real_t f627;
+    real_t f628;
+    real_t f629;
+    real_t f630;
+    real_t f631;
+    real_t f632;
+    real_t f633;
+    real_t f634;
+    real_t f635;
+    real_t f636;
+    real_t f637;
+    real_t f638;
+    real_t f639;
+    real_t f640;
+    real_t f641;
+    real_t f642;
+    real_t f643;
+    real_t f644;
+    real_t f645;
+    real_t f646;
+    real_t f647;
+    real_t f648;
+    real_t f649;
+    real_t f650;
+    real_t f651;
+    real_t f652;
+    real_t f653;
+    real_t f654;
+    real_t f655;
+    real_t f656;
+    real_t f657;
+    real_t f658;
+    real_t f659;
+    real_t f660;
+    real_t f661;
+    real_t f662;
+    real_t f663;
+    real_t f664;
+    real_t f665;
+    real_t f666;
+    real_t f667;
+    real_t f668;
+    real_t f669;
+    real_t f670;
+    real_t f671;
+    real_t f672;
+    real_t f673;
+    real_t f674;
+    real_t f675;
+    real_t f676;
+    real_t f677;
+    real_t f678;
+    real_t f679;
+    real_t f681;
+    real_t f682;
+    real_t f683;
+    real_t f684;
+    real_t f685;
+    real_t f686;
+    real_t f687;
+    real_t f688;
+    real_t f689;
+    real_t f690;
+    real_t f691;
+    real_t f692;
+    real_t f693;
+    real_t f694;
+    real_t f695;
+    real_t f696;
+    real_t f697;
+    real_t f698;
+    real_t f699;
+    real_t f700;
+    real_t f701;
+    real_t f702;
+    real_t f703;
+    real_t f704;
+    real_t f705;
+    real_t f706;
+    real_t f707;
+    real_t f708;
+    real_t f709;
+    real_t f710;
+    real_t f711;
+    real_t f712;
+    real_t f713;
+    real_t f714;
+    real_t f715;
+    real_t f716;
+    real_t f717;
+    real_t f718;
+    real_t f719;
+    real_t f720;
+    real_t f721;
+    real_t f722;
+    real_t f723;
+    real_t f724;
+    real_t f725;
+    real_t f726;
+    real_t f727;
+    real_t f728;
+    real_t f729;
+    real_t f730;
+    real_t f731;
+    real_t f732;
+    real_t f733;
+    real_t f734;
+    real_t f735;
+    real_t f736;
+    real_t f737;
+    real_t f738;
+    real_t f739;
+    real_t f740;
+    real_t f741;
+    real_t f742;
+    real_t f743;
+    real_t f744;
+    real_t f745;
+    real_t f746;
+    real_t f747;
+    real_t f748;
+    real_t f749;
+    real_t f750;
+    real_t f751;
+    real_t f752;
+    real_t f753;
+    real_t f754;
+    real_t f755;
+    real_t f756;
+    real_t f757;
+    real_t f758;
+    real_t f759;
+    real_t f760;
+    real_t f761;
+    real_t f762;
+    real_t f763;
+    real_t f764;
+    real_t f765;
+    real_t f766;
+    real_t f767;
+    real_t f768;
+    real_t f769;
+    real_t f770;
+    static real_t t7[64];
+    static real_t t6[64];
+    static real_t t0[64];
+
+    t7[0] = 0.5000376519155477 * x[0];
+    f1 = 0.5003390374428216 * x[1];
+    t7[2] = 0 - f1;
+    t7[4] = 0.5009427176380873 * x[2];
+    f3 = 0.5018505174842379 * x[3];
+    t7[6] = 0 - f3;
+    t7[8] = 0.5030651913013697 * x[4];
+    f5 = 0.5045904432216454 * x[5];
+    t7[10] = 0 - f5;
+    t7[12] = 0.5064309549285542 * x[6];
+    f7 = 0.5085924210498143 * x[7];
+    t7[14] = 0 - f7;
+    t7[16] = 0.5110815927066812 * x[8];
+    f9 = 0.5139063298475396 * x[9];
+    t7[18] = 0 - f9;
+    t7[20] = 0.5170756631334912 * x[10];
+    f11 = 0.5205998663018917 * x[11];
+    t7[22] = 0 - f11;
+    t7[24] = 0.5244905401147240 * x[12];
+    f13 = 0.5287607092074876 * x[13];
+    t7[26] = 0 - f13;
+    t7[28] = 0.5334249333971333 * x[14];
+    f15 = 0.5384994352919840 * x[15];
+    t7[30] = 0 - f15;
+    t7[32] = 0.5440022463817783 * x[16];
+    f17 = 0.5499533741832360 * x[17];
+    t7[34] = 0 - f17;
+    t7[36] = 0.5563749934898856 * x[18];
+    f19 = 0.5632916653417023 * x[19];
+    t7[38] = 0 - f19;
+    t7[40] = 0.5707305880121454 * x[20];
+    f21 = 0.5787218851348208 * x[21];
+    t7[42] = 0 - f21;
+    t7[44] = 0.5872989370937893 * x[22];
+    f23 = 0.5964987630244563 * x[23];
+    t7[46] = 0 - f23;
+    t7[48] = 0.6063624622721460 * x[24];
+    f25 = 0.6169357260050706 * x[25];
+    t7[50] = 0 - f25;
+    t7[52] = 0.6282694319707711 * x[26];
+    f27 = 0.6404203382416639 * x[27];
+    t7[54] = 0 - f27;
+    t7[56] = 0.6534518953751283 * x[28];
+    f29 = 0.6674352009263413 * x[29];
+    t7[58] = 0 - f29;
+    t7[60] = 0.6824501259764195 * x[30];
+    f31 = 0.6985866506472291 * x[31];
+    t7[62] = 0 - f31;
+    t7[63] = 0.7159464549705746 * x[32];
+    f33 = 0.7346448236478627 * x[33];
+    t7[61] = 0 - f33;
+    t7[59] = 0.7548129391165311 * x[34];
+    f35 = 0.7766006582339630 * x[35];
+    t7[57] = 0 - f35;
+    t7[55] = 0.8001798956216941 * x[36];
+    f37 = 0.8257487738627852 * x[37];
+    t7[53] = 0 - f37;
+    t7[51] = 0.8535367510066064 * x[38];
+    f39 = 0.8838110045596234 * x[39];
+    t7[49] = 0 - f39;
+    t7[47] = 0.9168844461846523 * x[40];
+    f41 = 0.9531258743921193 * x[41];
+    t7[45] = 0 - f41;
+    t7[43] = 0.9929729612675466 * x[42];
+    f43 = 1.0369490409103890 * x[43];
+    t7[41] = 0 - f43;
+    t7[39] = 1.0856850642580145 * x[44];
+    f45 = 1.1399486751015042 * x[45];
+    t7[37] = 0 - f45;
+    t7[35] = 1.2006832557294167 * x[46];
+    f47 = 1.2690611716991191 * x[47];
+    t7[33] = 0 - f47;
+    t7[31] = 1.3465576282062861 * x[48];
+    f49 = 1.4350550884414341 * x[49];
+    t7[29] = 0 - f49;
+    t7[27] = 1.5369941008524954 * x[50];
+    f51 = 1.6555965242641195 * x[51];
+    t7[25] = 0 - f51;
+    t7[23] = 1.7952052190778898 * x[52];
+    f53 = 1.9618178485711659 * x[53];
+    t7[21] = 0 - f53;
+    t7[19] = 2.1639578187519790 * x[54];
+    f55 = 2.4141600002500763 * x[55];
+    t7[17] = 0 - f55;
+    t7[15] = 2.7316450287739396 * x[56];
+    f57 = 3.1474621917819090 * x[57];
+    t7[13] = 0 - f57;
+    t7[11] = 3.7152427383269746 * x[58];
+    f59 = 4.5362909369693565 * x[59];
+    t7[9] = 0 - f59;
+    t7[7] = 5.8276883778446544 * x[60];
+    f61 = 8.1538486024668142 * x[61];
+    t7[5] = 0 - f61;
+    t7[3] = 13.5842902572844600 * x[62];
+    f63 = 40.7446881033518340 * x[63];
+    t7[1] = 0 - f63;
+    for (i0=0; i0<32; i0++)
+    {
+        t6[2*i0+1] = t7[2*i0] - t7[2*i0+1];
+        t6[2*i0] = t7[2*i0] + t7[2*i0+1];
+    }
+    f66 = t6[0] - t6[62];
+    f67 = t6[0] + t6[62];
+    f68 = t6[2] - t6[60];
+    f69 = t6[2] + t6[60];
+    f70 = t6[4] - t6[58];
+    f71 = t6[4] + t6[58];
+    f72 = t6[6] - t6[56];
+    f73 = t6[6] + t6[56];
+    f74 = t6[8] - t6[54];
+    f75 = t6[8] + t6[54];
+    f76 = t6[10] - t6[52];
+    f77 = t6[10] + t6[52];
+    f78 = t6[12] - t6[50];
+    f79 = t6[12] + t6[50];
+    f80 = t6[14] - t6[48];
+    f81 = t6[14] + t6[48];
+    f82 = t6[16] - t6[46];
+    f83 = t6[16] + t6[46];
+    f84 = t6[18] - t6[44];
+    f85 = t6[18] + t6[44];
+    f86 = t6[20] - t6[42];
+    f87 = t6[20] + t6[42];
+    f88 = t6[22] - t6[40];
+    f89 = t6[22] + t6[40];
+    f90 = t6[24] - t6[38];
+    f91 = t6[24] + t6[38];
+    f92 = t6[26] - t6[36];
+    f93 = t6[26] + t6[36];
+    f94 = t6[28] - t6[34];
+    f95 = t6[28] + t6[34];
+    f96 = t6[30] - t6[32];
+    f97 = t6[30] + t6[32];
+    f98 = f67 - f97;
+    f99 = f67 + f97;
+    f100 = f69 - f95;
+    f101 = f69 + f95;
+    f102 = f71 - f93;
+    f103 = f71 + f93;
+    f104 = f73 - f91;
+    f105 = f73 + f91;
+    f106 = f75 - f89;
+    f107 = f75 + f89;
+    f108 = f77 - f87;
+    f109 = f77 + f87;
+    f110 = f79 - f85;
+    f111 = f79 + f85;
+    f112 = f81 - f83;
+    f113 = f81 + f83;
+    f114 = f99 - f113;
+    f115 = f99 + f113;
+    f116 = f101 - f111;
+    f117 = f101 + f111;
+    f118 = f103 - f109;
+    f119 = f103 + f109;
+    f120 = f105 - f107;
+    f121 = f105 + f107;
+    f122 = f115 - f121;
+    f123 = f115 + f121;
+    f124 = f117 - f119;
+    f125 = f117 + f119;
+    f126 = f123 - f125;
+    f127 = f123 + f125;
+    f128 = 0.7071067811865476 * f126;
+    f129 = f122 + f124;
+    f130 = 1.3065629648763766 * f122;
+    f131 = (-0.9238795325112866) * f129;
+    f132 = (-0.5411961001461967) * f124;
+    f133 = f130 + f131;
+    f134 = f132 - f131;
+    f135 = f116 - f118;
+    f136 = f116 + f118;
+    f137 = 0.7071067811865476 * f136;
+    f138 = 0.7071067811865476 * f135;
+    f139 = f114 - f137;
+    f140 = f114 + f137;
+    f141 = f120 - f138;
+    f142 = f120 + f138;
+    f143 = f142 + f140;
+    f144 = (-0.7856949583871021) * f142;
+    f145 = 0.9807852804032304 * f143;
+    f146 = 1.1758756024193588 * f140;
+    f147 = f144 + f145;
+    f148 = f146 - f145;
+    f149 = f141 + f139;
+    f150 = 0.2758993792829431 * f141;
+    f151 = 0.5555702330196022 * f149;
+    f152 = 1.3870398453221475 * f139;
+    f153 = f150 + f151;
+    f154 = f152 - f151;
+    f155 = f100 - f102;
+    f156 = f100 + f102;
+    f157 = f104 - f106;
+    f158 = f104 + f106;
+    f159 = f108 - f110;
+    f160 = f108 + f110;
+    f161 = 0.7071067811865476 * f158;
+    f162 = f98 - f161;
+    f163 = f98 + f161;
+    f164 = f156 + f160;
+    f165 = 1.3065629648763766 * f156;
+    f166 = (-0.9238795325112866) * f164;
+    f167 = (-0.5411961001461967) * f160;
+    f168 = f165 + f166;
+    f169 = f167 - f166;
+    f170 = f163 - f169;
+    f171 = f163 + f169;
+    f172 = f162 - f168;
+    f173 = f162 + f168;
+    f174 = f155 + f159;
+    f175 = 1.3065629648763770 * f155;
+    f176 = (-0.3826834323650904) * f174;
+    f177 = 0.5411961001461961 * f159;
+    f178 = f175 + f176;
+    f179 = f177 - f176;
+    f180 = 0.7071067811865476 * f157;
+    f181 = f180 - f112;
+    f182 = f180 + f112;
+    f183 = f179 - f182;
+    f184 = f179 + f182;
+    f185 = f178 - f181;
+    f186 = f178 + f181;
+    f187 = f184 + f171;
+    f188 = (-0.8971675863426361) * f184;
+    f189 = 0.9951847266721968 * f187;
+    f190 = 1.0932018670017576 * f171;
+    f191 = f188 + f189;
+    f192 = f190 - f189;
+    f193 = f186 + f173;
+    f194 = (-0.6666556584777466) * f186;
+    f195 = 0.9569403357322089 * f193;
+    f196 = 1.2472250129866713 * f173;
+    f197 = f194 + f195;
+    f198 = f196 - f195;
+    f199 = f185 + f172;
+    f200 = (-0.4105245275223571) * f185;
+    f201 = 0.8819212643483549 * f199;
+    f202 = 1.3533180011743529 * f172;
+    f203 = f200 + f201;
+    f204 = f202 - f201;
+    f205 = f183 + f170;
+    f206 = (-0.1386171691990915) * f183;
+    f207 = 0.7730104533627370 * f205;
+    f208 = 1.4074037375263826 * f170;
+    f209 = f206 + f207;
+    f210 = f208 - f207;
+    f211 = f66 + f96;
+    f212 = 1.0478631305325901 * f66;
+    f213 = (-0.9987954562051724) * f211;
+    f214 = (-0.9497277818777548) * f96;
+    f215 = f212 + f213;
+    f216 = f214 - f213;
+    f217 = f70 + f92;
+    f218 = 1.2130114330978077 * f70;
+    f219 = (-0.9700312531945440) * f217;
+    f220 = (-0.7270510732912803) * f92;
+    f221 = f218 + f219;
+    f222 = f220 - f219;
+    f223 = f74 + f88;
+    f224 = 1.3315443865537255 * f74;
+    f225 = (-0.9039892931234433) * f223;
+    f226 = (-0.4764341996931612) * f88;
+    f227 = f224 + f225;
+    f228 = f226 - f225;
+    f229 = f78 + f84;
+    f230 = 1.3989068359730781 * f78;
+    f231 = (-0.8032075314806453) * f229;
+    f232 = (-0.2075082269882124) * f84;
+    f233 = f230 + f231;
+    f234 = f232 - f231;
+    f235 = f82 + f80;
+    f236 = 1.4125100802019777 * f82;
+    f237 = (-0.6715589548470187) * f235;
+    f238 = 0.0693921705079402 * f80;
+    f239 = f236 + f237;
+    f240 = f238 - f237;
+    f241 = f86 + f76;
+    f242 = 1.3718313541934939 * f86;
+    f243 = (-0.5141027441932219) * f241;
+    f244 = 0.3436258658070501 * f76;
+    f245 = f242 + f243;
+    f246 = f244 - f243;
+    f247 = f90 + f72;
+    f248 = 1.2784339185752409 * f90;
+    f249 = (-0.3368898533922200) * f247;
+    f250 = 0.6046542117908008 * f72;
+    f251 = f248 + f249;
+    f252 = f250 - f249;
+    f253 = f94 + f68;
+    f254 = 1.1359069844201433 * f94;
+    f255 = (-0.1467304744553624) * f253;
+    f256 = 0.8424460355094185 * f68;
+    f257 = f254 + f255;
+    f258 = f256 - f255;
+    f259 = f216 - f240;
+    f260 = f216 + f240;
+    f261 = f215 - f239;
+    f262 = f215 + f239;
+    f263 = f222 - f246;
+    f264 = f222 + f246;
+    f265 = f221 - f245;
+    f266 = f221 + f245;
+    f267 = f228 - f252;
+    f268 = f228 + f252;
+    f269 = f227 - f251;
+    f270 = f227 + f251;
+    f271 = f234 - f258;
+    f272 = f234 + f258;
+    f273 = f233 - f257;
+    f274 = f233 + f257;
+    f275 = f259 + f261;
+    f276 = 1.1758756024193588 * f259;
+    f277 = (-0.9807852804032304) * f275;
+    f278 = (-0.7856949583871021) * f261;
+    f279 = f276 + f277;
+    f280 = f278 - f277;
+    f281 = f263 + f265;
+    f282 = 1.3870398453221475 * f263;
+    f283 = (-0.5555702330196022) * f281;
+    f284 = 0.2758993792829431 * f265;
+    f285 = f282 + f283;
+    f286 = f284 - f283;
+    f287 = f267 + f269;
+    f288 = 0.7856949583871022 * f267;
+    f289 = 0.1950903220161283 * f287;
+    f290 = 1.1758756024193586 * f269;
+    f291 = f288 + f289;
+    f292 = f290 - f289;
+    f293 = f271 + f273;
+    f294 = (-0.2758993792829430) * f271;
+    f295 = 0.8314696123025452 * f293;
+    f296 = 1.3870398453221475 * f273;
+    f297 = f294 + f295;
+    f298 = f296 - f295;
+    f299 = f260 - f268;
+    f300 = f260 + f268;
+    f301 = f262 - f270;
+    f302 = f262 + f270;
+    f303 = f264 - f272;
+    f304 = f264 + f272;
+    f305 = f266 - f274;
+    f306 = f266 + f274;
+    f307 = f280 - f292;
+    f308 = f280 + f292;
+    f309 = f279 - f291;
+    f310 = f279 + f291;
+    f311 = f286 - f298;
+    f312 = f286 + f298;
+    f313 = f285 - f297;
+    f314 = f285 + f297;
+    f315 = f299 + f301;
+    f316 = 1.3065629648763766 * f299;
+    f317 = (-0.9238795325112866) * f315;
+    f318 = (-0.5411961001461967) * f301;
+    f319 = f316 + f317;
+    f320 = f318 - f317;
+    f321 = f303 + f305;
+    f322 = 0.5411961001461969 * f303;
+    f323 = 0.3826834323650898 * f321;
+    f324 = 1.3065629648763766 * f305;
+    f325 = f322 + f323;
+    f326 = f324 - f323;
+    f327 = f307 + f309;
+    f328 = 1.3065629648763766 * f307;
+    f329 = (-0.9238795325112866) * f327;
+    f330 = (-0.5411961001461967) * f309;
+    f331 = f328 + f329;
+    f332 = f330 - f329;
+    f333 = f311 + f313;
+    f334 = 0.5411961001461969 * f311;
+    f335 = 0.3826834323650898 * f333;
+    f336 = 1.3065629648763766 * f313;
+    f337 = f334 + f335;
+    f338 = f336 - f335;
+    f339 = f300 - f304;
+    f340 = f300 + f304;
+    f341 = f302 - f306;
+    f342 = f302 + f306;
+    f343 = f320 - f326;
+    f344 = f320 + f326;
+    f345 = f319 - f325;
+    f346 = f319 + f325;
+    f347 = f308 - f312;
+    f348 = f308 + f312;
+    f349 = f310 - f314;
+    f350 = f310 + f314;
+    f351 = f332 - f338;
+    f352 = f332 + f338;
+    f353 = f331 - f337;
+    f354 = f331 + f337;
+    f355 = f339 - f341;
+    f356 = f339 + f341;
+    f357 = 0.7071067811865474 * f355;
+    f358 = 0.7071067811865474 * f356;
+    f359 = f343 - f345;
+    f360 = f343 + f345;
+    f361 = 0.7071067811865474 * f359;
+    f362 = 0.7071067811865474 * f360;
+    f363 = f347 - f349;
+    f364 = f347 + f349;
+    f365 = 0.7071067811865474 * f363;
+    f366 = 0.7071067811865474 * f364;
+    f367 = f351 - f353;
+    f368 = f351 + f353;
+    f369 = 0.7071067811865474 * f367;
+    f370 = 0.7071067811865474 * f368;
+    f371 = t6[31] - t6[33];
+    f372 = t6[31] + t6[33];
+    f373 = 0.7071067811865476 * f372;
+    f374 = 0.7071067811865476 * f371;
+    f375 = t6[17] - t6[47];
+    f376 = t6[17] + t6[47];
+    f377 = 0.7071067811865476 * f376;
+    f378 = 0.7071067811865476 * f375;
+    f379 = t6[25] - t6[39];
+    f380 = t6[25] + t6[39];
+    f381 = 0.7071067811865476 * f380;
+    f382 = 0.7071067811865476 * f379;
+    f383 = t6[23] - t6[41];
+    f384 = t6[23] + t6[41];
+    f385 = 0.7071067811865476 * f384;
+    f386 = 0.7071067811865476 * f383;
+    f387 = t6[29] - t6[35];
+    f388 = t6[29] + t6[35];
+    f389 = 0.7071067811865476 * f388;
+    f390 = 0.7071067811865476 * f387;
+    f391 = t6[19] - t6[45];
+    f392 = t6[19] + t6[45];
+    f393 = 0.7071067811865476 * f392;
+    f394 = 0.7071067811865476 * f391;
+    f395 = t6[27] - t6[37];
+    f396 = t6[27] + t6[37];
+    f397 = 0.7071067811865476 * f396;
+    f398 = 0.7071067811865476 * f395;
+    f399 = t6[21] - t6[43];
+    f400 = t6[21] + t6[43];
+    f401 = 0.7071067811865476 * f400;
+    f402 = 0.7071067811865476 * f399;
+    f403 = t6[1] - f373;
+    f404 = t6[1] + f373;
+    f405 = t6[63] - f374;
+    f406 = t6[63] + f374;
+    f407 = t6[15] - f377;
+    f408 = t6[15] + f377;
+    f409 = t6[49] - f378;
+    f410 = t6[49] + f378;
+    f411 = t6[7] - f381;
+    f412 = t6[7] + f381;
+    f413 = t6[57] - f382;
+    f414 = t6[57] + f382;
+    f415 = t6[9] - f385;
+    f416 = t6[9] + f385;
+    f417 = t6[55] - f386;
+    f418 = t6[55] + f386;
+    f419 = t6[3] - f389;
+    f420 = t6[3] + f389;
+    f421 = t6[61] - f390;
+    f422 = t6[61] + f390;
+    f423 = t6[13] - f393;
+    f424 = t6[13] + f393;
+    f425 = t6[51] - f394;
+    f426 = t6[51] + f394;
+    f427 = t6[5] - f397;
+    f428 = t6[5] + f397;
+    f429 = t6[59] - f398;
+    f430 = t6[59] + f398;
+    f431 = t6[11] - f401;
+    f432 = t6[11] + f401;
+    f433 = t6[53] - f402;
+    f434 = t6[53] + f402;
+    f435 = f410 + f408;
+    f436 = (-0.5411961001461969) * f410;
+    f437 = 0.9238795325112867 * f435;
+    f438 = 1.3065629648763766 * f408;
+    f439 = f436 + f437;
+    f440 = f438 - f437;
+    f441 = f409 + f407;
+    f442 = 1.3065629648763770 * f409;
+    f443 = (-0.3826834323650904) * f441;
+    f444 = 0.5411961001461961 * f407;
+    f445 = f442 + f443;
+    f446 = f444 - f443;
+    f447 = f418 + f416;
+    f448 = (-0.5411961001461969) * f418;
+    f449 = 0.9238795325112867 * f447;
+    f450 = 1.3065629648763766 * f416;
+    f451 = f448 + f449;
+    f452 = f450 - f449;
+    f453 = f417 + f415;
+    f454 = 1.3065629648763770 * f417;
+    f455 = (-0.3826834323650904) * f453;
+    f456 = 0.5411961001461961 * f415;
+    f457 = f454 + f455;
+    f458 = f456 - f455;
+    f459 = f426 + f424;
+    f460 = (-0.5411961001461969) * f426;
+    f461 = 0.9238795325112867 * f459;
+    f462 = 1.3065629648763766 * f424;
+    f463 = f460 + f461;
+    f464 = f462 - f461;
+    f465 = f425 + f423;
+    f466 = 1.3065629648763770 * f425;
+    f467 = (-0.3826834323650904) * f465;
+    f468 = 0.5411961001461961 * f423;
+    f469 = f466 + f467;
+    f470 = f468 - f467;
+    f471 = f434 + f432;
+    f472 = (-0.5411961001461969) * f434;
+    f473 = 0.9238795325112867 * f471;
+    f474 = 1.3065629648763766 * f432;
+    f475 = f472 + f473;
+    f476 = f474 - f473;
+    f477 = f433 + f431;
+    f478 = 1.3065629648763770 * f433;
+    f479 = (-0.3826834323650904) * f477;
+    f480 = 0.5411961001461961 * f431;
+    f481 = f478 + f479;
+    f482 = f480 - f479;
+    f483 = f404 - f439;
+    f484 = f404 + f439;
+    f485 = f406 - f440;
+    f486 = f406 + f440;
+    f487 = f403 - f445;
+    f488 = f403 + f445;
+    f489 = f405 - f446;
+    f490 = f405 + f446;
+    f491 = f412 - f451;
+    f492 = f412 + f451;
+    f493 = f414 - f452;
+    f494 = f414 + f452;
+    f495 = f411 - f457;
+    f496 = f411 + f457;
+    f497 = f413 - f458;
+    f498 = f413 + f458;
+    f499 = f420 - f463;
+    f500 = f420 + f463;
+    f501 = f422 - f464;
+    f502 = f422 + f464;
+    f503 = f419 - f469;
+    f504 = f419 + f469;
+    f505 = f421 - f470;
+    f506 = f421 + f470;
+    f507 = f428 - f475;
+    f508 = f428 + f475;
+    f509 = f430 - f476;
+    f510 = f430 + f476;
+    f511 = f427 - f481;
+    f512 = f427 + f481;
+    f513 = f429 - f482;
+    f514 = f429 + f482;
+    f515 = f494 + f492;
+    f516 = (-0.7856949583871021) * f494;
+    f517 = 0.9807852804032304 * f515;
+    f518 = 1.1758756024193588 * f492;
+    f519 = f516 + f517;
+    f520 = f518 - f517;
+    f521 = f498 + f496;
+    f522 = 0.2758993792829431 * f498;
+    f523 = 0.5555702330196022 * f521;
+    f524 = 1.3870398453221475 * f496;
+    f525 = f522 + f523;
+    f526 = f524 - f523;
+    f527 = f493 + f491;
+    f528 = 1.1758756024193591 * f493;
+    f529 = (-0.1950903220161287) * f527;
+    f530 = 0.7856949583871016 * f491;
+    f531 = f528 + f529;
+    f532 = f530 - f529;
+    f533 = f497 + f495;
+    f534 = 1.3870398453221473 * f497;
+    f535 = (-0.8314696123025455) * f533;
+    f536 = (-0.2758993792829436) * f495;
+    f537 = f534 + f535;
+    f538 = f536 - f535;
+    f539 = f510 + f508;
+    f540 = (-0.7856949583871021) * f510;
+    f541 = 0.9807852804032304 * f539;
+    f542 = 1.1758756024193588 * f508;
+    f543 = f540 + f541;
+    f544 = f542 - f541;
+    f545 = f514 + f512;
+    f546 = 0.2758993792829431 * f514;
+    f547 = 0.5555702330196022 * f545;
+    f548 = 1.3870398453221475 * f512;
+    f549 = f546 + f547;
+    f550 = f548 - f547;
+    f551 = f509 + f507;
+    f552 = 1.1758756024193591 * f509;
+    f553 = (-0.1950903220161287) * f551;
+    f554 = 0.7856949583871016 * f507;
+    f555 = f552 + f553;
+    f556 = f554 - f553;
+    f557 = f513 + f511;
+    f558 = 1.3870398453221473 * f513;
+    f559 = (-0.8314696123025455) * f557;
+    f560 = (-0.2758993792829436) * f511;
+    f561 = f558 + f559;
+    f562 = f560 - f559;
+    f563 = f484 - f519;
+    f564 = f484 + f519;
+    f565 = f486 - f520;
+    f566 = f486 + f520;
+    f567 = f488 - f525;
+    f568 = f488 + f525;
+    f569 = f490 - f526;
+    f570 = f490 + f526;
+    f571 = f483 - f531;
+    f572 = f483 + f531;
+    f573 = f485 - f532;
+    f574 = f485 + f532;
+    f575 = f487 - f537;
+    f576 = f487 + f537;
+    f577 = f489 - f538;
+    f578 = f489 + f538;
+    f579 = f500 - f543;
+    f580 = f500 + f543;
+    f581 = f502 - f544;
+    f582 = f502 + f544;
+    f583 = f504 - f549;
+    f584 = f504 + f549;
+    f585 = f506 - f550;
+    f586 = f506 + f550;
+    f587 = f499 - f555;
+    f588 = f499 + f555;
+    f589 = f501 - f556;
+    f590 = f501 + f556;
+    f591 = f503 - f561;
+    f592 = f503 + f561;
+    f593 = f505 - f562;
+    f594 = f505 + f562;
+    f595 = f582 + f580;
+    f596 = (-0.8971675863426361) * f582;
+    f597 = 0.9951847266721968 * f595;
+    f598 = 1.0932018670017576 * f580;
+    f599 = f596 + f597;
+    f600 = f598 - f597;
+    f601 = f586 + f584;
+    f602 = (-0.4105245275223571) * f586;
+    f603 = 0.8819212643483549 * f601;
+    f604 = 1.3533180011743529 * f584;
+    f605 = f602 + f603;
+    f606 = f604 - f603;
+    f607 = f590 + f588;
+    f608 = 0.1386171691990915 * f590;
+    f609 = 0.6343932841636455 * f607;
+    f610 = 1.4074037375263826 * f588;
+    f611 = f608 + f609;
+    f612 = f610 - f609;
+    f613 = f594 + f592;
+    f614 = 0.6666556584777466 * f594;
+    f615 = 0.2902846772544623 * f613;
+    f616 = 1.2472250129866711 * f592;
+    f617 = f614 + f615;
+    f618 = f616 - f615;
+    f619 = f581 + f579;
+    f620 = 1.0932018670017574 * f581;
+    f621 = (-0.0980171403295605) * f619;
+    f622 = 0.8971675863426364 * f579;
+    f623 = f620 + f621;
+    f624 = f622 - f621;
+    f625 = f585 + f583;
+    f626 = 1.3533180011743529 * f585;
+    f627 = (-0.4713967368259979) * f625;
+    f628 = 0.4105245275223569 * f583;
+    f629 = f626 + f627;
+    f630 = f628 - f627;
+    f631 = f589 + f587;
+    f632 = 1.4074037375263826 * f589;
+    f633 = (-0.7730104533627369) * f631;
+    f634 = (-0.1386171691990913) * f587;
+    f635 = f632 + f633;
+    f636 = f634 - f633;
+    f637 = f593 + f591;
+    f638 = 1.2472250129866711 * f593;
+    f639 = (-0.9569403357322089) * f637;
+    f640 = (-0.6666556584777469) * f591;
+    f641 = f638 + f639;
+    f642 = f640 - f639;
+    f643 = f564 - f599;
+    f644 = f564 + f599;
+    f645 = f566 - f600;
+    f646 = f566 + f600;
+    f647 = f568 - f605;
+    f648 = f568 + f605;
+    f649 = f570 - f606;
+    f650 = f570 + f606;
+    f651 = f572 - f611;
+    f652 = f572 + f611;
+    f653 = f574 - f612;
+    f654 = f574 + f612;
+    f655 = f576 - f617;
+    f656 = f576 + f617;
+    f657 = f578 - f618;
+    f658 = f578 + f618;
+    f659 = f563 - f623;
+    f660 = f563 + f623;
+    f661 = f565 - f624;
+    f662 = f565 + f624;
+    f663 = f567 - f629;
+    f664 = f567 + f629;
+    f665 = f569 - f630;
+    f666 = f569 + f630;
+    f667 = f571 - f635;
+    f668 = f571 + f635;
+    f669 = f573 - f636;
+    f670 = f573 + f636;
+    f671 = f575 - f641;
+    f672 = f575 + f641;
+    f673 = f577 - f642;
+    f674 = f577 + f642;
+    f675 = f646 + f644;
+    f676 = (-0.9751575901732920) * f646;
+    f677 = 0.9996988186962043 * f675;
+    f678 = 1.0242400472191164 * f644;
+    f679 = f676 + f677;
+    t0[63] = f678 - f677;
+    f681 = f650 + f648;
+    f682 = (-0.8700688593994936) * f650;
+    f683 = 0.9924795345987100 * f681;
+    f684 = 1.1148902097979263 * f648;
+    f685 = f682 + f683;
+    f686 = f684 - f683;
+    f687 = f654 + f652;
+    f688 = (-0.7566008898816587) * f654;
+    f689 = 0.9757021300385286 * f687;
+    f690 = 1.1948033701953984 * f652;
+    f691 = f688 + f689;
+    f692 = f690 - f689;
+    f693 = f658 + f656;
+    f694 = (-0.6358464401941451) * f658;
+    f695 = 0.9495281805930367 * f693;
+    f696 = 1.2632099209919283 * f656;
+    f697 = f694 + f695;
+    f698 = f696 - f695;
+    f699 = f662 + f660;
+    f700 = (-0.5089684416985408) * f662;
+    f701 = 0.9142097557035307 * f699;
+    f702 = 1.3194510697085207 * f660;
+    f703 = f700 + f701;
+    f704 = f702 - f701;
+    f705 = f666 + f664;
+    f706 = (-0.3771887988789273) * f666;
+    f707 = 0.8700869911087114 * f705;
+    f708 = 1.3629851833384954 * f664;
+    f709 = f706 + f707;
+    f710 = f708 - f707;
+    f711 = f670 + f668;
+    f712 = (-0.2417766217337384) * f670;
+    f713 = 0.8175848131515837 * f711;
+    f714 = 1.3933930045694289 * f668;
+    f715 = f712 + f713;
+    f716 = f714 - f713;
+    f717 = f674 + f672;
+    f718 = (-0.1040360035527077) * f674;
+    f719 = 0.7572088465064845 * f717;
+    f720 = 1.4103816894602612 * f672;
+    f721 = f718 + f719;
+    f722 = f720 - f719;
+    f723 = f645 + f643;
+    f724 = 0.0347065382144002 * f645;
+    f725 = 0.6895405447370668 * f723;
+    f726 = 1.4137876276885337 * f643;
+    f727 = f724 + f725;
+    f728 = f726 - f725;
+    f729 = f649 + f647;
+    f730 = 0.1731148370459795 * f649;
+    f731 = 0.6152315905806268 * f729;
+    f732 = 1.4035780182072330 * f647;
+    f733 = f730 + f731;
+    f734 = f732 - f731;
+    f735 = f653 + f651;
+    f736 = 0.3098559453626100 * f653;
+    f737 = 0.5349976198870972 * f735;
+    f738 = 1.3798511851368043 * f651;
+    f739 = f736 + f737;
+    f740 = f738 - f737;
+    f741 = f657 + f655;
+    f742 = 0.4436129715409088 * f657;
+    f743 = 0.4496113296546065 * f741;
+    f744 = 1.3428356308501219 * f655;
+    f745 = f742 + f743;
+    f746 = f744 - f743;
+    f747 = f661 + f659;
+    f748 = 0.5730977622997509 * f661;
+    f749 = 0.3598950365349881 * f747;
+    f750 = 1.2928878353697271 * f659;
+    f751 = f748 + f749;
+    f752 = f750 - f749;
+    f753 = f665 + f663;
+    f754 = 0.6970633083205415 * f665;
+    f755 = 0.2667127574748984 * f753;
+    f756 = 1.2304888232703382 * f663;
+    f757 = f754 + f755;
+    f758 = f756 - f755;
+    f759 = f669 + f667;
+    f760 = 0.8143157536286401 * f669;
+    f761 = 0.1709618887603012 * f759;
+    f762 = 1.1562395311492424 * f667;
+    f763 = f760 + f761;
+    f764 = f762 - f761;
+    f765 = f673 + f671;
+    f766 = 0.9237258930790228 * f673;
+    f767 = 0.0735645635996674 * f765;
+    f768 = 1.0708550202783576 * f671;
+    f769 = f766 + f767;
+    f770 = f768 - f767;
+    t0[0] = f127 + f679;
+    t0[1] = f679 + f340;
+    t0[2] = f340 + f770;
+    t0[3] = f770 + f191;
+    t0[4] = f191 + f685;
+    t0[5] = f685 + f348;
+    t0[6] = f348 + f764;
+    t0[7] = f764 + f147;
+    t0[8] = f147 + f691;
+    t0[9] = f691 + f352;
+    t0[10] = f352 + f758;
+    t0[11] = f758 + f197;
+    t0[12] = f197 + f697;
+    t0[13] = f697 + f344;
+    t0[14] = f344 + f752;
+    t0[15] = f752 + f134;
+    t0[16] = f134 + f703;
+    t0[17] = f703 + f362;
+    t0[18] = f362 + f746;
+    t0[19] = f746 + f203;
+    t0[20] = f203 + f709;
+    t0[21] = f709 + f370;
+    t0[22] = f370 + f740;
+    t0[23] = f740 + f154;
+    t0[24] = f154 + f715;
+    t0[25] = f715 + f366;
+    t0[26] = f366 + f734;
+    t0[27] = f734 + f209;
+    t0[28] = f209 + f721;
+    t0[29] = f721 + f358;
+    t0[30] = f358 + f728;
+    t0[31] = f728 + f128;
+    t0[32] = f128 + f727;
+    t0[33] = f727 + f357;
+    t0[34] = f357 + f722;
+    t0[35] = f722 + f210;
+    t0[36] = f210 + f733;
+    t0[37] = f733 + f365;
+    t0[38] = f365 + f716;
+    t0[39] = f716 + f153;
+    t0[40] = f153 + f739;
+    t0[41] = f739 + f369;
+    t0[42] = f369 + f710;
+    t0[43] = f710 + f204;
+    t0[44] = f204 + f745;
+    t0[45] = f745 + f361;
+    t0[46] = f361 + f704;
+    t0[47] = f704 + f133;
+    t0[48] = f133 + f751;
+    t0[49] = f751 + f346;
+    t0[50] = f346 + f698;
+    t0[51] = f698 + f198;
+    t0[52] = f198 + f757;
+    t0[53] = f757 + f354;
+    t0[54] = f354 + f692;
+    t0[55] = f692 + f148;
+    t0[56] = f148 + f763;
+    t0[57] = f763 + f350;
+    t0[58] = f350 + f686;
+    t0[59] = f686 + f192;
+    t0[60] = f192 + f769;
+    t0[61] = f769 + f342;
+    t0[62] = f342 + t0[63];
+    for (i0=0; i0<64; i0++)
+    {
+        y[i0] = t0[-i0+63];
+    }
+}
+
+#endif
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/sbr_dct.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,45 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_dct.h,v 1.1 2003/07/29 08:20:13 menno Exp $
+**/
+
+#ifndef __SBR_DCT_H__
+#define __SBR_DCT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void DCT3_32_unscaled(real_t *y, real_t *x);
+void DCT2_64_unscaled(real_t *y, real_t *x);
+void DCT4_64(real_t *y, real_t *x);
+void DST4_64(real_t *y, real_t *x);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/sbr_dec.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,357 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** 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.5 2003/07/29 08:20:13 menno Exp $
+**/
+
+/*
+   SBR Decoder overview:
+
+   To achieve a synchronized output signal, the following steps have to be
+   acknowledged in the decoder:
+    - The bitstream parser divides the bitstream into two parts; the AAC
+      core coder part and the SBR part.
+    - The SBR bitstream part is fed to the bitstream de-multiplexer followed
+      by de-quantization The raw data is Huffman decoded.
+    - The AAC bitstream part is fed to the AAC core decoder, where the
+      bitstream data of the current frame is decoded, yielding a time domain
+      audio signal block of 1024 samples. The block length could easily be
+      adapted to other sizes e.g. 960.
+    - The core coder audio block is fed to the analysis QMF bank using a
+      delay of 1312 samples.
+    - The analysis QMF bank performs the filtering of the delayed core coder
+      audio signal. The output from the filtering is stored in the matrix
+      Xlow. The output from the analysis QMF bank is delayed tHFGen subband
+      samples, before being fed to the synthesis QMF bank. To achieve
+      synchronization tHFGen = 32, i.e. the value must equal the number of
+      subband samples corresponding to one frame.
+    - The HF generator calculates XHigh given the matrix XLow. The process
+      is guided by the SBR data contained in the current frame.
+    - The envelope adjuster calculates the matrix Y given the matrix XHigh
+      and the SBR envelope data, extracted from the SBR bitstream. To
+      achieve synchronization, tHFAdj has to be set to tHFAdj = 0, i.e. the
+      envelope adjuster operates on data delayed tHFGen subband samples.
+    - The synthesis QMF bank operates on the delayed output from the analysis
+      QMF bank and the output from the envelope adjuster.
+ */
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SBR_DEC
+
+#include <stdlib.h>
+
+#include "syntax.h"
+#include "bits.h"
+#include "sbr_syntax.h"
+#include "sbr_qmf.h"
+#include "sbr_hfgen.h"
+#include "sbr_hfadj.h"
+
+
+sbr_info *sbrDecodeInit()
+{
+    sbr_info *sbr = malloc(sizeof(sbr_info));
+    memset(sbr, 0, sizeof(sbr_info));
+
+    sbr->bs_freq_scale = 2;
+    sbr->bs_alter_scale = 1;
+    sbr->bs_noise_bands = 2;
+    sbr->bs_limiter_bands = 2;
+    sbr->bs_limiter_gains = 2;
+    sbr->bs_interpol_freq = 1;
+    sbr->bs_smoothing_mode = 1;
+    sbr->bs_start_freq = 5;
+    sbr->bs_amp_res = 1;
+    sbr->bs_samplerate_mode = 1;
+    sbr->prevEnvIsShort[0] = -1;
+    sbr->prevEnvIsShort[1] = -1;
+    sbr->header_count = 0;
+
+    return sbr;
+}
+
+void sbrDecodeEnd(sbr_info *sbr)
+{
+    uint8_t j;
+
+    if (sbr)
+    {
+        qmfa_end(sbr->qmfa[0]);
+        qmfs_end(sbr->qmfs[0]);
+        if (sbr->id_aac == ID_CPE)
+        {
+            qmfa_end(sbr->qmfa[1]);
+            qmfs_end(sbr->qmfs[1]);
+        }
+
+        if (sbr->Xcodec[0]) free(sbr->Xcodec[0]);
+        if (sbr->Xsbr[0]) free(sbr->Xsbr[0]);
+        if (sbr->Xcodec[1]) free(sbr->Xcodec[1]);
+        if (sbr->Xsbr[1]) free(sbr->Xsbr[1]);
+
+        for (j = 0; j < 5; j++)
+        {
+            if (sbr->G_temp_prev[0][j]) free(sbr->G_temp_prev[0][j]);
+            if (sbr->Q_temp_prev[0][j]) free(sbr->Q_temp_prev[0][j]);
+            if (sbr->G_temp_prev[1][j]) free(sbr->G_temp_prev[1][j]);
+            if (sbr->Q_temp_prev[1][j]) free(sbr->Q_temp_prev[1][j]);
+        }
+
+        free(sbr);
+    }
+}
+
+void sbr_save_prev_data(sbr_info *sbr, uint8_t ch)
+{
+    uint8_t i;
+
+    /* save data for next frame */
+    sbr->kx_prev = sbr->kx;
+
+    sbr->L_E_prev[ch] = sbr->L_E[ch];
+
+    sbr->f_prev[ch] = sbr->f[ch][sbr->L_E[ch] - 1];
+    for (i = 0; i < 64; 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++)
+    {
+        sbr->bs_add_harmonic_prev[ch][i] = sbr->bs_add_harmonic[ch][i];
+    }
+    sbr->bs_add_harmonic_flag_prev[ch] = sbr->bs_add_harmonic_flag[ch];
+
+    if (sbr->l_A[ch] == sbr->L_E[ch])
+        sbr->prevEnvIsShort[ch] = 0;
+    else
+        sbr->prevEnvIsShort[ch] = -1;
+}
+
+
+void sbrDecodeFrame(sbr_info *sbr, real_t *left_channel,
+                    real_t *right_channel, uint8_t id_aac,
+                    uint8_t just_seeked)
+{
+    int16_t i, k, l;
+
+    uint8_t dont_process = 0;
+    uint8_t ch, channels, ret;
+    real_t *ch_buf;
+
+    qmf_t X[32*64];
+#ifdef SBR_LOW_POWER
+    real_t deg[64];
+#endif
+
+    bitfile *ld = (bitfile*)malloc(sizeof(bitfile));
+
+
+    sbr->id_aac = id_aac;
+    channels = (id_aac == ID_SCE) ? 1 : 2;
+
+    /* initialise and read the bitstream */
+    faad_initbits(ld, sbr->data, sbr->data_size);
+
+    ret = sbr_extension_data(ld, sbr, id_aac);
+
+    if (sbr->data) free(sbr->data);
+    sbr->data = NULL;
+
+    ret = ld->error ? ld->error : ret;
+    faad_endbits(ld);
+    if (ld) free(ld);
+    ld = NULL;
+    if (ret || (sbr->header_count == 0))
+    {
+        /* don't process just upsample */
+        dont_process = 1;
+    }
+
+    if (just_seeked)
+        sbr->just_seeked = 1;
+    else
+        sbr->just_seeked = 0;
+
+    for (ch = 0; ch < channels; ch++)
+    {
+        if (sbr->frame == 0)
+        {
+            uint8_t j;
+            sbr->qmfa[ch] = qmfa_init(32);
+            sbr->qmfs[ch] = qmfs_init(64);
+            
+            for (j = 0; j < 5; j++)
+            {
+                sbr->G_temp_prev[ch][j] = malloc(64*sizeof(real_t));
+                sbr->Q_temp_prev[ch][j] = malloc(64*sizeof(real_t));
+            }
+
+            sbr->Xsbr[ch] = malloc((32+tHFGen)*64 * sizeof(qmf_t));
+            sbr->Xcodec[ch] = malloc((32+tHFGen)*32 * sizeof(qmf_t));
+
+            memset(sbr->Xsbr[ch], 0, (32+tHFGen)*64 * sizeof(qmf_t));
+            memset(sbr->Xcodec[ch], 0, (32+tHFGen)*32 * sizeof(qmf_t));
+        }
+
+        if (ch == 0)
+            ch_buf = left_channel;
+        else
+            ch_buf = right_channel;
+
+        for (i = 0; i < tHFAdj; i++)
+        {
+            int8_t j;
+            for (j = sbr->kx_prev; j < sbr->kx; j++)
+            {
+                QMF_RE(sbr->Xcodec[ch][i*32 + j]) = 0;
+#ifndef SBR_LOW_POWER
+                QMF_IM(sbr->Xcodec[ch][i*32 + j]) = 0;
+#endif
+            }
+        }
+
+        /* subband analysis */
+        sbr_qmf_analysis_32(sbr->qmfa[ch], ch_buf, sbr->Xcodec[ch], tHFGen);
+
+        if (!dont_process)
+        {
+            /* insert high frequencies here */
+            /* hf generation using patching */
+            hf_generation(sbr, sbr->Xcodec[ch], sbr->Xsbr[ch]
+#ifdef SBR_LOW_POWER
+                ,deg
+#endif
+                ,ch);
+
+#ifdef SBR_LOW_POWER
+            for (l = sbr->t_E[ch][0]; l < sbr->t_E[ch][sbr->L_E[ch]]; l++)
+            {
+                for (k = 0; k < sbr->kx; k++)
+                {
+                    QMF_RE(sbr->Xsbr[ch][(tHFAdj + l)*64 + k]) = 0;
+                }
+            }
+#endif
+
+            /* hf adjustment */
+            hf_adjustment(sbr, sbr->Xsbr[ch]
+#ifdef SBR_LOW_POWER
+                ,deg
+#endif
+                ,ch);
+        }
+
+        if ((sbr->just_seeked != 0) || dont_process)
+        {
+            for (l = 0; l < 32; l++)
+            {
+                for (k = 0; k < 32; k++)
+                {
+                    QMF_RE(X[l * 64 + k]) = QMF_RE(sbr->Xcodec[ch][(l + tHFAdj)*32 + k]);
+#ifndef SBR_LOW_POWER
+                    QMF_IM(X[l * 64 + k]) = QMF_IM(sbr->Xcodec[ch][(l + tHFAdj)*32 + k]);
+#endif
+                }
+                for (k = 32; k < 64; k++)
+                {
+                    QMF_RE(X[l * 64 + k]) = 0;
+#ifndef SBR_LOW_POWER
+                    QMF_IM(X[l * 64 + k]) = 0;
+#endif
+                }
+            }
+        } else {
+            for (l = 0; l < 32; l++)
+            {
+                uint8_t xover_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 * 64 + k]) = QMF_RE(sbr->Xcodec[ch][(l + tHFAdj)*32 + k]);
+#ifndef SBR_LOW_POWER
+                    QMF_IM(X[l * 64 + k]) = QMF_IM(sbr->Xcodec[ch][(l + tHFAdj)*32 + k]);
+#endif
+                }
+                for (k = xover_band; k < 64; k++)
+                {
+                    QMF_RE(X[l * 64 + k]) = QMF_RE(sbr->Xsbr[ch][(l + tHFAdj)*64 + k]);
+#ifndef SBR_LOW_POWER
+                    QMF_IM(X[l * 64 + k]) = QMF_IM(sbr->Xsbr[ch][(l + tHFAdj)*64 + k]);
+#endif
+                }
+#ifdef SBR_LOW_POWER
+                QMF_RE(X[l * 64 + xover_band - 1]) += QMF_RE(sbr->Xsbr[ch][(l + tHFAdj)*64 + xover_band - 1]);
+#endif
+            }
+        }
+
+        /* subband synthesis */
+        sbr_qmf_synthesis_64(sbr->qmfs[ch], (const complex_t*)X, ch_buf);
+
+        for (i = 0; i < 32; i++)
+        {
+            int8_t j;
+            for (j = 0; j < tHFGen; j++)
+            {
+                QMF_RE(sbr->Xcodec[ch][j*32 + i]) = QMF_RE(sbr->Xcodec[ch][(j+32)*32 + i]);
+#ifndef SBR_LOW_POWER
+                QMF_IM(sbr->Xcodec[ch][j*32 + i]) = QMF_IM(sbr->Xcodec[ch][(j+32)*32 + i]);
+#endif
+            }
+        }
+        for (i = 0; i < 64; i++)
+        {
+            int8_t j;
+            for (j = 0; j < tHFGen; j++)
+            {
+                QMF_RE(sbr->Xsbr[ch][j*64 + i]) = QMF_RE(sbr->Xsbr[ch][(j+32)*64 + i]);
+#ifndef SBR_LOW_POWER
+                QMF_IM(sbr->Xsbr[ch][j*64 + i]) = QMF_IM(sbr->Xsbr[ch][(j+32)*64 + i]);
+#endif
+            }
+        }
+    }
+
+    if (sbr->bs_header_flag)
+        sbr->just_seeked = 0;
+
+    if (sbr->header_count != 0)
+    {
+        for (ch = 0; ch < channels; ch++)
+            sbr_save_prev_data(sbr, ch);
+    }
+
+    sbr->frame++;
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/sbr_dec.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,199 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** 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.4 2003/07/29 08:20:13 menno Exp $
+**/
+
+#ifndef __SBR_DEC_H__
+#define __SBR_DEC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+#if 0
+    real_t post_exp_re[64];
+    real_t post_exp_im[64];
+#endif
+    real_t *x;
+    uint8_t channels;
+} qmfa_info;
+
+typedef struct {
+    real_t *v;
+    uint8_t channels;
+} qmfs_info;
+
+typedef struct
+{
+    uint32_t sample_rate;
+
+    uint8_t rate;
+    uint8_t just_seeked;
+
+    uint8_t amp_res[2];
+
+    uint8_t k0;
+    uint8_t kx;
+    uint8_t M;
+    uint8_t N_master;
+    uint8_t N_high;
+    uint8_t N_low;
+    uint8_t N_Q;
+    uint8_t N_L[4];
+    uint8_t n[2];
+
+    uint8_t f_master[64];
+    uint8_t f_table_res[2][64];
+    uint8_t f_table_noise[64];
+    uint8_t f_table_lim[4][64];
+#ifdef SBR_LOW_POWER
+    uint8_t f_group[5][64];
+    uint8_t N_G[5];
+#endif
+
+    uint8_t table_map_k_to_g[64];
+
+    uint8_t abs_bord_lead[2];
+    uint8_t abs_bord_trail[2];
+    uint8_t n_rel_lead[2];
+    uint8_t n_rel_trail[2];
+
+    uint8_t L_E[2];
+    uint8_t L_E_prev[2];
+    uint8_t L_Q[2];
+
+    uint8_t t_E[2][6];
+    uint8_t t_Q[2][3];
+    uint8_t f[2][6];
+    uint8_t f_prev[2];
+
+    real_t *G_temp_prev[2][5];
+    real_t *Q_temp_prev[2][5];
+
+    int16_t E[2][64][5];
+    int16_t E_prev[2][64];
+    real_t E_orig[2][64][5];
+    real_t E_curr[2][64][5];
+    int32_t Q[2][64][2];
+    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];
+    real_t bwArray[2][64];
+    real_t bwArray_prev[2][64];
+
+    uint8_t noPatches;
+    uint8_t patchNoSubbands[64];
+    uint8_t patchStartSubband[64];
+
+    uint8_t bs_add_harmonic[2][64];
+    uint8_t bs_add_harmonic_prev[2][64];
+
+    uint16_t index_noise_prev[2];
+    uint8_t psi_is_prev[2];
+
+    uint8_t bs_start_freq_prev;
+    uint8_t bs_stop_freq_prev;
+    uint8_t bs_xover_band_prev;
+    uint8_t bs_freq_scale_prev;
+    uint8_t bs_alter_scale_prev;
+    uint8_t bs_noise_bands_prev;
+
+    int8_t prevEnvIsShort[2];
+
+    int8_t kx_prev;
+
+    uint8_t Reset;
+    uint32_t frame;
+    uint32_t header_count;
+
+    uint8_t *data;
+    uint16_t data_size;
+
+    uint8_t id_aac;
+    qmfa_info *qmfa[2];
+    qmfs_info *qmfs[2];
+
+    qmf_t *Xsbr[2];
+    qmf_t *Xcodec[2];
+
+
+    /* to get it compiling */
+    /* we'll see during the coding of all the tools, whether
+       these are all used or not.
+    */
+    uint8_t bs_header_flag;
+    uint8_t bs_crc_flag;
+    uint16_t bs_sbr_crc_bits;
+    uint8_t bs_protocol_version;
+    uint8_t bs_amp_res;
+    uint8_t bs_start_freq;
+    uint8_t bs_stop_freq;
+    uint8_t bs_xover_band;
+    uint8_t bs_freq_scale;
+    uint8_t bs_alter_scale;
+    uint8_t bs_noise_bands;
+    uint8_t bs_limiter_bands;
+    uint8_t bs_limiter_gains;
+    uint8_t bs_interpol_freq;
+    uint8_t bs_smoothing_mode;
+    uint8_t bs_samplerate_mode;
+    uint8_t bs_add_harmonic_flag[2];
+    uint8_t bs_add_harmonic_flag_prev[2];
+    uint8_t bs_extended_data;
+    uint8_t bs_extension_id;
+    uint8_t bs_extension_data;
+    uint8_t bs_coupling;
+    uint8_t bs_frame_class[2];
+    uint8_t bs_rel_bord[2][9];
+    uint8_t bs_rel_bord_0[2][9];
+    uint8_t bs_rel_bord_1[2][9];
+    uint8_t bs_pointer[2];
+    uint8_t bs_abs_bord_0[2];
+    uint8_t bs_abs_bord_1[2];
+    uint8_t bs_num_rel_0[2];
+    uint8_t bs_num_rel_1[2];
+    uint8_t bs_df_env[2][9];
+    uint8_t bs_df_noise[2][3];
+} sbr_info;
+
+sbr_info *sbrDecodeInit();
+void sbrDecodeEnd(sbr_info *sbr);
+
+void sbrDecodeFrame(sbr_info *sbr, real_t *left_channel,
+                    real_t *right_channel, uint8_t id_aac,
+                    uint8_t just_seeked);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/sbr_e_nf.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,357 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_e_nf.c,v 1.1 2003/07/29 08:20:13 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SBR_DEC
+
+#include <stdlib.h>
+
+#include "sbr_syntax.h"
+#include "sbr_e_nf.h"
+
+void extract_envelope_data(sbr_info *sbr, uint8_t ch)
+{
+    uint8_t l, k;
+
+#if 0
+    if (sbr->frame == 19)
+    {
+        sbr->frame = 19;
+    }
+#endif
+
+    for (l = 0; l < sbr->L_E[ch]; l++)
+    {
+        if (sbr->bs_df_env[ch][l] == 0)
+        {
+            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];
+            }
+
+        } else { /* bs_df_env == 1 */
+
+            uint8_t g = (l == 0) ? sbr->f_prev[ch] : sbr->f[ch][l-1];
+            int16_t E_prev;
+
+            if (sbr->f[ch][l] == g)
+            {
+                for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
+                {
+                    if (l == 0)
+                        E_prev = sbr->E_prev[ch][k];
+                    else
+                        E_prev = sbr->E[ch][k][l - 1];
+
+                    sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l];
+                }
+
+            } else if ((g == 1) && (sbr->f[ch][l] == 0)) {
+                uint8_t i;
+
+                for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
+                {
+                    for (i = 0; i < sbr->N_high; i++)
+                    {
+                        if (sbr->f_table_res[HI_RES][i] == sbr->f_table_res[LO_RES][k])
+                        {
+                            if (l == 0)
+                                E_prev = sbr->E_prev[ch][i];
+                            else
+                                E_prev = sbr->E[ch][i][l - 1];
+
+                            sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l];
+                        }
+                    }
+                }
+
+            } else if ((g == 0) && (sbr->f[ch][l] == 1)) {
+                uint8_t i;
+
+                for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
+                {
+                    for (i = 0; i < sbr->N_low; i++)
+                    {
+                        if ((sbr->f_table_res[LO_RES][i] <= sbr->f_table_res[HI_RES][k]) &&
+                            (sbr->f_table_res[HI_RES][k] < sbr->f_table_res[LO_RES][i + 1]))
+                        {
+                            if (l == 0)
+                                E_prev = sbr->E_prev[ch][i];
+                            else
+                                E_prev = sbr->E[ch][i][l - 1];
+
+                            sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l];
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+#if 0
+    if (sbr->frame == 23)
+    {
+        int l, k;
+
+        for (l = 0; l < sbr->L_E[ch]; l++)
+        {
+            for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
+            {
+                //printf("l:%d k:%d E:%d\n",l,k, sbr->E[ch][k][l]);
+                printf("%d\n", sbr->E[ch][k][l]);
+            }
+        }
+        printf("\n");
+    }
+#endif
+}
+
+void extract_noise_floor_data(sbr_info *sbr, uint8_t ch)
+{
+    uint8_t l, k;
+
+    for (l = 0; l < sbr->L_Q[ch]; l++)
+    {
+        if (sbr->bs_df_noise[ch][l] == 0)
+        {
+            for (k = 1; k < sbr->N_Q; k++)
+            {
+                sbr->Q[ch][k][l] = sbr->Q[ch][k][l] + sbr->Q[ch][k-1][l];
+            }
+        } else {
+            if (l == 0)
+            {
+                for (k = 0; k < sbr->N_Q; k++)
+                {
+                    sbr->Q[ch][k][l] = sbr->Q_prev[ch][k] + sbr->Q[ch][k][0];
+                }
+            } else {
+                for (k = 0; k < sbr->N_Q; k++)
+                {
+                    sbr->Q[ch][k][l] = sbr->Q[ch][k][l - 1] + sbr->Q[ch][k][l];
+                }
+            }
+        }
+    }
+
+#if 0
+    if (sbr->frame == 23)
+    {
+        int l, k;
+
+        for (l = 0; l < sbr->L_Q[ch]; l++)
+        {
+            for (k = 0; k < sbr->N_Q; k++)
+            {
+                //printf("l:%d k:%d E:%d\n",l,k, sbr->E[ch][k][l]);
+                printf("%d\n", sbr->Q[ch][k][l]);
+            }
+        }
+        printf("\n");
+    }
+#endif
+}
+
+/* FIXME: pow() not needed */
+void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch)
+{
+    if (sbr->bs_coupling == 0)
+    {
+        uint8_t l, k;
+#ifdef FIXED_POINT
+        uint8_t amp = (sbr->amp_res[ch]) ? 0 : 1;
+#else
+        real_t amp = (sbr->amp_res[ch]) ? 1.0 : 0.5;
+#endif
+
+        for (l = 0; l < sbr->L_E[ch]; l++)
+        {
+            for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
+            {
+#ifndef FIXED_POINT
+                /* +6 for the *64 */
+                sbr->E_orig[ch][k][l] = pow(2, sbr->E[ch][k][l]*amp + 6);
+#else
+                int8_t exp;
+
+                /* +6 for the *64 and -10 for the /32 in the synthesis QMF
+                 * since this is a energy value: (x/32)^2 = (x^2)/1024
+                 */
+                exp = (sbr->E[ch][k][l] >> amp) + 6 - 10;
+
+//                printf("%d\n", exp);
+
+                if (exp < 0)
+                    sbr->E_orig[ch][k][l] = 0; //REAL_CONST(1) >> -exp;
+                else
+                    sbr->E_orig[ch][k][l] = 1 << exp; //REAL_CONST(1) << exp;
+
+                if (amp && (sbr->E[ch][k][l] & 1))
+                    sbr->E_orig[ch][k][l] = MUL(sbr->E_orig[ch][k][l], REAL_CONST(1.414213562));
+#endif
+            }
+        }
+
+        for (l = 0; l < sbr->L_Q[ch]; l++)
+        {
+            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 {
+#ifndef FIXED_POINT
+                    sbr->Q_orig[ch][k][l] = pow(2, NOISE_FLOOR_OFFSET - sbr->Q[ch][k][l]);
+#else
+                    int8_t exp = NOISE_FLOOR_OFFSET - sbr->Q[ch][k][l];
+                    if (exp < 0)
+                        sbr->Q_orig[ch][k][l] = REAL_CONST(1) >> -exp;
+                    else
+                        sbr->Q_orig[ch][k][l] = REAL_CONST(1) << exp;
+#endif
+                }
+            }
+        }
+    }
+}
+
+void unmap_envelope_noise(sbr_info *sbr)
+{
+    uint8_t l, k;
+#ifdef FIXED_POINT
+    uint8_t amp0 = (sbr->amp_res[0]) ? 0 : 1;
+    uint8_t amp1 = (sbr->amp_res[1]) ? 0 : 1;
+#else
+    real_t amp0 = (sbr->amp_res[0]) ? 1.0 : 0.5;
+    real_t amp1 = (sbr->amp_res[1]) ? 1.0 : 0.5;
+#endif
+
+    for (l = 0; l < sbr->L_E[0]; l++)
+    {
+        for (k = 0; k < sbr->n[sbr->f[0][l]]; k++)
+        {
+            real_t l_temp, r_temp;
+
+#ifdef FIXED_POINT
+            int8_t exp;
+
+            /* +6: * 64 ; +1: * 2 ; -10: /1024 QMF */
+            exp = (sbr->E[0][k][l] >> amp0) - 3;
+
+//            printf("%d\n", exp);
+
+            if (exp < 0)
+                l_temp = REAL_CONST(1) >> -exp;
+            else
+                l_temp = REAL_CONST(1) << exp;
+
+            if (amp0 && (sbr->E[0][k][l] & 1))
+                l_temp = MUL(l_temp, REAL_CONST(1.414213562373095));
+
+            /* UN_MAP removed: (x / 4096) same as (x >> 12) */
+            exp = (sbr->E[1][k][l] >> amp1) - 12;
+
+//            printf("%d\n", exp);
+
+            if (exp < 0)
+                r_temp = REAL_CONST(1) >> -exp;
+            else
+                r_temp = REAL_CONST(1) << exp;
+
+            if (amp1 && (sbr->E[1][k][l] & 1))
+                r_temp = MUL(r_temp, REAL_CONST(1.414213562373095));
+#else
+            /* +6: * 64 ; +1: * 2 */
+            l_temp = pow(2, sbr->E[0][k][l]*amp0 + 7);
+            /* UN_MAP removed: (x / 4096) same as (x >> 12) */
+            r_temp = pow(2, sbr->E[1][k][l]*amp1 - 12);
+#endif
+
+
+#ifdef FIXED_POINT
+            {
+                real_t tmp = REAL_CONST(1.0) + r_temp;
+                sbr->E_orig[1][k][l] = SBR_DIV(l_temp, tmp);
+            }
+#else
+            sbr->E_orig[1][k][l] = l_temp / (1.0 + r_temp);
+#endif
+            sbr->E_orig[0][k][l] = MUL(r_temp, sbr->E_orig[1][k][l]);
+
+#ifdef FIXED_POINT
+            sbr->E_orig[0][k][l] >>= REAL_BITS;
+            sbr->E_orig[1][k][l] >>= REAL_BITS;
+#endif
+
+            //printf("%f\t%f\n", sbr->E_orig[0][k][l] /(float)(1<<REAL_BITS), sbr->E_orig[1][k][l] /(float)(1<<REAL_BITS));
+            //printf("%f\t%f\n", sbr->E_orig[0][k][l]/1024., sbr->E_orig[1][k][l]/1024.);
+        }
+    }
+    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] > 30))
+            {
+                sbr->Q_orig[0][k][l] = 0;
+                sbr->Q_orig[1][k][l] = 0;
+            } else {
+                real_t l_temp, r_temp;
+
+#ifndef FIXED_POINT
+                l_temp = pow(2.0, NOISE_FLOOR_OFFSET - sbr->Q[0][k][l] + 1);
+                r_temp = pow(2.0, sbr->Q[1][k][l] - 12);
+#else
+                int8_t exp;
+
+                exp = NOISE_FLOOR_OFFSET - sbr->Q[0][k][l] + 1;
+                if (exp < 0)
+                    l_temp = REAL_CONST(1) >> -exp;
+                else
+                    l_temp = REAL_CONST(1) << exp;
+
+                exp = sbr->Q[1][k][l] - 12;
+                if (exp < 0)
+                    r_temp = REAL_CONST(1) >> -exp;
+                else
+                    r_temp = REAL_CONST(1) << exp;
+#endif
+
+#ifdef FIXED_POINT
+                sbr->Q_orig[1][k][l] = SBR_DIV(l_temp, (REAL_CONST(1.0) + r_temp));
+#else
+                sbr->Q_orig[1][k][l] = l_temp / (1.0 + r_temp);
+#endif
+                sbr->Q_orig[0][k][l] = MUL(r_temp, sbr->Q_orig[1][k][l]);
+            }
+        }
+    }
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/sbr_e_nf.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,44 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_e_nf.h,v 1.1 2003/07/29 08:20:13 menno Exp $
+**/
+
+#ifndef __SBR_E_NF_H__
+#define __SBR_E_NF_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void extract_envelope_data(sbr_info *sbr, uint8_t ch);
+void extract_noise_floor_data(sbr_info *sbr, uint8_t ch);
+void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/sbr_fbt.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,541 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_fbt.c,v 1.1 2003/07/29 08:20:13 menno Exp $
+**/
+
+/* Calculate frequency band tables */
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SBR_DEC
+
+#include <stdlib.h>
+
+#include "sbr_syntax.h"
+#include "sbr_fbt.h"
+
+
+/* calculate the start QMF channel for the master frequency band table */
+/* parameter is also called k0 */
+uint16_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode,
+                           uint32_t sample_rate)
+{
+    static int8_t offset[7][16] = {
+        { -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7 },
+        { -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13 },
+        { -5, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16 },
+        { -6, -4, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16 },
+        { -4, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20 },
+        { -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20, 24 },
+        { 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20, 24, 28, 33 }
+    };
+    uint8_t startMin;
+
+    if (sample_rate >= 64000)
+    {
+        startMin = (uint8_t)((5000.*128.)/(float)sample_rate + 0.5);
+    } else if (sample_rate < 32000) {
+        startMin = (uint8_t)((3000.*128.)/(float)sample_rate + 0.5);
+    } else {
+        startMin = (uint8_t)((4000.*128.)/(float)sample_rate + 0.5);
+    }
+
+    if (bs_samplerate_mode)
+    {
+        switch (sample_rate)
+        {
+        case 16000:
+            return startMin + offset[0][bs_start_freq];
+        case 22050:
+            return startMin + offset[1][bs_start_freq];
+        case 24000:
+            return startMin + offset[2][bs_start_freq];
+        case 32000:
+            return startMin + offset[3][bs_start_freq];
+        default:
+            if (sample_rate > 64000)
+            {
+                return startMin + offset[5][bs_start_freq];
+            } else { /* 44100 <= sample_rate <= 64000 */
+                return startMin + offset[4][bs_start_freq];
+            }
+        }
+    } else {
+        return startMin + offset[6][bs_start_freq];
+    }
+}
+
+static int32_t longcmp(const void *a, const void *b)
+{
+    return ((int32_t)(*(int32_t*)a - *(int32_t*)b));
+}
+
+/* calculate the stop QMF channel for the master frequency band table */
+/* parameter is also called k2 */
+uint16_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate,
+                          uint16_t k0)
+{
+    if (bs_stop_freq == 15)
+    {
+        return min(64, k0 * 3);
+    } else if (bs_stop_freq == 14) {
+        return min(64, k0 * 2);
+    } else {
+        uint8_t i;
+        uint8_t stopMin;
+        int32_t stopDk[13], stopDk_t[14], k2;
+
+        if (sample_rate >= 64000)
+        {
+            stopMin = (uint8_t)((10000.*128.)/(float)sample_rate + 0.5);
+        } else if (sample_rate < 32000) {
+            stopMin = (uint8_t)((6000.*128.)/(float)sample_rate + 0.5);
+        } else {
+            stopMin = (uint8_t)((8000.*128.)/(float)sample_rate + 0.5);
+        }
+
+        for (i = 0; i <= 13; i++)
+        {
+            stopDk_t[i] = (int32_t)(stopMin*pow(64.0/stopMin, i/13.0) + 0.5);
+        }
+        for (i = 0; i < 13; i++)
+        {
+            stopDk[i] = stopDk_t[i+1] - stopDk_t[i];
+        }
+
+        /* needed? or does this always reverse the array? */
+        qsort(stopDk, 13, sizeof(stopDk[0]), longcmp);
+
+        k2 = stopMin;
+        for (i = 0; i < bs_stop_freq; i++)
+        {
+            k2 += stopDk[i];
+        }
+        return min(64, k2);
+    }
+
+    return 0;
+}
+
+/* calculate the master frequency table from k0, k2, bs_freq_scale
+   and bs_alter_scale
+
+   version for bs_freq_scale = 0
+*/
+void master_frequency_table_fs0(sbr_info *sbr, uint16_t k0, uint16_t k2,
+                                uint8_t bs_alter_scale)
+{
+    int8_t incr;
+    uint8_t k;
+    uint8_t dk;
+    uint32_t nrBands, k2Achieved;
+    int32_t k2Diff, vDk[64];
+
+    memset(vDk, 0, 64*sizeof(int32_t));
+
+    /* mft only defined for k2 > k0 */
+    if (k2 <= k0)
+    {
+        sbr->N_master = 0;
+        return;
+    }
+
+    dk = bs_alter_scale ? 2 : 1;
+    nrBands = 2 * (int32_t)((float)(k2-k0)/(dk*2) + (-1+dk)/2.0f);
+    nrBands = min(nrBands, 64);
+
+    k2Achieved = k0 + nrBands * dk;
+    k2Diff = k2 - k2Achieved;
+    /* for (k = 0; k <= nrBands; k++) Typo fix */
+    for (k = 0; k < nrBands; k++)
+        vDk[k] = dk;
+
+    if (k2Diff)
+    {
+        incr = (k2Diff > 0) ? -1 : 1;
+        k = (k2Diff > 0) ? (nrBands-1) : 0;
+
+        while (k2Diff != 0)
+        {
+            vDk[k] -= incr;
+            k += incr;
+            k2Diff += incr;
+        }
+    }
+
+    sbr->f_master[0] = k0;
+    for (k = 1; k <= nrBands; k++)
+        sbr->f_master[k] = sbr->f_master[k-1] + vDk[k-1];
+
+    sbr->N_master = nrBands;
+    sbr->N_master = min(sbr->N_master, 64);
+
+#if 0
+    printf("f_master[%d]: ", nrBands);
+    for (k = 0; k <= nrBands; k++)
+    {
+        printf("%d ", sbr->f_master[k]);
+    }
+    printf("\n");
+#endif
+}
+
+/*
+   version for bs_freq_scale > 0
+*/
+void master_frequency_table(sbr_info *sbr, uint16_t k0, uint16_t k2,
+                            uint8_t bs_freq_scale, uint8_t bs_alter_scale)
+{
+    uint8_t k, bands, twoRegions;
+    uint16_t k1;
+    uint32_t nrBand0, nrBand1;
+    int32_t vDk0[64], vDk1[64];
+    int32_t vk0[64], vk1[64];
+    float warp;
+    uint8_t temp1[] = { 12, 10, 8 };
+    float temp2[] = { 1.0, 1.3 };
+
+    /* without memset code enters infinte loop,
+       so there must be some wrong table access */
+    memset(vDk0, 0, 64*sizeof(int32_t));
+    memset(vDk1, 0, 64*sizeof(int32_t));
+    memset(vk0, 0, 64*sizeof(int32_t));
+    memset(vk1, 0, 64*sizeof(int32_t));
+
+    /* mft only defined for k2 > k0 */
+    if (k2 <= k0)
+    {
+        sbr->N_master = 0;
+        return;
+    }
+
+    bands = temp1[bs_freq_scale-1];
+    warp = temp2[bs_alter_scale];
+
+    if ((float)k2/(float)k0 > 2.2449)
+    {
+        twoRegions = 1;
+        k1 = 2 * k0;
+    } else {
+        twoRegions = 0;
+        k1 = k2;
+    }
+
+    nrBand0 = 2 * (int32_t)(bands * log((float)k1/(float)k0)/(2.0*log(2.0)) + 0.5);
+    nrBand0 = min(nrBand0, 64);
+    for (k = 0; k <= nrBand0; k++)
+    {
+        /* MAPLE */
+        vDk0[k] = (int32_t)(k0 * pow((float)k1/(float)k0, (k+1)/(float)nrBand0)+0.5) -
+            (int32_t)(k0 * pow((float)k1/(float)k0, k/(float)nrBand0)+0.5);
+    }
+
+    /* needed? */
+    qsort(vDk0, nrBand0, sizeof(vDk0[0]), longcmp);
+
+    vk0[0] = k0;
+    for (k = 1; k <= nrBand0; k++)
+    {
+        vk0[k] = vk0[k-1] + vDk0[k-1];
+    }
+
+    if (!twoRegions)
+    {
+        for (k = 0; k <= nrBand0; k++)
+            sbr->f_master[k] = vk0[k];
+
+        sbr->N_master = nrBand0;
+        sbr->N_master = min(sbr->N_master, 64);
+        return;
+    }
+
+    nrBand1 = 2 * (int32_t)(bands * log((float)k2/(float)k1)/(2.0 * log(2.0) * warp) + 0.5);
+    nrBand1 = min(nrBand1, 64);
+
+    for (k = 0; k <= nrBand1 - 1; k++)
+    {
+        vDk1[k] = (int32_t)(k1 * pow((float)k2/(float)k1, (k+1)/(float)nrBand1)+0.5) -
+            (int32_t)(k1 * pow((float)k2/(float)k1, k/(float)nrBand1)+0.5);
+    }
+
+    if (vDk1[0] < vDk0[nrBand0 - 1])
+    {
+        int32_t change;
+
+        /* needed? */
+        qsort(vDk1, nrBand1 + 1, sizeof(vDk1[0]), longcmp);
+        change = vDk0[nrBand0 - 1] - vDk1[0];
+        vDk1[0] = vDk0[nrBand0 - 1];
+        vDk1[nrBand1 - 1] = vDk1[nrBand1 - 1] - change;
+    }
+
+    /* needed? */
+    qsort(vDk1, nrBand1, sizeof(vDk1[0]), longcmp);
+    vk1[0] = k1;
+    for (k = 1; k <= nrBand1; k++)
+    {
+        vk1[k] = vk1[k-1] + vDk1[k-1];
+    }
+
+    sbr->N_master = nrBand0 + nrBand1;
+    sbr->N_master = min(sbr->N_master, 64);
+    for (k = 0; k <= nrBand0; k++)
+    {
+        sbr->f_master[k] = vk0[k];
+    }
+    for (k = nrBand0 + 1; k <= sbr->N_master; k++)
+    {
+        sbr->f_master[k] = vk1[k - nrBand0];
+    }
+
+#if 0
+    printf("f_master[%d]: ", sbr->N_master);
+    for (k = 0; k <= sbr->N_master; k++)
+    {
+        printf("%d ", sbr->f_master[k]);
+    }
+    printf("\n");
+#endif
+}
+
+/* calculate the derived frequency border tables from f_master */
+void derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band,
+                             uint16_t k2)
+{
+    uint8_t k, i;
+    uint32_t minus;
+
+    sbr->N_high = sbr->N_master - bs_xover_band;
+
+    /* is this accurate? */
+    sbr->N_low = sbr->N_high/2 + (sbr->N_high - 2 * (sbr->N_high/2));
+
+    sbr->n[0] = sbr->N_low;
+    sbr->n[1] = sbr->N_high;
+
+    for (k = 0; k <= sbr->N_high; k++)
+    {
+        sbr->f_table_res[HI_RES][k] = sbr->f_master[k + bs_xover_band];
+    }
+
+    sbr->M = sbr->f_table_res[HI_RES][sbr->N_high] - sbr->f_table_res[HI_RES][0];
+    sbr->kx = sbr->f_table_res[HI_RES][0];
+
+    /* correct? */
+    minus = (sbr->N_high & 1) ? 1 : 0;
+
+    for (k = 0; k <= sbr->N_low; k++)
+    {
+        if (k == 0)
+            i = 0;
+        else
+            i = 2*k - minus;
+        sbr->f_table_res[LO_RES][k] = sbr->f_table_res[HI_RES][i];
+    }
+    /* end correct? */
+
+#if 0
+    printf("f_table_res[HI_RES][%d]: ", sbr->N_high);
+    for (k = 0; k <= sbr->N_high; k++)
+    {
+        printf("%d ", sbr->f_table_res[HI_RES][k]);
+    }
+    printf("\n");
+#endif
+#if 0
+    printf("f_table_res[LO_RES][%d]: ", sbr->N_low);
+    for (k = 0; k <= sbr->N_low; k++)
+    {
+        printf("%d ", sbr->f_table_res[LO_RES][k]);
+    }
+    printf("\n");
+#endif
+
+    sbr->N_Q = 0;
+    if (sbr->bs_noise_bands == 0)
+    {
+        sbr->N_Q = 1;
+    } else {
+        /* MAPLE */
+        sbr->N_Q = max(1, (int32_t)(sbr->bs_noise_bands*(log(k2/(float)sbr->kx)/log(2.0)) + 0.5));
+        if (sbr->N_Q == 0)
+            sbr->N_Q = 1;
+    }
+    sbr->N_Q = min(5, sbr->N_Q);
+
+    for (k = 0; k <= sbr->N_Q; k++)
+    {
+        if (k == 0)
+            i = 0;
+        else /* is this accurate? */
+            i = i + (int32_t)((sbr->N_low - i)/(sbr->N_Q + 1 - k));
+        sbr->f_table_noise[k] = sbr->f_table_res[LO_RES][i];
+    }
+
+    /* build table for mapping k to g in hf patching */
+    for (k = 0; k < 64; k++)
+    {
+        uint8_t g;
+        for (g = 0; g < sbr->N_Q; g++)
+        {
+            if ((sbr->f_table_noise[g] <= k) &&
+                (k < sbr->f_table_noise[g+1]))
+            {
+                sbr->table_map_k_to_g[k] = g;
+                break;
+            }
+        }
+    }
+
+#if 0
+    printf("f_table_noise[%d]: ", sbr->N_Q);
+    for (k = 0; k <= sbr->N_Q; k++)
+    {
+        printf("%d ", sbr->f_table_noise[k]);
+    }
+    printf("\n");
+#endif
+}
+
+/* TODO: blegh, ugly */
+/* Modified to calculate for all possible bs_limiter_bands always
+ * This reduces the number calls to this functions needed (now only on
+ * header reset)
+ */
+void limiter_frequency_table(sbr_info *sbr)
+{
+    static real_t limiterBandsPerOctave[] = { REAL_CONST(1.2),
+        REAL_CONST(2), REAL_CONST(3) };
+    uint8_t k, s;
+    int8_t nrLim;
+    int32_t limTable[100 /*TODO*/];
+    uint8_t patchBorders[64/*??*/];
+    real_t limBands;
+
+    sbr->f_table_lim[0][0] = sbr->f_table_res[LO_RES][0] - sbr->kx;
+    sbr->f_table_lim[0][1] = sbr->f_table_res[LO_RES][sbr->N_low] - sbr->kx;
+    sbr->N_L[0] = 1;
+
+    for (s = 1; s < 4; s++)
+    {
+        memset(limTable, 0, 100*sizeof(int32_t));
+
+        limBands = limiterBandsPerOctave[s - 1];
+
+        patchBorders[0] = sbr->kx;
+        for (k = 1; k <= sbr->noPatches; k++)
+        {
+            patchBorders[k] = patchBorders[k-1] + sbr->patchNoSubbands[k-1];
+        }
+
+        for (k = 0; k <= sbr->N_low; k++)
+        {
+            limTable[k] = sbr->f_table_res[LO_RES][k];
+        }
+        for (k = 1; k < sbr->noPatches; k++)
+        {
+            limTable[k+sbr->N_low] = patchBorders[k];
+        }
+
+        /* needed */
+        qsort(limTable, sbr->noPatches + sbr->N_low, sizeof(limTable[0]), longcmp);
+        k = 1;
+        nrLim = sbr->noPatches + sbr->N_low - 1;
+
+        if (nrLim < 0) // TODO: BIG FAT PROBLEM
+            return;
+
+restart:
+        if (k <= nrLim)
+        {
+            real_t nOctaves;
+
+            if (limTable[k-1] != 0)
+                nOctaves = REAL_CONST(log((float)limTable[k]/(float)limTable[k-1])/log(2.0));
+            else
+                nOctaves = 0;
+
+            if ((MUL(nOctaves,limBands)) < REAL_CONST(0.49))
+            {
+                uint8_t i;
+                if (limTable[k] != limTable[k-1])
+                {
+                    uint8_t found = 0, found2 = 0;
+                    for (i = 0; i <= sbr->noPatches; i++)
+                    {
+                        if (limTable[k] == patchBorders[i])
+                            found = 1;
+                    }
+                    if (found)
+                    {
+                        found2 = 0;
+                        for (i = 0; i <= sbr->noPatches; i++)
+                        {
+                            if (limTable[k-1] == patchBorders[i])
+                                found2 = 1;
+                        }
+                        if (found2)
+                        {
+                            k++;
+                            goto restart;
+                        } else {
+                            /* remove (k-1)th element */
+                            limTable[k-1] = sbr->f_table_res[LO_RES][sbr->N_low];
+                            qsort(limTable, sbr->noPatches + sbr->N_low, sizeof(limTable[0]), longcmp);
+                            nrLim--;
+                            goto restart;
+                        }
+                    }
+                }
+                /* remove kth element */
+                limTable[k] = sbr->f_table_res[LO_RES][sbr->N_low];
+                qsort(limTable, nrLim, sizeof(limTable[0]), longcmp);
+                nrLim--;
+                goto restart;
+            } else {
+                k++;
+                goto restart;
+            }
+        }
+
+        sbr->N_L[s] = nrLim;
+        for (k = 0; k <= nrLim; k++)
+        {
+            sbr->f_table_lim[s][k] = limTable[k] - sbr->kx;
+        }
+
+#if 0
+        printf("f_table_lim[%d][%d]: ", s, sbr->N_L[s]);
+        for (k = 0; k <= sbr->N_L[s]; k++)
+        {
+            printf("%d ", sbr->f_table_lim[s][k]);
+        }
+        printf("\n");
+#endif
+    }
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/sbr_fbt.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,52 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_fbt.h,v 1.1 2003/07/29 08:20:13 menno Exp $
+**/
+
+#ifndef __SBR_FBT_H__
+#define __SBR_FBT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+uint16_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode,
+                           uint32_t sample_rate);
+uint16_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate,
+                          uint16_t k0);
+void master_frequency_table_fs0(sbr_info *sbr, uint16_t k0, uint16_t k2,
+                                uint8_t bs_alter_scale);
+void master_frequency_table(sbr_info *sbr, uint16_t k0, uint16_t k2,
+                            uint8_t bs_freq_scale, uint8_t bs_alter_scale);
+void derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band,
+                             uint16_t k2);
+void limiter_frequency_table(sbr_info *sbr);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/sbr_hfadj.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,987 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_hfadj.c,v 1.1 2003/07/29 08:20:13 menno Exp $
+**/
+
+/* High Frequency adjustment */
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SBR_DEC
+
+#include "sbr_syntax.h"
+#include "sbr_hfadj.h"
+
+#include "sbr_noise.h"
+
+void hf_adjustment(sbr_info *sbr, qmf_t *Xsbr
+#ifdef SBR_LOW_POWER
+                   ,real_t *deg /* aliasing degree */
+#endif
+                   ,uint8_t ch)
+{
+    sbr_hfadj_info adj;
+
+    memset(&adj, 0, sizeof(sbr_hfadj_info));
+
+    map_noise_data(sbr, &adj, ch);
+    map_sinusoids(sbr, &adj, ch);
+
+    estimate_current_envelope(sbr, &adj, Xsbr, ch);
+
+    calculate_gain(sbr, &adj, ch);
+
+#if 1
+
+#ifdef SBR_LOW_POWER
+    calc_gain_groups(sbr, &adj, deg, ch);
+    aliasing_reduction(sbr, &adj, deg, ch);
+#endif
+
+    hf_assembly(sbr, &adj, Xsbr, ch);
+
+#endif
+}
+
+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;
+    } else if (sbr->bs_frame_class[ch] == VARFIX) {
+        if (sbr->bs_pointer[ch] > 1)
+            sbr->l_A[ch] = -1;
+        else
+            sbr->l_A[ch] = sbr->bs_pointer[ch] - 1;
+    } else {
+        if (sbr->bs_pointer[ch] == 0)
+            sbr->l_A[ch] = -1;
+        else
+            sbr->l_A[ch] = sbr->L_E[ch] + 1 - sbr->bs_pointer[ch];
+    }
+
+    for (l = 0; l < 5; l++)
+    {
+        for (i = 0; i < 64; i++)
+        {
+            adj->S_index_mapped[i][l] = 0;
+            adj->S_mapped[i][l] = 0;
+        }
+    }
+
+    for (l = 0; l < sbr->L_E[ch]; l++)
+    {
+        for (i = 0; i < sbr->N_high; i++)
+        {
+            for (m = sbr->f_table_res[HI_RES][i]; m < sbr->f_table_res[HI_RES][i+1]; m++)
+            {
+                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 0
+                if (sbr->frame == 95)
+                {
+                    printf("%d %d %d %d %d\n", adj->S_index_mapped[m - sbr->kx][l],
+                        sbr->bs_add_harmonic[ch][i], sbr->bs_add_harmonic_prev[ch][i],
+                        l, sbr->l_A[ch]);
+                }
+#endif
+            }
+        }
+    }
+
+    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;
+            }
+        }
+    }
+}
+
+static void estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj, qmf_t *Xsbr,
+                                      uint8_t ch)
+{
+    uint8_t m, l, j, k, k_l, k_h, p;
+    real_t nrg, div;
+
+    if (sbr->bs_interpol_freq == 1)
+    {
+        for (l = 0; l < sbr->L_E[ch]; l++)
+        {
+            uint8_t i, l_i, u_i;
+
+            l_i = sbr->t_E[ch][l];
+            u_i = sbr->t_E[ch][l+1];
+
+            div = (real_t)(u_i - l_i);
+
+            for (m = 0; m < sbr->M; m++)
+            {
+                nrg = 0;
+
+                for (i = l_i + tHFAdj; i < u_i + tHFAdj; i++)
+                {
+#ifdef FIXED_POINT
+                    nrg += ((QMF_RE(Xsbr[(i<<6) + m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[(i<<6) + m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS);
+#else
+                    nrg += MUL(QMF_RE(Xsbr[(i<<6) + m + sbr->kx]), QMF_RE(Xsbr[(i<<6) + m + sbr->kx]))
+#ifndef SBR_LOW_POWER
+                        + MUL(QMF_IM(Xsbr[(i<<6) + m + sbr->kx]), QMF_IM(Xsbr[(i<<6) + 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 {
+        for (l = 0; l < sbr->L_E[ch]; l++)
+        {
+            for (p = 0; p < sbr->n[sbr->f[ch][l]]; p++)
+            {
+                k_l = sbr->f_table_res[sbr->f[ch][l]][p];
+                k_h = sbr->f_table_res[sbr->f[ch][l]][p+1];
+
+                for (k = k_l; k < k_h; k++)
+                {
+                    uint8_t i, l_i, u_i;
+                    nrg = 0.0;
+
+                    l_i = sbr->t_E[ch][l];
+                    u_i = sbr->t_E[ch][l+1];
+
+                    div = (real_t)((u_i - l_i)*(k_h - k_l + 1));
+
+                    for (i = l_i + tHFAdj; i < u_i + tHFAdj; i++)
+                    {
+                        for (j = k_l; j < k_h; j++)
+                        {
+#ifdef FIXED_POINT
+                            nrg += ((QMF_RE(Xsbr[(i<<6) + j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[(i<<6) + j])+(1<<(REAL_BITS-1)))>>REAL_BITS);
+#else
+                            nrg += MUL(QMF_RE(Xsbr[(i<<6) + j]), QMF_RE(Xsbr[(i<<6) + j]))
+#ifndef SBR_LOW_POWER
+                                + MUL(QMF_IM(Xsbr[(i<<6) + j]), QMF_IM(Xsbr[(i<<6) + 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 step(shift) \
+    if ((0x40000000l >> shift) + root <= value)       \
+    {                                                 \
+        value -= (0x40000000l >> shift) + root;       \
+        root = (root >> 1) | (0x40000000l >> shift);  \
+    } else {                                          \
+        root = root >> 1;                             \
+    }
+
+/* fixed point square root approximation */
+real_t sbr_sqrt(real_t value)
+{
+    real_t root = 0;
+
+    step( 0); step( 2); step( 4); step( 6);
+    step( 8); step(10); step(12); step(14);
+    step(16); step(18); step(20); step(22);
+    step(24); step(26); step(28); step(30);
+
+    if (root < value)
+        ++root;
+
+    root <<= (REAL_BITS/2);
+
+    return root;
+}
+real_t sbr_sqrt_int(real_t value)
+{
+    real_t root = 0;
+
+    step( 0); step( 2); step( 4); step( 6);
+    step( 8); step(10); step(12); step(14);
+    step(16); step(18); step(20); step(22);
+    step(24); step(26); step(28); step(30);
+
+    if (root < value)
+        ++root;
+
+    return root;
+}
+#define SBR_SQRT_FIX(A) sbr_sqrt(A)
+#define SBR_SQRT_INT(A) sbr_sqrt_int(A)
+#endif
+
+#ifdef FIXED_POINT
+#define EPS (1) /* smallest number available in fixed point */
+#else
+#define EPS (1e-12)
+#endif
+
+#ifdef FIXED_POINT
+#define ONE (REAL_CONST(1)>>10)
+#else
+#define ONE (1)
+#endif
+
+
+#ifdef FIXED_POINT
+static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
+{
+    uint8_t m, l, k, i;
+
+    real_t Q_M_lim[64];
+    real_t G_lim[64];
+    real_t G_boost;
+    real_t S_M[64];
+    uint8_t table_map_res_to_m[64];
+
+
+    for (l = 0; l < sbr->L_E[ch]; l++)
+    {
+        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++)
+        {
+            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;
+            }
+        }
+
+        for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++)
+        {
+            real_t G_max;
+            real_t den = 0;
+            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++)
+            {
+                /* E_orig: integer */
+                acc1 += sbr->E_orig[ch][table_map_res_to_m[m]][l];
+                /* E_curr: integer */
+                acc2 += sbr->E_curr[ch][m][l];
+            }
+
+            /* G_max: fixed point */
+            if (acc2 == 0)
+            {
+                G_max = 0xFFF;
+            } else {
+                G_max = (((int64_t)acc1)<<REAL_BITS) / acc2;
+                switch (sbr->bs_limiter_gains)
+                {
+                case 0: G_max >>= 1; break;
+                case 2: G_max <<= 1; break;
+                default: break;
+                }
+            }
+
+            //printf("%f %d %d\n", G_max /(float)(1<<REAL_BITS), acc1, acc2);
+
+            for (m = sbr->f_table_lim[sbr->bs_limiter_bands][k];
+                 m < sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; m++)
+            {
+                real_t d, Q_M, G;
+                real_t div2;
+
+                /* Q_mapped: fixed point */
+                /* div2: fixed point COEF */
+                real_t tmp2 = adj->Q_mapped[m][l] << (COEF_BITS-REAL_BITS);
+                real_t tmp = COEF_CONST(1) + tmp2;
+                if (tmp == 0)
+                    div2 = COEF_CONST(1);
+                else
+                    div2 = (((int64_t)tmp2 << COEF_BITS)/tmp);
+
+                //printf("%f\n", div2 / (float)(1<<COEF_BITS));
+
+                /* Q_M: integer */
+                Q_M = MUL_R_C(sbr->E_orig[ch][table_map_res_to_m[m]][l], div2);
+
+                //printf("%d\n", Q_M /* / (float)(1<<REAL_BITS)*/);
+
+                if (adj->S_mapped[m][l] == 0)
+                {
+                    real_t tmp, tmp2;
+
+                    S_M[m] = 0;
+
+                    /* d: fixed point */
+                    tmp2 = adj->Q_mapped[m][l] /* << (COEF_BITS-REAL_BITS)*/;
+                    tmp = REAL_CONST(1) + delta*tmp2;
+                    d = (((int64_t)REAL_CONST(1))<<REAL_BITS) / (tmp);
+
+                    /* G: fixed point */
+                    G = (((int64_t)sbr->E_orig[ch][table_map_res_to_m[m]][l])<<REAL_BITS) / (1 + sbr->E_curr[ch][m][l]);
+                    G = MUL(G, d);
+
+                    //printf("%f\n", G/(float)(1<<REAL_BITS));
+
+                } else {
+
+                    real_t div;
+
+                    /* div: fixed point COEF */
+                    real_t tmp = COEF_CONST(1.0) + (adj->Q_mapped[m][l] << (COEF_BITS-REAL_BITS));
+                    real_t tmp2 = COEF_CONST(adj->S_mapped[m][l]);
+                    if (tmp == 0)
+                        div = COEF_CONST(1);
+                    else
+                        div = (((int64_t)tmp2 << COEF_BITS)/tmp);
+
+                    //printf("%f\n", div/(float)(1<<COEF_BITS));
+
+                    /* S_M: integer */
+                    S_M[m] = MUL_R_C(sbr->E_orig[ch][table_map_res_to_m[m]][l], div);
+
+                    //printf("%d\n", S_M[m]);
+
+                    /* G: fixed_point */
+                    if ((ONE + sbr->E_curr[ch][m][l]) == 0)
+                        G = 0xFFF; // uhm???
+                    else {
+                        real_t tmp = ONE + sbr->E_curr[ch][m][l];
+                        /* tmp2: fixed point */
+                        real_t tmp2 = (((int64_t)(sbr->E_orig[ch][table_map_res_to_m[m]][l]))<<REAL_BITS)/(tmp);
+                        G = MUL_R_C(tmp2, div2);
+                    }
+
+                    //printf("%f\n", G/(float)(1<<REAL_BITS));
+                }
+
+                /* limit the additional noise energy level */
+                /* and apply the limiter */
+
+                /* G_lim: fixed point */
+                /* Q_M_lim: integer */
+                if (G_max > G)
+                {
+                    Q_M_lim[m] = Q_M;
+                    G_lim[m] = G;
+                } else {
+                    real_t tmp;
+                    if (G == 0)
+                        tmp = 0xFFF;
+                    else
+                        tmp = SBR_DIV(G_max, G);
+                    Q_M_lim[m] = MUL(Q_M, tmp);
+                    G_lim[m] = G_max;
+                }
+
+                /* E_curr: integer, using MUL() is NOT OK */
+                den += MUL(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])
+                    den += Q_M_lim[m];
+            }
+
+            //printf("%d\n", den);
+
+            /* G_boost: fixed point */
+            if ((den + EPS) == 0)
+                G_boost = REAL_CONST(2.51188643);
+            else
+                G_boost = (((int64_t)(acc1 + EPS))<<REAL_BITS)/(den + EPS);
+            G_boost = min(G_boost, REAL_CONST(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++)
+            {
+                /* apply compensation to gain, noise floor sf's and sinusoid levels */
+#ifndef SBR_LOW_POWER
+                /* G_lim_boost: fixed point */
+                adj->G_lim_boost[l][m] = SBR_SQRT_FIX(MUL(G_lim[m], G_boost));
+#else
+                /* sqrt() will be done after the aliasing reduction to save a
+                 * few multiplies
+                 */
+                /* G_lim_boost: fixed point */
+                adj->G_lim_boost[l][m] = MUL(G_lim[m], G_boost);
+#endif
+                /* Q_M_lim_boost: integer */
+                adj->Q_M_lim_boost[l][m] = SBR_SQRT_INT(MUL(Q_M_lim[m], G_boost));
+
+                /* S_M_boost: integer */
+                if (adj->S_index_mapped[m][l])
+                    adj->S_M_boost[l][m] = SBR_SQRT_INT(MUL(S_M[m], G_boost));
+                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;
+
+    real_t Q_M_lim[64];
+    real_t G_lim[64];
+    real_t G_boost;
+    real_t S_M[64];
+    uint8_t table_map_res_to_m[64];
+
+
+    for (l = 0; l < sbr->L_E[ch]; l++)
+    {
+        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++)
+        {
+            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;
+            }
+        }
+
+        for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++)
+        {
+            real_t G_max;
+            real_t den = 0;
+            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++)
+            {
+                acc1 += sbr->E_orig[ch][table_map_res_to_m[m]][l];
+                acc2 += sbr->E_curr[ch][m][l];
+            }
+
+            G_max = ((EPS + acc1)/(EPS + acc2)) * limGain[sbr->bs_limiter_gains];
+            G_max = min(G_max, 1e10);
+
+            //printf("%f %d %d\n", G_max, (int)floor((acc1+EPS)/1024.), (int)floor((acc2+EPS)/1024.));
+
+            for (m = sbr->f_table_lim[sbr->bs_limiter_bands][k];
+                 m < sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; m++)
+            {
+                real_t d, Q_M, G;
+                real_t div2;
+
+                div2 = adj->Q_mapped[m][l] / (1 + adj->Q_mapped[m][l]);
+
+                //printf("%f\n", div2);
+
+                Q_M = sbr->E_orig[ch][table_map_res_to_m[m]][l] * div2;
+
+                //printf("%f\n", Q_M/1024.);
+
+                if (adj->S_mapped[m][l] == 0)
+                {
+                    S_M[m] = 0;
+
+                    /* fixed point: delta* can stay since it's either 1 or 0 */
+                    d = (1 + sbr->E_curr[ch][m][l]) * (1 + delta*adj->Q_mapped[m][l]);
+
+                    //printf("%f\n", d/1024.);
+
+                    G = sbr->E_orig[ch][table_map_res_to_m[m]][l] / d;
+
+                    //printf("%f\n", G);
+
+                } else {
+                    real_t div;
+
+                    div = adj->S_mapped[m][l] / (1. + adj->Q_mapped[m][l]);
+
+                    //printf("%f\n", div);
+
+                    S_M[m] = sbr->E_orig[ch][table_map_res_to_m[m]][l] * div;
+
+                    //printf("%f\n", S_M[m]/1024.);
+
+                    G = (sbr->E_orig[ch][table_map_res_to_m[m]][l] / (1. + sbr->E_curr[ch][m][l])) * div2;
+
+                    //printf("%f\n", G);
+                }
+
+                /* limit the additional noise energy level */
+                /* and apply the limiter */
+                if (G_max > G)
+                {
+                    Q_M_lim[m] = Q_M;
+                    G_lim[m] = G;
+                } else {
+                    Q_M_lim[m] = Q_M * G_max / G;
+                    G_lim[m] = G_max;
+
+                    //printf("%f\n", Q_M_lim[m] / 1024.);
+                }
+
+                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])
+                    den += Q_M_lim[m];
+            }
+
+            //printf("%f\n", den/1024.);
+
+            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++)
+            {
+                /* apply compensation to gain, noise floor sf's and sinusoid levels */
+#ifndef SBR_LOW_POWER
+                adj->G_lim_boost[l][m] = sqrt(G_lim[m] * G_boost);
+#else
+                /* sqrt() will be done after the aliasing reduction to save a
+                 * few multiplies
+                 */
+                adj->G_lim_boost[l][m] = G_lim[m] * G_boost;
+#endif
+                adj->Q_M_lim_boost[l][m] = sqrt(Q_M_lim[m] * G_boost);
+
+                if (adj->S_index_mapped[m][l])
+                    adj->S_M_boost[l][m] = sqrt(S_M[m] * G_boost);
+                else
+                    adj->S_M_boost[l][m] = 0;
+            }
+        }
+    }
+}
+#endif
+
+#ifdef SBR_LOW_POWER
+static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch)
+{
+    uint8_t l, k, i;
+    uint8_t grouping;
+
+    for (l = 0; l < sbr->L_E[ch]; l++)
+    {
+        i = 0;
+        grouping = 0;
+
+        for (k = sbr->kx; k < sbr->kx + sbr->M - 1; k++)
+        {
+            if (deg[k + 1] && adj->S_mapped[k-sbr->kx][l] == 0)
+            {
+                if (grouping == 0)
+                {
+                    sbr->f_group[l][i] = k;
+                    grouping = 1;
+                    i++;
+                }
+            } else {
+                if (grouping)
+                {
+                    if (adj->S_mapped[k-sbr->kx][l])
+                        sbr->f_group[l][i] = k;
+                    else
+                        sbr->f_group[l][i] = k + 1;
+                    grouping = 0;
+                    i++;
+                }
+            }
+        }        
+
+        if (grouping)
+        {
+            sbr->f_group[l][i] = sbr->kx + sbr->M;
+            i++;
+        }
+
+        sbr->N_G[l] = (uint8_t)(i >> 1);
+    }
+}
+
+static void aliasing_reduction(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch)
+{
+    uint8_t l, k, m;
+    real_t E_total, E_total_est, G_target, acc;
+
+    for (l = 0; l < sbr->L_E[ch]; l++)
+    {
+        for (k = 0; k < sbr->N_G[l]; k++)
+        {
+            E_total_est = E_total = 0;
+            
+            for (m = sbr->f_group[l][k<<1]; m < sbr->f_group[l][(k<<1) + 1]; m++)
+            {
+                /* E_curr: integer */
+                /* G_lim_boost: fixed point */
+                /* E_total_est: integer */
+                /* E_total: integer */
+                E_total_est += sbr->E_curr[ch][m-sbr->kx][l];
+                E_total += MUL(sbr->E_curr[ch][m-sbr->kx][l], adj->G_lim_boost[l][m-sbr->kx]);
+            }
+
+            /* G_target: fixed point */
+            if ((E_total_est + EPS) == 0)
+                G_target = 0;
+            else
+#ifdef FIXED_POINT
+                G_target = (((int64_t)(E_total))<<REAL_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 */
+                if (m < sbr->kx + sbr->M - 1)
+                {
+                    alpha = max(deg[m], deg[m + 1]);
+                } else {
+                    alpha = deg[m];
+                }
+
+                adj->G_lim_boost[l][m-sbr->kx] = MUL(alpha, G_target) +
+                    MUL((REAL_CONST(1)-alpha), adj->G_lim_boost[l][m-sbr->kx]);
+
+                /* acc: integer */
+                acc += MUL(adj->G_lim_boost[l][m-sbr->kx], sbr->E_curr[ch][m-sbr->kx][l]);
+            }
+
+            /* acc: fixed point */
+            if (acc + EPS == 0)
+                acc = 0;
+            else
+#ifdef FIXED_POINT
+                acc = (((int64_t)(E_total))<<REAL_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(acc, adj->G_lim_boost[l][m-sbr->kx]);
+            }
+        }
+    }
+
+    for (l = 0; l < sbr->L_E[ch]; l++)
+    {
+        for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++)
+        {
+            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_FIX(adj->G_lim_boost[l][m]);
+#else
+                 adj->G_lim_boost[l][m] = sqrt(adj->G_lim_boost[l][m]);
+#endif
+            }
+        }
+    }
+}
+#endif
+
+static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj,
+                        qmf_t *Xsbr, 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)
+    };
+    static int8_t phi_re[] = { 1, 0, -1, 0 };
+    static int8_t phi_im[] = { 0, 1, 0, -1 };
+
+    uint8_t m, l, i, n;
+    uint16_t fIndexNoise = 0;
+    uint8_t fIndexSine = 0;
+    uint8_t assembly_reset = 0;
+    real_t *temp;
+
+    real_t G_filt, Q_filt;
+
+    uint8_t h_SL;
+
+
+    if (sbr->Reset == 1)
+    {
+        assembly_reset = 1;
+        fIndexNoise = 0;
+    } else {
+        fIndexNoise = sbr->index_noise_prev[ch];
+    }
+    fIndexSine = sbr->psi_is_prev[ch];
+
+
+    for (l = 0; l < sbr->L_E[ch]; l++)
+    {
+        uint8_t no_noise = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 1 : 0;
+
+#ifdef SBR_LOW_POWER
+        h_SL = 0;
+#else
+        h_SL = (sbr->bs_smoothing_mode == 1) ? 0 : 4;
+        h_SL = (no_noise ? 0 : h_SL);
+#endif
+
+        if (assembly_reset)
+        {
+            for (n = 0; n < 4; n++)
+            {
+                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));
+            }
+            assembly_reset = 0;
+        }
+
+
+        for (i = sbr->t_E[ch][l]; i < sbr->t_E[ch][l+1]; i++)
+        {
+#ifdef SBR_LOW_POWER
+            uint8_t i_min1, i_plus1;
+            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));
+
+            for (m = 0; m < sbr->M; m++)
+            {
+                uint8_t j;
+                qmf_t psi;
+
+
+                G_filt = 0;
+                Q_filt = 0;
+                j = 0;
+
+                if (h_SL != 0)
+                {
+                    for (n = 0; n <= 4; n++)
+                    {
+                        G_filt += MUL_R_C(sbr->G_temp_prev[ch][n][m], h_smooth[j]);
+                        Q_filt += MUL_R_C(sbr->Q_temp_prev[ch][n][m], h_smooth[j]);
+                        j++;
+                    }
+                } else {
+                    G_filt = sbr->G_temp_prev[ch][4][m];
+                    Q_filt = sbr->Q_temp_prev[ch][4][m];
+                }
+
+                Q_filt = (adj->S_M_boost[l][m] != 0 || no_noise) ? 0 : Q_filt;
+
+#if 0
+                if (sbr->frame == 155)
+                {
+                    printf("%f\n", G_filt);
+                }
+#endif
+
+                /* add noise to the output */
+                fIndexNoise = (fIndexNoise + 1) & 511;
+
+#if 0
+                printf("%d %f\n", Q_filt, RE(V[fIndexNoise])/(float)(1<<COEF_BITS));
+#endif
+
+                /* the smoothed gain values are applied to Xsbr */
+                /* V is defined, not calculated */
+#ifdef FIXED_POINT
+                QMF_RE(Xsbr[((i + tHFAdj)<<6) + m+sbr->kx]) = MUL(G_filt, QMF_RE(Xsbr[((i + tHFAdj)<<6) + m+sbr->kx]))
+                    + MUL_R_C((Q_filt<<REAL_BITS), RE(V[fIndexNoise]));
+#else
+                QMF_RE(Xsbr[((i + tHFAdj)<<6) + m+sbr->kx]) = MUL(G_filt, QMF_RE(Xsbr[((i + tHFAdj)<<6) + m+sbr->kx]))
+                    + MUL_R_C(Q_filt, RE(V[fIndexNoise]));
+#endif
+                if (sbr->bs_extension_id == 3 && sbr->bs_extension_data == 42)
+                    QMF_RE(Xsbr[((i + tHFAdj)<<6) + m+sbr->kx]) = 16428320;
+#ifndef SBR_LOW_POWER
+                QMF_IM(Xsbr[((i + tHFAdj)<<6) + m+sbr->kx]) = MUL(G_filt, QMF_IM(Xsbr[((i + tHFAdj)<<6) + m+sbr->kx]))
+                    + MUL_R_C(Q_filt, IM(V[fIndexNoise]));
+#endif
+
+
+                if (adj->S_index_mapped[m][l])
+                {
+                    int8_t rev = ((m + sbr->kx) & 1) ? -1 : 1;
+                    QMF_RE(psi) = MUL(adj->S_M_boost[l][m], phi_re[fIndexSine]);
+                    QMF_RE(Xsbr[((i + tHFAdj)<<6) + m+sbr->kx]) += QMF_RE(psi);
+
+#ifndef SBR_LOW_POWER
+                    QMF_IM(psi) = rev * MUL(adj->S_M_boost[l][m], phi_im[fIndexSine]);
+                    QMF_IM(Xsbr[((i + tHFAdj)<<6) + m+sbr->kx]) += QMF_IM(psi);
+#else
+                    i_min1 = (fIndexSine - 1) & 3;
+                    i_plus1 = (fIndexSine + 1) & 3;
+
+                    if (m == 0)
+                    {
+                        QMF_RE(Xsbr[((i + tHFAdj)<<6) + m+sbr->kx - 1]) -=
+                            (rev * MUL_R_C(MUL(adj->S_M_boost[l][0], phi_re[i_plus1]), COEF_CONST(0.00815)));
+                        QMF_RE(Xsbr[((i + tHFAdj)<<6) + m+sbr->kx]) -=
+                            (rev * MUL_R_C(MUL(adj->S_M_boost[l][1], phi_re[i_plus1]), COEF_CONST(0.00815)));
+                    }
+                    if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16))
+                    {
+                        QMF_RE(Xsbr[((i + tHFAdj)<<6) + m+sbr->kx]) -=
+                            (rev * MUL_R_C(MUL(adj->S_M_boost[l][m - 1], phi_re[i_min1]), COEF_CONST(0.00815)));
+                        QMF_RE(Xsbr[((i + tHFAdj)<<6) + m+sbr->kx]) -=
+                            (rev * MUL_R_C(MUL(adj->S_M_boost[l][m + 1], phi_re[i_plus1]), COEF_CONST(0.00815)));
+                    }
+                    if ((m == sbr->M - 1) && (sinusoids < 16) && (m + sbr->kx + 1 < 63))
+                    {
+                        QMF_RE(Xsbr[((i + tHFAdj)<<6) + m+sbr->kx]) -=
+                            (rev * MUL_R_C(MUL(adj->S_M_boost[l][m - 1], phi_re[i_min1]), COEF_CONST(0.00815)));
+                        QMF_RE(Xsbr[((i + tHFAdj)<<6) + m+sbr->kx + 1]) -=
+                            (rev * MUL_R_C(MUL(adj->S_M_boost[l][m + 1], phi_re[i_min1]), COEF_CONST(0.00815)));
+                    }
+
+                    sinusoids++;
+#endif
+                }
+            }
+
+            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;
+        }
+    }
+
+    sbr->index_noise_prev[ch] = fIndexNoise;
+    sbr->psi_is_prev[ch] = fIndexSine;
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/sbr_hfadj.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,74 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_hfadj.h,v 1.1 2003/07/29 08:20:13 menno Exp $
+**/
+
+#ifndef __SBR_HFADJ_H__
+#define __SBR_HFADJ_H__
+
+#ifdef __cplusplus
+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];
+
+} sbr_hfadj_info;
+
+
+void hf_adjustment(sbr_info *sbr, qmf_t *Xsbr
+#ifdef SBR_LOW_POWER
+                   ,real_t *deg
+#endif
+                   ,uint8_t ch);
+
+
+static void map_envelope_data(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch);
+static void map_noise_data(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch);
+static void map_sinusoids(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch);
+static void estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj, qmf_t *Xsbr,
+                                      uint8_t ch);
+static void additional_component_levels(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch);
+static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch);
+#ifdef SBR_LOW_POWER
+static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch);
+static void aliasing_reduction(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch);
+#endif
+static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj, qmf_t *Xsbr, uint8_t ch);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/sbr_hfgen.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,497 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_hfgen.c,v 1.1 2003/07/29 08:20:13 menno Exp $
+**/
+
+/* High Frequency generation */
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SBR_DEC
+
+#include "sbr_syntax.h"
+#include "sbr_hfgen.h"
+#include "sbr_fbt.h"
+
+void hf_generation(sbr_info *sbr, qmf_t *Xlow,
+                   qmf_t *Xhigh
+#ifdef SBR_LOW_POWER
+                   ,real_t *deg
+#endif
+                   ,uint8_t ch)
+{
+    uint8_t l, i, x;
+    complex_t alpha_0[64], alpha_1[64];
+#ifdef SBR_LOW_POWER
+    real_t rxx[64];
+#endif
+
+
+    calc_chirp_factors(sbr, ch);
+
+    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_aliasing_degree(sbr, rxx, deg);
+#endif
+
+    /* actual HF generation */
+    for (i = 0; i < sbr->noPatches; i++)
+    {
+        for (x = 0; x < sbr->patchNoSubbands[i]; x++)
+        {
+            complex_t a0, a1;
+            real_t bw, bw2;
+            uint8_t q, p, k, g;
+
+            /* find the low and high band for patching */
+            k = sbr->kx + x;
+            for (q = 0; q < i; q++)
+            {
+                k += sbr->patchNoSubbands[q];
+            }
+            p = sbr->patchStartSubband[i] + x;
+
+#ifdef SBR_LOW_POWER
+            if (x != 0 /*x < sbr->patchNoSubbands[i]-1*/)
+                deg[k] = deg[p];
+            else
+                deg[k] = 0;
+#endif
+
+            g = sbr->table_map_k_to_g[k];
+
+            bw = sbr->bwArray[ch][g];
+            bw2 = MUL_C_C(bw, bw);
+
+            /* do the patching */
+            /* with or without filtering */
+            if (bw2 > 0)
+            {
+                RE(a0) = MUL_R_C(RE(alpha_0[p]), bw);
+                RE(a1) = MUL_R_C(RE(alpha_1[p]), bw2);
+#ifndef SBR_LOW_POWER
+                IM(a0) = MUL_R_C(IM(alpha_0[p]), bw);
+                IM(a1) = MUL_R_C(IM(alpha_1[p]), bw2);
+#endif
+
+                for (l = sbr->t_E[ch][0]; l < sbr->t_E[ch][sbr->L_E[ch]]; l++)
+                {
+                    QMF_RE(Xhigh[((l + tHFAdj)<<6) + k]) = QMF_RE(Xlow[((l + tHFAdj)<<5) + p]);
+#ifndef SBR_LOW_POWER
+                    QMF_IM(Xhigh[((l + tHFAdj)<<6) + k]) = QMF_IM(Xlow[((l + tHFAdj)<<5) + p]);
+#endif
+
+#ifdef SBR_LOW_POWER
+                    QMF_RE(Xhigh[((l + tHFAdj)<<6) + k]) += (
+                        MUL(RE(a0), QMF_RE(Xlow[((l - 1 + tHFAdj)<<5) + p])) +
+                        MUL(RE(a1), QMF_RE(Xlow[((l - 2 + tHFAdj)<<5) + p])));
+#else
+                    QMF_RE(Xhigh[((l + tHFAdj)<<6) + k]) += (
+                        RE(a0) * QMF_RE(Xlow[((l - 1 + tHFAdj)<<5) + p]) -
+                        IM(a0) * QMF_IM(Xlow[((l - 1 + tHFAdj)<<5) + p]) +
+                        RE(a1) * QMF_RE(Xlow[((l - 2 + tHFAdj)<<5) + p]) -
+                        IM(a1) * QMF_IM(Xlow[((l - 2 + tHFAdj)<<5) + p]));
+                    QMF_IM(Xhigh[((l + tHFAdj)<<6) + k]) += (
+                        IM(a0) * QMF_RE(Xlow[((l - 1 + tHFAdj)<<5) + p]) +
+                        RE(a0) * QMF_IM(Xlow[((l - 1 + tHFAdj)<<5) + p]) +
+                        IM(a1) * QMF_RE(Xlow[((l - 2 + tHFAdj)<<5) + p]) +
+                        RE(a1) * QMF_IM(Xlow[((l - 2 + tHFAdj)<<5) + p]));
+#endif
+                }
+            } else {
+                for (l = sbr->t_E[ch][0]; l < sbr->t_E[ch][sbr->L_E[ch]]; l++)
+                {
+                    QMF_RE(Xhigh[((l + tHFAdj)<<6) + k]) = QMF_RE(Xlow[((l + tHFAdj)<<5) + p]);
+#ifndef SBR_LOW_POWER
+                    QMF_IM(Xhigh[((l + tHFAdj)<<6) + k]) = QMF_IM(Xlow[((l + tHFAdj)<<5) + p]);
+#endif
+                }
+            }
+        }
+    }
+
+#if 0
+    if (sbr->frame == 179)
+    {
+        for (l = 0; l < 64; l++)
+        {
+            printf("%d %.3f\n", l, deg[l]);
+        }
+    }
+#endif
+
+    if (sbr->Reset)
+    {
+        limiter_frequency_table(sbr);
+    }
+}
+
+typedef struct
+{
+    complex_t r01;
+    complex_t r02;
+    complex_t r11;
+    complex_t r12;
+    complex_t r22;
+    real_t det;
+} acorr_coef;
+
+#define SBR_ABS(A) ((A) < 0) ? -(A) : (A)
+
+static void auto_correlation(acorr_coef *ac, qmf_t *buffer,
+                             uint8_t bd, uint8_t len)
+{
+    int8_t j, jminus1, jminus2;
+    const real_t rel = COEF_CONST(0.9999999999999); // 1 / (1 + 1e-6f);
+
+#ifdef FIXED_POINT
+    /*
+     *  For computing the covariance matrix and the filter coefficients
+     *  in fixed point, all values are normalised so that the fixed point
+     *  values don't overflow.
+     */
+    uint32_t max = 0;
+    uint32_t pow2, exp;
+
+    for (j = tHFAdj-2; j < len + tHFAdj; j++)
+    {
+        max = max(SBR_ABS(QMF_RE(buffer[j*32 + bd])>>REAL_BITS), max);
+    }
+
+    /* find the first power of 2 bigger than max to avoid division */
+    pow2 = 1;
+    exp = 0;
+    while (max > pow2)
+    {
+        pow2 <<= 1;
+        exp++;
+    }
+
+    /* give some more space */
+//    if (exp > 3)
+//        exp -= 3;
+#endif
+
+    memset(ac, 0, sizeof(acorr_coef));
+
+    for (j = tHFAdj; j < len + tHFAdj; j++)
+    {
+        jminus1 = j - 1;
+        jminus2 = jminus1 - 1;
+
+#ifdef SBR_LOW_POWER
+#ifdef FIXED_POINT
+        /* normalisation with rounding */
+        RE(ac->r01) += MUL(((QMF_RE(buffer[j*32 + bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[jminus1*32 + bd])+(1<<(exp-1)))>>exp));
+        RE(ac->r02) += MUL(((QMF_RE(buffer[j*32 + bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[jminus2*32 + bd])+(1<<(exp-1)))>>exp));
+        RE(ac->r11) += MUL(((QMF_RE(buffer[jminus1*32 + bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[jminus1*32 + bd])+(1<<(exp-1)))>>exp));
+        RE(ac->r12) += MUL(((QMF_RE(buffer[jminus1*32 + bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[jminus2*32 + bd])+(1<<(exp-1)))>>exp));
+        RE(ac->r22) += MUL(((QMF_RE(buffer[jminus2*32 + bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[jminus2*32 + bd])+(1<<(exp-1)))>>exp));
+#else
+        RE(ac->r01) += QMF_RE(buffer[j*32 + bd]) * QMF_RE(buffer[jminus1*32 + bd]);
+        RE(ac->r02) += QMF_RE(buffer[j*32 + bd]) * QMF_RE(buffer[jminus2*32 + bd]);
+        RE(ac->r11) += QMF_RE(buffer[jminus1*32 + bd]) * QMF_RE(buffer[jminus1*32 + bd]);
+        RE(ac->r12) += QMF_RE(buffer[jminus1*32 + bd]) * QMF_RE(buffer[jminus2*32 + bd]);
+        RE(ac->r22) += QMF_RE(buffer[jminus2*32 + bd]) * QMF_RE(buffer[jminus2*32 + bd]);
+#endif
+#else
+        RE(ac->r01) += QMF_RE(buffer[j*32 + bd]) * QMF_RE(buffer[jminus1*32 + bd]) +
+            QMF_IM(buffer[j*32 + bd]) * QMF_IM(buffer[jminus1*32 + bd]);
+
+        IM(ac->r01) += QMF_IM(buffer[j*32 + bd]) * QMF_RE(buffer[jminus1*32 + bd]) -
+            QMF_RE(buffer[j*32 + bd]) * QMF_IM(buffer[jminus1*32 + bd]);
+
+        RE(ac->r02) += QMF_RE(buffer[j*32 + bd]) * QMF_RE(buffer[jminus2*32 + bd]) +
+            QMF_IM(buffer[j*32 + bd]) * QMF_IM(buffer[jminus2*32 + bd]);
+
+        IM(ac->r02) += QMF_IM(buffer[j*32 + bd]) * QMF_RE(buffer[jminus2*32 + bd]) -
+            QMF_RE(buffer[j*32 + bd]) * QMF_IM(buffer[jminus2*32 + bd]);
+
+        RE(ac->r11) += QMF_RE(buffer[jminus1*32 + bd]) * QMF_RE(buffer[jminus1*32 + bd]) +
+            QMF_IM(buffer[jminus1*32 + bd]) * QMF_IM(buffer[jminus1*32 + bd]);
+
+        RE(ac->r12) += QMF_RE(buffer[jminus1*32 + bd]) * QMF_RE(buffer[jminus2*32 + bd]) +
+            QMF_IM(buffer[jminus1*32 + bd]) * QMF_IM(buffer[jminus2*32 + bd]);
+
+        IM(ac->r12) += QMF_IM(buffer[jminus1*32 + bd]) * QMF_RE(buffer[jminus2*32 + bd]) -
+            QMF_RE(buffer[jminus1*32 + bd]) * QMF_IM(buffer[jminus2*32 + bd]);
+
+        RE(ac->r22) += QMF_RE(buffer[jminus2*32 + bd]) * QMF_RE(buffer[jminus2*32 + bd]) +
+            QMF_IM(buffer[jminus2*32 + bd]) * QMF_IM(buffer[jminus2*32 + bd]);
+#endif
+    }
+
+#ifdef SBR_LOW_POWER
+    ac->det = MUL(RE(ac->r11), RE(ac->r22)) - MUL_R_C(MUL(RE(ac->r12), RE(ac->r12)), rel);
+#else
+    ac->det = RE(ac->r11) * RE(ac->r22) - rel * (RE(ac->r12) * RE(ac->r12) + IM(ac->r12) * IM(ac->r12));
+#endif
+
+#if 0
+    if (ac->det != 0)
+        printf("%f %f\n", ac->det, max);
+#endif
+}
+
+static void calc_prediction_coef(sbr_info *sbr, qmf_t *Xlow,
+                                 complex_t *alpha_0, complex_t *alpha_1
+#ifdef SBR_LOW_POWER
+                                 , real_t *rxx
+#endif
+                                 )
+{
+    uint8_t k;
+    real_t tmp;
+    acorr_coef ac;
+
+    for (k = 1; k < sbr->kx; k++)
+    {
+        auto_correlation(&ac, Xlow, k, 38);
+
+#ifdef SBR_LOW_POWER
+        if (ac.det == 0)
+        {
+            RE(alpha_1[k]) = 0;
+        } else {
+            tmp = MUL(RE(ac.r01), RE(ac.r12)) - MUL(RE(ac.r02), RE(ac.r11));
+            RE(alpha_1[k]) = SBR_DIV(tmp, ac.det);
+        }
+
+        if (RE(ac.r11) == 0)
+        {
+            RE(alpha_0[k]) = 0;
+        } else {
+            tmp = RE(ac.r01) + MUL(RE(alpha_1[k]), RE(ac.r12));
+            RE(alpha_0[k]) = -SBR_DIV(tmp, RE(ac.r11));
+        }
+
+        if ((RE(alpha_0[k]) >= REAL_CONST(4)) || (RE(alpha_1[k]) >= REAL_CONST(4)))
+        {
+            RE(alpha_0[k]) = REAL_CONST(0);
+            RE(alpha_1[k]) = REAL_CONST(0);
+        }
+
+        /* reflection coefficient */
+        if (RE(ac.r11) == REAL_CONST(0.0))
+        {
+            rxx[k] = REAL_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 = 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;
+        }
+
+        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);
+
+    for (k = 2; k < sbr->k0; k++)
+    {
+        deg[k] = 0.0;
+
+        if ((k % 2 == 0) && (rxx[k] < REAL_CONST(0.0)))
+        {
+            if (rxx[k-1] < 0.0)
+            {
+                deg[k] = REAL_CONST(1.0);
+
+                if (rxx[k-2] > REAL_CONST(0.0))
+                {
+                    deg[k-1] = REAL_CONST(1.0) - MUL(rxx[k-1], rxx[k-1]);
+                }
+            } else if (rxx[k-2] > REAL_CONST(0.0)) {
+                deg[k]   = REAL_CONST(1.0) - MUL(rxx[k-1], rxx[k-1]);
+            }
+        }
+
+        if ((k % 2 == 1) && (rxx[k] > REAL_CONST(0.0)))
+        {
+            if (rxx[k-1] > REAL_CONST(0.0))
+            {
+                deg[k] = REAL_CONST(1.0);
+
+                if (rxx[k-2] < REAL_CONST(0.0))
+                {
+                    deg[k-1] = REAL_CONST(1.0) - MUL(rxx[k-1], rxx[k-1]);
+                }
+            } else if (rxx[k-2] < REAL_CONST(0.0)) {
+                deg[k] = REAL_CONST(1.0) - MUL(rxx[k-1], rxx[k-1]);
+            }
+        }
+    }
+}
+#endif
+
+static real_t mapNewBw(uint8_t invf_mode, uint8_t invf_mode_prev)
+{
+    switch (invf_mode)
+    {
+    case 1: /* LOW */
+        if (invf_mode_prev == 0) /* NONE */
+            return COEF_CONST(0.6);
+        else
+            return COEF_CONST(0.75);
+
+    case 2: /* MID */
+        return COEF_CONST(0.9);
+
+    case 3: /* HIGH */
+        return COEF_CONST(0.98);
+
+    default: /* NONE */
+        if (invf_mode_prev == 1) /* LOW */
+            return COEF_CONST(0.6);
+        else
+            return COEF_CONST(0.0);
+    }
+}
+
+static void calc_chirp_factors(sbr_info *sbr, uint8_t ch)
+{
+    uint8_t i;
+
+    for (i = 0; i < sbr->N_Q; i++)
+    {
+        sbr->bwArray[ch][i] = mapNewBw(sbr->bs_invf_mode[ch][i], sbr->bs_invf_mode_prev[ch][i]);
+
+        if (sbr->bwArray[ch][i] < sbr->bwArray_prev[ch][i])
+            sbr->bwArray[ch][i] = MUL_C_C(COEF_CONST(0.75), sbr->bwArray[ch][i]) + MUL_C_C(COEF_CONST(0.25), sbr->bwArray_prev[ch][i]);
+        else
+            sbr->bwArray[ch][i] = MUL_C_C(COEF_CONST(0.90625), sbr->bwArray[ch][i]) + MUL_C_C(COEF_CONST(0.09375), sbr->bwArray_prev[ch][i]);
+
+        if (sbr->bwArray[ch][i] < COEF_CONST(0.015625))
+            sbr->bwArray[ch][i] = COEF_CONST(0.0);
+
+        if (sbr->bwArray[ch][i] >= COEF_CONST(0.99609375))
+            sbr->bwArray[ch][i] = COEF_CONST(0.99609375);
+
+        sbr->bwArray_prev[ch][i] = sbr->bwArray[ch][i];
+        sbr->bs_invf_mode_prev[ch][i] = sbr->bs_invf_mode[ch][i];
+    }
+}
+
+static void patch_construction(sbr_info *sbr)
+{
+    uint8_t i, k;
+    uint8_t odd, sb;
+    uint8_t msb = sbr->k0;
+    uint8_t usb = sbr->kx;
+    uint32_t goalSb = (uint32_t)(2.048e6/sbr->sample_rate + 0.5);
+
+    sbr->noPatches = 0;
+
+    if (goalSb < (sbr->kx + sbr->M))
+    {
+        for (i = 0, k = 0; sbr->f_master[i] < goalSb; i++)
+            k = i+1;
+    } else {
+        k = sbr->N_master;
+    }
+
+    do
+    {
+        uint8_t j = k + 1;
+
+        do
+        {
+            j--;
+
+            sb = sbr->f_master[j];
+            odd = (sb - 2 + sbr->k0) % 2;
+        } while (sb > (sbr->k0 - 1 + msb - odd));
+
+        sbr->patchNoSubbands[sbr->noPatches] = max(sb - usb, 0);
+        sbr->patchStartSubband[sbr->noPatches] = sbr->k0 - odd -
+            sbr->patchNoSubbands[sbr->noPatches];
+
+        if (sbr->patchNoSubbands[sbr->noPatches] > 0)
+        {
+            usb = sb;
+            msb = sb;
+            sbr->noPatches++;
+        } else {
+            msb = sbr->kx;
+        }
+
+        if (sb == sbr->f_master[k])
+            k = sbr->N_master;
+    } while (sb != (sbr->kx + sbr->M));
+
+    if ((sbr->patchNoSubbands[sbr->noPatches-1] < 3) &&
+        (sbr->noPatches > 1))
+    {
+        sbr->noPatches--;
+    }
+
+    sbr->noPatches = min(sbr->noPatches, 5);
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/sbr_hfgen.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,56 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_hfgen.h,v 1.1 2003/07/29 08:20:13 menno Exp $
+**/
+
+#ifndef __SBR_HFGEN_H__
+#define __SBR_HFGEN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void hf_generation(sbr_info *sbr, qmf_t *Xlow,
+                   qmf_t *Xhigh
+#ifdef SBR_LOW_POWER
+                   ,real_t *deg
+#endif
+                   ,uint8_t ch);
+
+static void calc_prediction_coef(sbr_info *sbr, qmf_t *Xlow,
+                                 complex_t *alpha_0, complex_t *alpha_1
+#ifdef SBR_LOW_POWER
+                                 , real_t *rxx
+#endif
+                                 );
+static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg);
+static void calc_chirp_factors(sbr_info *sbr, uint8_t ch);
+static void patch_construction(sbr_info *sbr);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/sbr_huff.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,233 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** 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.5 2003/07/29 08:20:13 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SBR_DEC
+
+#include "bits.h"
+#include "sbr_huff.h"
+
+
+int16_t sbr_huff_dec(bitfile *ld, sbr_huff_tab t_huff)
+{
+    uint8_t bit;
+    int16_t index = 0;
+
+    while (index >= 0)
+    {
+        bit = (uint8_t)faad_getbits(ld, 1);
+        index = t_huff[index][bit];
+    }
+
+    return index + 64;
+}
+
+
+const int8_t t_huffman_env_1_5dB[120][2] = {
+    {   1,   2 },    { -64, -65 },    {   3,   4 },    { -63, -66 },
+    {   5,   6 },    { -62, -67 },    {   7,   8 },    { -61, -68 },
+    {   9,  10 },    { -60, -69 },    {  11,  12 },    { -59, -70 },
+    {  13,  14 },    { -58, -71 },    {  15,  16 },    { -57, -72 },
+    {  17,  18 },    { -73, -56 },    {  19,  21 },    { -74,  20 },
+    { -55, -75 },    {  22,  26 },    {  23,  24 },    { -54, -76 },
+    { -77,  25 },    { -53, -78 },    {  27,  34 },    {  28,  29 },
+    { -52, -79 },    {  30,  31 },    { -80, -51 },    {  32,  33 },
+    { -83, -82 },    { -81, -50 },    {  35,  57 },    {  36,  40 },
+    {  37,  38 },    { -88, -84 },    { -48,  39 },    { -90, -85 },
+    {  41,  46 },    {  42,  43 },    { -49, -87 },    {  44,  45 },
+    { -89, -86 },    {-124,-123 },    {  47,  50 },    {  48,  49 },
+    {-122,-121 },    {-120,-119 },    {  51,  54 },    {  52,  53 },
+    {-118,-117 },    {-116,-115 },    {  55,  56 },    {-114,-113 },
+    {-112,-111 },    {  58,  89 },    {  59,  74 },    {  60,  67 },
+    {  61,  64 },    {  62,  63 },    {-110,-109 },    {-108,-107 },
+    {  65,  66 },    {-106,-105 },    {-104,-103 },    {  68,  71 },
+    {  69,  70 },    {-102,-101 },    {-100, -99 },    {  72,  73 },
+    { -98, -97 },    { -96, -95 },    {  75,  82 },    {  76,  79 },
+    {  77,  78 },    { -94, -93 },    { -92, -91 },    {  80,  81 },
+    { -47, -46 },    { -45, -44 },    {  83,  86 },    {  84,  85 },
+    { -43, -42 },    { -41, -40 },    {  87,  88 },    { -39, -38 },
+    { -37, -36 },    {  90, 105 },    {  91,  98 },    {  92,  95 },
+    {  93,  94 },    { -35, -34 },    { -33, -32 },    {  96,  97 },
+    { -31, -30 },    { -29, -28 },    {  99, 102 },    { 100, 101 },
+    { -27, -26 },    { -25, -24 },    { 103, 104 },    { -23, -22 },
+    { -21, -20 },    { 106, 113 },    { 107, 110 },    { 108, 109 },
+    { -19, -18 },    { -17, -16 },    { 111, 112 },    { -15, -14 },
+    { -13, -12 },    { 114, 117 },    { 115, 116 },    { -11, -10 },
+    {  -9,  -8 },    { 118, 119 },    {  -7,  -6 },    {  -5,  -4 }
+};
+
+const int8_t f_huffman_env_1_5dB[120][2] = {
+    {   1,   2 },    { -64, -65 },    {   3,   4 },    { -63, -66 },
+    {   5,   6 },    { -67, -62 },    {   7,   8 },    { -68, -61 },
+    {   9,  10 },    { -69, -60 },    {  11,  13 },    { -70,  12 },
+    { -59, -71 },    {  14,  16 },    { -58,  15 },    { -72, -57 },
+    {  17,  19 },    { -73,  18 },    { -56, -74 },    {  20,  23 },
+    {  21,  22 },    { -55, -75 },    { -54, -53 },    {  24,  27 },
+    {  25,  26 },    { -76, -52 },    { -77, -51 },    {  28,  31 },
+    {  29,  30 },    { -50, -78 },    { -79, -49 },    {  32,  36 },
+    {  33,  34 },    { -48, -47 },    { -80,  35 },    { -81, -82 },
+    {  37,  47 },    {  38,  41 },    {  39,  40 },    { -83, -46 },
+    { -45, -84 },    {  42,  44 },    { -85,  43 },    { -44, -43 },
+    {  45,  46 },    { -88, -87 },    { -86, -90 },    {  48,  66 },
+    {  49,  56 },    {  50,  53 },    {  51,  52 },    { -92, -42 },
+    { -41, -39 },    {  54,  55 },    {-105, -89 },    { -38, -37 },
+    {  57,  60 },    {  58,  59 },    { -94, -91 },    { -40, -36 },
+    {  61,  63 },    { -20,  62 },    {-115,-110 },    {  64,  65 },
+    {-108,-107 },    {-101, -97 },    {  67,  89 },    {  68,  75 },
+    {  69,  72 },    {  70,  71 },    { -95, -93 },    { -34, -27 },
+    {  73,  74 },    { -22, -17 },    { -16,-124 },    {  76,  82 },
+    {  77,  79 },    {-123,  78 },    {-122,-121 },    {  80,  81 },
+    {-120,-119 },    {-118,-117 },    {  83,  86 },    {  84,  85 },
+    {-116,-114 },    {-113,-112 },    {  87,  88 },    {-111,-109 },
+    {-106,-104 },    {  90, 105 },    {  91,  98 },    {  92,  95 },
+    {  93,  94 },    {-103,-102 },    {-100, -99 },    {  96,  97 },
+    { -98, -96 },    { -35, -33 },    {  99, 102 },    { 100, 101 },
+    { -32, -31 },    { -30, -29 },    { 103, 104 },    { -28, -26 },
+    { -25, -24 },    { 106, 113 },    { 107, 110 },    { 108, 109 },
+    { -23, -21 },    { -19, -18 },    { 111, 112 },    { -15, -14 },
+    { -13, -12 },    { 114, 117 },    { 115, 116 },    { -11, -10 },
+    {  -9,  -8 },    { 118, 119 },    {  -7,  -6 },    {  -5,  -4 }
+};
+
+const int8_t t_huffman_env_bal_1_5dB[48][2] = {
+    { -64,   1 },    { -63,   2 },    { -65,   3 },    { -62,   4 },
+    { -66,   5 },    { -61,   6 },    { -67,   7 },    { -60,   8 },
+    { -68,   9 },    {  10,  11 },    { -69, -59 },    {  12,  13 },
+    { -70, -58 },    {  14,  28 },    {  15,  21 },    {  16,  18 },
+    { -57,  17 },    { -71, -56 },    {  19,  20 },    { -88, -87 },
+    { -86, -85 },    {  22,  25 },    {  23,  24 },    { -84, -83 },
+    { -82, -81 },    {  26,  27 },    { -80, -79 },    { -78, -77 },
+    {  29,  36 },    {  30,  33 },    {  31,  32 },    { -76, -75 },
+    { -74, -73 },    {  34,  35 },    { -72, -55 },    { -54, -53 },
+    {  37,  41 },    {  38,  39 },    { -52, -51 },    { -50,  40 },
+    { -49, -48 },    {  42,  45 },    {  43,  44 },    { -47, -46 },
+    { -45, -44 },    {  46,  47 },    { -43, -42 },    { -41, -40 }
+};
+
+const int8_t f_huffman_env_bal_1_5dB[48][2] = {
+    { -64,   1 },    { -65,   2 },    { -63,   3 },    { -66,   4 },
+    { -62,   5 },    { -61,   6 },    { -67,   7 },    { -68,   8 },
+    { -60,   9 },    {  10,  11 },    { -69, -59 },    { -70,  12 },
+    { -58,  13 },    {  14,  17 },    { -71,  15 },    { -57,  16 },
+    { -56, -73 },    {  18,  32 },    {  19,  25 },    {  20,  22 },
+    { -72,  21 },    { -88, -87 },    {  23,  24 },    { -86, -85 },
+    { -84, -83 },    {  26,  29 },    {  27,  28 },    { -82, -81 },
+    { -80, -79 },    {  30,  31 },    { -78, -77 },    { -76, -75 },
+    {  33,  40 },    {  34,  37 },    {  35,  36 },    { -74, -55 },
+    { -54, -53 },    {  38,  39 },    { -52, -51 },    { -50, -49 },
+    {  41,  44 },    {  42,  43 },    { -48, -47 },    { -46, -45 },
+    {  45,  46 },    { -44, -43 },    { -42,  47 },    { -41, -40 }
+};
+
+const int8_t t_huffman_env_3_0dB[62][2] = {
+    { -64,   1 },    { -65,   2 },    { -63,   3 },    { -66,   4 },
+    { -62,   5 },    { -67,   6 },    { -61,   7 },    { -68,   8 },
+    { -60,   9 },    {  10,  11 },    { -69, -59 },    {  12,  14 },
+    { -70,  13 },    { -71, -58 },    {  15,  18 },    {  16,  17 },
+    { -72, -57 },    { -73, -74 },    {  19,  22 },    { -56,  20 },
+    { -55,  21 },    { -54, -77 },    {  23,  31 },    {  24,  25 },
+    { -75, -76 },    {  26,  27 },    { -78, -53 },    {  28,  29 },
+    { -52, -95 },    { -94,  30 },    { -93, -92 },    {  32,  47 },
+    {  33,  40 },    {  34,  37 },    {  35,  36 },    { -91, -90 },
+    { -89, -88 },    {  38,  39 },    { -87, -86 },    { -85, -84 },
+    {  41,  44 },    {  42,  43 },    { -83, -82 },    { -81, -80 },
+    {  45,  46 },    { -79, -51 },    { -50, -49 },    {  48,  55 },
+    {  49,  52 },    {  50,  51 },    { -48, -47 },    { -46, -45 },
+    {  53,  54 },    { -44, -43 },    { -42, -41 },    {  56,  59 },
+    {  57,  58 },    { -40, -39 },    { -38, -37 },    {  60,  61 },
+    { -36, -35 },    { -34, -33 }
+};
+
+const int8_t f_huffman_env_3_0dB[62][2] = {
+    { -64,   1 },    { -65,   2 },    { -63,   3 },    { -66,   4 },
+    { -62,   5 },    { -67,   6 },    {   7,   8 },    { -61, -68 },
+    {   9,  10 },    { -60, -69 },    {  11,  12 },    { -59, -70 },
+    {  13,  14 },    { -58, -71 },    {  15,  16 },    { -57, -72 },
+    {  17,  19 },    { -56,  18 },    { -55, -73 },    {  20,  24 },
+    {  21,  22 },    { -74, -54 },    { -53,  23 },    { -75, -76 },
+    {  25,  30 },    {  26,  27 },    { -52, -51 },    {  28,  29 },
+    { -77, -79 },    { -50, -49 },    {  31,  39 },    {  32,  35 },
+    {  33,  34 },    { -78, -46 },    { -82, -88 },    {  36,  37 },
+    { -83, -48 },    { -47,  38 },    { -86, -85 },    {  40,  47 },
+    {  41,  44 },    {  42,  43 },    { -80, -44 },    { -43, -42 },
+    {  45,  46 },    { -39, -87 },    { -84, -40 },    {  48,  55 },
+    {  49,  52 },    {  50,  51 },    { -95, -94 },    { -93, -92 },
+    {  53,  54 },    { -91, -90 },    { -89, -81 },    {  56,  59 },
+    {  57,  58 },    { -45, -41 },    { -38, -37 },    {  60,  61 },
+    { -36, -35 },    { -34, -33 }
+};
+
+const int8_t t_huffman_env_bal_3_0dB[24][2] = {
+    { -64,   1 },    { -63,   2 },    { -65,   3 },    { -66,   4 },
+    { -62,   5 },    { -61,   6 },    { -67,   7 },    { -68,   8 },
+    { -60,   9 },    {  10,  16 },    {  11,  13 },    { -69,  12 },
+    { -76, -75 },    {  14,  15 },    { -74, -73 },    { -72, -71 },
+    {  17,  20 },    {  18,  19 },    { -70, -59 },    { -58, -57 },
+    {  21,  22 },    { -56, -55 },    { -54,  23 },    { -53, -52 }
+};
+
+const int8_t f_huffman_env_bal_3_0dB[24][2] = {
+    { -64,   1 },    { -65,   2 },    { -63,   3 },    { -66,   4 },
+    { -62,   5 },    { -61,   6 },    { -67,   7 },    { -68,   8 },
+    { -60,   9 },    {  10,  13 },    { -69,  11 },    { -59,  12 },
+    { -58, -76 },    {  14,  17 },    {  15,  16 },    { -75, -74 },
+    { -73, -72 },    {  18,  21 },    {  19,  20 },    { -71, -70 },
+    { -57, -56 },    {  22,  23 },    { -55, -54 },    { -53, -52 }
+};
+
+
+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 },
+    {   9,  30 },    {  10,  15 },    { -60,  11 },    { -69,  12 },
+    {  13,  14 },    { -59, -53 },    { -95, -94 },    {  16,  23 },
+    {  17,  20 },    {  18,  19 },    { -93, -92 },    { -91, -90 },
+    {  21,  22 },    { -89, -88 },    { -87, -86 },    {  24,  27 },
+    {  25,  26 },    { -85, -84 },    { -83, -82 },    {  28,  29 },
+    { -81, -80 },    { -79, -78 },    {  31,  46 },    {  32,  39 },
+    {  33,  36 },    {  34,  35 },    { -77, -76 },    { -75, -74 },
+    {  37,  38 },    { -73, -72 },    { -71, -70 },    {  40,  43 },
+    {  41,  42 },    { -58, -57 },    { -56, -55 },    {  44,  45 },
+    { -54, -52 },    { -51, -50 },    {  47,  54 },    {  48,  51 },
+    {  49,  50 },    { -49, -48 },    { -47, -46 },    {  52,  53 },
+    { -45, -44 },    { -43, -42 },    {  55,  58 },    {  56,  57 },
+    { -41, -40 },    { -39, -38 },    {  59,  60 },    { -37, -36 },
+    { -35,  61 },    { -34, -33 }
+};
+
+const int8_t t_huffman_noise_bal_3_0dB[24][2] = {
+    { -64,   1 },    { -65,   2 },    { -63,   3 },    {   4,   9 },
+    { -66,   5 },    { -62,   6 },    {   7,   8 },    { -76, -75 },
+    { -74, -73 },    {  10,  17 },    {  11,  14 },    {  12,  13 },
+    { -72, -71 },    { -70, -69 },    {  15,  16 },    { -68, -67 },
+    { -61, -60 },    {  18,  21 },    {  19,  20 },    { -59, -58 },
+    { -57, -56 },    {  22,  23 },    { -55, -54 },    { -53, -52 }
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/sbr_huff.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,54 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** 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.5 2003/07/29 08:20:13 menno Exp $
+**/
+
+#ifndef __SBR_HUFF_H__
+#define __SBR_HUFF_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef const int8_t (*sbr_huff_tab)[2];
+
+int16_t sbr_huff_dec(bitfile *ld, sbr_huff_tab t_huff);
+
+const int8_t t_huffman_env_1_5dB[120][2];
+const int8_t f_huffman_env_1_5dB[120][2];
+const int8_t t_huffman_env_bal_1_5dB[48][2];
+const int8_t f_huffman_env_bal_1_5dB[48][2];
+const int8_t t_huffman_env_3_0dB[62][2];
+const int8_t f_huffman_env_3_0dB[62][2];
+const int8_t t_huffman_env_bal_3_0dB[24][2];
+const int8_t f_huffman_env_bal_3_0dB[24][2];
+const int8_t t_huffman_noise_3_0dB[62][2];
+const int8_t t_huffman_noise_bal_3_0dB[24][2];
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/sbr_noise.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,560 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_noise.h,v 1.1 2003/07/29 08:20:13 menno Exp $
+**/
+
+#ifndef __SBR_NOISE_H__
+#define __SBR_NOISE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+
+
+/* Table 1.A.13 Noise table V */
+complex_t V[] = {
+    { COEF_CONST(-0.99948155879974), COEF_CONST(-0.59483414888382) },
+    { COEF_CONST(0.97113454341888), COEF_CONST(-0.67528516054153) },
+    { COEF_CONST(0.14130051434040), COEF_CONST(-0.95090985298157) },
+    { COEF_CONST(-0.47005495429039), COEF_CONST(-0.37340548634529) },
+    { COEF_CONST(0.80705064535141), COEF_CONST(0.29653668403625) },
+    { COEF_CONST(-0.38981479406357), COEF_CONST(0.89572608470917) },
+    { COEF_CONST(-0.01053049881011), COEF_CONST(-0.66959059238434) },
+    { COEF_CONST(-0.91266369819641), COEF_CONST(-0.11522938311100) },
+    { COEF_CONST(0.54840421676636), COEF_CONST(0.75221365690231) },
+    { COEF_CONST(0.40009254217148), COEF_CONST(-0.98929399251938) },
+    { COEF_CONST(-0.99867975711823), COEF_CONST(-0.88147068023682) },
+    { COEF_CONST(-0.95531076192856), COEF_CONST(0.90908759832382) },
+    { COEF_CONST(-0.45725932717323), COEF_CONST(-0.56716322898865) },
+    { COEF_CONST(-0.72929674386978), COEF_CONST(-0.98008275032043) },
+    { COEF_CONST(0.75622802972794), COEF_CONST(0.20950329303741) },
+    { COEF_CONST(0.07069442421198), COEF_CONST(-0.78247898817062) },
+    { COEF_CONST(0.74496251344681), COEF_CONST(-0.91169005632401) },
+    { COEF_CONST(-0.96440184116364), COEF_CONST(-0.94739919900894) },
+    { COEF_CONST(0.30424630641937), COEF_CONST(-0.49438267946243) },
+    { COEF_CONST(0.66565030813217), COEF_CONST(0.64652937650681) },
+    { COEF_CONST(0.91697007417679), COEF_CONST(0.17514097690582) },
+    { COEF_CONST(-0.70774918794632), COEF_CONST(0.52548652887344) },
+    { COEF_CONST(-0.70051413774490), COEF_CONST(-0.45340028405190) },
+    { COEF_CONST(-0.99496513605118), COEF_CONST(-0.90071910619736) },
+    { COEF_CONST(0.98164492845535), COEF_CONST(-0.77463155984879) },
+    { COEF_CONST(-0.54671579599380), COEF_CONST(-0.02570928446949) },
+    { COEF_CONST(-0.01689629070461), COEF_CONST(0.00287506449968) },
+    { COEF_CONST(-0.86110347509384), COEF_CONST(0.42548584938049) },
+    { COEF_CONST(-0.98892980813980), COEF_CONST(-0.87881129980087) },
+    { COEF_CONST(0.51756626367569), COEF_CONST(0.66926783323288) },
+    { COEF_CONST(-0.99635028839111), COEF_CONST(-0.58107727766037) },
+    { COEF_CONST(-0.99969369173050), COEF_CONST(0.98369991779327) },
+    { COEF_CONST(0.55266261100769), COEF_CONST(0.59449058771133) },
+    { COEF_CONST(0.34581178426743), COEF_CONST(0.94879418611526) },
+    { COEF_CONST(0.62664210796356), COEF_CONST(-0.74402970075607) },
+    { COEF_CONST(-0.77149701118469), COEF_CONST(-0.33883658051491) },
+    { COEF_CONST(-0.91592246294022), COEF_CONST(0.03687901422381) },
+    { COEF_CONST(-0.76285493373871), COEF_CONST(-0.91371870040894) },
+    { COEF_CONST(0.79788339138031), COEF_CONST(-0.93180972337723) },
+    { COEF_CONST(0.54473078250885), COEF_CONST(-0.11919206380844) },
+    { COEF_CONST(-0.85639280080795), COEF_CONST(0.42429855465889) },
+    { COEF_CONST(-0.92882400751114), COEF_CONST(0.27871808409691) },
+    { COEF_CONST(-0.11708371341228), COEF_CONST(-0.99800843000412) },
+    { COEF_CONST(0.21356749534607), COEF_CONST(-0.90716296434402) },
+    { COEF_CONST(-0.76191693544388), COEF_CONST(0.99768120050430) },
+    { COEF_CONST(0.98111045360565), COEF_CONST(-0.95854461193085) },
+    { COEF_CONST(-0.85913270711899), COEF_CONST(0.95766568183899) },
+    { COEF_CONST(-0.93307244777679), COEF_CONST(0.49431759119034) },
+    { COEF_CONST(0.30485755205154), COEF_CONST(-0.70540034770966) },
+    { COEF_CONST(0.85289651155472), COEF_CONST(0.46766132116318) },
+    { COEF_CONST(0.91328084468842), COEF_CONST(-0.99839597940445) },
+    { COEF_CONST(-0.05890199914575), COEF_CONST(0.70741826295853) },
+    { COEF_CONST(0.28398686647415), COEF_CONST(0.34633556008339) },
+    { COEF_CONST(0.95258164405823), COEF_CONST(-0.54893416166306) },
+    { COEF_CONST(-0.78566324710846), COEF_CONST(-0.75568538904190) },
+    { COEF_CONST(-0.95789498090744), COEF_CONST(-0.20423194766045) },
+    { COEF_CONST(0.82411158084869), COEF_CONST(0.96654617786407) },
+    { COEF_CONST(-0.65185445547104), COEF_CONST(-0.88734990358353) },
+    { COEF_CONST(-0.93643605709076), COEF_CONST(0.99870789051056) },
+    { COEF_CONST(0.91427159309387), COEF_CONST(-0.98290503025055) },
+    { COEF_CONST(-0.70395684242249), COEF_CONST(0.58796799182892) },
+    { COEF_CONST(0.00563771976158), COEF_CONST(0.61768198013306) },
+    { COEF_CONST(0.89065051078796), COEF_CONST(0.52783352136612) },
+    { COEF_CONST(-0.68683707714081), COEF_CONST(0.80806946754456) },
+    { COEF_CONST(0.72165340185165), COEF_CONST(-0.69259858131409) },
+    { COEF_CONST(-0.62928247451782), COEF_CONST(0.13627037405968) },
+    { COEF_CONST(0.29938435554504), COEF_CONST(-0.46051329374313) },
+    { COEF_CONST(-0.91781955957413), COEF_CONST(-0.74012714624405) },
+    { COEF_CONST(0.99298715591431), COEF_CONST(0.40816611051559) },
+    { COEF_CONST(0.82368296384811), COEF_CONST(-0.74036049842834) },
+    { COEF_CONST(-0.98512834310532), COEF_CONST(-0.99972331523895) },
+    { COEF_CONST(-0.95915371179581), COEF_CONST(-0.99237799644470) },
+    { COEF_CONST(-0.21411126852036), COEF_CONST(-0.93424820899963) },
+    { COEF_CONST(-0.68821477890015), COEF_CONST(-0.26892307400703) },
+    { COEF_CONST(0.91851997375488), COEF_CONST(0.09358228743076) },
+    { COEF_CONST(-0.96062767505646), COEF_CONST(0.36099094152451) },
+    { COEF_CONST(0.51646184921265), COEF_CONST(-0.71373331546783) },
+    { COEF_CONST(0.61130720376968), COEF_CONST(0.46950140595436) },
+    { COEF_CONST(0.47336128354073), COEF_CONST(-0.27333179116249) },
+    { COEF_CONST(0.90998309850693), COEF_CONST(0.96715664863586) },
+    { COEF_CONST(0.44844800233841), COEF_CONST(0.99211573600769) },
+    { COEF_CONST(0.66614890098572), COEF_CONST(0.96590173244476) },
+    { COEF_CONST(0.74922239780426), COEF_CONST(-0.89879858493805) },
+    { COEF_CONST(-0.99571585655212), COEF_CONST(0.52785521745682) },
+    { COEF_CONST(0.97401082515717), COEF_CONST(-0.16855870187283) },
+    { COEF_CONST(0.72683745622635), COEF_CONST(-0.48060774803162) },
+    { COEF_CONST(0.95432192087173), COEF_CONST(0.68849605321884) },
+    { COEF_CONST(-0.72962206602097), COEF_CONST(-0.76608443260193) },
+    { COEF_CONST(-0.85359477996826), COEF_CONST(0.88738125562668) },
+    { COEF_CONST(-0.81412428617477), COEF_CONST(-0.97480767965317) },
+    { COEF_CONST(-0.87930774688721), COEF_CONST(0.74748307466507) },
+    { COEF_CONST(-0.71573328971863), COEF_CONST(-0.98570609092712) },
+    { COEF_CONST(0.83524298667908), COEF_CONST(0.83702534437180) },
+    { COEF_CONST(-0.48086065053940), COEF_CONST(-0.98848503828049) },
+    { COEF_CONST(0.97139126062393), COEF_CONST(0.80093622207642) },
+    { COEF_CONST(0.51992827653885), COEF_CONST(0.80247628688812) },
+    { COEF_CONST(-0.00848591234535), COEF_CONST(-0.76670128107071) },
+    { COEF_CONST(-0.70294374227524), COEF_CONST(0.55359911918640) },
+    { COEF_CONST(-0.95894426107407), COEF_CONST(-0.43265503644943) },
+    { COEF_CONST(0.97079253196716), COEF_CONST(0.09325857460499) },
+    { COEF_CONST(-0.92404294013977), COEF_CONST(0.85507702827454) },
+    { COEF_CONST(-0.69506472349167), COEF_CONST(0.98633414506912) },
+    { COEF_CONST(0.26559203863144), COEF_CONST(0.73314309120178) },
+    { COEF_CONST(0.28038442134857), COEF_CONST(0.14537914097309) },
+    { COEF_CONST(-0.74138122797012), COEF_CONST(0.99310338497162) },
+    { COEF_CONST(-0.01752796024084), COEF_CONST(-0.82616633176804) },
+    { COEF_CONST(-0.55126774311066), COEF_CONST(-0.98898541927338) },
+    { COEF_CONST(0.97960901260376), COEF_CONST(-0.94021445512772) },
+    { COEF_CONST(-0.99196308851242), COEF_CONST(0.67019015550613) },
+    { COEF_CONST(-0.67684930562973), COEF_CONST(0.12631492316723) },
+    { COEF_CONST(0.09140039235353), COEF_CONST(-0.20537731051445) },
+    { COEF_CONST(-0.71658962965012), COEF_CONST(-0.97788202762604) },
+    { COEF_CONST(0.81014639139175), COEF_CONST(0.53722649812698) },
+    { COEF_CONST(0.40616992115974), COEF_CONST(-0.26469007134438) },
+    { COEF_CONST(-0.67680186033249), COEF_CONST(0.94502049684525) },
+    { COEF_CONST(0.86849772930145), COEF_CONST(-0.18333598971367) },
+    { COEF_CONST(-0.99500381946564), COEF_CONST(-0.02634122036397) },
+    { COEF_CONST(0.84329187870026), COEF_CONST(0.10406957566738) },
+    { COEF_CONST(-0.09215968847275), COEF_CONST(0.69540011882782) },
+    { COEF_CONST(0.99956172704697), COEF_CONST(-0.12358541786671) },
+    { COEF_CONST(-0.79732781648636), COEF_CONST(-0.91582524776459) },
+    { COEF_CONST(0.96349972486496), COEF_CONST(0.96640455722809) },
+    { COEF_CONST(-0.79942780733109), COEF_CONST(0.64323902130127) },
+    { COEF_CONST(-0.11566039919853), COEF_CONST(0.28587844967842) },
+    { COEF_CONST(-0.39922955632210), COEF_CONST(0.94129604101181) },
+    { COEF_CONST(0.99089199304581), COEF_CONST(-0.92062628269196) },
+    { COEF_CONST(0.28631284832954), COEF_CONST(-0.91035044193268) },
+    { COEF_CONST(-0.83302724361420), COEF_CONST(-0.67330408096313) },
+    { COEF_CONST(0.95404446125031), COEF_CONST(0.49162766337395) },
+    { COEF_CONST(-0.06449863314629), COEF_CONST(0.03250560909510) },
+    { COEF_CONST(-0.99575054645538), COEF_CONST(0.42389783263206) },
+    { COEF_CONST(-0.65501141548157), COEF_CONST(0.82546114921570) },
+    { COEF_CONST(-0.81254440546036), COEF_CONST(-0.51627236604691) },
+    { COEF_CONST(-0.99646371603012), COEF_CONST(0.84490531682968) },
+    { COEF_CONST(0.00287840608507), COEF_CONST(0.64768260717392) },
+    { COEF_CONST(0.70176988840103), COEF_CONST(-0.20453028380871) },
+    { COEF_CONST(0.96361881494522), COEF_CONST(0.40706968307495) },
+    { COEF_CONST(-0.68883758783340), COEF_CONST(0.91338956356049) },
+    { COEF_CONST(-0.34875586628914), COEF_CONST(0.71472293138504) },
+    { COEF_CONST(0.91980081796646), COEF_CONST(0.66507452726364) },
+    { COEF_CONST(-0.99009048938751), COEF_CONST(0.85868018865585) },
+    { COEF_CONST(0.68865793943405), COEF_CONST(0.55660319328308) },
+    { COEF_CONST(-0.99484401941299), COEF_CONST(-0.20052559673786) },
+    { COEF_CONST(0.94214510917664), COEF_CONST(-0.99696427583694) },
+    { COEF_CONST(-0.67414629459381), COEF_CONST(0.49548220634460) },
+    { COEF_CONST(-0.47339352965355), COEF_CONST(-0.85904330015182) },
+    { COEF_CONST(0.14323651790619), COEF_CONST(-0.94145596027374) },
+    { COEF_CONST(-0.29268294572830), COEF_CONST(0.05759225040674) },
+    { COEF_CONST(0.43793860077858), COEF_CONST(-0.78904968500137) },
+    { COEF_CONST(-0.36345127224922), COEF_CONST(0.64874434471130) },
+    { COEF_CONST(-0.08750604838133), COEF_CONST(0.97686946392059) },
+    { COEF_CONST(-0.96495270729065), COEF_CONST(-0.53960305452347) },
+    { COEF_CONST(0.55526942014694), COEF_CONST(0.78891521692276) },
+    { COEF_CONST(0.73538213968277), COEF_CONST(0.96452075242996) },
+    { COEF_CONST(-0.30889773368835), COEF_CONST(-0.80664390325546) },
+    { COEF_CONST(0.03574995696545), COEF_CONST(-0.97325617074966) },
+    { COEF_CONST(0.98720687627792), COEF_CONST(0.48409134149551) },
+    { COEF_CONST(-0.81689298152924), COEF_CONST(-0.90827703475952) },
+    { COEF_CONST(0.67866861820221), COEF_CONST(0.81284505128860) },
+    { COEF_CONST(-0.15808570384979), COEF_CONST(0.85279554128647) },
+    { COEF_CONST(0.80723392963409), COEF_CONST(-0.24717418849468) },
+    { COEF_CONST(0.47788757085800), COEF_CONST(-0.46333149075508) },
+    { COEF_CONST(0.96367555856705), COEF_CONST(0.38486748933792) },
+    { COEF_CONST(-0.99143874645233), COEF_CONST(-0.24945276975632) },
+    { COEF_CONST(0.83081877231598), COEF_CONST(-0.94780850410461) },
+    { COEF_CONST(-0.58753192424774), COEF_CONST(0.01290772389621) },
+    { COEF_CONST(0.95538109540939), COEF_CONST(-0.85557049512863) },
+    { COEF_CONST(-0.96490919589996), COEF_CONST(-0.64020973443985) },
+    { COEF_CONST(-0.97327101230621), COEF_CONST(0.12378127872944) },
+    { COEF_CONST(0.91400367021561), COEF_CONST(0.57972472906113) },
+    { COEF_CONST(-0.99925839900970), COEF_CONST(0.71084845066071) },
+    { COEF_CONST(-0.86875903606415), COEF_CONST(-0.20291699469090) },
+    { COEF_CONST(-0.26240035891533), COEF_CONST(-0.68264555931091) },
+    { COEF_CONST(-0.24664412438869), COEF_CONST(-0.87642270326614) },
+    { COEF_CONST(0.02416275814176), COEF_CONST(0.27192914485931) },
+    { COEF_CONST(0.82068622112274), COEF_CONST(-0.85087788105011) },
+    { COEF_CONST(0.88547372817993), COEF_CONST(-0.89636802673340) },
+    { COEF_CONST(-0.18173077702522), COEF_CONST(-0.26152145862579) },
+    { COEF_CONST(0.09355476498604), COEF_CONST(0.54845124483109) },
+    { COEF_CONST(-0.54668414592743), COEF_CONST(0.95980775356293) },
+    { COEF_CONST(0.37050989270210), COEF_CONST(-0.59910142421722) },
+    { COEF_CONST(-0.70373594760895), COEF_CONST(0.91227668523788) },
+    { COEF_CONST(-0.34600785374641), COEF_CONST(-0.99441426992416) },
+    { COEF_CONST(-0.68774479627609), COEF_CONST(-0.30238837003708) },
+    { COEF_CONST(-0.26843291521072), COEF_CONST(0.83115667104721) },
+    { COEF_CONST(0.49072334170341), COEF_CONST(-0.45359709858894) },
+    { COEF_CONST(0.38975992798805), COEF_CONST(0.95515358448029) },
+    { COEF_CONST(-0.97757124900818), COEF_CONST(0.05305894464254) },
+    { COEF_CONST(-0.17325553297997), COEF_CONST(-0.92770671844482) },
+    { COEF_CONST(0.99948036670685), COEF_CONST(0.58285546302795) },
+    { COEF_CONST(-0.64946246147156), COEF_CONST(0.68645507097244) },
+    { COEF_CONST(-0.12016920745373), COEF_CONST(-0.57147324085236) },
+    { COEF_CONST(-0.58947455883026), COEF_CONST(-0.34847131371498) },
+    { COEF_CONST(-0.41815140843391), COEF_CONST(0.16276422142982) },
+    { COEF_CONST(0.99885648488998), COEF_CONST(0.11136095225811) },
+    { COEF_CONST(-0.56649613380432), COEF_CONST(-0.90494865179062) },
+    { COEF_CONST(0.94138020277023), COEF_CONST(0.35281917452812) },
+    { COEF_CONST(-0.75725078582764), COEF_CONST(0.53650552034378) },
+    { COEF_CONST(0.20541973412037), COEF_CONST(-0.94435143470764) },
+    { COEF_CONST(0.99980372190475), COEF_CONST(0.79835915565491) },
+    { COEF_CONST(0.29078277945518), COEF_CONST(0.35393777489662) },
+    { COEF_CONST(-0.62858772277832), COEF_CONST(0.38765692710876) },
+    { COEF_CONST(0.43440905213356), COEF_CONST(-0.98546332120895) },
+    { COEF_CONST(-0.98298585414886), COEF_CONST(0.21021524071693) },
+    { COEF_CONST(0.19513028860092), COEF_CONST(-0.94239830970764) },
+    { COEF_CONST(-0.95476663112640), COEF_CONST(0.98364555835724) },
+    { COEF_CONST(0.93379634618759), COEF_CONST(-0.70881992578506) },
+    { COEF_CONST(-0.85235410928726), COEF_CONST(-0.08342348039150) },
+    { COEF_CONST(-0.86425095796585), COEF_CONST(-0.45795026421547) },
+    { COEF_CONST(0.38879778981209), COEF_CONST(0.97274428606033) },
+    { COEF_CONST(0.92045122385025), COEF_CONST(-0.62433654069901) },
+    { COEF_CONST(0.89162534475327), COEF_CONST(0.54950958490372) },
+    { COEF_CONST(-0.36834338307381), COEF_CONST(0.96458297967911) },
+    { COEF_CONST(0.93891763687134), COEF_CONST(-0.89968353509903) },
+    { COEF_CONST(0.99267655611038), COEF_CONST(-0.03757034242153) },
+    { COEF_CONST(-0.94063472747803), COEF_CONST(0.41332337260246) },
+    { COEF_CONST(0.99740225076675), COEF_CONST(-0.16830494999886) },
+    { COEF_CONST(-0.35899412631989), COEF_CONST(-0.46633225679398) },
+    { COEF_CONST(0.05237237364054), COEF_CONST(-0.25640362501144) },
+    { COEF_CONST(0.36703583598137), COEF_CONST(-0.38653266429901) },
+    { COEF_CONST(0.91653180122375), COEF_CONST(-0.30587628483772) },
+    { COEF_CONST(0.69000804424286), COEF_CONST(0.90952169895172) },
+    { COEF_CONST(-0.38658750057220), COEF_CONST(0.99501574039459) },
+    { COEF_CONST(-0.29250815510750), COEF_CONST(0.37444993853569) },
+    { COEF_CONST(-0.60182201862335), COEF_CONST(0.86779648065567) },
+    { COEF_CONST(-0.97418588399887), COEF_CONST(0.96468526124954) },
+    { COEF_CONST(0.88461571931839), COEF_CONST(0.57508403062820) },
+    { COEF_CONST(0.05198933184147), COEF_CONST(0.21269661188126) },
+    { COEF_CONST(-0.53499621152878), COEF_CONST(0.97241556644440) },
+    { COEF_CONST(-0.49429559707642), COEF_CONST(0.98183864355087) },
+    { COEF_CONST(-0.98935145139694), COEF_CONST(-0.40249159932137) },
+    { COEF_CONST(-0.98081380128860), COEF_CONST(-0.72856897115707) },
+    { COEF_CONST(-0.27338150143623), COEF_CONST(0.99950921535492) },
+    { COEF_CONST(0.06310802698135), COEF_CONST(-0.54539585113525) },
+    { COEF_CONST(-0.20461677014828), COEF_CONST(-0.14209978282452) },
+    { COEF_CONST(0.66223841905594), COEF_CONST(0.72528582811356) },
+    { COEF_CONST(-0.84764343500137), COEF_CONST(0.02372316829860) },
+    { COEF_CONST(-0.89039862155914), COEF_CONST(0.88866579532623) },
+    { COEF_CONST(0.95903307199478), COEF_CONST(0.76744925975800) },
+    { COEF_CONST(0.73504126071930), COEF_CONST(-0.03747203201056) },
+    { COEF_CONST(-0.31744435429573), COEF_CONST(-0.36834111809731) },
+    { COEF_CONST(-0.34110826253891), COEF_CONST(0.40211221575737) },
+    { COEF_CONST(0.47803884744644), COEF_CONST(-0.39423218369484) },
+    { COEF_CONST(0.98299193382263), COEF_CONST(0.01989791356027) },
+    { COEF_CONST(-0.30963072180748), COEF_CONST(-0.18076720833778) },
+    { COEF_CONST(0.99992591142654), COEF_CONST(-0.26281872391701) },
+    { COEF_CONST(-0.93149733543396), COEF_CONST(-0.98313164710999) },
+    { COEF_CONST(0.99923473596573), COEF_CONST(-0.80142992734909) },
+    { COEF_CONST(-0.26024168729782), COEF_CONST(-0.75999760627747) },
+    { COEF_CONST(-0.35712513327599), COEF_CONST(0.19298963248730) },
+    { COEF_CONST(-0.99899083375931), COEF_CONST(0.74645155668259) },
+    { COEF_CONST(0.86557173728943), COEF_CONST(0.55593866109848) },
+    { COEF_CONST(0.33408042788506), COEF_CONST(0.86185956001282) },
+    { COEF_CONST(0.99010735750198), COEF_CONST(0.04602397605777) },
+    { COEF_CONST(-0.66694271564484), COEF_CONST(-0.91643613576889) },
+    { COEF_CONST(0.64016789197922), COEF_CONST(0.15649530291557) },
+    { COEF_CONST(0.99570536613464), COEF_CONST(0.45844584703445) },
+    { COEF_CONST(-0.63431465625763), COEF_CONST(0.21079117059708) },
+    { COEF_CONST(-0.07706847041845), COEF_CONST(-0.89581435918808) },
+    { COEF_CONST(0.98590087890625), COEF_CONST(0.88241720199585) },
+    { COEF_CONST(0.80099332332611), COEF_CONST(-0.36851897835732) },
+    { COEF_CONST(0.78368133306503), COEF_CONST(0.45506998896599) },
+    { COEF_CONST(0.08707806468010), COEF_CONST(0.80938994884491) },
+    { COEF_CONST(-0.86811882257462), COEF_CONST(0.39347308874130) },
+    { COEF_CONST(-0.39466530084610), COEF_CONST(-0.66809433698654) },
+    { COEF_CONST(0.97875326871872), COEF_CONST(-0.72467839717865) },
+    { COEF_CONST(-0.95038563013077), COEF_CONST(0.89563220739365) },
+    { COEF_CONST(0.17005239427090), COEF_CONST(0.54683053493500) },
+    { COEF_CONST(-0.76910793781281), COEF_CONST(-0.96226614713669) },
+    { COEF_CONST(0.99743282794952), COEF_CONST(0.42697158455849) },
+    { COEF_CONST(0.95437383651733), COEF_CONST(0.97002321481705) },
+    { COEF_CONST(0.99578905105591), COEF_CONST(-0.54106825590134) },
+    { COEF_CONST(0.28058260679245), COEF_CONST(-0.85361421108246) },
+    { COEF_CONST(0.85256522893906), COEF_CONST(-0.64567607641220) },
+    { COEF_CONST(-0.50608539581299), COEF_CONST(-0.65846014022827) },
+    { COEF_CONST(-0.97210735082626), COEF_CONST(-0.23095212876797) },
+    { COEF_CONST(0.95424050092697), COEF_CONST(-0.99240148067474) },
+    { COEF_CONST(-0.96926569938660), COEF_CONST(0.73775655031204) },
+    { COEF_CONST(0.30872163176537), COEF_CONST(0.41514959931374) },
+    { COEF_CONST(-0.24523839354515), COEF_CONST(0.63206630945206) },
+    { COEF_CONST(-0.33813264966011), COEF_CONST(-0.38661777973175) },
+    { COEF_CONST(-0.05826828256249), COEF_CONST(-0.06940773874521) },
+    { COEF_CONST(-0.22898460924625), COEF_CONST(0.97054851055145) },
+    { COEF_CONST(-0.18509915471077), COEF_CONST(0.47565764188766) },
+    { COEF_CONST(-0.10488238185644), COEF_CONST(-0.87769949436188) },
+    { COEF_CONST(-0.71886587142944), COEF_CONST(0.78030979633331) },
+    { COEF_CONST(0.99793875217438), COEF_CONST(0.90041309595108) },
+    { COEF_CONST(0.57563304901123), COEF_CONST(-0.91034334897995) },
+    { COEF_CONST(0.28909647464752), COEF_CONST(0.96307784318924) },
+    { COEF_CONST(0.42188999056816), COEF_CONST(0.48148649930954) },
+    { COEF_CONST(0.93335050344467), COEF_CONST(-0.43537023663521) },
+    { COEF_CONST(-0.97087377309799), COEF_CONST(0.86636447906494) },
+    { COEF_CONST(0.36722871661186), COEF_CONST(0.65291655063629) },
+    { COEF_CONST(-0.81093025207520), COEF_CONST(0.08778370171785) },
+    { COEF_CONST(-0.26240602135658), COEF_CONST(-0.92774093151093) },
+    { COEF_CONST(0.83996498584747), COEF_CONST(0.55839848518372) },
+    { COEF_CONST(-0.99909615516663), COEF_CONST(-0.96024608612061) },
+    { COEF_CONST(0.74649465084076), COEF_CONST(0.12144893407822) },
+    { COEF_CONST(-0.74774593114853), COEF_CONST(-0.26898062229156) },
+    { COEF_CONST(0.95781666040421), COEF_CONST(-0.79047924280167) },
+    { COEF_CONST(0.95472306013107), COEF_CONST(-0.08588775992393) },
+    { COEF_CONST(0.48708331584930), COEF_CONST(0.99999040365219) },
+    { COEF_CONST(0.46332037448883), COEF_CONST(0.10964126139879) },
+    { COEF_CONST(-0.76497006416321), COEF_CONST(0.89210927486420) },
+    { COEF_CONST(0.57397389411926), COEF_CONST(0.35289704799652) },
+    { COEF_CONST(0.75374317169189), COEF_CONST(0.96705216169357) },
+    { COEF_CONST(-0.59174400568008), COEF_CONST(-0.89405369758606) },
+    { COEF_CONST(0.75087904930115), COEF_CONST(-0.29612672328949) },
+    { COEF_CONST(-0.98607856035233), COEF_CONST(0.25034910440445) },
+    { COEF_CONST(-0.40761056542397), COEF_CONST(-0.90045571327209) },
+    { COEF_CONST(0.66929268836975), COEF_CONST(0.98629492521286) },
+    { COEF_CONST(-0.97463697195053), COEF_CONST(-0.00190223299433) },
+    { COEF_CONST(0.90145510435104), COEF_CONST(0.99781388044357) },
+    { COEF_CONST(-0.87259286642075), COEF_CONST(0.99233585596085) },
+    { COEF_CONST(-0.91529458761215), COEF_CONST(-0.15698707103729) },
+    { COEF_CONST(-0.03305738791823), COEF_CONST(-0.37205263972282) },
+    { COEF_CONST(0.07223051041365), COEF_CONST(-0.88805001974106) },
+    { COEF_CONST(0.99498009681702), COEF_CONST(0.97094357013702) },
+    { COEF_CONST(-0.74904936552048), COEF_CONST(0.99985486268997) },
+    { COEF_CONST(0.04585228487849), COEF_CONST(0.99812334775925) },
+    { COEF_CONST(-0.89054954051971), COEF_CONST(-0.31791913509369) },
+    { COEF_CONST(-0.83782142400742), COEF_CONST(0.97637635469437) },
+    { COEF_CONST(0.33454805612564), COEF_CONST(-0.86231517791748) },
+    { COEF_CONST(-0.99707579612732), COEF_CONST(0.93237990140915) },
+    { COEF_CONST(-0.22827528417110), COEF_CONST(0.18874759972095) },
+    { COEF_CONST(0.67248046398163), COEF_CONST(-0.03646211326122) },
+    { COEF_CONST(-0.05146538093686), COEF_CONST(-0.92599701881409) },
+    { COEF_CONST(0.99947297573090), COEF_CONST(0.93625229597092) },
+    { COEF_CONST(0.66951125860214), COEF_CONST(0.98905825614929) },
+    { COEF_CONST(-0.99602955579758), COEF_CONST(-0.44654715061188) },
+    { COEF_CONST(0.82104903459549), COEF_CONST(0.99540740251541) },
+    { COEF_CONST(0.99186509847641), COEF_CONST(0.72022998332977) },
+    { COEF_CONST(-0.65284591913223), COEF_CONST(0.52186721563339) },
+    { COEF_CONST(0.93885445594788), COEF_CONST(-0.74895310401917) },
+    { COEF_CONST(0.96735250949860), COEF_CONST(0.90891814231873) },
+    { COEF_CONST(-0.22225968539715), COEF_CONST(0.57124030590057) },
+    { COEF_CONST(-0.44132784008980), COEF_CONST(-0.92688840627670) },
+    { COEF_CONST(-0.85694974660873), COEF_CONST(0.88844531774521) },
+    { COEF_CONST(0.91783040761948), COEF_CONST(-0.46356892585754) },
+    { COEF_CONST(0.72556972503662), COEF_CONST(-0.99899554252625) },
+    { COEF_CONST(-0.99711579084396), COEF_CONST(0.58211559057236) },
+    { COEF_CONST(0.77638977766037), COEF_CONST(0.94321835041046) },
+    { COEF_CONST(0.07717324048281), COEF_CONST(0.58638399839401) },
+    { COEF_CONST(-0.56049829721451), COEF_CONST(0.82522302865982) },
+    { COEF_CONST(0.98398894071579), COEF_CONST(0.39467439055443) },
+    { COEF_CONST(0.47546947002411), COEF_CONST(0.68613046407700) },
+    { COEF_CONST(0.65675091743469), COEF_CONST(0.18331636488438) },
+    { COEF_CONST(0.03273375332355), COEF_CONST(-0.74933111667633) },
+    { COEF_CONST(-0.38684144616127), COEF_CONST(0.51337349414825) },
+    { COEF_CONST(-0.97346270084381), COEF_CONST(-0.96549361944199) },
+    { COEF_CONST(-0.53282153606415), COEF_CONST(-0.91423267126083) },
+    { COEF_CONST(0.99817311763763), COEF_CONST(0.61133575439453) },
+    { COEF_CONST(-0.50254499912262), COEF_CONST(-0.88829338550568) },
+    { COEF_CONST(0.01995873264968), COEF_CONST(0.85223513841629) },
+    { COEF_CONST(0.99930381774902), COEF_CONST(0.94578897953033) },
+    { COEF_CONST(0.82907766103745), COEF_CONST(-0.06323442608118) },
+    { COEF_CONST(-0.58660709857941), COEF_CONST(0.96840775012970) },
+    { COEF_CONST(-0.17573736608028), COEF_CONST(-0.48166921734810) },
+    { COEF_CONST(0.83434289693832), COEF_CONST(-0.13023450970650) },
+    { COEF_CONST(0.05946491286159), COEF_CONST(0.20511047542095) },
+    { COEF_CONST(0.81505483388901), COEF_CONST(-0.94685947895050) },
+    { COEF_CONST(-0.44976380467415), COEF_CONST(0.40894573926926) },
+    { COEF_CONST(-0.89746475219727), COEF_CONST(0.99846577644348) },
+    { COEF_CONST(0.39677256345749), COEF_CONST(-0.74854665994644) },
+    { COEF_CONST(-0.07588948309422), COEF_CONST(0.74096214771271) },
+    { COEF_CONST(0.76343196630478), COEF_CONST(0.41746628284454) },
+    { COEF_CONST(-0.74490106105804), COEF_CONST(0.94725912809372) },
+    { COEF_CONST(0.64880120754242), COEF_CONST(0.41336661577225) },
+    { COEF_CONST(0.62319535017014), COEF_CONST(-0.93098312616348) },
+    { COEF_CONST(0.42215818166733), COEF_CONST(-0.07712787389755) },
+    { COEF_CONST(0.02704554051161), COEF_CONST(-0.05417517945170) },
+    { COEF_CONST(0.80001771450043), COEF_CONST(0.91542196273804) },
+    { COEF_CONST(-0.79351830482483), COEF_CONST(-0.36208897829056) },
+    { COEF_CONST(0.63872361183167), COEF_CONST(0.08128252625465) },
+    { COEF_CONST(0.52890521287918), COEF_CONST(0.60048872232437) },
+    { COEF_CONST(0.74238550662994), COEF_CONST(0.04491915181279) },
+    { COEF_CONST(0.99096131324768), COEF_CONST(-0.19451183080673) },
+    { COEF_CONST(-0.80412328243256), COEF_CONST(-0.88513815402985) },
+    { COEF_CONST(-0.64612615108490), COEF_CONST(0.72198677062988) },
+    { COEF_CONST(0.11657770723104), COEF_CONST(-0.83662831783295) },
+    { COEF_CONST(-0.95053184032440), COEF_CONST(-0.96939903497696) },
+    { COEF_CONST(-0.62228870391846), COEF_CONST(0.82767260074615) },
+    { COEF_CONST(0.03004475869238), COEF_CONST(-0.99738895893097) },
+    { COEF_CONST(-0.97987216711044), COEF_CONST(0.36526128649712) },
+    { COEF_CONST(-0.99986982345581), COEF_CONST(-0.36021611094475) },
+    { COEF_CONST(0.89110648632050), COEF_CONST(-0.97894251346588) },
+    { COEF_CONST(0.10407960414886), COEF_CONST(0.77357792854309) },
+    { COEF_CONST(0.95964735746384), COEF_CONST(-0.35435819625854) },
+    { COEF_CONST(0.50843232870102), COEF_CONST(0.96107691526413) },
+    { COEF_CONST(0.17006334662437), COEF_CONST(-0.76854026317596) },
+    { COEF_CONST(0.25872674584389), COEF_CONST(0.99893301725388) },
+    { COEF_CONST(-0.01115998718888), COEF_CONST(0.98496019840240) },
+    { COEF_CONST(-0.79598701000214), COEF_CONST(0.97138410806656) },
+    { COEF_CONST(-0.99264711141586), COEF_CONST(-0.99542820453644) },
+    { COEF_CONST(-0.99829661846161), COEF_CONST(0.01877138763666) },
+    { COEF_CONST(-0.70801013708115), COEF_CONST(0.33680686354637) },
+    { COEF_CONST(-0.70467054843903), COEF_CONST(0.93272775411606) },
+    { COEF_CONST(0.99846023321152), COEF_CONST(-0.98725748062134) },
+    { COEF_CONST(-0.63364970684052), COEF_CONST(-0.16473594307899) },
+    { COEF_CONST(-0.16258217394352), COEF_CONST(-0.95939123630524) },
+    { COEF_CONST(-0.43645593523979), COEF_CONST(-0.94805032014847) },
+    { COEF_CONST(-0.99848473072052), COEF_CONST(0.96245169639587) },
+    { COEF_CONST(-0.16796459257603), COEF_CONST(-0.98987513780594) },
+    { COEF_CONST(-0.87979227304459), COEF_CONST(-0.71725726127625) },
+    { COEF_CONST(0.44183099269867), COEF_CONST(-0.93568974733353) },
+    { COEF_CONST(0.93310177326202), COEF_CONST(-0.99913311004639) },
+    { COEF_CONST(-0.93941932916641), COEF_CONST(-0.56409376859665) },
+    { COEF_CONST(-0.88590002059937), COEF_CONST(0.47624599933624) },
+    { COEF_CONST(0.99971461296082), COEF_CONST(-0.83889955282211) },
+    { COEF_CONST(-0.75376385450363), COEF_CONST(0.00814643409103) },
+    { COEF_CONST(0.93887686729431), COEF_CONST(-0.11284527927637) },
+    { COEF_CONST(0.85126435756683), COEF_CONST(0.52349251508713) },
+    { COEF_CONST(0.39701420068741), COEF_CONST(0.81779634952545) },
+    { COEF_CONST(-0.37024465203285), COEF_CONST(-0.87071657180786) },
+    { COEF_CONST(-0.36024826765060), COEF_CONST(0.34655734896660) },
+    { COEF_CONST(-0.93388813734055), COEF_CONST(-0.84476542472839) },
+    { COEF_CONST(-0.65298801660538), COEF_CONST(-0.18439576029778) },
+    { COEF_CONST(0.11960318684578), COEF_CONST(0.99899345636368) },
+    { COEF_CONST(0.94292563199997), COEF_CONST(0.83163905143738) },
+    { COEF_CONST(0.75081145763397), COEF_CONST(-0.35533222556114) },
+    { COEF_CONST(0.56721979379654), COEF_CONST(-0.24076835811138) },
+    { COEF_CONST(0.46857765316963), COEF_CONST(-0.30140233039856) },
+    { COEF_CONST(0.97312313318253), COEF_CONST(-0.99548190832138) },
+    { COEF_CONST(-0.38299977779388), COEF_CONST(0.98516911268234) },
+    { COEF_CONST(0.41025799512863), COEF_CONST(0.02116736955941) },
+    { COEF_CONST(0.09638062119484), COEF_CONST(0.04411984235048) },
+    { COEF_CONST(-0.85283249616623), COEF_CONST(0.91475564241409) },
+    { COEF_CONST(0.88866806030273), COEF_CONST(-0.99735265970230) },
+    { COEF_CONST(-0.48202428221703), COEF_CONST(-0.96805608272552) },
+    { COEF_CONST(0.27572581171989), COEF_CONST(0.58634752035141) },
+    { COEF_CONST(-0.65889132022858), COEF_CONST(0.58835631608963) },
+    { COEF_CONST(0.98838084936142), COEF_CONST(0.99994349479675) },
+    { COEF_CONST(-0.20651349425316), COEF_CONST(0.54593044519424) },
+    { COEF_CONST(-0.62126415967941), COEF_CONST(-0.59893679618835) },
+    { COEF_CONST(0.20320105552673), COEF_CONST(-0.86879181861877) },
+    { COEF_CONST(-0.97790551185608), COEF_CONST(0.96290808916092) },
+    { COEF_CONST(0.11112534999847), COEF_CONST(0.21484763920307) },
+    { COEF_CONST(-0.41368338465691), COEF_CONST(0.28216838836670) },
+    { COEF_CONST(0.24133038520813), COEF_CONST(0.51294362545013) },
+    { COEF_CONST(-0.66393411159515), COEF_CONST(-0.08249679952860) },
+    { COEF_CONST(-0.53697830438614), COEF_CONST(-0.97649902105331) },
+    { COEF_CONST(-0.97224736213684), COEF_CONST(0.22081333398819) },
+    { COEF_CONST(0.87392479181290), COEF_CONST(-0.12796173989773) },
+    { COEF_CONST(0.19050361216068), COEF_CONST(0.01602615416050) },
+    { COEF_CONST(-0.46353441476822), COEF_CONST(-0.95249038934708) },
+    { COEF_CONST(-0.07064096629620), COEF_CONST(-0.94479805231094) },
+    { COEF_CONST(-0.92444086074829), COEF_CONST(-0.10457590222359) },
+    { COEF_CONST(-0.83822596073151), COEF_CONST(-0.01695043221116) },
+    { COEF_CONST(0.75214684009552), COEF_CONST(-0.99955683946609) },
+    { COEF_CONST(-0.42102998495102), COEF_CONST(0.99720942974091) },
+    { COEF_CONST(-0.72094786167145), COEF_CONST(-0.35008960962296) },
+    { COEF_CONST(0.78843313455582), COEF_CONST(0.52851396799088) },
+    { COEF_CONST(0.97394025325775), COEF_CONST(-0.26695942878723) },
+    { COEF_CONST(0.99206465482712), COEF_CONST(-0.57010120153427) },
+    { COEF_CONST(0.76789611577988), COEF_CONST(-0.76519358158112) },
+    { COEF_CONST(-0.82002419233322), COEF_CONST(-0.73530179262161) },
+    { COEF_CONST(0.81924992799759), COEF_CONST(0.99698424339294) },
+    { COEF_CONST(-0.26719850301743), COEF_CONST(0.68903368711472) },
+    { COEF_CONST(-0.43311259150505), COEF_CONST(0.85321813821793) },
+    { COEF_CONST(0.99194979667664), COEF_CONST(0.91876250505447) },
+    { COEF_CONST(-0.80691999197006), COEF_CONST(-0.32627540826797) },
+    { COEF_CONST(0.43080005049706), COEF_CONST(-0.21919095516205) },
+    { COEF_CONST(0.67709493637085), COEF_CONST(-0.95478075742722) },
+    { COEF_CONST(0.56151771545410), COEF_CONST(-0.70693808794022) },
+    { COEF_CONST(0.10831862688065), COEF_CONST(-0.08628837019205) },
+    { COEF_CONST(0.91229414939880), COEF_CONST(-0.65987348556519) },
+    { COEF_CONST(-0.48972892761230), COEF_CONST(0.56289243698120) },
+    { COEF_CONST(-0.89033657312393), COEF_CONST(-0.71656566858292) },
+    { COEF_CONST(0.65269446372986), COEF_CONST(0.65916007757187) },
+    { COEF_CONST(0.67439478635788), COEF_CONST(-0.81684380769730) },
+    { COEF_CONST(-0.47770830988884), COEF_CONST(-0.16789555549622) },
+    { COEF_CONST(-0.99715977907181), COEF_CONST(-0.93565785884857) },
+    { COEF_CONST(-0.90889590978622), COEF_CONST(0.62034398317337) },
+    { COEF_CONST(-0.06618622690439), COEF_CONST(-0.23812216520309) },
+    { COEF_CONST(0.99430269002914), COEF_CONST(0.18812555074692) },
+    { COEF_CONST(0.97686403989792), COEF_CONST(-0.28664535284042) },
+    { COEF_CONST(0.94813650846481), COEF_CONST(-0.97506642341614) },
+    { COEF_CONST(-0.95434498786926), COEF_CONST(-0.79607981443405) },
+    { COEF_CONST(-0.49104782938957), COEF_CONST(0.32895213365555) },
+    { COEF_CONST(0.99881172180176), COEF_CONST(0.88993984460831) },
+    { COEF_CONST(0.50449168682098), COEF_CONST(-0.85995072126389) },
+    { COEF_CONST(0.47162890434265), COEF_CONST(-0.18680204451084) },
+    { COEF_CONST(-0.62081581354141), COEF_CONST(0.75000673532486) },
+    { COEF_CONST(-0.43867015838623), COEF_CONST(0.99998068809509) },
+    { COEF_CONST(0.98630565404892), COEF_CONST(-0.53578901290894) },
+    { COEF_CONST(-0.61510360240936), COEF_CONST(-0.89515018463135) },
+    { COEF_CONST(-0.03841517493129), COEF_CONST(-0.69888818264008) },
+    { COEF_CONST(-0.30102157592773), COEF_CONST(-0.07667808979750) },
+    { COEF_CONST(0.41881284117699), COEF_CONST(0.02188098989427) },
+    { COEF_CONST(-0.86135452985764), COEF_CONST(0.98947483301163) },
+    { COEF_CONST(0.67226862907410), COEF_CONST(-0.13494388759136) },
+    { COEF_CONST(-0.70737397670746), COEF_CONST(-0.76547348499298) },
+    { COEF_CONST(0.94044947624207), COEF_CONST(0.09026201069355) },
+    { COEF_CONST(-0.82386350631714), COEF_CONST(0.08924768865108) },
+    { COEF_CONST(-0.32070666551590), COEF_CONST(0.50143420696259) },
+    { COEF_CONST(0.57593160867691), COEF_CONST(-0.98966425657272) },
+    { COEF_CONST(-0.36326017975807), COEF_CONST(0.07440242916346) },
+    { COEF_CONST(0.99979043006897), COEF_CONST(-0.14130286872387) },
+    { COEF_CONST(-0.92366021871567), COEF_CONST(-0.97979295253754) },
+    { COEF_CONST(-0.44607177376747), COEF_CONST(-0.54233253002167) },
+    { COEF_CONST(0.44226801395416), COEF_CONST(0.71326756477356) },
+    { COEF_CONST(0.03671907261014), COEF_CONST(0.63606387376785) },
+    { COEF_CONST(0.52175426483154), COEF_CONST(-0.85396826267242) },
+    { COEF_CONST(-0.94701141119003), COEF_CONST(-0.01826348155737) },
+    { COEF_CONST(-0.98759609460831), COEF_CONST(0.82288712263107) },
+    { COEF_CONST(0.87434792518616), COEF_CONST(0.89399492740631) },
+    { COEF_CONST(-0.93412041664124), COEF_CONST(0.41374051570892) },
+    { COEF_CONST(0.96063941717148), COEF_CONST(0.93116706609726) },
+    { COEF_CONST(0.97534251213074), COEF_CONST(0.86150932312012) },
+    { COEF_CONST(0.99642467498779), COEF_CONST(0.70190042257309) },
+    { COEF_CONST(-0.94705086946487), COEF_CONST(-0.29580041766167) },
+    { COEF_CONST(0.91599804162979), COEF_CONST(-0.98147833347321) }
+};
+
+#ifdef __cplusplus
+
+#endif
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/sbr_qmf.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,363 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** 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.5 2003/07/29 08:20:13 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SBR_DEC
+
+
+#include <stdlib.h>
+#include <string.h>
+#include "sbr_dct.h"
+#include "sbr_qmf.h"
+#include "sbr_syntax.h"
+
+
+qmfa_info *qmfa_init(uint8_t channels)
+{
+#if 0
+    int16_t n;
+#endif
+    int size = 0;
+    qmfa_info *qmfa = (qmfa_info*)malloc(sizeof(qmfa_info));
+    qmfa->x = (real_t*)malloc(channels * 10 * sizeof(real_t));
+    memset(qmfa->x, 0, channels * 10 * sizeof(real_t));
+
+    qmfa->channels = channels;
+
+    if (channels == 32)
+    {
+#if 0
+        for (n = 0; n < 32; n++)
+        {
+            qmfa->post_exp_re[n] = cos((M_PI/32.)*(0.75*n + 0.375));
+            qmfa->post_exp_im[n] = sin((M_PI/32.)*(0.75*n + 0.375));
+        }
+#endif
+    } else if (channels == 64) {
+#if 0
+        for (n = 0; n < 2*channels; n++)
+        {
+            qmfa->pre_exp_re[n] = cos(M_PI*n/(2.*channels));
+            qmfa->pre_exp_im[n] = sin(M_PI*n/(2.*channels));
+        }
+        for (n = 0; n < 64; n++)
+        {
+            qmfa->post_exp_re[n] = cos(M_PI*(2*n+1)/(2.*128.));
+            qmfa->post_exp_im[n] = sin(M_PI*(2*n+1)/(2.*128.));
+        }
+#endif
+    }
+
+    return qmfa;
+}
+
+void qmfa_end(qmfa_info *qmfa)
+{
+    if (qmfa)
+    {
+        if (qmfa->x) free(qmfa->x);
+        free(qmfa);
+    }
+}
+
+void sbr_qmf_analysis_32(qmfa_info *qmfa, const real_t *input,
+                         qmf_t *X, uint8_t offset)
+{
+    uint8_t l;
+    real_t u[64];
+#ifndef SBR_LOW_POWER
+    real_t x[64], y[64];
+#else
+    real_t y[32];
+#endif
+    const real_t *inptr = input;
+
+    /* qmf subsample l */
+    for (l = 0; l < 32; l++)
+    {
+        int16_t n;
+
+        /* shift input buffer x */
+        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] = (*inptr++) >> 5;
+#else
+            qmfa->x[n] = *inptr++;
+#endif
+        }
+
+        /* window and summation to create array u */
+        for (n = 0; n < 64; n++)
+        {
+            u[n] = MUL_R_C(qmfa->x[n], qmf_c_2[n]) +
+                MUL_R_C(qmfa->x[n + 64], qmf_c_2[n + 64]) +
+                MUL_R_C(qmfa->x[n + 128], qmf_c_2[n + 128]) +
+                MUL_R_C(qmfa->x[n + 192], qmf_c_2[n + 192]) +
+                MUL_R_C(qmfa->x[n + 256], qmf_c_2[n + 256]);
+        }
+
+        /* calculate 32 subband samples by introducing X */
+#ifdef SBR_LOW_POWER
+        y[0] = u[48];
+        for (n = 1; n < 16; n++)
+            y[n] = u[n+48] + u[48-n];
+        for (n = 16; n < 32; n++)
+            y[n] = -u[n-16] + u[48-n];
+
+        DCT3_32_unscaled(u, y);
+
+        for (n = 0; n < 32; n++)
+        {
+#ifdef FIXED_POINT
+            QMF_RE(X[((l + offset)<<5) + n]) = u[n] << 1;
+#else
+            QMF_RE(X[((l + offset)<<5) + n]) = 2. * u[n];
+#endif
+
+#if 0
+            if (fabs(QMF_RE(X[((l + offset)<<5) + n])) > pow(2,20))
+            {
+                printf("%f\n", QMF_RE(X[((l + offset)<<5) + n]));
+            }
+#endif
+        }
+#else
+        x[0] = u[0];
+        x[63] = u[32];
+        for (n = 2; n < 64; n += 2)
+        {
+            x[n-1] = u[(n>>1)];
+            x[n] = -u[64-(n>>1)];
+        }
+
+        DCT4_64(y, x);
+
+        for (n = 0; n < 32; n++)
+        {
+#ifdef FIXED_POINT
+            QMF_RE(X[((l + offset)<<5) + n]) = y[n] << 1;
+            QMF_IM(X[((l + offset)<<5) + n]) = -y[63-n] << 1;
+#else
+            QMF_RE(X[((l + offset)<<5) + n]) = 2. * y[n];
+            QMF_IM(X[((l + offset)<<5) + n]) = -2. * y[63-n];
+#endif
+
+#if 0
+            if (fabs(QMF_RE(X[((l + offset)<<5) + n])) > pow(2,20))
+            {
+                printf("%f\n", QMF_RE(X[((l + offset)<<5) + n]));
+            }
+            if (fabs(QMF_IM(X[((l + offset)<<5) + n])) > pow(2,20))
+            {
+                printf("%f\n", QMF_IM(X[((l + offset)<<5) + n]));
+            }
+#endif
+        }
+#endif
+    }
+}
+
+qmfs_info *qmfs_init(uint8_t channels)
+{
+    int size = 0;
+    qmfs_info *qmfs = (qmfs_info*)malloc(sizeof(qmfs_info));
+    qmfs->v = (real_t*)malloc(channels * 20 * sizeof(real_t));
+    memset(qmfs->v, 0, channels * 20 * sizeof(real_t));
+
+    qmfs->channels = channels;
+
+    return qmfs;
+}
+
+void qmfs_end(qmfs_info *qmfs)
+{
+    if (qmfs)
+    {
+        if (qmfs->v) free(qmfs->v);
+        free(qmfs);
+    }
+}
+
+#if 0
+void sbr_qmf_synthesis_32(qmfs_info *qmfs, const complex_t *X,
+                          real_t *output)
+{
+    uint8_t l;
+    int16_t n, k;
+    real_t w[320];
+    complex_t x[128];
+    real_t *outptr = output;
+
+    /* qmf subsample l */
+    for (l = 0; l < 32; l++)
+    {
+        /* shift buffer */
+        for (n = 640 - 1; n >= 64; n--)
+        {
+            qmfs->v[n] = qmfs->v[n - 64];
+        }
+
+        /* calculate 64 samples */
+        memset(x, 0, 2*64*sizeof(real_t));
+
+        for (k = 0; k < 32; k++)
+        {
+            real_t er, ei, Xr, Xi;
+            er = qmfs->pre_exp_re[k];
+            ei = qmfs->pre_exp_im[k];
+
+            Xr = RE(X[l * 32 + k]);
+            Xi = IM(X[l * 32 + k]);
+            RE(x[k]) = Xr * er - Xi * ei;
+            IM(x[k]) = Xi * er + Xr * ei;
+        }
+
+        cfftb(qmfs->cffts, x);
+
+        for (n = 0; n < 64; n++)
+        {
+            real_t er, ei;
+            er = qmfs->post_exp_re[n];
+            ei = qmfs->post_exp_im[n];
+
+            qmfs->v[n] = RE(x[n]) * er - IM(x[n]) * ei;
+        }
+
+        for (n = 0; n < 5; n++)
+        {
+            for (k = 0; k < 32; k++)
+            {
+                w[64 * n +      k] = qmfs->v[128 * n +      k];
+                w[64 * n + 32 + k] = qmfs->v[128 * n + 96 + k];
+            }
+        }
+
+        /* window */
+        for (n = 0; n < 320; n++)
+        {
+            w[n] *= qmf_c_2[n];
+        }
+
+        /* calculate 32 output samples */
+        for (k = 0; k < 32; k++)
+        {
+            real_t sample = 0.0;
+
+            for (n = 0; n < 10; n++)
+            {
+                sample += w[32 * n + k];
+            }
+
+            *outptr++ = sample;
+        }
+    }
+}
+#endif
+
+void sbr_qmf_synthesis_64(qmfs_info *qmfs, const qmf_t *X,
+                          real_t *output)
+{
+    uint8_t l;
+    int16_t n, k;
+#ifdef SBR_LOW_POWER
+    real_t x[64];
+#else
+    real_t x1[64], x2[64];
+#endif
+    real_t *outptr = output;
+
+
+    /* qmf subsample l */
+    for (l = 0; l < 32; l++)
+    {
+        /* shift buffer */
+        memmove(qmfs->v + 128, qmfs->v, (1280-128)*sizeof(real_t));
+
+        /* calculate 128 samples */
+#ifdef SBR_LOW_POWER
+        for (k = 0; k < 64; k++)
+        {
+#ifdef FIXED_POINT
+            x[k] = QMF_RE(X[(l<<6) + k]);
+#else
+            x[k] = QMF_RE(X[(l<<6) + k]) / 32.;
+#endif
+        }
+
+        DCT2_64_unscaled(x, x);
+
+        for (n = 0; n < 64; n++)
+        {
+            qmfs->v[n+32] = x[n];
+        }
+        qmfs->v[0] = qmfs->v[64];
+        for (n = 1; n < 32; n++)
+        {
+            qmfs->v[32 - n] = qmfs->v[n + 32];
+            qmfs->v[n + 96] = -qmfs->v[96 - n];
+        }
+#else
+        for (k = 0; k < 64; k++)
+        {
+            x1[k] = QMF_RE(X[(l<<6) + k])/64.;
+            x2[k] = QMF_IM(X[(l<<6) + k])/64.;
+        }
+
+        DCT4_64(x1, x1);
+        DST4_64(x2, x2);
+
+        for (n = 0; n < 64; n++)
+        {
+            qmfs->v[n] = x2[n] - x1[n];
+            qmfs->v[127-n] = x2[n] + x1[n];
+        }
+#endif
+
+        /* calculate 64 output samples and window */
+        for (k = 0; k < 64; k++)
+        {
+            *outptr++ = MUL_R_C(qmfs->v[k], qmf_c[k]) +
+                MUL_R_C(qmfs->v[192 + k], qmf_c[64 + k]) +
+                MUL_R_C(qmfs->v[256 + k], qmf_c[128 + k]) +
+                MUL_R_C(qmfs->v[256 + 192 + k], qmf_c[128 + 64 + k]) +
+                MUL_R_C(qmfs->v[512 + k], qmf_c[256 + k]) +
+                MUL_R_C(qmfs->v[512 + 192 + k], qmf_c[256 + 64 + k]) +
+                MUL_R_C(qmfs->v[768 + k], qmf_c[384 + k]) +
+                MUL_R_C(qmfs->v[768 + 192 + k], qmf_c[384 + 64 + k]) +
+                MUL_R_C(qmfs->v[1024 + k], qmf_c[512 + k]) +
+                MUL_R_C(qmfs->v[1024 + 192 + k], qmf_c[512 + 64 + k]);
+        }
+    }
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/sbr_qmf.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,544 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** 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.5 2003/07/29 08:20:13 menno Exp $
+**/
+
+#ifndef __SBR_QMF_H__
+#define __SBR_QMF_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+qmfa_info *qmfa_init(uint8_t channels);
+void qmfa_end(qmfa_info *qmfa);
+qmfs_info *qmfs_init(uint8_t channels);
+void qmfs_end(qmfs_info *qmfs);
+
+void sbr_qmf_analysis_32(qmfa_info *qmfa, const real_t *input,
+                         qmf_t *X, uint8_t offset);
+void sbr_qmf_analysis_64(qmfa_info *qmfa, const real_t *input,
+                         qmf_t *X, uint8_t maxband, uint8_t offset);
+void sbr_qmf_synthesis_32(qmfs_info *qmfs, const qmf_t *X,
+                          real_t *output);
+void sbr_qmf_synthesis_64(qmfs_info *qmfs, const qmf_t *X,
+                          real_t *output);
+
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+
+static real_t qmf_c[] = {
+    COEF_CONST(0.0000000000), COEF_CONST(-0.0005525286),
+    COEF_CONST(-0.0005617692), COEF_CONST(-0.0004947518),
+    COEF_CONST(-0.0004875227), COEF_CONST(-0.0004893791),
+    COEF_CONST(-0.0005040714), COEF_CONST(-0.0005226564),
+    COEF_CONST(-0.0005466565), COEF_CONST(-0.0005677802),
+    COEF_CONST(-0.0005870930), COEF_CONST(-0.0006132747),
+    COEF_CONST(-0.0006312493), COEF_CONST(-0.0006540333),
+    COEF_CONST(-0.0006777690), COEF_CONST(-0.0006941614),
+    COEF_CONST(-0.0007157736), COEF_CONST(-0.0007255043),
+    COEF_CONST(-0.0007440941), COEF_CONST(-0.0007490598),
+    COEF_CONST(-0.0007681371), COEF_CONST(-0.0007724848),
+    COEF_CONST(-0.0007834332), COEF_CONST(-0.0007779869),
+    COEF_CONST(-0.0007803664), COEF_CONST(-0.0007801449),
+    COEF_CONST(-0.0007757977), COEF_CONST(-0.0007630793),
+    COEF_CONST(-0.0007530001), COEF_CONST(-0.0007319357),
+    COEF_CONST(-0.0007215391), COEF_CONST(-0.0006917937),
+    COEF_CONST(-0.0006650415), COEF_CONST(-0.0006341594),
+    COEF_CONST(-0.0005946118), COEF_CONST(-0.0005564576),
+    COEF_CONST(-0.0005145572), COEF_CONST(-0.0004606325),
+    COEF_CONST(-0.0004095121), COEF_CONST(-0.0003501175),
+    COEF_CONST(-0.0002896981), COEF_CONST(-0.0002098337),
+    COEF_CONST(-0.0001446380), COEF_CONST(-0.0000617334),
+    COEF_CONST(0.0000134949), COEF_CONST(0.0001094383),
+    COEF_CONST(0.0002043017), COEF_CONST(0.0002949531),
+    COEF_CONST(0.0004026540), COEF_CONST(0.0005107388),
+    COEF_CONST(0.0006239376), COEF_CONST(0.0007458025),
+    COEF_CONST(0.0008608443), COEF_CONST(0.0009885988),
+    COEF_CONST(0.0011250156), COEF_CONST(0.0012577884),
+    COEF_CONST(0.0013902494), COEF_CONST(0.0015443219),
+    COEF_CONST(0.0016868083), COEF_CONST(0.0018348265),
+    COEF_CONST(0.0019841141), COEF_CONST(0.0021461584),
+    COEF_CONST(0.0023017253), COEF_CONST(0.0024625617),
+    COEF_CONST(0.0026201757), COEF_CONST(0.0027870464),
+    COEF_CONST(0.0029469447), COEF_CONST(0.0031125420),
+    COEF_CONST(0.0032739614), COEF_CONST(0.0034418874),
+    COEF_CONST(0.0036008267), COEF_CONST(0.0037603923),
+    COEF_CONST(0.0039207432), COEF_CONST(0.0040819752),
+    COEF_CONST(0.0042264271), COEF_CONST(0.0043730717),
+    COEF_CONST(0.0045209853), COEF_CONST(0.0046606460),
+    COEF_CONST(0.0047932561), COEF_CONST(0.0049137603),
+    COEF_CONST(0.0050393022), COEF_CONST(0.0051407353),
+    COEF_CONST(0.0052461168), COEF_CONST(0.0053471681),
+    COEF_CONST(0.0054196776), COEF_CONST(0.0054876041),
+    COEF_CONST(0.0055475715), COEF_CONST(0.0055938023),
+    COEF_CONST(0.0056220642), COEF_CONST(0.0056455196),
+    COEF_CONST(0.0056389198), COEF_CONST(0.0056266114),
+    COEF_CONST(0.0055917129), COEF_CONST(0.0055404361),
+    COEF_CONST(0.0054753781), COEF_CONST(0.0053838976),
+    COEF_CONST(0.0052715759), COEF_CONST(0.0051382277),
+    COEF_CONST(0.0049839686), COEF_CONST(0.0048109470),
+    COEF_CONST(0.0046039531), COEF_CONST(0.0043801861),
+    COEF_CONST(0.0041251644), COEF_CONST(0.0038456407),
+    COEF_CONST(0.0035401245), COEF_CONST(0.0032091886),
+    COEF_CONST(0.0028446757), COEF_CONST(0.0024508541),
+    COEF_CONST(0.0020274175), COEF_CONST(0.0015784682),
+    COEF_CONST(0.0010902329), COEF_CONST(0.0005832264),
+    COEF_CONST(0.0000276045), COEF_CONST(-0.0005464280),
+    COEF_CONST(-0.0011568135), COEF_CONST(-0.0018039471),
+    COEF_CONST(-0.0024826722), COEF_CONST(-0.0031933777),
+    COEF_CONST(-0.0039401124), COEF_CONST(-0.0047222595),
+    COEF_CONST(-0.0055337213), COEF_CONST(-0.0063792295),
+    COEF_CONST(-0.0072615817), COEF_CONST(-0.0081798229),
+    COEF_CONST(-0.0091325333), COEF_CONST(-0.0101150218),
+    COEF_CONST(-0.0111315548), COEF_CONST(-0.0121849999),
+    COEF_CONST(0.0132718217), COEF_CONST(0.0143904667),
+    COEF_CONST(0.0155405551), COEF_CONST(0.0167324711),
+    COEF_CONST(0.0179433376), COEF_CONST(0.0191872437),
+    COEF_CONST(0.0204531793), COEF_CONST(0.0217467546),
+    COEF_CONST(0.0230680164), COEF_CONST(0.0244160984),
+    COEF_CONST(0.0257875845), COEF_CONST(0.0271859430),
+    COEF_CONST(0.0286072176), COEF_CONST(0.0300502665),
+    COEF_CONST(0.0315017626), COEF_CONST(0.0329754092),
+    COEF_CONST(0.0344620943), COEF_CONST(0.0359697565),
+    COEF_CONST(0.0374812856), COEF_CONST(0.0390053689),
+    COEF_CONST(0.0405349173), COEF_CONST(0.0420649089),
+    COEF_CONST(0.0436097533), COEF_CONST(0.0451488420),
+    COEF_CONST(0.0466843024), COEF_CONST(0.0482165702),
+    COEF_CONST(0.0497385748), COEF_CONST(0.0512556173),
+    COEF_CONST(0.0527630746), COEF_CONST(0.0542452782),
+    COEF_CONST(0.0557173640), COEF_CONST(0.0571616441),
+    COEF_CONST(0.0585915670), COEF_CONST(0.0599837489),
+    COEF_CONST(0.0613455176), COEF_CONST(0.0626857802),
+    COEF_CONST(0.0639715865), COEF_CONST(0.0652247071),
+    COEF_CONST(0.0664367527), COEF_CONST(0.0676075965),
+    COEF_CONST(0.0687043816), COEF_CONST(0.0697630271),
+    COEF_CONST(0.0707628727), COEF_CONST(0.0717002675),
+    COEF_CONST(0.0725682601), COEF_CONST(0.0733620226),
+    COEF_CONST(0.0741003677), COEF_CONST(0.0747452527),
+    COEF_CONST(0.0753137320), COEF_CONST(0.0758008361),
+    COEF_CONST(0.0761992484), COEF_CONST(0.0764992163),
+    COEF_CONST(0.0767093524), COEF_CONST(0.0768174008),
+    COEF_CONST(0.0768230036), COEF_CONST(0.0767204911),
+    COEF_CONST(0.0765050724), COEF_CONST(0.0761748329),
+    COEF_CONST(0.0757305771), COEF_CONST(0.0751576275),
+    COEF_CONST(0.0744664371), COEF_CONST(0.0736405998),
+    COEF_CONST(0.0726774633), COEF_CONST(0.0715826377),
+    COEF_CONST(0.0703533068), COEF_CONST(0.0689664036),
+    COEF_CONST(0.0674525052), COEF_CONST(0.0657690689),
+    COEF_CONST(0.0639444813), COEF_CONST(0.0619602762),
+    COEF_CONST(0.0598166585), COEF_CONST(0.0575152673),
+    COEF_CONST(0.0550460033), COEF_CONST(0.0524093807),
+    COEF_CONST(0.0495978668), COEF_CONST(0.0466303304),
+    COEF_CONST(0.0434768796), COEF_CONST(0.0401458293),
+    COEF_CONST(0.0366418101), COEF_CONST(0.0329583921),
+    COEF_CONST(0.0290824007), COEF_CONST(0.0250307564),
+    COEF_CONST(0.0207997076), COEF_CONST(0.0163701251),
+    COEF_CONST(0.0117623834), COEF_CONST(0.0069636861),
+    COEF_CONST(0.0019765601), COEF_CONST(-0.0032086896),
+    COEF_CONST(-0.0085711749), COEF_CONST(-0.0141288824),
+    COEF_CONST(-0.0198834129), COEF_CONST(-0.0258227289),
+    COEF_CONST(-0.0319531262), COEF_CONST(-0.0382776558),
+    COEF_CONST(-0.0447806828), COEF_CONST(-0.0514804162),
+    COEF_CONST(-0.0583705343), COEF_CONST(-0.0654409826),
+    COEF_CONST(-0.0726943314), COEF_CONST(-0.0801372901),
+    COEF_CONST(-0.0877547562), COEF_CONST(-0.0955533385),
+    COEF_CONST(-0.1035329551), COEF_CONST(-0.1116826907),
+    COEF_CONST(-0.1200077981), COEF_CONST(-0.1285002828),
+    COEF_CONST(-0.1371551752), COEF_CONST(-0.1459766477),
+    COEF_CONST(-0.1549607068), COEF_CONST(-0.1640958786),
+    COEF_CONST(-0.1733808219), COEF_CONST(-0.1828172505),
+    COEF_CONST(-0.1923966706), COEF_CONST(-0.2021250129),
+    COEF_CONST(-0.2119735926), COEF_CONST(-0.2219652683),
+    COEF_CONST(-0.2320690900), COEF_CONST(-0.2423016876),
+    COEF_CONST(-0.2526480258), COEF_CONST(-0.2631053329),
+    COEF_CONST(-0.2736634016), COEF_CONST(-0.2843214273),
+    COEF_CONST(-0.2950716615), COEF_CONST(-0.3059098721),
+    COEF_CONST(-0.3168278933), COEF_CONST(-0.3278113604),
+    COEF_CONST(-0.3388722837), COEF_CONST(-0.3499914110),
+    COEF_CONST(0.3611589968), COEF_CONST(0.3723795414),
+    COEF_CONST(0.3836350143), COEF_CONST(0.3949211836),
+    COEF_CONST(0.4062317610), COEF_CONST(0.4175696969),
+    COEF_CONST(0.4289119840), COEF_CONST(0.4402553737),
+    COEF_CONST(0.4515996575), COEF_CONST(0.4629307985),
+    COEF_CONST(0.4742453098), COEF_CONST(0.4855253100),
+    COEF_CONST(0.4967708290), COEF_CONST(0.5079817772),
+    COEF_CONST(0.5191234946), COEF_CONST(0.5302240849),
+    COEF_CONST(0.5412553549), COEF_CONST(0.5522051454),
+    COEF_CONST(0.5630789399), COEF_CONST(0.5738524199),
+    COEF_CONST(0.5845403075), COEF_CONST(0.5951123238),
+    COEF_CONST(0.6055783629), COEF_CONST(0.6159110069),
+    COEF_CONST(0.6261242628), COEF_CONST(0.6361979842),
+    COEF_CONST(0.6461269855), COEF_CONST(0.6559016109),
+    COEF_CONST(0.6655139923), COEF_CONST(0.6749663353),
+    COEF_CONST(0.6842353344), COEF_CONST(0.6933282614),
+    COEF_CONST(0.7022388577), COEF_CONST(0.7109410167),
+    COEF_CONST(0.7194462419), COEF_CONST(0.7277448773),
+    COEF_CONST(0.7358211875), COEF_CONST(0.7436828017),
+    COEF_CONST(0.7513137460), COEF_CONST(0.7587080598),
+    COEF_CONST(0.7658674717), COEF_CONST(0.7727780938),
+    COEF_CONST(0.7794287801), COEF_CONST(0.7858353257),
+    COEF_CONST(0.7919735909), COEF_CONST(0.7978466153),
+    COEF_CONST(0.8034485579), COEF_CONST(0.8087695241),
+    COEF_CONST(0.8138191104), COEF_CONST(0.8185775876),
+    COEF_CONST(0.8230419755), COEF_CONST(0.8272275329),
+    COEF_CONST(0.8311038613), COEF_CONST(0.8346937299),
+    COEF_CONST(0.8379717469), COEF_CONST(0.8409541249),
+    COEF_CONST(0.8436238170), COEF_CONST(0.8459818363),
+    COEF_CONST(0.8480315804), COEF_CONST(0.8497804999),
+    COEF_CONST(0.8511971235), COEF_CONST(0.8523046970),
+    COEF_CONST(0.8531020880), COEF_CONST(0.8535720706),
+    COEF_CONST(0.8537385464), COEF_CONST(0.8535720706),
+    COEF_CONST(0.8531020880), COEF_CONST(0.8523046970),
+    COEF_CONST(0.8511971235), COEF_CONST(0.8497804999),
+    COEF_CONST(0.8480315804), COEF_CONST(0.8459818363),
+    COEF_CONST(0.8436238170), COEF_CONST(0.8409541249),
+    COEF_CONST(0.8379717469), COEF_CONST(0.8346937299),
+    COEF_CONST(0.8311038613), COEF_CONST(0.8272275329),
+    COEF_CONST(0.8230419755), COEF_CONST(0.8185775876),
+    COEF_CONST(0.8138191104), COEF_CONST(0.8087695241),
+    COEF_CONST(0.8034485579), COEF_CONST(0.7978466153),
+    COEF_CONST(0.7919735909), COEF_CONST(0.7858353257),
+    COEF_CONST(0.7794287801), COEF_CONST(0.7727780938),
+    COEF_CONST(0.7658674717), COEF_CONST(0.7587080598),
+    COEF_CONST(0.7513137460), COEF_CONST(0.7436828017),
+    COEF_CONST(0.7358211875), COEF_CONST(0.7277448773),
+    COEF_CONST(0.7194462419), COEF_CONST(0.7109410167),
+    COEF_CONST(0.7022388577), COEF_CONST(0.6933282614),
+    COEF_CONST(0.6842353344), COEF_CONST(0.6749663353),
+    COEF_CONST(0.6655139923), COEF_CONST(0.6559016109),
+    COEF_CONST(0.6461269855), COEF_CONST(0.6361979842),
+    COEF_CONST(0.6261242628), COEF_CONST(0.6159110069),
+    COEF_CONST(0.6055783629), COEF_CONST(0.5951123238),
+    COEF_CONST(0.5845403075), COEF_CONST(0.5738524199),
+    COEF_CONST(0.5630789399), COEF_CONST(0.5522051454),
+    COEF_CONST(0.5412553549), COEF_CONST(0.5302240849),
+    COEF_CONST(0.5191234946), COEF_CONST(0.5079817772),
+    COEF_CONST(0.4967708290), COEF_CONST(0.4855253100),
+    COEF_CONST(0.4742453098), COEF_CONST(0.4629307985),
+    COEF_CONST(0.4515996575), COEF_CONST(0.4402553737),
+    COEF_CONST(0.4289119840), COEF_CONST(0.4175696969),
+    COEF_CONST(0.4062317610), COEF_CONST(0.3949211836),
+    COEF_CONST(0.3836350143), COEF_CONST(0.3723795414),
+    COEF_CONST(-0.3611589968), COEF_CONST(-0.3499914110),
+    COEF_CONST(-0.3388722837), COEF_CONST(-0.3278113604),
+    COEF_CONST(-0.3168278933), COEF_CONST(-0.3059098721),
+    COEF_CONST(-0.2950716615), COEF_CONST(-0.2843214273),
+    COEF_CONST(-0.2736634016), COEF_CONST(-0.2631053329),
+    COEF_CONST(-0.2526480258), COEF_CONST(-0.2423016876),
+    COEF_CONST(-0.2320690900), COEF_CONST(-0.2219652683),
+    COEF_CONST(-0.2119735926), COEF_CONST(-0.2021250129),
+    COEF_CONST(-0.1923966706), COEF_CONST(-0.1828172505),
+    COEF_CONST(-0.1733808219), COEF_CONST(-0.1640958786),
+    COEF_CONST(-0.1549607068), COEF_CONST(-0.1459766477),
+    COEF_CONST(-0.1371551752), COEF_CONST(-0.1285002828),
+    COEF_CONST(-0.1200077981), COEF_CONST(-0.1116826907),
+    COEF_CONST(-0.1035329551), COEF_CONST(-0.0955533385),
+    COEF_CONST(-0.0877547562), COEF_CONST(-0.0801372901),
+    COEF_CONST(-0.0726943314), COEF_CONST(-0.0654409826),
+    COEF_CONST(-0.0583705343), COEF_CONST(-0.0514804162),
+    COEF_CONST(-0.0447806828), COEF_CONST(-0.0382776558),
+    COEF_CONST(-0.0319531262), COEF_CONST(-0.0258227289),
+    COEF_CONST(-0.0198834129), COEF_CONST(-0.0141288824),
+    COEF_CONST(-0.0085711749), COEF_CONST(-0.0032086896),
+    COEF_CONST(0.0019765601), COEF_CONST(0.0069636861),
+    COEF_CONST(0.0117623834), COEF_CONST(0.0163701251),
+    COEF_CONST(0.0207997076), COEF_CONST(0.0250307564),
+    COEF_CONST(0.0290824007), COEF_CONST(0.0329583921),
+    COEF_CONST(0.0366418101), COEF_CONST(0.0401458293),
+    COEF_CONST(0.0434768796), COEF_CONST(0.0466303304),
+    COEF_CONST(0.0495978668), COEF_CONST(0.0524093807),
+    COEF_CONST(0.0550460033), COEF_CONST(0.0575152673),
+    COEF_CONST(0.0598166585), COEF_CONST(0.0619602762),
+    COEF_CONST(0.0639444813), COEF_CONST(0.0657690689),
+    COEF_CONST(0.0674525052), COEF_CONST(0.0689664036),
+    COEF_CONST(0.0703533068), COEF_CONST(0.0715826377),
+    COEF_CONST(0.0726774633), COEF_CONST(0.0736405998),
+    COEF_CONST(0.0744664371), COEF_CONST(0.0751576275),
+    COEF_CONST(0.0757305771), COEF_CONST(0.0761748329),
+    COEF_CONST(0.0765050724), COEF_CONST(0.0767204911),
+    COEF_CONST(0.0768230036), COEF_CONST(0.0768174008),
+    COEF_CONST(0.0767093524), COEF_CONST(0.0764992163),
+    COEF_CONST(0.0761992484), COEF_CONST(0.0758008361),
+    COEF_CONST(0.0753137320), COEF_CONST(0.0747452527),
+    COEF_CONST(0.0741003677), COEF_CONST(0.0733620226),
+    COEF_CONST(0.0725682601), COEF_CONST(0.0717002675),
+    COEF_CONST(0.0707628727), COEF_CONST(0.0697630271),
+    COEF_CONST(0.0687043816), COEF_CONST(0.0676075965),
+    COEF_CONST(0.0664367527), COEF_CONST(0.0652247071),
+    COEF_CONST(0.0639715865), COEF_CONST(0.0626857802),
+    COEF_CONST(0.0613455176), COEF_CONST(0.0599837489),
+    COEF_CONST(0.0585915670), COEF_CONST(0.0571616441),
+    COEF_CONST(0.0557173640), COEF_CONST(0.0542452782),
+    COEF_CONST(0.0527630746), COEF_CONST(0.0512556173),
+    COEF_CONST(0.0497385748), COEF_CONST(0.0482165702),
+    COEF_CONST(0.0466843024), COEF_CONST(0.0451488420),
+    COEF_CONST(0.0436097533), COEF_CONST(0.0420649089),
+    COEF_CONST(0.0405349173), COEF_CONST(0.0390053689),
+    COEF_CONST(0.0374812856), COEF_CONST(0.0359697565),
+    COEF_CONST(0.0344620943), COEF_CONST(0.0329754092),
+    COEF_CONST(0.0315017626), COEF_CONST(0.0300502665),
+    COEF_CONST(0.0286072176), COEF_CONST(0.0271859430),
+    COEF_CONST(0.0257875845), COEF_CONST(0.0244160984),
+    COEF_CONST(0.0230680164), COEF_CONST(0.0217467546),
+    COEF_CONST(0.0204531793), COEF_CONST(0.0191872437),
+    COEF_CONST(0.0179433376), COEF_CONST(0.0167324711),
+    COEF_CONST(0.0155405551), COEF_CONST(0.0143904667),
+    COEF_CONST(-0.0132718217), COEF_CONST(-0.0121849999),
+    COEF_CONST(-0.0111315548), COEF_CONST(-0.0101150218),
+    COEF_CONST(-0.0091325333), COEF_CONST(-0.0081798229),
+    COEF_CONST(-0.0072615817), COEF_CONST(-0.0063792295),
+    COEF_CONST(-0.0055337213), COEF_CONST(-0.0047222595),
+    COEF_CONST(-0.0039401124), COEF_CONST(-0.0031933777),
+    COEF_CONST(-0.0024826722), COEF_CONST(-0.0018039471),
+    COEF_CONST(-0.0011568135), COEF_CONST(-0.0005464280),
+    COEF_CONST(0.0000276045), COEF_CONST(0.0005832264),
+    COEF_CONST(0.0010902329), COEF_CONST(0.0015784682),
+    COEF_CONST(0.0020274175), COEF_CONST(0.0024508541),
+    COEF_CONST(0.0028446757), COEF_CONST(0.0032091886),
+    COEF_CONST(0.0035401245), COEF_CONST(0.0038456407),
+    COEF_CONST(0.0041251644), COEF_CONST(0.0043801861),
+    COEF_CONST(0.0046039531), COEF_CONST(0.0048109470),
+    COEF_CONST(0.0049839686), COEF_CONST(0.0051382277),
+    COEF_CONST(0.0052715759), COEF_CONST(0.0053838976),
+    COEF_CONST(0.0054753781), COEF_CONST(0.0055404361),
+    COEF_CONST(0.0055917129), COEF_CONST(0.0056266114),
+    COEF_CONST(0.0056389198), COEF_CONST(0.0056455196),
+    COEF_CONST(0.0056220642), COEF_CONST(0.0055938023),
+    COEF_CONST(0.0055475715), COEF_CONST(0.0054876041),
+    COEF_CONST(0.0054196776), COEF_CONST(0.0053471681),
+    COEF_CONST(0.0052461168), COEF_CONST(0.0051407353),
+    COEF_CONST(0.0050393022), COEF_CONST(0.0049137603),
+    COEF_CONST(0.0047932561), COEF_CONST(0.0046606460),
+    COEF_CONST(0.0045209853), COEF_CONST(0.0043730717),
+    COEF_CONST(0.0042264271), COEF_CONST(0.0040819752),
+    COEF_CONST(0.0039207432), COEF_CONST(0.0037603923),
+    COEF_CONST(0.0036008267), COEF_CONST(0.0034418874),
+    COEF_CONST(0.0032739614), COEF_CONST(0.0031125420),
+    COEF_CONST(0.0029469447), COEF_CONST(0.0027870464),
+    COEF_CONST(0.0026201757), COEF_CONST(0.0024625617),
+    COEF_CONST(0.0023017253), COEF_CONST(0.0021461584),
+    COEF_CONST(0.0019841141), COEF_CONST(0.0018348265),
+    COEF_CONST(0.0016868083), COEF_CONST(0.0015443219),
+    COEF_CONST(0.0013902494), COEF_CONST(0.0012577884),
+    COEF_CONST(0.0011250156), COEF_CONST(0.0009885988),
+    COEF_CONST(0.0008608443), COEF_CONST(0.0007458025),
+    COEF_CONST(0.0006239376), COEF_CONST(0.0005107388),
+    COEF_CONST(0.0004026540), COEF_CONST(0.0002949531),
+    COEF_CONST(0.0002043017), COEF_CONST(0.0001094383),
+    COEF_CONST(0.0000134949), COEF_CONST(-0.0000617334),
+    COEF_CONST(-0.0001446380), COEF_CONST(-0.0002098337),
+    COEF_CONST(-0.0002896981), COEF_CONST(-0.0003501175),
+    COEF_CONST(-0.0004095121), COEF_CONST(-0.0004606325),
+    COEF_CONST(-0.0005145572), COEF_CONST(-0.0005564576),
+    COEF_CONST(-0.0005946118), COEF_CONST(-0.0006341594),
+    COEF_CONST(-0.0006650415), COEF_CONST(-0.0006917937),
+    COEF_CONST(-0.0007215391), COEF_CONST(-0.0007319357),
+    COEF_CONST(-0.0007530001), COEF_CONST(-0.0007630793),
+    COEF_CONST(-0.0007757977), COEF_CONST(-0.0007801449),
+    COEF_CONST(-0.0007803664), COEF_CONST(-0.0007779869),
+    COEF_CONST(-0.0007834332), COEF_CONST(-0.0007724848),
+    COEF_CONST(-0.0007681371), COEF_CONST(-0.0007490598),
+    COEF_CONST(-0.0007440941), COEF_CONST(-0.0007255043),
+    COEF_CONST(-0.0007157736), COEF_CONST(-0.0006941614),
+    COEF_CONST(-0.0006777690), COEF_CONST(-0.0006540333),
+    COEF_CONST(-0.0006312493), COEF_CONST(-0.0006132747),
+    COEF_CONST(-0.0005870930), COEF_CONST(-0.0005677802),
+    COEF_CONST(-0.0005466565), COEF_CONST(-0.0005226564),
+    COEF_CONST(-0.0005040714), COEF_CONST(-0.0004893791),
+    COEF_CONST(-0.0004875227), COEF_CONST(-0.0004947518),
+    COEF_CONST(-0.0005617692), COEF_CONST(-0.0005525280)
+};
+
+static real_t qmf_c_2[] = {
+    COEF_CONST(0.0000000000), COEF_CONST(-0.0005617692),
+    COEF_CONST(-0.0004875227), COEF_CONST(-0.0005040714),
+    COEF_CONST(-0.0005466565), COEF_CONST(-0.0005870930),
+    COEF_CONST(-0.0006312493), COEF_CONST(-0.0006777690),
+    COEF_CONST(-0.0007157736), COEF_CONST(-0.0007440941),
+    COEF_CONST(-0.0007681371), COEF_CONST(-0.0007834332),
+    COEF_CONST(-0.0007803664), COEF_CONST(-0.0007757977),
+    COEF_CONST(-0.0007530001), COEF_CONST(-0.0007215391),
+    COEF_CONST(-0.0006650415), COEF_CONST(-0.0005946118),
+    COEF_CONST(-0.0005145572), COEF_CONST(-0.0004095121),
+    COEF_CONST(-0.0002896981), COEF_CONST(-0.0001446380),
+    COEF_CONST(0.0000134949), COEF_CONST(0.0002043017),
+    COEF_CONST(0.0004026540), COEF_CONST(0.0006239376),
+    COEF_CONST(0.0008608443), COEF_CONST(0.0011250156),
+    COEF_CONST(0.0013902494), COEF_CONST(0.0016868083),
+    COEF_CONST(0.0019841141), COEF_CONST(0.0023017253),
+    COEF_CONST(0.0026201757), COEF_CONST(0.0029469447),
+    COEF_CONST(0.0032739614), COEF_CONST(0.0036008267),
+    COEF_CONST(0.0039207432), COEF_CONST(0.0042264271),
+    COEF_CONST(0.0045209853), COEF_CONST(0.0047932561),
+    COEF_CONST(0.0050393022), COEF_CONST(0.0052461168),
+    COEF_CONST(0.0054196776), COEF_CONST(0.0055475715),
+    COEF_CONST(0.0056220642), COEF_CONST(0.0056389198),
+    COEF_CONST(0.0055917129), COEF_CONST(0.0054753781),
+    COEF_CONST(0.0052715759), COEF_CONST(0.0049839686),
+    COEF_CONST(0.0046039531), COEF_CONST(0.0041251644),
+    COEF_CONST(0.0035401245), COEF_CONST(0.0028446757),
+    COEF_CONST(0.0020274175), COEF_CONST(0.0010902329),
+    COEF_CONST(0.0000276045), COEF_CONST(-0.0011568135),
+    COEF_CONST(-0.0024826722), COEF_CONST(-0.0039401124),
+    COEF_CONST(-0.0055337213), COEF_CONST(-0.0072615817),
+    COEF_CONST(-0.0091325333), COEF_CONST(-0.0111315548),
+    COEF_CONST(0.0132718217), COEF_CONST(0.0155405551),
+    COEF_CONST(0.0179433376), COEF_CONST(0.0204531793),
+    COEF_CONST(0.0230680164), COEF_CONST(0.0257875845),
+    COEF_CONST(0.0286072176), COEF_CONST(0.0315017626),
+    COEF_CONST(0.0344620943), COEF_CONST(0.0374812856),
+    COEF_CONST(0.0405349173), COEF_CONST(0.0436097533),
+    COEF_CONST(0.0466843024), COEF_CONST(0.0497385748),
+    COEF_CONST(0.0527630746), COEF_CONST(0.0557173640),
+    COEF_CONST(0.0585915670), COEF_CONST(0.0613455176),
+    COEF_CONST(0.0639715865), COEF_CONST(0.0664367527),
+    COEF_CONST(0.0687043816), COEF_CONST(0.0707628727),
+    COEF_CONST(0.0725682601), COEF_CONST(0.0741003677),
+    COEF_CONST(0.0753137320), COEF_CONST(0.0761992484),
+    COEF_CONST(0.0767093524), COEF_CONST(0.0768230036),
+    COEF_CONST(0.0765050724), COEF_CONST(0.0757305771),
+    COEF_CONST(0.0744664371), COEF_CONST(0.0726774633),
+    COEF_CONST(0.0703533068), COEF_CONST(0.0674525052),
+    COEF_CONST(0.0639444813), COEF_CONST(0.0598166585),
+    COEF_CONST(0.0550460033), COEF_CONST(0.0495978668),
+    COEF_CONST(0.0434768796), COEF_CONST(0.0366418101),
+    COEF_CONST(0.0290824007), COEF_CONST(0.0207997076),
+    COEF_CONST(0.0117623834), COEF_CONST(0.0019765601),
+    COEF_CONST(-0.0085711749), COEF_CONST(-0.0198834129),
+    COEF_CONST(-0.0319531262), COEF_CONST(-0.0447806828),
+    COEF_CONST(-0.0583705343), COEF_CONST(-0.0726943314),
+    COEF_CONST(-0.0877547562), COEF_CONST(-0.1035329551),
+    COEF_CONST(-0.1200077981), COEF_CONST(-0.1371551752),
+    COEF_CONST(-0.1549607068), COEF_CONST(-0.1733808219),
+    COEF_CONST(-0.1923966706), COEF_CONST(-0.2119735926),
+    COEF_CONST(-0.2320690900), COEF_CONST(-0.2526480258),
+    COEF_CONST(-0.2736634016), COEF_CONST(-0.2950716615),
+    COEF_CONST(-0.3168278933), COEF_CONST(-0.3388722837),
+    COEF_CONST(0.3611589968), COEF_CONST(0.3836350143),
+    COEF_CONST(0.4062317610), COEF_CONST(0.4289119840),
+    COEF_CONST(0.4515996575), COEF_CONST(0.4742453098),
+    COEF_CONST(0.4967708290), COEF_CONST(0.5191234946),
+    COEF_CONST(0.5412553549), COEF_CONST(0.5630789399),
+    COEF_CONST(0.5845403075), COEF_CONST(0.6055783629),
+    COEF_CONST(0.6261242628), COEF_CONST(0.6461269855),
+    COEF_CONST(0.6655139923), COEF_CONST(0.6842353344),
+    COEF_CONST(0.7022388577), COEF_CONST(0.7194462419),
+    COEF_CONST(0.7358211875), COEF_CONST(0.7513137460),
+    COEF_CONST(0.7658674717), COEF_CONST(0.7794287801),
+    COEF_CONST(0.7919735909), COEF_CONST(0.8034485579),
+    COEF_CONST(0.8138191104), COEF_CONST(0.8230419755),
+    COEF_CONST(0.8311038613), COEF_CONST(0.8379717469),
+    COEF_CONST(0.8436238170), COEF_CONST(0.8480315804),
+    COEF_CONST(0.8511971235), COEF_CONST(0.8531020880),
+    COEF_CONST(0.8537385464), COEF_CONST(0.8531020880),
+    COEF_CONST(0.8511971235), COEF_CONST(0.8480315804),
+    COEF_CONST(0.8436238170), COEF_CONST(0.8379717469),
+    COEF_CONST(0.8311038613), COEF_CONST(0.8230419755),
+    COEF_CONST(0.8138191104), COEF_CONST(0.8034485579),
+    COEF_CONST(0.7919735909), COEF_CONST(0.7794287801),
+    COEF_CONST(0.7658674717), COEF_CONST(0.7513137460),
+    COEF_CONST(0.7358211875), COEF_CONST(0.7194462419),
+    COEF_CONST(0.7022388577), COEF_CONST(0.6842353344),
+    COEF_CONST(0.6655139923), COEF_CONST(0.6461269855),
+    COEF_CONST(0.6261242628), COEF_CONST(0.6055783629),
+    COEF_CONST(0.5845403075), COEF_CONST(0.5630789399),
+    COEF_CONST(0.5412553549), COEF_CONST(0.5191234946),
+    COEF_CONST(0.4967708290), COEF_CONST(0.4742453098),
+    COEF_CONST(0.4515996575), COEF_CONST(0.4289119840),
+    COEF_CONST(0.4062317610), COEF_CONST(0.3836350143),
+    COEF_CONST(-0.3611589968), COEF_CONST(-0.3388722837),
+    COEF_CONST(-0.3168278933), COEF_CONST(-0.2950716615),
+    COEF_CONST(-0.2736634016), COEF_CONST(-0.2526480258),
+    COEF_CONST(-0.2320690900), COEF_CONST(-0.2119735926),
+    COEF_CONST(-0.1923966706), COEF_CONST(-0.1733808219),
+    COEF_CONST(-0.1549607068), COEF_CONST(-0.1371551752),
+    COEF_CONST(-0.1200077981), COEF_CONST(-0.1035329551),
+    COEF_CONST(-0.0877547562), COEF_CONST(-0.0726943314),
+    COEF_CONST(-0.0583705343), COEF_CONST(-0.0447806828),
+    COEF_CONST(-0.0319531262), COEF_CONST(-0.0198834129),
+    COEF_CONST(-0.0085711749), COEF_CONST(0.0019765601),
+    COEF_CONST(0.0117623834), COEF_CONST(0.0207997076),
+    COEF_CONST(0.0290824007), COEF_CONST(0.0366418101),
+    COEF_CONST(0.0434768796), COEF_CONST(0.0495978668),
+    COEF_CONST(0.0550460033), COEF_CONST(0.0598166585),
+    COEF_CONST(0.0639444813), COEF_CONST(0.0674525052),
+    COEF_CONST(0.0703533068), COEF_CONST(0.0726774633),
+    COEF_CONST(0.0744664371), COEF_CONST(0.0757305771),
+    COEF_CONST(0.0765050724), COEF_CONST(0.0768230036),
+    COEF_CONST(0.0767093524), COEF_CONST(0.0761992484),
+    COEF_CONST(0.0753137320), COEF_CONST(0.0741003677),
+    COEF_CONST(0.0725682601), COEF_CONST(0.0707628727),
+    COEF_CONST(0.0687043816), COEF_CONST(0.0664367527),
+    COEF_CONST(0.0639715865), COEF_CONST(0.0613455176),
+    COEF_CONST(0.0585915670), COEF_CONST(0.0557173640),
+    COEF_CONST(0.0527630746), COEF_CONST(0.0497385748),
+    COEF_CONST(0.0466843024), COEF_CONST(0.0436097533),
+    COEF_CONST(0.0405349173), COEF_CONST(0.0374812856),
+    COEF_CONST(0.0344620943), COEF_CONST(0.0315017626),
+    COEF_CONST(0.0286072176), COEF_CONST(0.0257875845),
+    COEF_CONST(0.0230680164), COEF_CONST(0.0204531793),
+    COEF_CONST(0.0179433376), COEF_CONST(0.0155405551),
+    COEF_CONST(-0.0132718217), COEF_CONST(-0.0111315548),
+    COEF_CONST(-0.0091325333), COEF_CONST(-0.0072615817),
+    COEF_CONST(-0.0055337213), COEF_CONST(-0.0039401124),
+    COEF_CONST(-0.0024826722), COEF_CONST(-0.0011568135),
+    COEF_CONST(0.0000276045), COEF_CONST(0.0010902329),
+    COEF_CONST(0.0020274175), COEF_CONST(0.0028446757),
+    COEF_CONST(0.0035401245), COEF_CONST(0.0041251644),
+    COEF_CONST(0.0046039531), COEF_CONST(0.0049839686),
+    COEF_CONST(0.0052715759), COEF_CONST(0.0054753781),
+    COEF_CONST(0.0055917129), COEF_CONST(0.0056389198),
+    COEF_CONST(0.0056220642), COEF_CONST(0.0055475715),
+    COEF_CONST(0.0054196776), COEF_CONST(0.0052461168),
+    COEF_CONST(0.0050393022), COEF_CONST(0.0047932561),
+    COEF_CONST(0.0045209853), COEF_CONST(0.0042264271),
+    COEF_CONST(0.0039207432), COEF_CONST(0.0036008267),
+    COEF_CONST(0.0032739614), COEF_CONST(0.0029469447),
+    COEF_CONST(0.0026201757), COEF_CONST(0.0023017253),
+    COEF_CONST(0.0019841141), COEF_CONST(0.0016868083),
+    COEF_CONST(0.0013902494), COEF_CONST(0.0011250156),
+    COEF_CONST(0.0008608443), COEF_CONST(0.0006239376),
+    COEF_CONST(0.0004026540), COEF_CONST(0.0002043017),
+    COEF_CONST(0.0000134949), COEF_CONST(-0.0001446380),
+    COEF_CONST(-0.0002896981), COEF_CONST(-0.0004095121),
+    COEF_CONST(-0.0005145572), COEF_CONST(-0.0005946118),
+    COEF_CONST(-0.0006650415), COEF_CONST(-0.0007215391),
+    COEF_CONST(-0.0007530001), COEF_CONST(-0.0007757977),
+    COEF_CONST(-0.0007803664), COEF_CONST(-0.0007834332),
+    COEF_CONST(-0.0007681371), COEF_CONST(-0.0007440941),
+    COEF_CONST(-0.0007157736), COEF_CONST(-0.0006777690),
+    COEF_CONST(-0.0006312493), COEF_CONST(-0.0005870930),
+    COEF_CONST(-0.0005466565), COEF_CONST(-0.0005040714),
+    COEF_CONST(-0.0004875227), COEF_CONST(-0.0005617692)
+};
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/sbr_syntax.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,817 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** 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.7 2003/07/29 08:20:13 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SBR_DEC
+
+#include "sbr_syntax.h"
+#include "syntax.h"
+#include "sbr_huff.h"
+#include "sbr_fbt.h"
+#include "sbr_tf_grid.h"
+#include "sbr_e_nf.h"
+#include "bits.h"
+#include "analysis.h"
+
+static void sbr_reset(sbr_info *sbr)
+{
+    /* if these are different from the previous frame: Reset = 1 */
+    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))
+    {
+        sbr->Reset = 1;
+    } else {
+        sbr->Reset = 0;
+    }
+
+    sbr->bs_start_freq_prev = sbr->bs_start_freq;
+    sbr->bs_stop_freq_prev = sbr->bs_stop_freq;
+    sbr->bs_freq_scale_prev = sbr->bs_freq_scale;
+    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)
+    {
+        sbr->Reset = 1;
+    }
+}
+
+/* table 2 */
+uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint8_t id_aac)
+{
+    uint8_t bs_extension_type = (uint8_t)faad_getbits(ld, 4
+        DEBUGVAR(1,198,"sbr_bitstream(): bs_extension_type"));
+
+    if (bs_extension_type == EXT_SBR_DATA_CRC)
+    {
+        sbr->bs_sbr_crc_bits = (uint16_t)faad_getbits(ld, 10
+            DEBUGVAR(1,199,"sbr_bitstream(): bs_sbr_crc_bits"));
+    }
+
+    sbr->bs_header_flag = faad_get1bit(ld
+        DEBUGVAR(1,200,"sbr_bitstream(): bs_header_flag"));
+    if (sbr->bs_header_flag)
+        sbr_header(ld, sbr, id_aac);
+
+    /* TODO: Reset? */
+    sbr_reset(sbr);
+
+    /* first frame should have a header */
+    if (sbr->frame == 0 && sbr->bs_header_flag == 0)
+        return 1;
+
+
+    if (sbr->Reset || (sbr->bs_header_flag && sbr->just_seeked))
+    {
+        uint16_t k2;
+
+        /* 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 ((k2 - sbr->k0) > 32)
+                return 1;
+        } else if (sbr->sample_rate <= 32000) {
+            if ((k2 - sbr->k0) > 48)
+                return 1;
+        } else { /* (sbr->sample_rate == 44100) */
+            if ((k2 - sbr->k0) > 45)
+                return 1;
+        }
+
+        if (sbr->bs_freq_scale == 0)
+        {
+            master_frequency_table_fs0(sbr, sbr->k0, k2, sbr->bs_alter_scale);
+        } else {
+            master_frequency_table(sbr, sbr->k0, k2, sbr->bs_freq_scale,
+                sbr->bs_alter_scale);
+        }
+        derived_frequency_table(sbr, sbr->bs_xover_band, k2);
+    }
+
+    sbr_data(ld, sbr, id_aac);
+
+    /* no error */
+    return 0;
+}
+
+/* table 3 */
+static void sbr_header(bitfile *ld, sbr_info *sbr, uint8_t id_aac)
+{
+    uint8_t bs_header_extra_1, bs_header_extra_2;
+
+    sbr->header_count++;
+
+    sbr->bs_amp_res = faad_get1bit(ld
+        DEBUGVAR(1,203,"sbr_header(): bs_amp_res"));
+
+    /* bs_start_freq and bs_stop_freq must define a fequency band that does
+       not exceed 48 channels */
+    sbr->bs_start_freq = faad_getbits(ld, 4
+        DEBUGVAR(1,204,"sbr_header(): bs_start_freq"));
+    sbr->bs_stop_freq = faad_getbits(ld, 4
+        DEBUGVAR(1,205,"sbr_header(): bs_stop_freq"));
+    sbr->bs_xover_band = faad_getbits(ld, 3
+        DEBUGVAR(1,206,"sbr_header(): bs_xover_band"));
+    faad_getbits(ld, 2
+        DEBUGVAR(1,207,"sbr_header(): bs_reserved_bits_hdr"));
+    bs_header_extra_1 = faad_get1bit(ld
+        DEBUGVAR(1,208,"sbr_header(): bs_header_extra_1"));
+    bs_header_extra_2 = faad_get1bit(ld
+        DEBUGVAR(1,209,"sbr_header(): bs_header_extra_2"));
+
+    if (bs_header_extra_1)
+    {
+        sbr->bs_freq_scale = faad_getbits(ld, 2
+            DEBUGVAR(1,211,"sbr_header(): bs_freq_scale"));
+        sbr->bs_alter_scale = faad_get1bit(ld
+            DEBUGVAR(1,212,"sbr_header(): bs_alter_scale"));
+        sbr->bs_noise_bands = faad_getbits(ld, 2
+            DEBUGVAR(1,213,"sbr_header(): bs_noise_bands"));
+    }
+    if (bs_header_extra_2)
+    {
+        sbr->bs_limiter_bands = faad_getbits(ld, 2
+            DEBUGVAR(1,214,"sbr_header(): bs_limiter_bands"));
+        sbr->bs_limiter_gains = faad_getbits(ld, 2
+            DEBUGVAR(1,215,"sbr_header(): bs_limiter_gains"));
+        sbr->bs_interpol_freq = faad_get1bit(ld
+            DEBUGVAR(1,216,"sbr_header(): bs_interpol_freq"));
+        sbr->bs_smoothing_mode = faad_get1bit(ld
+            DEBUGVAR(1,217,"sbr_header(): bs_smoothing_mode"));
+    }
+
+#if 0
+    /* print the header to screen */
+    printf("bs_amp_res: %d\n", sbr->bs_amp_res);
+    printf("bs_start_freq: %d\n", sbr->bs_start_freq);
+    printf("bs_stop_freq: %d\n", sbr->bs_stop_freq);
+    printf("bs_xover_band: %d\n", sbr->bs_xover_band);
+    if (bs_header_extra_1)
+    {
+        printf("bs_freq_scale: %d\n", sbr->bs_freq_scale);
+        printf("bs_alter_scale: %d\n", sbr->bs_alter_scale);
+        printf("bs_noise_bands: %d\n", sbr->bs_noise_bands);
+    }
+    if (bs_header_extra_2)
+    {
+        printf("bs_limiter_bands: %d\n", sbr->bs_limiter_bands);
+        printf("bs_limiter_gains: %d\n", sbr->bs_limiter_gains);
+        printf("bs_interpol_freq: %d\n", sbr->bs_interpol_freq);
+        printf("bs_smoothing_mode: %d\n", sbr->bs_smoothing_mode);
+    }
+    printf("\n");
+#endif
+}
+
+/* table 4 */
+static void sbr_data(bitfile *ld, sbr_info *sbr, uint8_t id_aac)
+{
+#if 0
+    sbr->bs_samplerate_mode = faad_get1bit(ld
+        DEBUGVAR(1,219,"sbr_data(): bs_samplerate_mode"));
+#endif
+
+    sbr->rate = (sbr->bs_samplerate_mode) ? 2 : 1;
+
+    switch (id_aac)
+    {
+    case ID_SCE:
+        sbr_single_channel_element(ld, sbr);
+        break;
+    case ID_CPE:
+        sbr_channel_pair_element(ld, sbr);
+        break;
+    }
+}
+
+/* table 5 */
+static void sbr_single_channel_element(bitfile *ld, sbr_info *sbr)
+{
+    if (faad_get1bit(ld
+        DEBUGVAR(1,220,"sbr_single_channel_element(): bs_data_extra")))
+    {
+        faad_getbits(ld, 4
+            DEBUGVAR(1,221,"sbr_single_channel_element(): bs_reserved_bits_data"));
+    }
+
+    sbr_grid(ld, sbr, 0);
+    sbr_dtdf(ld, sbr, 0);
+    invf_mode(ld, sbr, 0);
+    sbr_envelope(ld, sbr, 0);
+    sbr_noise(ld, sbr, 0);
+
+    envelope_noise_dequantisation(sbr, 0);
+
+#if 0
+// TEMP
+    if (sbr->frame == 21)
+    {
+        int l, k;
+
+        printf("\n");
+        for (l = 0; l < sbr->L_E[0]; l++)
+        {
+            for (k = 0; k < sbr->n[sbr->f[0][l]]; k++)
+            {
+                //printf("%f\n", sbr->E_orig[0][k][l]);
+                printf("%f\n", sbr->E_orig[0][k][l] * 1024.  / (float)(1 << REAL_BITS));
+            }
+        }
+    }
+// end TEMP
+#endif
+
+#if 0
+// TEMP
+    {
+        int l, k;
+
+        printf("\n");
+        for (l = 0; l < sbr->L_Q[0]; l++)
+        {
+            for (k = 0; k < sbr->N_Q; k++)
+            {
+                printf("%f\n", sbr->Q_orig[0][k][l]);
+            }
+        }
+    }
+// end TEMP
+#endif
+
+    memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t));
+
+    sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld
+        DEBUGVAR(1,223,"sbr_single_channel_element(): bs_add_harmonic_flag[0]"));
+    if (sbr->bs_add_harmonic_flag[0])
+        sinusoidal_coding(ld, sbr, 0);
+
+    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;
+        uint16_t cnt = faad_getbits(ld, 4
+            DEBUGVAR(1,225,"sbr_single_channel_element(): bs_extension_size"));
+        if (cnt == 15)
+        {
+            cnt += faad_getbits(ld, 8
+                DEBUGVAR(1,226,"sbr_single_channel_element(): bs_esc_count"));
+        }
+
+        nr_bits_left = 8 * cnt;
+        while (nr_bits_left > 7)
+        {
+            sbr->bs_extension_id = faad_getbits(ld, 2
+                DEBUGVAR(1,227,"sbr_single_channel_element(): bs_extension_id"));
+            nr_bits_left -= 2;
+            /* sbr_extension(ld, sbr, 0, nr_bits_left); */
+            sbr->bs_extension_data = faad_getbits(ld, 6
+                DEBUGVAR(1,279,"sbr_single_channel_element(): bs_extension_data"));
+        }
+    }
+}
+
+/* table 6 */
+static void sbr_channel_pair_element(bitfile *ld, sbr_info *sbr)
+{
+    uint8_t n;
+
+    if (faad_get1bit(ld
+        DEBUGVAR(1,228,"sbr_single_channel_element(): bs_data_extra")))
+    {
+        faad_getbits(ld, 4
+            DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_reserved_bits_data"));
+        faad_getbits(ld, 4
+            DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_reserved_bits_data"));
+    }
+
+    sbr->bs_coupling = faad_get1bit(ld
+        DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_coupling"));
+
+    if (sbr->bs_coupling)
+    {
+        sbr_grid(ld, sbr, 0);
+
+        /* need to copy some data from left to right */
+        sbr->bs_frame_class[1] = sbr->bs_frame_class[0];
+        sbr->L_E[1] = sbr->L_E[0];
+        sbr->L_Q[1] = sbr->L_Q[0];
+        sbr->bs_pointer[1] = sbr->bs_pointer[0];
+
+        for (n = 0; n <= sbr->L_E[0]; n++)
+        {
+            sbr->t_E[1][n] = sbr->t_E[0][n];
+            sbr->f[1][n] = sbr->f[0][n];
+        }
+        for (n = 0; n <= sbr->L_Q[0]; n++)
+            sbr->t_Q[1][n] = sbr->t_Q[0][n];
+
+        sbr_dtdf(ld, sbr, 0);
+        sbr_dtdf(ld, sbr, 1);
+        invf_mode(ld, sbr, 0);
+
+        /* more copying */
+        for (n = 0; n < sbr->N_Q; n++)
+            sbr->bs_invf_mode[1][n] = sbr->bs_invf_mode[0][n];
+
+        sbr_envelope(ld, sbr, 0);
+        sbr_noise(ld, sbr, 0);
+        sbr_envelope(ld, sbr, 1);
+        sbr_noise(ld, sbr, 1);
+
+        memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t));
+        memset(sbr->bs_add_harmonic[1], 0, 64*sizeof(uint8_t));
+
+        sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld
+            DEBUGVAR(1,231,"sbr_channel_pair_element(): bs_add_harmonic_flag[0]"));
+        if (sbr->bs_add_harmonic_flag[0])
+            sinusoidal_coding(ld, sbr, 0);
+
+        sbr->bs_add_harmonic_flag[1] = faad_get1bit(ld
+            DEBUGVAR(1,232,"sbr_channel_pair_element(): bs_add_harmonic_flag[1]"));
+        if (sbr->bs_add_harmonic_flag[1])
+            sinusoidal_coding(ld, sbr, 1);
+    } else {
+        sbr_grid(ld, sbr, 0);
+        sbr_grid(ld, sbr, 1);
+        sbr_dtdf(ld, sbr, 0);
+        sbr_dtdf(ld, sbr, 1);
+        invf_mode(ld, sbr, 0);
+        invf_mode(ld, sbr, 1);
+        sbr_envelope(ld, sbr, 0);
+        sbr_envelope(ld, sbr, 1);
+        sbr_noise(ld, sbr, 0);
+        sbr_noise(ld, sbr, 1);
+
+        memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t));
+        memset(sbr->bs_add_harmonic[1], 0, 64*sizeof(uint8_t));
+
+        sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld
+            DEBUGVAR(1,239,"sbr_channel_pair_element(): bs_add_harmonic_flag[0]"));
+        if (sbr->bs_add_harmonic_flag[0])
+            sinusoidal_coding(ld, sbr, 0);
+
+        sbr->bs_add_harmonic_flag[1] = faad_get1bit(ld
+            DEBUGVAR(1,240,"sbr_channel_pair_element(): bs_add_harmonic_flag[1]"));
+        if (sbr->bs_add_harmonic_flag[1])
+            sinusoidal_coding(ld, sbr, 1);
+    }
+    envelope_noise_dequantisation(sbr, 0);
+    envelope_noise_dequantisation(sbr, 1);
+
+#if 0
+// TEMP
+    if (sbr->frame == 21)
+    {
+        int l, k;
+
+        printf("\n");
+        for (l = 0; l < sbr->L_E[0]; l++)
+        {
+            for (k = 0; k < sbr->n[sbr->f[0][l]]; k++)
+            {
+                printf("%f\n", sbr->E_orig[0][k][l]);
+                //printf("%f\n", sbr->E_orig[0][k][l] * 1024.  / (float)(1 << REAL_BITS));
+            }
+        }
+    }
+// end TEMP
+#endif
+
+    if (sbr->bs_coupling)
+        unmap_envelope_noise(sbr);
+
+#if 0
+// TEMP
+    if (sbr->bs_coupling)
+    {
+        int l, k;
+
+        printf("\n");
+        for (l = 0; l < sbr->L_Q[0]; l++)
+        {
+            for (k = 0; k < sbr->N_Q; k++)
+            {
+                printf("%f\n", sbr->Q_orig[0][k][l]);
+            }
+        }
+    }
+// end TEMP
+#endif
+
+    sbr->bs_extended_data = faad_get1bit(ld
+        DEBUGVAR(1,233,"sbr_channel_pair_element(): bs_extended_data[0]"));
+    if (sbr->bs_extended_data)
+    {
+        uint16_t nr_bits_left;
+        uint16_t cnt = faad_getbits(ld, 4
+            DEBUGVAR(1,234,"sbr_channel_pair_element(): bs_extension_size"));
+        if (cnt == 15)
+        {
+            cnt += faad_getbits(ld, 8
+                DEBUGVAR(1,235,"sbr_channel_pair_element(): bs_esc_count"));
+        }
+
+        nr_bits_left = 8 * cnt;
+        while (nr_bits_left > 7)
+        {
+            sbr->bs_extension_id = faad_getbits(ld, 2
+                DEBUGVAR(1,236,"sbr_channel_pair_element(): bs_extension_id"));
+            nr_bits_left -= 2;
+            /* sbr_extension(ld, sbr, 0, nr_bits_left); */
+            sbr->bs_extension_data = faad_getbits(ld, 6
+                DEBUGVAR(1,280,"sbr_single_channel_element(): bs_extension_data"));
+        }
+    }
+}
+
+/* table 7 */
+static void sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch)
+{
+    uint8_t i, env, rel;
+    uint8_t bs_abs_bord, bs_abs_bord_1;
+    uint16_t bs_num_env;
+
+    sbr->bs_frame_class[ch] = faad_getbits(ld, 2
+        DEBUGVAR(1,248,"sbr_grid(): bs_frame_class"));
+
+#if 0
+    if (sbr->bs_frame_class[ch] != FIXFIX)
+        printf("%d", sbr->bs_frame_class[ch]);
+#endif
+
+    switch (sbr->bs_frame_class[ch])
+    {
+    case FIXFIX:
+        i = faad_getbits(ld, 2
+            DEBUGVAR(1,249,"sbr_grid(): bs_num_env_raw"));
+
+        bs_num_env = min(1 << i, 5);
+
+        i = faad_get1bit(ld
+            DEBUGVAR(1,250,"sbr_grid(): bs_freq_res_flag"));
+        for (env = 0; env < bs_num_env; env++)
+            sbr->f[ch][env] = i;
+
+        sbr->abs_bord_lead[ch] = 0;
+        sbr->abs_bord_trail[ch] = NO_TIME_SLOTS;
+        sbr->n_rel_lead[ch] = bs_num_env - 1;
+        sbr->n_rel_trail[ch] = 0;
+        break;
+
+    case FIXVAR:
+        bs_abs_bord = faad_getbits(ld, 2
+            DEBUGVAR(1,251,"sbr_grid(): bs_abs_bord")) + NO_TIME_SLOTS;
+        bs_num_env = faad_getbits(ld, 2
+            DEBUGVAR(1,252,"sbr_grid(): bs_num_env")) + 1;
+
+        for (rel = 0; rel < bs_num_env-1; rel++)
+        {
+            sbr->bs_rel_bord[ch][rel] = 2 * faad_getbits(ld, 2
+                DEBUGVAR(1,253,"sbr_grid(): bs_rel_bord")) + 2;
+        }
+        i = int_log2((int32_t)(bs_num_env + 1));
+        sbr->bs_pointer[ch] = faad_getbits(ld, i
+            DEBUGVAR(1,254,"sbr_grid(): bs_pointer"));
+
+        for (env = 0; env < bs_num_env; env++)
+        {
+            sbr->f[ch][bs_num_env - env - 1] = faad_get1bit(ld
+                DEBUGVAR(1,255,"sbr_grid(): bs_freq_res"));
+        }
+
+        sbr->abs_bord_lead[ch] = 0;
+        sbr->abs_bord_trail[ch] = bs_abs_bord;
+        sbr->n_rel_lead[ch] = 0;
+        sbr->n_rel_trail[ch] = bs_num_env - 1;
+        break;
+
+    case VARFIX:
+        bs_abs_bord = faad_getbits(ld, 2
+            DEBUGVAR(1,256,"sbr_grid(): bs_abs_bord"));
+        bs_num_env = faad_getbits(ld, 2
+            DEBUGVAR(1,257,"sbr_grid(): bs_num_env")) + 1;
+
+        for (rel = 0; rel < bs_num_env-1; rel++)
+        {
+            sbr->bs_rel_bord[ch][rel] = 2 * faad_getbits(ld, 2
+                DEBUGVAR(1,258,"sbr_grid(): bs_rel_bord")) + 2;
+        }
+        i = int_log2((int32_t)(bs_num_env + 1));
+        sbr->bs_pointer[ch] = faad_getbits(ld, i
+            DEBUGVAR(1,259,"sbr_grid(): bs_pointer"));
+
+        for (env = 0; env < bs_num_env; env++)
+        {
+            sbr->f[ch][env] = faad_get1bit(ld
+                DEBUGVAR(1,260,"sbr_grid(): bs_freq_res"));
+        }
+
+        sbr->abs_bord_lead[ch] = bs_abs_bord;
+        sbr->abs_bord_trail[ch] = NO_TIME_SLOTS;
+        sbr->n_rel_lead[ch] = bs_num_env - 1;
+        sbr->n_rel_trail[ch] = 0;
+        break;
+
+    case VARVAR:
+        bs_abs_bord = faad_getbits(ld, 2
+            DEBUGVAR(1,261,"sbr_grid(): bs_abs_bord_0"));
+        bs_abs_bord_1 = faad_getbits(ld, 2
+            DEBUGVAR(1,262,"sbr_grid(): bs_abs_bord_1")) + NO_TIME_SLOTS;
+        sbr->bs_num_rel_0[ch] = faad_getbits(ld, 2
+            DEBUGVAR(1,263,"sbr_grid(): bs_num_rel_0"));
+        sbr->bs_num_rel_1[ch] = faad_getbits(ld, 2
+            DEBUGVAR(1,264,"sbr_grid(): bs_num_rel_1"));
+
+        bs_num_env = min(5, sbr->bs_num_rel_0[ch] + sbr->bs_num_rel_1[ch] + 1);
+
+        for (rel = 0; rel < sbr->bs_num_rel_0[ch]; rel++)
+        {
+            sbr->bs_rel_bord_0[ch][rel] = 2 * faad_getbits(ld, 2
+                DEBUGVAR(1,265,"sbr_grid(): bs_rel_bord")) + 2;
+        }
+        for(rel = 0; rel < sbr->bs_num_rel_1[ch]; rel++)
+        {
+            sbr->bs_rel_bord_1[ch][rel] = 2 * faad_getbits(ld, 2
+                DEBUGVAR(1,266,"sbr_grid(): bs_rel_bord")) + 2;
+        }
+        i = int_log2((int32_t)(sbr->bs_num_rel_0[ch] + sbr->bs_num_rel_1[ch] + 2));
+        sbr->bs_pointer[ch] = faad_getbits(ld, i
+            DEBUGVAR(1,267,"sbr_grid(): bs_pointer"));
+
+        for (env = 0; env < bs_num_env; env++)
+        {
+            sbr->f[ch][env] = faad_get1bit(ld
+                DEBUGVAR(1,268,"sbr_grid(): bs_freq_res"));
+        }
+
+        sbr->abs_bord_lead[ch] = bs_abs_bord;
+        sbr->abs_bord_trail[ch] = bs_abs_bord_1;
+        sbr->n_rel_lead[ch] = sbr->bs_num_rel_0[ch];
+        sbr->n_rel_trail[ch] = sbr->bs_num_rel_1[ch];
+        break;
+    }
+
+    if (sbr->bs_frame_class[ch] == VARVAR)
+        sbr->L_E[ch] = min(bs_num_env, 5);
+    else
+        sbr->L_E[ch] = min(bs_num_env, 4);
+
+    if (sbr->L_E[ch] > 1)
+        sbr->L_Q[ch] = 2;
+    else
+        sbr->L_Q[ch] = 1;
+
+    /* TODO: this code can probably be integrated into the code above! */
+    envelope_time_border_vector(sbr, ch);
+    noise_floor_time_border_vector(sbr, ch);
+}
+
+/* table 8 */
+static void sbr_dtdf(bitfile *ld, sbr_info *sbr, uint8_t ch)
+{
+    uint8_t i;
+
+    for (i = 0; i < sbr->L_E[ch]; i++)
+    {
+        sbr->bs_df_env[ch][i] = faad_get1bit(ld
+            DEBUGVAR(1,269,"sbr_dtdf(): bs_df_env"));
+    }
+
+    for (i = 0; i < sbr->L_Q[ch]; i++)
+    {
+        sbr->bs_df_noise[ch][i] = faad_get1bit(ld
+            DEBUGVAR(1,270,"sbr_dtdf(): bs_df_noise"));
+    }
+}
+
+/* table 9 */
+static void invf_mode(bitfile *ld, sbr_info *sbr, uint8_t ch)
+{
+    uint8_t n;
+
+    for (n = 0; n < sbr->N_Q; n++)
+    {
+        sbr->bs_invf_mode[ch][n] = faad_getbits(ld, 2
+            DEBUGVAR(1,271,"invf_mode(): bs_invf_mode"));
+    }
+}
+
+/* table 10 */
+static void sbr_envelope(bitfile *ld, sbr_info *sbr, uint8_t ch)
+{
+    uint8_t env, band;
+    int8_t delta = 0;
+    sbr_huff_tab t_huff, f_huff;
+
+    if ((sbr->L_E[ch] == 1) && (sbr->bs_frame_class[ch] == FIXFIX))
+        sbr->amp_res[ch] = 0;
+    else
+        sbr->amp_res[ch] = sbr->bs_amp_res;
+
+    if ((sbr->bs_coupling) && (ch == 1))
+    {
+        delta = 1;
+        if (sbr->amp_res[ch])
+        {
+            t_huff = t_huffman_env_bal_3_0dB;
+            f_huff = f_huffman_env_bal_3_0dB;
+        } else {
+            t_huff = t_huffman_env_bal_1_5dB;
+            f_huff = f_huffman_env_bal_1_5dB;
+        }
+    } else {
+        delta = 0;
+        if (sbr->amp_res[ch])
+        {
+            t_huff = t_huffman_env_3_0dB;
+            f_huff = f_huffman_env_3_0dB;
+        } else {
+            t_huff = t_huffman_env_1_5dB;
+            f_huff = f_huffman_env_1_5dB;
+        }
+    }
+
+    for (env = 0; env < sbr->L_E[ch]; env++)
+    {
+        if (sbr->bs_df_env[ch][env] == 0)
+        {
+            if ((sbr->bs_coupling == 1) && (ch == 1))
+            {
+                if (sbr->amp_res[ch])
+                {
+                    sbr->E[ch][0][env] = (faad_getbits(ld, 5
+                        DEBUGVAR(1,272,"sbr_envelope(): bs_data_env")) << delta);
+                } else {
+                    sbr->E[ch][0][env] = (faad_getbits(ld, 6
+                        DEBUGVAR(1,273,"sbr_envelope(): bs_data_env")) << delta);
+                }
+            } else {
+                if (sbr->amp_res[ch])
+                {
+                    sbr->E[ch][0][env] = (faad_getbits(ld, 6
+                        DEBUGVAR(1,274,"sbr_envelope(): bs_data_env")) << delta);
+                } else {
+                    sbr->E[ch][0][env] = (faad_getbits(ld, 7
+                        DEBUGVAR(1,275,"sbr_envelope(): bs_data_env")) << delta);
+                }
+            }
+
+            for (band = 1; band < sbr->n[sbr->f[ch][env]]; band++)
+            {
+                sbr->E[ch][band][env] = (sbr_huff_dec(ld, f_huff) << delta);
+            }
+
+        } else {
+            for (band = 0; band < sbr->n[sbr->f[ch][env]]; band++)
+            {
+                sbr->E[ch][band][env] = (sbr_huff_dec(ld, t_huff) << delta);
+            }
+        }
+    }
+
+#if 0
+// TEMP
+    if (sbr->frame == 19)
+    {
+        int l, k;
+
+        printf("\n");
+        for (l = 0; l < sbr->L_E[ch]; l++)
+        {
+            for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
+            {
+                printf("l:%d k:%d E:%d\n",l, k, sbr->E[ch][k][l]);
+            }
+        }
+    }
+// end TEMP
+#endif
+
+    extract_envelope_data(sbr, ch);
+
+#if 0
+// TEMP
+    if (sbr->frame == 21)
+    {
+        int l, k;
+
+        printf("\n");
+        for (l = 0; l < sbr->L_E[ch]; l++)
+        {
+            for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
+            {
+                //printf("l:%d k:%d E:%d\n",l,k, sbr->E[ch][k][l]);
+                printf("%d\n", sbr->E[ch][k][l]);
+            }
+        }
+    }
+// end TEMP
+#endif
+}
+
+/* table 11 */
+static void sbr_noise(bitfile *ld, sbr_info *sbr, uint8_t ch)
+{
+    uint8_t noise, band;
+    int8_t delta = 0;
+    sbr_huff_tab t_huff, f_huff;
+
+    if ((sbr->bs_coupling == 1) && (ch == 1))
+    {
+        delta = 1;
+        t_huff = t_huffman_noise_bal_3_0dB;
+        f_huff = f_huffman_env_bal_3_0dB;
+    } else {
+        delta = 0;
+        t_huff = t_huffman_noise_3_0dB;
+        f_huff = f_huffman_env_3_0dB;
+    }
+
+    for (noise = 0; noise < sbr->L_Q[ch]; noise++)
+    {
+        if(sbr->bs_df_noise[ch][noise] == 0)
+        {
+            if ((sbr->bs_coupling == 1) && (ch == 1))
+            {
+                sbr->Q[ch][0][noise] = (faad_getbits(ld, 5
+                    DEBUGVAR(1,276,"sbr_noise(): bs_data_noise")) << delta);
+            } else {
+                sbr->Q[ch][0][noise] = (faad_getbits(ld, 5
+                    DEBUGVAR(1,277,"sbr_noise(): bs_data_noise")) << delta);
+            }
+            for (band = 1; band < sbr->N_Q; band++)
+            {
+                sbr->Q[ch][band][noise] = (sbr_huff_dec(ld, f_huff) << delta);
+            }
+        } else {
+            for (band = 0; band < sbr->N_Q; band++)
+            {
+                sbr->Q[ch][band][noise] = (sbr_huff_dec(ld, t_huff) << delta);
+            }
+        }
+    }
+
+    extract_noise_floor_data(sbr, ch);
+}
+
+/* table 12 */
+static void sinusoidal_coding(bitfile *ld, sbr_info *sbr, uint8_t ch)
+{
+    uint8_t n;
+
+    for (n = 0; n < sbr->N_high; n++)
+    {
+        sbr->bs_add_harmonic[ch][n] = faad_get1bit(ld
+            DEBUGVAR(1,278,"sinusoidal_coding(): bs_add_harmonic"));
+    }
+}
+
+
+#endif /* SBR_DEC */
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/sbr_syntax.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,71 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** 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.6 2003/07/29 08:20:13 menno Exp $
+**/
+
+#ifndef __SBR_SYNTAX_H__
+#define __SBR_SYNTAX_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "bits.h"
+
+#define tHFGen 8
+#define tHFAdj 2
+
+#define EXT_SBR_DATA     13
+#define EXT_SBR_DATA_CRC 14
+
+#define FIXFIX 0
+#define FIXVAR 1
+#define VARFIX 2
+#define VARVAR 3
+
+#define LO_RES 0
+#define HI_RES 1
+
+#define NO_TIME_SLOTS 16
+#define NOISE_FLOOR_OFFSET 6.0
+
+
+uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint8_t id_aac);
+static void sbr_header(bitfile *ld, sbr_info *sbr, uint8_t id_aac);
+static void sbr_data(bitfile *ld, sbr_info *sbr, uint8_t id_aac);
+static void sbr_single_channel_element(bitfile *ld, sbr_info *sbr);
+static void sbr_channel_pair_element(bitfile *ld, sbr_info *sbr);
+static void sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch);
+static void sbr_dtdf(bitfile *ld, sbr_info *sbr, uint8_t ch);
+static void invf_mode(bitfile *ld, sbr_info *sbr, uint8_t ch);
+static void sbr_envelope(bitfile *ld, sbr_info *sbr, uint8_t ch);
+static void sbr_noise(bitfile *ld, sbr_info *sbr, uint8_t ch);
+static void sinusoidal_coding(bitfile *ld, sbr_info *sbr, uint8_t ch);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __SBR_SYNTAX_H__ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/sbr_tf_grid.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,226 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_tf_grid.c,v 1.1 2003/07/29 08:20:13 menno Exp $
+**/
+
+/* Time/Frequency grid */
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SBR_DEC
+
+#include <stdlib.h>
+
+#include "sbr_syntax.h"
+#include "sbr_tf_grid.h"
+
+void envelope_time_border_vector(sbr_info *sbr, uint8_t ch)
+{
+    uint8_t l, border;
+
+    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];
+
+    switch (sbr->bs_frame_class[ch])
+    {
+    case FIXFIX:
+        switch (sbr->L_E[ch])
+        {
+        case 4:
+            sbr->t_E[ch][3] = sbr->rate * 12;
+            sbr->t_E[ch][2] = sbr->rate * 8;
+            sbr->t_E[ch][1] = sbr->rate * 4;
+            break;
+        case 2:
+            sbr->t_E[ch][1] = sbr->rate * 8;
+            break;
+        default:
+            break;
+        }
+        break;
+
+    case FIXVAR:
+        if (sbr->L_E[ch] > 1)
+        {
+            int8_t i = sbr->L_E[ch];
+            border = sbr->abs_bord_trail[ch];
+
+            for (l = 0; l < (sbr->L_E[ch] - 1); l++)
+            {
+                border -= sbr->bs_rel_bord[ch][l];
+                sbr->t_E[ch][--i] = sbr->rate * border;
+            }
+        }
+        break;
+
+    case VARFIX:
+        if (sbr->L_E[ch] > 1)
+        {
+            int8_t i = 1;
+            border = sbr->abs_bord_lead[ch];
+
+            for (l = 0; l < (sbr->L_E[ch] - 1); l++)
+            {
+                border += sbr->bs_rel_bord[ch][l];
+                sbr->t_E[ch][i++] = sbr->rate * border;
+            }
+        }
+        break;
+
+    case VARVAR:
+        if (sbr->bs_num_rel_0[ch])
+        {
+            int8_t i = 1;
+            border = sbr->abs_bord_lead[ch];
+
+            for (l = 0; l < sbr->bs_num_rel_0[ch]; l++)
+            {
+                border += sbr->bs_rel_bord_0[ch][l];
+                sbr->t_E[ch][i++] = sbr->rate * border;
+            }
+        }
+
+        if (sbr->bs_num_rel_1[ch])
+        {
+            int8_t i = sbr->L_E[ch];
+            border = sbr->abs_bord_trail[ch];
+
+            for (l = 0; l < sbr->bs_num_rel_1[ch]; l++)
+            {
+                border -= sbr->bs_rel_bord_1[ch][l];
+                sbr->t_E[ch][--i] = sbr->rate * border;
+            }
+        }
+        break;
+    }
+}
+
+void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch)
+{
+    sbr->t_Q[ch][0] = sbr->t_E[ch][0];
+
+    if (sbr->L_E[ch] == 1)
+    {
+        sbr->t_Q[ch][1] = sbr->t_E[ch][1];
+        sbr->t_Q[ch][2] = 0;
+    } else {
+        uint8_t index = middleBorder(sbr, ch);
+        sbr->t_Q[ch][1] = sbr->t_E[ch][index];
+        sbr->t_Q[ch][2] = sbr->t_E[ch][sbr->L_E[ch]];
+    }
+}
+
+static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l)
+{
+    uint8_t i;
+    int16_t acc = 0;
+
+    switch (sbr->bs_frame_class[ch])
+    {
+    case FIXFIX:
+        return NO_TIME_SLOTS/sbr->L_E[ch];
+    case FIXVAR:
+        return 0;
+    case VARFIX:
+        for (i = 0; i < l; i++)
+        {
+            acc += sbr->bs_rel_bord[ch][i];
+        }
+        return acc;
+    case VARVAR:
+        for (i = 0; i < l; i++)
+        {
+            acc += sbr->bs_rel_bord_0[ch][i];
+        }
+        return acc;
+    }
+
+    return 0;
+}
+
+static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l)
+{
+    uint8_t i;
+    int16_t acc = 0;
+
+    switch (sbr->bs_frame_class[ch])
+    {
+    case FIXFIX:
+    case VARFIX:
+        return 0;
+    case FIXVAR:
+        for (i = 0; i < l; i++)
+        {
+            acc += sbr->bs_rel_bord[ch][i];
+        }
+        return acc;
+    case VARVAR:
+        for (i = 0; i < l; i++)
+        {
+            acc += sbr->bs_rel_bord_1[ch][i];
+        }
+        return acc;
+    }
+
+    return 0;
+}
+
+static uint8_t middleBorder(sbr_info *sbr, uint8_t ch)
+{
+    int8_t retval;
+
+    switch (sbr->bs_frame_class[ch])
+    {
+    case FIXFIX:
+        retval = sbr->L_E[ch]/2;
+        break;
+    case VARFIX:
+        if (sbr->bs_pointer[ch] == 0)
+            retval = 1;
+        else if (sbr->bs_pointer[ch] == 1)
+            retval = sbr->L_E[ch] - 1;
+        else
+            retval = sbr->bs_pointer[ch] - 1;
+        break;
+    case FIXVAR:
+    case VARVAR:
+        if (sbr->bs_pointer[ch] > 1)
+            retval = sbr->L_E[ch] + 1 - sbr->bs_pointer[ch];
+        else
+            retval = sbr->L_E[ch] - 1;
+        break;
+    }
+
+    return (retval > 0) ? retval : 0;
+}
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/sbr_tf_grid.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,48 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_tf_grid.h,v 1.1 2003/07/29 08:20:13 menno Exp $
+**/
+
+#ifndef __SBR_TF_GRID_H__
+#define __SBR_TF_GRID_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+void envelope_time_border_vector(sbr_info *sbr, uint8_t ch);
+void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch);
+
+static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l);
+static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l);
+static uint8_t middleBorder(sbr_info *sbr, uint8_t ch);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/sine_win.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,8548 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sine_win.h,v 1.2 2003/07/29 08:20:13 menno Exp $
+**/
+
+#ifndef __SINE_WIN_H__
+#define __SINE_WIN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef FIXED_POINT
+
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+
+real_t sine_long_1024[] =
+{
+    0.0007669903,
+    0.0023009692,
+    0.0038349427,
+    0.0053689071,
+    0.0069028589,
+    0.0084367945,
+    0.0099707102,
+    0.0115046024,
+    0.0130384676,
+    0.0145723021,
+    0.0161061023,
+    0.0176398646,
+    0.0191735854,
+    0.0207072611,
+    0.0222408880,
+    0.0237744627,
+    0.0253079813,
+    0.0268414404,
+    0.0283748364,
+    0.0299081656,
+    0.0314414244,
+    0.0329746092,
+    0.0345077165,
+    0.0360407425,
+    0.0375736838,
+    0.0391065366,
+    0.0406392974,
+    0.0421719625,
+    0.0437045285,
+    0.0452369916,
+    0.0467693482,
+    0.0483015948,
+    0.0498337277,
+    0.0513657434,
+    0.0528976382,
+    0.0544294085,
+    0.0559610508,
+    0.0574925613,
+    0.0590239366,
+    0.0605551730,
+    0.0620862669,
+    0.0636172147,
+    0.0651480128,
+    0.0666786576,
+    0.0682091456,
+    0.0697394730,
+    0.0712696363,
+    0.0727996319,
+    0.0743294562,
+    0.0758591055,
+    0.0773885764,
+    0.0789178652,
+    0.0804469683,
+    0.0819758821,
+    0.0835046030,
+    0.0850331273,
+    0.0865614516,
+    0.0880895722,
+    0.0896174856,
+    0.0911451880,
+    0.0926726760,
+    0.0941999459,
+    0.0957269942,
+    0.0972538171,
+    0.0987804113,
+    0.1003067730,
+    0.1018328987,
+    0.1033587847,
+    0.1048844276,
+    0.1064098236,
+    0.1079349692,
+    0.1094598609,
+    0.1109844950,
+    0.1125088679,
+    0.1140329761,
+    0.1155568160,
+    0.1170803839,
+    0.1186036763,
+    0.1201266897,
+    0.1216494204,
+    0.1231718648,
+    0.1246940194,
+    0.1262158806,
+    0.1277374448,
+    0.1292587084,
+    0.1307796678,
+    0.1323003195,
+    0.1338206599,
+    0.1353406854,
+    0.1368603924,
+    0.1383797774,
+    0.1398988368,
+    0.1414175669,
+    0.1429359643,
+    0.1444540254,
+    0.1459717465,
+    0.1474891242,
+    0.1490061548,
+    0.1505228347,
+    0.1520391605,
+    0.1535551285,
+    0.1550707352,
+    0.1565859770,
+    0.1581008503,
+    0.1596153516,
+    0.1611294774,
+    0.1626432239,
+    0.1641565877,
+    0.1656695653,
+    0.1671821530,
+    0.1686943474,
+    0.1702061448,
+    0.1717175416,
+    0.1732285344,
+    0.1747391196,
+    0.1762492936,
+    0.1777590529,
+    0.1792683938,
+    0.1807773130,
+    0.1822858067,
+    0.1837938716,
+    0.1853015039,
+    0.1868087002,
+    0.1883154569,
+    0.1898217705,
+    0.1913276375,
+    0.1928330542,
+    0.1943380172,
+    0.1958425228,
+    0.1973465677,
+    0.1988501481,
+    0.2003532607,
+    0.2018559018,
+    0.2033580679,
+    0.2048597554,
+    0.2063609610,
+    0.2078616809,
+    0.2093619117,
+    0.2108616499,
+    0.2123608919,
+    0.2138596342,
+    0.2153578733,
+    0.2168556056,
+    0.2183528276,
+    0.2198495358,
+    0.2213457267,
+    0.2228413967,
+    0.2243365424,
+    0.2258311602,
+    0.2273252466,
+    0.2288187981,
+    0.2303118111,
+    0.2318042822,
+    0.2332962078,
+    0.2347875845,
+    0.2362784086,
+    0.2377686768,
+    0.2392583855,
+    0.2407475313,
+    0.2422361105,
+    0.2437241197,
+    0.2452115554,
+    0.2466984140,
+    0.2481846922,
+    0.2496703864,
+    0.2511554931,
+    0.2526400088,
+    0.2541239300,
+    0.2556072532,
+    0.2570899749,
+    0.2585720917,
+    0.2600536001,
+    0.2615344965,
+    0.2630147775,
+    0.2644944396,
+    0.2659734793,
+    0.2674518932,
+    0.2689296777,
+    0.2704068294,
+    0.2718833448,
+    0.2733592205,
+    0.2748344529,
+    0.2763090386,
+    0.2777829741,
+    0.2792562559,
+    0.2807288807,
+    0.2822008448,
+    0.2836721449,
+    0.2851427776,
+    0.2866127392,
+    0.2880820264,
+    0.2895506357,
+    0.2910185637,
+    0.2924858069,
+    0.2939523618,
+    0.2954182251,
+    0.2968833932,
+    0.2983478627,
+    0.2998116301,
+    0.3012746921,
+    0.3027370451,
+    0.3041986858,
+    0.3056596107,
+    0.3071198163,
+    0.3085792992,
+    0.3100380561,
+    0.3114960833,
+    0.3129533776,
+    0.3144099355,
+    0.3158657535,
+    0.3173208283,
+    0.3187751564,
+    0.3202287344,
+    0.3216815589,
+    0.3231336264,
+    0.3245849335,
+    0.3260354769,
+    0.3274852530,
+    0.3289342586,
+    0.3303824902,
+    0.3318299443,
+    0.3332766176,
+    0.3347225067,
+    0.3361676081,
+    0.3376119185,
+    0.3390554345,
+    0.3404981526,
+    0.3419400695,
+    0.3433811818,
+    0.3448214861,
+    0.3462609790,
+    0.3476996571,
+    0.3491375170,
+    0.3505745554,
+    0.3520107688,
+    0.3534461540,
+    0.3548807074,
+    0.3563144257,
+    0.3577473057,
+    0.3591793438,
+    0.3606105367,
+    0.3620408811,
+    0.3634703735,
+    0.3648990107,
+    0.3663267892,
+    0.3677537058,
+    0.3691797569,
+    0.3706049394,
+    0.3720292498,
+    0.3734526847,
+    0.3748752409,
+    0.3762969150,
+    0.3777177036,
+    0.3791376034,
+    0.3805566111,
+    0.3819747232,
+    0.3833919366,
+    0.3848082478,
+    0.3862236535,
+    0.3876381503,
+    0.3890517351,
+    0.3904644043,
+    0.3918761548,
+    0.3932869831,
+    0.3946968860,
+    0.3961058601,
+    0.3975139021,
+    0.3989210088,
+    0.4003271768,
+    0.4017324027,
+    0.4031366834,
+    0.4045400154,
+    0.4059423955,
+    0.4073438203,
+    0.4087442867,
+    0.4101437912,
+    0.4115423307,
+    0.4129399017,
+    0.4143365010,
+    0.4157321254,
+    0.4171267715,
+    0.4185204361,
+    0.4199131159,
+    0.4213048075,
+    0.4226955078,
+    0.4240852135,
+    0.4254739212,
+    0.4268616277,
+    0.4282483298,
+    0.4296340242,
+    0.4310187077,
+    0.4324023768,
+    0.4337850286,
+    0.4351666595,
+    0.4365472665,
+    0.4379268463,
+    0.4393053955,
+    0.4406829110,
+    0.4420593896,
+    0.4434348280,
+    0.4448092229,
+    0.4461825711,
+    0.4475548694,
+    0.4489261146,
+    0.4502963034,
+    0.4516654326,
+    0.4530334990,
+    0.4544004994,
+    0.4557664305,
+    0.4571312892,
+    0.4584950722,
+    0.4598577763,
+    0.4612193983,
+    0.4625799351,
+    0.4639393833,
+    0.4652977398,
+    0.4666550015,
+    0.4680111650,
+    0.4693662273,
+    0.4707201851,
+    0.4720730353,
+    0.4734247746,
+    0.4747754000,
+    0.4761249081,
+    0.4774732959,
+    0.4788205601,
+    0.4801666976,
+    0.4815117052,
+    0.4828555798,
+    0.4841983182,
+    0.4855399172,
+    0.4868803737,
+    0.4882196845,
+    0.4895578465,
+    0.4908948565,
+    0.4922307114,
+    0.4935654080,
+    0.4948989433,
+    0.4962313139,
+    0.4975625169,
+    0.4988925491,
+    0.5002214073,
+    0.5015490885,
+    0.5028755895,
+    0.5042009071,
+    0.5055250384,
+    0.5068479800,
+    0.5081697290,
+    0.5094902823,
+    0.5108096366,
+    0.5121277890,
+    0.5134447363,
+    0.5147604754,
+    0.5160750032,
+    0.5173883167,
+    0.5187004127,
+    0.5200112881,
+    0.5213209399,
+    0.5226293650,
+    0.5239365603,
+    0.5252425227,
+    0.5265472491,
+    0.5278507366,
+    0.5291529819,
+    0.5304539821,
+    0.5317537341,
+    0.5330522349,
+    0.5343494813,
+    0.5356454703,
+    0.5369401989,
+    0.5382336641,
+    0.5395258627,
+    0.5408167917,
+    0.5421064482,
+    0.5433948291,
+    0.5446819312,
+    0.5459677517,
+    0.5472522875,
+    0.5485355355,
+    0.5498174928,
+    0.5510981563,
+    0.5523775230,
+    0.5536555900,
+    0.5549323541,
+    0.5562078124,
+    0.5574819619,
+    0.5587547996,
+    0.5600263225,
+    0.5612965275,
+    0.5625654118,
+    0.5638329724,
+    0.5650992062,
+    0.5663641102,
+    0.5676276815,
+    0.5688899172,
+    0.5701508142,
+    0.5714103696,
+    0.5726685804,
+    0.5739254436,
+    0.5751809564,
+    0.5764351157,
+    0.5776879185,
+    0.5789393621,
+    0.5801894433,
+    0.5814381593,
+    0.5826855071,
+    0.5839314838,
+    0.5851760864,
+    0.5864193121,
+    0.5876611579,
+    0.5889016208,
+    0.5901406980,
+    0.5913783866,
+    0.5926146835,
+    0.5938495860,
+    0.5950830911,
+    0.5963151959,
+    0.5975458976,
+    0.5987751931,
+    0.6000030797,
+    0.6012295544,
+    0.6024546144,
+    0.6036782567,
+    0.6049004785,
+    0.6061212769,
+    0.6073406491,
+    0.6085585921,
+    0.6097751031,
+    0.6109901793,
+    0.6122038177,
+    0.6134160156,
+    0.6146267701,
+    0.6158360782,
+    0.6170439373,
+    0.6182503444,
+    0.6194552967,
+    0.6206587913,
+    0.6218608255,
+    0.6230613964,
+    0.6242605011,
+    0.6254581369,
+    0.6266543010,
+    0.6278489904,
+    0.6290422025,
+    0.6302339344,
+    0.6314241833,
+    0.6326129463,
+    0.6338002208,
+    0.6349860039,
+    0.6361702928,
+    0.6373530847,
+    0.6385343769,
+    0.6397141665,
+    0.6408924509,
+    0.6420692271,
+    0.6432444925,
+    0.6444182443,
+    0.6455904797,
+    0.6467611960,
+    0.6479303904,
+    0.6490980601,
+    0.6502642024,
+    0.6514288146,
+    0.6525918940,
+    0.6537534377,
+    0.6549134431,
+    0.6560719074,
+    0.6572288279,
+    0.6583842018,
+    0.6595380266,
+    0.6606902994,
+    0.6618410175,
+    0.6629901782,
+    0.6641377789,
+    0.6652838167,
+    0.6664282891,
+    0.6675711934,
+    0.6687125267,
+    0.6698522866,
+    0.6709904702,
+    0.6721270748,
+    0.6732620980,
+    0.6743955368,
+    0.6755273888,
+    0.6766576511,
+    0.6777863212,
+    0.6789133965,
+    0.6800388741,
+    0.6811627516,
+    0.6822850262,
+    0.6834056954,
+    0.6845247564,
+    0.6856422067,
+    0.6867580436,
+    0.6878722645,
+    0.6889848667,
+    0.6900958478,
+    0.6912052049,
+    0.6923129356,
+    0.6934190372,
+    0.6945235071,
+    0.6956263427,
+    0.6967275415,
+    0.6978271008,
+    0.6989250180,
+    0.7000212906,
+    0.7011159160,
+    0.7022088916,
+    0.7033002148,
+    0.7043898831,
+    0.7054778939,
+    0.7065642446,
+    0.7076489327,
+    0.7087319557,
+    0.7098133109,
+    0.7108929959,
+    0.7119710081,
+    0.7130473449,
+    0.7141220039,
+    0.7151949824,
+    0.7162662781,
+    0.7173358883,
+    0.7184038105,
+    0.7194700423,
+    0.7205345811,
+    0.7215974244,
+    0.7226585697,
+    0.7237180145,
+    0.7247757564,
+    0.7258317928,
+    0.7268861212,
+    0.7279387392,
+    0.7289896443,
+    0.7300388340,
+    0.7310863058,
+    0.7321320574,
+    0.7331760861,
+    0.7342183896,
+    0.7352589655,
+    0.7362978112,
+    0.7373349243,
+    0.7383703024,
+    0.7394039430,
+    0.7404358438,
+    0.7414660022,
+    0.7424944159,
+    0.7435210825,
+    0.7445459994,
+    0.7455691644,
+    0.7465905750,
+    0.7476102287,
+    0.7486281233,
+    0.7496442563,
+    0.7506586253,
+    0.7516712279,
+    0.7526820618,
+    0.7536911245,
+    0.7546984137,
+    0.7557039270,
+    0.7567076622,
+    0.7577096166,
+    0.7587097882,
+    0.7597081744,
+    0.7607047729,
+    0.7616995815,
+    0.7626925976,
+    0.7636838191,
+    0.7646732436,
+    0.7656608687,
+    0.7666466922,
+    0.7676307116,
+    0.7686129248,
+    0.7695933293,
+    0.7705719229,
+    0.7715487032,
+    0.7725236681,
+    0.7734968151,
+    0.7744681420,
+    0.7754376465,
+    0.7764053263,
+    0.7773711792,
+    0.7783352028,
+    0.7792973950,
+    0.7802577533,
+    0.7812162757,
+    0.7821729598,
+    0.7831278033,
+    0.7840808041,
+    0.7850319598,
+    0.7859812683,
+    0.7869287273,
+    0.7878743346,
+    0.7888180880,
+    0.7897599851,
+    0.7907000239,
+    0.7916382021,
+    0.7925745175,
+    0.7935089679,
+    0.7944415511,
+    0.7953722649,
+    0.7963011071,
+    0.7972280756,
+    0.7981531680,
+    0.7990763824,
+    0.7999977164,
+    0.8009171680,
+    0.8018347350,
+    0.8027504151,
+    0.8036642063,
+    0.8045761064,
+    0.8054861132,
+    0.8063942247,
+    0.8073004386,
+    0.8082047529,
+    0.8091071654,
+    0.8100076740,
+    0.8109062766,
+    0.8118029710,
+    0.8126977551,
+    0.8135906270,
+    0.8144815843,
+    0.8153706251,
+    0.8162577473,
+    0.8171429487,
+    0.8180262273,
+    0.8189075810,
+    0.8197870078,
+    0.8206645055,
+    0.8215400721,
+    0.8224137055,
+    0.8232854037,
+    0.8241551647,
+    0.8250229863,
+    0.8258888666,
+    0.8267528035,
+    0.8276147949,
+    0.8284748389,
+    0.8293329334,
+    0.8301890764,
+    0.8310432659,
+    0.8318954999,
+    0.8327457763,
+    0.8335940932,
+    0.8344404486,
+    0.8352848405,
+    0.8361272668,
+    0.8369677257,
+    0.8378062151,
+    0.8386427331,
+    0.8394772776,
+    0.8403098468,
+    0.8411404387,
+    0.8419690512,
+    0.8427956826,
+    0.8436203307,
+    0.8444429937,
+    0.8452636697,
+    0.8460823567,
+    0.8468990528,
+    0.8477137560,
+    0.8485264645,
+    0.8493371763,
+    0.8501458896,
+    0.8509526024,
+    0.8517573128,
+    0.8525600189,
+    0.8533607189,
+    0.8541594108,
+    0.8549560928,
+    0.8557507630,
+    0.8565434196,
+    0.8573340606,
+    0.8581226843,
+    0.8589092887,
+    0.8596938720,
+    0.8604764323,
+    0.8612569679,
+    0.8620354768,
+    0.8628119573,
+    0.8635864076,
+    0.8643588257,
+    0.8651292099,
+    0.8658975583,
+    0.8666638692,
+    0.8674281408,
+    0.8681903713,
+    0.8689505588,
+    0.8697087015,
+    0.8704647978,
+    0.8712188458,
+    0.8719708437,
+    0.8727207898,
+    0.8734686823,
+    0.8742145194,
+    0.8749582994,
+    0.8757000206,
+    0.8764396811,
+    0.8771772793,
+    0.8779128134,
+    0.8786462817,
+    0.8793776825,
+    0.8801070140,
+    0.8808342745,
+    0.8815594624,
+    0.8822825758,
+    0.8830036132,
+    0.8837225727,
+    0.8844394528,
+    0.8851542517,
+    0.8858669678,
+    0.8865775993,
+    0.8872861446,
+    0.8879926020,
+    0.8886969699,
+    0.8893992467,
+    0.8900994305,
+    0.8907975199,
+    0.8914935132,
+    0.8921874087,
+    0.8928792048,
+    0.8935688998,
+    0.8942564922,
+    0.8949419803,
+    0.8956253626,
+    0.8963066373,
+    0.8969858030,
+    0.8976628579,
+    0.8983378006,
+    0.8990106294,
+    0.8996813427,
+    0.9003499390,
+    0.9010164167,
+    0.9016807742,
+    0.9023430100,
+    0.9030031224,
+    0.9036611101,
+    0.9043169713,
+    0.9049707045,
+    0.9056223083,
+    0.9062717811,
+    0.9069191213,
+    0.9075643274,
+    0.9082073980,
+    0.9088483315,
+    0.9094871263,
+    0.9101237811,
+    0.9107582942,
+    0.9113906642,
+    0.9120208897,
+    0.9126489690,
+    0.9132749009,
+    0.9138986837,
+    0.9145203160,
+    0.9151397963,
+    0.9157571232,
+    0.9163722953,
+    0.9169853111,
+    0.9175961691,
+    0.9182048679,
+    0.9188114061,
+    0.9194157822,
+    0.9200179948,
+    0.9206180426,
+    0.9212159241,
+    0.9218116378,
+    0.9224051825,
+    0.9229965566,
+    0.9235857588,
+    0.9241727878,
+    0.9247576421,
+    0.9253403203,
+    0.9259208211,
+    0.9264991431,
+    0.9270752850,
+    0.9276492454,
+    0.9282210230,
+    0.9287906163,
+    0.9293580242,
+    0.9299232451,
+    0.9304862779,
+    0.9310471211,
+    0.9316057735,
+    0.9321622337,
+    0.9327165005,
+    0.9332685724,
+    0.9338184484,
+    0.9343661269,
+    0.9349116068,
+    0.9354548868,
+    0.9359959655,
+    0.9365348418,
+    0.9370715142,
+    0.9376059817,
+    0.9381382429,
+    0.9386682966,
+    0.9391961415,
+    0.9397217764,
+    0.9402452000,
+    0.9407664111,
+    0.9412854085,
+    0.9418021910,
+    0.9423167573,
+    0.9428291063,
+    0.9433392367,
+    0.9438471473,
+    0.9443528370,
+    0.9448563045,
+    0.9453575486,
+    0.9458565683,
+    0.9463533623,
+    0.9468479294,
+    0.9473402684,
+    0.9478303783,
+    0.9483182579,
+    0.9488039059,
+    0.9492873214,
+    0.9497685031,
+    0.9502474498,
+    0.9507241606,
+    0.9511986342,
+    0.9516708696,
+    0.9521408655,
+    0.9526086210,
+    0.9530741350,
+    0.9535374062,
+    0.9539984337,
+    0.9544572163,
+    0.9549137530,
+    0.9553680427,
+    0.9558200843,
+    0.9562698768,
+    0.9567174191,
+    0.9571627101,
+    0.9576057488,
+    0.9580465342,
+    0.9584850652,
+    0.9589213409,
+    0.9593553600,
+    0.9597871218,
+    0.9602166250,
+    0.9606438688,
+    0.9610688521,
+    0.9614915739,
+    0.9619120332,
+    0.9623302290,
+    0.9627461604,
+    0.9631598263,
+    0.9635712259,
+    0.9639803580,
+    0.9643872219,
+    0.9647918164,
+    0.9651941407,
+    0.9655941938,
+    0.9659919747,
+    0.9663874826,
+    0.9667807165,
+    0.9671716754,
+    0.9675603585,
+    0.9679467648,
+    0.9683308935,
+    0.9687127436,
+    0.9690923142,
+    0.9694696044,
+    0.9698446134,
+    0.9702173403,
+    0.9705877841,
+    0.9709559440,
+    0.9713218192,
+    0.9716854088,
+    0.9720467119,
+    0.9724057277,
+    0.9727624553,
+    0.9731168939,
+    0.9734690427,
+    0.9738189008,
+    0.9741664675,
+    0.9745117418,
+    0.9748547230,
+    0.9751954102,
+    0.9755338028,
+    0.9758698998,
+    0.9762037005,
+    0.9765352041,
+    0.9768644098,
+    0.9771913168,
+    0.9775159245,
+    0.9778382319,
+    0.9781582384,
+    0.9784759432,
+    0.9787913456,
+    0.9791044447,
+    0.9794152399,
+    0.9797237305,
+    0.9800299157,
+    0.9803337948,
+    0.9806353670,
+    0.9809346317,
+    0.9812315882,
+    0.9815262358,
+    0.9818185737,
+    0.9821086014,
+    0.9823963180,
+    0.9826817229,
+    0.9829648155,
+    0.9832455951,
+    0.9835240610,
+    0.9838002126,
+    0.9840740493,
+    0.9843455703,
+    0.9846147750,
+    0.9848816628,
+    0.9851462332,
+    0.9854084853,
+    0.9856684187,
+    0.9859260328,
+    0.9861813268,
+    0.9864343003,
+    0.9866849526,
+    0.9869332832,
+    0.9871792914,
+    0.9874229766,
+    0.9876643384,
+    0.9879033761,
+    0.9881400891,
+    0.9883744770,
+    0.9886065391,
+    0.9888362750,
+    0.9890636840,
+    0.9892887657,
+    0.9895115194,
+    0.9897319448,
+    0.9899500412,
+    0.9901658081,
+    0.9903792451,
+    0.9905903517,
+    0.9907991273,
+    0.9910055714,
+    0.9912096836,
+    0.9914114634,
+    0.9916109103,
+    0.9918080239,
+    0.9920028036,
+    0.9921952491,
+    0.9923853598,
+    0.9925731354,
+    0.9927585753,
+    0.9929416792,
+    0.9931224466,
+    0.9933008770,
+    0.9934769702,
+    0.9936507256,
+    0.9938221428,
+    0.9939912215,
+    0.9941579612,
+    0.9943223616,
+    0.9944844222,
+    0.9946441427,
+    0.9948015227,
+    0.9949565619,
+    0.9951092598,
+    0.9952596161,
+    0.9954076305,
+    0.9955533026,
+    0.9956966321,
+    0.9958376186,
+    0.9959762618,
+    0.9961125614,
+    0.9962465170,
+    0.9963781284,
+    0.9965073951,
+    0.9966343170,
+    0.9967588938,
+    0.9968811250,
+    0.9970010105,
+    0.9971185500,
+    0.9972337431,
+    0.9973465897,
+    0.9974570894,
+    0.9975652420,
+    0.9976710472,
+    0.9977745048,
+    0.9978756145,
+    0.9979743762,
+    0.9980707895,
+    0.9981648543,
+    0.9982565703,
+    0.9983459372,
+    0.9984329550,
+    0.9985176234,
+    0.9985999422,
+    0.9986799111,
+    0.9987575301,
+    0.9988327989,
+    0.9989057173,
+    0.9989762853,
+    0.9990445025,
+    0.9991103689,
+    0.9991738843,
+    0.9992350485,
+    0.9992938615,
+    0.9993503230,
+    0.9994044329,
+    0.9994561911,
+    0.9995055976,
+    0.9995526521,
+    0.9995973545,
+    0.9996397048,
+    0.9996797029,
+    0.9997173486,
+    0.9997526418,
+    0.9997855826,
+    0.9998161708,
+    0.9998444063,
+    0.9998702890,
+    0.9998938190,
+    0.9999149961,
+    0.9999338204,
+    0.9999502917,
+    0.9999644100,
+    0.9999761753,
+    0.9999855875,
+    0.9999926467,
+    0.9999973529,
+    0.9999997059
+};
+
+real_t sine_long_960[] =
+{
+    0.0008181230,
+    0.0024543669,
+    0.0040906041,
+    0.0057268305,
+    0.0073630415,
+    0.0089992327,
+    0.0106353999,
+    0.0122715386,
+    0.0139076445,
+    0.0155437131,
+    0.0171797401,
+    0.0188157211,
+    0.0204516518,
+    0.0220875276,
+    0.0237233444,
+    0.0253590976,
+    0.0269947829,
+    0.0286303960,
+    0.0302659324,
+    0.0319013878,
+    0.0335367578,
+    0.0351720379,
+    0.0368072240,
+    0.0384423114,
+    0.0400772960,
+    0.0417121732,
+    0.0433469388,
+    0.0449815883,
+    0.0466161174,
+    0.0482505217,
+    0.0498847968,
+    0.0515189384,
+    0.0531529420,
+    0.0547868033,
+    0.0564205179,
+    0.0580540815,
+    0.0596874897,
+    0.0613207380,
+    0.0629538222,
+    0.0645867378,
+    0.0662194805,
+    0.0678520459,
+    0.0694844297,
+    0.0711166274,
+    0.0727486347,
+    0.0743804473,
+    0.0760120607,
+    0.0776434706,
+    0.0792746727,
+    0.0809056625,
+    0.0825364356,
+    0.0841669879,
+    0.0857973147,
+    0.0874274119,
+    0.0890572750,
+    0.0906868996,
+    0.0923162815,
+    0.0939454162,
+    0.0955742994,
+    0.0972029267,
+    0.0988312938,
+    0.1004593962,
+    0.1020872297,
+    0.1037147899,
+    0.1053420724,
+    0.1069690729,
+    0.1085957870,
+    0.1102222103,
+    0.1118483386,
+    0.1134741674,
+    0.1150996924,
+    0.1167249092,
+    0.1183498135,
+    0.1199744010,
+    0.1215986673,
+    0.1232226080,
+    0.1248462188,
+    0.1264694953,
+    0.1280924333,
+    0.1297150283,
+    0.1313372760,
+    0.1329591721,
+    0.1345807122,
+    0.1362018920,
+    0.1378227072,
+    0.1394431534,
+    0.1410632262,
+    0.1426829214,
+    0.1443022345,
+    0.1459211613,
+    0.1475396975,
+    0.1491578386,
+    0.1507755804,
+    0.1523929185,
+    0.1540098486,
+    0.1556263664,
+    0.1572424676,
+    0.1588581477,
+    0.1604734026,
+    0.1620882278,
+    0.1637026190,
+    0.1653165720,
+    0.1669300823,
+    0.1685431457,
+    0.1701557579,
+    0.1717679146,
+    0.1733796113,
+    0.1749908439,
+    0.1766016080,
+    0.1782118992,
+    0.1798217134,
+    0.1814310460,
+    0.1830398930,
+    0.1846482499,
+    0.1862561124,
+    0.1878634763,
+    0.1894703372,
+    0.1910766908,
+    0.1926825329,
+    0.1942878591,
+    0.1958926651,
+    0.1974969467,
+    0.1991006995,
+    0.2007039192,
+    0.2023066016,
+    0.2039087424,
+    0.2055103372,
+    0.2071113819,
+    0.2087118720,
+    0.2103118034,
+    0.2119111716,
+    0.2135099726,
+    0.2151082019,
+    0.2167058553,
+    0.2183029285,
+    0.2198994172,
+    0.2214953172,
+    0.2230906242,
+    0.2246853339,
+    0.2262794421,
+    0.2278729444,
+    0.2294658367,
+    0.2310581146,
+    0.2326497739,
+    0.2342408103,
+    0.2358312196,
+    0.2374209975,
+    0.2390101398,
+    0.2405986421,
+    0.2421865003,
+    0.2437737101,
+    0.2453602672,
+    0.2469461675,
+    0.2485314066,
+    0.2501159802,
+    0.2516998843,
+    0.2532831145,
+    0.2548656665,
+    0.2564475362,
+    0.2580287194,
+    0.2596092117,
+    0.2611890089,
+    0.2627681069,
+    0.2643465014,
+    0.2659241881,
+    0.2675011628,
+    0.2690774214,
+    0.2706529596,
+    0.2722277732,
+    0.2738018579,
+    0.2753752096,
+    0.2769478240,
+    0.2785196969,
+    0.2800908242,
+    0.2816612016,
+    0.2832308248,
+    0.2847996898,
+    0.2863677923,
+    0.2879351281,
+    0.2895016930,
+    0.2910674829,
+    0.2926324934,
+    0.2941967205,
+    0.2957601599,
+    0.2973228075,
+    0.2988846591,
+    0.3004457105,
+    0.3020059575,
+    0.3035653959,
+    0.3051240216,
+    0.3066818303,
+    0.3082388180,
+    0.3097949805,
+    0.3113503135,
+    0.3129048130,
+    0.3144584747,
+    0.3160112945,
+    0.3175632683,
+    0.3191143918,
+    0.3206646610,
+    0.3222140717,
+    0.3237626197,
+    0.3253103009,
+    0.3268571111,
+    0.3284030463,
+    0.3299481022,
+    0.3314922747,
+    0.3330355597,
+    0.3345779531,
+    0.3361194508,
+    0.3376600485,
+    0.3391997422,
+    0.3407385278,
+    0.3422764011,
+    0.3438133581,
+    0.3453493945,
+    0.3468845064,
+    0.3484186895,
+    0.3499519398,
+    0.3514842532,
+    0.3530156256,
+    0.3545460528,
+    0.3560755308,
+    0.3576040555,
+    0.3591316228,
+    0.3606582285,
+    0.3621838687,
+    0.3637085392,
+    0.3652322359,
+    0.3667549548,
+    0.3682766918,
+    0.3697974428,
+    0.3713172038,
+    0.3728359706,
+    0.3743537392,
+    0.3758705056,
+    0.3773862656,
+    0.3789010153,
+    0.3804147505,
+    0.3819274673,
+    0.3834391615,
+    0.3849498291,
+    0.3864594661,
+    0.3879680685,
+    0.3894756321,
+    0.3909821530,
+    0.3924876271,
+    0.3939920504,
+    0.3954954189,
+    0.3969977285,
+    0.3984989752,
+    0.3999991550,
+    0.4014982640,
+    0.4029962979,
+    0.4044932530,
+    0.4059891250,
+    0.4074839102,
+    0.4089776043,
+    0.4104702036,
+    0.4119617038,
+    0.4134521011,
+    0.4149413915,
+    0.4164295710,
+    0.4179166355,
+    0.4194025812,
+    0.4208874040,
+    0.4223710999,
+    0.4238536651,
+    0.4253350954,
+    0.4268153870,
+    0.4282945359,
+    0.4297725381,
+    0.4312493897,
+    0.4327250867,
+    0.4341996252,
+    0.4356730012,
+    0.4371452107,
+    0.4386162499,
+    0.4400861148,
+    0.4415548014,
+    0.4430223059,
+    0.4444886242,
+    0.4459537525,
+    0.4474176869,
+    0.4488804234,
+    0.4503419581,
+    0.4518022871,
+    0.4532614065,
+    0.4547193124,
+    0.4561760009,
+    0.4576314680,
+    0.4590857100,
+    0.4605387228,
+    0.4619905026,
+    0.4634410455,
+    0.4648903477,
+    0.4663384052,
+    0.4677852142,
+    0.4692307707,
+    0.4706750710,
+    0.4721181112,
+    0.4735598874,
+    0.4750003957,
+    0.4764396322,
+    0.4778775932,
+    0.4793142748,
+    0.4807496731,
+    0.4821837843,
+    0.4836166046,
+    0.4850481301,
+    0.4864783569,
+    0.4879072813,
+    0.4893348994,
+    0.4907612075,
+    0.4921862016,
+    0.4936098779,
+    0.4950322328,
+    0.4964532623,
+    0.4978729626,
+    0.4992913300,
+    0.5007083606,
+    0.5021240507,
+    0.5035383964,
+    0.5049513940,
+    0.5063630397,
+    0.5077733298,
+    0.5091822603,
+    0.5105898276,
+    0.5119960280,
+    0.5134008575,
+    0.5148043125,
+    0.5162063893,
+    0.5176070840,
+    0.5190063929,
+    0.5204043123,
+    0.5218008384,
+    0.5231959674,
+    0.5245896958,
+    0.5259820196,
+    0.5273729352,
+    0.5287624389,
+    0.5301505270,
+    0.5315371956,
+    0.5329224412,
+    0.5343062600,
+    0.5356886483,
+    0.5370696023,
+    0.5384491185,
+    0.5398271931,
+    0.5412038224,
+    0.5425790028,
+    0.5439527305,
+    0.5453250019,
+    0.5466958133,
+    0.5480651610,
+    0.5494330413,
+    0.5507994507,
+    0.5521643854,
+    0.5535278418,
+    0.5548898163,
+    0.5562503051,
+    0.5576093047,
+    0.5589668114,
+    0.5603228216,
+    0.5616773317,
+    0.5630303379,
+    0.5643818368,
+    0.5657318246,
+    0.5670802978,
+    0.5684272527,
+    0.5697726858,
+    0.5711165935,
+    0.5724589721,
+    0.5737998180,
+    0.5751391277,
+    0.5764768976,
+    0.5778131241,
+    0.5791478036,
+    0.5804809326,
+    0.5818125074,
+    0.5831425246,
+    0.5844709805,
+    0.5857978716,
+    0.5871231943,
+    0.5884469451,
+    0.5897691205,
+    0.5910897169,
+    0.5924087308,
+    0.5937261586,
+    0.5950419968,
+    0.5963562420,
+    0.5976688905,
+    0.5989799388,
+    0.6002893835,
+    0.6015972211,
+    0.6029034480,
+    0.6042080607,
+    0.6055110558,
+    0.6068124298,
+    0.6081121791,
+    0.6094103003,
+    0.6107067900,
+    0.6120016446,
+    0.6132948607,
+    0.6145864349,
+    0.6158763636,
+    0.6171646434,
+    0.6184512709,
+    0.6197362426,
+    0.6210195550,
+    0.6223012049,
+    0.6235811886,
+    0.6248595028,
+    0.6261361441,
+    0.6274111090,
+    0.6286843942,
+    0.6299559962,
+    0.6312259115,
+    0.6324941370,
+    0.6337606690,
+    0.6350255043,
+    0.6362886394,
+    0.6375500710,
+    0.6388097956,
+    0.6400678100,
+    0.6413241107,
+    0.6425786945,
+    0.6438315578,
+    0.6450826974,
+    0.6463321099,
+    0.6475797920,
+    0.6488257403,
+    0.6500699516,
+    0.6513124223,
+    0.6525531494,
+    0.6537921293,
+    0.6550293589,
+    0.6562648347,
+    0.6574985536,
+    0.6587305121,
+    0.6599607069,
+    0.6611891349,
+    0.6624157927,
+    0.6636406770,
+    0.6648637845,
+    0.6660851120,
+    0.6673046561,
+    0.6685224137,
+    0.6697383815,
+    0.6709525561,
+    0.6721649344,
+    0.6733755132,
+    0.6745842891,
+    0.6757912589,
+    0.6769964195,
+    0.6781997675,
+    0.6794012997,
+    0.6806010131,
+    0.6817989042,
+    0.6829949700,
+    0.6841892071,
+    0.6853816125,
+    0.6865721829,
+    0.6877609152,
+    0.6889478061,
+    0.6901328525,
+    0.6913160512,
+    0.6924973990,
+    0.6936768929,
+    0.6948545295,
+    0.6960303058,
+    0.6972042186,
+    0.6983762648,
+    0.6995464412,
+    0.7007147448,
+    0.7018811723,
+    0.7030457206,
+    0.7042083867,
+    0.7053691674,
+    0.7065280597,
+    0.7076850603,
+    0.7088401663,
+    0.7099933745,
+    0.7111446818,
+    0.7122940851,
+    0.7134415815,
+    0.7145871677,
+    0.7157308408,
+    0.7168725976,
+    0.7180124352,
+    0.7191503504,
+    0.7202863403,
+    0.7214204017,
+    0.7225525317,
+    0.7236827271,
+    0.7248109851,
+    0.7259373025,
+    0.7270616764,
+    0.7281841037,
+    0.7293045814,
+    0.7304231066,
+    0.7315396762,
+    0.7326542872,
+    0.7337669368,
+    0.7348776218,
+    0.7359863393,
+    0.7370930863,
+    0.7381978600,
+    0.7393006572,
+    0.7404014752,
+    0.7415003108,
+    0.7425971612,
+    0.7436920235,
+    0.7447848947,
+    0.7458757719,
+    0.7469646521,
+    0.7480515325,
+    0.7491364101,
+    0.7502192821,
+    0.7513001455,
+    0.7523789975,
+    0.7534558351,
+    0.7545306554,
+    0.7556034557,
+    0.7566742330,
+    0.7577429844,
+    0.7588097072,
+    0.7598743984,
+    0.7609370551,
+    0.7619976746,
+    0.7630562540,
+    0.7641127905,
+    0.7651672812,
+    0.7662197234,
+    0.7672701141,
+    0.7683184506,
+    0.7693647301,
+    0.7704089498,
+    0.7714511069,
+    0.7724911985,
+    0.7735292220,
+    0.7745651745,
+    0.7755990532,
+    0.7766308555,
+    0.7776605784,
+    0.7786882194,
+    0.7797137755,
+    0.7807372441,
+    0.7817586225,
+    0.7827779079,
+    0.7837950975,
+    0.7848101886,
+    0.7858231786,
+    0.7868340647,
+    0.7878428442,
+    0.7888495145,
+    0.7898540727,
+    0.7908565162,
+    0.7918568424,
+    0.7928550486,
+    0.7938511320,
+    0.7948450901,
+    0.7958369201,
+    0.7968266194,
+    0.7978141854,
+    0.7987996154,
+    0.7997829068,
+    0.8007640569,
+    0.8017430631,
+    0.8027199228,
+    0.8036946334,
+    0.8046671923,
+    0.8056375968,
+    0.8066058444,
+    0.8075719325,
+    0.8085358584,
+    0.8094976197,
+    0.8104572137,
+    0.8114146378,
+    0.8123698896,
+    0.8133229663,
+    0.8142738656,
+    0.8152225848,
+    0.8161691215,
+    0.8171134730,
+    0.8180556368,
+    0.8189956104,
+    0.8199333914,
+    0.8208689772,
+    0.8218023652,
+    0.8227335530,
+    0.8236625381,
+    0.8245893180,
+    0.8255138903,
+    0.8264362524,
+    0.8273564019,
+    0.8282743363,
+    0.8291900531,
+    0.8301035500,
+    0.8310148244,
+    0.8319238740,
+    0.8328306962,
+    0.8337352887,
+    0.8346376491,
+    0.8355377749,
+    0.8364356636,
+    0.8373313130,
+    0.8382247206,
+    0.8391158841,
+    0.8400048009,
+    0.8408914688,
+    0.8417758854,
+    0.8426580483,
+    0.8435379552,
+    0.8444156036,
+    0.8452909913,
+    0.8461641159,
+    0.8470349751,
+    0.8479035665,
+    0.8487698878,
+    0.8496339367,
+    0.8504957108,
+    0.8513552080,
+    0.8522124258,
+    0.8530673619,
+    0.8539200142,
+    0.8547703802,
+    0.8556184578,
+    0.8564642446,
+    0.8573077384,
+    0.8581489370,
+    0.8589878380,
+    0.8598244392,
+    0.8606587385,
+    0.8614907335,
+    0.8623204220,
+    0.8631478018,
+    0.8639728707,
+    0.8647956265,
+    0.8656160670,
+    0.8664341900,
+    0.8672499933,
+    0.8680634747,
+    0.8688746320,
+    0.8696834631,
+    0.8704899657,
+    0.8712941378,
+    0.8720959772,
+    0.8728954818,
+    0.8736926493,
+    0.8744874777,
+    0.8752799648,
+    0.8760701085,
+    0.8768579067,
+    0.8776433574,
+    0.8784264583,
+    0.8792072074,
+    0.8799856025,
+    0.8807616417,
+    0.8815353229,
+    0.8823066439,
+    0.8830756027,
+    0.8838421972,
+    0.8846064254,
+    0.8853682853,
+    0.8861277748,
+    0.8868848918,
+    0.8876396344,
+    0.8883920005,
+    0.8891419881,
+    0.8898895952,
+    0.8906348198,
+    0.8913776599,
+    0.8921181136,
+    0.8928561787,
+    0.8935918534,
+    0.8943251357,
+    0.8950560237,
+    0.8957845152,
+    0.8965106085,
+    0.8972343016,
+    0.8979555925,
+    0.8986744793,
+    0.8993909601,
+    0.9001050330,
+    0.9008166959,
+    0.9015259472,
+    0.9022327848,
+    0.9029372068,
+    0.9036392114,
+    0.9043387967,
+    0.9050359608,
+    0.9057307018,
+    0.9064230179,
+    0.9071129073,
+    0.9078003680,
+    0.9084853983,
+    0.9091679963,
+    0.9098481602,
+    0.9105258881,
+    0.9112011783,
+    0.9118740290,
+    0.9125444382,
+    0.9132124044,
+    0.9138779255,
+    0.9145410000,
+    0.9152016259,
+    0.9158598016,
+    0.9165155252,
+    0.9171687951,
+    0.9178196094,
+    0.9184679665,
+    0.9191138645,
+    0.9197573017,
+    0.9203982766,
+    0.9210367872,
+    0.9216728319,
+    0.9223064091,
+    0.9229375169,
+    0.9235661538,
+    0.9241923180,
+    0.9248160078,
+    0.9254372217,
+    0.9260559578,
+    0.9266722147,
+    0.9272859906,
+    0.9278972838,
+    0.9285060928,
+    0.9291124159,
+    0.9297162514,
+    0.9303175979,
+    0.9309164536,
+    0.9315128169,
+    0.9321066864,
+    0.9326980603,
+    0.9332869370,
+    0.9338733151,
+    0.9344571929,
+    0.9350385689,
+    0.9356174416,
+    0.9361938093,
+    0.9367676705,
+    0.9373390237,
+    0.9379078674,
+    0.9384742000,
+    0.9390380200,
+    0.9395993260,
+    0.9401581163,
+    0.9407143896,
+    0.9412681443,
+    0.9418193789,
+    0.9423680920,
+    0.9429142821,
+    0.9434579477,
+    0.9439990874,
+    0.9445376998,
+    0.9450737833,
+    0.9456073366,
+    0.9461383582,
+    0.9466668467,
+    0.9471928007,
+    0.9477162188,
+    0.9482370995,
+    0.9487554416,
+    0.9492712435,
+    0.9497845040,
+    0.9502952216,
+    0.9508033949,
+    0.9513090227,
+    0.9518121035,
+    0.9523126361,
+    0.9528106190,
+    0.9533060510,
+    0.9537989307,
+    0.9542892567,
+    0.9547770279,
+    0.9552622428,
+    0.9557449002,
+    0.9562249988,
+    0.9567025372,
+    0.9571775143,
+    0.9576499288,
+    0.9581197793,
+    0.9585870647,
+    0.9590517836,
+    0.9595139348,
+    0.9599735172,
+    0.9604305294,
+    0.9608849703,
+    0.9613368385,
+    0.9617861330,
+    0.9622328525,
+    0.9626769958,
+    0.9631185617,
+    0.9635575491,
+    0.9639939567,
+    0.9644277835,
+    0.9648590281,
+    0.9652876896,
+    0.9657137667,
+    0.9661372582,
+    0.9665581632,
+    0.9669764804,
+    0.9673922086,
+    0.9678053469,
+    0.9682158941,
+    0.9686238491,
+    0.9690292108,
+    0.9694319780,
+    0.9698321499,
+    0.9702297252,
+    0.9706247029,
+    0.9710170819,
+    0.9714068613,
+    0.9717940399,
+    0.9721786167,
+    0.9725605907,
+    0.9729399608,
+    0.9733167261,
+    0.9736908855,
+    0.9740624381,
+    0.9744313828,
+    0.9747977187,
+    0.9751614448,
+    0.9755225600,
+    0.9758810635,
+    0.9762369542,
+    0.9765902313,
+    0.9769408937,
+    0.9772889406,
+    0.9776343710,
+    0.9779771840,
+    0.9783173786,
+    0.9786549539,
+    0.9789899092,
+    0.9793222433,
+    0.9796519555,
+    0.9799790449,
+    0.9803035106,
+    0.9806253518,
+    0.9809445675,
+    0.9812611569,
+    0.9815751192,
+    0.9818864535,
+    0.9821951590,
+    0.9825012349,
+    0.9828046803,
+    0.9831054945,
+    0.9834036766,
+    0.9836992258,
+    0.9839921414,
+    0.9842824225,
+    0.9845700684,
+    0.9848550783,
+    0.9851374515,
+    0.9854171871,
+    0.9856942845,
+    0.9859687429,
+    0.9862405616,
+    0.9865097398,
+    0.9867762768,
+    0.9870401719,
+    0.9873014244,
+    0.9875600336,
+    0.9878159988,
+    0.9880693193,
+    0.9883199945,
+    0.9885680237,
+    0.9888134061,
+    0.9890561412,
+    0.9892962283,
+    0.9895336667,
+    0.9897684559,
+    0.9900005952,
+    0.9902300839,
+    0.9904569215,
+    0.9906811073,
+    0.9909026408,
+    0.9911215213,
+    0.9913377484,
+    0.9915513213,
+    0.9917622395,
+    0.9919705024,
+    0.9921761096,
+    0.9923790604,
+    0.9925793543,
+    0.9927769908,
+    0.9929719693,
+    0.9931642894,
+    0.9933539504,
+    0.9935409519,
+    0.9937252935,
+    0.9939069745,
+    0.9940859945,
+    0.9942623531,
+    0.9944360497,
+    0.9946070839,
+    0.9947754553,
+    0.9949411633,
+    0.9951042076,
+    0.9952645877,
+    0.9954223032,
+    0.9955773536,
+    0.9957297385,
+    0.9958794576,
+    0.9960265105,
+    0.9961708966,
+    0.9963126157,
+    0.9964516674,
+    0.9965880513,
+    0.9967217670,
+    0.9968528142,
+    0.9969811925,
+    0.9971069016,
+    0.9972299412,
+    0.9973503108,
+    0.9974680103,
+    0.9975830392,
+    0.9976953973,
+    0.9978050843,
+    0.9979120998,
+    0.9980164436,
+    0.9981181155,
+    0.9982171151,
+    0.9983134421,
+    0.9984070964,
+    0.9984980776,
+    0.9985863855,
+    0.9986720200,
+    0.9987549807,
+    0.9988352674,
+    0.9989128799,
+    0.9989878181,
+    0.9990600816,
+    0.9991296704,
+    0.9991965842,
+    0.9992608228,
+    0.9993223862,
+    0.9993812740,
+    0.9994374862,
+    0.9994910226,
+    0.9995418831,
+    0.9995900674,
+    0.9996355756,
+    0.9996784075,
+    0.9997185629,
+    0.9997560418,
+    0.9997908440,
+    0.9998229695,
+    0.9998524181,
+    0.9998791899,
+    0.9999032846,
+    0.9999247024,
+    0.9999434430,
+    0.9999595065,
+    0.9999728928,
+    0.9999836018,
+    0.9999916336,
+    0.9999969881,
+    0.9999996654
+};
+
+real_t sine_short_128[] =
+{
+    0.0061358848,
+    0.0184067304,
+    0.0306748040,
+    0.0429382581,
+    0.0551952459,
+    0.0674439214,
+    0.0796824402,
+    0.0919089590,
+    0.1041216368,
+    0.1163186341,
+    0.1284981143,
+    0.1406582432,
+    0.1527971895,
+    0.1649131250,
+    0.1770042253,
+    0.1890686693,
+    0.2011046404,
+    0.2131103258,
+    0.2250839175,
+    0.2370236125,
+    0.2489276125,
+    0.2607941250,
+    0.2726213628,
+    0.2844075449,
+    0.2961508962,
+    0.3078496483,
+    0.3195020394,
+    0.3311063146,
+    0.3426607265,
+    0.3541635348,
+    0.3656130075,
+    0.3770074202,
+    0.3883450569,
+    0.3996242103,
+    0.4108431818,
+    0.4220002818,
+    0.4330938301,
+    0.4441221560,
+    0.4550835988,
+    0.4659765077,
+    0.4767992422,
+    0.4875501725,
+    0.4982276796,
+    0.5088301553,
+    0.5193560032,
+    0.5298036379,
+    0.5401714861,
+    0.5504579865,
+    0.5606615899,
+    0.5707807598,
+    0.5808139721,
+    0.5907597160,
+    0.6006164937,
+    0.6103828207,
+    0.6200572264,
+    0.6296382536,
+    0.6391244597,
+    0.6485144160,
+    0.6578067083,
+    0.6669999374,
+    0.6760927188,
+    0.6850836831,
+    0.6939714763,
+    0.7027547599,
+    0.7114322112,
+    0.7200025235,
+    0.7284644060,
+    0.7368165845,
+    0.7450578010,
+    0.7531868147,
+    0.7612024011,
+    0.7691033533,
+    0.7768884813,
+    0.7845566127,
+    0.7921065928,
+    0.7995372846,
+    0.8068475690,
+    0.8140363451,
+    0.8211025303,
+    0.8280450605,
+    0.8348628901,
+    0.8415549925,
+    0.8481203597,
+    0.8545580032,
+    0.8608669533,
+    0.8670462601,
+    0.8730949928,
+    0.8790122407,
+    0.8847971125,
+    0.8904487372,
+    0.8959662635,
+    0.9013488606,
+    0.9065957178,
+    0.9117060451,
+    0.9166790728,
+    0.9215140520,
+    0.9262102546,
+    0.9307669733,
+    0.9351835219,
+    0.9394592352,
+    0.9435934695,
+    0.9475856021,
+    0.9514350317,
+    0.9551411788,
+    0.9587034850,
+    0.9621214141,
+    0.9653944512,
+    0.9685221034,
+    0.9715038998,
+    0.9743393912,
+    0.9770281507,
+    0.9795697733,
+    0.9819638764,
+    0.9842100992,
+    0.9863081037,
+    0.9882575738,
+    0.9900582159,
+    0.9917097588,
+    0.9932119539,
+    0.9945645750,
+    0.9957674182,
+    0.9968203026,
+    0.9977230695,
+    0.9984755829,
+    0.9990777296,
+    0.9995294188,
+    0.9998305826,
+    0.9999811755
+};
+
+real_t sine_short_120[] =
+{
+    0.0065449381,
+    0.0196336930,
+    0.0327190837,
+    0.0457988682,
+    0.0588708053,
+    0.0719326552,
+    0.0849821797,
+    0.0980171430,
+    0.1110353116,
+    0.1240344549,
+    0.1370123455,
+    0.1499667597,
+    0.1628954779,
+    0.1757962848,
+    0.1886669699,
+    0.2015053279,
+    0.2143091589,
+    0.2270762692,
+    0.2398044712,
+    0.2524915839,
+    0.2651354334,
+    0.2777338534,
+    0.2902846851,
+    0.3027857780,
+    0.3152349901,
+    0.3276301883,
+    0.3399692488,
+    0.3522500573,
+    0.3644705095,
+    0.3766285116,
+    0.3887219804,
+    0.4007488436,
+    0.4127070406,
+    0.4245945223,
+    0.4364092520,
+    0.4481492051,
+    0.4598123703,
+    0.4713967489,
+    0.4829003561,
+    0.4943212208,
+    0.5056573861,
+    0.5169069096,
+    0.5280678638,
+    0.5391383363,
+    0.5501164301,
+    0.5610002644,
+    0.5717879741,
+    0.5824777109,
+    0.5930676432,
+    0.6035559563,
+    0.6139408533,
+    0.6242205546,
+    0.6343932989,
+    0.6444573433,
+    0.6544109631,
+    0.6642524530,
+    0.6739801267,
+    0.6835923173,
+    0.6930873779,
+    0.7024636815,
+    0.7117196216,
+    0.7208536122,
+    0.7298640883,
+    0.7387495058,
+    0.7475083425,
+    0.7561390974,
+    0.7646402918,
+    0.7730104690,
+    0.7812481948,
+    0.7893520577,
+    0.7973206693,
+    0.8051526640,
+    0.8128467000,
+    0.8204014588,
+    0.8278156461,
+    0.8350879914,
+    0.8422172487,
+    0.8492021964,
+    0.8560416377,
+    0.8627344006,
+    0.8692793384,
+    0.8756753297,
+    0.8819212785,
+    0.8880161146,
+    0.8939587938,
+    0.8997482976,
+    0.9053836343,
+    0.9108638381,
+    0.9161879700,
+    0.9213551179,
+    0.9263643963,
+    0.9312149469,
+    0.9359059386,
+    0.9404365677,
+    0.9448060577,
+    0.9490136602,
+    0.9530586539,
+    0.9569403460,
+    0.9606580713,
+    0.9642111928,
+    0.9675991016,
+    0.9708212173,
+    0.9738769878,
+    0.9767658894,
+    0.9794874272,
+    0.9820411349,
+    0.9844265749,
+    0.9866433385,
+    0.9886910458,
+    0.9905693459,
+    0.9922779171,
+    0.9938164666,
+    0.9951847307,
+    0.9963824750,
+    0.9974094943,
+    0.9982656127,
+    0.9989506833,
+    0.9994645889,
+    0.9998072413,
+    0.9999785819
+};
+
+#ifdef LD_DEC
+real_t sine_mid_512[] =
+{
+    0.0015339802,
+    0.0046019262,
+    0.0076698290,
+    0.0107376595,
+    0.0138053889,
+    0.0168729884,
+    0.0199404291,
+    0.0230076821,
+    0.0260747186,
+    0.0291415096,
+    0.0322080263,
+    0.0352742399,
+    0.0383401214,
+    0.0414056421,
+    0.0444707731,
+    0.0475354855,
+    0.0505997504,
+    0.0536635391,
+    0.0567268227,
+    0.0597895724,
+    0.0628517593,
+    0.0659133546,
+    0.0689743295,
+    0.0720346552,
+    0.0750943029,
+    0.0781532438,
+    0.0812114491,
+    0.0842688899,
+    0.0873255376,
+    0.0903813634,
+    0.0934363384,
+    0.0964904340,
+    0.0995436214,
+    0.1025958719,
+    0.1056471566,
+    0.1086974470,
+    0.1117467143,
+    0.1147949298,
+    0.1178420648,
+    0.1208880906,
+    0.1239329785,
+    0.1269767000,
+    0.1300192263,
+    0.1330605288,
+    0.1361005789,
+    0.1391393480,
+    0.1421768074,
+    0.1452129287,
+    0.1482476831,
+    0.1512810421,
+    0.1543129773,
+    0.1573434600,
+    0.1603724617,
+    0.1633999539,
+    0.1664259081,
+    0.1694502959,
+    0.1724730887,
+    0.1754942582,
+    0.1785137759,
+    0.1815316133,
+    0.1845477420,
+    0.1875621337,
+    0.1905747601,
+    0.1935855926,
+    0.1965946031,
+    0.1996017631,
+    0.2026070444,
+    0.2056104187,
+    0.2086118577,
+    0.2116113332,
+    0.2146088169,
+    0.2176042806,
+    0.2205976961,
+    0.2235890353,
+    0.2265782700,
+    0.2295653721,
+    0.2325503134,
+    0.2355330658,
+    0.2385136014,
+    0.2414918919,
+    0.2444679094,
+    0.2474416259,
+    0.2504130134,
+    0.2533820439,
+    0.2563486895,
+    0.2593129222,
+    0.2622747142,
+    0.2652340375,
+    0.2681908643,
+    0.2711451669,
+    0.2740969173,
+    0.2770460878,
+    0.2799926507,
+    0.2829365781,
+    0.2858778425,
+    0.2888164160,
+    0.2917522711,
+    0.2946853801,
+    0.2976157155,
+    0.3005432495,
+    0.3034679547,
+    0.3063898036,
+    0.3093087686,
+    0.3122248223,
+    0.3151379372,
+    0.3180480859,
+    0.3209552410,
+    0.3238593752,
+    0.3267604611,
+    0.3296584714,
+    0.3325533788,
+    0.3354451561,
+    0.3383337760,
+    0.3412192114,
+    0.3441014352,
+    0.3469804201,
+    0.3498561391,
+    0.3527285651,
+    0.3555976712,
+    0.3584634302,
+    0.3613258152,
+    0.3641847992,
+    0.3670403554,
+    0.3698924569,
+    0.3727410769,
+    0.3755861884,
+    0.3784277648,
+    0.3812657793,
+    0.3841002051,
+    0.3869310157,
+    0.3897581843,
+    0.3925816844,
+    0.3954014893,
+    0.3982175726,
+    0.4010299077,
+    0.4038384682,
+    0.4066432275,
+    0.4094441594,
+    0.4122412374,
+    0.4150344353,
+    0.4178237267,
+    0.4206090854,
+    0.4233904852,
+    0.4261678998,
+    0.4289413032,
+    0.4317106692,
+    0.4344759718,
+    0.4372371850,
+    0.4399942827,
+    0.4427472390,
+    0.4454960280,
+    0.4482406238,
+    0.4509810007,
+    0.4537171327,
+    0.4564489941,
+    0.4591765593,
+    0.4618998026,
+    0.4646186982,
+    0.4673332207,
+    0.4700433445,
+    0.4727490440,
+    0.4754502939,
+    0.4781470686,
+    0.4808393428,
+    0.4835270912,
+    0.4862102885,
+    0.4888889093,
+    0.4915629286,
+    0.4942323210,
+    0.4968970616,
+    0.4995571252,
+    0.5022124867,
+    0.5048631212,
+    0.5075090038,
+    0.5101501095,
+    0.5127864135,
+    0.5154178909,
+    0.5180445171,
+    0.5206662672,
+    0.5232831165,
+    0.5258950406,
+    0.5285020147,
+    0.5311040144,
+    0.5337010151,
+    0.5362929924,
+    0.5388799219,
+    0.5414617792,
+    0.5440385402,
+    0.5466101804,
+    0.5491766757,
+    0.5517380020,
+    0.5542941351,
+    0.5568450509,
+    0.5593907256,
+    0.5619311350,
+    0.5644662553,
+    0.5669960626,
+    0.5695205332,
+    0.5720396432,
+    0.5745533690,
+    0.5770616868,
+    0.5795645732,
+    0.5820620044,
+    0.5845539570,
+    0.5870404077,
+    0.5895213328,
+    0.5919967092,
+    0.5944665134,
+    0.5969307223,
+    0.5993893127,
+    0.6018422614,
+    0.6042895453,
+    0.6067311415,
+    0.6091670268,
+    0.6115971784,
+    0.6140215735,
+    0.6164401891,
+    0.6188530025,
+    0.6212599911,
+    0.6236611322,
+    0.6260564031,
+    0.6284457813,
+    0.6308292444,
+    0.6332067698,
+    0.6355783353,
+    0.6379439184,
+    0.6403034970,
+    0.6426570488,
+    0.6450045517,
+    0.6473459836,
+    0.6496813224,
+    0.6520105461,
+    0.6543336328,
+    0.6566505608,
+    0.6589613080,
+    0.6612658529,
+    0.6635641737,
+    0.6658562488,
+    0.6681420566,
+    0.6704215756,
+    0.6726947843,
+    0.6749616613,
+    0.6772221854,
+    0.6794763352,
+    0.6817240894,
+    0.6839654271,
+    0.6862003270,
+    0.6884287681,
+    0.6906507295,
+    0.6928661902,
+    0.6950751294,
+    0.6972775262,
+    0.6994733600,
+    0.7016626102,
+    0.7038452560,
+    0.7060212769,
+    0.7081906525,
+    0.7103533623,
+    0.7125093860,
+    0.7146587034,
+    0.7168012940,
+    0.7189371379,
+    0.7210662148,
+    0.7231885048,
+    0.7253039879,
+    0.7274126442,
+    0.7295144537,
+    0.7316093968,
+    0.7336974537,
+    0.7357786047,
+    0.7378528304,
+    0.7399201111,
+    0.7419804273,
+    0.7440337598,
+    0.7460800891,
+    0.7481193961,
+    0.7501516614,
+    0.7521768661,
+    0.7541949909,
+    0.7562060170,
+    0.7582099254,
+    0.7602066973,
+    0.7621963137,
+    0.7641787561,
+    0.7661540058,
+    0.7681220441,
+    0.7700828526,
+    0.7720364128,
+    0.7739827062,
+    0.7759217146,
+    0.7778534198,
+    0.7797778035,
+    0.7816948476,
+    0.7836045342,
+    0.7855068451,
+    0.7874017626,
+    0.7892892687,
+    0.7911693458,
+    0.7930419760,
+    0.7949071418,
+    0.7967648257,
+    0.7986150101,
+    0.8004576777,
+    0.8022928110,
+    0.8041203929,
+    0.8059404060,
+    0.8077528334,
+    0.8095576578,
+    0.8113548624,
+    0.8131444302,
+    0.8149263444,
+    0.8167005882,
+    0.8184671449,
+    0.8202259979,
+    0.8219771306,
+    0.8237205265,
+    0.8254561693,
+    0.8271840425,
+    0.8289041300,
+    0.8306164155,
+    0.8323208829,
+    0.8340175162,
+    0.8357062995,
+    0.8373872167,
+    0.8390602521,
+    0.8407253900,
+    0.8423826147,
+    0.8440319105,
+    0.8456732620,
+    0.8473066536,
+    0.8489320701,
+    0.8505494961,
+    0.8521589165,
+    0.8537603160,
+    0.8553536795,
+    0.8569389922,
+    0.8585162390,
+    0.8600854051,
+    0.8616464758,
+    0.8631994363,
+    0.8647442721,
+    0.8662809686,
+    0.8678095113,
+    0.8693298858,
+    0.8708420779,
+    0.8723460733,
+    0.8738418578,
+    0.8753294174,
+    0.8768087381,
+    0.8782798059,
+    0.8797426070,
+    0.8811971277,
+    0.8826433541,
+    0.8840812728,
+    0.8855108702,
+    0.8869321328,
+    0.8883450473,
+    0.8897496003,
+    0.8911457787,
+    0.8925335692,
+    0.8939129589,
+    0.8952839348,
+    0.8966464839,
+    0.8980005934,
+    0.8993462506,
+    0.9006834428,
+    0.9020121574,
+    0.9033323820,
+    0.9046441040,
+    0.9059473112,
+    0.9072419912,
+    0.9085281320,
+    0.9098057213,
+    0.9110747472,
+    0.9123351977,
+    0.9135870610,
+    0.9148303252,
+    0.9160649787,
+    0.9172910099,
+    0.9185084071,
+    0.9197171590,
+    0.9209172542,
+    0.9221086814,
+    0.9232914293,
+    0.9244654868,
+    0.9256308430,
+    0.9267874867,
+    0.9279354072,
+    0.9290745935,
+    0.9302050351,
+    0.9313267212,
+    0.9324396413,
+    0.9335437850,
+    0.9346391418,
+    0.9357257014,
+    0.9368034535,
+    0.9378723882,
+    0.9389324952,
+    0.9399837646,
+    0.9410261866,
+    0.9420597512,
+    0.9430844489,
+    0.9441002698,
+    0.9451072045,
+    0.9461052436,
+    0.9470943775,
+    0.9480745970,
+    0.9490458928,
+    0.9500082559,
+    0.9509616771,
+    0.9519061475,
+    0.9528416583,
+    0.9537682005,
+    0.9546857654,
+    0.9555943446,
+    0.9564939293,
+    0.9573845111,
+    0.9582660816,
+    0.9591386326,
+    0.9600021558,
+    0.9608566431,
+    0.9617020864,
+    0.9625384778,
+    0.9633658095,
+    0.9641840736,
+    0.9649932624,
+    0.9657933683,
+    0.9665843838,
+    0.9673663015,
+    0.9681391139,
+    0.9689028139,
+    0.9696573941,
+    0.9704028476,
+    0.9711391673,
+    0.9718663462,
+    0.9725843776,
+    0.9732932546,
+    0.9739929706,
+    0.9746835191,
+    0.9753648934,
+    0.9760370872,
+    0.9767000942,
+    0.9773539081,
+    0.9779985228,
+    0.9786339322,
+    0.9792601304,
+    0.9798771113,
+    0.9804848693,
+    0.9810833986,
+    0.9816726935,
+    0.9822527486,
+    0.9828235583,
+    0.9833851173,
+    0.9839374204,
+    0.9844804622,
+    0.9850142377,
+    0.9855387419,
+    0.9860539698,
+    0.9865599167,
+    0.9870565776,
+    0.9875439480,
+    0.9880220232,
+    0.9884907988,
+    0.9889502704,
+    0.9894004335,
+    0.9898412841,
+    0.9902728179,
+    0.9906950309,
+    0.9911079190,
+    0.9915114785,
+    0.9919057055,
+    0.9922905963,
+    0.9926661473,
+    0.9930323550,
+    0.9933892158,
+    0.9937367265,
+    0.9940748837,
+    0.9944036844,
+    0.9947231253,
+    0.9950332035,
+    0.9953339161,
+    0.9956252602,
+    0.9959072331,
+    0.9961798322,
+    0.9964430548,
+    0.9966968986,
+    0.9969413610,
+    0.9971764399,
+    0.9974021329,
+    0.9976184380,
+    0.9978253532,
+    0.9980228764,
+    0.9982110059,
+    0.9983897398,
+    0.9985590765,
+    0.9987190144,
+    0.9988695519,
+    0.9990106877,
+    0.9991424205,
+    0.9992647489,
+    0.9993776719,
+    0.9994811883,
+    0.9995752973,
+    0.9996599979,
+    0.9997352893,
+    0.9998011707,
+    0.9998576417,
+    0.9999047017,
+    0.9999423501,
+    0.9999705868,
+    0.9999894113,
+    0.9999988235
+};
+
+real_t sine_mid_480[] =
+{
+    0.0016362455,
+    0.0049087189,
+    0.0081811398,
+    0.0114534731,
+    0.0147256837,
+    0.0179977366,
+    0.0212695968,
+    0.0245412292,
+    0.0278125988,
+    0.0310836705,
+    0.0343544094,
+    0.0376247803,
+    0.0408947483,
+    0.0441642784,
+    0.0474333354,
+    0.0507018846,
+    0.0539698907,
+    0.0572373189,
+    0.0605041341,
+    0.0637703013,
+    0.0670357857,
+    0.0703005521,
+    0.0735645656,
+    0.0768277914,
+    0.0800901944,
+    0.0833517396,
+    0.0866123923,
+    0.0898721174,
+    0.0931308800,
+    0.0963886453,
+    0.0996453784,
+    0.1029010443,
+    0.1061556082,
+    0.1094090353,
+    0.1126612907,
+    0.1159123396,
+    0.1191621472,
+    0.1224106786,
+    0.1256578991,
+    0.1289037739,
+    0.1321482683,
+    0.1353913474,
+    0.1386329767,
+    0.1418731213,
+    0.1451117465,
+    0.1483488177,
+    0.1515843002,
+    0.1548181594,
+    0.1580503605,
+    0.1612808691,
+    0.1645096505,
+    0.1677366702,
+    0.1709618935,
+    0.1741852859,
+    0.1774068130,
+    0.1806264402,
+    0.1838441330,
+    0.1870598570,
+    0.1902735777,
+    0.1934852607,
+    0.1966948717,
+    0.1999023762,
+    0.2031077400,
+    0.2063109286,
+    0.2095119078,
+    0.2127106433,
+    0.2159071008,
+    0.2191012462,
+    0.2222930451,
+    0.2254824635,
+    0.2286694671,
+    0.2318540218,
+    0.2350360936,
+    0.2382156484,
+    0.2413926520,
+    0.2445670705,
+    0.2477388699,
+    0.2509080162,
+    0.2540744755,
+    0.2572382139,
+    0.2603991974,
+    0.2635573923,
+    0.2667127647,
+    0.2698652808,
+    0.2730149069,
+    0.2761616092,
+    0.2793053540,
+    0.2824461077,
+    0.2855838367,
+    0.2887185072,
+    0.2918500858,
+    0.2949785389,
+    0.2981038331,
+    0.3012259348,
+    0.3043448106,
+    0.3074604271,
+    0.3105727510,
+    0.3136817488,
+    0.3167873874,
+    0.3198896335,
+    0.3229884538,
+    0.3260838151,
+    0.3291756844,
+    0.3322640284,
+    0.3353488142,
+    0.3384300086,
+    0.3415075788,
+    0.3445814916,
+    0.3476517143,
+    0.3507182139,
+    0.3537809576,
+    0.3568399126,
+    0.3598950461,
+    0.3629463254,
+    0.3659937179,
+    0.3690371908,
+    0.3720767117,
+    0.3751122479,
+    0.3781437670,
+    0.3811712365,
+    0.3841946239,
+    0.3872138969,
+    0.3902290232,
+    0.3932399704,
+    0.3962467063,
+    0.3992491987,
+    0.4022474156,
+    0.4052413246,
+    0.4082308939,
+    0.4112160913,
+    0.4141968849,
+    0.4171732429,
+    0.4201451332,
+    0.4231125241,
+    0.4260753838,
+    0.4290336806,
+    0.4319873828,
+    0.4349364587,
+    0.4378808768,
+    0.4408206056,
+    0.4437556136,
+    0.4466858692,
+    0.4496113412,
+    0.4525319983,
+    0.4554478091,
+    0.4583587424,
+    0.4612647671,
+    0.4641658519,
+    0.4670619660,
+    0.4699530782,
+    0.4728391575,
+    0.4757201731,
+    0.4785960942,
+    0.4814668899,
+    0.4843325294,
+    0.4871929822,
+    0.4900482174,
+    0.4928982047,
+    0.4957429134,
+    0.4985823131,
+    0.5014163734,
+    0.5042450640,
+    0.5070683544,
+    0.5098862146,
+    0.5126986143,
+    0.5155055234,
+    0.5183069119,
+    0.5211027497,
+    0.5238930069,
+    0.5266776537,
+    0.5294566601,
+    0.5322299965,
+    0.5349976332,
+    0.5377595404,
+    0.5405156887,
+    0.5432660485,
+    0.5460105903,
+    0.5487492848,
+    0.5514821026,
+    0.5542090145,
+    0.5569299913,
+    0.5596450038,
+    0.5623540230,
+    0.5650570198,
+    0.5677539653,
+    0.5704448306,
+    0.5731295868,
+    0.5758082054,
+    0.5784806575,
+    0.5811469145,
+    0.5838069479,
+    0.5864607292,
+    0.5891082300,
+    0.5917494219,
+    0.5943842766,
+    0.5970127660,
+    0.5996348618,
+    0.6022505361,
+    0.6048597607,
+    0.6074625077,
+    0.6100587493,
+    0.6126484577,
+    0.6152316051,
+    0.6178081639,
+    0.6203781064,
+    0.6229414052,
+    0.6254980328,
+    0.6280479618,
+    0.6305911649,
+    0.6331276149,
+    0.6356572846,
+    0.6381801469,
+    0.6406961748,
+    0.6432053414,
+    0.6457076197,
+    0.6482029831,
+    0.6506914047,
+    0.6531728580,
+    0.6556473162,
+    0.6581147531,
+    0.6605751420,
+    0.6630284567,
+    0.6654746709,
+    0.6679137584,
+    0.6703456931,
+    0.6727704490,
+    0.6751880000,
+    0.6775983202,
+    0.6800013840,
+    0.6823971654,
+    0.6847856390,
+    0.6871667790,
+    0.6895405601,
+    0.6919069567,
+    0.6942659435,
+    0.6966174953,
+    0.6989615869,
+    0.7012981932,
+    0.7036272892,
+    0.7059488498,
+    0.7082628503,
+    0.7105692659,
+    0.7128680719,
+    0.7151592436,
+    0.7174427565,
+    0.7197185862,
+    0.7219867083,
+    0.7242470985,
+    0.7264997326,
+    0.7287445864,
+    0.7309816360,
+    0.7332108574,
+    0.7354322266,
+    0.7376457200,
+    0.7398513138,
+    0.7420489844,
+    0.7442387082,
+    0.7464204618,
+    0.7485942218,
+    0.7507599651,
+    0.7529176682,
+    0.7550673083,
+    0.7572088621,
+    0.7593423069,
+    0.7614676197,
+    0.7635847778,
+    0.7656937585,
+    0.7677945393,
+    0.7698870976,
+    0.7719714111,
+    0.7740474573,
+    0.7761152141,
+    0.7781746593,
+    0.7802257710,
+    0.7822685270,
+    0.7843029055,
+    0.7863288848,
+    0.7883464432,
+    0.7903555590,
+    0.7923562107,
+    0.7943483769,
+    0.7963320363,
+    0.7983071676,
+    0.8002737497,
+    0.8022317615,
+    0.8041811820,
+    0.8061219904,
+    0.8080541659,
+    0.8099776877,
+    0.8118925354,
+    0.8137986883,
+    0.8156961261,
+    0.8175848285,
+    0.8194647752,
+    0.8213359460,
+    0.8231983211,
+    0.8250518803,
+    0.8268966039,
+    0.8287324721,
+    0.8305594652,
+    0.8323775637,
+    0.8341867481,
+    0.8359869990,
+    0.8377782972,
+    0.8395606235,
+    0.8413339587,
+    0.8430982839,
+    0.8448535802,
+    0.8465998288,
+    0.8483370110,
+    0.8500651082,
+    0.8517841019,
+    0.8534939737,
+    0.8551947052,
+    0.8568862783,
+    0.8585686748,
+    0.8602418767,
+    0.8619058662,
+    0.8635606253,
+    0.8652061363,
+    0.8668423818,
+    0.8684693440,
+    0.8700870056,
+    0.8716953493,
+    0.8732943578,
+    0.8748840140,
+    0.8764643010,
+    0.8780352017,
+    0.8795966993,
+    0.8811487772,
+    0.8826914187,
+    0.8842246072,
+    0.8857483265,
+    0.8872625600,
+    0.8887672917,
+    0.8902625055,
+    0.8917481852,
+    0.8932243150,
+    0.8946908791,
+    0.8961478618,
+    0.8975952475,
+    0.8990330206,
+    0.9004611658,
+    0.9018796678,
+    0.9032885114,
+    0.9046876815,
+    0.9060771631,
+    0.9074569413,
+    0.9088270015,
+    0.9101873288,
+    0.9115379087,
+    0.9128787268,
+    0.9142097687,
+    0.9155310202,
+    0.9168424670,
+    0.9181440952,
+    0.9194358908,
+    0.9207178400,
+    0.9219899290,
+    0.9232521443,
+    0.9245044723,
+    0.9257468996,
+    0.9269794128,
+    0.9282019989,
+    0.9294146447,
+    0.9306173372,
+    0.9318100635,
+    0.9329928109,
+    0.9341655667,
+    0.9353283183,
+    0.9364810533,
+    0.9376237593,
+    0.9387564242,
+    0.9398790357,
+    0.9409915818,
+    0.9420940507,
+    0.9431864306,
+    0.9442687096,
+    0.9453408763,
+    0.9464029192,
+    0.9474548268,
+    0.9484965880,
+    0.9495281915,
+    0.9505496264,
+    0.9515608816,
+    0.9525619463,
+    0.9535528099,
+    0.9545334617,
+    0.9555038913,
+    0.9564640881,
+    0.9574140420,
+    0.9583537427,
+    0.9592831803,
+    0.9602023446,
+    0.9611112260,
+    0.9620098147,
+    0.9628981010,
+    0.9637760755,
+    0.9646437286,
+    0.9655010512,
+    0.9663480341,
+    0.9671846682,
+    0.9680109445,
+    0.9688268541,
+    0.9696323885,
+    0.9704275388,
+    0.9712122966,
+    0.9719866535,
+    0.9727506013,
+    0.9735041316,
+    0.9742472365,
+    0.9749799080,
+    0.9757021383,
+    0.9764139195,
+    0.9771152442,
+    0.9778061047,
+    0.9784864937,
+    0.9791564039,
+    0.9798158282,
+    0.9804647593,
+    0.9811031905,
+    0.9817311149,
+    0.9823485257,
+    0.9829554164,
+    0.9835517804,
+    0.9841376113,
+    0.9847129029,
+    0.9852776490,
+    0.9858318436,
+    0.9863754808,
+    0.9869085546,
+    0.9874310595,
+    0.9879429897,
+    0.9884443399,
+    0.9889351046,
+    0.9894152786,
+    0.9898848568,
+    0.9903438341,
+    0.9907922056,
+    0.9912299666,
+    0.9916571122,
+    0.9920736380,
+    0.9924795395,
+    0.9928748124,
+    0.9932594523,
+    0.9936334552,
+    0.9939968171,
+    0.9943495342,
+    0.9946916025,
+    0.9950230184,
+    0.9953437785,
+    0.9956538793,
+    0.9959533173,
+    0.9962420896,
+    0.9965201929,
+    0.9967876242,
+    0.9970443807,
+    0.9972904597,
+    0.9975258586,
+    0.9977505747,
+    0.9979646057,
+    0.9981679493,
+    0.9983606034,
+    0.9985425657,
+    0.9987138346,
+    0.9988744079,
+    0.9990242842,
+    0.9991634617,
+    0.9992919389,
+    0.9994097146,
+    0.9995167873,
+    0.9996131561,
+    0.9996988198,
+    0.9997737775,
+    0.9998380284,
+    0.9998915719,
+    0.9999344073,
+    0.9999665343,
+    0.9999879524,
+    0.9999986614
+};
+
+real_t ld_mid_512[] =
+{
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0061358848,
+    0.0184067304,
+    0.0306748040,
+    0.0429382581,
+    0.0551952459,
+    0.0674439214,
+    0.0796824402,
+    0.0919089590,
+    0.1041216368,
+    0.1163186341,
+    0.1284981143,
+    0.1406582432,
+    0.1527971895,
+    0.1649131250,
+    0.1770042253,
+    0.1890686693,
+    0.2011046404,
+    0.2131103258,
+    0.2250839175,
+    0.2370236125,
+    0.2489276125,
+    0.2607941250,
+    0.2726213628,
+    0.2844075449,
+    0.2961508962,
+    0.3078496483,
+    0.3195020394,
+    0.3311063146,
+    0.3426607265,
+    0.3541635348,
+    0.3656130075,
+    0.3770074202,
+    0.3883450569,
+    0.3996242103,
+    0.4108431818,
+    0.4220002818,
+    0.4330938301,
+    0.4441221560,
+    0.4550835988,
+    0.4659765077,
+    0.4767992422,
+    0.4875501725,
+    0.4982276796,
+    0.5088301553,
+    0.5193560032,
+    0.5298036379,
+    0.5401714861,
+    0.5504579865,
+    0.5606615899,
+    0.5707807598,
+    0.5808139721,
+    0.5907597160,
+    0.6006164937,
+    0.6103828207,
+    0.6200572264,
+    0.6296382536,
+    0.6391244597,
+    0.6485144160,
+    0.6578067083,
+    0.6669999374,
+    0.6760927188,
+    0.6850836831,
+    0.6939714763,
+    0.7027547599,
+    0.7114322112,
+    0.7200025235,
+    0.7284644060,
+    0.7368165845,
+    0.7450578010,
+    0.7531868147,
+    0.7612024011,
+    0.7691033533,
+    0.7768884813,
+    0.7845566127,
+    0.7921065928,
+    0.7995372846,
+    0.8068475690,
+    0.8140363451,
+    0.8211025303,
+    0.8280450605,
+    0.8348628901,
+    0.8415549925,
+    0.8481203597,
+    0.8545580032,
+    0.8608669533,
+    0.8670462601,
+    0.8730949928,
+    0.8790122407,
+    0.8847971125,
+    0.8904487372,
+    0.8959662635,
+    0.9013488606,
+    0.9065957178,
+    0.9117060451,
+    0.9166790728,
+    0.9215140520,
+    0.9262102546,
+    0.9307669733,
+    0.9351835219,
+    0.9394592352,
+    0.9435934695,
+    0.9475856021,
+    0.9514350317,
+    0.9551411788,
+    0.9587034850,
+    0.9621214141,
+    0.9653944512,
+    0.9685221034,
+    0.9715038998,
+    0.9743393912,
+    0.9770281507,
+    0.9795697733,
+    0.9819638764,
+    0.9842100992,
+    0.9863081037,
+    0.9882575738,
+    0.9900582159,
+    0.9917097588,
+    0.9932119539,
+    0.9945645750,
+    0.9957674182,
+    0.9968203026,
+    0.9977230695,
+    0.9984755829,
+    0.9990777296,
+    0.9995294188,
+    0.9998305826,
+    0.9999811755,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000
+};
+
+real_t ld_mid_480[] =
+{
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0000000000,
+    0.0065449381,
+    0.0196336930,
+    0.0327190837,
+    0.0457988682,
+    0.0588708053,
+    0.0719326552,
+    0.0849821797,
+    0.0980171430,
+    0.1110353116,
+    0.1240344549,
+    0.1370123455,
+    0.1499667597,
+    0.1628954779,
+    0.1757962848,
+    0.1886669699,
+    0.2015053279,
+    0.2143091589,
+    0.2270762692,
+    0.2398044712,
+    0.2524915839,
+    0.2651354334,
+    0.2777338534,
+    0.2902846851,
+    0.3027857780,
+    0.3152349901,
+    0.3276301883,
+    0.3399692488,
+    0.3522500573,
+    0.3644705095,
+    0.3766285116,
+    0.3887219804,
+    0.4007488436,
+    0.4127070406,
+    0.4245945223,
+    0.4364092520,
+    0.4481492051,
+    0.4598123703,
+    0.4713967489,
+    0.4829003561,
+    0.4943212208,
+    0.5056573861,
+    0.5169069096,
+    0.5280678638,
+    0.5391383363,
+    0.5501164301,
+    0.5610002644,
+    0.5717879741,
+    0.5824777109,
+    0.5930676432,
+    0.6035559563,
+    0.6139408533,
+    0.6242205546,
+    0.6343932989,
+    0.6444573433,
+    0.6544109631,
+    0.6642524530,
+    0.6739801267,
+    0.6835923173,
+    0.6930873779,
+    0.7024636815,
+    0.7117196216,
+    0.7208536122,
+    0.7298640883,
+    0.7387495058,
+    0.7475083425,
+    0.7561390974,
+    0.7646402918,
+    0.7730104690,
+    0.7812481948,
+    0.7893520577,
+    0.7973206693,
+    0.8051526640,
+    0.8128467000,
+    0.8204014588,
+    0.8278156461,
+    0.8350879914,
+    0.8422172487,
+    0.8492021964,
+    0.8560416377,
+    0.8627344006,
+    0.8692793384,
+    0.8756753297,
+    0.8819212785,
+    0.8880161146,
+    0.8939587938,
+    0.8997482976,
+    0.9053836343,
+    0.9108638381,
+    0.9161879700,
+    0.9213551179,
+    0.9263643963,
+    0.9312149469,
+    0.9359059386,
+    0.9404365677,
+    0.9448060577,
+    0.9490136602,
+    0.9530586539,
+    0.9569403460,
+    0.9606580713,
+    0.9642111928,
+    0.9675991016,
+    0.9708212173,
+    0.9738769878,
+    0.9767658894,
+    0.9794874272,
+    0.9820411349,
+    0.9844265749,
+    0.9866433385,
+    0.9886910458,
+    0.9905693459,
+    0.9922779171,
+    0.9938164666,
+    0.9951847307,
+    0.9963824750,
+    0.9974094943,
+    0.9982656127,
+    0.9989506833,
+    0.9994645889,
+    0.9998072413,
+    0.9999785819,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000,
+    1.0000000000
+};
+#endif
+
+#else
+
+real_t sine_long_1024[] =
+{
+    0x3243F,
+    0x96CBD,
+    0xFB53A,
+    0x15FDB5,
+    0x1C462C,
+    0x228E9E,
+    0x28D70C,
+    0x2F1F73,
+    0x3567D2,
+    0x3BB02A,
+    0x41F878,
+    0x4840BD,
+    0x4E88F6,
+    0x54D123,
+    0x5B1942,
+    0x616154,
+    0x67A957,
+    0x6DF14A,
+    0x74392C,
+    0x7A80FC,
+    0x80C8B9,
+    0x871062,
+    0x8D57F6,
+    0x939F75,
+    0x99E6DC,
+    0xA02E2C,
+    0xA67564,
+    0xACBC81,
+    0xB30385,
+    0xB94A6C,
+    0xBF9137,
+    0xC5D7E4,
+    0xCC1E73,
+    0xD264E2,
+    0xD8AB31,
+    0xDEF15F,
+    0xE5376A,
+    0xEB7D51,
+    0xF1C315,
+    0xF808B3,
+    0xFE4E2B,
+    0x104937C,
+    0x10AD8A4,
+    0x1111DA3,
+    0x1176279,
+    0x11DA723,
+    0x123EBA1,
+    0x12A2FF2,
+    0x1307415,
+    0x136B809,
+    0x13CFBCD,
+    0x1433F61,
+    0x14982C2,
+    0x14FC5F1,
+    0x15608EC,
+    0x15C4BB2,
+    0x1628E42,
+    0x168D09C,
+    0x16F12BE,
+    0x17554A8,
+    0x17B9658,
+    0x181D7CD,
+    0x1881907,
+    0x18E5A04,
+    0x1949AC4,
+    0x19ADB46,
+    0x1A11B88,
+    0x1A75B8A,
+    0x1AD9B4B,
+    0x1B3DAC9,
+    0x1BA1A04,
+    0x1C058FB,
+    0x1C697AD,
+    0x1CCD619,
+    0x1D3143D,
+    0x1D9521A,
+    0x1DF8FAE,
+    0x1E5CCF7,
+    0x1EC09F6,
+    0x1F246A9,
+    0x1F8830F,
+    0x1FEBF27,
+    0x204FAF1,
+    0x20B366B,
+    0x2117194,
+    0x217AC6B,
+    0x21DE6F0,
+    0x2242121,
+    0x22A5AFE,
+    0x2309485,
+    0x236CDB6,
+    0x23D0690,
+    0x2433F11,
+    0x2497738,
+    0x24FAF06,
+    0x255E678,
+    0x25C1D8E,
+    0x2625447,
+    0x2688AA1,
+    0x26EC09D,
+    0x274F638,
+    0x27B2B73,
+    0x281604C,
+    0x28794C1,
+    0x28DC8D3,
+    0x293FC80,
+    0x29A2FC7,
+    0x2A062A8,
+    0x2A69521,
+    0x2ACC731,
+    0x2B2F8D8,
+    0x2B92A14,
+    0x2BF5AE4,
+    0x2C58B48,
+    0x2CBBB3F,
+    0x2D1EAC7,
+    0x2D819E0,
+    0x2DE4889,
+    0x2E476C0,
+    0x2EAA485,
+    0x2F0D1D7,
+    0x2F6FEB5,
+    0x2FD2B1E,
+    0x3035711,
+    0x309828D,
+    0x30FAD91,
+    0x315D81C,
+    0x31C022E,
+    0x3222BC4,
+    0x32854DF,
+    0x32E7D7E,
+    0x334A59E,
+    0x33ACD41,
+    0x340F463,
+    0x3471B05,
+    0x34D4126,
+    0x35366C5,
+    0x3598BE0,
+    0x35FB077,
+    0x365D488,
+    0x36BF814,
+    0x3721B18,
+    0x3783D95,
+    0x37E5F88,
+    0x38480F2,
+    0x38AA1D1,
+    0x390C223,
+    0x396E1EA,
+    0x39D0122,
+    0x3A31FCC,
+    0x3A93DE6,
+    0x3AF5B70,
+    0x3B57868,
+    0x3BB94CD,
+    0x3C1B0A0,
+    0x3C7CBDE,
+    0x3CDE687,
+    0x3D40099,
+    0x3DA1A15,
+    0x3E032F8,
+    0x3E64B43,
+    0x3EC62F3,
+    0x3F27A09,
+    0x3F89083,
+    0x3FEA660,
+    0x404BB9F,
+    0x40AD03F,
+    0x410E441,
+    0x416F7A1,
+    0x41D0A60,
+    0x4231C7D,
+    0x4292DF6,
+    0x42F3ECB,
+    0x4354EFB,
+    0x43B5E85,
+    0x4416D68,
+    0x4477BA2,
+    0x44D8934,
+    0x453961C,
+    0x459A259,
+    0x45FADEB,
+    0x465B8CF,
+    0x46BC306,
+    0x471CC8F,
+    0x477D568,
+    0x47DDD91,
+    0x483E508,
+    0x489EBCD,
+    0x48FF1DF,
+    0x495F73D,
+    0x49BFBE6,
+    0x4A1FFD8,
+    0x4A80314,
+    0x4AE0598,
+    0x4B40764,
+    0x4BA0875,
+    0x4C008CD,
+    0x4C60868,
+    0x4CC0747,
+    0x4D20569,
+    0x4D802CC,
+    0x4DDFF70,
+    0x4E3FB54,
+    0x4E9F677,
+    0x4EFF0D8,
+    0x4F5EA76,
+    0x4FBE351,
+    0x501DB66,
+    0x507D2B6,
+    0x50DC93F,
+    0x513BF01,
+    0x519B3FA,
+    0x51FA82A,
+    0x5259B8F,
+    0x52B8E2A,
+    0x5317FF8,
+    0x53770F9,
+    0x53D612D,
+    0x5435091,
+    0x5493F26,
+    0x54F2CEA,
+    0x55519DC,
+    0x55B05FC,
+    0x560F149,
+    0x566DBC1,
+    0x56CC564,
+    0x572AE30,
+    0x5789626,
+    0x57E7D44,
+    0x5846388,
+    0x58A48F3,
+    0x5902D84,
+    0x5961138,
+    0x59BF410,
+    0x5A1D60B,
+    0x5A7B727,
+    0x5AD9764,
+    0x5B376C1,
+    0x5B9553D,
+    0x5BF32D6,
+    0x5C50F8D,
+    0x5CAEB60,
+    0x5D0C64F,
+    0x5D6A058,
+    0x5DC797A,
+    0x5E251B5,
+    0x5E82908,
+    0x5EDFF71,
+    0x5F3D4F1,
+    0x5F9A985,
+    0x5FF7D2E,
+    0x6054FE9,
+    0x60B21B8,
+    0x610F297,
+    0x616C287,
+    0x61C9187,
+    0x6225F95,
+    0x6282CB1,
+    0x62DF8DA,
+    0x633C40F,
+    0x6398E4F,
+    0x63F579A,
+    0x6451FEE,
+    0x64AE74A,
+    0x650ADAE,
+    0x6567319,
+    0x65C3789,
+    0x661FAFE,
+    0x667BD78,
+    0x66D7EF4,
+    0x6733F73,
+    0x678FEF3,
+    0x67EBD74,
+    0x6847AF4,
+    0x68A3772,
+    0x68FF2EF,
+    0x695AD69,
+    0x69B66DE,
+    0x6A11F4F,
+    0x6A6D6BA,
+    0x6AC8D1F,
+    0x6B2427C,
+    0x6B7F6D0,
+    0x6BDAA1C,
+    0x6C35C5D,
+    0x6C90D93,
+    0x6CEBDBE,
+    0x6D46CDB,
+    0x6DA1AEB,
+    0x6DFC7ED,
+    0x6E573DF,
+    0x6EB1EC1,
+    0x6F0C891,
+    0x6F67150,
+    0x6FC18FC,
+    0x701BF94,
+    0x7076518,
+    0x70D0986,
+    0x712ACDD,
+    0x7184F1E,
+    0x71DF046,
+    0x7239055,
+    0x7292F4B,
+    0x72ECD26,
+    0x73469E5,
+    0x73A0588,
+    0x73FA00D,
+    0x7453975,
+    0x74AD1BD,
+    0x75068E6,
+    0x755FEED,
+    0x75B93D3,
+    0x7612797,
+    0x766BA37,
+    0x76C4BB3,
+    0x771DC0A,
+    0x7776B3C,
+    0x77CF946,
+    0x7828629,
+    0x78811E3,
+    0x78D9C74,
+    0x79325DB,
+    0x798AE16,
+    0x79E3526,
+    0x7A3BB09,
+    0x7A93FBF,
+    0x7AEC346,
+    0x7B4459E,
+    0x7B9C6C5,
+    0x7BF46BC,
+    0x7C4C581,
+    0x7CA4313,
+    0x7CFBF71,
+    0x7D53A9B,
+    0x7DAB490,
+    0x7E02D4F,
+    0x7E5A4D7,
+    0x7EB1B27,
+    0x7F0903F,
+    0x7F6041D,
+    0x7FB76C0,
+    0x800E829,
+    0x8065856,
+    0x80BC746,
+    0x81134F8,
+    0x816A16C,
+    0x81C0CA0,
+    0x8217694,
+    0x826DF48,
+    0x82C46B9,
+    0x831ACE8,
+    0x83711D3,
+    0x83C757A,
+    0x841D7DC,
+    0x84738F8,
+    0x84C98CD,
+    0x851F75B,
+    0x85754A0,
+    0x85CB09B,
+    0x8620B4D,
+    0x86764B4,
+    0x86CBCCE,
+    0x872139D,
+    0x877691D,
+    0x87CBD50,
+    0x8821034,
+    0x88761C7,
+    0x88CB20A,
+    0x89200FC,
+    0x8974E9B,
+    0x89C9AE7,
+    0x8A1E5DE,
+    0x8A72F82,
+    0x8AC77CF,
+    0x8B1BEC6,
+    0x8B70466,
+    0x8BC48AE,
+    0x8C18B9D,
+    0x8C6CD32,
+    0x8CC0D6D,
+    0x8D14C4C,
+    0x8D689D0,
+    0x8DBC5F6,
+    0x8E100BF,
+    0x8E63A29,
+    0x8EB7234,
+    0x8F0A8DF,
+    0x8F5DE29,
+    0x8FB1211,
+    0x9004496,
+    0x90575B9,
+    0x90AA577,
+    0x90FD3D0,
+    0x91500C3,
+    0x91A2C50,
+    0x91F5675,
+    0x9247F33,
+    0x929A687,
+    0x92ECC72,
+    0x933F0F2,
+    0x9391407,
+    0x93E35AF,
+    0x94355EB,
+    0x94874B9,
+    0x94D9219,
+    0x952AE09,
+    0x957C88A,
+    0x95CE199,
+    0x961F937,
+    0x9670F62,
+    0x96C241B,
+    0x971375F,
+    0x976492E,
+    0x97B5988,
+    0x980686C,
+    0x98575D8,
+    0x98A81CD,
+    0x98F8C49,
+    0x994954C,
+    0x9999CD4,
+    0x99EA2E1,
+    0x9A3A773,
+    0x9A8AA88,
+    0x9ADAC1F,
+    0x9B2AC39,
+    0x9B7AAD4,
+    0x9BCA7EF,
+    0x9C1A389,
+    0x9C69DA3,
+    0x9CB963A,
+    0x9D08D4F,
+    0x9D582E1,
+    0x9DA76EE,
+    0x9DF6976,
+    0x9E45A79,
+    0x9E949F5,
+    0x9EE37E9,
+    0x9F32456,
+    0x9F80F3A,
+    0x9FCF894,
+    0xA01E064,
+    0xA06C6A9,
+    0xA0BAB62,
+    0xA108E8E,
+    0xA15702D,
+    0xA1A503E,
+    0xA1F2EC0,
+    0xA240BB3,
+    0xA28E715,
+    0xA2DC0E6,
+    0xA329925,
+    0xA376FD2,
+    0xA3C44EC,
+    0xA411871,
+    0xA45EA61,
+    0xA4ABABC,
+    0xA4F8981,
+    0xA5456AE,
+    0xA592244,
+    0xA5DEC41,
+    0xA62B4A5,
+    0xA677B6F,
+    0xA6C409E,
+    0xA710432,
+    0xA75C62A,
+    0xA7A8684,
+    0xA7F4541,
+    0xA840260,
+    0xA88BDDF,
+    0xA8D77BE,
+    0xA922FFD,
+    0xA96E69B,
+    0xA9B9B96,
+    0xAA04EEF,
+    0xAA500A4,
+    0xAA9B0B5,
+    0xAAE5F21,
+    0xAB30BE8,
+    0xAB7B707,
+    0xABC6080,
+    0xAC10851,
+    0xAC5AE7A,
+    0xACA52F9,
+    0xACEF5CE,
+    0xAD396F9,
+    0xAD83678,
+    0xADCD44B,
+    0xAE17071,
+    0xAE60AE9,
+    0xAEAA3B4,
+    0xAEF3ACF,
+    0xAF3D03B,
+    0xAF863F6,
+    0xAFCF600,
+    0xB018658,
+    0xB0614FE,
+    0xB0AA1F1,
+    0xB0F2D30,
+    0xB13B6BA,
+    0xB183E8F,
+    0xB1CC4AE,
+    0xB214916,
+    0xB25CBC7,
+    0xB2A4CC0,
+    0xB2ECBFF,
+    0xB334986,
+    0xB37C552,
+    0xB3C3F64,
+    0xB40B7B9,
+    0xB452E53,
+    0xB49A330,
+    0xB4E164F,
+    0xB5287AF,
+    0xB56F751,
+    0xB5B6533,
+    0xB5FD155,
+    0xB643BB6,
+    0xB68A455,
+    0xB6D0B31,
+    0xB71704B,
+    0xB75D3A0,
+    0xB7A3532,
+    0xB7E94FE,
+    0xB82F304,
+    0xB874F44,
+    0xB8BA9BD,
+    0xB90026E,
+    0xB945957,
+    0xB98AE76,
+    0xB9D01CC,
+    0xBA15357,
+    0xBA5A317,
+    0xBA9F10B,
+    0xBAE3D33,
+    0xBB2878D,
+    0xBB6D01A,
+    0xBBB16D9,
+    0xBBF5BC8,
+    0xBC39EE7,
+    0xBC7E036,
+    0xBCC1FB4,
+    0xBD05D60,
+    0xBD4993A,
+    0xBD8D341,
+    0xBDD0B74,
+    0xBE141D3,
+    0xBE5765C,
+    0xBE9A910,
+    0xBEDD9EE,
+    0xBF208F5,
+    0xBF63624,
+    0xBFA617B,
+    0xBFE8AF9,
+    0xC02B29E,
+    0xC06D868,
+    0xC0AFC58,
+    0xC0F1E6C,
+    0xC133EA4,
+    0xC175D00,
+    0xC1B797E,
+    0xC1F941E,
+    0xC23ACDF,
+    0xC27C3C2,
+    0xC2BD8C4,
+    0xC2FEBE6,
+    0xC33FD27,
+    0xC380C86,
+    0xC3C1A02,
+    0xC40259C,
+    0xC442F52,
+    0xC483724,
+    0xC4C3D10,
+    0xC504118,
+    0xC544339,
+    0xC584373,
+    0xC5C41C7,
+    0xC603E32,
+    0xC6438B4,
+    0xC68314E,
+    0xC6C27FD,
+    0xC701CC2,
+    0xC740F9D,
+    0xC78008B,
+    0xC7BEF8D,
+    0xC7FDCA3,
+    0xC83C7CB,
+    0xC87B104,
+    0xC8B9850,
+    0xC8F7DAC,
+    0xC936118,
+    0xC974293,
+    0xC9B221E,
+    0xC9EFFB7,
+    0xCA2DB5D,
+    0xCA6B511,
+    0xCAA8CD1,
+    0xCAE629E,
+    0xCB23675,
+    0xCB60858,
+    0xCB9D844,
+    0xCBDA63A,
+    0xCC1723A,
+    0xCC53C41,
+    0xCC90451,
+    0xCCCCA67,
+    0xCD08E85,
+    0xCD450A8,
+    0xCD810D1,
+    0xCDBCEFF,
+    0xCDF8B32,
+    0xCE34568,
+    0xCE6FDA1,
+    0xCEAB3DD,
+    0xCEE681B,
+    0xCF21A5A,
+    0xCF5CA9B,
+    0xCF978DC,
+    0xCFD251C,
+    0xD00CF5C,
+    0xD04779A,
+    0xD081DD7,
+    0xD0BC211,
+    0xD0F6448,
+    0xD13047C,
+    0xD16A2AB,
+    0xD1A3ED5,
+    0xD1DD8FB,
+    0xD21711A,
+    0xD250733,
+    0xD289B46,
+    0xD2C2D50,
+    0xD2FBD53,
+    0xD334B4D,
+    0xD36D73E,
+    0xD3A6125,
+    0xD3DE902,
+    0xD416ED5,
+    0xD44F29C,
+    0xD487457,
+    0xD4BF406,
+    0xD4F71A7,
+    0xD52ED3C,
+    0xD5666C2,
+    0xD59DE3A,
+    0xD5D53A3,
+    0xD60C6FC,
+    0xD643845,
+    0xD67A77D,
+    0xD6B14A4,
+    0xD6E7FB9,
+    0xD71E8BC,
+    0xD754FAD,
+    0xD78B48A,
+    0xD7C1753,
+    0xD7F7808,
+    0xD82D6A8,
+    0xD863332,
+    0xD898DA7,
+    0xD8CE605,
+    0xD903C4C,
+    0xD93907C,
+    0xD96E294,
+    0xD9A3293,
+    0xD9D8079,
+    0xDA0CC46,
+    0xDA415F9,
+    0xDA75D91,
+    0xDAAA30E,
+    0xDADE670,
+    0xDB127B6,
+    0xDB466DF,
+    0xDB7A3EB,
+    0xDBADEDA,
+    0xDBE17AA,
+    0xDC14E5C,
+    0xDC482EF,
+    0xDC7B562,
+    0xDCAE5B6,
+    0xDCE13E9,
+    0xDD13FFB,
+    0xDD469EB,
+    0xDD791B9,
+    0xDDAB765,
+    0xDDDDAEE,
+    0xDE0FC54,
+    0xDE41B96,
+    0xDE738B3,
+    0xDEA53AB,
+    0xDED6C7E,
+    0xDF0832C,
+    0xDF397B3,
+    0xDF6AA13,
+    0xDF9BA4C,
+    0xDFCC85D,
+    0xDFFD446,
+    0xE02DE06,
+    0xE05E59D,
+    0xE08EB0A,
+    0xE0BEE4E,
+    0xE0EEF67,
+    0xE11EE55,
+    0xE14EB17,
+    0xE17E5AE,
+    0xE1ADE18,
+    0xE1DD455,
+    0xE20C865,
+    0xE23BA47,
+    0xE26A9FB,
+    0xE299781,
+    0xE2C82D7,
+    0xE2F6BFE,
+    0xE3252F4,
+    0xE3537BB,
+    0xE381A50,
+    0xE3AFAB4,
+    0xE3DD8E6,
+    0xE40B4E6,
+    0xE438EB3,
+    0xE46664D,
+    0xE493BB4,
+    0xE4C0EE7,
+    0xE4EDFE5,
+    0xE51AEAE,
+    0xE547B42,
+    0xE5745A0,
+    0xE5A0DC9,
+    0xE5CD3BA,
+    0xE5F9775,
+    0xE6258F8,
+    0xE651843,
+    0xE67D556,
+    0xE6A9030,
+    0xE6D48D1,
+    0xE6FFF39,
+    0xE72B366,
+    0xE75655A,
+    0xE781512,
+    0xE7AC28F,
+    0xE7D6DD1,
+    0xE8016D6,
+    0xE82BD9F,
+    0xE85622C,
+    0xE88047B,
+    0xE8AA48C,
+    0xE8D425F,
+    0xE8FDDF4,
+    0xE92774A,
+    0xE950E60,
+    0xE97A337,
+    0xE9A35CE,
+    0xE9CC624,
+    0xE9F5439,
+    0xEA1E00E,
+    0xEA469A0,
+    0xEA6F0F0,
+    0xEA975FE,
+    0xEABF8CA,
+    0xEAE7952,
+    0xEB0F796,
+    0xEB37396,
+    0xEB5ED52,
+    0xEB864C9,
+    0xEBAD9FC,
+    0xEBD4CE8,
+    0xEBFBD8F,
+    0xEC22BEF,
+    0xEC49809,
+    0xEC701DC,
+    0xEC96967,
+    0xECBCEAB,
+    0xECE31A6,
+    0xED09259,
+    0xED2F0C3,
+    0xED54CE4,
+    0xED7A6BC,
+    0xED9FE49,
+    0xEDC538C,
+    0xEDEA685,
+    0xEE0F732,
+    0xEE34594,
+    0xEE591AA,
+    0xEE7DB74,
+    0xEEA22F2,
+    0xEEC6823,
+    0xEEEAB06,
+    0xEF0EB9D,
+    0xEF329E5,
+    0xEF565DF,
+    0xEF79F8B,
+    0xEF9D6E7,
+    0xEFC0BF5,
+    0xEFE3EB3,
+    0xF006F21,
+    0xF029D3F,
+    0xF04C90C,
+    0xF06F288,
+    0xF0919B3,
+    0xF0B3E8D,
+    0xF0D6114,
+    0xF0F8149,
+    0xF119F2C,
+    0xF13BABC,
+    0xF15D3F9,
+    0xF17EAE2,
+    0xF19FF77,
+    0xF1C11B8,
+    0xF1E21A4,
+    0xF202F3C,
+    0xF223A7F,
+    0xF24436C,
+    0xF264A03,
+    0xF284E44,
+    0xF2A502F,
+    0xF2C4FC3,
+    0xF2E4D01,
+    0xF3047E6,
+    0xF324075,
+    0xF3436AB,
+    0xF362A89,
+    0xF381C0F,
+    0xF3A0B3B,
+    0xF3BF80F,
+    0xF3DE289,
+    0xF3FCAAA,
+    0xF41B070,
+    0xF4393DC,
+    0xF4574EE,
+    0xF4753A4,
+    0xF493000,
+    0xF4B0A00,
+    0xF4CE1A4,
+    0xF4EB6EC,
+    0xF5089D8,
+    0xF525A67,
+    0xF54289A,
+    0xF55F46F,
+    0xF57BDE7,
+    0xF598501,
+    0xF5B49BD,
+    0xF5D0C1B,
+    0xF5ECC1A,
+    0xF6089BB,
+    0xF6244FD,
+    0xF63FDDF,
+    0xF65B461,
+    0xF676884,
+    0xF691A47,
+    0xF6AC9A9,
+    0xF6C76AA,
+    0xF6E214B,
+    0xF6FC98B,
+    0xF716F69,
+    0xF7312E5,
+    0xF74B400,
+    0xF7652B8,
+    0xF77EF0E,
+    0xF798901,
+    0xF7B2092,
+    0xF7CB5BF,
+    0xF7E4888,
+    0xF7FD8EF,
+    0xF8166F1,
+    0xF82F28F,
+    0xF847BC9,
+    0xF86029E,
+    0xF87870E,
+    0xF890919,
+    0xF8A88BF,
+    0xF8C05FF,
+    0xF8D80DA,
+    0xF8EF94E,
+    0xF906F5D,
+    0xF91E305,
+    0xF935446,
+    0xF94C320,
+    0xF962F93,
+    0xF97999F,
+    0xF990144,
+    0xF9A6680,
+    0xF9BC955,
+    0xF9D29C1,
+    0xF9E87C5,
+    0xF9FE360,
+    0xFA13C93,
+    0xFA2935C,
+    0xFA3E7BC,
+    0xFA539B3,
+    0xFA68940,
+    0xFA7D663,
+    0xFA9211D,
+    0xFAA696C,
+    0xFABAF50,
+    0xFACF2CA,
+    0xFAE33D9,
+    0xFAF727D,
+    0xFB0AEB5,
+    0xFB1E883,
+    0xFB31FE4,
+    0xFB454DA,
+    0xFB58764,
+    0xFB6B782,
+    0xFB7E533,
+    0xFB91078,
+    0xFBA3950,
+    0xFBB5FBB,
+    0xFBC83B9,
+    0xFBDA54A,
+    0xFBEC46E,
+    0xFBFE124,
+    0xFC0FB6C,
+    0xFC21346,
+    0xFC328B2,
+    0xFC43BB0,
+    0xFC54C3F,
+    0xFC65A60,
+    0xFC76612,
+    0xFC86F55,
+    0xFC97629,
+    0xFCA7A8D,
+    0xFCB7C83,
+    0xFCC7C08,
+    0xFCD791F,
+    0xFCE73C5,
+    0xFCF6BFB,
+    0xFD061C1,
+    0xFD15517,
+    0xFD245FC,
+    0xFD33471,
+    0xFD42074,
+    0xFD50A07,
+    0xFD5F129,
+    0xFD6D5DA,
+    0xFD7B81A,
+    0xFD897E8,
+    0xFD97544,
+    0xFDA502F,
+    0xFDB28A8,
+    0xFDBFEAF,
+    0xFDCD244,
+    0xFDDA366,
+    0xFDE7217,
+    0xFDF3E54,
+    0xFE00820,
+    0xFE0CF78,
+    0xFE1945E,
+    0xFE256D0,
+    0xFE316D0,
+    0xFE3D45C,
+    0xFE48F75,
+    0xFE5481B,
+    0xFE5FE4D,
+    0xFE6B20C,
+    0xFE76356,
+    0xFE8122D,
+    0xFE8BE90,
+    0xFE9687F,
+    0xFEA0FFA,
+    0xFEAB500,
+    0xFEB5792,
+    0xFEBF7AF,
+    0xFEC9558,
+    0xFED308D,
+    0xFEDC94C,
+    0xFEE5F97,
+    0xFEEF36D,
+    0xFEF84CE,
+    0xFF013B9,
+    0xFF0A030,
+    0xFF12A31,
+    0xFF1B1BD,
+    0xFF236D3,
+    0xFF2B974,
+    0xFF3399F,
+    0xFF3B754,
+    0xFF43294,
+    0xFF4AB5E,
+    0xFF521B2,
+    0xFF59590,
+    0xFF606F8,
+    0xFF675EA,
+    0xFF6E266,
+    0xFF74C6B,
+    0xFF7B3FA,
+    0xFF81913,
+    0xFF87BB5,
+    0xFF8DBE1,
+    0xFF93996,
+    0xFF994D5,
+    0xFF9ED9D,
+    0xFFA43EE,
+    0xFFA97C9,
+    0xFFAE92D,
+    0xFFB3819,
+    0xFFB848F,
+    0xFFBCE8E,
+    0xFFC1616,
+    0xFFC5B27,
+    0xFFC9DC1,
+    0xFFCDDE3,
+    0xFFD1B8F,
+    0xFFD56C3,
+    0xFFD8F80,
+    0xFFDC5C6,
+    0xFFDF994,
+    0xFFE2AEB,
+    0xFFE59CB,
+    0xFFE8633,
+    0xFFEB024,
+    0xFFED79E,
+    0xFFEFCA0,
+    0xFFF1F2A,
+    0xFFF3F3D,
+    0xFFF5CD9,
+    0xFFF77FC,
+    0xFFF90A9,
+    0xFFFA6DD,
+    0xFFFBA9B,
+    0xFFFCBE0,
+    0xFFFDAAE,
+    0xFFFE704,
+    0xFFFF0E3,
+    0xFFFF84A,
+    0xFFFFD39,
+    0xFFFFFB1
+};
+
+real_t sine_long_960[] = {
+    0x359DD,
+    0xA0D97,
+    0x10C14F,
+    0x177504,
+    0x1E28B5,
+    0x24DC61,
+    0x2B9006,
+    0x3243A4,
+    0x38F738,
+    0x3FAAC3,
+    0x465E43,
+    0x4D11B6,
+    0x53C51C,
+    0x5A7873,
+    0x612BBA,
+    0x67DEF0,
+    0x6E9214,
+    0x754525,
+    0x7BF821,
+    0x82AB07,
+    0x895DD6,
+    0x90108E,
+    0x96C32B,
+    0x9D75AF,
+    0xA42817,
+    0xAADA62,
+    0xB18C8F,
+    0xB83E9D,
+    0xBEF08A,
+    0xC5A256,
+    0xCC5400,
+    0xD30585,
+    0xD9B6E6,
+    0xE06820,
+    0xE71933,
+    0xEDCA1D,
+    0xF47ADE,
+    0xFB2B74,
+    0x101DBDD,
+    0x1088C1A,
+    0x10F3C28,
+    0x115EC06,
+    0x11C9BB4,
+    0x1234B30,
+    0x129FA78,
+    0x130A98D,
+    0x137586C,
+    0x13E0714,
+    0x144B584,
+    0x14B63BC,
+    0x15211B9,
+    0x158BF7B,
+    0x15F6D01,
+    0x1661A49,
+    0x16CC752,
+    0x173741B,
+    0x17A20A3,
+    0x180CCE8,
+    0x18778EA,
+    0x18E24A7,
+    0x194D01F,
+    0x19B7B4F,
+    0x1A22638,
+    0x1A8D0D6,
+    0x1AF7B2B,
+    0x1B62533,
+    0x1BCCEEF,
+    0x1C3785D,
+    0x1CA217B,
+    0x1D0CA49,
+    0x1D772C6,
+    0x1DE1AF0,
+    0x1E4C2C6,
+    0x1EB6A47,
+    0x1F21171,
+    0x1F8B844,
+    0x1FF5EBF,
+    0x20604E0,
+    0x20CAAA6,
+    0x2135010,
+    0x219F51D,
+    0x22099CB,
+    0x2273E1A,
+    0x22DE208,
+    0x2348595,
+    0x23B28BE,
+    0x241CB83,
+    0x2486DE3,
+    0x24F0FDC,
+    0x255B16D,
+    0x25C5295,
+    0x262F354,
+    0x26993A7,
+    0x270338E,
+    0x276D307,
+    0x27D7212,
+    0x28410AD,
+    0x28AAED7,
+    0x2914C8E,
+    0x297E9D3,
+    0x29E86A3,
+    0x2A522FD,
+    0x2ABBEE0,
+    0x2B25A4C,
+    0x2B8F53E,
+    0x2BF8FB6,
+    0x2C629B3,
+    0x2CCC332,
+    0x2D35C35,
+    0x2D9F4B8,
+    0x2E08CBB,
+    0x2E7243D,
+    0x2EDBB3D,
+    0x2F451B9,
+    0x2FAE7B0,
+    0x3017D21,
+    0x308120C,
+    0x30EA66E,
+    0x3153A47,
+    0x31BCD96,
+    0x3226058,
+    0x328F28E,
+    0x32F8437,
+    0x3361550,
+    0x33CA5D8,
+    0x34335D0,
+    0x349C535,
+    0x3505406,
+    0x356E242,
+    0x35D6FE8,
+    0x363FCF7,
+    0x36A896E,
+    0x371154C,
+    0x377A08F,
+    0x37E2B36,
+    0x384B540,
+    0x38B3EAC,
+    0x391C779,
+    0x3984FA6,
+    0x39ED731,
+    0x3A55E19,
+    0x3ABE45E,
+    0x3B269FE,
+    0x3B8EEF8,
+    0x3BF734A,
+    0x3C5F6F4,
+    0x3CC79F5,
+    0x3D2FC4B,
+    0x3D97DF6,
+    0x3DFFEF3,
+    0x3E67F43,
+    0x3ECFEE3,
+    0x3F37DD3,
+    0x3F9FC11,
+    0x400799D,
+    0x406F675,
+    0x40D7298,
+    0x413EE05,
+    0x41A68BB,
+    0x420E2B8,
+    0x4275BFD,
+    0x42DD486,
+    0x4344C54,
+    0x43AC365,
+    0x44139B8,
+    0x447AF4C,
+    0x44E2420,
+    0x4549832,
+    0x45B0B82,
+    0x4617E0E,
+    0x467EFD5,
+    0x46E60D7,
+    0x474D111,
+    0x47B4084,
+    0x481AF2D,
+    0x4881D0B,
+    0x48E8A1E,
+    0x494F664,
+    0x49B61DD,
+    0x4A1CC86,
+    0x4A83660,
+    0x4AE9F68,
+    0x4B5079E,
+    0x4BB6F01,
+    0x4C1D58F,
+    0x4C83B47,
+    0x4CEA029,
+    0x4D50432,
+    0x4DB6763,
+    0x4E1C9B9,
+    0x4E82B34,
+    0x4EE8BD3,
+    0x4F4EB94,
+    0x4FB4A77,
+    0x501A87A,
+    0x508059C,
+    0x50E61DB,
+    0x514BD38,
+    0x51B17B1,
+    0x5217144,
+    0x527C9F1,
+    0x52E21B6,
+    0x5347892,
+    0x53ACE85,
+    0x541238D,
+    0x54777A9,
+    0x54DCAD7,
+    0x5541D18,
+    0x55A6E69,
+    0x560BECA,
+    0x5670E39,
+    0x56D5CB5,
+    0x573AA3E,
+    0x579F6D1,
+    0x580426F,
+    0x5868D16,
+    0x58CD6C4,
+    0x5931F79,
+    0x5996734,
+    0x59FADF3,
+    0x5A5F3B6,
+    0x5AC387B,
+    0x5B27C41,
+    0x5B8BF07,
+    0x5BF00CC,
+    0x5C54190,
+    0x5CB814F,
+    0x5D1C00B,
+    0x5D7FDC1,
+    0x5DE3A71,
+    0x5E47619,
+    0x5EAB0B9,
+    0x5F0EA4E,
+    0x5F722D9,
+    0x5FD5A58,
+    0x60390CA,
+    0x609C62E,
+    0x60FFA82,
+    0x6162DC7,
+    0x61C5FF9,
+    0x622911A,
+    0x628C126,
+    0x62EF01F,
+    0x6351E01,
+    0x63B4ACC,
+    0x6417680,
+    0x647A11B,
+    0x64DCA9B,
+    0x653F301,
+    0x65A1A4A,
+    0x6604076,
+    0x6666583,
+    0x66C8971,
+    0x672AC3F,
+    0x678CDEA,
+    0x67EEE73,
+    0x6850DD9,
+    0x68B2C19,
+    0x6914934,
+    0x6976527,
+    0x69D7FF3,
+    0x6A39995,
+    0x6A9B20D,
+    0x6AFC95A,
+    0x6B5DF7B,
+    0x6BBF46E,
+    0x6C20832,
+    0x6C81AC7,
+    0x6CE2C2C,
+    0x6D43C5F,
+    0x6DA4B5F,
+    0x6E0592B,
+    0x6E665C2,
+    0x6EC7123,
+    0x6F27B4E,
+    0x6F88440,
+    0x6FE8BF9,
+    0x7049279,
+    0x70A97BC,
+    0x7109BC4,
+    0x7169E8E,
+    0x71CA01A,
+    0x722A066,
+    0x7289F72,
+    0x72E9D3D,
+    0x73499C4,
+    0x73A9508,
+    0x7408F08,
+    0x74687C1,
+    0x74C7F34,
+    0x752755F,
+    0x7586A41,
+    0x75E5DDA,
+    0x7645027,
+    0x76A4128,
+    0x77030DC,
+    0x7761F42,
+    0x77C0C59,
+    0x781F81F,
+    0x787E295,
+    0x78DCBB8,
+    0x793B388,
+    0x7999A03,
+    0x79F7F29,
+    0x7A562F9,
+    0x7AB4571,
+    0x7B12691,
+    0x7B70658,
+    0x7BCE4C3,
+    0x7C2C1D3,
+    0x7C89D87,
+    0x7CE77DD,
+    0x7D450D4,
+    0x7DA286C,
+    0x7DFFEA3,
+    0x7E5D378,
+    0x7EBA6EB,
+    0x7F178F9,
+    0x7F749A3,
+    0x7FD18E7,
+    0x802E6C5,
+    0x808B33A,
+    0x80E7E47,
+    0x81447E9,
+    0x81A1021,
+    0x81FD6ED,
+    0x8259C4C,
+    0x82B603D,
+    0x83122BF,
+    0x836E3D1,
+    0x83CA372,
+    0x84261A1,
+    0x8481E5D,
+    0x84DD9A5,
+    0x8539378,
+    0x8594BD5,
+    0x85F02BC,
+    0x864B82A,
+    0x86A6C1F,
+    0x8701E9A,
+    0x875CF9A,
+    0x87B7F1E,
+    0x8812D25,
+    0x886D9AE,
+    0x88C84B8,
+    0x8922E42,
+    0x897D64B,
+    0x89D7CD2,
+    0x8A321D6,
+    0x8A8C556,
+    0x8AE6752,
+    0x8B407C7,
+    0x8B9A6B5,
+    0x8BF441B,
+    0x8C4DFF9,
+    0x8CA7A4C,
+    0x8D01315,
+    0x8D5AA52,
+    0x8DB4002,
+    0x8E0D424,
+    0x8E666B8,
+    0x8EBF7BB,
+    0x8F1872E,
+    0x8F71510,
+    0x8FCA15E,
+    0x9022C19,
+    0x907B53F,
+    0x90D3CD0,
+    0x912C2CA,
+    0x918472C,
+    0x91DC9F6,
+    0x9234B27,
+    0x928CABD,
+    0x92E48B7,
+    0x933C516,
+    0x9393FD6,
+    0x93EB8F9,
+    0x944307C,
+    0x949A65F,
+    0x94F1AA1,
+    0x9548D41,
+    0x959FE3E,
+    0x95F6D96,
+    0x964DB4A,
+    0x96A4758,
+    0x96FB1BE,
+    0x9751A7D,
+    0x97A8193,
+    0x97FE700,
+    0x9854AC1,
+    0x98AACD7,
+    0x9900D41,
+    0x9956BFD,
+    0x99AC90A,
+    0x9A02468,
+    0x9A57E15,
+    0x9AAD612,
+    0x9B02C5C,
+    0x9B580F3,
+    0x9BAD3D6,
+    0x9C02503,
+    0x9C5747B,
+    0x9CAC23C,
+    0x9D00E45,
+    0x9D55895,
+    0x9DAA12C,
+    0x9DFE808,
+    0x9E52D28,
+    0x9EA708C,
+    0x9EFB233,
+    0x9F4F21B,
+    0x9FA3044,
+    0x9FF6CAD,
+    0xA04A755,
+    0xA09E03B,
+    0xA0F175E,
+    0xA144CBD,
+    0xA198057,
+    0xA1EB22C,
+    0xA23E23A,
+    0xA291080,
+    0xA2E3CFF,
+    0xA3367B4,
+    0xA38909E,
+    0xA3DB7BE,
+    0xA42DD12,
+    0xA480098,
+    0xA4D2251,
+    0xA52423C,
+    0xA576056,
+    0xA5C7CA0,
+    0xA619719,
+    0xA66AFBF,
+    0xA6BC693,
+    0xA70DB92,
+    0xA75EEBC,
+    0xA7B0010,
+    0xA800F8E,
+    0xA851D34,
+    0xA8A2901,
+    0xA8F32F5,
+    0xA943B0E,
+    0xA99414D,
+    0xA9E45AF,
+    0xAA34835,
+    0xAA848DC,
+    0xAAD47A5,
+    0xAB2448E,
+    0xAB73F97,
+    0xABC38BF,
+    0xAC13004,
+    0xAC62566,
+    0xACB18E5,
+    0xAD00A7E,
+    0xAD4FA32,
+    0xAD9E7FF,
+    0xADED3E5,
+    0xAE3BDE3,
+    0xAE8A5F7,
+    0xAED8C22,
+    0xAF27061,
+    0xAF752B5,
+    0xAFC331D,
+    0xB011196,
+    0xB05EE22,
+    0xB0AC8BE,
+    0xB0FA16B,
+    0xB147827,
+    0xB194CF1,
+    0xB1E1FC8,
+    0xB22F0AC,
+    0xB27BF9C,
+    0xB2C8C97,
+    0xB31579B,
+    0xB3620AA,
+    0xB3AE7C0,
+    0xB3FACDE,
+    0xB447003,
+    0xB49312E,
+    0xB4DF05D,
+    0xB52AD91,
+    0xB5768C9,
+    0xB5C2203,
+    0xB60D93E,
+    0xB658E7B,
+    0xB6A41B8,
+    0xB6EF2F4,
+    0xB73A22E,
+    0xB784F66,
+    0xB7CFA9B,
+    0xB81A3CC,
+    0xB864AF8,
+    0xB8AF01E,
+    0xB8F933E,
+    0xB943456,
+    0xB98D367,
+    0xB9D706E,
+    0xBA20B6C,
+    0xBA6A45F,
+    0xBAB3B47,
+    0xBAFD023,
+    0xBB462F2,
+    0xBB8F3B3,
+    0xBBD8266,
+    0xBC20F09,
+    0xBC6999C,
+    0xBCB221E,
+    0xBCFA88F,
+    0xBD42CED,
+    0xBD8AF37,
+    0xBDD2F6E,
+    0xBE1AD8F,
+    0xBE6299B,
+    0xBEAA390,
+    0xBEF1B6E,
+    0xBF39135,
+    0xBF804E2,
+    0xBFC7675,
+    0xC00E5EF,
+    0xC05534D,
+    0xC09BE8F,
+    0xC0E27B4,
+    0xC128EBC,
+    0xC16F3A6,
+    0xC1B5670,
+    0xC1FB71B,
+    0xC2415A5,
+    0xC28720E,
+    0xC2CCC55,
+    0xC312479,
+    0xC357A79,
+    0xC39CE55,
+    0xC3E200C,
+    0xC426F9C,
+    0xC46BD06,
+    0xC4B0849,
+    0xC4F5164,
+    0xC539855,
+    0xC57DD1D,
+    0xC5C1FBB,
+    0xC60602D,
+    0xC649E73,
+    0xC68DA8D,
+    0xC6D1479,
+    0xC714C37,
+    0xC7581C7,
+    0xC79B526,
+    0xC7DE656,
+    0xC821554,
+    0xC864220,
+    0xC8A6CBA,
+    0xC8E9520,
+    0xC92BB53,
+    0xC96DF50,
+    0xC9B0119,
+    0xC9F20AB,
+    0xCA33E06,
+    0xCA75929,
+    0xCAB7214,
+    0xCAF88C6,
+    0xCB39D3E,
+    0xCB7AF7C,
+    0xCBBBF7E,
+    0xCBFCD44,
+    0xCC3D8CE,
+    0xCC7E21B,
+    0xCCBE929,
+    0xCCFEDF8,
+    0xCD3F088,
+    0xCD7F0D8,
+    0xCDBEEE7,
+    0xCDFEAB4,
+    0xCE3E43F,
+    0xCE7DB87,
+    0xCEBD08B,
+    0xCEFC34B,
+    0xCF3B3C6,
+    0xCF7A1FB,
+    0xCFB8DEA,
+    0xCFF7791,
+    0xD035EF1,
+    0xD074408,
+    0xD0B26D6,
+    0xD0F075A,
+    0xD12E593,
+    0xD16C181,
+    0xD1A9B24,
+    0xD1E7279,
+    0xD224782,
+    0xD261A3C,
+    0xD29EAA8,
+    0xD2DB8C5,
+    0xD318491,
+    0xD354E0D,
+    0xD391538,
+    0xD3CDA11,
+    0xD409C97,
+    0xD445CCA,
+    0xD481AA8,
+    0xD4BD633,
+    0xD4F8F68,
+    0xD534647,
+    0xD56FAD0,
+    0xD5AAD01,
+    0xD5E5CDB,
+    0xD620A5C,
+    0xD65B584,
+    0xD695E53,
+    0xD6D04C6,
+    0xD70A8DF,
+    0xD744A9C,
+    0xD77E9FD,
+    0xD7B8701,
+    0xD7F21A7,
+    0xD82B9EF,
+    0xD864FD8,
+    0xD89E362,
+    0xD8D748B,
+    0xD910354,
+    0xD948FBB,
+    0xD9819C1,
+    0xD9BA163,
+    0xD9F26A3,
+    0xDA2A97F,
+    0xDA629F6,
+    0xDA9A808,
+    0xDAD23B4,
+    0xDB09CFA,
+    0xDB413DA,
+    0xDB78851,
+    0xDBAFA61,
+    0xDBE6A07,
+    0xDC1D745,
+    0xDC54218,
+    0xDC8AA81,
+    0xDCC107F,
+    0xDCF7411,
+    0xDD2D537,
+    0xDD633F0,
+    0xDD9903B,
+    0xDDCEA18,
+    0xDE04187,
+    0xDE39686,
+    0xDE6E916,
+    0xDEA3934,
+    0xDED86E2,
+    0xDF0D21F,
+    0xDF41AE9,
+    0xDF76140,
+    0xDFAA524,
+    0xDFDE694,
+    0xE012590,
+    0xE046217,
+    0xE079C28,
+    0xE0AD3C2,
+    0xE0E08E6,
+    0xE113B93,
+    0xE146BC8,
+    0xE179984,
+    0xE1AC4C8,
+    0xE1DED92,
+    0xE2113E2,
+    0xE2437B7,
+    0xE275911,
+    0xE2A77EF,
+    0xE2D9451,
+    0xE30AE36,
+    0xE33C59E,
+    0xE36DA87,
+    0xE39ECF3,
+    0xE3CFCDF,
+    0xE400A4B,
+    0xE431538,
+    0xE461DA4,
+    0xE49238F,
+    0xE4C26F8,
+    0xE4F27DF,
+    0xE522643,
+    0xE552224,
+    0xE581B82,
+    0xE5B125A,
+    0xE5E06AE,
+    0xE60F87D,
+    0xE63E7C6,
+    0xE66D488,
+    0xE69BEC4,
+    0xE6CA678,
+    0xE6F8BA4,
+    0xE726E48,
+    0xE754E63,
+    0xE782BF5,
+    0xE7B06FC,
+    0xE7DDF79,
+    0xE80B56C,
+    0xE8388D2,
+    0xE8659AD,
+    0xE8927FC,
+    0xE8BF3BD,
+    0xE8EBCF1,
+    0xE918397,
+    0xE9447AF,
+    0xE970938,
+    0xE99C832,
+    0xE9C849C,
+    0xE9F3E75,
+    0xEA1F5BE,
+    0xEA4AA75,
+    0xEA75C9B,
+    0xEAA0C2E,
+    0xEACB92F,
+    0xEAF639D,
+    0xEB20B77,
+    0xEB4B0BD,
+    0xEB7536E,
+    0xEB9F38B,
+    0xEBC9111,
+    0xEBF2C02,
+    0xEC1C45D,
+    0xEC45A21,
+    0xEC6ED4D,
+    0xEC97DE2,
+    0xECC0BDE,
+    0xECE9742,
+    0xED1200D,
+    0xED3A63E,
+    0xED629D5,
+    0xED8AAD2,
+    0xEDB2934,
+    0xEDDA4FB,
+    0xEE01E25,
+    0xEE294B4,
+    0xEE508A6,
+    0xEE779FB,
+    0xEE9E8B3,
+    0xEEC54CD,
+    0xEEEBE48,
+    0xEF12525,
+    0xEF38962,
+    0xEF5EB00,
+    0xEF849FE,
+    0xEFAA65C,
+    0xEFD0018,
+    0xEFF5734,
+    0xF01ABAE,
+    0xF03FD85,
+    0xF064CBB,
+    0xF08994D,
+    0xF0AE33C,
+    0xF0D2A88,
+    0xF0F6F2F,
+    0xF11B132,
+    0xF13F090,
+    0xF162D49,
+    0xF18675C,
+    0xF1A9EC9,
+    0xF1CD390,
+    0xF1F05AF,
+    0xF213528,
+    0xF2361F9,
+    0xF258C22,
+    0xF27B3A3,
+    0xF29D87B,
+    0xF2BFAAA,
+    0xF2E1A2F,
+    0xF30370B,
+    0xF32513C,
+    0xF3468C3,
+    0xF367D9E,
+    0xF388FCF,
+    0xF3A9F54,
+    0xF3CAC2C,
+    0xF3EB658,
+    0xF40BDD8,
+    0xF42C2AA,
+    0xF44C4CF,
+    0xF46C446,
+    0xF48C10F,
+    0xF4ABB2A,
+    0xF4CB295,
+    0xF4EA751,
+    0xF50995E,
+    0xF5288BB,
+    0xF547567,
+    0xF565F63,
+    0xF5846AE,
+    0xF5A2B48,
+    0xF5C0D30,
+    0xF5DEC67,
+    0xF5FC8EB,
+    0xF61A2BC,
+    0xF6379DB,
+    0xF654E46,
+    0xF671FFE,
+    0xF68EF02,
+    0xF6ABB52,
+    0xF6C84ED,
+    0xF6E4BD3,
+    0xF701005,
+    0xF71D181,
+    0xF739047,
+    0xF754C57,
+    0xF7705B1,
+    0xF78BC54,
+    0xF7A7040,
+    0xF7C2175,
+    0xF7DCFF3,
+    0xF7F7BB8,
+    0xF8124C6,
+    0xF82CB1B,
+    0xF846EB7,
+    0xF860F9A,
+    0xF87ADC4,
+    0xF894935,
+    0xF8AE1EB,
+    0xF8C77E8,
+    0xF8E0B2A,
+    0xF8F9BB1,
+    0xF91297E,
+    0xF92B48F,
+    0xF943CE4,
+    0xF95C27E,
+    0xF97455C,
+    0xF98C57E,
+    0xF9A42E3,
+    0xF9BBD8B,
+    0xF9D3576,
+    0xF9EAAA3,
+    0xFA01D14,
+    0xFA18CC6,
+    0xFA2F9BA,
+    0xFA463F0,
+    0xFA5CB67,
+    0xFA7301F,
+    0xFA89218,
+    0xFA9F152,
+    0xFAB4DCC,
+    0xFACA787,
+    0xFADFE81,
+    0xFAF52BB,
+    0xFB0A435,
+    0xFB1F2EE,
+    0xFB33EE6,
+    0xFB4881C,
+    0xFB5CE91,
+    0xFB71245,
+    0xFB85337,
+    0xFB99166,
+    0xFBACCD3,
+    0xFBC057E,
+    0xFBD3B66,
+    0xFBE6E8B,
+    0xFBF9EEC,
+    0xFC0CC8B,
+    0xFC1F766,
+    0xFC31F7D,
+    0xFC444CF,
+    0xFC5675E,
+    0xFC68729,
+    0xFC7A42E,
+    0xFC8BE6F,
+    0xFC9D5EB,
+    0xFCAEAA2,
+    0xFCBFC94,
+    0xFCD0BBF,
+    0xFCE1826,
+    0xFCF21C6,
+    0xFD028A0,
+    0xFD12CB4,
+    0xFD22E01,
+    0xFD32C88,
+    0xFD42848,
+    0xFD52141,
+    0xFD61772,
+    0xFD70ADD,
+    0xFD7FB80,
+    0xFD8E95B,
+    0xFD9D46E,
+    0xFDABCBA,
+    0xFDBA23D,
+    0xFDC84F8,
+    0xFDD64EB,
+    0xFDE4214,
+    0xFDF1C76,
+    0xFDFF40E,
+    0xFE0C8DD,
+    0xFE19AE3,
+    0xFE26A20,
+    0xFE33693,
+    0xFE4003C,
+    0xFE4C71C,
+    0xFE58B32,
+    0xFE64C7E,
+    0xFE70AFF,
+    0xFE7C6B7,
+    0xFE87FA4,
+    0xFE935C6,
+    0xFE9E91E,
+    0xFEA99AA,
+    0xFEB476C,
+    0xFEBF263,
+    0xFEC9A8F,
+    0xFED3FEF,
+    0xFEDE284,
+    0xFEE824E,
+    0xFEF1F4C,
+    0xFEFB97E,
+    0xFF050E4,
+    0xFF0E57F,
+    0xFF1774D,
+    0xFF2064F,
+    0xFF29286,
+    0xFF31BEF,
+    0xFF3A28D,
+    0xFF4265D,
+    0xFF4A761,
+    0xFF52599,
+    0xFF5A104,
+    0xFF619A2,
+    0xFF68F72,
+    0xFF70276,
+    0xFF772AD,
+    0xFF7E017,
+    0xFF84AB3,
+    0xFF8B282,
+    0xFF91784,
+    0xFF979B8,
+    0xFF9D91E,
+    0xFFA35B7,
+    0xFFA8F83,
+    0xFFAE680,
+    0xFFB3AB0,
+    0xFFB8C12,
+    0xFFBDAA6,
+    0xFFC266C,
+    0xFFC6F64,
+    0xFFCB58E,
+    0xFFCF8EA,
+    0xFFD3978,
+    0xFFD7738,
+    0xFFDB229,
+    0xFFDEA4C,
+    0xFFE1FA1,
+    0xFFE5227,
+    0xFFE81DF,
+    0xFFEAEC9,
+    0xFFED8E4,
+    0xFFF0030,
+    0xFFF24AF,
+    0xFFF465E,
+    0xFFF653F,
+    0xFFF8152,
+    0xFFF9A96,
+    0xFFFB10B,
+    0xFFFC4B2,
+    0xFFFD58A,
+    0xFFFE393,
+    0xFFFEECE,
+    0xFFFF73A,
+    0xFFFFCD7,
+    0xFFFFFA6
+};
+
+real_t sine_short_128[] =
+{
+    0x1921F1,
+    0x4B64DB,
+    0x7DA4DD,
+    0xAFE006,
+    0xE21468,
+    0x1144013,
+    0x1466118,
+    0x1787587,
+    0x1AA7B73,
+    0x1DC70ED,
+    0x20E5409,
+    0x24022DB,
+    0x271DB77,
+    0x2A37BF1,
+    0x2D50261,
+    0x3066CDE,
+    0x337B97F,
+    0x368E65F,
+    0x399F198,
+    0x3CAD945,
+    0x3FB9B85,
+    0x42C3675,
+    0x45CA837,
+    0x48CEEED,
+    0x4BD08B8,
+    0x4ECF3C0,
+    0x51CAE2B,
+    0x54C3622,
+    0x57B89D0,
+    0x5AAA761,
+    0x5D98D06,
+    0x60838EE,
+    0x636A94E,
+    0x664DC5B,
+    0x692D04C,
+    0x6C0835E,
+    0x6EDF3CB,
+    0x71B1FD5,
+    0x74805BD,
+    0x774A3C8,
+    0x7A0F83E,
+    0x7CD0168,
+    0x7F8BD96,
+    0x8242B16,
+    0x84F483D,
+    0x87A1361,
+    0x8A48ADB,
+    0x8CEAD08,
+    0x8F87849,
+    0x921EB01,
+    0x94B0397,
+    0x973C075,
+    0x99C200A,
+    0x9C420C6,
+    0x9EBC120,
+    0xA12FF8F,
+    0xA39DA91,
+    0xA6050A6,
+    0xA866053,
+    0xAAC0820,
+    0xAD14699,
+    0xAF61A4E,
+    0xB1A81D5,
+    0xB3E7BC6,
+    0xB6206BE,
+    0xB85215D,
+    0xBA7CA4B,
+    0xBCA002F,
+    0xBEBC1BA,
+    0xC0D0D9E,
+    0xC2DE291,
+    0xC4E3F51,
+    0xC6E229D,
+    0xC8D8B3C,
+    0xCAC77F6,
+    0xCCAE79B,
+    0xCE8D8FF,
+    0xD064AF9,
+    0xD233C68,
+    0xD3FAC2D,
+    0xD5B9930,
+    0xD77025E,
+    0xD91E6A7,
+    0xDAC4503,
+    0xDC61C6D,
+    0xDDF6BE6,
+    0xDF83274,
+    0xE106F23,
+    0xE282104,
+    0xE3F472C,
+    0xE55E0B8,
+    0xE6BECC8,
+    0xE816A82,
+    0xE965913,
+    0xEAAB7AC,
+    0xEBE8584,
+    0xED1C1D8,
+    0xEE46BE8,
+    0xEF682FF,
+    0xF080668,
+    0xF18F577,
+    0xF294F85,
+    0xF3913F0,
+    0xF48421D,
+    0xF56D977,
+    0xF64D96C,
+    0xF724173,
+    0xF7F1108,
+    0xF8B47AC,
+    0xF96E4E6,
+    0xFA1E845,
+    0xFAC515A,
+    0xFB61FC0,
+    0xFBF5316,
+    0xFC7EB01,
+    0xFCFE72C,
+    0xFD74748,
+    0xFDE0B0D,
+    0xFE43237,
+    0xFE9BC8B,
+    0xFEEA9D0,
+    0xFF2F9D8,
+    0xFF6AC77,
+    0xFF9C188,
+    0xFFC38ED,
+    0xFFE128F,
+    0xFFF4E5A,
+    0xFFFEC42
+};
+
+real_t sine_short_120[] =
+{
+    0x1ACEDD,
+    0x506B6B,
+    0x860472,
+    0xBB9798,
+    0xF12283,
+    0x126A2DB,
+    0x15C1646,
+    0x1917A6C,
+    0x1C6CCF6,
+    0x1FC0B8D,
+    0x23133DB,
+    0x266438B,
+    0x29B3849,
+    0x2D00FC3,
+    0x304C7A8,
+    0x3395DA6,
+    0x36DCF70,
+    0x3A21AB9,
+    0x3D63D36,
+    0x40A349D,
+    0x43DFEA6,
+    0x471990D,
+    0x4A5018D,
+    0x4D835E6,
+    0x50B33D8,
+    0x53DF927,
+    0x5708398,
+    0x5A2D0F4,
+    0x5D4DF07,
+    0x606AB9E,
+    0x638348A,
+    0x669779E,
+    0x69A72B2,
+    0x6CB23A0,
+    0x6FB8844,
+    0x72B9E80,
+    0x75B6437,
+    0x78AD751,
+    0x7B9F5B9,
+    0x7E8BD5E,
+    0x8172C33,
+    0x845402D,
+    0x872F749,
+    0x8A04F85,
+    0x8CD46E2,
+    0x8F9DB69,
+    0x9260B25,
+    0x951D425,
+    0x97D347F,
+    0x9A82A4A,
+    0x9D2B3A4,
+    0x9FCCEB1,
+    0xA267996,
+    0xA4FB280,
+    0xA7877A1,
+    0xAA0C72E,
+    0xAC89F62,
+    0xAEFFE7F,
+    0xB16E2CA,
+    0xB3D4A8E,
+    0xB63341D,
+    0xB889DCC,
+    0xBAD85F7,
+    0xBD1EB00,
+    0xBF5CB4E,
+    0xC19254F,
+    0xC3BF775,
+    0xC5E4039,
+    0xC7FFE1B,
+    0xCA12F9F,
+    0xCC1D351,
+    0xCE1E7C2,
+    0xD016B8A,
+    0xD205D47,
+    0xD3EBB9E,
+    0xD5C8539,
+    0xD79B8CB,
+    0xD96550A,
+    0xDB258B7,
+    0xDCDC296,
+    0xDE89173,
+    0xE02C422,
+    0xE1C597C,
+    0xE355062,
+    0xE4DA7BC,
+    0xE655E78,
+    0xE7C738C,
+    0xE92E5F5,
+    0xEA8B4B7,
+    0xEBDDEDD,
+    0xED26379,
+    0xEE641A4,
+    0xEF97881,
+    0xF0C0736,
+    0xF1DECF4,
+    0xF2F28F2,
+    0xF3FBA6E,
+    0xF4FA0AE,
+    0xF5EDAFF,
+    0xF6D68B7,
+    0xF7B4932,
+    0xF887BD4,
+    0xF950009,
+    0xFA0D544,
+    0xFABFB02,
+    0xFB670C3,
+    0xFC03614,
+    0xFC94A86,
+    0xFD1ADB3,
+    0xFD95F3E,
+    0xFE05ECF,
+    0xFE6AC18,
+    0xFEC46D2,
+    0xFF12EC0,
+    0xFF563A8,
+    0xFF8E55C,
+    0xFFBB3B6,
+    0xFFDCE94,
+    0xFFF35E0,
+    0xFFFE98A
+};
+
+#ifdef LD_DEC
+real_t sine_mid_512[] =
+{
+    0x6487E,
+    0x12D978,
+    0x1F6A66,
+    0x2BFB40,
+    0x388BFF,
+    0x451C9C,
+    0x51AD0E,
+    0x5E3D4D,
+    0x6ACD52,
+    0x775D16,
+    0x83EC90,
+    0x907BB8,
+    0x9D0A87,
+    0xA998F6,
+    0xB626FC,
+    0xC2B491,
+    0xCF41AF,
+    0xDBCE4C,
+    0xE85A62,
+    0xF4E5E9,
+    0x10170D8,
+    0x10DFB29,
+    0x11A84D3,
+    0x1270DCF,
+    0x1339615,
+    0x1401D9D,
+    0x14CA460,
+    0x1592A55,
+    0x165AF76,
+    0x17233BA,
+    0x17EB71A,
+    0x18B398D,
+    0x197BB0D,
+    0x1A43B91,
+    0x1B0BB12,
+    0x1BD3988,
+    0x1C9B6EC,
+    0x1D63335,
+    0x1E2AE5C,
+    0x1EF2859,
+    0x1FBA125,
+    0x20818B8,
+    0x2148F0A,
+    0x2210413,
+    0x22D77CC,
+    0x239EA2E,
+    0x2465B30,
+    0x252CACA,
+    0x25F38F6,
+    0x26BA5AB,
+    0x27810E2,
+    0x2847A93,
+    0x290E2B6,
+    0x29D4945,
+    0x2A9AE36,
+    0x2B61183,
+    0x2C27324,
+    0x2CED311,
+    0x2DB3142,
+    0x2E78DB1,
+    0x2F3E855,
+    0x3004126,
+    0x30C981E,
+    0x318ED34,
+    0x3254061,
+    0x331919E,
+    0x33DE0E2,
+    0x34A2E26,
+    0x3567963,
+    0x362C290,
+    0x36F09A7,
+    0x37B4EA0,
+    0x3879173,
+    0x393D218,
+    0x3A01089,
+    0x3AC4CBD,
+    0x3B886AD,
+    0x3C4BE51,
+    0x3D0F3A3,
+    0x3DD269A,
+    0x3E9572E,
+    0x3F58559,
+    0x401B113,
+    0x40DDA54,
+    0x41A0115,
+    0x426254E,
+    0x43246F8,
+    0x43E660B,
+    0x44A8280,
+    0x4569C50,
+    0x462B372,
+    0x46EC7E0,
+    0x47AD992,
+    0x486E881,
+    0x492F4A5,
+    0x49EFDF6,
+    0x4AB046D,
+    0x4B70804,
+    0x4C308B2,
+    0x4CF0670,
+    0x4DB0136,
+    0x4E6F8FE,
+    0x4F2EDC0,
+    0x4FEDF74,
+    0x50ACE13,
+    0x516B996,
+    0x522A1F6,
+    0x52E872B,
+    0x53A692D,
+    0x54647F6,
+    0x552237D,
+    0x55DFBBD,
+    0x569D0AD,
+    0x575A246,
+    0x5817081,
+    0x58D3B57,
+    0x59902C0,
+    0x5A4C6B5,
+    0x5B0872F,
+    0x5BC4426,
+    0x5C7FD93,
+    0x5D3B370,
+    0x5DF65B5,
+    0x5EB145A,
+    0x5F6BF58,
+    0x60266A9,
+    0x60E0A45,
+    0x619AA25,
+    0x6254641,
+    0x630DE93,
+    0x63C7313,
+    0x64803BB,
+    0x6539083,
+    0x65F1963,
+    0x66A9E56,
+    0x6761F53,
+    0x6819C54,
+    0x68D1551,
+    0x6988A44,
+    0x6A3FB25,
+    0x6AF67EE,
+    0x6BAD097,
+    0x6C63519,
+    0x6D1956E,
+    0x6DCF18E,
+    0x6E84972,
+    0x6F39D13,
+    0x6FEEC6B,
+    0x70A3771,
+    0x7157E20,
+    0x720C071,
+    0x72BFE5C,
+    0x73737DA,
+    0x7426CE5,
+    0x74D9D75,
+    0x758C985,
+    0x763F10C,
+    0x76F1404,
+    0x77A3266,
+    0x7854C2B,
+    0x790614D,
+    0x79B71C4,
+    0x7A67D8A,
+    0x7B18498,
+    0x7BC86E7,
+    0x7C78470,
+    0x7D27D2D,
+    0x7DD7116,
+    0x7E86026,
+    0x7F34A55,
+    0x7FE2F9C,
+    0x8090FF5,
+    0x813EB5A,
+    0x81EC1C2,
+    0x8299329,
+    0x8345F86,
+    0x83F26D4,
+    0x849E90C,
+    0x854A626,
+    0x85F5E1E,
+    0x86A10EB,
+    0x874BE87,
+    0x87F66EC,
+    0x88A0A13,
+    0x894A7F5,
+    0x89F408D,
+    0x8A9D3D3,
+    0x8B461C1,
+    0x8BEEA51,
+    0x8C96D7B,
+    0x8D3EB3A,
+    0x8DE6386,
+    0x8E8D65B,
+    0x8F343B0,
+    0x8FDAB80,
+    0x9080DC4,
+    0x9126A76,
+    0x91CC190,
+    0x927130A,
+    0x9315EDF,
+    0x93BA509,
+    0x945E580,
+    0x950203F,
+    0x95A5540,
+    0x964847B,
+    0x96EADEB,
+    0x978D18A,
+    0x982EF51,
+    0x98D073A,
+    0x997193F,
+    0x9A12559,
+    0x9AB2B83,
+    0x9B52BB6,
+    0x9BF25EC,
+    0x9C91A1F,
+    0x9D30849,
+    0x9DCF063,
+    0x9E6D267,
+    0x9F0AE51,
+    0x9FA8418,
+    0xA0453B8,
+    0xA0E1D29,
+    0xA17E067,
+    0xA219D6B,
+    0xA2B5430,
+    0xA3504AE,
+    0xA3EAEE1,
+    0xA4852C1,
+    0xA51F04A,
+    0xA5B8776,
+    0xA65183E,
+    0xA6EA29C,
+    0xA78268B,
+    0xA81A404,
+    0xA8B1B03,
+    0xA948B80,
+    0xA9DF577,
+    0xAA758E1,
+    0xAB0B5B9,
+    0xABA0BF9,
+    0xAC35B9B,
+    0xACCA499,
+    0xAD5E6EE,
+    0xADF2293,
+    0xAE85784,
+    0xAF185BB,
+    0xAFAAD31,
+    0xB03CDE2,
+    0xB0CE7C7,
+    0xB15FADB,
+    0xB1F0719,
+    0xB280C7A,
+    0xB310AFA,
+    0xB3A0292,
+    0xB42F33E,
+    0xB4BDCF7,
+    0xB54BFB8,
+    0xB5D9B7C,
+    0xB66703D,
+    0xB6F3DF6,
+    0xB7804A2,
+    0xB80C43A,
+    0xB897CBA,
+    0xB922E1C,
+    0xB9AD85A,
+    0xBA37B70,
+    0xBAC1759,
+    0xBB4AC0E,
+    0xBBD398A,
+    0xBC5BFC9,
+    0xBCE3EC4,
+    0xBD6B678,
+    0xBDF26DE,
+    0xBE78FF1,
+    0xBEFF1AC,
+    0xBF84C0B,
+    0xC009F07,
+    0xC08EA9C,
+    0xC112EC4,
+    0xC196B7B,
+    0xC21A0BB,
+    0xC29CE7F,
+    0xC31F4C3,
+    0xC3A1380,
+    0xC422AB3,
+    0xC4A3A57,
+    0xC524265,
+    0xC5A42DA,
+    0xC623BB0,
+    0xC6A2CE3,
+    0xC72166D,
+    0xC79F84A,
+    0xC81D274,
+    0xC89A4E8,
+    0xC916FA0,
+    0xC993297,
+    0xCA0EDC8,
+    0xCA8A130,
+    0xCB04CC8,
+    0xCB7F08D,
+    0xCBF8C79,
+    0xCC72088,
+    0xCCEACB5,
+    0xCD630FC,
+    0xCDDAD58,
+    0xCE521C4,
+    0xCEC8E3C,
+    0xCF3F2BB,
+    0xCFB4F3C,
+    0xD02A3BB,
+    0xD09F034,
+    0xD1134A2,
+    0xD187101,
+    0xD1FA54B,
+    0xD26D17D,
+    0xD2DF593,
+    0xD351187,
+    0xD3C2555,
+    0xD4330FA,
+    0xD4A3470,
+    0xD512FB3,
+    0xD5822C0,
+    0xD5F0D91,
+    0xD65F023,
+    0xD6CCA71,
+    0xD739C77,
+    0xD7A6631,
+    0xD81279A,
+    0xD87E0AF,
+    0xD8E916B,
+    0xD9539CB,
+    0xD9BD9C9,
+    0xDA27163,
+    0xDA90093,
+    0xDAF8757,
+    0xDB605A9,
+    0xDBC7B86,
+    0xDC2E8E9,
+    0xDC94DD0,
+    0xDCFAA36,
+    0xDD5FE17,
+    0xDDC496E,
+    0xDE28C39,
+    0xDE8C674,
+    0xDEEF81A,
+    0xDF52127,
+    0xDFB4199,
+    0xE01596B,
+    0xE076899,
+    0xE0D6F20,
+    0xE136CFB,
+    0xE196228,
+    0xE1F4EA3,
+    0xE253267,
+    0xE2B0D72,
+    0xE30DFBF,
+    0xE36A94B,
+    0xE3C6A13,
+    0xE422213,
+    0xE47D147,
+    0xE4D77AC,
+    0xE53153F,
+    0xE58A9FB,
+    0xE5E35DE,
+    0xE63B8E4,
+    0xE69330A,
+    0xE6EA44C,
+    0xE740CA7,
+    0xE796C18,
+    0xE7EC29B,
+    0xE84102D,
+    0xE8954CB,
+    0xE8E9071,
+    0xE93C31D,
+    0xE98ECCA,
+    0xE9E0D77,
+    0xEA3251F,
+    0xEA833C0,
+    0xEAD3956,
+    0xEB235DF,
+    0xEB72956,
+    0xEBC13BB,
+    0xEC0F508,
+    0xEC5CD3B,
+    0xECA9C52,
+    0xECF6249,
+    0xED41F1D,
+    0xED8D2CC,
+    0xEDD7D52,
+    0xEE21EAC,
+    0xEE6B6D9,
+    0xEEB45D4,
+    0xEEFCB9B,
+    0xEF4482C,
+    0xEF8BB83,
+    0xEFD259E,
+    0xF01867A,
+    0xF05DE14,
+    0xF0A2C6A,
+    0xF0E7179,
+    0xF12AD3E,
+    0xF16DFB8,
+    0xF1B08E2,
+    0xF1F28BB,
+    0xF233F40,
+    0xF274C6F,
+    0xF2B5044,
+    0xF2F4ABF,
+    0xF333BDB,
+    0xF372397,
+    0xF3B01F0,
+    0xF3ED6E5,
+    0xF42A271,
+    0xF466494,
+    0xF4A1D4B,
+    0xF4DCC94,
+    0xF51726B,
+    0xF550ED0,
+    0xF58A1C0,
+    0xF5C2B38,
+    0xF5FAB37,
+    0xF6321BA,
+    0xF668EBF,
+    0xF69F244,
+    0xF6D4C47,
+    0xF709CC6,
+    0xF73E3BF,
+    0xF77212F,
+    0xF7A5516,
+    0xF7D7F70,
+    0xF80A03C,
+    0xF83B778,
+    0xF86C522,
+    0xF89C939,
+    0xF8CC3B9,
+    0xF8FB4A2,
+    0xF929BF2,
+    0xF9579A7,
+    0xF984DBE,
+    0xF9B1837,
+    0xF9DD910,
+    0xFA09047,
+    0xFA33DDA,
+    0xFA5E1C7,
+    0xFA87C0D,
+    0xFAB0CAB,
+    0xFAD939F,
+    0xFB010E6,
+    0xFB28481,
+    0xFB4EE6D,
+    0xFB74EA8,
+    0xFB9A532,
+    0xFBBF208,
+    0xFBE352A,
+    0xFC06E95,
+    0xFC29E4A,
+    0xFC4C445,
+    0xFC6E087,
+    0xFC8F30D,
+    0xFCAFBD6,
+    0xFCCFAE1,
+    0xFCEF02E,
+    0xFD0DBBA,
+    0xFD2BD84,
+    0xFD4958C,
+    0xFD663D0,
+    0xFD8284F,
+    0xFD9E308,
+    0xFDB93FA,
+    0xFDD3B23,
+    0xFDED884,
+    0xFE06C1A,
+    0xFE1F5E5,
+    0xFE375E5,
+    0xFE4EC17,
+    0xFE6587B,
+    0xFE7BB10,
+    0xFE913D6,
+    0xFEA62CB,
+    0xFEBA7EF,
+    0xFECE341,
+    0xFEE14C0,
+    0xFEF3C6C,
+    0xFF05A43,
+    0xFF16E45,
+    0xFF27872,
+    0xFF378C8,
+    0xFF46F48,
+    0xFF55BF0,
+    0xFF63EC0,
+    0xFF717B7,
+    0xFF7E6D5,
+    0xFF8AC1A,
+    0xFF96785,
+    0xFFA1915,
+    0xFFAC0CA,
+    0xFFB5EA3,
+    0xFFBF2A1,
+    0xFFC7CC3,
+    0xFFCFD08,
+    0xFFD7371,
+    0xFFDDFFC,
+    0xFFE42AA,
+    0xFFE9B7B,
+    0xFFEEA6E,
+    0xFFF2F83,
+    0xFFF6AB9,
+    0xFFF9C12,
+    0xFFFC38C,
+    0xFFFE128,
+    0xFFFF4E5,
+    0xFFFFEC4
+};
+
+real_t sine_mid_480[] =
+{
+    0x6B3BA,
+    0x141B2A,
+    0x21828C,
+    0x2EE9D6,
+    0x3C50FF,
+    0x49B7FE,
+    0x571EC9,
+    0x648558,
+    0x71EB9F,
+    0x7F5197,
+    0x8CB735,
+    0x9A1C71,
+    0xA78140,
+    0xB4E59A,
+    0xC24975,
+    0xCFACC7,
+    0xDD0F88,
+    0xEA71AD,
+    0xF7D32E,
+    0x1053401,
+    0x112941D,
+    0x11FF378,
+    0x12D5209,
+    0x13AAFC7,
+    0x1480CA7,
+    0x15568A2,
+    0x162C3AD,
+    0x1701DBE,
+    0x17D76CE,
+    0x18ACED1,
+    0x19825C0,
+    0x1A57B90,
+    0x1B2D039,
+    0x1C023B0,
+    0x1CD75EC,
+    0x1DAC6E5,
+    0x1E81691,
+    0x1F564E6,
+    0x202B1DB,
+    0x20FFD67,
+    0x21D4780,
+    0x22A901E,
+    0x237D736,
+    0x2451CBF,
+    0x25260B1,
+    0x25FA302,
+    0x26CE3A8,
+    0x27A229B,
+    0x2875FD0,
+    0x2949B3F,
+    0x2A1D4DF,
+    0x2AF0CA5,
+    0x2BC4289,
+    0x2C97682,
+    0x2D6A886,
+    0x2E3D88C,
+    0x2F1068B,
+    0x2FE3279,
+    0x30B5C4E,
+    0x3188400,
+    0x325A985,
+    0x332CCD5,
+    0x33FEDE6,
+    0x34D0CB0,
+    0x35A2928,
+    0x3674346,
+    0x3745B01,
+    0x381704E,
+    0x38E8326,
+    0x39B937F,
+    0x3A8A150,
+    0x3B5AC90,
+    0x3C2B534,
+    0x3CFBB36,
+    0x3DCBE8A,
+    0x3E9BF29,
+    0x3F6BD08,
+    0x403B81F,
+    0x410B065,
+    0x41DA5D1,
+    0x42A9859,
+    0x43787F4,
+    0x444749A,
+    0x4515E41,
+    0x45E44E1,
+    0x46B286F,
+    0x47808E4,
+    0x484E635,
+    0x491C05B,
+    0x49E974C,
+    0x4AB6AFE,
+    0x4B83B6A,
+    0x4C50886,
+    0x4D1D249,
+    0x4DE98AA,
+    0x4EB5B9F,
+    0x4F81B22,
+    0x504D727,
+    0x5118FA6,
+    0x51E4497,
+    0x52AF5F0,
+    0x537A3A9,
+    0x5444DB8,
+    0x550F415,
+    0x55D96B7,
+    0x56A3595,
+    0x576D0A6,
+    0x58367E1,
+    0x58FFB3E,
+    0x59C8AB3,
+    0x5A91638,
+    0x5B59DC4,
+    0x5C2214E,
+    0x5CEA0CE,
+    0x5DB1C3A,
+    0x5E7938A,
+    0x5F406B5,
+    0x60075B3,
+    0x60CE07A,
+    0x6194702,
+    0x625A943,
+    0x6320732,
+    0x63E60C9,
+    0x64AB5FE,
+    0x65706C9,
+    0x6635320,
+    0x66F9AFC,
+    0x67BDE53,
+    0x6881D1E,
+    0x6945752,
+    0x6A08CE9,
+    0x6ACBDD9,
+    0x6B8EA1A,
+    0x6C511A3,
+    0x6D1346B,
+    0x6DD526B,
+    0x6E96B9A,
+    0x6F57FEE,
+    0x7018F60,
+    0x70D99E8,
+    0x7199F7C,
+    0x725A014,
+    0x7319BA9,
+    0x73D9231,
+    0x74983A4,
+    0x7556FFA,
+    0x761572A,
+    0x76D392C,
+    0x77915F7,
+    0x784ED84,
+    0x790BFCA,
+    0x79C8CC1,
+    0x7A85460,
+    0x7B416A0,
+    0x7BFD377,
+    0x7CB8ADE,
+    0x7D73CCC,
+    0x7E2E93A,
+    0x7EE901F,
+    0x7FA3172,
+    0x805CD2C,
+    0x8116345,
+    0x81CF3B4,
+    0x8287E72,
+    0x8340376,
+    0x83F82B8,
+    0x84AFC30,
+    0x8566FD6,
+    0x861DDA2,
+    0x86D458C,
+    0x878A78B,
+    0x8840399,
+    0x88F59AD,
+    0x89AA9BF,
+    0x8A5F3C7,
+    0x8B137BD,
+    0x8BC7599,
+    0x8C7AD54,
+    0x8D2DEE5,
+    0x8DE0A45,
+    0x8E92F6C,
+    0x8F44E51,
+    0x8FF66EE,
+    0x90A793A,
+    0x915852E,
+    0x9208AC2,
+    0x92B89ED,
+    0x93682AA,
+    0x94174EF,
+    0x94C60B4,
+    0x95745F4,
+    0x96224A5,
+    0x96CFCC0,
+    0x977CE3D,
+    0x9829916,
+    0x98D5D42,
+    0x9981AB9,
+    0x9A2D175,
+    0x9AD816D,
+    0x9B82A9B,
+    0x9C2CCF6,
+    0x9CD6878,
+    0x9D7FD18,
+    0x9E28AD0,
+    0x9ED1197,
+    0x9F79168,
+    0xA020A39,
+    0xA0C7C05,
+    0xA16E6C2,
+    0xA214A6C,
+    0xA2BA6F9,
+    0xA35FC62,
+    0xA404AA1,
+    0xA4A91AF,
+    0xA54D183,
+    0xA5F0A17,
+    0xA693B63,
+    0xA736561,
+    0xA7D880A,
+    0xA87A355,
+    0xA91B73D,
+    0xA9BC3BA,
+    0xAA5C8C4,
+    0xAAFC656,
+    0xAB9BC67,
+    0xAC3AAF2,
+    0xACD91EE,
+    0xAD77156,
+    0xAE14921,
+    0xAEB194A,
+    0xAF4E1C9,
+    0xAFEA297,
+    0xB085BAE,
+    0xB120D07,
+    0xB1BB69B,
+    0xB255863,
+    0xB2EF258,
+    0xB388474,
+    0xB420EB0,
+    0xB4B9105,
+    0xB550B6D,
+    0xB5E7DE0,
+    0xB67E859,
+    0xB714AD1,
+    0xB7AA541,
+    0xB83F7A2,
+    0xB8D41EF,
+    0xB968420,
+    0xB9FBE2E,
+    0xBA8F015,
+    0xBB219CC,
+    0xBBB3B4E,
+    0xBC45495,
+    0xBCD6599,
+    0xBD66E54,
+    0xBDF6EC1,
+    0xBE866D9,
+    0xBF15695,
+    0xBFA3DEF,
+    0xC031CE1,
+    0xC0BF365,
+    0xC14C175,
+    0xC1D870A,
+    0xC26441E,
+    0xC2EF8AB,
+    0xC37A4AC,
+    0xC404819,
+    0xC48E2ED,
+    0xC517522,
+    0xC59FEB1,
+    0xC627F96,
+    0xC6AF7C9,
+    0xC736745,
+    0xC7BCE04,
+    0xC842C00,
+    0xC8C8134,
+    0xC94CD98,
+    0xC9D1128,
+    0xCA54BDE,
+    0xCAD7DB4,
+    0xCB5A6A4,
+    0xCBDC6A9,
+    0xCC5DDBC,
+    0xCCDEBD8,
+    0xCD5F0F8,
+    0xCDDED16,
+    0xCE5E02C,
+    0xCEDCA34,
+    0xCF5AB29,
+    0xCFD8306,
+    0xD0551C5,
+    0xD0D1761,
+    0xD14D3D4,
+    0xD1C8718,
+    0xD243129,
+    0xD2BD200,
+    0xD336999,
+    0xD3AF7EE,
+    0xD427CFB,
+    0xD49F8B8,
+    0xD516B22,
+    0xD58D434,
+    0xD6033E7,
+    0xD678A37,
+    0xD6ED71E,
+    0xD761A98,
+    0xD7D54A0,
+    0xD848530,
+    0xD8BAC43,
+    0xD92C9D4,
+    0xD99DDDE,
+    0xDA0E85D,
+    0xDA7E94C,
+    0xDAEE0A4,
+    0xDB5CE62,
+    0xDBCB281,
+    0xDC38CFC,
+    0xDCA5DCE,
+    0xDD124F2,
+    0xDD7E263,
+    0xDDE961E,
+    0xDE5401C,
+    0xDEBE05A,
+    0xDF276D2,
+    0xDF90381,
+    0xDFF8661,
+    0xE05FF6E,
+    0xE0C6EA3,
+    0xE12D3FD,
+    0xE192F75,
+    0xE1F8109,
+    0xE25C8B3,
+    0xE2C066F,
+    0xE323A39,
+    0xE38640D,
+    0xE3E83E5,
+    0xE4499BE,
+    0xE4AA594,
+    0xE50A762,
+    0xE569F23,
+    0xE5C8CD5,
+    0xE627072,
+    0xE6849F7,
+    0xE6E195F,
+    0xE73DEA7,
+    0xE7999CA,
+    0xE7F4AC4,
+    0xE84F191,
+    0xE8A8E2E,
+    0xE902096,
+    0xE95A8C6,
+    0xE9B26B9,
+    0xEA09A6C,
+    0xEA603DA,
+    0xEAB6301,
+    0xEB0B7DC,
+    0xEB60268,
+    0xEBB42A1,
+    0xEC07883,
+    0xEC5A40A,
+    0xECAC533,
+    0xECFDBFB,
+    0xED4E85D,
+    0xED9EA56,
+    0xEDEE1E3,
+    0xEE3CF01,
+    0xEE8B1AB,
+    0xEED89DE,
+    0xEF25797,
+    0xEF71AD3,
+    0xEFBD38E,
+    0xF0081C5,
+    0xF052574,
+    0xF09BE99,
+    0xF0E4D30,
+    0xF12D136,
+    0xF174AA7,
+    0xF1BB981,
+    0xF201DC1,
+    0xF247763,
+    0xF28C664,
+    0xF2D0AC2,
+    0xF314479,
+    0xF357386,
+    0xF3997E7,
+    0xF3DB198,
+    0xF41C097,
+    0xF45C4E1,
+    0xF49BE72,
+    0xF4DAD49,
+    0xF519162,
+    0xF556ABB,
+    0xF593951,
+    0xF5CFD22,
+    0xF60B62A,
+    0xF646467,
+    0xF6807D6,
+    0xF6BA076,
+    0xF6F2E43,
+    0xF72B13A,
+    0xF76295B,
+    0xF7996A1,
+    0xF7CF90B,
+    0xF805096,
+    0xF839D40,
+    0xF86DF06,
+    0xF8A15E7,
+    0xF8D41E0,
+    0xF9062EF,
+    0xF937911,
+    0xF968445,
+    0xF998488,
+    0xF9C79D8,
+    0xF9F6433,
+    0xFA24398,
+    0xFA51803,
+    0xFA7E174,
+    0xFAA9FE7,
+    0xFAD535C,
+    0xFAFFBD0,
+    0xFB29942,
+    0xFB52BAF,
+    0xFB7B316,
+    0xFBA2F75,
+    0xFBCA0CA,
+    0xFBF0714,
+    0xFC16251,
+    0xFC3B27F,
+    0xFC5F79C,
+    0xFC831A7,
+    0xFCA609F,
+    0xFCC8482,
+    0xFCE9D4E,
+    0xFD0AB03,
+    0xFD2AD9D,
+    0xFD4A51D,
+    0xFD69180,
+    0xFD872C6,
+    0xFDA48ED,
+    0xFDC13F4,
+    0xFDDD3D9,
+    0xFDF889B,
+    0xFE13239,
+    0xFE2D0B3,
+    0xFE46406,
+    0xFE5EC31,
+    0xFE76934,
+    0xFE8DB0E,
+    0xFEA41BD,
+    0xFEB9D41,
+    0xFECED99,
+    0xFEE32C3,
+    0xFEF6CBE,
+    0xFF09B8B,
+    0xFF1BF28,
+    0xFF2D794,
+    0xFF3E4CE,
+    0xFF4E6D7,
+    0xFF5DDAC,
+    0xFF6C94E,
+    0xFF7A9BC,
+    0xFF87EF4,
+    0xFF948F7,
+    0xFFA07C4,
+    0xFFABB5B,
+    0xFFB63BB,
+    0xFFC00E3,
+    0xFFC92D3,
+    0xFFD198B,
+    0xFFD950A,
+    0xFFE0550,
+    0xFFE6A5D,
+    0xFFEC430,
+    0xFFF12C9,
+    0xFFF5629,
+    0xFFF8E4E,
+    0xFFFBB38,
+    0xFFFDCE8,
+    0xFFFF35D,
+    0xFFFFE98
+};
+
+real_t ld_mid_512[] =
+{
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x1921F1,
+    0x4B64DB,
+    0x7DA4DD,
+    0xAFE006,
+    0xE21468,
+    0x1144013,
+    0x1466118,
+    0x1787587,
+    0x1AA7B73,
+    0x1DC70ED,
+    0x20E5409,
+    0x24022DB,
+    0x271DB77,
+    0x2A37BF1,
+    0x2D50261,
+    0x3066CDE,
+    0x337B97F,
+    0x368E65F,
+    0x399F198,
+    0x3CAD945,
+    0x3FB9B85,
+    0x42C3675,
+    0x45CA837,
+    0x48CEEED,
+    0x4BD08B8,
+    0x4ECF3C0,
+    0x51CAE2B,
+    0x54C3622,
+    0x57B89D0,
+    0x5AAA761,
+    0x5D98D06,
+    0x60838EE,
+    0x636A94E,
+    0x664DC5B,
+    0x692D04C,
+    0x6C0835E,
+    0x6EDF3CB,
+    0x71B1FD5,
+    0x74805BD,
+    0x774A3C8,
+    0x7A0F83E,
+    0x7CD0168,
+    0x7F8BD96,
+    0x8242B16,
+    0x84F483D,
+    0x87A1361,
+    0x8A48ADB,
+    0x8CEAD08,
+    0x8F87849,
+    0x921EB01,
+    0x94B0397,
+    0x973C075,
+    0x99C200A,
+    0x9C420C6,
+    0x9EBC120,
+    0xA12FF8F,
+    0xA39DA91,
+    0xA6050A6,
+    0xA866053,
+    0xAAC0820,
+    0xAD14699,
+    0xAF61A4E,
+    0xB1A81D5,
+    0xB3E7BC6,
+    0xB6206BE,
+    0xB85215D,
+    0xBA7CA4B,
+    0xBCA002F,
+    0xBEBC1BA,
+    0xC0D0D9E,
+    0xC2DE291,
+    0xC4E3F51,
+    0xC6E229D,
+    0xC8D8B3C,
+    0xCAC77F6,
+    0xCCAE79B,
+    0xCE8D8FF,
+    0xD064AF9,
+    0xD233C68,
+    0xD3FAC2D,
+    0xD5B9930,
+    0xD77025E,
+    0xD91E6A7,
+    0xDAC4503,
+    0xDC61C6D,
+    0xDDF6BE6,
+    0xDF83274,
+    0xE106F23,
+    0xE282104,
+    0xE3F472C,
+    0xE55E0B8,
+    0xE6BECC8,
+    0xE816A82,
+    0xE965913,
+    0xEAAB7AC,
+    0xEBE8584,
+    0xED1C1D8,
+    0xEE46BE8,
+    0xEF682FF,
+    0xF080668,
+    0xF18F577,
+    0xF294F85,
+    0xF3913F0,
+    0xF48421D,
+    0xF56D977,
+    0xF64D96C,
+    0xF724173,
+    0xF7F1108,
+    0xF8B47AC,
+    0xF96E4E6,
+    0xFA1E845,
+    0xFAC515A,
+    0xFB61FC0,
+    0xFBF5316,
+    0xFC7EB01,
+    0xFCFE72C,
+    0xFD74748,
+    0xFDE0B0D,
+    0xFE43237,
+    0xFE9BC8B,
+    0xFEEA9D0,
+    0xFF2F9D8,
+    0xFF6AC77,
+    0xFF9C188,
+    0xFFC38ED,
+    0xFFE128F,
+    0xFFF4E5A,
+    0xFFFEC42,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000
+};
+
+real_t ld_mid_480[] =
+{
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x0,
+    0x1ACEDD,
+    0x506B6B,
+    0x860472,
+    0xBB9798,
+    0xF12283,
+    0x126A2DB,
+    0x15C1646,
+    0x1917A6C,
+    0x1C6CCF6,
+    0x1FC0B8D,
+    0x23133DB,
+    0x266438B,
+    0x29B3849,
+    0x2D00FC3,
+    0x304C7A8,
+    0x3395DA6,
+    0x36DCF70,
+    0x3A21AB9,
+    0x3D63D36,
+    0x40A349D,
+    0x43DFEA6,
+    0x471990D,
+    0x4A5018D,
+    0x4D835E6,
+    0x50B33D8,
+    0x53DF927,
+    0x5708398,
+    0x5A2D0F4,
+    0x5D4DF07,
+    0x606AB9E,
+    0x638348A,
+    0x669779E,
+    0x69A72B2,
+    0x6CB23A0,
+    0x6FB8844,
+    0x72B9E80,
+    0x75B6437,
+    0x78AD751,
+    0x7B9F5B9,
+    0x7E8BD5E,
+    0x8172C33,
+    0x845402D,
+    0x872F749,
+    0x8A04F85,
+    0x8CD46E2,
+    0x8F9DB69,
+    0x9260B25,
+    0x951D425,
+    0x97D347F,
+    0x9A82A4A,
+    0x9D2B3A4,
+    0x9FCCEB1,
+    0xA267996,
+    0xA4FB280,
+    0xA7877A1,
+    0xAA0C72E,
+    0xAC89F62,
+    0xAEFFE7F,
+    0xB16E2CA,
+    0xB3D4A8E,
+    0xB63341D,
+    0xB889DCC,
+    0xBAD85F7,
+    0xBD1EB00,
+    0xBF5CB4E,
+    0xC19254F,
+    0xC3BF775,
+    0xC5E4039,
+    0xC7FFE1B,
+    0xCA12F9F,
+    0xCC1D351,
+    0xCE1E7C2,
+    0xD016B8A,
+    0xD205D47,
+    0xD3EBB9E,
+    0xD5C8539,
+    0xD79B8CB,
+    0xD96550A,
+    0xDB258B7,
+    0xDCDC296,
+    0xDE89173,
+    0xE02C422,
+    0xE1C597C,
+    0xE355062,
+    0xE4DA7BC,
+    0xE655E78,
+    0xE7C738C,
+    0xE92E5F5,
+    0xEA8B4B7,
+    0xEBDDEDD,
+    0xED26379,
+    0xEE641A4,
+    0xEF97881,
+    0xF0C0736,
+    0xF1DECF4,
+    0xF2F28F2,
+    0xF3FBA6E,
+    0xF4FA0AE,
+    0xF5EDAFF,
+    0xF6D68B7,
+    0xF7B4932,
+    0xF887BD4,
+    0xF950009,
+    0xFA0D544,
+    0xFABFB02,
+    0xFB670C3,
+    0xFC03614,
+    0xFC94A86,
+    0xFD1ADB3,
+    0xFD95F3E,
+    0xFE05ECF,
+    0xFE6AC18,
+    0xFEC46D2,
+    0xFF12EC0,
+    0xFF563A8,
+    0xFF8E55C,
+    0xFFBB3B6,
+    0xFFDCE94,
+    0xFFF35E0,
+    0xFFFE98A,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000,
+    0x10000000
+};
+#endif
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/specrec.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,626 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: specrec.c,v 1.23 2003/07/29 08:20:13 menno Exp $
+**/
+
+/*
+  Spectral reconstruction:
+   - grouping/sectioning
+   - inverse quantization
+   - applying scalefactors
+*/
+
+#include "common.h"
+#include "structs.h"
+
+#include <string.h>
+#include "specrec.h"
+#include "syntax.h"
+#include "iq_table.h"
+
+#ifdef LD_DEC
+static uint8_t num_swb_512_window[] =
+{
+    0, 0, 0, 36, 36, 37, 31, 31, 0, 0, 0, 0
+};
+static uint8_t num_swb_480_window[] =
+{
+    0, 0, 0, 35, 35, 37, 30, 30, 0, 0, 0, 0
+};
+#endif
+
+static uint8_t num_swb_960_window[] =
+{
+    40, 40, 45, 49, 49, 49, 46, 46, 42, 42, 42, 40
+};
+
+static uint8_t num_swb_1024_window[] =
+{
+    41, 41, 47, 49, 49, 51, 47, 47, 43, 43, 43, 40
+};
+
+static uint8_t num_swb_128_window[] =
+{
+    12, 12, 12, 14, 14, 14, 15, 15, 15, 15, 15, 15
+};
+
+static uint16_t swb_offset_1024_96[] =
+{
+    0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56,
+    64, 72, 80, 88, 96, 108, 120, 132, 144, 156, 172, 188, 212, 240,
+    276, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960, 1024
+};
+
+static uint16_t swb_offset_128_96[] =
+{
+    0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128
+};
+
+static uint16_t swb_offset_1024_64[] =
+{
+    0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56,
+    64, 72, 80, 88, 100, 112, 124, 140, 156, 172, 192, 216, 240, 268,
+    304, 344, 384, 424, 464, 504, 544, 584, 624, 664, 704, 744, 784, 824,
+    864, 904, 944, 984, 1024
+};
+
+static uint16_t swb_offset_128_64[] =
+{
+    0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128
+};
+
+
+static uint16_t swb_offset_1024_48[] =
+{
+    0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72,
+    80, 88, 96, 108, 120, 132, 144, 160, 176, 196, 216, 240, 264, 292,
+    320, 352, 384, 416, 448, 480, 512, 544, 576, 608, 640, 672, 704, 736,
+    768, 800, 832, 864, 896, 928, 1024
+};
+
+#ifdef LD_DEC
+static uint16_t swb_offset_512_48[] =
+{
+    0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 68, 76, 84,
+    92, 100, 112, 124, 136, 148, 164, 184, 208, 236, 268, 300, 332, 364, 396,
+    428, 460, 512
+};
+
+static uint16_t swb_offset_480_48[] =
+{
+    0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72 ,80 ,88,
+    96, 108, 120, 132, 144, 156, 172, 188, 212, 240, 272, 304, 336, 368, 400,
+    432, 480
+};
+#endif
+
+static uint16_t swb_offset_128_48[] =
+{
+    0, 4, 8, 12, 16, 20, 28, 36, 44, 56, 68, 80, 96, 112, 128
+};
+
+static uint16_t swb_offset_1024_32[] =
+{
+    0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72,
+    80, 88, 96, 108, 120, 132, 144, 160, 176, 196, 216, 240, 264, 292,
+    320, 352, 384, 416, 448, 480, 512, 544, 576, 608, 640, 672, 704, 736,
+    768, 800, 832, 864, 896, 928, 960, 992, 1024
+};
+
+#ifdef LD_DEC
+static uint16_t swb_offset_512_32[] =
+{
+    0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72, 80,
+    88, 96, 108, 120, 132, 144, 160, 176, 192, 212, 236, 260, 288, 320, 352,
+    384, 416, 448, 480, 512
+};
+
+static uint16_t swb_offset_480_32[] =
+{
+    0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 72, 80,
+    88, 96, 104, 112, 124, 136, 148, 164, 180, 200, 224, 256, 288, 320, 352,
+    384, 416, 448, 480
+};
+#endif
+
+static uint16_t swb_offset_1024_24[] =
+{
+    0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68,
+    76, 84, 92, 100, 108, 116, 124, 136, 148, 160, 172, 188, 204, 220,
+    240, 260, 284, 308, 336, 364, 396, 432, 468, 508, 552, 600, 652, 704,
+    768, 832, 896, 960, 1024
+};
+
+#ifdef LD_DEC
+static uint16_t swb_offset_512_24[] =
+{
+    0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68,
+    80, 92, 104, 120, 140, 164, 192, 224, 256, 288, 320, 352, 384, 416,
+    448, 480, 512
+};
+
+static uint16_t swb_offset_480_24[] =
+{
+    0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68, 80, 92, 104, 120,
+    140, 164, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480
+};
+#endif
+
+static uint16_t swb_offset_128_24[] =
+{
+    0, 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 64, 76, 92, 108, 128
+};
+
+static uint16_t swb_offset_1024_16[] =
+{
+    0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 100, 112, 124,
+    136, 148, 160, 172, 184, 196, 212, 228, 244, 260, 280, 300, 320, 344,
+    368, 396, 424, 456, 492, 532, 572, 616, 664, 716, 772, 832, 896, 960, 1024
+};
+
+static uint16_t swb_offset_128_16[] =
+{
+    0, 4, 8, 12, 16, 20, 24, 28, 32, 40, 48, 60, 72, 88, 108, 128
+};
+
+static uint16_t swb_offset_1024_8[] =
+{
+    0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144, 156, 172,
+    188, 204, 220, 236, 252, 268, 288, 308, 328, 348, 372, 396, 420, 448,
+    476, 508, 544, 580, 620, 664, 712, 764, 820, 880, 944, 1024
+};
+
+static uint16_t swb_offset_128_8[] =
+{
+    0, 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 60, 72, 88, 108, 128
+};
+
+static uint16_t *swb_offset_1024_window[] =
+{
+    swb_offset_1024_96,      /* 96000 */
+    swb_offset_1024_96,      /* 88200 */
+    swb_offset_1024_64,      /* 64000 */
+    swb_offset_1024_48,      /* 48000 */
+    swb_offset_1024_48,      /* 44100 */
+    swb_offset_1024_32,      /* 32000 */
+    swb_offset_1024_24,      /* 24000 */
+    swb_offset_1024_24,      /* 22050 */
+    swb_offset_1024_16,      /* 16000 */
+    swb_offset_1024_16,      /* 12000 */
+    swb_offset_1024_16,      /* 11025 */
+    swb_offset_1024_8        /* 8000  */
+};
+
+#ifdef LD_DEC
+static uint16_t *swb_offset_512_window[] =
+{
+    0,                       /* 96000 */
+    0,                       /* 88200 */
+    0,                       /* 64000 */
+    swb_offset_512_48,       /* 48000 */
+    swb_offset_512_48,       /* 44100 */
+    swb_offset_512_32,       /* 32000 */
+    swb_offset_512_24,       /* 24000 */
+    swb_offset_512_24,       /* 22050 */
+    0,                       /* 16000 */
+    0,                       /* 12000 */
+    0,                       /* 11025 */
+    0                        /* 8000  */
+};
+
+static uint16_t *swb_offset_480_window[] =
+{
+    0,                       /* 96000 */
+    0,                       /* 88200 */
+    0,                       /* 64000 */
+    swb_offset_480_48,       /* 48000 */
+    swb_offset_480_48,       /* 44100 */
+    swb_offset_480_32,       /* 32000 */
+    swb_offset_480_24,       /* 24000 */
+    swb_offset_480_24,       /* 22050 */
+    0,                       /* 16000 */
+    0,                       /* 12000 */
+    0,                       /* 11025 */
+    0                        /* 8000  */
+};
+#endif
+
+static uint16_t *swb_offset_128_window[] =
+{
+    swb_offset_128_96,       /* 96000 */
+    swb_offset_128_96,       /* 88200 */
+    swb_offset_128_64,       /* 64000 */
+    swb_offset_128_48,       /* 48000 */
+    swb_offset_128_48,       /* 44100 */
+    swb_offset_128_48,       /* 32000 */
+    swb_offset_128_24,       /* 24000 */
+    swb_offset_128_24,       /* 22050 */
+    swb_offset_128_16,       /* 16000 */
+    swb_offset_128_16,       /* 12000 */
+    swb_offset_128_16,       /* 11025 */
+    swb_offset_128_8         /* 8000  */
+};
+
+#define bit_set(A, B) ((A) & (1<<(B)))
+
+/* 4.5.2.3.4 */
+/*
+  - determine the number of windows in a window_sequence named num_windows
+  - determine the number of window_groups named num_window_groups
+  - determine the number of windows in each group named window_group_length[g]
+  - determine the total number of scalefactor window bands named num_swb for
+    the actual window type
+  - determine swb_offset[swb], the offset of the first coefficient in
+    scalefactor window band named swb of the window actually used
+  - determine sect_sfb_offset[g][section],the offset of the first coefficient
+    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 i, g;
+
+    uint8_t sf_index = hDecoder->sf_index;
+
+    switch (ics->window_sequence) {
+    case ONLY_LONG_SEQUENCE:
+    case LONG_START_SEQUENCE:
+    case LONG_STOP_SEQUENCE:
+        ics->num_windows = 1;
+        ics->num_window_groups = 1;
+        ics->window_group_length[ics->num_window_groups-1] = 1;
+#ifdef LD_DEC
+        if (hDecoder->object_type == LD)
+        {
+            if (hDecoder->frameLength == 512)
+                ics->num_swb = num_swb_512_window[sf_index];
+            else /* if (hDecoder->frameLength == 480) */
+                ics->num_swb = num_swb_480_window[sf_index];
+        } else {
+#endif
+            if (hDecoder->frameLength == 1024)
+                ics->num_swb = num_swb_1024_window[sf_index];
+            else /* if (hDecoder->frameLength == 960) */
+                ics->num_swb = num_swb_960_window[sf_index];
+#ifdef LD_DEC
+        }
+#endif
+
+        /* preparation of sect_sfb_offset for long blocks */
+        /* also copy the last value! */
+#ifdef LD_DEC
+        if (hDecoder->object_type == LD)
+        {
+            if (hDecoder->frameLength == 512)
+            {
+                for (i = 0; i < ics->num_swb; i++)
+                {
+                    ics->sect_sfb_offset[0][i] = swb_offset_512_window[sf_index][i];
+                    ics->swb_offset[i] = swb_offset_512_window[sf_index][i];
+                }
+            } else /* if (hDecoder->frameLength == 480) */ {
+                for (i = 0; i < ics->num_swb; i++)
+                {
+                    ics->sect_sfb_offset[0][i] = swb_offset_480_window[sf_index][i];
+                    ics->swb_offset[i] = swb_offset_480_window[sf_index][i];
+                }
+            }
+            ics->sect_sfb_offset[0][ics->num_swb] = hDecoder->frameLength;
+            ics->swb_offset[ics->num_swb] = hDecoder->frameLength;
+        } else {
+#endif
+            for (i = 0; i < ics->num_swb; i++)
+            {
+                ics->sect_sfb_offset[0][i] = swb_offset_1024_window[sf_index][i];
+                ics->swb_offset[i] = swb_offset_1024_window[sf_index][i];
+            }
+            ics->sect_sfb_offset[0][ics->num_swb] = hDecoder->frameLength;
+            ics->swb_offset[ics->num_swb] = hDecoder->frameLength;
+#ifdef LD_DEC
+        }
+#endif
+        return 0;
+    case EIGHT_SHORT_SEQUENCE:
+        ics->num_windows = 8;
+        ics->num_window_groups = 1;
+        ics->window_group_length[ics->num_window_groups-1] = 1;
+        ics->num_swb = num_swb_128_window[sf_index];
+
+        for (i = 0; i < ics->num_swb; i++)
+            ics->swb_offset[i] = swb_offset_128_window[sf_index][i];
+        ics->swb_offset[ics->num_swb] = hDecoder->frameLength/8;
+
+        for (i = 0; i < ics->num_windows-1; i++) {
+            if (bit_set(ics->scale_factor_grouping, 6-i) == 0)
+            {
+                ics->num_window_groups += 1;
+                ics->window_group_length[ics->num_window_groups-1] = 1;
+            } else {
+                ics->window_group_length[ics->num_window_groups-1] += 1;
+            }
+        }
+
+        /* preparation of sect_sfb_offset for short blocks */
+        for (g = 0; g < ics->num_window_groups; g++)
+        {
+            uint16_t width;
+            uint8_t sect_sfb = 0;
+            uint16_t offset = 0;
+
+            for (i = 0; i < ics->num_swb; i++)
+            {
+                if (i+1 == ics->num_swb)
+                {
+                    width = (hDecoder->frameLength/8) - swb_offset_128_window[sf_index][i];
+                } else {
+                    width = swb_offset_128_window[sf_index][i+1] -
+                        swb_offset_128_window[sf_index][i];
+                }
+                width *= ics->window_group_length[g];
+                ics->sect_sfb_offset[g][sect_sfb++] = offset;
+                offset += width;
+            }
+            ics->sect_sfb_offset[g][sect_sfb] = offset;
+        }
+        return 0;
+    default:
+        return 1;
+    }
+}
+
+/*
+  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.
+*/
+void quant_to_spec(ic_stream *ics, real_t *spec_data, uint16_t frame_len)
+{
+    uint8_t g, sfb, win;
+    uint16_t width, bin;
+    real_t *start_inptr, *start_win_ptr, *win_ptr;
+
+    real_t tmp_spec[1024];
+    real_t *tmp_spec_ptr, *spec_ptr;
+
+    tmp_spec_ptr = tmp_spec;
+    memset(tmp_spec_ptr, 0, frame_len*sizeof(real_t));
+
+    spec_ptr = spec_data;
+    tmp_spec_ptr = tmp_spec;
+    start_win_ptr = tmp_spec_ptr;
+
+    for (g = 0; g < ics->num_window_groups; g++)
+    {
+        uint16_t j = 0;
+        uint16_t win_inc = 0;
+
+        start_inptr = spec_ptr;
+
+        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];
+
+            win_ptr = start_win_ptr;
+
+            for (win = 0; win < ics->window_group_length[g]; win++)
+            {
+                tmp_spec_ptr = win_ptr + j;
+
+                for (bin = 0; bin < width; bin += 4)
+                {
+                    tmp_spec_ptr[0] = spec_ptr[0];
+                    tmp_spec_ptr[1] = spec_ptr[1];
+                    tmp_spec_ptr[2] = spec_ptr[2];
+                    tmp_spec_ptr[3] = spec_ptr[3];
+                    tmp_spec_ptr += 4;
+                    spec_ptr += 4;
+                }
+
+                win_ptr += win_inc;
+            }
+            j += width;
+        }
+        start_win_ptr += (spec_ptr - start_inptr);
+    }
+
+    spec_ptr = spec_data;
+    tmp_spec_ptr = tmp_spec;
+
+    memcpy(spec_ptr, tmp_spec_ptr, frame_len*sizeof(real_t));
+}
+
+#ifndef FIXED_POINT
+void build_tables(real_t *pow2_table)
+{
+    uint16_t i;
+
+    /* build pow(2, 0.25*x) table for scalefactors */
+    for(i = 0; i < POW_TABLE_SIZE; i++)
+    {
+        pow2_table[i] = REAL_CONST(pow(2.0, 0.25 * (i-100)));
+    }
+}
+#endif
+
+static INLINE real_t iquant(int16_t q, real_t *tab)
+{
+    int16_t sgn = 1;
+
+    if (q == 0) return 0;
+
+    if (q < 0)
+    {
+        q = -q;
+        sgn = -1;
+    }
+
+    if (q >= IQ_TABLE_SIZE)
+        return sgn * tab[q>>3] * 16;
+
+    return sgn * tab[q];
+}
+
+void inverse_quantization(real_t *x_invquant, int16_t *x_quant, uint16_t frame_len)
+{
+    int16_t i;
+    int16_t *in_ptr = x_quant;
+    real_t *out_ptr = x_invquant;
+    real_t *tab = iq_table;
+
+    for(i = frame_len/4-1; i >= 0; --i)
+    {
+        out_ptr[0] = iquant(in_ptr[0], tab);
+        out_ptr[1] = iquant(in_ptr[1], tab);
+        out_ptr[2] = iquant(in_ptr[2], tab);
+        out_ptr[3] = iquant(in_ptr[3], tab);
+        out_ptr += 4;
+        in_ptr += 4;
+    }
+}
+
+#ifndef FIXED_POINT
+static INLINE real_t get_scale_factor_gain(uint16_t scale_factor, real_t *pow2_table)
+{
+    if (scale_factor < POW_TABLE_SIZE)
+        return pow2_table[scale_factor];
+    else
+        return REAL_CONST(pow(2.0, 0.25 * (scale_factor - 100)));
+}
+#else
+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),
+    COEF_CONST(1.68179283050743)
+};
+#endif
+
+#ifdef FIXED_POINT
+void apply_scalefactors(faacDecHandle hDecoder, ic_stream *ics, real_t *x_invquant,
+                        uint16_t frame_len)
+#else
+void apply_scalefactors(ic_stream *ics, real_t *x_invquant, real_t *pow2_table,
+                        uint16_t frame_len)
+#endif
+{
+    uint8_t g, sfb;
+    uint16_t top;
+    real_t *fp;
+#ifndef FIXED_POINT
+    real_t scale;
+#else
+    int32_t exp, frac;
+#endif
+    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 128*groups doesn't hurt long blocks, because
+           long blocks only have 1 group, so that means 'groups' is
+           always 0 for long blocks
+        */
+        fp = x_invquant + (groups*nshort);
+
+        for (sfb = 0; sfb < ics->max_sfb; sfb++)
+        {
+            top = ics->sect_sfb_offset[g][sfb+1];
+
+#ifndef FIXED_POINT
+            scale = get_scale_factor_gain(ics->scale_factors[g][sfb], pow2_table);
+#else
+            exp = (ics->scale_factors[g][sfb] - 100) / 4;
+            frac = (ics->scale_factors[g][sfb] - 100) % 4;
+
+            if (hDecoder->object_type == LD)
+            {
+                exp -= 6 /*9*/;
+            } else {
+                if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+                    exp -= 4 /*7*/;
+                else
+                    exp -= 7 /*10*/;
+            }
+#endif
+
+            /* minimum size of a sf band is 4 and always a multiple of 4 */
+            for ( ; k < top; k += 4)
+            {
+#ifndef FIXED_POINT
+                fp[0] = fp[0] * scale;
+                fp[1] = fp[1] * scale;
+                fp[2] = fp[2] * scale;
+                fp[3] = fp[3] * scale;
+#else
+                if (exp < 0)
+                {
+                    fp[0] >>= -exp;
+                    fp[1] >>= -exp;
+                    fp[2] >>= -exp;
+                    fp[3] >>= -exp;
+                } else {
+                    fp[0] <<= exp;
+                    fp[1] <<= exp;
+                    fp[2] <<= exp;
+                    fp[3] <<= exp;
+                }
+
+                if (frac)
+                {
+                    fp[0] = MUL_R_C(fp[0],pow2_table[frac + 3]);
+                    fp[1] = MUL_R_C(fp[1],pow2_table[frac + 3]);
+                    fp[2] = MUL_R_C(fp[2],pow2_table[frac + 3]);
+                    fp[3] = MUL_R_C(fp[3],pow2_table[frac + 3]);
+                }
+#endif
+                fp += 4;
+            }
+        }
+        groups += ics->window_group_length[g];
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/specrec.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,52 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: specrec.h,v 1.13 2003/07/29 08:20:14 menno Exp $
+**/
+
+#ifndef __SPECREC_H__
+#define __SPECREC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "syntax.h"
+
+uint8_t window_grouping_info(faacDecHandle hDecoder, ic_stream *ics);
+void quant_to_spec(ic_stream *ics, real_t *spec_data, uint16_t frame_len);
+void inverse_quantization(real_t *x_invquant, int16_t *x_quant, uint16_t frame_len);
+#ifdef FIXED_POINT
+void apply_scalefactors(faacDecHandle hDecoder, ic_stream *ics, real_t *x_invquant,
+                        uint16_t frame_len);
+#else
+void build_tables(real_t *pow2_table);
+void apply_scalefactors(ic_stream *ics, real_t *x_invquant, real_t *pow2_table,
+                        uint16_t frame_len);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/ssr.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,175 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ssr.c,v 1.4 2003/07/29 08:20:14 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SSR_DEC
+
+#include "syntax.h"
+#include "filtbank.h"
+#include "ssr.h"
+#include "ssr_fb.h"
+
+void ssr_decode(ssr_info *ssr, fb_info *fb, uint8_t window_sequence,
+                uint8_t window_shape, uint8_t window_shape_prev,
+                real_t *freq_in, real_t *time_out, real_t *overlap,
+                real_t ipqf_buffer[SSR_BANDS][96/4],
+                real_t *prev_fmd, uint16_t frame_len)
+{
+    uint8_t band;
+    uint16_t ssr_frame_len = frame_len/SSR_BANDS;
+    real_t time_tmp[2048];
+    real_t output[1024];
+
+    memset(output, 0, 1024*sizeof(real_t));
+    memset(time_tmp, 0, 2048*sizeof(real_t));
+
+    for (band = 0; band < SSR_BANDS; band++)
+    {
+        int16_t j;
+
+        /* uneven bands have inverted frequency scale */
+        if (band == 1 || band == 3)
+        {
+            for (j = 0; j < ssr_frame_len/2; j++)
+            {
+                real_t tmp;
+                tmp = freq_in[j + ssr_frame_len*band];
+                freq_in[j + ssr_frame_len*band] =
+                    freq_in[ssr_frame_len - j - 1 + ssr_frame_len*band];
+                freq_in[ssr_frame_len - j - 1 + ssr_frame_len*band] = tmp;
+            }
+        }
+
+        /* non-overlapping inverse filterbank for SSR */
+        ssr_ifilter_bank(fb, window_sequence, window_shape, window_shape_prev,
+            freq_in + band*ssr_frame_len, time_tmp + band*ssr_frame_len,
+            ssr_frame_len);
+
+        /* gain control */
+        ssr_gain_control(ssr, time_tmp, output, overlap, prev_fmd,
+            band, window_sequence, ssr_frame_len);
+    }
+
+    /* inverse pqf to bring subbands together again */
+    ssr_ipqf(ssr, output, time_out, ipqf_buffer, frame_len, SSR_BANDS);
+}
+
+static void ssr_gain_control(ssr_info *ssr, real_t *data, real_t *output,
+                             real_t *overlap, real_t *prev_fmd, uint8_t band,
+                             uint8_t window_sequence, uint16_t frame_len)
+{
+    uint16_t i;
+    real_t gc_function[2*1024/SSR_BANDS];
+
+    if (window_sequence != EIGHT_SHORT_SEQUENCE)
+    {
+        ssr_gc_function(ssr, &prev_fmd[band * frame_len*2],
+            gc_function, window_sequence, frame_len);
+
+        for (i = 0; i < frame_len*2; i++)
+            data[band * frame_len*2 + i] *= gc_function[i];
+        for (i = 0; i < frame_len; i++)
+        {
+            output[band*frame_len + i] = overlap[band*frame_len + i] +
+                data[band*frame_len*2 + i];
+        }
+        for (i = 0; i < frame_len; i++)
+        {
+            overlap[band*frame_len + i] =
+                data[band*frame_len*2 + frame_len + i];
+        }
+    } else {
+        uint8_t w;
+        for (w = 0; w < 8; w++)
+        {
+            uint16_t frame_len8 = frame_len/8;
+            uint16_t frame_len16 = frame_len/16;
+
+            ssr_gc_function(ssr, &prev_fmd[band*frame_len*2 + w*frame_len*2/8],
+                gc_function, window_sequence, frame_len);
+
+            for (i = 0; i < frame_len8*2; i++)
+                data[band*frame_len*2 + w*frame_len8*2+i] *= gc_function[i];
+            for (i = 0; i < frame_len8; i++)
+            {
+                overlap[band*frame_len + i + 7*frame_len16 + w*frame_len8] +=
+                    data[band*frame_len*2 + 2*w*frame_len8 + i];
+            }
+            for (i = 0; i < frame_len8; i++)
+            {
+                overlap[band*frame_len + i + 7*frame_len16 + (w+1)*frame_len8] =
+                    data[band*frame_len*2 + 2*w*frame_len8 + frame_len8 + i];
+            }
+        }
+        for (i = 0; i < frame_len; i++)
+            output[band*frame_len + i] = overlap[band*frame_len + i];
+        for (i = 0; i < frame_len; i++)
+            overlap[band*frame_len + i] = overlap[band*frame_len + i + frame_len];
+    }
+}
+
+static void ssr_gc_function(ssr_info *ssr, real_t *prev_fmd,
+                            real_t *gc_function, uint8_t window_sequence,
+                            uint16_t frame_len)
+{
+    uint16_t i;
+    uint16_t len_area1, len_area2;
+    int32_t aloc[10];
+    real_t alev[10];
+
+    switch (window_sequence)
+    {
+    case ONLY_LONG_SEQUENCE:
+        len_area1 = frame_len/SSR_BANDS;
+        len_area2 = 0;
+        break;
+    case LONG_START_SEQUENCE:
+        len_area1 = (frame_len/SSR_BANDS)*7/32;
+        len_area2 = (frame_len/SSR_BANDS)/16;
+        break;
+    case EIGHT_SHORT_SEQUENCE:
+        len_area1 = (frame_len/8)/SSR_BANDS;
+        len_area2 = 0;
+        break;
+    case LONG_STOP_SEQUENCE:
+        len_area1 = (frame_len/SSR_BANDS);
+        len_area2 = 0;
+        break;
+    }
+
+    /* decode bitstream information */
+
+    /* build array M */
+
+
+    for (i = 0; i < frame_len*2; i++)
+        gc_function[i] = 1;
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/ssr.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,56 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ssr.h,v 1.4 2003/07/29 08:20:14 menno Exp $
+**/
+
+#ifndef __SSR_H__
+#define __SSR_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SSR_BANDS 4
+#define PQFTAPS 96
+
+void ssr_decode(ssr_info *ssr, fb_info *fb, uint8_t window_sequence,
+                uint8_t window_shape, uint8_t window_shape_prev,
+                real_t *freq_in, real_t *time_out, real_t *overlap,
+                real_t ipqf_buffer[SSR_BANDS][96/4],
+                real_t *prev_fmd, uint16_t frame_len);
+
+
+static void ssr_gain_control(ssr_info *ssr, real_t *data, real_t *output,
+                             real_t *overlap, real_t *prev_fmd, uint8_t band,
+                             uint8_t window_sequence, uint16_t frame_len);
+static void ssr_gc_function(ssr_info *ssr, real_t *prev_fmd,
+                            real_t *gc_function, uint8_t window_sequence,
+                            uint16_t frame_len);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/ssr_fb.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,182 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ssr_fb.c,v 1.2 2003/07/29 08:20:14 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SSR_DEC
+
+#include <string.h>
+#include <stdlib.h>
+#include "syntax.h"
+#include "filtbank.h"
+#include "mdct.h"
+#include "ssr_fb.h"
+#include "ssr_win.h"
+
+fb_info *ssr_filter_bank_init(uint16_t frame_len)
+{
+    uint16_t nshort = frame_len/8;
+
+    fb_info *fb = (fb_info*)malloc(sizeof(fb_info));
+    memset(fb, 0, sizeof(fb_info));
+
+    /* normal */
+    fb->mdct256 = faad_mdct_init(2*nshort);
+    fb->mdct2048 = faad_mdct_init(2*frame_len);
+
+    fb->long_window[0]  = sine_long_256;
+    fb->short_window[0] = sine_short_32;
+    fb->long_window[1]  = kbd_long_256;
+    fb->short_window[1] = kbd_short_32;
+
+    return fb;
+}
+
+void ssr_filter_bank_end(fb_info *fb)
+{
+    faad_mdct_end(fb->mdct256);
+    faad_mdct_end(fb->mdct2048);
+
+    if (fb) free(fb);
+}
+
+static INLINE void imdct_ssr(fb_info *fb, real_t *in_data,
+                             real_t *out_data, uint16_t len)
+{
+    mdct_info *mdct;
+
+    switch (len)
+    {
+    case 512:
+        mdct = fb->mdct2048;
+        break;
+    case 64:
+        mdct = fb->mdct256;
+        break;
+    }
+
+    faad_imdct(mdct, in_data, out_data);
+}
+
+/* NON-overlapping inverse filterbank for use with SSR */
+void ssr_ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
+                      uint8_t window_shape_prev, real_t *freq_in,
+                      real_t *time_out, uint16_t frame_len)
+{
+    int16_t i;
+    real_t *transf_buf;
+
+    real_t *window_long;
+    real_t *window_long_prev;
+    real_t *window_short;
+    real_t *window_short_prev;
+
+    uint16_t nlong = frame_len;
+    uint16_t nshort = frame_len/8;
+    uint16_t trans = nshort/2;
+
+    uint16_t nflat_ls = (nlong-nshort)/2;
+
+    transf_buf = (real_t*)malloc(2*nlong*sizeof(real_t));
+
+    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];
+
+    switch (window_sequence)
+    {
+    case ONLY_LONG_SEQUENCE:
+        imdct_ssr(fb, freq_in, transf_buf, 2*nlong);
+        for (i = nlong-1; i >= 0; i--)
+        {
+            time_out[i] = MUL_R_C(transf_buf[i],window_long_prev[i]);
+            time_out[nlong+i] = MUL_R_C(transf_buf[nlong+i],window_long[nlong-1-i]);
+        }
+        break;
+
+    case LONG_START_SEQUENCE:
+        imdct_ssr(fb, freq_in, transf_buf, 2*nlong);
+        for (i = 0; i < nlong; i++)
+            time_out[i] = MUL_R_C(transf_buf[i],window_long_prev[i]);
+        for (i = 0; i < nflat_ls; i++)
+            time_out[nlong+i] = transf_buf[nlong+i];
+        for (i = 0; i < nshort; i++)
+            time_out[nlong+nflat_ls+i] = MUL_R_C(transf_buf[nlong+nflat_ls+i],window_short[nshort-i-1]);
+        for (i = 0; i < nflat_ls; i++)
+            time_out[nlong+nflat_ls+nshort+i] = 0;
+        break;
+
+    case EIGHT_SHORT_SEQUENCE:
+        imdct_ssr(fb, freq_in+0*nshort, transf_buf+2*nshort*0, 2*nshort);
+        imdct_ssr(fb, freq_in+1*nshort, transf_buf+2*nshort*1, 2*nshort);
+        imdct_ssr(fb, freq_in+2*nshort, transf_buf+2*nshort*2, 2*nshort);
+        imdct_ssr(fb, freq_in+3*nshort, transf_buf+2*nshort*3, 2*nshort);
+        imdct_ssr(fb, freq_in+4*nshort, transf_buf+2*nshort*4, 2*nshort);
+        imdct_ssr(fb, freq_in+5*nshort, transf_buf+2*nshort*5, 2*nshort);
+        imdct_ssr(fb, freq_in+6*nshort, transf_buf+2*nshort*6, 2*nshort);
+        imdct_ssr(fb, freq_in+7*nshort, transf_buf+2*nshort*7, 2*nshort);
+        for(i = nshort-1; i >= 0; i--)
+        {
+            time_out[i+0*nshort] = MUL_R_C(transf_buf[nshort*0+i],window_short_prev[i]);
+            time_out[i+1*nshort] = MUL_R_C(transf_buf[nshort*1+i],window_short[i]);
+            time_out[i+2*nshort] = MUL_R_C(transf_buf[nshort*2+i],window_short_prev[i]);
+            time_out[i+3*nshort] = MUL_R_C(transf_buf[nshort*3+i],window_short[i]);
+            time_out[i+4*nshort] = MUL_R_C(transf_buf[nshort*4+i],window_short_prev[i]);
+            time_out[i+5*nshort] = MUL_R_C(transf_buf[nshort*5+i],window_short[i]);
+            time_out[i+6*nshort] = MUL_R_C(transf_buf[nshort*6+i],window_short_prev[i]);
+            time_out[i+7*nshort] = MUL_R_C(transf_buf[nshort*7+i],window_short[i]);
+            time_out[i+8*nshort] = MUL_R_C(transf_buf[nshort*8+i],window_short_prev[i]);
+            time_out[i+9*nshort] = MUL_R_C(transf_buf[nshort*9+i],window_short[i]);
+            time_out[i+10*nshort] = MUL_R_C(transf_buf[nshort*10+i],window_short_prev[i]);
+            time_out[i+11*nshort] = MUL_R_C(transf_buf[nshort*11+i],window_short[i]);
+            time_out[i+12*nshort] = MUL_R_C(transf_buf[nshort*12+i],window_short_prev[i]);
+            time_out[i+13*nshort] = MUL_R_C(transf_buf[nshort*13+i],window_short[i]);
+            time_out[i+14*nshort] = MUL_R_C(transf_buf[nshort*14+i],window_short_prev[i]);
+            time_out[i+15*nshort] = MUL_R_C(transf_buf[nshort*15+i],window_short[i]);
+        }
+        break;
+
+    case LONG_STOP_SEQUENCE:
+        imdct_ssr(fb, freq_in, transf_buf, 2*nlong);
+        for (i = 0; i < nflat_ls; i++)
+            time_out[i] = 0;
+        for (i = 0; i < nshort; i++)
+            time_out[nflat_ls+i] = MUL_R_C(transf_buf[nflat_ls+i],window_short_prev[i]);
+        for (i = 0; i < nflat_ls; i++)
+            time_out[nflat_ls+nshort+i] = transf_buf[nflat_ls+nshort+i];
+        for (i = 0; i < nlong; i++)
+            time_out[nlong+i] = MUL_R_C(transf_buf[nlong+i],window_long[nlong-1-i]);
+		break;
+    }
+
+    free(transf_buf);
+}
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/ssr_fb.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,50 @@
+/*
+** 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
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ssr_fb.h,v 1.2 2003/07/29 08:20:14 menno Exp $
+**/
+
+#ifndef __SSR_FB_H__
+#define __SSR_FB_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+fb_info *ssr_filter_bank_init(uint16_t frame_len);
+void ssr_filter_bank_end(fb_info *fb);
+
+/*non overlapping inverse filterbank */
+void ssr_ifilter_bank(fb_info *fb,
+                      uint8_t window_sequence,
+                      uint8_t window_shape,
+                      uint8_t window_shape_prev,
+                      real_t *freq_in,
+                      real_t *time_out,
+                      uint16_t frame_len);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/ssr_ipqf.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,188 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** 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.3 2003/07/29 08:20:14 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SSR_DEC
+
+#include "ssr.h"
+#include "ssr_ipqf.h"
+
+static real_t **app_pqfbuf;
+static real_t **pp_q0, **pp_t0, **pp_t1;
+
+void gc_set_protopqf(real_t *p_proto)
+{
+    int	j;
+    static real_t a_half[48] =
+    {
+        1.2206911375946939E-05,  1.7261986723798209E-05,  1.2300093657077942E-05,
+        -1.0833943097791965E-05, -5.7772498639901686E-05, -1.2764767618947719E-04,
+        -2.0965186675013334E-04, -2.8166673689263850E-04, -3.1234860429017460E-04,
+        -2.6738519958452353E-04, -1.1949424681824722E-04,  1.3965139412648678E-04,
+        4.8864136409185725E-04,  8.7044629275148344E-04,  1.1949430269934793E-03,
+        1.3519708175026700E-03,  1.2346314373964412E-03,  7.6953209114159191E-04,
+        -5.2242432579537141E-05, -1.1516092887213454E-03, -2.3538469841711277E-03,
+        -3.4033123072127277E-03, -4.0028551071986133E-03, -3.8745415659693259E-03,
+        -2.8321073426874310E-03, -8.5038892323704195E-04,  1.8856751185350931E-03,
+        4.9688741735340923E-03,  7.8056704536795926E-03,  9.7027909685901654E-03,
+        9.9960423120166159E-03,  8.2019366335594487E-03,  4.1642072876103365E-03,
+        -1.8364453822737758E-03, -9.0384863094167686E-03, -1.6241528177129844E-02,
+        -2.1939551286300665E-02, -2.4533179947088161E-02, -2.2591663337768787E-02,
+        -1.5122066420044672E-02, -1.7971713448186293E-03,  1.6903413428575379E-02,
+        3.9672315874127042E-02,  6.4487527248102796E-02,  8.8850025474701726E-02,
+        0.1101132906105560    ,  0.1258540205143761    ,  0.1342239368467012    
+    };
+
+    for (j = 0; j < 48; ++j)
+    {
+        p_proto[j] = p_proto[95-j] = a_half[j];
+    }
+}
+
+void gc_setcoef_eff_pqfsyn(int mm,
+                           int kk,
+                           real_t *p_proto,
+                           real_t ***ppp_q0,
+                           real_t ***ppp_t0,
+                           real_t ***ppp_t1)
+{
+    int	i, k, n;
+    real_t	w;
+
+    /* Set 1st Mul&Acc Coef's */
+    *ppp_q0 = (real_t **) calloc(mm, sizeof(real_t *));
+    for (n = 0; n < mm; ++n)
+    {
+        (*ppp_q0)[n] = (real_t *) calloc(mm, sizeof(real_t));
+    }
+    for (n = 0; n < mm/2; ++n)
+    {
+        for (i = 0; i < mm; ++i)
+        {
+            w = (2*i+1)*(2*n+1-mm)*M_PI/(4*mm);
+            (*ppp_q0)[n][i] = 2.0 * cos((real_t) w);
+
+            w = (2*i+1)*(2*(mm+n)+1-mm)*M_PI/(4*mm);
+            (*ppp_q0)[n + mm/2][i] = 2.0 * cos((real_t) w);
+        }
+    }
+
+    /* Set 2nd Mul&Acc Coef's */
+    *ppp_t0 = (real_t **) calloc(mm, sizeof(real_t *));
+    *ppp_t1 = (real_t **) calloc(mm, sizeof(real_t *));
+    for (n = 0; n < mm; ++n)
+    {
+        (*ppp_t0)[n] = (real_t *) calloc(kk, sizeof(real_t));
+        (*ppp_t1)[n] = (real_t *) calloc(kk, sizeof(real_t));
+    }
+    for (n = 0; n < mm; ++n)
+    {
+        for (k = 0; k < kk; ++k)
+        {
+            (*ppp_t0)[n][k] = mm * p_proto[2*k    *mm + n];
+            (*ppp_t1)[n][k] = mm * p_proto[(2*k+1)*mm + n];
+
+            if (k%2 != 0)
+            {
+                (*ppp_t0)[n][k] = -(*ppp_t0)[n][k];
+                (*ppp_t1)[n][k] = -(*ppp_t1)[n][k];
+            }
+        }
+    }
+}
+
+void ssr_ipqf(ssr_info *ssr, real_t *in_data, real_t *out_data,
+              real_t buffer[SSR_BANDS][96/4],
+              uint16_t frame_len, uint8_t bands)
+{
+    static int initFlag = 0;
+    real_t a_pqfproto[PQFTAPS];
+
+    int	i;
+
+    if (initFlag == 0)
+    {
+        gc_set_protopqf(a_pqfproto);
+        gc_setcoef_eff_pqfsyn(SSR_BANDS, PQFTAPS/(2*SSR_BANDS), a_pqfproto,
+            &pp_q0, &pp_t0, &pp_t1);
+        initFlag = 1;
+    }
+
+    for (i = 0; i < frame_len / SSR_BANDS; i++)
+    {
+        int l, n, k;
+        int mm = SSR_BANDS;
+        int kk = PQFTAPS/(2*SSR_BANDS);
+
+        for (n = 0; n < mm; n++)
+        {
+            for (k = 0; k < 2*kk-1; k++)
+            {
+                buffer[n][k] = buffer[n][k+1];
+            }
+        }
+
+        for (n = 0; n < mm; n++)
+        {
+            real_t acc = 0.0;
+            for (l = 0; l < mm; l++)
+            {
+                acc += pp_q0[n][l] * in_data[l*frame_len/SSR_BANDS + i];
+            }
+            buffer[n][2*kk-1] = acc;
+        }
+
+        for (n = 0; n < mm/2; n++)
+        {
+            real_t acc = 0.0;
+            for (k = 0; k < kk; k++)
+            {
+                acc += pp_t0[n][k] * buffer[n][2*kk-1-2*k];
+            }
+            for (k = 0; k < kk; ++k)
+            {
+                acc += pp_t1[n][k] * buffer[n + mm/2][2*kk-2-2*k];
+            }
+            out_data[i*SSR_BANDS + n] = acc;
+
+            acc = 0.0;
+            for (k = 0; k < kk; k++)
+            {
+                acc += pp_t0[mm-1-n][k] * buffer[n][2*kk-1-2*k];
+            }
+            for (k = 0; k < kk; k++)
+            {
+                acc -= pp_t1[mm-1-n][k] * buffer[n + mm/2][2*kk-2-2*k];
+            }
+            out_data[i*SSR_BANDS + mm-1-n] = acc;
+        }
+    }
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/ssr_ipqf.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,43 @@
+/*
+** 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
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ssr_ipqf.h,v 1.3 2003/07/29 08:20:14 menno Exp $
+**/
+
+#ifndef __SSR_IPQF_H__
+#define __SSR_IPQF_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void ssr_ipqf(ssr_info *ssr, real_t *in_data, real_t *out_data,
+              real_t buffer[SSR_BANDS][96/4],
+              uint16_t frame_len, uint8_t bands);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/ssr_win.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,632 @@
+/*
+** 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
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ssr_win.h,v 1.2 2003/07/29 08:20:14 menno Exp $
+**/
+
+#ifndef __SSR_WIN_H__
+#define __SSR_WIN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+
+static real_t sine_short_32[] = {
+    0.0245412290,
+    0.0735645667,
+    0.1224106774,
+    0.1709618866,
+    0.2191012502,
+    0.2667127550,
+    0.3136817515,
+    0.3598950505,
+    0.4052413106,
+    0.4496113360,
+    0.4928981960,
+    0.5349976420,
+    0.5758082271,
+    0.6152316332,
+    0.6531728506,
+    0.6895405650,
+    0.7242470980,
+    0.7572088838,
+    0.7883464694,
+    0.8175848126,
+    0.8448535800,
+    0.8700870275,
+    0.8932242990,
+    0.9142097831,
+    0.9329928160,
+    0.9495282173,
+    0.9637760520,
+    0.9757021666,
+    0.9852776527,
+    0.9924795628,
+    0.9972904325,
+    0.9996988177
+};
+
+static real_t sine_long_256[] = {
+    0.0030679568,
+    0.0092037553,
+    0.0153392069,
+    0.0214740802,
+    0.0276081469,
+    0.0337411724,
+    0.0398729295,
+    0.0460031852,
+    0.0521317050,
+    0.0582582653,
+    0.0643826351,
+    0.0705045760,
+    0.0766238645,
+    0.0827402696,
+    0.0888535529,
+    0.0949634984,
+    0.1010698676,
+    0.1071724296,
+    0.1132709533,
+    0.1193652153,
+    0.1254549921,
+    0.1315400302,
+    0.1376201212,
+    0.1436950415,
+    0.1497645378,
+    0.1558284014,
+    0.1618863940,
+    0.1679383069,
+    0.1739838719,
+    0.1800229102,
+    0.1860551536,
+    0.1920804083,
+    0.1980984211,
+    0.2041089684,
+    0.2101118416,
+    0.2161068022,
+    0.2220936269,
+    0.2280720919,
+    0.2340419590,
+    0.2400030345,
+    0.2459550500,
+    0.2518978119,
+    0.2578310966,
+    0.2637546957,
+    0.2696683407,
+    0.2755718231,
+    0.2814649343,
+    0.2873474658,
+    0.2932191789,
+    0.2990798354,
+    0.3049292266,
+    0.3107671738,
+    0.3165933788,
+    0.3224076927,
+    0.3282098472,
+    0.3339996636,
+    0.3397769034,
+    0.3455413282,
+    0.3512927592,
+    0.3570309579,
+    0.3627557456,
+    0.3684668541,
+    0.3741640747,
+    0.3798472285,
+    0.3855160773,
+    0.3911703825,
+    0.3968099952,
+    0.4024346471,
+    0.4080441594,
+    0.4136383235,
+    0.4192169011,
+    0.4247796834,
+    0.4303264916,
+    0.4358570874,
+    0.4413712919,
+    0.4468688369,
+    0.4523496032,
+    0.4578133225,
+    0.4632597864,
+    0.4686888456,
+    0.4741002321,
+    0.4794937670,
+    0.4848692715,
+    0.4902265072,
+    0.4955652654,
+    0.5008853674,
+    0.5061866641,
+    0.5114688873,
+    0.5167317986,
+    0.5219752789,
+    0.5271991491,
+    0.5324031115,
+    0.5375871062,
+    0.5427507758,
+    0.5478940606,
+    0.5530167222,
+    0.5581185222,
+    0.5631993413,
+    0.5682589412,
+    0.5732972026,
+    0.5783138275,
+    0.5833086967,
+    0.5882815719,
+    0.5932323337,
+    0.5981607437,
+    0.6030666232,
+    0.6079497933,
+    0.6128100753,
+    0.6176473498,
+    0.6224613190,
+    0.6272518039,
+    0.6320187449,
+    0.6367619038,
+    0.6414810419,
+    0.6461760402,
+    0.6508467197,
+    0.6554928422,
+    0.6601143479,
+    0.6647109985,
+    0.6692826152,
+    0.6738290191,
+    0.6783500314,
+    0.6828455329,
+    0.6873153448,
+    0.6917592883,
+    0.6961771250,
+    0.7005687952,
+    0.7049341202,
+    0.7092728615,
+    0.7135848999,
+    0.7178700566,
+    0.7221282125,
+    0.7263591886,
+    0.7305628061,
+    0.7347388864,
+    0.7388873696,
+    0.7430079579,
+    0.7471006513,
+    0.7511651516,
+    0.7552013993,
+    0.7592092156,
+    0.7631884217,
+    0.7671388984,
+    0.7710605264,
+    0.7749531269,
+    0.7788165212,
+    0.7826505899,
+    0.7864552140,
+    0.7902302146,
+    0.7939754725,
+    0.7976908684,
+    0.8013761640,
+    0.8050313592,
+    0.8086562157,
+    0.8122506142,
+    0.8158144355,
+    0.8193475604,
+    0.8228498101,
+    0.8263210654,
+    0.8297612667,
+    0.8331701756,
+    0.8365477324,
+    0.8398938179,
+    0.8432082534,
+    0.8464909792,
+    0.8497417569,
+    0.8529606462,
+    0.8561473489,
+    0.8593018055,
+    0.8624239564,
+    0.8655136228,
+    0.8685707450,
+    0.8715950847,
+    0.8745866418,
+    0.8775452971,
+    0.8804709315,
+    0.8833633661,
+    0.8862225413,
+    0.8890483975,
+    0.8918406963,
+    0.8945994973,
+    0.8973246217,
+    0.9000158906,
+    0.9026733041,
+    0.9052967429,
+    0.9078861475,
+    0.9104412794,
+    0.9129621983,
+    0.9154487252,
+    0.9179008007,
+    0.9203183055,
+    0.9227011204,
+    0.9250492454,
+    0.9273625612,
+    0.9296408892,
+    0.9318842888,
+    0.9340925813,
+    0.9362657070,
+    0.9384035468,
+    0.9405061007,
+    0.9425731897,
+    0.9446048737,
+    0.9466009140,
+    0.9485613704,
+    0.9504860640,
+    0.9523749948,
+    0.9542281032,
+    0.9560452700,
+    0.9578264356,
+    0.9595715404,
+    0.9612805247,
+    0.9629532695,
+    0.9645897746,
+    0.9661900401,
+    0.9677538276,
+    0.9692812562,
+    0.9707721472,
+    0.9722265005,
+    0.9736442566,
+    0.9750253558,
+    0.9763697386,
+    0.9776773453,
+    0.9789481759,
+    0.9801821709,
+    0.9813792109,
+    0.9825392962,
+    0.9836624265,
+    0.9847484827,
+    0.9857975245,
+    0.9868094325,
+    0.9877841473,
+    0.9887216687,
+    0.9896219969,
+    0.9904850721,
+    0.9913108945,
+    0.9920993447,
+    0.9928504229,
+    0.9935641289,
+    0.9942404628,
+    0.9948793054,
+    0.9954807758,
+    0.9960446954,
+    0.9965711236,
+    0.9970600605,
+    0.9975114465,
+    0.9979252815,
+    0.9983015656,
+    0.9986402392,
+    0.9989413023,
+    0.9992047548,
+    0.9994305968,
+    0.9996188283,
+    0.9997693896,
+    0.9998823404,
+    0.9999576211,
+    0.9999952912
+};
+
+static real_t kbd_short_32[] = {
+    0.0000875914060105,
+    0.0009321760265333,
+    0.0032114611466596,
+    0.0081009893216786,
+    0.0171240286619181,
+    0.0320720743527833,
+    0.0548307856028528,
+    0.0871361822564870,
+    0.1302923415174603,
+    0.1848955425508276,
+    0.2506163195331889,
+    0.3260874142923209,
+    0.4089316830907141,
+    0.4959414909423747,
+    0.5833939894958904,
+    0.6674601983218376,
+    0.7446454751465113,
+    0.8121892962974020,
+    0.8683559394406505,
+    0.9125649996381605,
+    0.9453396205809574,
+    0.9680864942677585,
+    0.9827581789763112,
+    0.9914756203467121,
+    0.9961964092194694,
+    0.9984956609571091,
+    0.9994855586984285,
+    0.9998533730714648,
+    0.9999671864476404,
+    0.9999948432453556,
+    0.9999995655238333,
+    0.9999999961638728
+};
+
+
+static real_t kbd_long_256[] = {
+    0.0005851230124487,
+    0.0009642149851497,
+    0.0013558207534965,
+    0.0017771849644394,
+    0.0022352533849672,
+    0.0027342299070304,
+    0.0032773001022195,
+    0.0038671998069216,
+    0.0045064443384152,
+    0.0051974336885144,
+    0.0059425050016407,
+    0.0067439602523141,
+    0.0076040812644888,
+    0.0085251378135895,
+    0.0095093917383048,
+    0.0105590986429280,
+    0.0116765080854300,
+    0.0128638627792770,
+    0.0141233971318631,
+    0.0154573353235409,
+    0.0168678890600951,
+    0.0183572550877256,
+    0.0199276125319803,
+    0.0215811201042484,
+    0.0233199132076965,
+    0.0251461009666641,
+    0.0270617631981826,
+    0.0290689473405856,
+    0.0311696653515848,
+    0.0333658905863535,
+    0.0356595546648444,
+    0.0380525443366107,
+    0.0405466983507029,
+    0.0431438043376910,
+    0.0458455957104702,
+    0.0486537485902075,
+    0.0515698787635492,
+    0.0545955386770205,
+    0.0577322144743916,
+    0.0609813230826460,
+    0.0643442093520723,
+    0.0678221432558827,
+    0.0714163171546603,
+    0.0751278431308314,
+    0.0789577503982528,
+    0.0829069827918993,
+    0.0869763963425241,
+    0.0911667569410503,
+    0.0954787380973307,
+    0.0999129187977865,
+    0.1044697814663005,
+    0.1091497100326053,
+    0.1139529881122542,
+    0.1188797973021148,
+    0.1239302155951605,
+    0.1291042159181728,
+    0.1344016647957880,
+    0.1398223211441467,
+    0.1453658351972151,
+    0.1510317475686540,
+    0.1568194884519144,
+    0.1627283769610327,
+    0.1687576206143887,
+    0.1749063149634756,
+    0.1811734433685097,
+    0.1875578769224857,
+    0.1940583745250518,
+    0.2006735831073503,
+    0.2074020380087318,
+    0.2142421635060113,
+    0.2211922734956977,
+    0.2282505723293797,
+    0.2354151558022098,
+    0.2426840122941792,
+    0.2500550240636293,
+    0.2575259686921987,
+    0.2650945206801527,
+    0.2727582531907993,
+    0.2805146399424422,
+    0.2883610572460804,
+    0.2962947861868143,
+    0.3043130149466800,
+    0.3124128412663888,
+    0.3205912750432127,
+    0.3288452410620226,
+    0.3371715818562547,
+    0.3455670606953511,
+    0.3540283646950029,
+    0.3625521080463003,
+    0.3711348353596863,
+    0.3797730251194006,
+    0.3884630932439016,
+    0.3972013967475546,
+    0.4059842374986933,
+    0.4148078660689724,
+    0.4236684856687616,
+    0.4325622561631607,
+    0.4414852981630577,
+    0.4504336971855032,
+    0.4594035078775303,
+    0.4683907582974173,
+    0.4773914542472655,
+    0.4864015836506502,
+    0.4954171209689973,
+    0.5044340316502417,
+    0.5134482766032377,
+    0.5224558166913167,
+    0.5314526172383208,
+    0.5404346525403849,
+    0.5493979103766972,
+    0.5583383965124314,
+    0.5672521391870222,
+    0.5761351935809411,
+    0.5849836462541291,
+    0.5937936195492526,
+    0.6025612759529649,
+    0.6112828224083939,
+    0.6199545145721097,
+    0.6285726610088878,
+    0.6371336273176413,
+    0.6456338401819751,
+    0.6540697913388968,
+    0.6624380414593221,
+    0.6707352239341151,
+    0.6789580485595255,
+    0.6871033051160131,
+    0.6951678668345944,
+    0.7031486937449871,
+    0.7110428359000029,
+    0.7188474364707993,
+    0.7265597347077880,
+    0.7341770687621900,
+    0.7416968783634273,
+    0.7491167073477523,
+    0.7564342060337386,
+    0.7636471334404891,
+    0.7707533593446514,
+    0.7777508661725849,
+    0.7846377507242818,
+    0.7914122257259034,
+    0.7980726212080798,
+    0.8046173857073919,
+    0.8110450872887550,
+    0.8173544143867162,
+    0.8235441764639875,
+    0.8296133044858474,
+    0.8355608512093652,
+    0.8413859912867303,
+    0.8470880211822968,
+    0.8526663589032990,
+    0.8581205435445334,
+    0.8634502346476508,
+    0.8686552113760616,
+    0.8737353715068081,
+    0.8786907302411250,
+    0.8835214188357692,
+    0.8882276830575707,
+    0.8928098814640207,
+    0.8972684835130879,
+    0.9016040675058185,
+    0.9058173183656508,
+    0.9099090252587376,
+    0.9138800790599416,
+    0.9177314696695282,
+    0.9214642831859411,
+    0.9250796989403991,
+    0.9285789863994010,
+    0.9319635019415643,
+    0.9352346855155568,
+    0.9383940571861993,
+    0.9414432135761304,
+    0.9443838242107182,
+    0.9472176277741918,
+    0.9499464282852282,
+    0.9525720912004834,
+    0.9550965394547873,
+    0.9575217494469370,
+    0.9598497469802043,
+    0.9620826031668507,
+    0.9642224303060783,
+    0.9662713777449607,
+    0.9682316277319895,
+    0.9701053912729269,
+    0.9718949039986892,
+    0.9736024220549734,
+    0.9752302180233160,
+    0.9767805768831932,
+    0.9782557920246753,
+    0.9796581613210076,
+    0.9809899832703159,
+    0.9822535532154261,
+    0.9834511596505429,
+    0.9845850806232530,
+    0.9856575802399989,
+    0.9866709052828243,
+    0.9876272819448033,
+    0.9885289126911557,
+    0.9893779732525968,
+    0.9901766097569984,
+    0.9909269360049311,
+    0.9916310308941294,
+    0.9922909359973702,
+    0.9929086532976777,
+    0.9934861430841844,
+    0.9940253220113651,
+    0.9945280613237534,
+    0.9949961852476154,
+    0.9954314695504363,
+    0.9958356402684387,
+    0.9962103726017252,
+    0.9965572899760172,
+    0.9968779632693499,
+    0.9971739102014799,
+    0.9974465948831872,
+    0.9976974275220812,
+    0.9979277642809907,
+    0.9981389072844972,
+    0.9983321047686901,
+    0.9985085513687731,
+    0.9986693885387259,
+    0.9988157050968516,
+    0.9989485378906924,
+    0.9990688725744943,
+    0.9991776444921379,
+    0.9992757396582338,
+    0.9993639958299003,
+    0.9994432036616085,
+    0.9995141079353859,
+    0.9995774088586188,
+    0.9996337634216871,
+    0.9996837868076957,
+    0.9997280538466377,
+    0.9997671005064359,
+    0.9998014254134544,
+    0.9998314913952471,
+    0.9998577270385304,
+    0.9998805282555989,
+    0.9999002598526793,
+    0.9999172570940037,
+    0.9999318272557038,
+    0.9999442511639580,
+    0.9999547847121726,
+    0.9999636603523446,
+    0.9999710885561258,
+    0.9999772592414866,
+    0.9999823431612708,
+    0.9999864932503106,
+    0.9999898459281599,
+    0.9999925223548691,
+    0.9999946296375997,
+    0.9999962619864214,
+    0.9999975018180320,
+    0.9999984208055542,
+    0.9999990808746198,
+    0.9999995351446231,
+    0.9999998288155155
+};
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/structs.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,427 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: structs.h,v 1.10 2003/07/29 08:20:14 menno Exp $
+**/
+
+#ifndef __STRUCTS_H__
+#define __STRUCTS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef SBR_DEC
+#include "sbr_dec.h"
+#endif
+
+#define MAX_CHANNELS        64
+#define MAX_SYNTAX_ELEMENTS 48
+#define MAX_WINDOW_GROUPS    8
+#define MAX_SFB             51
+#define MAX_LTP_SFB         40
+#define MAX_LTP_SFB_S        8
+
+/* used to save the prediction state */
+typedef struct {
+    real_t r[2];
+    real_t KOR[2];
+    real_t VAR[2];
+} pred_state;
+
+typedef struct
+{
+    uint16_t n;
+    uint16_t ifac[15];
+    complex_t *work;
+    complex_t *tab;
+} cfft_info;
+
+typedef struct {
+    uint16_t N;
+    cfft_info *cfft;
+    complex_t *sincos;
+    complex_t *Z1;
+} mdct_info;
+
+typedef struct
+{
+    real_t *long_window[2];
+    real_t *short_window[2];
+#ifdef LD_DEC
+    real_t *ld_window[2];
+#endif
+
+    mdct_info *mdct256;
+#ifdef LD_DEC
+    mdct_info *mdct1024;
+#endif
+    mdct_info *mdct2048;
+} fb_info;
+
+typedef struct
+{
+    uint8_t 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];
+
+    real_t ctrl1;
+    real_t ctrl2;
+} drc_info;
+
+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];
+
+    uint8_t channels;
+
+    uint8_t comment_field_bytes;
+    uint8_t 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];
+} 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;
+} 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;
+
+    /* maximum of 16 PCEs */
+    program_config pce[16];
+} adif_header;
+
+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];
+} ltp_info;
+
+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];
+} 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];
+} tns_info;
+
+#ifdef SSR_DEC
+typedef struct
+{
+    uint8_t max_band;
+
+    uint8_t adjust_num[4][8];
+    uint8_t alevcode[4][8][8];
+    uint8_t aloccode[4][8][8];
+} ssr_info;
+#endif
+
+typedef struct
+{
+    uint8_t 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];
+
+    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 */
+
+    uint8_t global_gain;
+    int16_t scale_factors[8][51];
+
+    uint8_t ms_mask_present;
+    uint8_t ms_used[MAX_WINDOW_GROUPS][MAX_SFB];
+
+    uint8_t noise_used;
+
+    uint8_t pulse_data_present;
+    uint8_t tns_data_present;
+    uint8_t gain_control_data_present;
+    uint8_t predictor_data_present;
+
+    pulse_info pul;
+    tns_info tns;
+    pred_info pred;
+    ltp_info ltp;
+    ltp_info ltp2;
+#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;
+    /* 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;
+#endif
+} ic_stream; /* individual channel stream */
+
+typedef struct
+{
+    uint8_t ele_id;
+
+    uint8_t channel;
+    int16_t paired_channel;
+
+    uint8_t element_instance_tag;
+    uint8_t common_window;
+
+    ic_stream ics1;
+    ic_stream ics2;
+} element; /* syntax element (SCE, CPE, LFE) */
+
+typedef struct mp4AudioSpecificConfig
+{
+    /* Audio Specific Info */
+    uint8_t objectTypeIndex;
+    uint8_t samplingFrequencyIndex;
+    uint32_t samplingFrequency;
+    uint8_t 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;
+
+    int8_t sbr_present_flag;
+} mp4AudioSpecificConfig;
+
+typedef struct faacDecConfiguration
+{
+    uint8_t defObjectType;
+    uint32_t defSampleRate;
+    uint8_t outputFormat;
+    uint8_t downMatrix;
+} faacDecConfiguration, *faacDecConfigurationPtr;
+
+typedef struct faacDecFrameInfo
+{
+    uint32_t bytesconsumed;
+    uint32_t samples;
+    uint8_t channels;
+    uint8_t error;
+    uint32_t samplerate;
+
+    /* 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;
+
+typedef struct
+{
+    uint8_t adts_header_present;
+    uint8_t adif_header_present;
+    uint8_t sf_index;
+    uint8_t object_type;
+    uint8_t channelConfiguration;
+#ifdef ERROR_RESILIENCE
+    uint8_t aacSectionDataResilienceFlag;
+    uint8_t aacScalefactorDataResilienceFlag;
+    uint8_t aacSpectralDataResilienceFlag;
+#endif
+    uint16_t frameLength;
+    uint16_t samplesLeft;
+    uint8_t postSeekResetFlag;
+
+    uint32_t frame;
+
+    uint8_t downMatrix;
+    uint8_t first_syn_ele;
+    uint8_t last_syn_ele;
+    uint8_t has_lfe;
+    uint8_t fr_channels;
+    uint8_t fr_ch_ele;
+
+    void *sample_buffer;
+
+    uint8_t window_shape_prev[MAX_CHANNELS];
+#ifdef LTP_DEC
+    uint16_t ltp_lag[MAX_CHANNELS];
+#endif
+    fb_info *fb;
+    drc_info *drc;
+
+    real_t *time_out[MAX_CHANNELS];
+
+#ifdef SBR_DEC
+    int8_t sbr_present_flag;
+
+    real_t *time_out2[MAX_CHANNELS];
+
+    uint8_t sbr_used[32];
+
+    sbr_info *sbr[32];
+#endif
+
+#ifdef SSR_DEC
+    real_t *ssr_overlap[MAX_CHANNELS];
+    real_t *prev_fmd[MAX_CHANNELS];
+    real_t ipqf_buffer[MAX_CHANNELS][4][96/4];
+#endif
+
+#ifdef MAIN_DEC
+    pred_state *pred_stat[MAX_CHANNELS];
+#endif
+#ifdef LTP_DEC
+    real_t *lt_pred_stat[MAX_CHANNELS];
+#endif
+
+#ifndef FIXED_POINT
+#if POW_TABLE_SIZE
+    real_t *pow2_table;
+#endif
+#endif
+
+    /* Program Config Element */
+    uint8_t pce_set;
+    program_config pce;
+    uint8_t channel_element[MAX_CHANNELS];
+    uint8_t internal_channel[MAX_CHANNELS];
+
+    /* Configuration data */
+    faacDecConfiguration config;
+} faacDecStruct, *faacDecHandle;
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/syntax.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,1960 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: syntax.c,v 1.51 2003/07/29 08:20:14 menno Exp $
+**/
+
+/*
+   Reads the AAC bitstream as defined in 14496-3 (MPEG-4 Audio)
+*/
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "decoder.h"
+#include "syntax.h"
+#include "specrec.h"
+#include "huffman.h"
+#include "bits.h"
+#include "pulse.h"
+#include "analysis.h"
+#include "drc.h"
+#ifdef ERROR_RESILIENCE
+#include "rvlc.h"
+#endif
+#ifdef SBR_DEC
+#include "sbr_syntax.h"
+#endif
+
+
+/* Table 4.4.1 */
+int8_t GASpecificConfig(bitfile *ld, mp4AudioSpecificConfig *mp4ASC,
+                        program_config *pce_out)
+{
+    program_config pce;
+
+    /* 1024 or 960 */
+    mp4ASC->frameLengthFlag = faad_get1bit(ld
+        DEBUGVAR(1,138,"GASpecificConfig(): FrameLengthFlag"));
+
+    mp4ASC->dependsOnCoreCoder = faad_get1bit(ld
+        DEBUGVAR(1,139,"GASpecificConfig(): DependsOnCoreCoder"));
+    if (mp4ASC->dependsOnCoreCoder == 1)
+    {
+        mp4ASC->coreCoderDelay = (uint16_t)faad_getbits(ld, 14
+            DEBUGVAR(1,140,"GASpecificConfig(): CoreCoderDelay"));
+    }
+
+    mp4ASC->extensionFlag = faad_get1bit(ld DEBUGVAR(1,141,"GASpecificConfig(): ExtensionFlag"));
+    if (mp4ASC->channelsConfiguration == 0)
+    {
+        program_config_element(&pce, ld);
+        //mp4ASC->channelsConfiguration = pce.channels;
+
+        if (pce_out != NULL)
+            memcpy(pce_out, &pce, sizeof(program_config));
+
+        /*
+        if (pce.num_valid_cc_elements)
+            return -3;
+        */
+    }
+
+#ifdef ERROR_RESILIENCE
+    if (mp4ASC->extensionFlag == 1)
+    {
+        /* Error resilience not supported yet */
+        if (mp4ASC->objectTypeIndex >= ER_OBJECT_START)
+        {
+            mp4ASC->aacSectionDataResilienceFlag = faad_get1bit(ld
+                DEBUGVAR(1,144,"GASpecificConfig(): aacSectionDataResilienceFlag"));
+            mp4ASC->aacScalefactorDataResilienceFlag = faad_get1bit(ld
+                DEBUGVAR(1,145,"GASpecificConfig(): aacScalefactorDataResilienceFlag"));
+            mp4ASC->aacSpectralDataResilienceFlag = faad_get1bit(ld
+                DEBUGVAR(1,146,"GASpecificConfig(): aacSpectralDataResilienceFlag"));
+
+            /* 1 bit: extensionFlag3 */
+        }
+    }
+#endif
+
+    return 0;
+}
+
+/* Table 4.4.2 */
+/* An MPEG-4 Audio decoder is only required to follow the Program
+   Configuration Element in GASpecificConfig(). The decoder shall ignore
+   any Program Configuration Elements that may occur in raw data blocks.
+   PCEs transmitted in raw data blocks cannot be used to convey decoder
+   configuration information.
+*/
+uint8_t program_config_element(program_config *pce, bitfile *ld)
+{
+    uint8_t i;
+
+    memset(pce, 0, sizeof(program_config));
+
+    pce->channels = 0;
+
+    pce->element_instance_tag = (uint8_t)faad_getbits(ld, 4
+        DEBUGVAR(1,10,"program_config_element(): element_instance_tag"));
+
+    pce->object_type = (uint8_t)faad_getbits(ld, 2
+        DEBUGVAR(1,11,"program_config_element(): object_type"));
+    pce->sf_index = (uint8_t)faad_getbits(ld, 4
+        DEBUGVAR(1,12,"program_config_element(): sf_index"));
+    pce->num_front_channel_elements = (uint8_t)faad_getbits(ld, 4
+        DEBUGVAR(1,13,"program_config_element(): num_front_channel_elements"));
+    pce->num_side_channel_elements = (uint8_t)faad_getbits(ld, 4
+        DEBUGVAR(1,14,"program_config_element(): num_side_channel_elements"));
+    pce->num_back_channel_elements = (uint8_t)faad_getbits(ld, 4
+        DEBUGVAR(1,15,"program_config_element(): num_back_channel_elements"));
+    pce->num_lfe_channel_elements = (uint8_t)faad_getbits(ld, 2
+        DEBUGVAR(1,16,"program_config_element(): num_lfe_channel_elements"));
+    pce->num_assoc_data_elements = (uint8_t)faad_getbits(ld, 3
+        DEBUGVAR(1,17,"program_config_element(): num_assoc_data_elements"));
+    pce->num_valid_cc_elements = (uint8_t)faad_getbits(ld, 4
+        DEBUGVAR(1,18,"program_config_element(): num_valid_cc_elements"));
+
+    pce->mono_mixdown_present = faad_get1bit(ld
+        DEBUGVAR(1,19,"program_config_element(): mono_mixdown_present"));
+    if (pce->mono_mixdown_present == 1)
+    {
+        pce->mono_mixdown_element_number = (uint8_t)faad_getbits(ld, 4
+            DEBUGVAR(1,20,"program_config_element(): mono_mixdown_element_number"));
+    }
+
+    pce->stereo_mixdown_present = faad_get1bit(ld
+        DEBUGVAR(1,21,"program_config_element(): stereo_mixdown_present"));
+    if (pce->stereo_mixdown_present == 1)
+    {
+        pce->stereo_mixdown_element_number = (uint8_t)faad_getbits(ld, 4
+            DEBUGVAR(1,22,"program_config_element(): stereo_mixdown_element_number"));
+    }
+
+    pce->matrix_mixdown_idx_present = faad_get1bit(ld
+        DEBUGVAR(1,23,"program_config_element(): matrix_mixdown_idx_present"));
+    if (pce->matrix_mixdown_idx_present == 1)
+    {
+        pce->matrix_mixdown_idx = (uint8_t)faad_getbits(ld, 2
+            DEBUGVAR(1,24,"program_config_element(): matrix_mixdown_idx"));
+        pce->pseudo_surround_enable = faad_get1bit(ld
+            DEBUGVAR(1,25,"program_config_element(): pseudo_surround_enable"));
+    }
+
+    for (i = 0; i < pce->num_front_channel_elements; i++)
+    {
+        pce->front_element_is_cpe[i] = faad_get1bit(ld
+            DEBUGVAR(1,26,"program_config_element(): front_element_is_cpe"));
+        pce->front_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4
+            DEBUGVAR(1,27,"program_config_element(): front_element_tag_select"));
+
+        if (pce->front_element_is_cpe[i] & 1)
+        {
+            pce->cpe_channel[pce->front_element_tag_select[i]] = pce->channels;
+            pce->num_front_channels += 2;
+            pce->channels += 2;
+        } else {
+            pce->sce_channel[pce->front_element_tag_select[i]] = pce->channels;
+            pce->num_front_channels++;
+            pce->channels++;
+        }
+    }
+
+    for (i = 0; i < pce->num_side_channel_elements; i++)
+    {
+        pce->side_element_is_cpe[i] = faad_get1bit(ld
+            DEBUGVAR(1,28,"program_config_element(): side_element_is_cpe"));
+        pce->side_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4
+            DEBUGVAR(1,29,"program_config_element(): side_element_tag_select"));
+
+        if (pce->side_element_is_cpe[i] & 1)
+        {
+            pce->cpe_channel[pce->side_element_tag_select[i]] = pce->channels;
+            pce->num_side_channels += 2;
+            pce->channels += 2;
+        } else {
+            pce->sce_channel[pce->side_element_tag_select[i]] = pce->channels;
+            pce->num_side_channels++;
+            pce->channels++;
+        }
+    }
+
+    for (i = 0; i < pce->num_back_channel_elements; i++)
+    {
+        pce->back_element_is_cpe[i] = faad_get1bit(ld
+            DEBUGVAR(1,30,"program_config_element(): back_element_is_cpe"));
+        pce->back_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4
+            DEBUGVAR(1,31,"program_config_element(): back_element_tag_select"));
+
+        if (pce->back_element_is_cpe[i] & 1)
+        {
+            pce->cpe_channel[pce->back_element_tag_select[i]] = pce->channels;
+            pce->channels += 2;
+            pce->num_back_channels += 2;
+        } else {
+            pce->sce_channel[pce->back_element_tag_select[i]] = pce->channels;
+            pce->num_back_channels++;
+            pce->channels++;
+        }
+    }
+
+    for (i = 0; i < pce->num_lfe_channel_elements; i++)
+    {
+        pce->lfe_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4
+            DEBUGVAR(1,32,"program_config_element(): lfe_element_tag_select"));
+
+        pce->sce_channel[pce->lfe_element_tag_select[i]] = pce->channels;
+        pce->num_lfe_channels++;
+        pce->channels++;
+    }
+
+    for (i = 0; i < pce->num_assoc_data_elements; i++)
+        pce->assoc_data_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4
+        DEBUGVAR(1,33,"program_config_element(): assoc_data_element_tag_select"));
+
+    for (i = 0; i < pce->num_valid_cc_elements; i++)
+    {
+        pce->cc_element_is_ind_sw[i] = faad_get1bit(ld
+            DEBUGVAR(1,34,"program_config_element(): cc_element_is_ind_sw"));
+        pce->valid_cc_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4
+            DEBUGVAR(1,35,"program_config_element(): valid_cc_element_tag_select"));
+    }
+
+    faad_byte_align(ld);
+
+    pce->comment_field_bytes = (uint8_t)faad_getbits(ld, 8
+        DEBUGVAR(1,36,"program_config_element(): comment_field_bytes"));
+
+    for (i = 0; i < pce->comment_field_bytes; i++)
+    {
+        pce->comment_field_data[i] = (uint8_t)faad_getbits(ld, 8
+            DEBUGVAR(1,37,"program_config_element(): comment_field_data"));
+    }
+    pce->comment_field_data[i] = 0;
+
+    return 0;
+}
+
+element *decode_sce_lfe(faacDecHandle hDecoder,
+                        faacDecFrameInfo *hInfo, bitfile *ld,
+                        int16_t **spec_data, real_t **spec_coef,
+                        uint8_t id_syn_ele)
+{
+    element *ele;
+    uint8_t channels = hDecoder->fr_channels;
+
+    if (channels+1 > MAX_CHANNELS)
+    {
+        hInfo->error = 12;
+        return NULL;
+    }
+    if (hDecoder->fr_ch_ele+1 > MAX_SYNTAX_ELEMENTS)
+    {
+        hInfo->error = 13;
+        return NULL;
+    }
+
+    spec_data[channels]   = (int16_t*)malloc(hDecoder->frameLength*sizeof(int16_t));
+    spec_coef[channels]   = (real_t*)malloc(hDecoder->frameLength*sizeof(real_t));
+
+    ele = (element*)malloc(sizeof(element));
+    memset(ele, 0, sizeof(element));
+    ele->ele_id  = id_syn_ele;
+    ele->channel = channels;
+    ele->paired_channel = -1;
+
+    hInfo->error = single_lfe_channel_element(hDecoder, ele,
+        ld, spec_data[channels]);
+
+    if (hDecoder->pce_set)
+        hDecoder->internal_channel[hDecoder->pce.sce_channel[ele->element_instance_tag]] = channels;
+    else
+        hDecoder->internal_channel[channels] = channels;
+
+    if (id_syn_ele == ID_SCE)
+        hDecoder->channel_element[channels] = hDecoder->fr_ch_ele;
+    else /* LFE */
+        hDecoder->channel_element[channels] = hDecoder->fr_ch_ele;
+
+    hDecoder->fr_channels++;
+    hDecoder->fr_ch_ele++;
+
+    return ele;
+}
+
+element *decode_cpe(faacDecHandle hDecoder,
+                    faacDecFrameInfo *hInfo, bitfile *ld,
+                    int16_t **spec_data, real_t **spec_coef,
+                    uint8_t id_syn_ele)
+{
+    element *ele;
+    uint8_t channels = hDecoder->fr_channels;
+
+    if (channels+2 > MAX_CHANNELS)
+    {
+        hInfo->error = 12;
+        return NULL;
+    }
+    if (hDecoder->fr_ch_ele+1 > MAX_SYNTAX_ELEMENTS)
+    {
+        hInfo->error = 13;
+        return NULL;
+    }
+
+    spec_data[channels]   = (int16_t*)malloc(hDecoder->frameLength*sizeof(int16_t));
+    spec_data[channels+1] = (int16_t*)malloc(hDecoder->frameLength*sizeof(int16_t));
+    spec_coef[channels]   = (real_t*)malloc(hDecoder->frameLength*sizeof(real_t));
+    spec_coef[channels+1] = (real_t*)malloc(hDecoder->frameLength*sizeof(real_t));
+
+    ele = (element*)malloc(sizeof(element));
+    memset(ele, 0, sizeof(element));
+    ele->ele_id         = id_syn_ele;
+    ele->channel        = channels;
+    ele->paired_channel = channels+1;
+
+    hInfo->error = channel_pair_element(hDecoder, ele,
+        ld, spec_data[channels], spec_data[channels+1]);
+
+    if (hDecoder->pce_set)
+    {
+        hDecoder->internal_channel[hDecoder->pce.cpe_channel[ele->element_instance_tag]] = channels;
+        hDecoder->internal_channel[hDecoder->pce.cpe_channel[ele->element_instance_tag]+1] = channels+1;
+    } else {
+        hDecoder->internal_channel[channels] = channels;
+        hDecoder->internal_channel[channels+1] = channels+1;
+    }
+
+    hDecoder->channel_element[channels] = hDecoder->fr_ch_ele;
+    hDecoder->channel_element[channels+1] = hDecoder->fr_ch_ele;
+
+    hDecoder->fr_channels += 2;
+    hDecoder->fr_ch_ele++;
+
+    return ele;
+}
+
+element **raw_data_block(faacDecHandle hDecoder, faacDecFrameInfo *hInfo,
+                         bitfile *ld, element **elements,
+                         int16_t **spec_data, real_t **spec_coef,
+                         program_config *pce, drc_info *drc)
+{
+    uint8_t id_syn_ele;
+    uint8_t ch_ele = 0;
+
+    hDecoder->fr_channels = 0;
+    hDecoder->fr_ch_ele = 0;
+    hDecoder->first_syn_ele = 25;
+    hDecoder->has_lfe = 0;
+
+#ifdef ERROR_RESILIENCE
+    if (hDecoder->object_type < ER_OBJECT_START)
+    {
+#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)
+        {
+            switch (id_syn_ele) {
+            case ID_SCE:
+                if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele;
+                hDecoder->last_syn_ele = id_syn_ele;
+                elements[ch_ele++] = decode_sce_lfe(hDecoder,
+                    hInfo, ld, spec_data, spec_coef, id_syn_ele);
+                if (hInfo->error > 0)
+                    return elements;
+                break;
+            case ID_CPE:
+                if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele;
+                hDecoder->last_syn_ele = id_syn_ele;
+                elements[ch_ele++] = decode_cpe(hDecoder,
+                    hInfo, ld, spec_data, spec_coef, id_syn_ele);
+                if (hInfo->error > 0)
+                    return elements;
+                break;
+            case ID_LFE:
+                hDecoder->has_lfe++;
+                elements[ch_ele++] = decode_sce_lfe(hDecoder,
+                    hInfo, ld, spec_data, spec_coef, id_syn_ele);
+                if (hInfo->error > 0)
+                    return elements;
+                break;
+            case ID_CCE: /* not implemented yet, but skip the bits */
+                hInfo->error = coupling_channel_element(hDecoder, ld);
+                if (hInfo->error > 0)
+                    return elements;
+                break;
+            case ID_DSE:
+                data_stream_element(hDecoder, ld);
+                break;
+            case ID_PCE:
+                if ((hInfo->error = program_config_element(pce, ld)) > 0)
+                    return elements;
+                hDecoder->pce_set = 1;
+                break;
+            case ID_FIL:
+                /* one sbr_info describes a channel_element not a channel! */
+                if ((hInfo->error = fill_element(hDecoder, ld, drc
+#ifdef SBR_DEC
+                    , (ch_ele-1)
+#endif
+                    )) > 0)
+                    return elements;
+#ifdef SBR_DEC
+                if (hDecoder->sbr_used[ch_ele-1])
+                {
+                    hDecoder->sbr_present_flag = 1;
+                    hDecoder->sbr[ch_ele-1]->sample_rate = sample_rates[hDecoder->sf_index];
+                    hDecoder->sbr[ch_ele-1]->sample_rate *= 2;
+                }
+#endif
+                break;
+            }
+        }
+#ifdef ERROR_RESILIENCE
+    } else {
+        /* Table 262: er_raw_data_block() */
+        switch (hDecoder->channelConfiguration)
+        {
+        case 1:
+            elements[ch_ele++] = decode_sce_lfe(hDecoder,
+                hInfo, ld, spec_data, spec_coef, ID_SCE);
+            if (hInfo->error > 0)
+                return elements;
+            break;
+        case 2:
+            elements[ch_ele++] = decode_cpe(hDecoder,
+                hInfo, ld, spec_data, spec_coef, ID_CPE);
+            if (hInfo->error > 0)
+                return elements;
+            break;
+        case 3:
+            elements[ch_ele++] = decode_sce_lfe(hDecoder,
+                hInfo, ld, spec_data, spec_coef, ID_SCE);
+            elements[ch_ele++] = decode_cpe(hDecoder,
+                hInfo, ld, spec_data, spec_coef, ID_CPE);
+            if (hInfo->error > 0)
+                return elements;
+            break;
+        case 4:
+            elements[ch_ele++] = decode_sce_lfe(hDecoder,
+                hInfo, ld, spec_data, spec_coef, ID_SCE);
+            elements[ch_ele++] = decode_cpe(hDecoder,
+                hInfo, ld, spec_data, spec_coef, ID_CPE);
+            elements[ch_ele++] = decode_sce_lfe(hDecoder,
+                hInfo, ld, spec_data, spec_coef, ID_SCE);
+            if (hInfo->error > 0)
+                return elements;
+            break;
+        case 5:
+            elements[ch_ele++] = decode_sce_lfe(hDecoder,
+                hInfo, ld, spec_data, spec_coef, ID_SCE);
+            elements[ch_ele++] = decode_cpe(hDecoder,
+                hInfo, ld, spec_data, spec_coef, ID_CPE);
+            elements[ch_ele++] = decode_cpe(hDecoder,
+                hInfo, ld, spec_data, spec_coef, ID_CPE);
+            if (hInfo->error > 0)
+                return elements;
+            break;
+        case 6:
+            elements[ch_ele++] = decode_sce_lfe(hDecoder,
+                hInfo, ld, spec_data, spec_coef, ID_SCE);
+            elements[ch_ele++] = decode_cpe(hDecoder,
+                hInfo, ld, spec_data, spec_coef, ID_CPE);
+            elements[ch_ele++] = decode_cpe(hDecoder,
+                hInfo, ld, spec_data, spec_coef, ID_CPE);
+            elements[ch_ele++] = decode_sce_lfe(hDecoder,
+                hInfo, ld, spec_data, spec_coef, ID_LFE);
+            if (hInfo->error > 0)
+                return elements;
+            break;
+        case 7:
+            elements[ch_ele++] = decode_sce_lfe(hDecoder,
+                hInfo, ld, spec_data, spec_coef, ID_SCE);
+            elements[ch_ele++] = decode_cpe(hDecoder,
+                hInfo, ld, spec_data, spec_coef, ID_CPE);
+            elements[ch_ele++] = decode_cpe(hDecoder,
+                hInfo, ld, spec_data, spec_coef, ID_CPE);
+            elements[ch_ele++] = decode_cpe(hDecoder,
+                hInfo, ld, spec_data, spec_coef, ID_CPE);
+            elements[ch_ele++] = decode_sce_lfe(hDecoder,
+                hInfo, ld, spec_data, spec_coef, ID_LFE);
+            if (hInfo->error > 0)
+                return elements;
+            break;
+        default:
+            hInfo->error = 7;
+            return elements;
+        }
+#if 0
+        cnt = bits_to_decode() / 8;
+        while (cnt >= 1)
+        {
+            cnt -= extension_payload(cnt);
+        }
+#endif
+    }
+#endif
+
+    /* new in corrigendum 14496-3:2002 */
+    faad_byte_align(ld);
+
+    return elements;
+}
+
+#ifdef DRM
+static uint8_t faad_check_CRC(bitfile *ld)
+{
+    uint16_t len = faad_get_processed_bits(ld) - 8;
+    uint8_t CRC;
+    uint16_t r=255;  /* Initialize to all ones */
+
+    /* CRC polynome used x^8 + x^4 + x^3 + x^2 +1 */
+#define GPOLY 0435
+
+    faad_rewindbits(ld);
+
+    CRC = ~faad_getbits(ld, 8
+        DEBUGVAR(1,999,"faad_check_CRC(): CRC"));          /* CRC is stored inverted */
+
+    for (; len>0; len--)
+    {
+        r = ( (r << 1) ^ (( ( faad_get1bit(ld
+            DEBUGVAR(1,998,""))  & 1) ^ ((r >> 7) & 1)) * GPOLY )) & 0xFF;
+    }
+    if (r != CRC)
+    {
+        return 8;
+    } else {
+        return 0;
+    }
+}
+#endif
+
+/* Table 4.4.4 and */
+/* Table 4.4.9 */
+static uint8_t single_lfe_channel_element(faacDecHandle hDecoder,
+                                          element *sce, bitfile *ld,
+                                          int16_t *spec_data)
+{
+    ic_stream *ics = &(sce->ics1);
+#ifdef DRM
+    uint8_t result;
+
+    if (hDecoder->object_type != DRM_ER_LC)
+#endif
+    sce->element_instance_tag = (uint8_t)faad_getbits(ld, LEN_TAG
+        DEBUGVAR(1,38,"single_lfe_channel_element(): element_instance_tag"));
+
+#ifdef DRM
+    if (hDecoder->object_type == DRM_ER_LC)
+    {
+        individual_channel_stream(hDecoder, sce, ld, ics, 0, spec_data);
+
+        if (ics->tns_data_present)
+            tns_data(ics, &(ics->tns), ld);
+
+        if ((result = faad_check_CRC( ld )) > 0)
+            return result;
+
+        /* error resilient spectral data decoding */
+        if ((result = reordered_spectral_data(hDecoder, ics, ld, spec_data)) > 0)
+            return result;
+
+        /* pulse coding reconstruction */
+        if (ics->pulse_data_present)
+        {
+            if (ics->window_sequence != EIGHT_SHORT_SEQUENCE)
+            {
+                if ((result = pulse_decode(ics, spec_data, hDecoder->frameLength)) > 0)
+                    return result;
+            } else {
+                return 2; /* pulse coding not allowed for short blocks */
+            }
+        }
+        return 0;
+    } else
+#endif
+
+    return individual_channel_stream(hDecoder, sce, ld, ics, 0, spec_data);
+}
+
+/* Table 4.4.5 */
+static uint8_t channel_pair_element(faacDecHandle hDecoder, element *cpe,
+                                    bitfile *ld, int16_t *spec_data1,
+                                    int16_t *spec_data2)
+{
+    uint8_t result;
+    ic_stream *ics1 = &(cpe->ics1);
+    ic_stream *ics2 = &(cpe->ics2);
+
+#ifdef DRM
+    if (hDecoder->object_type != DRM_ER_LC)
+#endif
+    cpe->element_instance_tag = (uint8_t)faad_getbits(ld, LEN_TAG
+        DEBUGVAR(1,39,"channel_pair_element(): element_instance_tag"));
+
+    if ((cpe->common_window = faad_get1bit(ld
+        DEBUGVAR(1,40,"channel_pair_element(): common_window"))) & 1)
+    {
+        /* both channels have common ics information */
+        if ((result = ics_info(hDecoder, ics1, ld, cpe->common_window)) > 0)
+            return result;
+
+        ics1->ms_mask_present = (uint8_t)faad_getbits(ld, 2
+            DEBUGVAR(1,41,"channel_pair_element(): ms_mask_present"));
+        if (ics1->ms_mask_present == 1)
+        {
+            uint8_t g, sfb;
+            for (g = 0; g < ics1->num_window_groups; g++)
+            {
+                for (sfb = 0; sfb < ics1->max_sfb; sfb++)
+                {
+                    ics1->ms_used[g][sfb] = faad_get1bit(ld
+                        DEBUGVAR(1,42,"channel_pair_element(): faad_get1bit"));
+                }
+            }
+        }
+
+#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)
+            {
+                ltp_data(hDecoder, ics1, &(ics1->ltp), ld);
+            }
+        }
+#endif
+
+        memcpy(ics2, ics1, sizeof(ic_stream));
+    } else {
+        ics1->ms_mask_present = 0;
+    }
+
+    if ((result = individual_channel_stream(hDecoder, cpe, ld, ics1,
+        0, spec_data1)) > 0)
+    {
+        return result;
+    }
+
+#ifdef ERROR_RESILIENCE
+    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)
+        {
+            ltp_data(hDecoder, ics1, &(ics1->ltp2), ld);
+        }
+    }
+#endif
+
+    if ((result = individual_channel_stream(hDecoder, cpe, ld, ics2,
+        0, spec_data2)) > 0)
+    {
+        return result;
+    }
+
+#ifdef DRM
+    if (hDecoder->object_type == DRM_ER_LC)
+    {
+        if (ics1->tns_data_present)
+            tns_data(ics1, &(ics1->tns), ld);
+
+        if (ics1->tns_data_present)
+            tns_data(ics2, &(ics2->tns), ld);
+
+        if ((result = faad_check_CRC( ld )) > 0)
+        {
+            return result;
+        }
+        /* error resilient spectral data decoding */
+        if ((result = reordered_spectral_data(hDecoder, ics1, ld, spec_data1)) > 0)
+            return result;
+        if ((result = reordered_spectral_data(hDecoder, ics2, ld, spec_data2)) > 0)
+            return result;
+        /* pulse coding reconstruction */
+        if (ics1->pulse_data_present)
+        {
+            if (ics1->window_sequence != EIGHT_SHORT_SEQUENCE)
+            {
+                if ((result = pulse_decode(ics1, spec_data1, hDecoder->frameLength)) > 0)
+                    return result;
+            } else {
+                return 2; /* pulse coding not allowed for short blocks */
+            }
+        }
+        if (ics2->pulse_data_present)
+        {
+            if (ics2->window_sequence != EIGHT_SHORT_SEQUENCE)
+            {
+                if ((result = pulse_decode(ics2, spec_data2, hDecoder->frameLength)) > 0)
+                    return result;
+            } else {
+                return 2; /* pulse coding not allowed for short blocks */
+            }
+        }
+        return 0;
+    } else
+#endif
+
+    return 0;
+}
+
+static uint8_t pred_sfb_max[] =
+{
+    33,     /* 96000 */
+    33,     /* 88200 */
+    38,     /* 64000 */
+    40,     /* 48000 */
+    40,     /* 44100 */
+    40,     /* 32000 */
+    41,     /* 24000 */
+    41,     /* 22050 */
+    37,     /* 16000 */
+    37,     /* 12000 */
+    37,     /* 11025 */
+    34      /* 8000  */
+};
+
+/* Table 4.4.6 */
+static uint8_t ics_info(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld,
+                        uint8_t common_window)
+{
+    uint8_t retval = 0;
+
+    /* ics->ics_reserved_bit = */ faad_get1bit(ld
+        DEBUGVAR(1,43,"ics_info(): ics_reserved_bit"));
+    ics->window_sequence = (uint8_t)faad_getbits(ld, 2
+        DEBUGVAR(1,44,"ics_info(): window_sequence"));
+    ics->window_shape = faad_get1bit(ld
+        DEBUGVAR(1,45,"ics_info(): window_shape"));
+
+    if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+    {
+        ics->max_sfb = (uint8_t)faad_getbits(ld, 4
+            DEBUGVAR(1,46,"ics_info(): max_sfb (short)"));
+        ics->scale_factor_grouping = (uint8_t)faad_getbits(ld, 7
+            DEBUGVAR(1,47,"ics_info(): scale_factor_grouping"));
+    } else {
+        ics->max_sfb = (uint8_t)faad_getbits(ld, 6
+            DEBUGVAR(1,48,"ics_info(): max_sfb (long)"));
+    }
+
+    /* get the grouping information */
+    if ((retval = window_grouping_info(hDecoder, ics)) > 0)
+        return retval;
+
+    /* should be an error */
+    /* check the range of max_sfb */
+    if (ics->max_sfb > ics->num_swb)
+        return 16;
+
+    if (ics->window_sequence != EIGHT_SHORT_SEQUENCE)
+    {
+        if ((ics->predictor_data_present = faad_get1bit(ld
+            DEBUGVAR(1,49,"ics_info(): predictor_data_present"))) & 1)
+        {
+            if (hDecoder->object_type == MAIN) /* MPEG2 style AAC predictor */
+            {
+                uint8_t sfb;
+
+                ics->pred.limit = min(ics->max_sfb, pred_sfb_max[hDecoder->sf_index]);
+
+                if ((ics->pred.predictor_reset = 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"));
+                }
+
+                for (sfb = 0; sfb < ics->pred.limit; sfb++)
+                {
+                    ics->pred.prediction_used[sfb] = faad_get1bit(ld
+                        DEBUGVAR(1,55,"ics_info(): pred.prediction_used"));
+                }
+            }
+#ifdef LTP_DEC
+            else { /* Long Term Prediction */
+                if (hDecoder->object_type < ER_OBJECT_START)
+                {
+                    if ((ics->ltp.data_present = faad_get1bit(ld
+                        DEBUGVAR(1,50,"ics_info(): ltp.data_present"))) & 1)
+                    {
+                        ltp_data(hDecoder, ics, &(ics->ltp), ld);
+                    }
+                    if (common_window)
+                    {
+                        if ((ics->ltp2.data_present = faad_get1bit(ld
+                            DEBUGVAR(1,51,"ics_info(): ltp2.data_present"))) & 1)
+                        {
+                            ltp_data(hDecoder, ics, &(ics->ltp2), ld);
+                        }
+                    }
+                }
+#ifdef ERROR_RESILIENCE
+                if (!common_window && (hDecoder->object_type >= ER_OBJECT_START))
+                {
+                    if ((ics->ltp.data_present = faad_get1bit(ld
+                        DEBUGVAR(1,50,"ics_info(): ltp.data_present"))) & 1)
+                    {
+                        ltp_data(hDecoder, ics, &(ics->ltp), ld);
+                    }
+                }
+#endif
+            }
+#endif
+        }
+    }
+
+    return retval;
+}
+
+/* Table 4.4.7 */
+static uint8_t pulse_data(ic_stream *ics, pulse_info *pul, bitfile *ld)
+{
+    uint8_t i;
+
+    pul->number_pulse = (uint8_t)faad_getbits(ld, 2
+        DEBUGVAR(1,56,"pulse_data(): number_pulse"));
+    pul->pulse_start_sfb = (uint8_t)faad_getbits(ld, 6
+        DEBUGVAR(1,57,"pulse_data(): pulse_start_sfb"));
+
+    /* check the range of pulse_start_sfb */
+    if (pul->pulse_start_sfb > ics->num_swb)
+        return 16;
+
+    for (i = 0; i < pul->number_pulse+1; i++)
+    {
+        pul->pulse_offset[i] = (uint8_t)faad_getbits(ld, 5
+            DEBUGVAR(1,58,"pulse_data(): pulse_offset"));
+        pul->pulse_amp[i] = (uint8_t)faad_getbits(ld, 4
+            DEBUGVAR(1,59,"pulse_data(): pulse_amp"));
+    }
+
+    return 0;
+}
+
+/* Table 4.4.8: Currently just for skipping the bits... */
+static uint8_t coupling_channel_element(faacDecHandle hDecoder, bitfile *ld)
+{
+    uint8_t c, result = 0;
+    uint8_t ind_sw_cce_flag = 0;
+    uint8_t num_gain_element_lists = 0;
+    uint8_t num_coupled_elements = 0;
+
+    element el_empty;
+    ic_stream ics_empty;
+    int16_t sh_data[1024];
+
+    memset(&el_empty, 0, sizeof(element));
+    memset(&ics_empty, 0, sizeof(ic_stream));
+
+    c = faad_getbits(ld, LEN_TAG
+        DEBUGVAR(1,900,"coupling_channel_element(): element_instance_tag"));
+
+    ind_sw_cce_flag = faad_get1bit(ld
+        DEBUGVAR(1,901,"coupling_channel_element(): ind_sw_cce_flag"));
+    num_coupled_elements = faad_getbits(ld, 3
+        DEBUGVAR(1,902,"coupling_channel_element(): num_coupled_elements"));
+
+    for (c = 0; c < num_coupled_elements + 1; c++)
+    {
+        uint8_t cc_target_is_cpe, cc_target_tag_select;
+
+        num_gain_element_lists++;
+
+        cc_target_is_cpe = faad_get1bit(ld
+            DEBUGVAR(1,903,"coupling_channel_element(): cc_target_is_cpe"));
+        cc_target_tag_select = faad_getbits(ld, 4
+            DEBUGVAR(1,904,"coupling_channel_element(): cc_target_tag_select"));
+
+        if (cc_target_is_cpe)
+        {
+            uint8_t cc_l = faad_get1bit(ld
+                DEBUGVAR(1,905,"coupling_channel_element(): cc_l"));
+            uint8_t cc_r = faad_get1bit(ld
+                DEBUGVAR(1,906,"coupling_channel_element(): cc_r"));
+
+            if (cc_l && cc_r)
+                num_gain_element_lists++;
+        }
+    }
+
+    faad_get1bit(ld
+        DEBUGVAR(1,907,"coupling_channel_element(): cc_domain"));
+    faad_get1bit(ld
+        DEBUGVAR(1,908,"coupling_channel_element(): gain_element_sign"));
+    faad_getbits(ld, 2
+        DEBUGVAR(1,909,"coupling_channel_element(): gain_element_scale"));
+
+    if ((result = individual_channel_stream(hDecoder, &el_empty, ld, &ics_empty,
+        0, sh_data)) > 0)
+    {
+        return result;
+    }
+
+    for (c = 1; c < num_gain_element_lists; c++)
+    {
+        uint8_t cge;
+
+        if (ind_sw_cce_flag)
+        {
+            cge = 1;
+        } else {
+            cge = faad_get1bit(ld
+                DEBUGVAR(1,910,"coupling_channel_element(): common_gain_element_present"));
+        }
+
+        if (cge)
+        {
+            huffman_scale_factor(ld);
+        } else {
+            uint8_t g, sfb;
+
+            for (g = 0; g < ics_empty.num_window_groups; g++)
+            {
+                for (sfb = 0; sfb < ics_empty.max_sfb; sfb++)
+                {
+                    if (ics_empty.sfb_cb[g][sfb] != ZERO_HCB)
+                        huffman_scale_factor(ld);
+                }
+            }
+        }
+    }
+
+    return 0;
+}
+
+/* Table 4.4.10 */
+static uint16_t data_stream_element(faacDecHandle hDecoder, bitfile *ld)
+{
+    uint8_t byte_aligned;
+    uint16_t i, count;
+
+    /* element_instance_tag = */ faad_getbits(ld, LEN_TAG
+        DEBUGVAR(1,60,"data_stream_element(): element_instance_tag"));
+    byte_aligned = faad_get1bit(ld
+        DEBUGVAR(1,61,"data_stream_element(): byte_aligned"));
+    count = (uint16_t)faad_getbits(ld, 8
+        DEBUGVAR(1,62,"data_stream_element(): count"));
+    if (count == 255)
+    {
+        count += (uint16_t)faad_getbits(ld, 8
+            DEBUGVAR(1,63,"data_stream_element(): extra count"));
+    }
+    if (byte_aligned)
+        faad_byte_align(ld);
+
+    for (i = 0; i < count; i++)
+    {
+        uint8_t data = faad_getbits(ld, LEN_BYTE
+            DEBUGVAR(1,64,"data_stream_element(): data_stream_byte"));
+
+        if (count == 6 && data == 'N')
+        {
+            data = faad_getbits(ld, LEN_BYTE
+                DEBUGVAR(1,64,"data_stream_element(): data_stream_byte"));
+            i++;
+            if (data == 'D')
+            {
+                uint16_t samplesLeft;
+                uint8_t data2 = faad_getbits(ld, LEN_BYTE
+                    DEBUGVAR(1,64,"data_stream_element(): data_stream_byte"));
+                data = faad_getbits(ld, LEN_BYTE
+                    DEBUGVAR(1,64,"data_stream_element(): data_stream_byte"));
+                samplesLeft = faad_getbits(ld, LEN_BYTE
+                    DEBUGVAR(1,64,"data_stream_element(): data_stream_byte"));
+                samplesLeft += (faad_getbits(ld, LEN_BYTE
+                    DEBUGVAR(1,64,"data_stream_element(): data_stream_byte")) << 8);
+                i += 4;
+
+                if (data == 'L' && data2 == 'F')
+                    hDecoder->samplesLeft = samplesLeft;
+            }
+        }
+    }
+
+    return count;
+}
+
+/* Table 4.4.11 */
+static uint8_t fill_element(faacDecHandle hDecoder, bitfile *ld, drc_info *drc
+#ifdef SBR_DEC
+                            ,uint8_t sbr_ele
+#endif
+                            )
+{
+    uint16_t count;
+#ifdef SBR_DEC
+    uint8_t bs_extension_type;
+#endif
+
+    count = (uint16_t)faad_getbits(ld, 4
+        DEBUGVAR(1,65,"fill_element(): count"));
+    if (count == 15)
+    {
+        count += (uint16_t)faad_getbits(ld, 8
+            DEBUGVAR(1,66,"fill_element(): extra count")) - 1;
+    }
+
+    if (count > 0)
+    {
+#ifdef SBR_DEC
+        hDecoder->sbr_used[sbr_ele] = 0;
+        bs_extension_type = (uint8_t)faad_showbits(ld, 4);
+
+        if ((bs_extension_type == EXT_SBR_DATA) ||
+            (bs_extension_type == EXT_SBR_DATA_CRC))
+        {
+            hDecoder->sbr_used[sbr_ele] = 1;
+
+            if (!hDecoder->sbr[sbr_ele])
+                hDecoder->sbr[sbr_ele] = sbrDecodeInit();
+
+            /* read in all the SBR data for processing later on
+               this is needed because the SBR bitstream reader needs to know
+               what element type comes _after_ the (this) SBR FIL element
+            */
+            hDecoder->sbr[sbr_ele]->data = (uint8_t*)faad_getbitbuffer(ld, count*8);
+            hDecoder->sbr[sbr_ele]->data_size = count;
+        } else {
+            hDecoder->sbr_used[sbr_ele] = 0;
+#endif
+            while (count > 0)
+            {
+                count -= extension_payload(ld, drc, count);
+            }
+#ifdef SBR_DEC
+        }
+#endif
+    }
+
+    return 0;
+}
+
+/* Table 4.4.12 */
+#ifdef SSR_DEC
+static void gain_control_data(bitfile *ld, ic_stream *ics)
+{
+    uint8_t bd, wd, ad;
+    ssr_info *ssr = &(ics->ssr);
+
+    ssr->max_band = (uint8_t)faad_getbits(ld, 2
+        DEBUGVAR(1,1000,"gain_control_data(): max_band"));
+
+    if (ics->window_sequence == ONLY_LONG_SEQUENCE)
+    {
+        for (bd = 1; bd <= ssr->max_band; bd++)
+        {
+            for (wd = 0; wd < 1; wd++)
+            {
+                ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3
+                    DEBUGVAR(1,1001,"gain_control_data(): adjust_num"));
+
+                for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++)
+                {
+                    ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
+                        DEBUGVAR(1,1002,"gain_control_data(): alevcode"));
+                    ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 5
+                        DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
+                }
+            }
+        }
+    } else if (ics->window_sequence == LONG_START_SEQUENCE) {
+        for (bd = 1; bd <= ssr->max_band; bd++)
+        {
+            for (wd = 0; wd < 2; wd++)
+            {
+                ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3
+                    DEBUGVAR(1,1001,"gain_control_data(): adjust_num"));
+
+                for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++)
+                {
+                    ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
+                        DEBUGVAR(1,1002,"gain_control_data(): alevcode"));
+                    if (wd == 0)
+                    {
+                        ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
+                            DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
+                    } else {
+                        ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 2
+                            DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
+                    }
+                }
+            }
+        }
+    } else if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) {
+        for (bd = 1; bd <= ssr->max_band; bd++)
+        {
+            for (wd = 0; wd < 8; wd++)
+            {
+                ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3
+                    DEBUGVAR(1,1001,"gain_control_data(): adjust_num"));
+
+                for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++)
+                {
+                    ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
+                        DEBUGVAR(1,1002,"gain_control_data(): alevcode"));
+                    ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 2
+                        DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
+                }
+            }
+        }
+    } else if (ics->window_sequence == LONG_STOP_SEQUENCE) {
+        for (bd = 1; bd <= ssr->max_band; bd++)
+        {
+            for (wd = 0; wd < 2; wd++)
+            {
+                ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3
+                    DEBUGVAR(1,1001,"gain_control_data(): adjust_num"));
+
+                for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++)
+                {
+                    ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
+                        DEBUGVAR(1,1002,"gain_control_data(): alevcode"));
+
+                    if (wd == 0)
+                    {
+                        ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
+                            DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
+                    } else {
+                        ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 5
+                            DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
+                    }
+                }
+            }
+        }
+    }
+}
+#endif
+
+/* Table 4.4.24 */
+static uint8_t individual_channel_stream(faacDecHandle hDecoder, element *ele,
+                                         bitfile *ld, ic_stream *ics, uint8_t scal_flag,
+                                         int16_t *spec_data)
+{
+    uint8_t result;
+
+    ics->global_gain = (uint8_t)faad_getbits(ld, 8
+        DEBUGVAR(1,67,"individual_channel_stream(): global_gain"));
+
+    if (!ele->common_window && !scal_flag)
+    {
+        if ((result = ics_info(hDecoder, ics, ld, ele->common_window)) > 0)
+            return result;
+    }
+
+    if ((result = section_data(hDecoder, ics, ld)) > 0)
+        return result;
+
+    if ((result = scale_factor_data(hDecoder, ics, ld)) > 0)
+        return result;
+
+    if (!scal_flag)
+    {
+        /**
+         **  NOTE: It could be that pulse data is available in scalable AAC too,
+         **        as said in Amendment 1, this could be only the case for ER AAC,
+         **        though. (have to check this out later)
+         **/
+        /* get pulse data */
+        if ((ics->pulse_data_present = faad_get1bit(ld
+            DEBUGVAR(1,68,"individual_channel_stream(): pulse_data_present"))) & 1)
+        {
+            if ((result = pulse_data(ics, &(ics->pul), ld)) > 0)
+                return result;
+        }
+
+        /* get tns data */
+        if ((ics->tns_data_present = faad_get1bit(ld
+            DEBUGVAR(1,69,"individual_channel_stream(): tns_data_present"))) & 1)
+        {
+#ifdef ERROR_RESILIENCE
+            if (hDecoder->object_type < ER_OBJECT_START)
+#endif
+                tns_data(ics, &(ics->tns), ld);
+        }
+
+        /* get gain control data */
+        if ((ics->gain_control_data_present = faad_get1bit(ld
+            DEBUGVAR(1,70,"individual_channel_stream(): gain_control_data_present"))) & 1)
+        {
+#ifdef SSR_DEC
+            if (hDecoder->object_type != SSR)
+                return 1;
+            else
+                gain_control_data(ld, ics);
+#else
+            return 1;
+#endif
+        }
+    }
+
+#ifdef ERROR_RESILIENCE
+    if (hDecoder->aacSpectralDataResilienceFlag)
+    {
+        ics->length_of_reordered_spectral_data = (uint16_t)faad_getbits(ld, 14
+            DEBUGVAR(1,147,"individual_channel_stream(): length_of_reordered_spectral_data"));
+
+        if (hDecoder->channelConfiguration == 2)
+        {
+            if (ics->length_of_reordered_spectral_data > 6144)
+                ics->length_of_reordered_spectral_data = 6144;
+        } else {
+            if (ics->length_of_reordered_spectral_data > 12288)
+                ics->length_of_reordered_spectral_data = 12288;
+        }
+
+        ics->length_of_longest_codeword = (uint8_t)faad_getbits(ld, 6
+            DEBUGVAR(1,148,"individual_channel_stream(): length_of_longest_codeword"));
+        if (ics->length_of_longest_codeword >= 49)
+            ics->length_of_longest_codeword = 49;
+    }
+
+    /* RVLC spectral data is put here */
+    if (hDecoder->aacScalefactorDataResilienceFlag)
+    {
+        if ((result = rvlc_decode_scale_factors(ics, ld)) > 0)
+            return result;
+    }
+
+#ifdef DRM
+    if (hDecoder->object_type == DRM_ER_LC)
+        return 0;
+#endif
+
+    if (hDecoder->object_type >= ER_OBJECT_START) 
+    {
+        if (ics->tns_data_present)
+            tns_data(ics, &(ics->tns), ld);
+    }
+
+    if (hDecoder->aacSpectralDataResilienceFlag)
+    {
+        /* error resilient spectral data decoding */
+        if ((result = reordered_spectral_data(hDecoder, ics, ld, spec_data)) > 0)
+        {
+            return result;
+        }
+    } else {
+#endif
+        /* decode the spectral data */
+        if ((result = spectral_data(hDecoder, ics, ld, spec_data)) > 0)
+        {
+            return result;
+        }
+#ifdef ERROR_RESILIENCE
+    }
+#endif
+
+    /* pulse coding reconstruction */
+    if (ics->pulse_data_present)
+    {
+        if (ics->window_sequence != EIGHT_SHORT_SEQUENCE)
+        {
+            if ((result = pulse_decode(ics, spec_data, hDecoder->frameLength)) > 0)
+                return result;
+        } else {
+            return 2; /* pulse coding not allowed for short blocks */
+        }
+    }
+
+    return 0;
+}
+
+/* Table 4.4.25 */
+static uint8_t section_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld)
+{
+    uint8_t g;
+    uint8_t sect_esc_val, sect_bits;
+
+    if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+        sect_bits = 3;
+    else
+        sect_bits = 5;
+    sect_esc_val = (1<<sect_bits) - 1;
+
+#if 0
+    printf("\ntotal sfb %d\n", ics->max_sfb);
+    printf("   sect    top     cb\n");
+#endif
+
+    for (g = 0; g < ics->num_window_groups; g++)
+    {
+        uint8_t k = 0;
+        uint8_t i = 0;
+
+        while (k < ics->max_sfb)
+        {
+#ifdef ERROR_RESILIENCE
+            uint8_t vcb11 = 0;
+#endif
+            uint8_t sfb;
+            uint8_t sect_len_incr;
+            uint16_t sect_len = 0;
+            uint8_t sect_cb_bits = 4;
+
+            /* if "faad_getbits" detects error and returns "0", "k" is never
+               incremented and we cannot leave the while loop */
+            if ((ld->error != 0) || (ld->no_more_reading))
+                return 14;
+
+#ifdef ERROR_RESILIENCE
+            if (hDecoder->aacSectionDataResilienceFlag)
+                sect_cb_bits = 5;
+#endif
+
+            ics->sect_cb[g][i] = (uint8_t)faad_getbits(ld, sect_cb_bits
+                DEBUGVAR(1,71,"section_data(): sect_cb"));
+
+            if (ics->sect_cb[g][i] == NOISE_HCB)
+                ics->noise_used = 1;
+
+#ifdef ERROR_RESILIENCE
+            if (hDecoder->aacSectionDataResilienceFlag)
+            {
+                if ((ics->sect_cb[g][i] == 11) ||
+                    ((ics->sect_cb[g][i] >= 16) && (ics->sect_cb[g][i] <= 32)))
+                {
+                    vcb11 = 1;
+                }
+            }
+            if (vcb11)
+            {
+                sect_len_incr = 1;
+            } else {
+#endif
+                sect_len_incr = (uint8_t)faad_getbits(ld, sect_bits
+                    DEBUGVAR(1,72,"section_data(): sect_len_incr"));
+#ifdef ERROR_RESILIENCE
+            }
+#endif
+            while ((sect_len_incr == sect_esc_val) /* &&
+                (k+sect_len < ics->max_sfb)*/)
+            {
+                sect_len += sect_len_incr;
+                sect_len_incr = (uint8_t)faad_getbits(ld, sect_bits
+                    DEBUGVAR(1,72,"section_data(): sect_len_incr"));
+            }
+
+            sect_len += sect_len_incr;
+
+            ics->sect_start[g][i] = k;
+            ics->sect_end[g][i] = k + sect_len;
+
+            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(" %6d %6d %6d\n",
+                i,
+                ics->sect_end[g][i],
+                ics->sect_cb[g][i]);
+#endif
+
+            k += sect_len;
+            i++;
+        }
+        ics->num_sec[g] = i;
+    }
+
+#if 0
+    printf("\n");
+#endif
+
+    return 0;
+}
+
+/*
+ *  decode_scale_factors()
+ *   decodes the scalefactors from the bitstream
+ */
+/*
+ * All scalefactors (and also the stereo positions and pns energies) are
+ * transmitted using Huffman coded DPCM relative to the previous active
+ * scalefactor (respectively previous stereo position or previous pns energy,
+ * see subclause 4.6.2 and 4.6.3). The first active scalefactor is
+ * differentially coded relative to the global gain.
+ */
+static uint8_t decode_scale_factors(ic_stream *ics, bitfile *ld)
+{
+    uint8_t g, sfb;
+    int16_t t;
+    int8_t noise_pcm_flag = 1;
+
+    int16_t scale_factor = ics->global_gain;
+    int16_t is_position = 0;
+    int16_t noise_energy = ics->global_gain - 90;
+
+    for (g = 0; g < ics->num_window_groups; g++)
+    {
+        for (sfb = 0; sfb < ics->max_sfb; sfb++)
+        {
+            switch (ics->sfb_cb[g][sfb])
+            {
+            case ZERO_HCB: /* zero book */
+                ics->scale_factors[g][sfb] = 0;
+                break;
+            case INTENSITY_HCB: /* intensity books */
+            case INTENSITY_HCB2:
+
+                /* decode intensity position */
+                t = huffman_scale_factor(ld);
+                if (t < 0)
+                    return 9;
+                is_position += (t - 60);
+                ics->scale_factors[g][sfb] = is_position;
+
+                break;
+            case NOISE_HCB: /* noise books */
+
+                /* decode noise energy */
+                if (noise_pcm_flag)
+                {
+                    noise_pcm_flag = 0;
+                    t = (int16_t)faad_getbits(ld, 9
+                        DEBUGVAR(1,73,"scale_factor_data(): first noise")) - 256;
+                } else {
+                    t = huffman_scale_factor(ld);
+                    if (t < 0)
+                        return 9;
+                    t -= 60;
+                }
+                noise_energy += t;
+                ics->scale_factors[g][sfb] = noise_energy;
+
+                break;
+            default: /* spectral books */
+
+                /* decode scale factor */
+                t = huffman_scale_factor(ld);
+                if (t < 0)
+                    return 9;
+                scale_factor += (t - 60);
+                if (scale_factor < 0)
+                    return 4;
+                ics->scale_factors[g][sfb] = scale_factor;
+
+                break;
+            }
+        }
+    }
+
+    return 0;
+}
+
+/* Table 4.4.26 */
+static uint8_t scale_factor_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld)
+{
+#ifdef ERROR_RESILIENCE
+    if (!hDecoder->aacScalefactorDataResilienceFlag)
+    {
+#endif
+        return decode_scale_factors(ics, ld);
+#ifdef ERROR_RESILIENCE
+    } else {
+        /* In ER AAC the parameters for RVLC are seperated from the actual
+           data that holds the scale_factors.
+           Strangely enough, 2 parameters for HCR are put inbetween them.
+        */
+        return rvlc_scale_factor_data(ics, ld);
+    }
+#endif
+}
+
+/* Table 4.4.27 */
+static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld)
+{
+    uint8_t w, filt, i, start_coef_bits, coef_bits;
+    uint8_t n_filt_bits = 2;
+    uint8_t length_bits = 6;
+    uint8_t order_bits = 5;
+
+    if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+    {
+        n_filt_bits = 1;
+        length_bits = 4;
+        order_bits = 3;
+    }
+
+    for (w = 0; w < ics->num_windows; w++)
+    {
+        tns->n_filt[w] = (uint8_t)faad_getbits(ld, n_filt_bits
+            DEBUGVAR(1,74,"tns_data(): n_filt"));
+
+        if (tns->n_filt[w])
+        {
+            if ((tns->coef_res[w] = faad_get1bit(ld
+                DEBUGVAR(1,75,"tns_data(): coef_res"))) & 1)
+            {
+                start_coef_bits = 4;
+            } else {
+                start_coef_bits = 3;
+            }
+        }
+
+        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"));
+            tns->order[w][filt]  = (uint8_t)faad_getbits(ld, order_bits
+                DEBUGVAR(1,77,"tns_data(): order"));
+            if (tns->order[w][filt])
+            {
+                tns->direction[w][filt] = faad_get1bit(ld
+                    DEBUGVAR(1,78,"tns_data(): direction"));
+                tns->coef_compress[w][filt] = faad_get1bit(ld
+                    DEBUGVAR(1,79,"tns_data(): coef_compress"));
+
+                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"));
+                }
+            }
+        }
+    }
+}
+
+#ifdef LTP_DEC
+/* Table 4.4.28 */
+static void ltp_data(faacDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld)
+{
+    uint8_t sfb, w;
+
+#ifdef LD_DEC
+    if (hDecoder->object_type == LD)
+    {
+        ltp->lag_update = (uint8_t)faad_getbits(ld, 1
+            DEBUGVAR(1,142,"ltp_data(): lag_update"));
+
+        if (ltp->lag_update)
+        {
+            ltp->lag = (uint16_t)faad_getbits(ld, 10
+                DEBUGVAR(1,81,"ltp_data(): lag"));
+        }
+    } else {
+#endif
+        ltp->lag = (uint16_t)faad_getbits(ld, 11
+            DEBUGVAR(1,81,"ltp_data(): lag"));
+#ifdef LD_DEC
+    }
+#endif
+    ltp->coef = (uint8_t)faad_getbits(ld, 3
+        DEBUGVAR(1,82,"ltp_data(): coef"));
+
+    if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+    {
+        for (w = 0; w < ics->num_windows; w++)
+        {
+            if ((ltp->short_used[w] = faad_get1bit(ld
+                DEBUGVAR(1,83,"ltp_data(): short_used"))) & 1)
+            {
+                ltp->short_lag_present[w] = faad_get1bit(ld
+                    DEBUGVAR(1,84,"ltp_data(): short_lag_present"));
+                if (ltp->short_lag_present[w])
+                {
+                    ltp->short_lag[w] = (uint8_t)faad_getbits(ld, 4
+                        DEBUGVAR(1,85,"ltp_data(): short_lag"));
+                }
+            }
+        }
+    } else {
+        ltp->last_band = (ics->max_sfb < MAX_LTP_SFB ? ics->max_sfb : MAX_LTP_SFB);
+
+        for (sfb = 0; sfb < ltp->last_band; sfb++)
+        {
+            ltp->long_used[sfb] = faad_get1bit(ld
+                DEBUGVAR(1,86,"ltp_data(): long_used"));
+        }
+    }
+}
+#endif
+
+/* Table 4.4.29 */
+static uint8_t spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld,
+                             int16_t *spectral_data)
+{
+    int8_t i;
+    uint8_t g;
+    int16_t *sp;
+    uint16_t k, p = 0;
+    uint8_t groups = 0;
+    uint8_t sect_cb;
+    uint8_t result;
+    uint16_t nshort = hDecoder->frameLength/8;
+
+    sp = spectral_data;
+    memset(sp, 0, hDecoder->frameLength*sizeof(int16_t));
+
+    for(g = 0; g < ics->num_window_groups; g++)
+    {
+        p = groups*nshort;
+
+        for (i = 0; i < ics->num_sec[g]; i++)
+        {
+            sect_cb = ics->sect_cb[g][i];
+
+            switch (sect_cb)
+            {
+            case ZERO_HCB:
+            case NOISE_HCB:
+            case INTENSITY_HCB:
+            case INTENSITY_HCB2:
+                p += (ics->sect_sfb_offset[g][ics->sect_end[g][i]] -
+                    ics->sect_sfb_offset[g][ics->sect_start[g][i]]);
+                break;
+            default:
+                for (k = ics->sect_sfb_offset[g][ics->sect_start[g][i]];
+                     k < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; k += 4)
+                {
+                    sp = spectral_data + p;
+
+                    if (sect_cb < FIRST_PAIR_HCB)
+                    {
+                        if ((result = huffman_spectral_data(sect_cb, ld, sp)) > 0)
+                            return result;
+                    } else {
+                        if ((result = huffman_spectral_data(sect_cb, ld, sp)) > 0)
+                            return result;
+                        if ((result = huffman_spectral_data(sect_cb, ld, sp+2)) > 0)
+                            return result;
+                    }
+                    p += 4;
+                }
+                break;
+            }
+        }
+        groups += ics->window_group_length[g];
+    }
+
+    return 0;
+}
+
+/* Table 4.4.30 */
+static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count)
+{
+    uint16_t i, n, dataElementLength;
+    uint8_t dataElementLengthPart;
+    uint8_t align = 4, data_element_version, loopCounter;
+
+    uint8_t extension_type = (uint8_t)faad_getbits(ld, 4
+        DEBUGVAR(1,87,"extension_payload(): extension_type"));
+
+    switch (extension_type)
+    {
+    case EXT_DYNAMIC_RANGE:
+        drc->present = 1;
+        n = dynamic_range_info(ld, drc);
+        return n;
+    case EXT_FILL_DATA:
+        /* fill_nibble = */ faad_getbits(ld, 4
+            DEBUGVAR(1,136,"extension_payload(): fill_nibble")); /* must be ‘0000’ */
+        for (i = 0; i < count-1; i++)
+        {
+            /* fill_byte[i] = */ faad_getbits(ld, 8
+                DEBUGVAR(1,88,"extension_payload(): fill_byte")); /* must be ‘10100101’ */
+        }
+        return count;
+    case EXT_DATA_ELEMENT:
+        data_element_version = faad_getbits(ld, 4
+            DEBUGVAR(1,400,"extension_payload(): data_element_version"));
+        switch (data_element_version)
+        {
+        case ANC_DATA:
+            loopCounter = 0;
+            dataElementLength = 0;
+            do {
+                dataElementLengthPart = faad_getbits(ld, 8
+                    DEBUGVAR(1,401,"extension_payload(): dataElementLengthPart"));
+                dataElementLength += dataElementLengthPart;
+                loopCounter++;
+            } while (dataElementLengthPart == 255);
+
+            for (i = 0; i < dataElementLength; i++)
+            {
+                /* data_element_byte[i] = */ faad_getbits(ld, 8
+                    DEBUGVAR(1,402,"extension_payload(): data_element_byte"));
+                return (dataElementLength+loopCounter+1);
+            }
+        default:
+            align = 0;
+        }
+    case EXT_FIL:
+    default:
+        faad_getbits(ld, align
+            DEBUGVAR(1,88,"extension_payload(): fill_nibble"));
+        for (i = 0; i < count-1; i++)
+        {
+            /* other_bits[i] = */ faad_getbits(ld, 8
+               DEBUGVAR(1,89,"extension_payload(): fill_bit"));
+        }
+        return count;
+    }
+}
+
+/* Table 4.4.31 */
+static uint8_t dynamic_range_info(bitfile *ld, drc_info *drc)
+{
+    uint8_t i, n = 1;
+    uint8_t band_incr;
+
+    drc->num_bands = 1;
+
+    if (faad_get1bit(ld
+        DEBUGVAR(1,90,"dynamic_range_info(): has instance_tag")) & 1)
+    {
+        drc->pce_instance_tag = (uint8_t)faad_getbits(ld, 4
+            DEBUGVAR(1,91,"dynamic_range_info(): pce_instance_tag"));
+        /* drc->drc_tag_reserved_bits = */ faad_getbits(ld, 4
+            DEBUGVAR(1,92,"dynamic_range_info(): drc_tag_reserved_bits"));
+        n++;
+    }
+
+    drc->excluded_chns_present = faad_get1bit(ld
+        DEBUGVAR(1,93,"dynamic_range_info(): excluded_chns_present"));
+    if (drc->excluded_chns_present == 1)
+    {
+        n += excluded_channels(ld, drc);
+    }
+
+    if (faad_get1bit(ld
+        DEBUGVAR(1,94,"dynamic_range_info(): has bands data")) & 1)
+    {
+        band_incr = (uint8_t)faad_getbits(ld, 4
+            DEBUGVAR(1,95,"dynamic_range_info(): band_incr"));
+        /* drc->drc_bands_reserved_bits = */ faad_getbits(ld, 4
+            DEBUGVAR(1,96,"dynamic_range_info(): drc_bands_reserved_bits"));
+        n++;
+        drc->num_bands += band_incr;
+
+        for (i = 0; i < drc->num_bands; i++);
+        {
+            drc->band_top[i] = (uint8_t)faad_getbits(ld, 8
+                DEBUGVAR(1,97,"dynamic_range_info(): band_top"));
+            n++;
+        }
+    }
+
+    if (faad_get1bit(ld
+        DEBUGVAR(1,98,"dynamic_range_info(): has prog_ref_level")) & 1)
+    {
+        drc->prog_ref_level = (uint8_t)faad_getbits(ld, 7
+            DEBUGVAR(1,99,"dynamic_range_info(): prog_ref_level"));
+        /* drc->prog_ref_level_reserved_bits = */ faad_get1bit(ld
+            DEBUGVAR(1,100,"dynamic_range_info(): prog_ref_level_reserved_bits"));
+        n++;
+    }
+
+    for (i = 0; i < drc->num_bands; i++)
+    {
+        drc->dyn_rng_sgn[i] = faad_get1bit(ld
+            DEBUGVAR(1,101,"dynamic_range_info(): dyn_rng_sgn"));
+        drc->dyn_rng_ctl[i] = (uint8_t)faad_getbits(ld, 7
+            DEBUGVAR(1,102,"dynamic_range_info(): dyn_rng_ctl"));
+        n++;
+    }
+
+    return n;
+}
+
+/* Table 4.4.32 */
+static uint8_t excluded_channels(bitfile *ld, drc_info *drc)
+{
+    uint8_t i, n = 0;
+    uint8_t num_excl_chan = 7;
+
+    for (i = 0; i < 7; i++)
+    {
+        drc->exclude_mask[i] = faad_get1bit(ld
+            DEBUGVAR(1,103,"excluded_channels(): exclude_mask"));
+    }
+    n++;
+
+    while ((drc->additional_excluded_chns[n-1] = faad_get1bit(ld
+        DEBUGVAR(1,104,"excluded_channels(): additional_excluded_chns"))) == 1)
+    {
+        for (i = num_excl_chan; i < num_excl_chan+7; i++)
+        {
+            drc->exclude_mask[i] = faad_get1bit(ld
+                DEBUGVAR(1,105,"excluded_channels(): exclude_mask"));
+        }
+        n++;
+        num_excl_chan += 7;
+    }
+
+    return n;
+}
+
+/* Annex A: Audio Interchange Formats */
+
+/* Table 1.A.2 */
+void get_adif_header(adif_header *adif, bitfile *ld)
+{
+    uint8_t i;
+
+    /* adif_id[0] = */ faad_getbits(ld, 8
+        DEBUGVAR(1,106,"get_adif_header(): adif_id[0]"));
+    /* adif_id[1] = */ faad_getbits(ld, 8
+        DEBUGVAR(1,107,"get_adif_header(): adif_id[1]"));
+    /* adif_id[2] = */ faad_getbits(ld, 8
+        DEBUGVAR(1,108,"get_adif_header(): adif_id[2]"));
+    /* adif_id[3] = */ faad_getbits(ld, 8
+        DEBUGVAR(1,109,"get_adif_header(): adif_id[3]"));
+    adif->copyright_id_present = faad_get1bit(ld
+        DEBUGVAR(1,110,"get_adif_header(): copyright_id_present"));
+    if(adif->copyright_id_present)
+    {
+        for (i = 0; i < 72/8; i++)
+        {
+            adif->copyright_id[i] = (int8_t)faad_getbits(ld, 8
+                DEBUGVAR(1,111,"get_adif_header(): copyright_id"));
+        }
+        adif->copyright_id[i] = 0;
+    }
+    adif->original_copy  = faad_get1bit(ld
+        DEBUGVAR(1,112,"get_adif_header(): original_copy"));
+    adif->home = faad_get1bit(ld
+        DEBUGVAR(1,113,"get_adif_header(): home"));
+    adif->bitstream_type = faad_get1bit(ld
+        DEBUGVAR(1,114,"get_adif_header(): bitstream_type"));
+    adif->bitrate = faad_getbits(ld, 23
+        DEBUGVAR(1,115,"get_adif_header(): bitrate"));
+    adif->num_program_config_elements = (uint8_t)faad_getbits(ld, 4
+        DEBUGVAR(1,116,"get_adif_header(): num_program_config_elements"));
+
+    for (i = 0; i < adif->num_program_config_elements + 1; i++)
+    {
+        if(adif->bitstream_type == 0)
+        {
+            adif->adif_buffer_fullness = faad_getbits(ld, 20
+                DEBUGVAR(1,117,"get_adif_header(): adif_buffer_fullness"));
+        } else {
+            adif->adif_buffer_fullness = 0;
+        }
+
+        program_config_element(&adif->pce[i], ld);
+    }
+}
+
+/* Table 1.A.5 */
+uint8_t adts_frame(adts_header *adts, bitfile *ld)
+{
+    /* faad_byte_align(ld); */
+    if (adts_fixed_header(adts, ld))
+        return 5;
+    adts_variable_header(adts, ld);
+    adts_error_check(adts, ld);
+
+    return 0;
+}
+
+/* Table 1.A.6 */
+static uint8_t adts_fixed_header(adts_header *adts, bitfile *ld)
+{
+    uint16_t i;
+    uint8_t sync_err = 1;
+
+    /* try to recover from sync errors */
+    for (i = 0; i < 768; i++)
+    {
+        adts->syncword = (uint16_t)faad_showbits(ld, 12);
+        if (adts->syncword != 0xFFF)
+        {
+            faad_getbits(ld, 8
+                DEBUGVAR(0,0,""));
+        } else {
+            sync_err = 0;
+            faad_getbits(ld, 12
+                DEBUGVAR(1,118,"adts_fixed_header(): syncword"));
+            break;
+        }
+    }
+    if (sync_err)
+        return 5;
+
+    adts->id = faad_get1bit(ld
+        DEBUGVAR(1,119,"adts_fixed_header(): id"));
+    adts->layer = (uint8_t)faad_getbits(ld, 2
+        DEBUGVAR(1,120,"adts_fixed_header(): layer"));
+    adts->protection_absent = faad_get1bit(ld
+        DEBUGVAR(1,121,"adts_fixed_header(): protection_absent"));
+    adts->profile = (uint8_t)faad_getbits(ld, 2
+        DEBUGVAR(1,122,"adts_fixed_header(): profile"));
+    adts->sf_index = (uint8_t)faad_getbits(ld, 4
+        DEBUGVAR(1,123,"adts_fixed_header(): sf_index"));
+    adts->private_bit = faad_get1bit(ld
+        DEBUGVAR(1,124,"adts_fixed_header(): private_bit"));
+    adts->channel_configuration = (uint8_t)faad_getbits(ld, 3
+        DEBUGVAR(1,125,"adts_fixed_header(): channel_configuration"));
+    adts->original = faad_get1bit(ld
+        DEBUGVAR(1,126,"adts_fixed_header(): original"));
+    adts->home = faad_get1bit(ld
+        DEBUGVAR(1,127,"adts_fixed_header(): home"));
+/* Removed in corrigendum 14496-3:2002
+    if (adts->id == 0)
+    {
+        adts->emphasis = (uint8_t)faad_getbits(ld, 2
+            DEBUGVAR(1,128,"adts_fixed_header(): emphasis"));
+    }
+*/
+
+    return 0;
+}
+
+/* Table 1.A.7 */
+static void adts_variable_header(adts_header *adts, bitfile *ld)
+{
+    adts->copyright_identification_bit = faad_get1bit(ld
+        DEBUGVAR(1,129,"adts_variable_header(): copyright_identification_bit"));
+    adts->copyright_identification_start = faad_get1bit(ld
+        DEBUGVAR(1,130,"adts_variable_header(): copyright_identification_start"));
+    adts->aac_frame_length = (uint16_t)faad_getbits(ld, 13
+        DEBUGVAR(1,131,"adts_variable_header(): aac_frame_length"));
+    adts->adts_buffer_fullness = (uint16_t)faad_getbits(ld, 11
+        DEBUGVAR(1,132,"adts_variable_header(): adts_buffer_fullness"));
+    adts->no_raw_data_blocks_in_frame = (uint8_t)faad_getbits(ld, 2
+        DEBUGVAR(1,133,"adts_variable_header(): no_raw_data_blocks_in_frame"));
+}
+
+/* Table 1.A.8 */
+static void adts_error_check(adts_header *adts, bitfile *ld)
+{
+    if (adts->protection_absent == 0)
+    {
+        adts->crc_check = (uint16_t)faad_getbits(ld, 16
+            DEBUGVAR(1,134,"adts_error_check(): crc_check"));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/syntax.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,144 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: syntax.h,v 1.32 2003/07/29 08:20:14 menno Exp $
+**/
+
+#ifndef __SYNTAX_H__
+#define __SYNTAX_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "decoder.h"
+#include "drc.h"
+#include "bits.h"
+
+#define MAIN       0
+#define LC         1
+#define SSR        2
+#define LTP        3
+#define LD        23
+#define ER_LC     17
+#define ER_LTP    19
+#define DRM_ER_LC 27 /* special object type for DRM */
+
+
+/* First object type that has ER */
+#define ER_OBJECT_START 17
+
+
+/* Bitstream */
+#define LEN_SE_ID 3
+#define LEN_TAG   4
+#define LEN_BYTE  8
+
+#define EXT_FIL            0
+#define EXT_FILL_DATA      1
+#define EXT_DATA_ELEMENT   2
+#define EXT_DYNAMIC_RANGE 11
+#define ANC_DATA           0
+
+/* Syntax elements */
+#define ID_SCE 0x0
+#define ID_CPE 0x1
+#define ID_CCE 0x2
+#define ID_LFE 0x3
+#define ID_DSE 0x4
+#define ID_PCE 0x5
+#define ID_FIL 0x6
+#define ID_END 0x7
+
+#define ONLY_LONG_SEQUENCE   0x0
+#define LONG_START_SEQUENCE  0x1
+#define EIGHT_SHORT_SEQUENCE 0x2
+#define LONG_STOP_SEQUENCE   0x3
+
+#define ZERO_HCB       0
+#define FIRST_PAIR_HCB 5
+#define ESC_HCB        11
+#define QUAD_LEN       4
+#define PAIR_LEN       2
+#define NOISE_HCB      13
+#define INTENSITY_HCB2 14
+#define INTENSITY_HCB  15
+
+static uint32_t sample_rates[] =
+{
+    96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000,
+    12000, 11025, 8000
+};
+
+int8_t GASpecificConfig(bitfile *ld, mp4AudioSpecificConfig *mp4ASC,
+                        program_config *pce);
+
+uint8_t adts_frame(adts_header *adts, bitfile *ld);
+void get_adif_header(adif_header *adif, bitfile *ld);
+
+
+/* static functions */
+static uint8_t single_lfe_channel_element(faacDecHandle hDecoder,
+                                          element *sce, bitfile *ld,
+                                          int16_t *spec_data);
+static uint8_t channel_pair_element(faacDecHandle hDecoder, element *cpe,
+                                    bitfile *ld, int16_t *spec_data1,
+                                    int16_t *spec_data2);
+static uint8_t coupling_channel_element(faacDecHandle hDecoder, bitfile *ld);
+static uint16_t data_stream_element(faacDecHandle hDecoder, bitfile *ld);
+static uint8_t program_config_element(program_config *pce, bitfile *ld);
+static uint8_t fill_element(faacDecHandle hDecoder, bitfile *ld, drc_info *drc
+#ifdef SBR_DEC
+                            ,uint8_t sbr_ele
+#endif
+                            );
+static uint8_t individual_channel_stream(faacDecHandle hDecoder, element *ele,
+                                         bitfile *ld, ic_stream *ics, uint8_t scal_flag,
+                                         int16_t *spec_data);
+static uint8_t ics_info(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld,
+                        uint8_t common_window);
+static uint8_t section_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld);
+static uint8_t scale_factor_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld);
+static void gain_control_data(bitfile *ld, ic_stream *ics);
+static uint8_t spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld,
+                             int16_t *spectral_data);
+static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count);
+#ifdef ERROR_RESILIENCE
+uint8_t reordered_spectral_data(faacDecHandle hDecoder, ic_stream *ics,
+                                bitfile *ld, int16_t *spectral_data);
+#endif
+static uint8_t pulse_data(ic_stream *ics, pulse_info *pul, bitfile *ld);
+static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld);
+static void ltp_data(faacDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld);
+static uint8_t adts_fixed_header(adts_header *adts, bitfile *ld);
+static void adts_variable_header(adts_header *adts, bitfile *ld);
+static void adts_error_check(adts_header *adts, bitfile *ld);
+static uint8_t dynamic_range_info(bitfile *ld, drc_info *drc);
+static uint8_t excluded_channels(bitfile *ld, drc_info *drc);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/tns.c	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,303 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: tns.c,v 1.21 2003/07/29 08:20:14 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include "syntax.h"
+#include "tns.h"
+
+#ifdef FIXED_POINT
+static real_t tns_coef_0_3[] =
+{
+    0x0, 0x6F13013, 0xC8261BA, 0xF994E02,
+    0xF03E3A3A, 0xF224C28C, 0xF5B72457, 0xFA8715E3,
+    0xF90ECFED, 0xF37D9E46, 0xF066B1FE, 0xF066B1FE,
+    0xF03E3A3A, 0xF224C28C, 0xF5B72457, 0xFA8715E3
+};
+static real_t tns_coef_0_4[] =
+{
+    0x0, 0x3539B35, 0x681FE48, 0x9679182,
+    0xBE3EBD4, 0xDDB3D74, 0xF378709, 0xFE98FCA,
+    0xF011790B, 0xF09C5CB7, 0xF1AD6942, 0xF33B524A,
+    0xF5388AEB, 0xF793BBDF, 0xFA385AA9, 0xFD0F5CAB
+};
+static real_t tns_coef_1_3[] =
+{
+    0x0, 0x6F13013, 0xF5B72457, 0xFA8715E3,
+    0xF994E02, 0xC8261BA, 0xF5B72457, 0xFA8715E3,
+    0xF90ECFED, 0xF37D9E46, 0xF5B72457, 0xFA8715E3,
+    0xF37D9E46, 0xF90ECFED, 0xF5B72457, 0xFA8715E3
+};
+static real_t tns_coef_1_4[] =
+{
+    0x0, 0x3539B35, 0x681FE48, 0x9679182,
+    0xF5388AEB, 0xF793BBDF, 0xFA385AA9, 0xFD0F5CAB,
+    0xFE98FCA, 0xF378709, 0xDDB3D74, 0xBE3EBD4,
+    0xF5388AEB, 0xF793BBDF, 0xFA385AA9, 0xFD0F5CAB
+};
+#else
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+static real_t tns_coef_0_3[] =
+{
+    0.0, 0.4338837391, 0.7818314825, 0.9749279122,
+    -0.9848077530, -0.8660254038, -0.6427876097, -0.3420201433,
+    -0.4338837391, -0.7818314825, -0.9749279122, -0.9749279122,
+    -0.9848077530, -0.8660254038, -0.6427876097, -0.3420201433
+};
+static real_t tns_coef_0_4[] =
+{
+    0.0, 0.2079116908, 0.4067366431, 0.5877852523,
+    0.7431448255, 0.8660254038, 0.9510565163, 0.9945218954,
+    -0.9957341763, -0.9618256432, -0.8951632914, -0.7980172273,
+    -0.6736956436, -0.5264321629, -0.3612416662, -0.1837495178
+};
+static real_t tns_coef_1_3[] =
+{
+    0.0, 0.4338837391, -0.6427876097, -0.3420201433,
+    0.9749279122, 0.7818314825, -0.6427876097, -0.3420201433,
+    -0.4338837391, -0.7818314825, -0.6427876097, -0.3420201433,
+    -0.7818314825, -0.4338837391, -0.6427876097, -0.3420201433
+};
+static real_t tns_coef_1_4[] =
+{
+    0.0, 0.2079116908, 0.4067366431, 0.5877852523,
+    -0.6736956436, -0.5264321629, -0.3612416662, -0.1837495178,
+    0.9945218954, 0.9510565163, 0.8660254038, 0.7431448255,
+    -0.6736956436, -0.5264321629, -0.3612416662, -0.1837495178
+};
+#endif
+
+
+/* TNS decoding for one channel and frame */
+void tns_decode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index,
+                      uint8_t object_type, real_t *spec, uint16_t frame_len)
+{
+    uint8_t w, f, tns_order;
+    int8_t inc;
+    uint16_t bottom, top, start, end, size;
+    uint16_t nshort = frame_len/8;
+    real_t lpc[TNS_MAX_ORDER+1];
+
+    if (!ics->tns_data_present)
+        return;
+
+    for (w = 0; w < ics->num_windows; w++)
+    {
+        bottom = ics->num_swb;
+
+        for (f = 0; f < tns->n_filt[w]; f++)
+        {
+            top = bottom;
+            bottom = max(top - tns->length[w][f], 0);
+            tns_order = min(tns->order[w][f], TNS_MAX_ORDER);
+            if (!tns_order)
+                continue;
+
+            tns_decode_coef(tns_order, tns->coef_res[w]+3,
+                tns->coef_compress[w][f], tns->coef[w][f], lpc);
+
+            start = ics->swb_offset[min(bottom, ics->max_sfb)];
+            end = ics->swb_offset[min(top, ics->max_sfb)];
+
+            if ((size = end - start) <= 0)
+                continue;
+
+            if (tns->direction[w][f])
+            {
+                inc = -1;
+                start = end - 1;
+            } else {
+                inc = 1;
+            }
+
+            tns_ar_filter(&spec[(w*nshort)+start], size, inc, lpc, tns_order);
+        }
+    }
+}
+
+/* TNS encoding for one channel and frame */
+void tns_encode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index,
+                      uint8_t object_type, real_t *spec, uint16_t frame_len)
+{
+    uint8_t w, f, tns_order;
+    int8_t inc;
+    uint16_t bottom, top, start, end, size;
+    uint16_t nshort = frame_len/8;
+    real_t lpc[TNS_MAX_ORDER+1];
+
+    if (!ics->tns_data_present)
+        return;
+
+    for (w = 0; w < ics->num_windows; w++)
+    {
+        bottom = ics->num_swb;
+
+        for (f = 0; f < tns->n_filt[w]; f++)
+        {
+            top = bottom;
+            bottom = max(top - tns->length[w][f], 0);
+            tns_order = min(tns->order[w][f], TNS_MAX_ORDER);
+            if (!tns_order)
+                continue;
+
+            tns_decode_coef(tns_order, tns->coef_res[w]+3,
+                tns->coef_compress[w][f], tns->coef[w][f], lpc);
+
+            start = ics->swb_offset[min(bottom, ics->max_sfb)];
+            end = ics->swb_offset[min(top, ics->max_sfb)];
+
+            if ((size = end - start) <= 0)
+                continue;
+
+            if (tns->direction[w][f])
+            {
+                inc = -1;
+                start = end - 1;
+            } else {
+                inc = 1;
+            }
+
+            tns_ma_filter(&spec[(w*nshort)+start], size, inc, lpc, tns_order);
+        }
+    }
+}
+
+/* Decoder transmitted coefficients for one TNS filter */
+static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_compress,
+                            uint8_t *coef, real_t *a)
+{
+    uint8_t i, m;
+    real_t tmp2[TNS_MAX_ORDER+1], b[TNS_MAX_ORDER+1];
+
+    /* Conversion to signed integer */
+    for (i = 0; i < order; i++)
+    {
+        if (coef_compress == 0)
+        {
+            if (coef_res_bits == 3)
+            {
+                tmp2[i] = tns_coef_0_3[coef[i]];
+            } else {
+                tmp2[i] = tns_coef_0_4[coef[i]];
+            }
+        } else {
+            if (coef_res_bits == 3)
+            {
+                tmp2[i] = tns_coef_1_3[coef[i]];
+            } else {
+                tmp2[i] = tns_coef_1_4[coef[i]];
+            }
+        }
+    }
+
+    /* Conversion to LPC coefficients */
+    a[0] = COEF_CONST(1.0);
+    for (m = 1; m <= order; m++)
+    {
+        for (i = 1; i < m; i++) /* loop only while i<m */
+            b[i] = a[i] + MUL_C_C(tmp2[m-1], a[m-i]);
+
+        for (i = 1; i < m; i++) /* loop only while i<m */
+            a[i] = b[i];
+
+        a[m] = tmp2[m-1]; /* changed */
+    }
+}
+
+static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc,
+                          uint8_t order)
+{
+    /*
+     - Simple all-pole filter of order "order" defined by
+       y(n) = x(n) - lpc[1]*y(n-1) - ... - lpc[order]*y(n-order)
+     - The state variables of the filter are initialized to zero every time
+     - The output data is written over the input data ("in-place operation")
+     - An input vector of "size" samples is processed and the index increment
+       to the next data sample is given by "inc"
+    */
+
+    uint8_t j;
+    uint16_t i;
+    real_t y, state[TNS_MAX_ORDER];
+
+    for (i = 0; i < order; i++)
+        state[i] = 0;
+
+    for (i = 0; i < size; i++)
+    {
+        y = *spectrum;
+
+        for (j = 0; j < order; j++)
+            y -= MUL_R_C(state[j], lpc[j+1]);
+
+        for (j = order-1; j > 0; j--)
+            state[j] = state[j-1];
+
+        state[0] = y;
+        *spectrum = y;
+        spectrum += inc;
+    }
+}
+
+static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc,
+                          uint8_t order)
+{
+    /*
+     - Simple all-zero filter of order "order" defined by
+       y(n) =  x(n) + a(2)*x(n-1) + ... + a(order+1)*x(n-order)
+     - The state variables of the filter are initialized to zero every time
+     - The output data is written over the input data ("in-place operation")
+     - An input vector of "size" samples is processed and the index increment
+       to the next data sample is given by "inc"
+    */
+
+    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);
+
+    for (i = 0; i < size; i++)
+    {
+        y = *spectrum;
+
+        for (j = 0; j < order; j++)
+            y += MUL_R_C(state[j], lpc[j+1]);
+
+        for (j = order-1; j > 0; j--)
+            state[j] = state[j-1];
+
+        state[0] = *spectrum;
+        *spectrum = y;
+        spectrum += inc;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libfaad2/tns.h	Sat Aug 30 22:30:28 2003 +0000
@@ -0,0 +1,55 @@
+/*
+** 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 
+** 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
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: tns.h,v 1.8 2003/07/29 08:20:14 menno Exp $
+**/
+
+#ifndef __TNS_H__
+#define __TNS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define TNS_MAX_ORDER 20
+
+    
+void tns_decode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index,
+                      uint8_t object_type, real_t *spec, uint16_t frame_len);
+void tns_encode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index,
+                      uint8_t object_type, real_t *spec, uint16_t frame_len);
+
+static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_compress,
+                            uint8_t *coef, real_t *a);
+static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc,
+                          uint8_t order);
+static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc,
+                          uint8_t order);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif