changeset 2:6efb9e514224 trunk

[svn] Import AAC stuff.
author nenolod
date Mon, 24 Oct 2005 10:44:27 -0700
parents cc6293c827ec
children ca62d3600a75
files Input/Makefile.am Input/Makefile.in Input/aac/Makefile.am Input/aac/include/faad.h Input/aac/include/mpeg4ip.h Input/aac/include/systems.h Input/aac/libfaad2/Makefile.am Input/aac/libfaad2/analysis.h Input/aac/libfaad2/bits.c Input/aac/libfaad2/bits.h Input/aac/libfaad2/cfft.c Input/aac/libfaad2/cfft.h Input/aac/libfaad2/cfft_tab.h Input/aac/libfaad2/codebook/hcb.h Input/aac/libfaad2/codebook/hcb_1.h Input/aac/libfaad2/codebook/hcb_10.h Input/aac/libfaad2/codebook/hcb_11.h Input/aac/libfaad2/codebook/hcb_2.h Input/aac/libfaad2/codebook/hcb_3.h Input/aac/libfaad2/codebook/hcb_4.h Input/aac/libfaad2/codebook/hcb_5.h Input/aac/libfaad2/codebook/hcb_6.h Input/aac/libfaad2/codebook/hcb_7.h Input/aac/libfaad2/codebook/hcb_8.h Input/aac/libfaad2/codebook/hcb_9.h Input/aac/libfaad2/codebook/hcb_sf.h Input/aac/libfaad2/common.c Input/aac/libfaad2/common.h Input/aac/libfaad2/decoder.c Input/aac/libfaad2/decoder.h Input/aac/libfaad2/drc.c Input/aac/libfaad2/drc.h Input/aac/libfaad2/error.c Input/aac/libfaad2/error.h Input/aac/libfaad2/filtbank.c Input/aac/libfaad2/filtbank.h Input/aac/libfaad2/fixed.h Input/aac/libfaad2/hcr.c Input/aac/libfaad2/huffman.c Input/aac/libfaad2/huffman.h Input/aac/libfaad2/ic_predict.c Input/aac/libfaad2/ic_predict.h Input/aac/libfaad2/iq_table.h Input/aac/libfaad2/is.c Input/aac/libfaad2/is.h Input/aac/libfaad2/kbd_win.h Input/aac/libfaad2/libfaad.dsp Input/aac/libfaad2/libfaad.dsw Input/aac/libfaad2/libfaad.sln Input/aac/libfaad2/libfaad.vcproj Input/aac/libfaad2/libfaad2.def Input/aac/libfaad2/libfaad2.vcp Input/aac/libfaad2/libfaad2.vcw Input/aac/libfaad2/libfaad2_dll.dsp Input/aac/libfaad2/libfaad2_dll.dsw Input/aac/libfaad2/libfaad2_dll.sln Input/aac/libfaad2/libfaad2_dll.vcproj Input/aac/libfaad2/lt_predict.c Input/aac/libfaad2/lt_predict.h Input/aac/libfaad2/mdct.c Input/aac/libfaad2/mdct.h Input/aac/libfaad2/mp4.c Input/aac/libfaad2/mp4.h Input/aac/libfaad2/ms.c Input/aac/libfaad2/ms.h Input/aac/libfaad2/output.c Input/aac/libfaad2/output.h Input/aac/libfaad2/pns.c Input/aac/libfaad2/pns.h Input/aac/libfaad2/pulse.c Input/aac/libfaad2/pulse.h Input/aac/libfaad2/rvlc.c Input/aac/libfaad2/rvlc.h Input/aac/libfaad2/sbr_dct.c Input/aac/libfaad2/sbr_dct.h Input/aac/libfaad2/sbr_dec.c Input/aac/libfaad2/sbr_dec.h Input/aac/libfaad2/sbr_e_nf.c Input/aac/libfaad2/sbr_e_nf.h Input/aac/libfaad2/sbr_fbt.c Input/aac/libfaad2/sbr_fbt.h Input/aac/libfaad2/sbr_hfadj.c Input/aac/libfaad2/sbr_hfadj.h Input/aac/libfaad2/sbr_hfgen.c Input/aac/libfaad2/sbr_hfgen.h Input/aac/libfaad2/sbr_huff.c Input/aac/libfaad2/sbr_huff.h Input/aac/libfaad2/sbr_noise.h Input/aac/libfaad2/sbr_qmf.c Input/aac/libfaad2/sbr_qmf.h Input/aac/libfaad2/sbr_qmf_c.h Input/aac/libfaad2/sbr_syntax.c Input/aac/libfaad2/sbr_syntax.h Input/aac/libfaad2/sbr_tf_grid.c Input/aac/libfaad2/sbr_tf_grid.h Input/aac/libfaad2/sine_win.h Input/aac/libfaad2/specrec.c Input/aac/libfaad2/specrec.h Input/aac/libfaad2/ssr.c Input/aac/libfaad2/ssr.h Input/aac/libfaad2/ssr_fb.c Input/aac/libfaad2/ssr_fb.h Input/aac/libfaad2/ssr_ipqf.c Input/aac/libfaad2/ssr_ipqf.h Input/aac/libfaad2/ssr_win.h Input/aac/libfaad2/structs.h Input/aac/libfaad2/syntax.c Input/aac/libfaad2/syntax.h Input/aac/libfaad2/tns.c Input/aac/libfaad2/tns.h Input/aac/libmp4v2/API_CHANGES Input/aac/libmp4v2/INTERNALS Input/aac/libmp4v2/Makefile.am Input/aac/libmp4v2/README Input/aac/libmp4v2/TODO Input/aac/libmp4v2/atom_co64.cpp Input/aac/libmp4v2/atom_cprt.cpp Input/aac/libmp4v2/atom_ctts.cpp Input/aac/libmp4v2/atom_dimm.cpp Input/aac/libmp4v2/atom_dinf.cpp Input/aac/libmp4v2/atom_dmax.cpp Input/aac/libmp4v2/atom_dmed.cpp Input/aac/libmp4v2/atom_dref.cpp Input/aac/libmp4v2/atom_drep.cpp Input/aac/libmp4v2/atom_edts.cpp Input/aac/libmp4v2/atom_elst.cpp Input/aac/libmp4v2/atom_esds.cpp Input/aac/libmp4v2/atom_free.cpp Input/aac/libmp4v2/atom_ftyp.cpp Input/aac/libmp4v2/atom_hdlr.cpp Input/aac/libmp4v2/atom_hinf.cpp Input/aac/libmp4v2/atom_hmhd.cpp Input/aac/libmp4v2/atom_hnti.cpp Input/aac/libmp4v2/atom_iods.cpp Input/aac/libmp4v2/atom_maxr.cpp Input/aac/libmp4v2/atom_mdat.cpp Input/aac/libmp4v2/atom_mdhd.cpp Input/aac/libmp4v2/atom_mdia.cpp Input/aac/libmp4v2/atom_mfhd.cpp Input/aac/libmp4v2/atom_minf.cpp Input/aac/libmp4v2/atom_moof.cpp Input/aac/libmp4v2/atom_moov.cpp Input/aac/libmp4v2/atom_mp4a.cpp Input/aac/libmp4v2/atom_mp4s.cpp Input/aac/libmp4v2/atom_mp4v.cpp Input/aac/libmp4v2/atom_mvex.cpp Input/aac/libmp4v2/atom_mvhd.cpp Input/aac/libmp4v2/atom_nmhd.cpp Input/aac/libmp4v2/atom_nump.cpp Input/aac/libmp4v2/atom_payt.cpp Input/aac/libmp4v2/atom_pmax.cpp Input/aac/libmp4v2/atom_root.cpp Input/aac/libmp4v2/atom_rtp.cpp Input/aac/libmp4v2/atom_sdp.cpp Input/aac/libmp4v2/atom_smhd.cpp Input/aac/libmp4v2/atom_snro.cpp Input/aac/libmp4v2/atom_stbl.cpp Input/aac/libmp4v2/atom_stco.cpp Input/aac/libmp4v2/atom_stdp.cpp Input/aac/libmp4v2/atom_stsc.cpp Input/aac/libmp4v2/atom_stsd.cpp Input/aac/libmp4v2/atom_stsh.cpp Input/aac/libmp4v2/atom_stss.cpp Input/aac/libmp4v2/atom_stsz.cpp Input/aac/libmp4v2/atom_stts.cpp Input/aac/libmp4v2/atom_tfhd.cpp Input/aac/libmp4v2/atom_tims.cpp Input/aac/libmp4v2/atom_tkhd.cpp Input/aac/libmp4v2/atom_tmax.cpp Input/aac/libmp4v2/atom_tmin.cpp Input/aac/libmp4v2/atom_tpyl.cpp Input/aac/libmp4v2/atom_traf.cpp Input/aac/libmp4v2/atom_trak.cpp Input/aac/libmp4v2/atom_tref.cpp Input/aac/libmp4v2/atom_treftype.cpp Input/aac/libmp4v2/atom_trex.cpp Input/aac/libmp4v2/atom_trpy.cpp Input/aac/libmp4v2/atom_trun.cpp Input/aac/libmp4v2/atom_tsro.cpp Input/aac/libmp4v2/atom_udta.cpp Input/aac/libmp4v2/atom_url.cpp Input/aac/libmp4v2/atom_urn.cpp Input/aac/libmp4v2/atom_vmhd.cpp Input/aac/libmp4v2/atoms.h Input/aac/libmp4v2/descriptors.cpp Input/aac/libmp4v2/descriptors.h Input/aac/libmp4v2/isma.cpp Input/aac/libmp4v2/libmp4v260.dsp Input/aac/libmp4v2/libmp4v2_st60.dsp Input/aac/libmp4v2/mp4.cpp Input/aac/libmp4v2/mp4.h Input/aac/libmp4v2/mp4array.h Input/aac/libmp4v2/mp4atom.cpp Input/aac/libmp4v2/mp4atom.h Input/aac/libmp4v2/mp4common.h Input/aac/libmp4v2/mp4container.cpp Input/aac/libmp4v2/mp4container.h Input/aac/libmp4v2/mp4descriptor.cpp Input/aac/libmp4v2/mp4descriptor.h Input/aac/libmp4v2/mp4file.cpp Input/aac/libmp4v2/mp4file.h Input/aac/libmp4v2/mp4file_io.cpp Input/aac/libmp4v2/mp4info.cpp Input/aac/libmp4v2/mp4property.cpp Input/aac/libmp4v2/mp4property.h Input/aac/libmp4v2/mp4track.cpp Input/aac/libmp4v2/mp4track.h Input/aac/libmp4v2/mp4util.cpp Input/aac/libmp4v2/mp4util.h Input/aac/libmp4v2/ocidescriptors.cpp Input/aac/libmp4v2/ocidescriptors.h Input/aac/libmp4v2/odcommands.cpp Input/aac/libmp4v2/odcommands.h Input/aac/libmp4v2/qosqualifiers.cpp Input/aac/libmp4v2/qosqualifiers.h Input/aac/libmp4v2/rtphint.cpp Input/aac/libmp4v2/rtphint.h Input/aac/libmp4v2/win32_ver.h Input/aac/src/Makefile.am Input/aac/src/aac_utils.c Input/aac/src/libmp4.c Input/aac/src/mp4_utils.c Input/cdaudio/Makefile.in Input/mpg123/Makefile.in Input/vorbis/Makefile.in Input/wav/Makefile.in Makefile.in Output/Makefile.in Output/OSS/Makefile.in Output/alsa/Makefile.in Output/esd/Makefile.in Visualization/Makefile.in Visualization/blur_scope/Makefile.in audacious/Makefile.in audacious/glade/Makefile.in audacious/images/Makefile.in configure configure.ac icons/Makefile.in libaudacious/Makefile.in skin/Makefile.in
diffstat 241 files changed, 62786 insertions(+), 154 deletions(-) [+]
line wrap: on
line diff
--- a/Input/Makefile.am	Mon Oct 24 03:12:26 2005 -0700
+++ b/Input/Makefile.am	Mon Oct 24 10:44:27 2005 -0700
@@ -1,2 +1,2 @@
-ALL_PLUGINS = mpg123 vorbis cdaudio wav
+ALL_PLUGINS = mpg123 aac vorbis cdaudio wav
 SUBDIRS = $(INPUT_PLUGINS)
--- a/Input/Makefile.in	Mon Oct 24 03:12:26 2005 -0700
+++ b/Input/Makefile.in	Mon Oct 24 10:44:27 2005 -0700
@@ -94,7 +94,10 @@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
 CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
 DEFS = @DEFS@
@@ -106,6 +109,8 @@
 EFFECT_PLUGINS = @EFFECT_PLUGINS@
 EFFECT_PLUGIN_DIR = @EFFECT_PLUGIN_DIR@
 EGREP = @EGREP@
+ENABLE_AAC_FALSE = @ENABLE_AAC_FALSE@
+ENABLE_AAC_TRUE = @ENABLE_AAC_TRUE@
 ENABLE_MPG123_FALSE = @ENABLE_MPG123_FALSE@
 ENABLE_MPG123_TRUE = @ENABLE_MPG123_TRUE@
 ESD_CFLAGS = @ESD_CFLAGS@
@@ -209,10 +214,13 @@
 X_PRE_LIBS = @X_PRE_LIBS@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
 ac_ct_RANLIB = @ac_ct_RANLIB@
 ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
@@ -254,7 +262,7 @@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
-ALL_PLUGINS = mpg123 vorbis cdaudio wav
+ALL_PLUGINS = mpg123 aac vorbis cdaudio wav
 SUBDIRS = $(INPUT_PLUGINS)
 all: all-recursive
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/Makefile.am	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,1 @@
+SUBDIRS = libmp4v2 libfaad2 src
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/include/faad.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,216 @@
+/*
+** 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.36 2003/11/14 15:16:43 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 RC3 "
+
+/* object types for AAC */
+#define MAIN       1
+#define LC         2
+#define SSR        3
+#define LTP        4
+#define HE_AAC     5
+#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
+
+/* SBR signalling */
+#define NO_SBR           0
+#define SBR_UPSAMPLED    1
+#define SBR_DOWNSAMPLED  2
+#define NO_SBR_UPSAMPLED 3
+
+/* 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
+
+/* Capabilities */
+#define LC_DEC_CAP           (1<<0) /* Can decode LC */
+#define MAIN_DEC_CAP         (1<<1) /* Can decode MAIN */
+#define LTP_DEC_CAP          (1<<2) /* Can decode LTP */
+#define LD_DEC_CAP           (1<<3) /* Can decode LD */
+#define ERROR_RESILIENCE_CAP (1<<4) /* Can decode ER */
+#define FIXED_POINT_CAP      (1<<5) /* Fixed point */
+
+/* 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)
+
+/* DRM channel definitions */
+#define DRMCH_MONO          1
+#define DRMCH_STEREO        2
+#define DRMCH_SBR_MONO      3
+#define DRMCH_SBR_LC_STEREO 4
+#define DRMCH_SBR_STEREO    5
+
+
+/* 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;
+    char forceUpSampling;
+} mp4AudioSpecificConfig;
+
+typedef struct faacDecConfiguration
+{
+    unsigned char defObjectType;
+    unsigned long defSampleRate;
+    unsigned char outputFormat;
+    unsigned char downMatrix;
+    unsigned char useOldADTSFormat;
+} faacDecConfiguration, *faacDecConfigurationPtr;
+
+typedef struct faacDecFrameInfo
+{
+    unsigned long bytesconsumed;
+    unsigned long samples;
+    unsigned char channels;
+    unsigned char error;
+    unsigned long samplerate;
+
+    /* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */
+    unsigned char sbr;
+
+    /* MPEG-4 ObjectType */
+    unsigned char object_type;
+
+    /* AAC header type; MP4 will be signalled as RAW also */
+    unsigned char header_type;
+
+    /* 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 faacDecPostSeekReset(faacDecHandle hDecoder, long frame);
+
+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/Input/aac/include/mpeg4ip.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,58 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2000, 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#ifndef __MPEG4IP_INCLUDED__
+#define __MPEG4IP_INCLUDED__
+
+/* project wide applicable stuff here */
+
+#include <systems.h>
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef __cplusplus
+#ifndef bool
+typedef unsigned char bool;
+#endif
+#endif
+
+#ifndef MIN
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+#ifndef MAX
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#endif
+
+#ifndef ROUND
+# ifdef HAVE_RINT
+# define ROUND(f) rint(f)
+# else
+# define ROUND(f) (int)(floor((f) + 0.5))
+# endif
+#endif
+
+#endif /* __MPEG4IP_INCLUDED__ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/include/systems.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,271 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2000, 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ *		Bill May		wmay@cisco.com
+ */
+
+#ifndef __SYSTEMS_H__
+#define __SYSTEMS_H__
+
+#ifdef WIN32
+#define HAVE_IN_PORT_T
+#define HAVE_SOCKLEN_T
+#include <win32_ver.h>
+#else
+#include <config.h>
+#endif
+
+
+
+
+#ifdef WIN32
+
+#define _WIN32_WINNT 0x0400
+#include <windows.h>
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <time.h>
+#include <limits.h>
+
+typedef unsigned __int64 uint64_t;
+typedef unsigned __int32 uint32_t;
+typedef unsigned __int16 uint16_t;
+typedef unsigned __int8 uint8_t;
+typedef unsigned __int64 u_int64_t;
+typedef unsigned __int32 u_int32_t;
+typedef unsigned __int16 u_int16_t;
+typedef unsigned __int8 u_int8_t;
+typedef __int64 int64_t;
+typedef __int32 int32_t;
+typedef __int16 int16_t;
+typedef __int8  int8_t;
+typedef unsigned short in_port_t;
+typedef unsigned int socklen_t;
+typedef int ssize_t;
+#define snprintf _snprintf
+#define strncasecmp _strnicmp
+#define strcasecmp _stricmp
+
+#include <io.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#define write _write
+#define lseek _lseek
+#define close _close
+#define open _open
+#define access _access
+#define vsnprintf _vsnprintf
+#define F_OK 0
+#define OPEN_RDWR (_O_RDWR | _O_BINARY)
+#define OPEN_CREAT (_O_CREAT | _O_BINARY)
+#define OPEN_RDONLY (_O_RDONLY | _O_BINARY)
+#define srandom srand
+#define random rand
+
+#define IOSBINARY ios::binary
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+int gettimeofday(struct timeval *t, void *);
+#ifdef __cplusplus
+}
+#endif
+
+#define PATH_MAX MAX_PATH
+#define MAX_UINT64 -1
+#define LLD "%I64d"
+#define LLU "%I64u"
+#define LLX "%I64x"
+#define M_LLU 1000i64
+#define C_LLU 100i64
+#define I_LLU 1i64
+
+#define LOG_EMERG 0
+#define LOG_ALERT 1
+#define LOG_CRIT 2
+#define LOG_ERR 3
+#define LOG_WARNING 4
+#define LOG_NOTICE 5
+#define LOG_INFO 6
+#define LOG_DEBUG 7
+
+#if     !__STDC__ && _INTEGRAL_MAX_BITS >= 64
+#define VAR_TO_FPOS(fpos, var) (fpos) = (var)
+#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)(_FPOSOFF(fpos))
+#else
+#define VAR_TO_FPOS(fpos, var) (fpos).lopart = ((var) & UINT_MAX); (fpos).hipart = ((var) >> 32)
+#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)((uint64_t)((fpos).hipart ) << 32 | (fpos).lopart)
+#endif
+
+#define __STRING(expr) #expr
+
+#define FOPEN_READ_BINARY "rb"
+#define FOPEN_WRITE_BINARY "wb"
+
+#else /* UNIX */
+
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#else
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#else
+#error "Don't have stdint.h or inttypes.h - no way to get uint8_t"
+#endif
+#endif
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <netinet/in.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <syslog.h>
+#include <string.h>
+#include <ctype.h>
+#include <netdb.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/param.h>
+
+#define OPEN_RDWR O_RDWR
+#define OPEN_CREAT O_CREAT 
+#define OPEN_RDONLY O_RDONLY
+
+#define closesocket close
+#define IOSBINARY ios::bin
+#define MAX_UINT64 -1LLU
+#define LLD "%lld"
+#define LLU "%llu"
+#define LLX "%llx"
+#define M_LLU 1000LLU
+#define C_LLU 100LLU
+#define I_LLU 1LLU
+#ifdef HAVE_FPOS_T_POS
+#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)((fpos).__pos)
+#define VAR_TO_FPOS(fpos, var) (fpos).__pos = (var)
+#else
+#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)(fpos)
+#define VAR_TO_FPOS(fpos, var) (fpos) = (var)
+#endif
+
+#define FOPEN_READ_BINARY "r"
+#define FOPEN_WRITE_BINARY "w"
+#endif /* define unix */
+
+#include <stdarg.h>
+typedef void (*error_msg_func_t)(int loglevel,
+				 const char *lib,
+				 const char *fmt,
+				 va_list ap);
+typedef void (*lib_message_func_t)(int loglevel,
+				   const char *lib,
+				   const char *fmt,
+				   ...);
+#ifndef HAVE_IN_PORT_T
+typedef uint16_t in_port_t;
+#endif
+
+#ifndef HAVE_SOCKLEN_T
+typedef unsigned int socklen_t;
+#endif
+
+#ifdef sun
+#include <limits.h>
+#define u_int8_t uint8_t
+#define u_int16_t uint16_t
+#define u_int32_t uint32_t
+#define u_int64_t uint64_t
+#define __STRING(expr) #expr
+#endif
+
+#ifndef HAVE_STRSEP
+#ifdef __cplusplus
+extern "C" {
+#endif
+char *strsep(char **strp, const char *delim); 
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#ifndef MIN
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+#endif
+
+#ifndef MAX
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#endif
+
+#ifndef INADDR_NONE
+#define INADDR_NONE (-1)
+#endif
+
+#define MALLOC_STRUCTURE(a) ((a *)malloc(sizeof(a)))
+
+#define CHECK_AND_FREE(a) if ((a) != NULL) { free((a)); (a) = NULL;}
+#ifndef HAVE_GLIB_H
+typedef char gchar;
+typedef unsigned char guchar;
+
+typedef int gint;
+typedef unsigned int guint;
+
+typedef long glong;
+typedef unsigned long gulong;
+
+typedef double gdouble;
+
+typedef int gboolean;
+
+typedef int16_t gint16;
+typedef uint16_t guint16;
+
+typedef int32_t gint32;
+typedef uint32_t guint32;
+
+typedef int64_t gint64;
+typedef uint64_t guint64;
+
+typedef uint8_t  guint8;
+typedef int8_t gint8;
+
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#endif /* __SYSTEMS_H__ */
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/Makefile.am	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,20 @@
+noinst_LTLIBRARIES = libfaad.la
+
+libfaad_la_SOURCES = bits.c cfft.c decoder.c drc.c \
+error.c filtbank.c \
+ic_predict.c is.c lt_predict.c mdct.c mp4.c ms.c output.c pns.c \
+pulse.c specrec.c syntax.c tns.c hcr.c huffman.c \
+rvlc.c ssr.c ssr_fb.c ssr_ipqf.c common.c \
+sbr_dct.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 sbr_dec.c \
+analysis.h bits.h cfft.h cfft_tab.h common.h \
+decoder.h drc.h error.h fixed.h filtbank.h \
+huffman.h ic_predict.h iq_table.h is.h kbd_win.h lt_predict.h mdct.h mp4.h \
+ms.h output.h pns.h pulse.h rvlc.h sine_win.h ssr.h ssr_fb.h ssr_ipqf.h \
+ssr_win.h specrec.h syntax.h structs.h tns.h \
+sbr_dct.h sbr_dec.h sbr_e_nf.h sbr_fbt.h sbr_hfadj.h sbr_hfgen.h \
+sbr_huff.h sbr_noise.h sbr_qmf.h sbr_syntax.h sbr_tf_grid.h \
+sbr_qmf_c.h codebook/hcb.h \
+codebook/hcb_1.h codebook/hcb_2.h codebook/hcb_3.h codebook/hcb_4.h \
+codebook/hcb_5.h codebook/hcb_6.h codebook/hcb_7.h codebook/hcb_8.h \
+codebook/hcb_9.h codebook/hcb_10.h codebook/hcb_11.h codebook/hcb_sf.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/analysis.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.9 2003/11/12 20:47:56 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/Input/aac/libfaad2/bits.c	Mon Oct 24 10:44:27 2005 -0700
@@ -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: bits.c,v 1.28 2003/11/12 20:47:57 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, const void *_buffer, const uint32_t buffer_size)
+{
+    uint32_t tmp;
+
+    if (ld == NULL)
+        return;
+
+    memset(ld, 0, sizeof(bitfile));
+
+    if (buffer_size == 0 || _buffer == NULL)
+    {
+        ld->error = 1;
+        ld->no_more_reading = 1;
+        return;
+    }
+
+    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);
+    ld->bufa = tmp;
+
+    tmp = getdword((uint32_t*)ld->buffer + 1);
+    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 (uint32_t)(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;
+}
+
+void faad_flushbits_ex(bitfile *ld, uint32_t bits)
+{
+    uint32_t tmp;
+
+    ld->bufa = ld->bufb;
+    tmp = getdword(ld->tail);
+    ld->tail++;
+    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;
+}
+
+/* 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);
+    ld->bufa = tmp;
+
+    tmp = getdword((uint32_t*)buffer + index - 1);
+    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/Input/aac/libfaad2/bits.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,368 @@
+/*
+** 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.h,v 1.27 2003/11/12 20:47:57 menno Exp $
+**/
+
+#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, const void *buffer, const 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_flushbits_ex(bitfile *ld, uint32_t bits);
+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;
+#ifndef ARCH_IS_BIG_ENDIAN
+    ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[3];
+    ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[2];
+    ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[1];
+    ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[0];
+#else
+    ((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];
+#endif
+
+    return tmp;
+#else
+    uint32_t tmp;
+    tmp = *(uint32_t*)mem;
+#ifndef ARCH_IS_BIG_ENDIAN
+    BSWAP(tmp);
+#endif
+    return tmp;
+#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];
+    }
+
+    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 {
+        faad_flushbits_ex(ld, bits);
+    }
+}
+
+/* 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 || 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);
+        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 DRM
+static uint8_t faad_check_CRC(bitfile *ld, uint16_t len)
+{
+    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;
+    }
+}
+
+static uint8_t tabFlipbits[256] = {
+    0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,
+    8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248,
+    4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244,
+    12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,
+    2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,
+    10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,
+    6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,
+    14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,
+    1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,
+    9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,
+    5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,
+    13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,
+    3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,
+    11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251,
+    7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247,
+    15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255
+};
+#endif
+
+#ifdef ERROR_RESILIENCE
+
+/* Modified bit reading functions for HCR */
+
+typedef struct
+{
+    /* bit input */
+    uint32_t bufa;
+    uint32_t bufb;
+    int8_t len; 
+} bits_t;
+
+
+static INLINE uint32_t showbits_hcr(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_hcr( 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_hcr(bits_t *ld, uint8_t n, uint32_t *result)
+{
+    *result = showbits_hcr(ld, n);
+    return flushbits_hcr(ld, n);
+}
+
+static INLINE int8_t get1bit_hcr(bits_t *ld, uint8_t *result)
+{
+    uint32_t res;
+    int8_t ret;
+
+    ret = getbits_hcr(ld, 1, &res);
+    *result = (int8_t)(res & 1);
+    return ret;
+}
+
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/cfft.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,811 @@
+/*
+** 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.19 2003/11/12 20:47:57 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>
+
+#include "cfft.h"
+#include "cfft_tab.h"
+
+
+/*----------------------------------------------------------------------
+   passf2, passf3, passf4, passf5. Complex FFT passes fwd and bwd.
+  ----------------------------------------------------------------------*/
+
+static void passf2(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+                   complex_t *ch, const complex_t *wa, const 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]);
+            RE(ch[ah+l1]) = RE(cc[ac]) - RE(cc[ac+1]);
+            IM(ch[ah])    = IM(cc[ac]) + IM(cc[ac+1]);
+            IM(ch[ah+l1]) = IM(cc[ac]) - IM(cc[ac+1]);
+        }
+    } else {
+        if (isign == 1)
+        {
+            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+i]) = RE(cc[ac+i]) + RE(cc[ac+i+ido]);
+                    RE(t2)       = RE(cc[ac+i]) - RE(cc[ac+i+ido]);
+
+                    IM(ch[ah+i]) = IM(cc[ac+i]) + IM(cc[ac+i+ido]);
+                    IM(t2)       = IM(cc[ac+i]) - IM(cc[ac+i+ido]);
+
+                    ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]),
+                        IM(t2), RE(t2), RE(wa[i]), IM(wa[i]));
+                }
+            }
+        } 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+i]) = RE(cc[ac+i]) + RE(cc[ac+i+ido]);
+                    RE(t2)       = RE(cc[ac+i]) - RE(cc[ac+i+ido]);
+
+                    IM(ch[ah+i]) = IM(cc[ac+i]) + IM(cc[ac+i+ido]);
+                    IM(t2)       = IM(cc[ac+i]) - IM(cc[ac+i+ido]);
+
+                    ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]),
+                        RE(t2), IM(t2), RE(wa[i]), IM(wa[i]));
+                }
+            }
+        }
+    }
+}
+
+
+static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+                   complex_t *ch, const complex_t *wa1, const complex_t *wa2,
+                   const int8_t isign)
+{
+    static real_t taur = FRAC_CONST(-0.5);
+    static real_t taui = FRAC_CONST(0.866025403784439);
+    uint16_t i, k, ac, ah;
+    complex_t c2, c3, d2, d3, t2;
+
+    if (ido == 1)
+    {
+        if (isign == 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_F(RE(t2),taur);
+                IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),taur);
+
+                RE(ch[ah]) = RE(cc[ac-1]) + RE(t2);
+                IM(ch[ah]) = IM(cc[ac-1]) + IM(t2);
+
+                RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+1])), taui);
+                IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+1])), taui);
+
+                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++)
+            {
+                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_F(RE(t2),taur);
+                IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),taur);
+
+                RE(ch[ah]) = RE(cc[ac-1]) + RE(t2);
+                IM(ch[ah]) = IM(cc[ac-1]) + IM(t2);
+
+                RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+1])), taui);
+                IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+1])), taui);
+
+                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 {
+        if (isign == 1)
+        {
+            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_F(RE(t2),taur);
+                    IM(t2) = IM(cc[ac]) + IM(cc[ac+ido]);
+                    IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),taur);
+
+                    RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2);
+                    IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2);
+
+                    RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+ido])), taui);
+                    IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+ido])), taui);
+
+                    RE(d2) = RE(c2) - IM(c3);
+                    IM(d3) = IM(c2) - RE(c3);
+                    RE(d3) = RE(c2) + IM(c3);
+                    IM(d2) = IM(c2) + RE(c3);
+
+                    ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]),
+                        IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
+                    ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]),
+                        IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
+                }
+            }
+        } else {
+            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_F(RE(t2),taur);
+                    IM(t2) = IM(cc[ac]) + IM(cc[ac+ido]);
+                    IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),taur);
+
+                    RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2);
+                    IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2);
+
+                    RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+ido])), taui);
+                    IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+ido])), taui);
+
+                    RE(d2) = RE(c2) + IM(c3);
+                    IM(d3) = IM(c2) + RE(c3);
+                    RE(d3) = RE(c2) - IM(c3);
+                    IM(d2) = IM(c2) - RE(c3);
+
+                    ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]),
+                        RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
+                    ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]),
+                        RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
+                }
+            }
+        }
+    }
+}
+
+static void passf4(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+                   complex_t *ch, const complex_t *wa1, const complex_t *wa2,
+                   const complex_t *wa3, const int8_t isign)
+{
+    uint16_t i, k, ac, ah;
+
+    if (ido == 1)
+    {
+        if (isign == 1)
+        {
+            for (k = 0; k < l1; k++)
+            {
+                complex_t t1, t2, t3, t4;
+
+                ac = 4*k;
+                ah = k;
+
+                RE(t2) = RE(cc[ac])   + RE(cc[ac+2]);
+                RE(t1) = RE(cc[ac])   - RE(cc[ac+2]);
+                IM(t2) = IM(cc[ac])   + IM(cc[ac+2]);
+                IM(t1) = IM(cc[ac])   - IM(cc[ac+2]);
+                RE(t3) = RE(cc[ac+1]) + RE(cc[ac+3]);
+                IM(t4) = RE(cc[ac+1]) - RE(cc[ac+3]);
+                IM(t3) = IM(cc[ac+3]) + IM(cc[ac+1]);
+                RE(t4) = IM(cc[ac+3]) - IM(cc[ac+1]);
+
+                RE(ch[ah])      = RE(t2) + RE(t3);
+                RE(ch[ah+2*l1]) = RE(t2) - RE(t3);
+
+                IM(ch[ah])      = IM(t2) + IM(t3);
+                IM(ch[ah+2*l1]) = IM(t2) - IM(t3);
+
+                RE(ch[ah+l1])   = RE(t1) + RE(t4);
+                RE(ch[ah+3*l1]) = RE(t1) - RE(t4);
+
+                IM(ch[ah+l1])   = IM(t1) + IM(t4);
+                IM(ch[ah+3*l1]) = IM(t1) - IM(t4);
+            }
+        } else {
+            for (k = 0; k < l1; k++)
+            {
+                complex_t t1, t2, t3, t4;
+
+                ac = 4*k;
+                ah = k;
+
+                RE(t2) = RE(cc[ac])   + RE(cc[ac+2]);
+                RE(t1) = RE(cc[ac])   - RE(cc[ac+2]);
+                IM(t2) = IM(cc[ac])   + IM(cc[ac+2]);
+                IM(t1) = IM(cc[ac])   - IM(cc[ac+2]);
+                RE(t3) = RE(cc[ac+1]) + RE(cc[ac+3]);
+                IM(t4) = RE(cc[ac+1]) - RE(cc[ac+3]);
+                IM(t3) = IM(cc[ac+3]) + IM(cc[ac+1]);
+                RE(t4) = IM(cc[ac+3]) - IM(cc[ac+1]);
+
+                RE(ch[ah])      = RE(t2) + RE(t3);
+                RE(ch[ah+2*l1]) = RE(t2) - RE(t3);
+
+                IM(ch[ah])      = IM(t2) + IM(t3);
+                IM(ch[ah+2*l1]) = IM(t2) - IM(t3);
+
+                RE(ch[ah+l1])   = RE(t1) - RE(t4);
+                RE(ch[ah+3*l1]) = RE(t1) + RE(t4);
+
+                IM(ch[ah+l1])   = IM(t1) - IM(t4);
+                IM(ch[ah+3*l1]) = IM(t1) + IM(t4);
+            }
+        }
+    } else {
+        if (isign == 1)
+        {
+            for (k = 0; k < l1; k++)
+            {
+                ac = 4*k*ido;
+                ah = k*ido;
+
+                for (i = 0; i < ido; i++)
+                {
+                    complex_t c2, c3, c4, t1, t2, t3, t4;
+
+                    RE(t2) = RE(cc[ac+i]) + RE(cc[ac+i+2*ido]);
+                    RE(t1) = RE(cc[ac+i]) - RE(cc[ac+i+2*ido]);
+                    IM(t2) = IM(cc[ac+i]) + IM(cc[ac+i+2*ido]);
+                    IM(t1) = IM(cc[ac+i]) - IM(cc[ac+i+2*ido]);
+                    RE(t3) = RE(cc[ac+i+ido]) + RE(cc[ac+i+3*ido]);
+                    IM(t4) = RE(cc[ac+i+ido]) - RE(cc[ac+i+3*ido]);
+                    IM(t3) = IM(cc[ac+i+3*ido]) + IM(cc[ac+i+ido]);
+                    RE(t4) = IM(cc[ac+i+3*ido]) - IM(cc[ac+i+ido]);
+
+                    RE(c2) = RE(t1) + RE(t4);
+                    RE(c4) = RE(t1) - RE(t4);
+
+                    IM(c2) = IM(t1) + IM(t4);
+                    IM(c4) = IM(t1) - IM(t4);
+
+                    RE(ch[ah+i]) = RE(t2) + RE(t3);
+                    RE(c3)       = RE(t2) - RE(t3);
+
+                    IM(ch[ah+i]) = IM(t2) + IM(t3);
+                    IM(c3)       = IM(t2) - IM(t3);
+
+                    ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]),
+                        IM(c2), RE(c2), RE(wa1[i]), IM(wa1[i]));
+                    ComplexMult(&IM(ch[ah+i+2*l1*ido]), &RE(ch[ah+i+2*l1*ido]),
+                        IM(c3), RE(c3), RE(wa2[i]), IM(wa2[i]));
+                    ComplexMult(&IM(ch[ah+i+3*l1*ido]), &RE(ch[ah+i+3*l1*ido]),
+                        IM(c4), RE(c4), RE(wa3[i]), IM(wa3[i]));
+                }
+            }
+        } else {
+            for (k = 0; k < l1; k++)
+            {
+                ac = 4*k*ido;
+                ah = k*ido;
+
+                for (i = 0; i < ido; i++)
+                {
+                    complex_t c2, c3, c4, t1, t2, t3, t4;
+
+                    RE(t2) = RE(cc[ac+i]) + RE(cc[ac+i+2*ido]);
+                    RE(t1) = RE(cc[ac+i]) - RE(cc[ac+i+2*ido]);
+                    IM(t2) = IM(cc[ac+i]) + IM(cc[ac+i+2*ido]);
+                    IM(t1) = IM(cc[ac+i]) - IM(cc[ac+i+2*ido]);
+                    RE(t3) = RE(cc[ac+i+ido]) + RE(cc[ac+i+3*ido]);
+                    IM(t4) = RE(cc[ac+i+ido]) - RE(cc[ac+i+3*ido]);
+                    IM(t3) = IM(cc[ac+i+3*ido]) + IM(cc[ac+i+ido]);
+                    RE(t4) = IM(cc[ac+i+3*ido]) - IM(cc[ac+i+ido]);
+
+                    RE(c2) = RE(t1) - RE(t4);
+                    RE(c4) = RE(t1) + RE(t4);
+
+                    IM(c2) = IM(t1) - IM(t4);
+                    IM(c4) = IM(t1) + IM(t4);
+
+                    RE(ch[ah+i]) = RE(t2) + RE(t3);
+                    RE(c3)       = RE(t2) - RE(t3);
+
+                    IM(ch[ah+i]) = IM(t2) + IM(t3);
+                    IM(c3)       = IM(t2) - IM(t3);
+
+                    ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]),
+                        RE(c2), IM(c2), RE(wa1[i]), IM(wa1[i]));
+                    ComplexMult(&RE(ch[ah+i+2*l1*ido]), &IM(ch[ah+i+2*l1*ido]),
+                        RE(c3), IM(c3), RE(wa2[i]), IM(wa2[i]));
+                    ComplexMult(&RE(ch[ah+i+3*l1*ido]), &IM(ch[ah+i+3*l1*ido]),
+                        RE(c4), IM(c4), RE(wa3[i]), IM(wa3[i]));
+                }
+            }
+        }
+    }
+}
+
+static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+                   complex_t *ch, const complex_t *wa1, const complex_t *wa2, const complex_t *wa3,
+                   const complex_t *wa4, const int8_t isign)
+{
+    static real_t tr11 = FRAC_CONST(0.309016994374947);
+    static real_t ti11 = FRAC_CONST(0.951056516295154);
+    static real_t tr12 = FRAC_CONST(-0.809016994374947);
+    static real_t ti12 = FRAC_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)
+    {
+        if (isign == 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_F(RE(t2),tr11) + MUL_F(RE(t3),tr12);
+                IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12);
+                RE(c3) = RE(cc[ac-1]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11);
+                IM(c3) = IM(cc[ac-1]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11);
+
+                ComplexMult(&RE(c5), &RE(c4),
+                    ti11, ti12, RE(t5), RE(t4));
+                ComplexMult(&IM(c5), &IM(c4),
+                    ti11, ti12, IM(t5), IM(t4));
+
+                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++)
+            {
+                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_F(RE(t2),tr11) + MUL_F(RE(t3),tr12);
+                IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12);
+                RE(c3) = RE(cc[ac-1]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11);
+                IM(c3) = IM(cc[ac-1]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11);
+
+                ComplexMult(&RE(c4), &RE(c5),
+                    ti12, ti11, RE(t5), RE(t4));
+                ComplexMult(&IM(c4), &IM(c5),
+                    ti12, ti12, IM(t5), IM(t4));
+
+                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 {
+        if (isign == 1)
+        {
+            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_F(RE(t2),tr11) + MUL_F(RE(t3),tr12);
+                    IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12);
+                    RE(c3) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11);
+                    IM(c3) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11);
+
+                    ComplexMult(&RE(c5), &RE(c4),
+                        ti11, ti12, RE(t5), RE(t4));
+                    ComplexMult(&IM(c5), &IM(c4),
+                        ti11, ti12, IM(t5), IM(t4));
+
+                    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);
+
+                    ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]),
+                        IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
+                    ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]),
+                        IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
+                    ComplexMult(&IM(ch[ah+3*l1*ido]), &RE(ch[ah+3*l1*ido]),
+                        IM(d4), RE(d4), RE(wa3[i]), IM(wa3[i]));
+                    ComplexMult(&IM(ch[ah+4*l1*ido]), &RE(ch[ah+4*l1*ido]),
+                        IM(d5), RE(d5), RE(wa4[i]), IM(wa4[i]));
+                }
+            }
+        } 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_F(RE(t2),tr11) + MUL_F(RE(t3),tr12);
+                    IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12);
+                    RE(c3) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11);
+                    IM(c3) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11);
+
+                    ComplexMult(&RE(c4), &RE(c5),
+                        ti12, ti11, RE(t5), RE(t4));
+                    ComplexMult(&IM(c4), &IM(c5),
+                        ti12, ti12, IM(t5), IM(t4));
+
+                    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);
+
+                    ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]),
+                        RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
+                    ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]),
+                        RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
+                    ComplexMult(&RE(ch[ah+3*l1*ido]), &IM(ch[ah+3*l1*ido]),
+                        RE(d4), IM(d4), RE(wa3[i]), IM(wa3[i]));
+                    ComplexMult(&RE(ch[ah+4*l1*ido]), &IM(ch[ah+4*l1*ido]),
+                        RE(d5), IM(d5), RE(wa4[i]), IM(wa4[i]));
+                }
+            }
+        }
+    }
+}
+
+
+/*----------------------------------------------------------------------
+   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 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 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 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 = (real_t)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]) = (real_t)cos(arg);
+                IM(wa[i]) = (real_t)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 64: cfft->tab = cfft_tab_64; break;
+    case 512: cfft->tab = cfft_tab_512; break;
+#ifdef LD_DEC
+    case 256: cfft->tab = cfft_tab_256; break;
+#endif
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+    case 60: cfft->tab = cfft_tab_60; break;
+    case 480: cfft->tab = cfft_tab_480; break;
+#ifdef LD_DEC
+    case 240: cfft->tab = cfft_tab_240; break;
+#endif
+#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/Input/aac/libfaad2/cfft.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,68 @@
+/*
+** 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.12 2003/11/12 20:47:57 menno Exp $
+**/
+
+#ifndef __CFFT_H__
+#define __CFFT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct
+{
+    uint16_t n;
+    uint16_t ifac[15];
+    complex_t *work;
+    complex_t *tab;
+} cfft_info;
+
+
+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(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+                   complex_t *ch, const complex_t *wa, const int8_t isign);
+static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+                   complex_t *ch, const complex_t *wa1, const complex_t *wa2, const int8_t isign);
+static void passf4(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch,
+                   const complex_t *wa1, const complex_t *wa2, const complex_t *wa3,
+                   const int8_t isign);
+static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch,
+                   const complex_t *wa1, const complex_t *wa2, const complex_t *wa3,
+                   const complex_t *wa4, const int8_t isign);
+INLINE void cfftf1(uint16_t n, complex_t *c, complex_t *ch,
+                   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/Input/aac/libfaad2/cfft_tab.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,1688 @@
+/*
+** 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.10 2003/11/12 20:47:57 menno Exp $
+**/
+
+#ifndef __CFFT_TAB_H__
+#define __CFFT_TAB_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef FIXED_POINT
+
+complex_t cfft_tab_512[] =
+{
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.999924719333649), FRAC_CONST(0.012271538376808) },
+    { FRAC_CONST(0.999698817729950), FRAC_CONST(0.024541229009628) },
+    { FRAC_CONST(0.999322354793549), FRAC_CONST(0.036807224154472) },
+    { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
+    { FRAC_CONST(0.998118102550507), FRAC_CONST(0.061320740729570) },
+    { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) },
+    { FRAC_CONST(0.996312618255615), FRAC_CONST(0.085797317326069) },
+    { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+    { FRAC_CONST(0.993906974792480), FRAC_CONST(0.110222205519676) },
+    { FRAC_CONST(0.992479562759399), FRAC_CONST(0.122410677373409) },
+    { FRAC_CONST(0.990902662277222), FRAC_CONST(0.134580716490746) },
+    { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+    { FRAC_CONST(0.987301409244537), FRAC_CONST(0.158858150243759) },
+    { FRAC_CONST(0.985277652740479), FRAC_CONST(0.170961901545525) },
+    { FRAC_CONST(0.983105480670929), FRAC_CONST(0.183039888739586) },
+    { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+    { FRAC_CONST(0.978317379951477), FRAC_CONST(0.207111388444901) },
+    { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) },
+    { FRAC_CONST(0.972939968109131), FRAC_CONST(0.231058120727539) },
+    { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
+    { FRAC_CONST(0.966976463794708), FRAC_CONST(0.254865676164627) },
+    { FRAC_CONST(0.963776051998138), FRAC_CONST(0.266712784767151) },
+    { FRAC_CONST(0.960430502891541), FRAC_CONST(0.278519690036774) },
+    { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+    { FRAC_CONST(0.953306019306183), FRAC_CONST(0.302005946636200) },
+    { FRAC_CONST(0.949528157711029), FRAC_CONST(0.313681751489639) },
+    { FRAC_CONST(0.945607304573059), FRAC_CONST(0.325310319662094) },
+    { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
+    { FRAC_CONST(0.937339007854462), FRAC_CONST(0.348418682813644) },
+    { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) },
+    { FRAC_CONST(0.928506076335907), FRAC_CONST(0.371317207813263) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.919113874435425), FRAC_CONST(0.393992066383362) },
+    { FRAC_CONST(0.914209723472595), FRAC_CONST(0.405241340398788) },
+    { FRAC_CONST(0.909167945384979), FRAC_CONST(0.416429579257965) },
+    { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+    { FRAC_CONST(0.898674488067627), FRAC_CONST(0.438616245985031) },
+    { FRAC_CONST(0.893224298954010), FRAC_CONST(0.449611335992813) },
+    { FRAC_CONST(0.887639641761780), FRAC_CONST(0.460538715124130) },
+    { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+    { FRAC_CONST(0.876070082187653), FRAC_CONST(0.482183754444122) },
+    { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) },
+    { FRAC_CONST(0.863972842693329), FRAC_CONST(0.503538370132446) },
+    { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
+    { FRAC_CONST(0.851355195045471), FRAC_CONST(0.524589717388153) },
+    { FRAC_CONST(0.844853579998016), FRAC_CONST(0.534997642040253) },
+    { FRAC_CONST(0.838224709033966), FRAC_CONST(0.545324981212616) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.824589252471924), FRAC_CONST(0.565731823444366) },
+    { FRAC_CONST(0.817584812641144), FRAC_CONST(0.575808227062225) },
+    { FRAC_CONST(0.810457170009613), FRAC_CONST(0.585797905921936) },
+    { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
+    { FRAC_CONST(0.795836925506592), FRAC_CONST(0.605511009693146) },
+    { FRAC_CONST(0.788346409797668), FRAC_CONST(0.615231633186340) },
+    { FRAC_CONST(0.780737221240997), FRAC_CONST(0.624859511852264) },
+    { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+    { FRAC_CONST(0.765167236328125), FRAC_CONST(0.643831551074982) },
+    { FRAC_CONST(0.757208824157715), FRAC_CONST(0.653172850608826) },
+    { FRAC_CONST(0.749136388301849), FRAC_CONST(0.662415802478790) },
+    { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+    { FRAC_CONST(0.732654273509979), FRAC_CONST(0.680601000785828) },
+    { FRAC_CONST(0.724247097969055), FRAC_CONST(0.689540565013886) },
+    { FRAC_CONST(0.715730786323547), FRAC_CONST(0.698376297950745) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.698376238346100), FRAC_CONST(0.715730845928192) },
+    { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) },
+    { FRAC_CONST(0.680601000785828), FRAC_CONST(0.732654273509979) },
+    { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
+    { FRAC_CONST(0.662415742874146), FRAC_CONST(0.749136388301849) },
+    { FRAC_CONST(0.653172791004181), FRAC_CONST(0.757208883762360) },
+    { FRAC_CONST(0.643831551074982), FRAC_CONST(0.765167295932770) },
+    { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+    { FRAC_CONST(0.624859452247620), FRAC_CONST(0.780737280845642) },
+    { FRAC_CONST(0.615231573581696), FRAC_CONST(0.788346409797668) },
+    { FRAC_CONST(0.605511009693146), FRAC_CONST(0.795836925506592) },
+    { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
+    { FRAC_CONST(0.585797846317291), FRAC_CONST(0.810457170009613) },
+    { FRAC_CONST(0.575808167457581), FRAC_CONST(0.817584812641144) },
+    { FRAC_CONST(0.565731823444366), FRAC_CONST(0.824589312076569) },
+    { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+    { FRAC_CONST(0.545324981212616), FRAC_CONST(0.838224709033966) },
+    { FRAC_CONST(0.534997642040253), FRAC_CONST(0.844853579998016) },
+    { FRAC_CONST(0.524589657783508), FRAC_CONST(0.851355195045471) },
+    { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+    { FRAC_CONST(0.503538429737091), FRAC_CONST(0.863972842693329) },
+    { FRAC_CONST(0.492898195981979), FRAC_CONST(0.870086967945099) },
+    { FRAC_CONST(0.482183724641800), FRAC_CONST(0.876070141792297) },
+    { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+    { FRAC_CONST(0.460538715124130), FRAC_CONST(0.887639641761780) },
+    { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) },
+    { FRAC_CONST(0.438616186380386), FRAC_CONST(0.898674488067627) },
+    { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
+    { FRAC_CONST(0.416429549455643), FRAC_CONST(0.909168004989624) },
+    { FRAC_CONST(0.405241280794144), FRAC_CONST(0.914209783077240) },
+    { FRAC_CONST(0.393991947174072), FRAC_CONST(0.919113874435425) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.371317148208618), FRAC_CONST(0.928506076335907) },
+    { FRAC_CONST(0.359894961118698), FRAC_CONST(0.932992815971375) },
+    { FRAC_CONST(0.348418682813644), FRAC_CONST(0.937339007854462) },
+    { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
+    { FRAC_CONST(0.325310230255127), FRAC_CONST(0.945607364177704) },
+    { FRAC_CONST(0.313681662082672), FRAC_CONST(0.949528217315674) },
+    { FRAC_CONST(0.302005946636200), FRAC_CONST(0.953306019306183) },
+    { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+    { FRAC_CONST(0.278519600629807), FRAC_CONST(0.960430562496185) },
+    { FRAC_CONST(0.266712754964828), FRAC_CONST(0.963776051998138) },
+    { FRAC_CONST(0.254865646362305), FRAC_CONST(0.966976463794708) },
+    { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
+    { FRAC_CONST(0.231058135628700), FRAC_CONST(0.972939968109131) },
+    { FRAC_CONST(0.219101220369339), FRAC_CONST(0.975702106952667) },
+    { FRAC_CONST(0.207111328840256), FRAC_CONST(0.978317379951477) },
+    { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+    { FRAC_CONST(0.183039888739586), FRAC_CONST(0.983105480670929) },
+    { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) },
+    { FRAC_CONST(0.158858075737953), FRAC_CONST(0.987301409244537) },
+    { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
+    { FRAC_CONST(0.134580686688423), FRAC_CONST(0.990902662277222) },
+    { FRAC_CONST(0.122410625219345), FRAC_CONST(0.992479562759399) },
+    { FRAC_CONST(0.110222116112709), FRAC_CONST(0.993906974792480) },
+    { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(0.085797272622585), FRAC_CONST(0.996312618255615) },
+    { FRAC_CONST(0.073564492166042), FRAC_CONST(0.997290432453156) },
+    { FRAC_CONST(0.061320748180151), FRAC_CONST(0.998118102550507) },
+    { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
+    { FRAC_CONST(0.036807164549828), FRAC_CONST(0.999322414398193) },
+    { FRAC_CONST(0.024541135877371), FRAC_CONST(0.999698817729950) },
+    { FRAC_CONST(0.012271529063582), FRAC_CONST(0.999924719333649) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.012271616607904), FRAC_CONST(0.999924719333649) },
+    { FRAC_CONST(-0.024541223421693), FRAC_CONST(0.999698817729950) },
+    { FRAC_CONST(-0.036807250231504), FRAC_CONST(0.999322354793549) },
+    { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
+    { FRAC_CONST(-0.061320833861828), FRAC_CONST(0.998118102550507) },
+    { FRAC_CONST(-0.073564574122429), FRAC_CONST(0.997290432453156) },
+    { FRAC_CONST(-0.085797362029552), FRAC_CONST(0.996312618255615) },
+    { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(-0.110222205519676), FRAC_CONST(0.993906974792480) },
+    { FRAC_CONST(-0.122410707175732), FRAC_CONST(0.992479503154755) },
+    { FRAC_CONST(-0.134580776095390), FRAC_CONST(0.990902602672577) },
+    { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) },
+    { FRAC_CONST(-0.158858165144920), FRAC_CONST(0.987301409244537) },
+    { FRAC_CONST(-0.170961946249008), FRAC_CONST(0.985277652740479) },
+    { FRAC_CONST(-0.183039978146553), FRAC_CONST(0.983105480670929) },
+    { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+    { FRAC_CONST(-0.207111418247223), FRAC_CONST(0.978317379951477) },
+    { FRAC_CONST(-0.219101309776306), FRAC_CONST(0.975702106952667) },
+    { FRAC_CONST(-0.231058210134506), FRAC_CONST(0.972939908504486) },
+    { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) },
+    { FRAC_CONST(-0.254865705966949), FRAC_CONST(0.966976463794708) },
+    { FRAC_CONST(-0.266712844371796), FRAC_CONST(0.963776051998138) },
+    { FRAC_CONST(-0.278519690036774), FRAC_CONST(0.960430502891541) },
+    { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) },
+    { FRAC_CONST(-0.302006036043167), FRAC_CONST(0.953306019306183) },
+    { FRAC_CONST(-0.313681721687317), FRAC_CONST(0.949528157711029) },
+    { FRAC_CONST(-0.325310319662094), FRAC_CONST(0.945607304573059) },
+    { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) },
+    { FRAC_CONST(-0.348418772220612), FRAC_CONST(0.937338948249817) },
+    { FRAC_CONST(-0.359895050525665), FRAC_CONST(0.932992815971375) },
+    { FRAC_CONST(-0.371317237615585), FRAC_CONST(0.928506076335907) },
+    { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(-0.393992036581039), FRAC_CONST(0.919113874435425) },
+    { FRAC_CONST(-0.405241340398788), FRAC_CONST(0.914209723472595) },
+    { FRAC_CONST(-0.416429519653320), FRAC_CONST(0.909168004989624) },
+    { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) },
+    { FRAC_CONST(-0.438616245985031), FRAC_CONST(0.898674428462982) },
+    { FRAC_CONST(-0.449611365795136), FRAC_CONST(0.893224298954010) },
+    { FRAC_CONST(-0.460538804531097), FRAC_CONST(0.887639582157135) },
+    { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+    { FRAC_CONST(-0.482183903455734), FRAC_CONST(0.876070022583008) },
+    { FRAC_CONST(-0.492898166179657), FRAC_CONST(0.870087027549744) },
+    { FRAC_CONST(-0.503538370132446), FRAC_CONST(0.863972842693329) },
+    { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) },
+    { FRAC_CONST(-0.524589717388153), FRAC_CONST(0.851355135440826) },
+    { FRAC_CONST(-0.534997701644897), FRAC_CONST(0.844853520393372) },
+    { FRAC_CONST(-0.545325100421906), FRAC_CONST(0.838224649429321) },
+    { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+    { FRAC_CONST(-0.565731763839722), FRAC_CONST(0.824589312076569) },
+    { FRAC_CONST(-0.575808167457581), FRAC_CONST(0.817584812641144) },
+    { FRAC_CONST(-0.585797905921936), FRAC_CONST(0.810457170009613) },
+    { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
+    { FRAC_CONST(-0.605511128902435), FRAC_CONST(0.795836865901947) },
+    { FRAC_CONST(-0.615231692790985), FRAC_CONST(0.788346350193024) },
+    { FRAC_CONST(-0.624859631061554), FRAC_CONST(0.780737102031708) },
+    { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) },
+    { FRAC_CONST(-0.643831551074982), FRAC_CONST(0.765167236328125) },
+    { FRAC_CONST(-0.653172850608826), FRAC_CONST(0.757208824157715) },
+    { FRAC_CONST(-0.662415802478790), FRAC_CONST(0.749136328697205) },
+    { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) },
+    { FRAC_CONST(-0.680601119995117), FRAC_CONST(0.732654154300690) },
+    { FRAC_CONST(-0.689540684223175), FRAC_CONST(0.724246978759766) },
+    { FRAC_CONST(-0.698376238346100), FRAC_CONST(0.715730845928192) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.715730845928192), FRAC_CONST(0.698376238346100) },
+    { FRAC_CONST(-0.724247157573700), FRAC_CONST(0.689540505409241) },
+    { FRAC_CONST(-0.732654333114624), FRAC_CONST(0.680600941181183) },
+    { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) },
+    { FRAC_CONST(-0.749136507511139), FRAC_CONST(0.662415623664856) },
+    { FRAC_CONST(-0.757208824157715), FRAC_CONST(0.653172850608826) },
+    { FRAC_CONST(-0.765167295932770), FRAC_CONST(0.643831551074982) },
+    { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) },
+    { FRAC_CONST(-0.780737280845642), FRAC_CONST(0.624859452247620) },
+    { FRAC_CONST(-0.788346469402313), FRAC_CONST(0.615231513977051) },
+    { FRAC_CONST(-0.795836985111237), FRAC_CONST(0.605510950088501) },
+    { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) },
+    { FRAC_CONST(-0.810457170009613), FRAC_CONST(0.585797846317291) },
+    { FRAC_CONST(-0.817584812641144), FRAC_CONST(0.575808167457581) },
+    { FRAC_CONST(-0.824589312076569), FRAC_CONST(0.565731763839722) },
+    { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+    { FRAC_CONST(-0.838224768638611), FRAC_CONST(0.545324862003326) },
+    { FRAC_CONST(-0.844853639602661), FRAC_CONST(0.534997463226318) },
+    { FRAC_CONST(-0.851355314254761), FRAC_CONST(0.524589538574219) },
+    { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) },
+    { FRAC_CONST(-0.863972842693329), FRAC_CONST(0.503538370132446) },
+    { FRAC_CONST(-0.870087027549744), FRAC_CONST(0.492898136377335) },
+    { FRAC_CONST(-0.876070141792297), FRAC_CONST(0.482183694839478) },
+    { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) },
+    { FRAC_CONST(-0.887639701366425), FRAC_CONST(0.460538566112518) },
+    { FRAC_CONST(-0.893224298954010), FRAC_CONST(0.449611365795136) },
+    { FRAC_CONST(-0.898674488067627), FRAC_CONST(0.438616245985031) },
+    { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) },
+    { FRAC_CONST(-0.909168004989624), FRAC_CONST(0.416429489850998) },
+    { FRAC_CONST(-0.914209783077240), FRAC_CONST(0.405241221189499) },
+    { FRAC_CONST(-0.919113874435425), FRAC_CONST(0.393991917371750) },
+    { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+    { FRAC_CONST(-0.928506076335907), FRAC_CONST(0.371317237615585) },
+    { FRAC_CONST(-0.932992815971375), FRAC_CONST(0.359895050525665) },
+    { FRAC_CONST(-0.937339007854462), FRAC_CONST(0.348418653011322) },
+    { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
+    { FRAC_CONST(-0.945607364177704), FRAC_CONST(0.325310200452805) },
+    { FRAC_CONST(-0.949528217315674), FRAC_CONST(0.313681602478027) },
+    { FRAC_CONST(-0.953306078910828), FRAC_CONST(0.302005797624588) },
+    { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) },
+    { FRAC_CONST(-0.960430502891541), FRAC_CONST(0.278519690036774) },
+    { FRAC_CONST(-0.963776051998138), FRAC_CONST(0.266712725162506) },
+    { FRAC_CONST(-0.966976463794708), FRAC_CONST(0.254865586757660) },
+    { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) },
+    { FRAC_CONST(-0.972939968109131), FRAC_CONST(0.231057971715927) },
+    { FRAC_CONST(-0.975702166557312), FRAC_CONST(0.219101071357727) },
+    { FRAC_CONST(-0.978317379951477), FRAC_CONST(0.207111403346062) },
+    { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+    { FRAC_CONST(-0.983105480670929), FRAC_CONST(0.183039844036102) },
+    { FRAC_CONST(-0.985277652740479), FRAC_CONST(0.170961812138557) },
+    { FRAC_CONST(-0.987301409244537), FRAC_CONST(0.158858031034470) },
+    { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) },
+    { FRAC_CONST(-0.990902662277222), FRAC_CONST(0.134580522775650) },
+    { FRAC_CONST(-0.992479503154755), FRAC_CONST(0.122410699725151) },
+    { FRAC_CONST(-0.993906974792480), FRAC_CONST(0.110222198069096) },
+    { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) },
+    { FRAC_CONST(-0.996312618255615), FRAC_CONST(0.085797227919102) },
+    { FRAC_CONST(-0.997290492057800), FRAC_CONST(0.073564447462559) },
+    { FRAC_CONST(-0.998118102550507), FRAC_CONST(0.061320584267378) },
+    { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) },
+    { FRAC_CONST(-0.999322354793549), FRAC_CONST(0.036807239055634) },
+    { FRAC_CONST(-0.999698817729950), FRAC_CONST(0.024541210383177) },
+    { FRAC_CONST(-0.999924719333649), FRAC_CONST(0.012271485291421) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.999698817729950), FRAC_CONST(0.024541229009628) },
+    { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
+    { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) },
+    { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+    { FRAC_CONST(0.992479562759399), FRAC_CONST(0.122410677373409) },
+    { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+    { FRAC_CONST(0.985277652740479), FRAC_CONST(0.170961901545525) },
+    { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+    { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) },
+    { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
+    { FRAC_CONST(0.963776051998138), FRAC_CONST(0.266712784767151) },
+    { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+    { FRAC_CONST(0.949528157711029), FRAC_CONST(0.313681751489639) },
+    { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
+    { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.914209723472595), FRAC_CONST(0.405241340398788) },
+    { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+    { FRAC_CONST(0.893224298954010), FRAC_CONST(0.449611335992813) },
+    { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+    { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) },
+    { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
+    { FRAC_CONST(0.844853579998016), FRAC_CONST(0.534997642040253) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.817584812641144), FRAC_CONST(0.575808227062225) },
+    { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
+    { FRAC_CONST(0.788346409797668), FRAC_CONST(0.615231633186340) },
+    { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+    { FRAC_CONST(0.757208824157715), FRAC_CONST(0.653172850608826) },
+    { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+    { FRAC_CONST(0.724247097969055), FRAC_CONST(0.689540565013886) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) },
+    { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
+    { FRAC_CONST(0.653172791004181), FRAC_CONST(0.757208883762360) },
+    { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+    { FRAC_CONST(0.615231573581696), FRAC_CONST(0.788346409797668) },
+    { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
+    { FRAC_CONST(0.575808167457581), FRAC_CONST(0.817584812641144) },
+    { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+    { FRAC_CONST(0.534997642040253), FRAC_CONST(0.844853579998016) },
+    { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+    { FRAC_CONST(0.492898195981979), FRAC_CONST(0.870086967945099) },
+    { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+    { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) },
+    { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
+    { FRAC_CONST(0.405241280794144), FRAC_CONST(0.914209783077240) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.359894961118698), FRAC_CONST(0.932992815971375) },
+    { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
+    { FRAC_CONST(0.313681662082672), FRAC_CONST(0.949528217315674) },
+    { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+    { FRAC_CONST(0.266712754964828), FRAC_CONST(0.963776051998138) },
+    { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
+    { FRAC_CONST(0.219101220369339), FRAC_CONST(0.975702106952667) },
+    { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+    { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) },
+    { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
+    { FRAC_CONST(0.122410625219345), FRAC_CONST(0.992479562759399) },
+    { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(0.073564492166042), FRAC_CONST(0.997290432453156) },
+    { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
+    { FRAC_CONST(0.024541135877371), FRAC_CONST(0.999698817729950) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
+    { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+    { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+    { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+    { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
+    { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+    { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+    { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+    { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
+    { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+    { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
+    { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+    { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
+    { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+    { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+    { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+    { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
+    { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+    { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
+    { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+    { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
+    { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
+    { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) },
+    { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+    { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) },
+    { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) },
+    { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) },
+    { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) },
+    { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+    { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) },
+    { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+    { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
+    { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) },
+    { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) },
+    { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) },
+    { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) },
+    { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+    { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) },
+    { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) },
+    { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) },
+    { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+    { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
+    { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) },
+    { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) },
+    { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+    { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) },
+    { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) },
+    { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) },
+    { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+    { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) },
+    { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+    { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) },
+    { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+    { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.788346469402313), FRAC_CONST(0.615231573581696) },
+    { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+    { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) },
+    { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+    { FRAC_CONST(0.575808227062225), FRAC_CONST(0.817584812641144) },
+    { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+    { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.313681751489639), FRAC_CONST(0.949528157711029) },
+    { FRAC_CONST(0.242980241775513), FRAC_CONST(0.970031261444092) },
+    { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) },
+    { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(0.024541255086660), FRAC_CONST(0.999698817729950) },
+    { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
+    { FRAC_CONST(-0.122410707175732), FRAC_CONST(0.992479503154755) },
+    { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+    { FRAC_CONST(-0.266712725162506), FRAC_CONST(0.963776051998138) },
+    { FRAC_CONST(-0.336889803409576), FRAC_CONST(0.941544055938721) },
+    { FRAC_CONST(-0.405241340398788), FRAC_CONST(0.914209723472595) },
+    { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+    { FRAC_CONST(-0.534997701644897), FRAC_CONST(0.844853520393372) },
+    { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
+    { FRAC_CONST(-0.653172850608826), FRAC_CONST(0.757208824157715) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.757208824157715), FRAC_CONST(0.653172850608826) },
+    { FRAC_CONST(-0.803207516670227), FRAC_CONST(0.595699369907379) },
+    { FRAC_CONST(-0.844853520393372), FRAC_CONST(0.534997701644897) },
+    { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
+    { FRAC_CONST(-0.914209783077240), FRAC_CONST(0.405241221189499) },
+    { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
+    { FRAC_CONST(-0.963776051998138), FRAC_CONST(0.266712725162506) },
+    { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+    { FRAC_CONST(-0.992479503154755), FRAC_CONST(0.122410699725151) },
+    { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067724496126) },
+    { FRAC_CONST(-0.999698817729950), FRAC_CONST(-0.024541147053242) },
+    { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
+    { FRAC_CONST(-0.985277652740479), FRAC_CONST(-0.170961990952492) },
+    { FRAC_CONST(-0.970031261444092), FRAC_CONST(-0.242980241775513) },
+    { FRAC_CONST(-0.949528157711029), FRAC_CONST(-0.313681781291962) },
+    { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+    { FRAC_CONST(-0.893224298954010), FRAC_CONST(-0.449611306190491) },
+    { FRAC_CONST(-0.857728660106659), FRAC_CONST(-0.514102697372437) },
+    { FRAC_CONST(-0.817584872245789), FRAC_CONST(-0.575808107852936) },
+    { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
+    { FRAC_CONST(-0.724247038364410), FRAC_CONST(-0.689540624618530) },
+    { FRAC_CONST(-0.671558916568756), FRAC_CONST(-0.740951180458069) },
+    { FRAC_CONST(-0.615231573581696), FRAC_CONST(-0.788346469402313) },
+    { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
+    { FRAC_CONST(-0.492898195981979), FRAC_CONST(-0.870086967945099) },
+    { FRAC_CONST(-0.427554935216904), FRAC_CONST(-0.903989374637604) },
+    { FRAC_CONST(-0.359895110130310), FRAC_CONST(-0.932992756366730) },
+    { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
+    { FRAC_CONST(-0.219101369380951), FRAC_CONST(-0.975702106952667) },
+    { FRAC_CONST(-0.146730408072472), FRAC_CONST(-0.989176511764526) },
+    { FRAC_CONST(-0.073564760386944), FRAC_CONST(-0.997290432453156) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+    { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+    { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+    { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+    { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+    { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+    { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+    { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+    { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+    { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+    { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
+    { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+    { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
+    { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+    { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
+    { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
+    { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) }
+};
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+complex_t cfft_tab_480[] =
+{
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.999914348125458), FRAC_CONST(0.013089596293867) },
+    { FRAC_CONST(0.999657332897186), FRAC_CONST(0.026176949962974) },
+    { FRAC_CONST(0.999229013919830), FRAC_CONST(0.039259817451239) },
+    { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) },
+    { FRAC_CONST(0.997858941555023), FRAC_CONST(0.065403133630753) },
+    { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) },
+    { FRAC_CONST(0.995804905891418), FRAC_CONST(0.091501623392105) },
+    { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
+    { FRAC_CONST(0.993068456649780), FRAC_CONST(0.117537401616573) },
+    { FRAC_CONST(0.991444885730743), FRAC_CONST(0.130526199936867) },
+    { FRAC_CONST(0.989651381969452), FRAC_CONST(0.143492624163628) },
+    { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+    { FRAC_CONST(0.985556066036224), FRAC_CONST(0.169349506497383) },
+    { FRAC_CONST(0.983254909515381), FRAC_CONST(0.182235524058342) },
+    { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+    { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
+    { FRAC_CONST(0.975342333316803), FRAC_CONST(0.220697447657585) },
+    { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
+    { FRAC_CONST(0.969230890274048), FRAC_CONST(0.246153295040131) },
+    { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) },
+    { FRAC_CONST(0.962455213069916), FRAC_CONST(0.271440446376801) },
+    { FRAC_CONST(0.958819746971130), FRAC_CONST(0.284015357494354) },
+    { FRAC_CONST(0.955019950866699), FRAC_CONST(0.296541601419449) },
+    { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+    { FRAC_CONST(0.946930110454559), FRAC_CONST(0.321439445018768) },
+    { FRAC_CONST(0.942641496658325), FRAC_CONST(0.333806872367859) },
+    { FRAC_CONST(0.938191354274750), FRAC_CONST(0.346117079257965) },
+    { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) },
+    { FRAC_CONST(0.928809583187103), FRAC_CONST(0.370557427406311) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.918791174888611), FRAC_CONST(0.394743889570236) },
+    { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
+    { FRAC_CONST(0.908143162727356), FRAC_CONST(0.418659746646881) },
+    { FRAC_CONST(0.902585268020630), FRAC_CONST(0.430511116981506) },
+    { FRAC_CONST(0.896872758865356), FRAC_CONST(0.442288726568222) },
+    { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+    { FRAC_CONST(0.884987652301788), FRAC_CONST(0.465614527463913) },
+    { FRAC_CONST(0.878817081451416), FRAC_CONST(0.477158784866333) },
+    { FRAC_CONST(0.872496008872986), FRAC_CONST(0.488621264696121) },
+    { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
+    { FRAC_CONST(0.859406411647797), FRAC_CONST(0.511293113231659) },
+    { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) },
+    { FRAC_CONST(0.845727801322937), FRAC_CONST(0.533614516258240) },
+    { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.824126183986664), FRAC_CONST(0.566406250000000) },
+    { FRAC_CONST(0.816641509532928), FRAC_CONST(0.577145218849182) },
+    { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+    { FRAC_CONST(0.801253795623779), FRAC_CONST(0.598324596881866) },
+    { FRAC_CONST(0.793353319168091), FRAC_CONST(0.608761429786682) },
+    { FRAC_CONST(0.785316884517670), FRAC_CONST(0.619093954563141) },
+    { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) },
+    { FRAC_CONST(0.768841803073883), FRAC_CONST(0.639438986778259) },
+    { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
+    { FRAC_CONST(0.751839756965637), FRAC_CONST(0.659345865249634) },
+    { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
+    { FRAC_CONST(0.734322488307953), FRAC_CONST(0.678800761699677) },
+    { FRAC_CONST(0.725374400615692), FRAC_CONST(0.688354551792145) },
+    { FRAC_CONST(0.716301918029785), FRAC_CONST(0.697790503501892) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.697790443897247), FRAC_CONST(0.716301977634430) },
+    { FRAC_CONST(0.688354551792145), FRAC_CONST(0.725374400615692) },
+    { FRAC_CONST(0.678800702095032), FRAC_CONST(0.734322547912598) },
+    { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
+    { FRAC_CONST(0.659345805644989), FRAC_CONST(0.751839816570282) },
+    { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) },
+    { FRAC_CONST(0.639438986778259), FRAC_CONST(0.768841862678528) },
+    { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) },
+    { FRAC_CONST(0.619093954563141), FRAC_CONST(0.785316944122314) },
+    { FRAC_CONST(0.608761370182037), FRAC_CONST(0.793353378772736) },
+    { FRAC_CONST(0.598324596881866), FRAC_CONST(0.801253855228424) },
+    { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(0.577145159244537), FRAC_CONST(0.816641569137573) },
+    { FRAC_CONST(0.566406250000000), FRAC_CONST(0.824126183986664) },
+    { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+    { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) },
+    { FRAC_CONST(0.533614516258240), FRAC_CONST(0.845727801322937) },
+    { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) },
+    { FRAC_CONST(0.511293113231659), FRAC_CONST(0.859406411647797) },
+    { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
+    { FRAC_CONST(0.488621175289154), FRAC_CONST(0.872496068477631) },
+    { FRAC_CONST(0.477158755064011), FRAC_CONST(0.878817141056061) },
+    { FRAC_CONST(0.465614467859268), FRAC_CONST(0.884987652301788) },
+    { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+    { FRAC_CONST(0.442288666963577), FRAC_CONST(0.896872758865356) },
+    { FRAC_CONST(0.430511027574539), FRAC_CONST(0.902585327625275) },
+    { FRAC_CONST(0.418659746646881), FRAC_CONST(0.908143162727356) },
+    { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
+    { FRAC_CONST(0.394743800163269), FRAC_CONST(0.918791234493256) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.370557397603989), FRAC_CONST(0.928809583187103) },
+    { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) },
+    { FRAC_CONST(0.346117049455643), FRAC_CONST(0.938191354274750) },
+    { FRAC_CONST(0.333806812763214), FRAC_CONST(0.942641496658325) },
+    { FRAC_CONST(0.321439474821091), FRAC_CONST(0.946930110454559) },
+    { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+    { FRAC_CONST(0.296541512012482), FRAC_CONST(0.955019950866699) },
+    { FRAC_CONST(0.284015327692032), FRAC_CONST(0.958819746971130) },
+    { FRAC_CONST(0.271440386772156), FRAC_CONST(0.962455272674561) },
+    { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) },
+    { FRAC_CONST(0.246153265237808), FRAC_CONST(0.969230890274048) },
+    { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) },
+    { FRAC_CONST(0.220697447657585), FRAC_CONST(0.975342333316803) },
+    { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
+    { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+    { FRAC_CONST(0.182235524058342), FRAC_CONST(0.983254909515381) },
+    { FRAC_CONST(0.169349446892738), FRAC_CONST(0.985556066036224) },
+    { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+    { FRAC_CONST(0.143492594361305), FRAC_CONST(0.989651381969452) },
+    { FRAC_CONST(0.130526125431061), FRAC_CONST(0.991444885730743) },
+    { FRAC_CONST(0.117537401616573), FRAC_CONST(0.993068456649780) },
+    { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
+    { FRAC_CONST(0.091501533985138), FRAC_CONST(0.995804905891418) },
+    { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) },
+    { FRAC_CONST(0.065403074026108), FRAC_CONST(0.997858941555023) },
+    { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) },
+    { FRAC_CONST(0.039259787648916), FRAC_CONST(0.999229013919830) },
+    { FRAC_CONST(0.026176875457168), FRAC_CONST(0.999657332897186) },
+    { FRAC_CONST(0.013089597225189), FRAC_CONST(0.999914348125458) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.013089684769511), FRAC_CONST(0.999914348125458) },
+    { FRAC_CONST(-0.026176963001490), FRAC_CONST(0.999657332897186) },
+    { FRAC_CONST(-0.039259877055883), FRAC_CONST(0.999229013919830) },
+    { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) },
+    { FRAC_CONST(-0.065403163433075), FRAC_CONST(0.997858941555023) },
+    { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) },
+    { FRAC_CONST(-0.091501623392105), FRAC_CONST(0.995804905891418) },
+    { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
+    { FRAC_CONST(-0.117537491023541), FRAC_CONST(0.993068456649780) },
+    { FRAC_CONST(-0.130526214838028), FRAC_CONST(0.991444885730743) },
+    { FRAC_CONST(-0.143492683768272), FRAC_CONST(0.989651381969452) },
+    { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
+    { FRAC_CONST(-0.169349536299706), FRAC_CONST(0.985556066036224) },
+    { FRAC_CONST(-0.182235598564148), FRAC_CONST(0.983254909515381) },
+    { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+    { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
+    { FRAC_CONST(-0.220697522163391), FRAC_CONST(0.975342273712158) },
+    { FRAC_CONST(-0.233445391058922), FRAC_CONST(0.972369909286499) },
+    { FRAC_CONST(-0.246153354644775), FRAC_CONST(0.969230890274048) },
+    { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) },
+    { FRAC_CONST(-0.271440476179123), FRAC_CONST(0.962455213069916) },
+    { FRAC_CONST(-0.284015417098999), FRAC_CONST(0.958819687366486) },
+    { FRAC_CONST(-0.296541571617126), FRAC_CONST(0.955019950866699) },
+    { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+    { FRAC_CONST(-0.321439564228058), FRAC_CONST(0.946930110454559) },
+    { FRAC_CONST(-0.333806872367859), FRAC_CONST(0.942641496658325) },
+    { FRAC_CONST(-0.346117109060287), FRAC_CONST(0.938191294670105) },
+    { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) },
+    { FRAC_CONST(-0.370557487010956), FRAC_CONST(0.928809523582459) },
+    { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(-0.394743859767914), FRAC_CONST(0.918791234493256) },
+    { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
+    { FRAC_CONST(-0.418659836053848), FRAC_CONST(0.908143103122711) },
+    { FRAC_CONST(-0.430511116981506), FRAC_CONST(0.902585268020630) },
+    { FRAC_CONST(-0.442288637161255), FRAC_CONST(0.896872758865356) },
+    { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
+    { FRAC_CONST(-0.465614557266235), FRAC_CONST(0.884987592697144) },
+    { FRAC_CONST(-0.477158725261688), FRAC_CONST(0.878817141056061) },
+    { FRAC_CONST(-0.488621354103088), FRAC_CONST(0.872495949268341) },
+    { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) },
+    { FRAC_CONST(-0.511293053627014), FRAC_CONST(0.859406411647797) },
+    { FRAC_CONST(-0.522498667240143), FRAC_CONST(0.852640092372894) },
+    { FRAC_CONST(-0.533614575862885), FRAC_CONST(0.845727801322937) },
+    { FRAC_CONST(-0.544639050960541), FRAC_CONST(0.838670551776886) },
+    { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+    { FRAC_CONST(-0.566406309604645), FRAC_CONST(0.824126124382019) },
+    { FRAC_CONST(-0.577145218849182), FRAC_CONST(0.816641569137573) },
+    { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(-0.598324656486511), FRAC_CONST(0.801253736019135) },
+    { FRAC_CONST(-0.608761429786682), FRAC_CONST(0.793353319168091) },
+    { FRAC_CONST(-0.619093894958496), FRAC_CONST(0.785316944122314) },
+    { FRAC_CONST(-0.629320502281189), FRAC_CONST(0.777145862579346) },
+    { FRAC_CONST(-0.639439046382904), FRAC_CONST(0.768841803073883) },
+    { FRAC_CONST(-0.649448037147522), FRAC_CONST(0.760405957698822) },
+    { FRAC_CONST(-0.659345924854279), FRAC_CONST(0.751839697360992) },
+    { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) },
+    { FRAC_CONST(-0.678800761699677), FRAC_CONST(0.734322488307953) },
+    { FRAC_CONST(-0.688354671001434), FRAC_CONST(0.725374281406403) },
+    { FRAC_CONST(-0.697790503501892), FRAC_CONST(0.716301858425140) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.716302037239075), FRAC_CONST(0.697790324687958) },
+    { FRAC_CONST(-0.725374460220337), FRAC_CONST(0.688354492187500) },
+    { FRAC_CONST(-0.734322547912598), FRAC_CONST(0.678800702095032) },
+    { FRAC_CONST(-0.743144929409027), FRAC_CONST(0.669130444526672) },
+    { FRAC_CONST(-0.751839876174927), FRAC_CONST(0.659345746040344) },
+    { FRAC_CONST(-0.760406017303467), FRAC_CONST(0.649448037147522) },
+    { FRAC_CONST(-0.768841803073883), FRAC_CONST(0.639439046382904) },
+    { FRAC_CONST(-0.777146041393280), FRAC_CONST(0.629320263862610) },
+    { FRAC_CONST(-0.785316944122314), FRAC_CONST(0.619093894958496) },
+    { FRAC_CONST(-0.793353319168091), FRAC_CONST(0.608761429786682) },
+    { FRAC_CONST(-0.801253914833069), FRAC_CONST(0.598324477672577) },
+    { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+    { FRAC_CONST(-0.816641569137573), FRAC_CONST(0.577145218849182) },
+    { FRAC_CONST(-0.824126303195953), FRAC_CONST(0.566406130790710) },
+    { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+    { FRAC_CONST(-0.838670551776886), FRAC_CONST(0.544639050960541) },
+    { FRAC_CONST(-0.845727920532227), FRAC_CONST(0.533614337444305) },
+    { FRAC_CONST(-0.852640211582184), FRAC_CONST(0.522498488426209) },
+    { FRAC_CONST(-0.859406411647797), FRAC_CONST(0.511293053627014) },
+    { FRAC_CONST(-0.866025388240814), FRAC_CONST(0.500000059604645) },
+    { FRAC_CONST(-0.872496068477631), FRAC_CONST(0.488621145486832) },
+    { FRAC_CONST(-0.878817141056061), FRAC_CONST(0.477158725261688) },
+    { FRAC_CONST(-0.884987652301788), FRAC_CONST(0.465614557266235) },
+    { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) },
+    { FRAC_CONST(-0.896872758865356), FRAC_CONST(0.442288637161255) },
+    { FRAC_CONST(-0.902585268020630), FRAC_CONST(0.430511116981506) },
+    { FRAC_CONST(-0.908143222332001), FRAC_CONST(0.418659597635269) },
+    { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) },
+    { FRAC_CONST(-0.918791234493256), FRAC_CONST(0.394743859767914) },
+    { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+    { FRAC_CONST(-0.928809583187103), FRAC_CONST(0.370557337999344) },
+    { FRAC_CONST(-0.933580458164215), FRAC_CONST(0.358367919921875) },
+    { FRAC_CONST(-0.938191413879395), FRAC_CONST(0.346116900444031) },
+    { FRAC_CONST(-0.942641556262970), FRAC_CONST(0.333806753158569) },
+    { FRAC_CONST(-0.946930170059204), FRAC_CONST(0.321439445018768) },
+    { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+    { FRAC_CONST(-0.955020010471344), FRAC_CONST(0.296541452407837) },
+    { FRAC_CONST(-0.958819746971130), FRAC_CONST(0.284015297889709) },
+    { FRAC_CONST(-0.962455213069916), FRAC_CONST(0.271440476179123) },
+    { FRAC_CONST(-0.965925872325897), FRAC_CONST(0.258818924427032) },
+    { FRAC_CONST(-0.969230949878693), FRAC_CONST(0.246153235435486) },
+    { FRAC_CONST(-0.972369909286499), FRAC_CONST(0.233445376157761) },
+    { FRAC_CONST(-0.975342333316803), FRAC_CONST(0.220697283744812) },
+    { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) },
+    { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+    { FRAC_CONST(-0.983254909515381), FRAC_CONST(0.182235360145569) },
+    { FRAC_CONST(-0.985556066036224), FRAC_CONST(0.169349402189255) },
+    { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) },
+    { FRAC_CONST(-0.989651441574097), FRAC_CONST(0.143492430448532) },
+    { FRAC_CONST(-0.991444885730743), FRAC_CONST(0.130526080727577) },
+    { FRAC_CONST(-0.993068456649780), FRAC_CONST(0.117537356913090) },
+    { FRAC_CONST(-0.994521915912628), FRAC_CONST(0.104528494179249) },
+    { FRAC_CONST(-0.995804965496063), FRAC_CONST(0.091501489281654) },
+    { FRAC_CONST(-0.996917366981506), FRAC_CONST(0.078459039330482) },
+    { FRAC_CONST(-0.997858941555023), FRAC_CONST(0.065403148531914) },
+    { FRAC_CONST(-0.998629570007324), FRAC_CONST(0.052335809916258) },
+    { FRAC_CONST(-0.999229013919830), FRAC_CONST(0.039259742945433) },
+    { FRAC_CONST(-0.999657332897186), FRAC_CONST(0.026176951825619) },
+    { FRAC_CONST(-0.999914348125458), FRAC_CONST(0.013089434243739) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.999657332897186), FRAC_CONST(0.026176949962974) },
+    { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) },
+    { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) },
+    { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
+    { FRAC_CONST(0.991444885730743), FRAC_CONST(0.130526199936867) },
+    { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+    { FRAC_CONST(0.983254909515381), FRAC_CONST(0.182235524058342) },
+    { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
+    { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
+    { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) },
+    { FRAC_CONST(0.958819746971130), FRAC_CONST(0.284015357494354) },
+    { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+    { FRAC_CONST(0.942641496658325), FRAC_CONST(0.333806872367859) },
+    { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
+    { FRAC_CONST(0.902585268020630), FRAC_CONST(0.430511116981506) },
+    { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+    { FRAC_CONST(0.878817081451416), FRAC_CONST(0.477158784866333) },
+    { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
+    { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) },
+    { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) },
+    { FRAC_CONST(0.824126183986664), FRAC_CONST(0.566406250000000) },
+    { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+    { FRAC_CONST(0.793353319168091), FRAC_CONST(0.608761429786682) },
+    { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) },
+    { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
+    { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
+    { FRAC_CONST(0.725374400615692), FRAC_CONST(0.688354551792145) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.688354551792145), FRAC_CONST(0.725374400615692) },
+    { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
+    { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) },
+    { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) },
+    { FRAC_CONST(0.608761370182037), FRAC_CONST(0.793353378772736) },
+    { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(0.566406250000000), FRAC_CONST(0.824126183986664) },
+    { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) },
+    { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) },
+    { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
+    { FRAC_CONST(0.477158755064011), FRAC_CONST(0.878817141056061) },
+    { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+    { FRAC_CONST(0.430511027574539), FRAC_CONST(0.902585327625275) },
+    { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) },
+    { FRAC_CONST(0.333806812763214), FRAC_CONST(0.942641496658325) },
+    { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+    { FRAC_CONST(0.284015327692032), FRAC_CONST(0.958819746971130) },
+    { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) },
+    { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) },
+    { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
+    { FRAC_CONST(0.182235524058342), FRAC_CONST(0.983254909515381) },
+    { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+    { FRAC_CONST(0.130526125431061), FRAC_CONST(0.991444885730743) },
+    { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
+    { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) },
+    { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) },
+    { FRAC_CONST(0.026176875457168), FRAC_CONST(0.999657332897186) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.026176963001490), FRAC_CONST(0.999657332897186) },
+    { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) },
+    { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) },
+    { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
+    { FRAC_CONST(-0.130526214838028), FRAC_CONST(0.991444885730743) },
+    { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
+    { FRAC_CONST(-0.182235598564148), FRAC_CONST(0.983254909515381) },
+    { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
+    { FRAC_CONST(-0.233445391058922), FRAC_CONST(0.972369909286499) },
+    { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) },
+    { FRAC_CONST(-0.284015417098999), FRAC_CONST(0.958819687366486) },
+    { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+    { FRAC_CONST(-0.333806872367859), FRAC_CONST(0.942641496658325) },
+    { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) },
+    { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
+    { FRAC_CONST(-0.430511116981506), FRAC_CONST(0.902585268020630) },
+    { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
+    { FRAC_CONST(-0.477158725261688), FRAC_CONST(0.878817141056061) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) },
+    { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
+    { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+    { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
+    { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) },
+    { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+    { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) },
+    { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
+    { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+    { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
+    { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) },
+    { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+    { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) },
+    { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
+    { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) },
+    { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) },
+    { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
+    { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+    { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
+    { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) },
+    { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+    { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) },
+    { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
+    { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+    { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
+    { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) },
+    { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
+    { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
+    { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
+    { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) },
+    { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+    { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) },
+    { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
+    { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
+    { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) },
+    { FRAC_CONST(-0.544639050960541), FRAC_CONST(0.838670551776886) },
+    { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(-0.629320502281189), FRAC_CONST(0.777145862579346) },
+    { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.743144929409027), FRAC_CONST(0.669130444526672) },
+    { FRAC_CONST(-0.777146041393280), FRAC_CONST(0.629320263862610) },
+    { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+    { FRAC_CONST(-0.838670551776886), FRAC_CONST(0.544639050960541) },
+    { FRAC_CONST(-0.866025388240814), FRAC_CONST(0.500000059604645) },
+    { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) },
+    { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) },
+    { FRAC_CONST(-0.933580458164215), FRAC_CONST(0.358367919921875) },
+    { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+    { FRAC_CONST(-0.965925872325897), FRAC_CONST(0.258818924427032) },
+    { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) },
+    { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) },
+    { FRAC_CONST(-0.994521915912628), FRAC_CONST(0.104528494179249) },
+    { FRAC_CONST(-0.998629570007324), FRAC_CONST(0.052335809916258) },
+    { FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.000000087422777) },
+    { FRAC_CONST(-0.998629510402679), FRAC_CONST(-0.052335985004902) },
+    { FRAC_CONST(-0.994521856307983), FRAC_CONST(-0.104528672993183) },
+    { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) },
+    { FRAC_CONST(-0.978147566318512), FRAC_CONST(-0.207911789417267) },
+    { FRAC_CONST(-0.965925812721252), FRAC_CONST(-0.258819073438644) },
+    { FRAC_CONST(-0.951056540012360), FRAC_CONST(-0.309016972780228) },
+    { FRAC_CONST(-0.933580398559570), FRAC_CONST(-0.358368098735809) },
+    { FRAC_CONST(-0.913545429706573), FRAC_CONST(-0.406736731529236) },
+    { FRAC_CONST(-0.891006529331207), FRAC_CONST(-0.453990548849106) },
+    { FRAC_CONST(-0.866025269031525), FRAC_CONST(-0.500000178813934) },
+    { FRAC_CONST(-0.838670492172241), FRAC_CONST(-0.544639170169830) },
+    { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+    { FRAC_CONST(-0.777145922183990), FRAC_CONST(-0.629320442676544) },
+    { FRAC_CONST(-0.743144810199738), FRAC_CONST(-0.669130623340607) },
+    { FRAC_CONST(-0.707106649875641), FRAC_CONST(-0.707106888294220) },
+    { FRAC_CONST(-0.669130504131317), FRAC_CONST(-0.743144869804382) },
+    { FRAC_CONST(-0.629320323467255), FRAC_CONST(-0.777145981788635) },
+    { FRAC_CONST(-0.587785065174103), FRAC_CONST(-0.809017121791840) },
+    { FRAC_CONST(-0.544639110565186), FRAC_CONST(-0.838670551776886) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) },
+    { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+    { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
+    { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+    { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) },
+    { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+    { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) },
+    { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) },
+    { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+    { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) },
+    { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+    { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+    { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+    { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+    { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+    { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+    { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
+    { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+    { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
+    { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+    { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) },
+    { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+    { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
+    { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+    { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
+    { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+    { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) },
+    { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+    { FRAC_CONST(-0.522498667240143), FRAC_CONST(0.852640092372894) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.852640211582184), FRAC_CONST(0.522498488426209) },
+    { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+    { FRAC_CONST(-0.996917366981506), FRAC_CONST(0.078459039330482) },
+    { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) },
+    { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+    { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+    { FRAC_CONST(-0.649447917938232), FRAC_CONST(-0.760406076908112) },
+    { FRAC_CONST(-0.453990221023560), FRAC_CONST(-0.891006648540497) },
+    { FRAC_CONST(-0.233445450663567), FRAC_CONST(-0.972369909286499) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+    { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+    { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+    { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+    { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+    { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+    { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+    { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.309017121791840), FRAC_CONST(-0.951056480407715) }
+};
+#endif
+
+complex_t cfft_tab_64[] =
+{
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+    { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+    { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+    { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+    { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+    { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+    { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+    { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+    { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+    { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+    { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
+    { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+    { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
+    { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+    { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
+    { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
+    { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) }
+};
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+complex_t cfft_tab_60[] =
+{
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
+    { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
+    { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+    { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
+    { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
+    { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+    { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
+    { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
+    { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
+    { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
+    { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+    { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
+    { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
+    { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
+    { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+    { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
+    { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
+    { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+    { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
+    { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
+    { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+    { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
+    { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
+    { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+    { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) },
+    { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) },
+    { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+    { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) },
+    { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) },
+    { FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.000000087422777) },
+    { FRAC_CONST(-0.978147566318512), FRAC_CONST(-0.207911789417267) },
+    { FRAC_CONST(-0.913545429706573), FRAC_CONST(-0.406736731529236) },
+    { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+    { FRAC_CONST(-0.669130504131317), FRAC_CONST(-0.743144869804382) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+    { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+    { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+    { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+    { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+    { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+    { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+    { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.309017121791840), FRAC_CONST(-0.951056480407715) }
+};
+#endif
+
+#ifdef LD_DEC
+
+complex_t cfft_tab_256[] =
+{
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.999698817729950), FRAC_CONST(0.024541229009628) },
+    { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
+    { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) },
+    { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+    { FRAC_CONST(0.992479562759399), FRAC_CONST(0.122410677373409) },
+    { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+    { FRAC_CONST(0.985277652740479), FRAC_CONST(0.170961901545525) },
+    { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+    { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) },
+    { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
+    { FRAC_CONST(0.963776051998138), FRAC_CONST(0.266712784767151) },
+    { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+    { FRAC_CONST(0.949528157711029), FRAC_CONST(0.313681751489639) },
+    { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
+    { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.914209723472595), FRAC_CONST(0.405241340398788) },
+    { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+    { FRAC_CONST(0.893224298954010), FRAC_CONST(0.449611335992813) },
+    { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+    { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) },
+    { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
+    { FRAC_CONST(0.844853579998016), FRAC_CONST(0.534997642040253) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.817584812641144), FRAC_CONST(0.575808227062225) },
+    { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
+    { FRAC_CONST(0.788346409797668), FRAC_CONST(0.615231633186340) },
+    { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+    { FRAC_CONST(0.757208824157715), FRAC_CONST(0.653172850608826) },
+    { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+    { FRAC_CONST(0.724247097969055), FRAC_CONST(0.689540565013886) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) },
+    { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
+    { FRAC_CONST(0.653172791004181), FRAC_CONST(0.757208883762360) },
+    { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+    { FRAC_CONST(0.615231573581696), FRAC_CONST(0.788346409797668) },
+    { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
+    { FRAC_CONST(0.575808167457581), FRAC_CONST(0.817584812641144) },
+    { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+    { FRAC_CONST(0.534997642040253), FRAC_CONST(0.844853579998016) },
+    { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+    { FRAC_CONST(0.492898195981979), FRAC_CONST(0.870086967945099) },
+    { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+    { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) },
+    { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
+    { FRAC_CONST(0.405241280794144), FRAC_CONST(0.914209783077240) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.359894961118698), FRAC_CONST(0.932992815971375) },
+    { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
+    { FRAC_CONST(0.313681662082672), FRAC_CONST(0.949528217315674) },
+    { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+    { FRAC_CONST(0.266712754964828), FRAC_CONST(0.963776051998138) },
+    { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
+    { FRAC_CONST(0.219101220369339), FRAC_CONST(0.975702106952667) },
+    { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+    { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) },
+    { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
+    { FRAC_CONST(0.122410625219345), FRAC_CONST(0.992479562759399) },
+    { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(0.073564492166042), FRAC_CONST(0.997290432453156) },
+    { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
+    { FRAC_CONST(0.024541135877371), FRAC_CONST(0.999698817729950) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
+    { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+    { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+    { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+    { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
+    { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+    { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+    { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+    { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
+    { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+    { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
+    { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+    { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
+    { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+    { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+    { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+    { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
+    { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+    { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
+    { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+    { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
+    { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
+    { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) },
+    { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+    { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) },
+    { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) },
+    { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) },
+    { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) },
+    { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+    { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) },
+    { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+    { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
+    { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) },
+    { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) },
+    { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) },
+    { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) },
+    { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+    { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) },
+    { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) },
+    { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) },
+    { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+    { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
+    { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) },
+    { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) },
+    { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+    { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) },
+    { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) },
+    { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) },
+    { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+    { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) },
+    { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+    { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) },
+    { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+    { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.788346469402313), FRAC_CONST(0.615231573581696) },
+    { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+    { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) },
+    { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+    { FRAC_CONST(0.575808227062225), FRAC_CONST(0.817584812641144) },
+    { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+    { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.313681751489639), FRAC_CONST(0.949528157711029) },
+    { FRAC_CONST(0.242980241775513), FRAC_CONST(0.970031261444092) },
+    { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) },
+    { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(0.024541255086660), FRAC_CONST(0.999698817729950) },
+    { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
+    { FRAC_CONST(-0.122410707175732), FRAC_CONST(0.992479503154755) },
+    { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+    { FRAC_CONST(-0.266712725162506), FRAC_CONST(0.963776051998138) },
+    { FRAC_CONST(-0.336889803409576), FRAC_CONST(0.941544055938721) },
+    { FRAC_CONST(-0.405241340398788), FRAC_CONST(0.914209723472595) },
+    { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+    { FRAC_CONST(-0.534997701644897), FRAC_CONST(0.844853520393372) },
+    { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
+    { FRAC_CONST(-0.653172850608826), FRAC_CONST(0.757208824157715) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.757208824157715), FRAC_CONST(0.653172850608826) },
+    { FRAC_CONST(-0.803207516670227), FRAC_CONST(0.595699369907379) },
+    { FRAC_CONST(-0.844853520393372), FRAC_CONST(0.534997701644897) },
+    { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
+    { FRAC_CONST(-0.914209783077240), FRAC_CONST(0.405241221189499) },
+    { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
+    { FRAC_CONST(-0.963776051998138), FRAC_CONST(0.266712725162506) },
+    { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+    { FRAC_CONST(-0.992479503154755), FRAC_CONST(0.122410699725151) },
+    { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067724496126) },
+    { FRAC_CONST(-0.999698817729950), FRAC_CONST(-0.024541147053242) },
+    { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
+    { FRAC_CONST(-0.985277652740479), FRAC_CONST(-0.170961990952492) },
+    { FRAC_CONST(-0.970031261444092), FRAC_CONST(-0.242980241775513) },
+    { FRAC_CONST(-0.949528157711029), FRAC_CONST(-0.313681781291962) },
+    { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+    { FRAC_CONST(-0.893224298954010), FRAC_CONST(-0.449611306190491) },
+    { FRAC_CONST(-0.857728660106659), FRAC_CONST(-0.514102697372437) },
+    { FRAC_CONST(-0.817584872245789), FRAC_CONST(-0.575808107852936) },
+    { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
+    { FRAC_CONST(-0.724247038364410), FRAC_CONST(-0.689540624618530) },
+    { FRAC_CONST(-0.671558916568756), FRAC_CONST(-0.740951180458069) },
+    { FRAC_CONST(-0.615231573581696), FRAC_CONST(-0.788346469402313) },
+    { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
+    { FRAC_CONST(-0.492898195981979), FRAC_CONST(-0.870086967945099) },
+    { FRAC_CONST(-0.427554935216904), FRAC_CONST(-0.903989374637604) },
+    { FRAC_CONST(-0.359895110130310), FRAC_CONST(-0.932992756366730) },
+    { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
+    { FRAC_CONST(-0.219101369380951), FRAC_CONST(-0.975702106952667) },
+    { FRAC_CONST(-0.146730408072472), FRAC_CONST(-0.989176511764526) },
+    { FRAC_CONST(-0.073564760386944), FRAC_CONST(-0.997290432453156) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+    { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+    { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+    { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+    { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+    { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+    { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+    { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+    { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+    { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+    { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
+    { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+    { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
+    { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+    { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
+    { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
+    { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) }
+};
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+complex_t cfft_tab_240[] =
+{
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.999657332897186), FRAC_CONST(0.026176949962974) },
+    { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) },
+    { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) },
+    { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
+    { FRAC_CONST(0.991444885730743), FRAC_CONST(0.130526199936867) },
+    { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+    { FRAC_CONST(0.983254909515381), FRAC_CONST(0.182235524058342) },
+    { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
+    { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
+    { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) },
+    { FRAC_CONST(0.958819746971130), FRAC_CONST(0.284015357494354) },
+    { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+    { FRAC_CONST(0.942641496658325), FRAC_CONST(0.333806872367859) },
+    { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
+    { FRAC_CONST(0.902585268020630), FRAC_CONST(0.430511116981506) },
+    { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+    { FRAC_CONST(0.878817081451416), FRAC_CONST(0.477158784866333) },
+    { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
+    { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) },
+    { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) },
+    { FRAC_CONST(0.824126183986664), FRAC_CONST(0.566406250000000) },
+    { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+    { FRAC_CONST(0.793353319168091), FRAC_CONST(0.608761429786682) },
+    { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) },
+    { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
+    { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
+    { FRAC_CONST(0.725374400615692), FRAC_CONST(0.688354551792145) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.688354551792145), FRAC_CONST(0.725374400615692) },
+    { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
+    { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) },
+    { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) },
+    { FRAC_CONST(0.608761370182037), FRAC_CONST(0.793353378772736) },
+    { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(0.566406250000000), FRAC_CONST(0.824126183986664) },
+    { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) },
+    { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) },
+    { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
+    { FRAC_CONST(0.477158755064011), FRAC_CONST(0.878817141056061) },
+    { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+    { FRAC_CONST(0.430511027574539), FRAC_CONST(0.902585327625275) },
+    { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) },
+    { FRAC_CONST(0.333806812763214), FRAC_CONST(0.942641496658325) },
+    { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+    { FRAC_CONST(0.284015327692032), FRAC_CONST(0.958819746971130) },
+    { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) },
+    { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) },
+    { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
+    { FRAC_CONST(0.182235524058342), FRAC_CONST(0.983254909515381) },
+    { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+    { FRAC_CONST(0.130526125431061), FRAC_CONST(0.991444885730743) },
+    { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
+    { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) },
+    { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) },
+    { FRAC_CONST(0.026176875457168), FRAC_CONST(0.999657332897186) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.026176963001490), FRAC_CONST(0.999657332897186) },
+    { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) },
+    { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) },
+    { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
+    { FRAC_CONST(-0.130526214838028), FRAC_CONST(0.991444885730743) },
+    { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
+    { FRAC_CONST(-0.182235598564148), FRAC_CONST(0.983254909515381) },
+    { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
+    { FRAC_CONST(-0.233445391058922), FRAC_CONST(0.972369909286499) },
+    { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) },
+    { FRAC_CONST(-0.284015417098999), FRAC_CONST(0.958819687366486) },
+    { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+    { FRAC_CONST(-0.333806872367859), FRAC_CONST(0.942641496658325) },
+    { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) },
+    { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
+    { FRAC_CONST(-0.430511116981506), FRAC_CONST(0.902585268020630) },
+    { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
+    { FRAC_CONST(-0.477158725261688), FRAC_CONST(0.878817141056061) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) },
+    { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
+    { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+    { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
+    { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) },
+    { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+    { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) },
+    { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
+    { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+    { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
+    { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) },
+    { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+    { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) },
+    { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
+    { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) },
+    { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) },
+    { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
+    { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+    { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
+    { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) },
+    { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+    { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) },
+    { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
+    { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+    { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
+    { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) },
+    { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
+    { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
+    { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
+    { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) },
+    { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+    { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) },
+    { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
+    { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
+    { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) },
+    { FRAC_CONST(-0.544639050960541), FRAC_CONST(0.838670551776886) },
+    { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(-0.629320502281189), FRAC_CONST(0.777145862579346) },
+    { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.743144929409027), FRAC_CONST(0.669130444526672) },
+    { FRAC_CONST(-0.777146041393280), FRAC_CONST(0.629320263862610) },
+    { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+    { FRAC_CONST(-0.838670551776886), FRAC_CONST(0.544639050960541) },
+    { FRAC_CONST(-0.866025388240814), FRAC_CONST(0.500000059604645) },
+    { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) },
+    { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) },
+    { FRAC_CONST(-0.933580458164215), FRAC_CONST(0.358367919921875) },
+    { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+    { FRAC_CONST(-0.965925872325897), FRAC_CONST(0.258818924427032) },
+    { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) },
+    { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) },
+    { FRAC_CONST(-0.994521915912628), FRAC_CONST(0.104528494179249) },
+    { FRAC_CONST(-0.998629570007324), FRAC_CONST(0.052335809916258) },
+    { FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.000000087422777) },
+    { FRAC_CONST(-0.998629510402679), FRAC_CONST(-0.052335985004902) },
+    { FRAC_CONST(-0.994521856307983), FRAC_CONST(-0.104528672993183) },
+    { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) },
+    { FRAC_CONST(-0.978147566318512), FRAC_CONST(-0.207911789417267) },
+    { FRAC_CONST(-0.965925812721252), FRAC_CONST(-0.258819073438644) },
+    { FRAC_CONST(-0.951056540012360), FRAC_CONST(-0.309016972780228) },
+    { FRAC_CONST(-0.933580398559570), FRAC_CONST(-0.358368098735809) },
+    { FRAC_CONST(-0.913545429706573), FRAC_CONST(-0.406736731529236) },
+    { FRAC_CONST(-0.891006529331207), FRAC_CONST(-0.453990548849106) },
+    { FRAC_CONST(-0.866025269031525), FRAC_CONST(-0.500000178813934) },
+    { FRAC_CONST(-0.838670492172241), FRAC_CONST(-0.544639170169830) },
+    { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+    { FRAC_CONST(-0.777145922183990), FRAC_CONST(-0.629320442676544) },
+    { FRAC_CONST(-0.743144810199738), FRAC_CONST(-0.669130623340607) },
+    { FRAC_CONST(-0.707106649875641), FRAC_CONST(-0.707106888294220) },
+    { FRAC_CONST(-0.669130504131317), FRAC_CONST(-0.743144869804382) },
+    { FRAC_CONST(-0.629320323467255), FRAC_CONST(-0.777145981788635) },
+    { FRAC_CONST(-0.587785065174103), FRAC_CONST(-0.809017121791840) },
+    { FRAC_CONST(-0.544639110565186), FRAC_CONST(-0.838670551776886) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) },
+    { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+    { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
+    { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+    { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) },
+    { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+    { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) },
+    { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) },
+    { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+    { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) },
+    { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+    { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+    { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+    { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+    { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+    { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+    { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
+    { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+    { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
+    { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+    { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) },
+    { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+    { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
+    { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+    { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
+    { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+    { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) },
+    { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+    { FRAC_CONST(-0.522498667240143), FRAC_CONST(0.852640092372894) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.852640211582184), FRAC_CONST(0.522498488426209) },
+    { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+    { FRAC_CONST(-0.996917366981506), FRAC_CONST(0.078459039330482) },
+    { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) },
+    { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+    { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+    { FRAC_CONST(-0.649447917938232), FRAC_CONST(-0.760406076908112) },
+    { FRAC_CONST(-0.453990221023560), FRAC_CONST(-0.891006648540497) },
+    { FRAC_CONST(-0.233445450663567), FRAC_CONST(-0.972369909286499) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+    { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+    { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+    { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+    { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+    { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+    { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+    { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+    { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.309017121791840), FRAC_CONST(-0.951056480407715) }
+};
+#endif
+
+#endif
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/codebook/hcb.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.6 2003/09/09 18:12:01 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/Input/aac/libfaad2/codebook/hcb_1.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.3 2003/09/09 18:12:01 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/Input/aac/libfaad2/codebook/hcb_10.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.3 2003/09/09 18:12:01 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/Input/aac/libfaad2/codebook/hcb_11.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.3 2003/09/09 18:12:01 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/Input/aac/libfaad2/codebook/hcb_2.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.3 2003/09/09 18:12:01 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/Input/aac/libfaad2/codebook/hcb_3.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.3 2003/09/09 18:12:01 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/Input/aac/libfaad2/codebook/hcb_4.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.3 2003/09/09 18:12:01 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/Input/aac/libfaad2/codebook/hcb_5.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.3 2003/09/09 18:12:01 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/Input/aac/libfaad2/codebook/hcb_6.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.3 2003/09/09 18:12:01 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/Input/aac/libfaad2/codebook/hcb_7.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.3 2003/09/09 18:12:01 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/Input/aac/libfaad2/codebook/hcb_8.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.3 2003/09/09 18:12:01 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/Input/aac/libfaad2/codebook/hcb_9.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.3 2003/09/09 18:12:01 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/Input/aac/libfaad2/codebook/hcb_sf.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.3 2003/09/09 18:12:01 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/Input/aac/libfaad2/common.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,230 @@
+/*
+** 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.12 2003/11/12 20:47:57 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 (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;
+    if (16428320 <= samplerate) return 11;
+
+    return 11;
+}
+
+/* Returns the sample rate based on the sample rate index */
+uint32_t get_sample_rate(uint8_t sr_index)
+{
+    static const uint32_t sample_rates[] =
+    {
+        96000, 88200, 64000, 48000, 44100, 32000,
+        24000, 22050, 16000, 12000, 11025, 8000
+    };
+
+    if (sr_index < 12)
+        return sample_rates[sr_index];
+
+    return 0;
+}
+
+uint8_t max_pred_sfb(uint8_t sr_index)
+{
+    static const uint8_t pred_sfb_max[] =
+    {
+        33, 33, 38, 40, 40, 40, 41, 41, 37, 37, 37, 34
+    };
+
+
+    if (sr_index < 12)
+        return pred_sfb_max[sr_index];
+
+    return 0;
+}
+
+uint8_t max_tns_sfb(uint8_t sr_index, uint8_t object_type, uint8_t is_short)
+{
+    /* entry for each sampling rate	
+     * 1    Main/LC long window
+     * 2    Main/LC short window
+     * 3    SSR long window
+     * 4    SSR short window
+     */
+    static const uint8_t tns_sbf_max[][4] =
+    {
+        {31,  9, 28, 7}, /* 96000 */
+        {31,  9, 28, 7}, /* 88200 */
+        {34, 10, 27, 7}, /* 64000 */
+        {40, 14, 26, 6}, /* 48000 */
+        {42, 14, 26, 6}, /* 44100 */
+        {51, 14, 26, 6}, /* 32000 */
+        {46, 14, 29, 7}, /* 24000 */
+        {46, 14, 29, 7}, /* 22050 */
+        {42, 14, 23, 8}, /* 16000 */
+        {42, 14, 23, 8}, /* 12000 */
+        {42, 14, 23, 8}, /* 11025 */
+        {39, 14, 19, 7}, /*  8000 */
+        {39, 14, 19, 7}, /*  7350 */
+        {0,0,0,0},
+        {0,0,0,0},
+        {0,0,0,0}
+    };
+    uint8_t i = 0;
+
+    if (is_short) i++;
+    if (object_type == SSR) i += 2;
+
+    return tns_sbf_max[sr_index][i];
+}
+
+/* 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/Input/aac/libfaad2/common.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,375 @@
+/*
+** 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.h,v 1.38 2003/11/12 20:47:57 menno Exp $
+**/
+
+#ifndef __COMMON_H__
+#define __COMMON_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#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
+
+#ifdef _WIN32_WCE
+#define FIXED_POINT
+#endif
+
+
+#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
+/* Allow decoding of Digital Radio Mondiale (DRM) */
+//#define DRM
+
+/* 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 ALLOW_SMALL_FRAMELENGTH
+
+
+// Define LC_ONLY_DECODER if you want a pure AAC LC decoder (independant of SBR_DEC)
+//#define LC_ONLY_DECODER
+#ifdef LC_ONLY_DECODER
+  #undef LTP_DEC
+  #undef MAIN_DEC
+  #undef SSR_DEC
+  #undef DRM
+  #undef ALLOW_SMALL_FRAMELENGTH
+  #undef ERROR_RESILIENCE
+#endif
+
+#define SBR_DEC
+//#define SBR_LOW_POWER
+
+/* FIXED POINT: No MAIN decoding, forced SBR Low Power decoder */
+#ifdef FIXED_POINT
+# ifdef MAIN_DEC
+#  undef MAIN_DEC
+# endif
+# ifndef SBR_LOW_POWER
+#  define SBR_LOW_POWER
+# endif
+#endif // FIXED_POINT
+
+#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)
+#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
+
+#ifdef HAVE_CONFIG_H
+#  include "../config.h"
+#endif
+
+#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_R(A,B) ((A)*(B))
+  #define MUL_C(A,B) ((A)*(B))
+  #define MUL_F(A,B) ((A)*(B))
+
+  /* Complex multiplication */
+  static INLINE void ComplexMult(real_t *y1, real_t *y2,
+      real_t x1, real_t x2, real_t c1, real_t c2)
+  {
+      *y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
+      *y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
+  }
+
+  #define REAL_CONST(A) ((real_t)(A))
+  #define COEF_CONST(A) ((real_t)(A))
+  #define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */
+
+#else /* Normal floating point operation */
+
+  typedef float real_t;
+
+  #define MUL_R(A,B) ((A)*(B))
+  #define MUL_C(A,B) ((A)*(B))
+  #define MUL_F(A,B) ((A)*(B))
+
+  #define REAL_CONST(A) ((real_t)(A))
+  #define COEF_CONST(A) ((real_t)(A))
+  #define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */
+
+  /* Complex multiplication */
+  static INLINE void ComplexMult(real_t *y1, real_t *y2,
+      real_t x1, real_t x2, real_t c1, real_t c2)
+  {
+      *y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
+      *y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
+  }
+
+
+  #ifdef _WIN32
+    #define HAS_LRINTF
+    static INLINE int lrintf(float f)
+    {
+        int i;
+        __asm
+        {
+            fld   f
+            fistp i
+        }
+        return i;
+    }
+  #endif
+
+
+  #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
+
+#ifdef HAVE_LRINTF
+#  define HAS_LRINTF
+#  define _ISOC9X_SOURCE 1
+#  define _ISOC99_SOURCE 1
+#  define __USE_ISOC9X   1
+#  define __USE_ISOC99   1
+#endif
+
+    #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
+
+#ifndef HAS_LRINTF
+/* standard cast */
+#define lrintf(f) ((int32_t)(f))
+#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);
+uint8_t max_pred_sfb(uint8_t sr_index);
+uint8_t max_tns_sfb(uint8_t sr_index, uint8_t object_type, uint8_t is_short);
+uint32_t get_sample_rate(uint8_t sr_index);
+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/Input/aac/libfaad2/decoder.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,1035 @@
+/*
+** 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.82 2003/11/12 20:47:57 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "decoder.h"
+#include "mp4.h"
+#include "syntax.h"
+#include "error.h"
+#include "output.h"
+#ifdef SBR_DEC
+#include "sbr_dec.h"
+#endif
+#ifdef SSR_DEC
+#include "ssr.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->config.downMatrix = 0;
+    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));
+    if (!hDecoder->pow2_table)
+    {
+        free(hDecoder);
+        hDecoder = NULL;
+        return hDecoder;
+    }
+    build_tables(hDecoder->pow2_table);
+#endif
+
+    return hDecoder;
+}
+
+faacDecConfigurationPtr FAADAPI faacDecGetCurrentConfiguration(faacDecHandle hDecoder)
+{
+    if (hDecoder)
+    {
+        faacDecConfigurationPtr config = &(hDecoder->config);
+
+        return config;
+    }
+
+    return NULL;
+}
+
+uint8_t FAADAPI faacDecSetConfiguration(faacDecHandle hDecoder,
+                                    faacDecConfigurationPtr config)
+{
+    if (hDecoder && config)
+    {
+        /* check if we can decode this object type */
+        if (can_decode_ot(config->defObjectType) < 0)
+            return 0;
+        hDecoder->config.defObjectType = config->defObjectType;
+
+        /* samplerate: anything but 0 should be possible */
+        if (config->defSampleRate == 0)
+            return 0;
+        hDecoder->config.defSampleRate = config->defSampleRate;
+
+        /* check output format */
+        if ((config->outputFormat < 1) || (config->outputFormat > 9))
+            return 0;
+        hDecoder->config.outputFormat = config->outputFormat;
+
+        if (config->downMatrix > 1)
+            hDecoder->config.downMatrix = config->downMatrix;
+
+        /* OK */
+        return 1;
+    }
+
+    return 0;
+}
+
+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;
+
+    if ((hDecoder == NULL) || (samplerate == NULL) || (channels == NULL))
+        return -1;
+
+    hDecoder->sf_index = get_sr_index(hDecoder->config.defSampleRate);
+    hDecoder->object_type = hDecoder->config.defObjectType;
+    *samplerate = get_sample_rate(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 + 1;
+
+            *samplerate = get_sample_rate(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.old_format = hDecoder->config.useOldADTSFormat;
+            adts_frame(&adts, &ld);
+
+            hDecoder->sf_index = adts.sf_index;
+            hDecoder->object_type = adts.profile + 1;
+
+            *samplerate = get_sample_rate(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;
+
+#ifdef SBR_DEC
+    /* implicit signalling */
+    if (*samplerate <= 24000)
+    {
+        *samplerate *= 2;
+        hDecoder->forceUpSampling = 1;
+    }
+#endif
+
+    /* 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;
+
+    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;
+
+    if((hDecoder == NULL)
+        || (pBuffer == NULL)
+        || (SizeOfDecoderSpecificInfo < 2)
+        || (samplerate == NULL)
+        || (channels == NULL))
+    {
+        return -1;
+    }
+
+    hDecoder->adif_header_present = 0;
+    hDecoder->adts_header_present = 0;
+
+    /* 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;
+#ifdef ERROR_RESILIENCE
+    hDecoder->aacSectionDataResilienceFlag = mp4ASC.aacSectionDataResilienceFlag;
+    hDecoder->aacScalefactorDataResilienceFlag = mp4ASC.aacScalefactorDataResilienceFlag;
+    hDecoder->aacSpectralDataResilienceFlag = mp4ASC.aacSpectralDataResilienceFlag;
+#endif
+#ifdef SBR_DEC
+    hDecoder->sbr_present_flag = mp4ASC.sbr_present_flag;
+    hDecoder->forceUpSampling = mp4ASC.forceUpSampling;
+
+    /* AAC core decoder samplerate is 2 times as low */
+    if (hDecoder->sbr_present_flag == 1 || hDecoder->forceUpSampling == 1)
+    {
+        hDecoder->sf_index = get_sr_index(mp4ASC.samplingFrequency / 2);
+    }
+#endif
+
+    if (rc != 0)
+    {
+        return rc;
+    }
+    hDecoder->channelConfiguration = mp4ASC.channelsConfiguration;
+    if (mp4ASC.frameLengthFlag)
+#ifdef ALLOW_SMALL_FRAMELENGTH
+        hDecoder->frameLength = 960;
+#else
+        return -1;
+#endif
+
+    /* 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
+
+    return 0;
+}
+
+#ifdef DRM
+int8_t FAADAPI faacDecInitDRM(faacDecHandle hDecoder, uint32_t samplerate,
+                              uint8_t channels)
+{
+    uint8_t i;
+
+    /* Special object type defined for DRM */
+    hDecoder->config.defObjectType = DRM_ER_LC;
+
+    hDecoder->config.defSampleRate = samplerate;
+#ifdef ERROR_RESILIENCE // This shoudl always be defined for DRM
+    hDecoder->aacSectionDataResilienceFlag = 1; /* VCB11 */
+    hDecoder->aacScalefactorDataResilienceFlag = 0; /* no RVLC */
+    hDecoder->aacSpectralDataResilienceFlag = 1; /* HCR */
+#endif
+    hDecoder->frameLength = 960;
+    hDecoder->sf_index = get_sr_index(hDecoder->config.defSampleRate);
+    hDecoder->object_type = hDecoder->config.defObjectType;
+
+    if ((channels == DRMCH_STEREO) || (channels == DRMCH_SBR_STEREO))
+        hDecoder->channelConfiguration = 2;
+    else
+        hDecoder->channelConfiguration = 1;
+
+#ifdef SBR_DEC
+    if (channels == DRMCH_SBR_LC_STEREO)
+        hDecoder->lcstereo_flag = 1;
+    else
+        hDecoder->lcstereo_flag = 0;
+
+    if ((channels == DRMCH_MONO) || (channels == DRMCH_STEREO))
+        hDecoder->sbr_present_flag = 0;
+    else
+        hDecoder->sbr_present_flag = 1;
+
+    /* Reset sbr for new initialization */
+    sbrDecodeEnd(hDecoder->sbr[0]);
+    hDecoder->sbr[0] = NULL;
+#endif
+
+    /* must be done before frameLength is divided by 2 for LD */
+    hDecoder->fb = filter_bank_init(hDecoder->frameLength);
+
+    /* Take care of buffers */
+    if (hDecoder->sample_buffer) free(hDecoder->sample_buffer);
+    hDecoder->sample_buffer = NULL;
+
+    for (i = 0; i < MAX_CHANNELS; i++)
+    {
+        hDecoder->window_shape_prev[i] = 0;
+
+        if (hDecoder->time_out[i]) free(hDecoder->time_out[i]);
+        hDecoder->time_out[i] = NULL;
+#ifdef SBR_DEC
+        if (hDecoder->time_out2[i]) free(hDecoder->time_out2[i]);
+        hDecoder->time_out2[i] = NULL;
+#endif
+#ifdef SSR_DEC
+        if (hDecoder->ssr_overlap[i]) free(hDecoder->ssr_overlap[i]);
+        hDecoder->ssr_overlap[i] = NULL;
+        if (hDecoder->prev_fmd[i]) free(hDecoder->prev_fmd[i]);
+        hDecoder->prev_fmd[i] = NULL;
+#endif
+#ifdef MAIN_DEC
+        if (hDecoder->pred_stat[i]) free(hDecoder->pred_stat[i]);
+        hDecoder->pred_stat[i] = NULL;
+#endif
+#ifdef LTP_DEC
+        hDecoder->ltp_lag[i] = 0;
+        if (hDecoder->lt_pred_stat[i]) free(hDecoder->lt_pred_stat[i]);
+        hDecoder->lt_pred_stat[i] = NULL;
+#endif
+    }
+
+    return 0;
+}
+#endif
+
+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;
+    }
+}
+
+static 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)
+{
+    adts_header adts;
+    uint8_t channels = 0, ch_ele = 0;
+    uint8_t output_channels = 0;
+    bitfile ld;
+    uint32_t bitsconsumed;
+#ifdef DRM
+    uint8_t *revbuffer;
+    uint8_t *prevbufstart;
+    uint8_t *pbufend;
+#endif
+
+    /* local copy of globals */
+    uint8_t sf_index, object_type, channelConfiguration, outputFormat;
+    uint8_t *window_shape_prev;
+    uint16_t frame_len;
+#ifdef MAIN_DEC
+    pred_state **pred_stat;
+#endif
+    real_t **time_out;
+#ifdef SBR_DEC
+    real_t **time_out2;
+#endif
+#ifdef SSR_DEC
+    real_t **ssr_overlap, **prev_fmd;
+#endif
+    fb_info *fb;
+    drc_info *drc;
+    program_config *pce;
+
+    void *sample_buffer;
+
+    /* safety checks */
+    if ((hDecoder == NULL) || (hInfo == NULL) || (buffer == NULL))
+    {
+        return NULL;
+    }
+
+    sf_index = hDecoder->sf_index;
+    object_type = hDecoder->object_type;
+    channelConfiguration = hDecoder->channelConfiguration;
+#ifdef MAIN_DEC
+    pred_stat = hDecoder->pred_stat;
+#endif
+    window_shape_prev = hDecoder->window_shape_prev;
+    time_out = hDecoder->time_out;
+#ifdef SBR_DEC
+    time_out2 = hDecoder->time_out2;
+#endif
+#ifdef SSR_DEC
+    ssr_overlap = hDecoder->ssr_overlap;
+    prev_fmd = hDecoder->prev_fmd;
+#endif
+    fb = hDecoder->fb;
+    drc = hDecoder->drc;
+    outputFormat = hDecoder->config.outputFormat;
+    pce = &hDecoder->pce;
+    frame_len = hDecoder->frameLength;
+
+
+    memset(hInfo, 0, sizeof(faacDecFrameInfo));
+    memset(hDecoder->internal_channel, 0, MAX_CHANNELS*sizeof(hDecoder->internal_channel[0]));
+
+    /* 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)
+    {
+        adts.old_format = hDecoder->config.useOldADTSFormat;
+        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
+
+    /* decode the complete bitstream */
+    raw_data_block(hDecoder, hInfo, &ld, pce, drc);
+
+    ch_ele = hDecoder->fr_ch_ele;
+    channels = hDecoder->fr_channels;
+
+    if (hInfo->error > 0)
+        goto error;
+
+
+    /* no more bit reading after this */
+    bitsconsumed = faad_get_processed_bits(&ld);
+    hInfo->bytesconsumed = bit2byte(bitsconsumed);
+    if (ld.error)
+    {
+        hInfo->error = 14;
+        goto error;
+    }
+    faad_endbits(&ld);
+
+#ifdef DRM
+#ifdef SBR_DEC
+    if ((hDecoder->sbr_present_flag == 1) && (hDecoder->object_type == DRM_ER_LC))
+    {
+        int32_t i;
+
+        if (bitsconsumed + 8 > buffer_size*8)
+        {
+            hInfo->error = 14;
+            goto error;
+        }
+
+        hDecoder->sbr_used[0] = 1;
+
+        if (!hDecoder->sbr[0])
+            hDecoder->sbr[0] = sbrDecodeInit(hDecoder->frameLength, 1);
+
+        /* Reverse bit reading of SBR data in DRM audio frame */
+        revbuffer = (uint8_t*)malloc(buffer_size*sizeof(uint8_t));
+        prevbufstart = revbuffer;
+        pbufend = &buffer[buffer_size - 1];
+        for (i = 0; i < buffer_size; i++)
+            *prevbufstart++ = tabFlipbits[*pbufend--];
+
+        /* Set SBR data */
+        hDecoder->sbr[0]->data = revbuffer;
+        /* consider 8 bits from AAC-CRC */
+        hDecoder->sbr[0]->data_size_bits = buffer_size*8 - bitsconsumed - 8;
+        hDecoder->sbr[0]->data_size =
+            bit2byte(hDecoder->sbr[0]->data_size_bits + 8);
+
+        hDecoder->sbr[0]->lcstereo_flag = hDecoder->lcstereo_flag;
+
+        hDecoder->sbr[0]->sample_rate = get_sample_rate(hDecoder->sf_index);
+        hDecoder->sbr[0]->sample_rate *= 2;
+
+        hDecoder->sbr[0]->id_aac = hDecoder->element_id[0];
+    }
+#endif
+#endif
+
+    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 = get_sample_rate(hDecoder->sf_index);
+    /* object type */
+    hInfo->object_type = hDecoder->object_type;
+    /* sbr */
+    hInfo->sbr = NO_SBR;
+    /* header type */
+    hInfo->header_type = RAW;
+    if (hDecoder->adif_header_present)
+        hInfo->header_type = ADIF;
+    if (hDecoder->adts_header_present)
+        hInfo->header_type = ADTS;
+
+    /* check if frame has channel elements */
+    if (channels == 0)
+    {
+        hDecoder->frame++;
+        return NULL;
+    }
+
+    /* allocate the buffer for the final samples */
+    if (hDecoder->sample_buffer == NULL)
+    {
+        static const uint8_t str[] = { sizeof(int16_t), sizeof(int32_t), sizeof(int32_t),
+            sizeof(float32_t), sizeof(double), sizeof(int16_t), sizeof(int16_t),
+            sizeof(int16_t), sizeof(int16_t), 0, 0, 0
+        };
+        uint8_t stride = str[outputFormat-1];
+#ifdef SBR_DEC
+        if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+            stride = 2 * stride;
+#endif
+        hDecoder->sample_buffer = malloc(frame_len*channels*stride);
+    }
+
+    sample_buffer = hDecoder->sample_buffer;
+
+#ifdef SBR_DEC
+    if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+    {
+        uint8_t i, ch = 0;
+        for (i = 0; i < ch_ele; i++)
+        {
+            /* following case can happen when forceUpSampling == 1 */
+            if (hDecoder->sbr[i] == NULL)
+            {
+                hDecoder->sbr[i] = sbrDecodeInit(hDecoder->frameLength
+#ifdef DRM
+                    , 0
+#endif
+                    );
+                hDecoder->sbr[i]->data = NULL;
+                hDecoder->sbr[i]->data_size = 0;
+                hDecoder->sbr[i]->id_aac = hDecoder->element_id[i];
+            }
+
+            /* Allocate space for SBR output */
+            if (hDecoder->time_out2[ch] == NULL)
+            {
+                hDecoder->time_out2[ch] = (real_t*)malloc(hDecoder->frameLength*2*sizeof(real_t));
+                memset(hDecoder->time_out2[ch], 0, hDecoder->frameLength*2*sizeof(real_t));
+            }
+
+            if (hDecoder->sbr[i]->id_aac == ID_CPE)
+            {
+                /* space for 2 channels needed */
+                if (hDecoder->time_out2[ch+1] == NULL)
+                {
+                    hDecoder->time_out2[ch+1] = (real_t*)malloc(hDecoder->frameLength*2*sizeof(real_t));
+                    memset(hDecoder->time_out2[ch+1], 0, hDecoder->frameLength*2*sizeof(real_t));
+                }
+
+                memcpy(time_out2[ch],
+                    time_out[ch], frame_len*sizeof(real_t));
+                memcpy(time_out2[ch+1],
+                    time_out[ch+1], frame_len*sizeof(real_t));
+                sbrDecodeFrame(hDecoder->sbr[i],
+                    time_out2[ch], time_out2[ch+1],
+                    hDecoder->postSeekResetFlag, hDecoder->forceUpSampling);
+                ch += 2;
+            } else {
+                memcpy(time_out2[ch],
+                    time_out[ch], frame_len*sizeof(real_t));
+                sbrDecodeFrame(hDecoder->sbr[i],
+                    time_out2[ch], NULL,
+                    hDecoder->postSeekResetFlag, hDecoder->forceUpSampling);
+                ch++;
+            }
+        }
+        frame_len *= 2;
+        hInfo->samples *= 2;
+        hInfo->samplerate *= 2;
+        /* sbr */
+        if (hDecoder->sbr_present_flag == 1)
+        {
+            hInfo->object_type = HE_AAC;
+            hInfo->sbr = SBR_UPSAMPLED;
+        } else {
+            hInfo->sbr = NO_SBR_UPSAMPLED;
+        }
+
+        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
+
+    hDecoder->postSeekResetFlag = 0;
+
+    hDecoder->frame++;
+#ifdef LD_DEC
+    if (object_type != LD)
+    {
+#endif
+        if (hDecoder->frame <= 1)
+            hInfo->samples = 0;
+#ifdef LD_DEC
+    } else {
+        /* LD encoders will give lower delay */
+        if (hDecoder->frame <= 0)
+            hInfo->samples = 0;
+    }
+#endif
+
+    /* cleanup */
+#ifdef ANALYSIS
+    fflush(stdout);
+#endif
+
+    return sample_buffer;
+
+error:
+    /* cleanup */
+#ifdef ANALYSIS
+    fflush(stdout);
+#endif
+
+    return NULL;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/decoder.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,122 @@
+/*
+** 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.33 2003/11/12 20:47:57 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 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 faacDecPostSeekReset(faacDecHandle hDecoder, int32_t frame);
+
+void* FAADAPI faacDecDecode(faacDecHandle hDecoder,
+                            faacDecFrameInfo *hInfo,
+                            uint8_t *buffer,
+                            uint32_t buffer_size);
+
+#ifdef _WIN32
+  #pragma pack(pop)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/drc.c	Mon Oct 24 10:44:27 2005 -0700
@@ -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.19 2003/11/12 20:47:57 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))/REAL_CONST(24.0);
+        else /* boost */
+            exp = drc->ctrl2 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/REAL_CONST(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_R(spec[i],drc_pow2_table[frac+23]);
+            }
+        } else {
+            for (i = bottom; i < top; i++)
+            {
+                spec[i] <<= exp;
+                if (frac)
+                    spec[i] = MUL_R(spec[i],drc_pow2_table[frac+23]);
+            }
+        }
+#endif
+
+        bottom = top;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/drc.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.13 2003/11/12 20:47:57 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/Input/aac/libfaad2/error.c	Mon Oct 24 10:44:27 2005 -0700
@@ -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.16 2003/11/12 20:47:57 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/Input/aac/libfaad2/error.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.11 2003/11/12 20:47:57 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/Input/aac/libfaad2/filtbank.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,344 @@
+/*
+** 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.32 2003/11/12 20:47:57 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
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+    if (frame_len == 1024)
+    {
+#endif
+        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
+#ifdef ALLOW_SMALL_FRAMELENGTH
+    } 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
+    }
+#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[2*1024] = {0};
+
+    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;
+
+#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 = 0; i < nlong; i+=4)
+        {
+            time_out[i]   = time_out[nlong+i]   + MUL_F(transf_buf[i],window_long_prev[i]);
+            time_out[i+1] = time_out[nlong+i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]);
+            time_out[i+2] = time_out[nlong+i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]);
+            time_out[i+3] = time_out[nlong+i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]);
+        }
+        for (i = 0; i < nlong; i+=4)
+        {
+            time_out[nlong+i]   = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]);
+            time_out[nlong+i+1] = MUL_F(transf_buf[nlong+i+1],window_long[nlong-2-i]);
+            time_out[nlong+i+2] = MUL_F(transf_buf[nlong+i+2],window_long[nlong-3-i]);
+            time_out[nlong+i+3] = MUL_F(transf_buf[nlong+i+3],window_long[nlong-4-i]);
+        }
+        break;
+
+    case LONG_START_SEQUENCE:
+        imdct(fb, freq_in, transf_buf, 2*nlong);
+        for (i = 0; i < nlong; i+=4)
+        {
+            time_out[i]   = time_out[nlong+i]   + MUL_F(transf_buf[i],window_long_prev[i]);
+            time_out[i+1] = time_out[nlong+i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]);
+            time_out[i+2] = time_out[nlong+i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]);
+            time_out[i+3] = time_out[nlong+i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]);
+        }
+        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_F(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_F(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_F(transf_buf[nshort*1+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*2+i],window_short[i]);
+            time_out[nflat_ls+2*nshort+i] = time_out[nlong+nflat_ls+nshort*2+i] + MUL_F(transf_buf[nshort*3+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*4+i],window_short[i]);
+            time_out[nflat_ls+3*nshort+i] = time_out[nlong+nflat_ls+nshort*3+i] + MUL_F(transf_buf[nshort*5+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*6+i],window_short[i]);
+            if (i < trans)
+                time_out[nflat_ls+4*nshort+i] = time_out[nlong+nflat_ls+nshort*4+i] + MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]);
+            else
+                time_out[nflat_ls+4*nshort+i] = MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]);
+            time_out[nflat_ls+5*nshort+i] = MUL_F(transf_buf[nshort*9+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*10+i],window_short[i]);
+            time_out[nflat_ls+6*nshort+i] = MUL_F(transf_buf[nshort*11+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*12+i],window_short[i]);
+            time_out[nflat_ls+7*nshort+i] = MUL_F(transf_buf[nshort*13+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*14+i],window_short[i]);
+            time_out[nflat_ls+8*nshort+i] = MUL_F(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_F(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_F(transf_buf[nlong+i],window_long[nlong-1-i]);
+		break;
+    }
+}
+
+#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[2*1024] = {0};
+
+    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);
+
+#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_F(in_data[i], window_long_prev[i]);
+            windowed_buf[i+nlong] = MUL_F(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_F(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_F(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_F(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_F(in_data[i+nlong], window_long[nlong-1-i]);
+        mdct(fb, windowed_buf, out_mdct, 2*nlong);
+        break;
+    }
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/filtbank.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,62 @@
+/*
+** 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.17 2003/11/12 20:47:57 menno Exp $
+**/
+
+#ifndef __FILTBANK_H__
+#define __FILTBANK_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+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/Input/aac/libfaad2/fixed.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,194 @@
+/*
+** 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.15 2003/11/12 20:47:57 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 14 // MAXIMUM OF 14 FOR FIXED POINT SBR
+#define REAL_PRECISION (1 << REAL_BITS)
+
+/* FRAC is the fractional only part of the fixed point number [0.0..1.0) */
+#define FRAC_SIZE 32 /* frac is a 32 bit integer */
+#define FRAC_BITS 31
+#define FRAC_PRECISION ((uint32_t)(1 << FRAC_BITS))
+#define FRAC_MAX 0x7FFFFFFF
+
+typedef int32_t real_t;
+
+
+#define REAL_CONST(A) (((A) >= 0) ? ((real_t)((A)*(REAL_PRECISION)+0.5)) : ((real_t)((A)*(REAL_PRECISION)-0.5)))
+#define COEF_CONST(A) (((A) >= 0) ? ((real_t)((A)*(COEF_PRECISION)+0.5)) : ((real_t)((A)*(COEF_PRECISION)-0.5)))
+#define FRAC_CONST(A) (((A) == 1.00) ? ((real_t)FRAC_MAX) : (((A) >= 0) ? ((real_t)((A)*(FRAC_PRECISION)+0.5)) : ((real_t)((A)*(FRAC_PRECISION)-0.5))))
+
+#if defined(_WIN32) && !defined(_WIN32_WCE)
+
+/* multiply with real shift */
+static INLINE real_t MUL_R(real_t A, real_t B)
+{
+    _asm {
+        mov eax,A
+        imul B
+        shrd eax,edx,REAL_BITS
+    }
+}
+
+/* multiply with coef shift */
+static INLINE real_t MUL_C(real_t A, real_t B)
+{
+    _asm {
+        mov eax,A
+        imul B
+        shrd eax,edx,COEF_BITS
+    }
+}
+
+static INLINE real_t _MulHigh(real_t A, real_t B)
+{
+    _asm {
+        mov eax,A
+        imul B
+        mov eax,edx
+    }
+}
+
+/* multiply with fractional shift */
+static INLINE real_t MUL_F(real_t A, real_t B)
+{
+    return _MulHigh(A,B) << (FRAC_SIZE-FRAC_BITS);
+}
+
+/* Complex multiplication */
+static INLINE void ComplexMult(real_t *y1, real_t *y2,
+    real_t x1, real_t x2, real_t c1, real_t c2)
+{
+    *y1 = (_MulHigh(x1, c1) + _MulHigh(x2, c2))<<(FRAC_SIZE-FRAC_BITS);
+    *y2 = (_MulHigh(x2, c1) - _MulHigh(x1, c2))<<(FRAC_SIZE-FRAC_BITS);
+}
+
+#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_R(real_t A, real_t B)
+{
+    return arm_mul(A, B, REAL_BITS);
+}
+
+static INLINE real_t MUL_C(real_t A, real_t B)
+{
+    return arm_mul(A, B, COEF_BITS);
+}
+
+static INLINE real_t _MulHigh(real_t x, real_t y)
+{
+    uint32_t __lo;
+    uint32_t __hi;
+    asm("smull\t%0, %1, %2, %3"
+        : "=&r"(__lo),"=&r"(__hi)
+        : "%r"(x),"r"(y)
+        : "cc");
+    return __hi;
+}
+
+static INLINE real_t MUL_F(real_t A, real_t B)
+{
+    return _MulHigh(A, B) << (FRAC_SIZE-FRAC_BITS);
+}
+
+/* Complex multiplication */
+static INLINE void ComplexMult(real_t *y1, real_t *y2,
+    real_t x1, real_t x2, real_t c1, real_t c2)
+{
+    int32_t tmp, yt1, yt2;
+    asm("smull %0, %1, %4, %6\n\t"
+        "smlal %0, %1, %5, %7\n\t"
+        "rsb   %3, %4, #0\n\t"
+        "smull %0, %2, %5, %6\n\t"
+        "smlal %0, %2, %3, %7"
+        : "=&r" (tmp), "=&r" (yt1), "=&r" (yt2), "=r" (x1)
+        : "3" (x1), "r" (x2), "r" (c1), "r" (c2)
+        : "cc" );
+    *y1 = yt1 << (FRAC_SIZE-FRAC_BITS);
+    *y2 = yt2 << (FRAC_SIZE-FRAC_BITS);
+}
+
+#else
+
+  /* multiply with real shift */
+  #define MUL_R(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (REAL_BITS-1))) >> REAL_BITS)
+  /* multiply with coef shift */
+  #define MUL_C(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (COEF_BITS-1))) >> COEF_BITS)
+  /* multiply with fractional shift */
+#ifndef _WIN32_WCE
+  #define _MulHigh(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_SIZE-1))) >> FRAC_SIZE)
+  #define MUL_F(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_BITS-1))) >> FRAC_BITS)
+#else
+  /* eVC for PocketPC has an intrinsic function that returns only the high 32 bits of a 32x32 bit multiply */
+  #include <cmnintrin.h>
+  static INLINE real_t MUL_F(real_t A, real_t B)
+  {
+      return _MulHigh(A,B) << (32-FRAC_BITS);
+  }
+#endif
+
+/* Complex multiplication */
+static INLINE void ComplexMult(real_t *y1, real_t *y2,
+    real_t x1, real_t x2, real_t c1, real_t c2)
+{
+    *y1 = (_MulHigh(x1, c1) + _MulHigh(x2, c2))<<(FRAC_SIZE-FRAC_BITS);
+    *y2 = (_MulHigh(x2, c1) - _MulHigh(x1, c2))<<(FRAC_SIZE-FRAC_BITS);
+}
+
+#endif
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/hcr.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,413 @@
+/*
+** 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.11 2003/11/12 20:47:57 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 "huffman.h"
+
+/* Implements the HCR11 tool as described in ISO/IEC 14496-3/Amd.1, 8.5.3.3 */
+
+#ifdef ERROR_RESILIENCE
+
+/* 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_hcr(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_hcr(a, a->len );
+        hwa = 0;
+    }
+    if (b->len >=32) {
+        lwb = b->bufa;
+        hwb = (b->bufb & (0xFFFFFFFF >> (64 - b->len)) ) | ( lwa << (b->len - 32));
+    } else {
+        lwb = showbits_hcr(b, b->len ) | (lwa << (b->len));
+        hwb = (lwa >> (32 - b->len)) | (hwa << (b->len));
+    }
+
+    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_hcr(&Segment[ numberOfSegments-1 ], Segment[ numberOfSegments-1 ].len - 32);
+                                                    Segment[ numberOfSegments-1 ].bufa = lw + 
+                                                        showbits_hcr(&Segment[ numberOfSegments-1 ], 32);
+                                                } else {
+                                                    Segment[ numberOfSegments-1 ].bufa = lw + 
+                                                        showbits_hcr(&Segment[ numberOfSegments-1 ], Segment[ numberOfSegments-1 ].len);
+                                                    Segment[ numberOfSegments-1 ].bufb = hw;
+                                                }
+                                                Segment[ numberOfSegments-1 ].len += additional_bits;
+                                            }
+                                            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/Input/aac/libfaad2/huffman.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,503 @@
+/*
+** 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.c,v 1.9 2003/11/12 20:47:57 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+#ifdef ANALYSIS
+#include <stdio.h>
+#endif
+
+#include "bits.h"
+#include "huffman.h"
+#include "codebook/hcb.h"
+
+
+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;
+}
+
+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 ERROR_RESILIENCE
+
+/* Special version of huffman_spectral_data
+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 */
+
+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_hcr(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_hcr(ld, hcbN[cb]) ) return -1;
+            offset += (uint16_t)showbits_hcr(ld, extra_bits);
+            if ( flushbits_hcr(ld, hcb_2_quad_table[cb][offset].bits - hcbN[cb]) ) return -1;
+        } else {
+            if ( flushbits_hcr(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_hcr(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_hcr(ld, hcbN[cb]) ) return -1;
+            offset += (uint16_t)showbits_hcr(ld, extra_bits);
+            if ( flushbits_hcr(ld, hcb_2_pair_table[cb][offset].bits - hcbN[cb]) ) return -1;
+        } else {
+            if ( flushbits_hcr(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_hcr(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_hcr(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_hcr(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_hcr(ld, &b))
+                        return -1;
+                    if (b == 0)
+                        break;
+                }
+// TODO: here we would need to test "off" if VCB11 is used!
+                if (getbits_hcr(ld, i, &off))
+                    return -1;
+                j = off + (1<<i);
+                sp[k] = (int16_t)((neg) ? -j : j);
+            }
+        }
+    }    
+    return ld->len;
+}
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/huffman.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,57 @@
+/*
+** 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.19 2003/11/12 20:47:57 menno Exp $
+**/
+
+#ifndef __HUFFMAN_H__
+#define __HUFFMAN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len);
+static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp);
+static uint8_t huffman_2step_quad(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp);
+static huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp);
+static int16_t huffman_codebook(uint8_t i);
+
+int8_t huffman_scale_factor(bitfile *ld);
+uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp);
+#ifdef ERROR_RESILIENCE
+int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/ic_predict.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,267 @@
+/*
+** 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.18 2003/11/12 20:47:57 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(float32_t *pf)
+{
+    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 = *(float32_t*)&tmp1 + *(float32_t*)&tmp2 - *(float32_t*)&tmp;
+    } else {
+        *pf = *(float32_t*)&tmp;
+    }
+}
+
+static int16_t quant_pred(float32_t x)
+{
+    int16_t q;
+    uint32_t *tmp = (uint32_t*)&x;
+
+    q = (int16_t)(*tmp>>16);
+
+    return q;
+}
+
+static float32_t inv_quant_pred(int16_t q)
+{
+    float32_t x;
+    uint32_t *tmp = (uint32_t*)&x;
+    *tmp = ((uint32_t)q)<<16;
+
+    return x;
+}
+
+static void ic_predict(pred_state *state, real_t input, real_t *output, uint8_t pred)
+{
+    uint32_t tmp;
+    int16_t i, j;
+    real_t dr1, predictedvalue;
+    real_t e0, e1;
+    real_t k1, k2;
+
+    real_t r[2];
+    real_t COR[2];
+    real_t VAR[2];
+
+    r[0] = inv_quant_pred(state->r[0]);
+    r[1] = inv_quant_pred(state->r[1]);
+    COR[0] = inv_quant_pred(state->COR[0]);
+    COR[1] = inv_quant_pred(state->COR[1]);
+    VAR[0] = inv_quant_pred(state->VAR[0]);
+    VAR[1] = inv_quant_pred(state->VAR[1]);
+
+
+#if 1
+    tmp = state->VAR[0];
+    j = (tmp >> 7);
+    i = tmp & 0x7f;
+    if (j >= 128)
+    {
+        j -= 128;
+        k1 = COR[0] * exp_table[j] * mnt_table[i];
+    } else {
+        k1 = REAL_CONST(0);
+    }
+#else
+
+    {
+#define B 0.953125
+        real_t c = COR[0];
+        real_t v = VAR[0];
+        real_t tmp;
+        if (c == 0 || v <= 1)
+        {
+            k1 = 0;
+        } else {
+            tmp = B / v;
+            flt_round(&tmp);
+            k1 = c * tmp;
+        }
+    }
+#endif
+
+    if (pred)
+    {
+#if 1
+        tmp = state->VAR[1];
+        j = (tmp >> 7);
+        i = tmp & 0x7f;
+        if (j >= 128)
+        {
+            j -= 128;
+            k2 = COR[1] * exp_table[j] * mnt_table[i];
+        } else {
+            k2 = REAL_CONST(0);
+        }
+#else
+
+#define B 0.953125
+        real_t c = COR[1];
+        real_t v = VAR[1];
+        real_t tmp;
+        if (c == 0 || v <= 1)
+        {
+            k2 = 0;
+        } else {
+            tmp = B / v;
+            flt_round(&tmp);
+            k2 = c * tmp;
+        }
+#endif
+
+        predictedvalue = k1*r[0] + k2*r[1];
+        flt_round(&predictedvalue);
+        *output = input + predictedvalue;
+    }
+
+    /* calculate new state data */
+    e0 = *output;
+    e1 = e0 - k1*r[0];
+    dr1 = k1*e0;
+
+    VAR[0] = ALPHA*VAR[0] + 0.5f * (r[0]*r[0] + e0*e0);
+    COR[0] = ALPHA*COR[0] + r[0]*e0;
+    VAR[1] = ALPHA*VAR[1] + 0.5f * (r[1]*r[1] + e1*e1);
+    COR[1] = ALPHA*COR[1] + r[1]*e1;
+
+    r[1] = A * (r[0]-dr1);
+    r[0] = A * e0;
+
+    state->r[0] = quant_pred(r[0]);
+    state->r[1] = quant_pred(r[1]);
+    state->COR[0] = quant_pred(COR[0]);
+    state->COR[1] = quant_pred(COR[1]);
+    state->VAR[0] = quant_pred(VAR[0]);
+    state->VAR[1] = quant_pred(VAR[1]);
+}
+
+static void reset_pred_state(pred_state *state)
+{
+    state->r[0]   = 0;
+    state->r[1]   = 0;
+    state->COR[0] = 0;
+    state->COR[1] = 0;
+    state->VAR[0] = 0x3F80;
+    state->VAR[1] = 0x3F80;
+}
+
+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 sf_index)
+{
+    uint8_t sfb;
+    uint16_t bin;
+
+    if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+    {
+        reset_all_predictors(state, frame_len);
+    } else {
+        for (sfb = 0; sfb < max_pred_sfb(sf_index); 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/Input/aac/libfaad2/ic_predict.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,249 @@
+/*
+** 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.14 2003/11/12 20:47:57 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)
+
+
+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, uint8_t sf_index);
+
+static const real_t mnt_table[128] = {
+    COEF_CONST(0.9531250000), COEF_CONST(0.9453125000),
+    COEF_CONST(0.9375000000), COEF_CONST(0.9296875000),
+    COEF_CONST(0.9257812500), COEF_CONST(0.9179687500),
+    COEF_CONST(0.9101562500), COEF_CONST(0.9023437500),
+    COEF_CONST(0.8984375000), COEF_CONST(0.8906250000),
+    COEF_CONST(0.8828125000), COEF_CONST(0.8789062500),
+    COEF_CONST(0.8710937500), COEF_CONST(0.8671875000),
+    COEF_CONST(0.8593750000), COEF_CONST(0.8515625000),
+    COEF_CONST(0.8476562500), COEF_CONST(0.8398437500),
+    COEF_CONST(0.8359375000), COEF_CONST(0.8281250000),
+    COEF_CONST(0.8242187500), COEF_CONST(0.8203125000),
+    COEF_CONST(0.8125000000), COEF_CONST(0.8085937500),
+    COEF_CONST(0.8007812500), COEF_CONST(0.7968750000),
+    COEF_CONST(0.7929687500), COEF_CONST(0.7851562500),
+    COEF_CONST(0.7812500000), COEF_CONST(0.7773437500),
+    COEF_CONST(0.7734375000), COEF_CONST(0.7656250000),
+    COEF_CONST(0.7617187500), COEF_CONST(0.7578125000),
+    COEF_CONST(0.7539062500), COEF_CONST(0.7500000000),
+    COEF_CONST(0.7421875000), COEF_CONST(0.7382812500),
+    COEF_CONST(0.7343750000), COEF_CONST(0.7304687500),
+    COEF_CONST(0.7265625000), COEF_CONST(0.7226562500),
+    COEF_CONST(0.7187500000), COEF_CONST(0.7148437500),
+    COEF_CONST(0.7109375000), COEF_CONST(0.7070312500),
+    COEF_CONST(0.6992187500), COEF_CONST(0.6953125000),
+    COEF_CONST(0.6914062500), COEF_CONST(0.6875000000),
+    COEF_CONST(0.6835937500), COEF_CONST(0.6796875000),
+    COEF_CONST(0.6796875000), COEF_CONST(0.6757812500),
+    COEF_CONST(0.6718750000), COEF_CONST(0.6679687500),
+    COEF_CONST(0.6640625000), COEF_CONST(0.6601562500),
+    COEF_CONST(0.6562500000), COEF_CONST(0.6523437500),
+    COEF_CONST(0.6484375000), COEF_CONST(0.6445312500),
+    COEF_CONST(0.6406250000), COEF_CONST(0.6406250000),
+    COEF_CONST(0.6367187500), COEF_CONST(0.6328125000),
+    COEF_CONST(0.6289062500), COEF_CONST(0.6250000000),
+    COEF_CONST(0.6210937500), COEF_CONST(0.6210937500),
+    COEF_CONST(0.6171875000), COEF_CONST(0.6132812500),
+    COEF_CONST(0.6093750000), COEF_CONST(0.6054687500),
+    COEF_CONST(0.6054687500), COEF_CONST(0.6015625000),
+    COEF_CONST(0.5976562500), COEF_CONST(0.5937500000),
+    COEF_CONST(0.5937500000), COEF_CONST(0.5898437500),
+    COEF_CONST(0.5859375000), COEF_CONST(0.5820312500),
+    COEF_CONST(0.5820312500), COEF_CONST(0.5781250000),
+    COEF_CONST(0.5742187500), COEF_CONST(0.5742187500),
+    COEF_CONST(0.5703125000), COEF_CONST(0.5664062500),
+    COEF_CONST(0.5664062500), COEF_CONST(0.5625000000),
+    COEF_CONST(0.5585937500), COEF_CONST(0.5585937500),
+    COEF_CONST(0.5546875000), COEF_CONST(0.5507812500),
+    COEF_CONST(0.5507812500), COEF_CONST(0.5468750000),
+    COEF_CONST(0.5429687500), COEF_CONST(0.5429687500),
+    COEF_CONST(0.5390625000), COEF_CONST(0.5390625000),
+    COEF_CONST(0.5351562500), COEF_CONST(0.5312500000),
+    COEF_CONST(0.5312500000), COEF_CONST(0.5273437500),
+    COEF_CONST(0.5273437500), COEF_CONST(0.5234375000),
+    COEF_CONST(0.5195312500), COEF_CONST(0.5195312500),
+    COEF_CONST(0.5156250000), COEF_CONST(0.5156250000),
+    COEF_CONST(0.5117187500), COEF_CONST(0.5117187500),
+    COEF_CONST(0.5078125000), COEF_CONST(0.5078125000),
+    COEF_CONST(0.5039062500), COEF_CONST(0.5039062500),
+    COEF_CONST(0.5000000000), COEF_CONST(0.4980468750),
+    COEF_CONST(0.4960937500), COEF_CONST(0.4941406250),
+    COEF_CONST(0.4921875000), COEF_CONST(0.4902343750),
+    COEF_CONST(0.4882812500), COEF_CONST(0.4863281250),
+    COEF_CONST(0.4843750000), COEF_CONST(0.4824218750),
+    COEF_CONST(0.4804687500), COEF_CONST(0.4785156250)
+};
+
+static const real_t exp_table[128] = {
+    COEF_CONST(0.50000000000000000000000000000000000000000000000000),
+    COEF_CONST(0.25000000000000000000000000000000000000000000000000),
+    COEF_CONST(0.12500000000000000000000000000000000000000000000000),
+    COEF_CONST(0.06250000000000000000000000000000000000000000000000),
+    COEF_CONST(0.03125000000000000000000000000000000000000000000000),
+    COEF_CONST(0.01562500000000000000000000000000000000000000000000),
+    COEF_CONST(0.00781250000000000000000000000000000000000000000000),
+    COEF_CONST(0.00390625000000000000000000000000000000000000000000),
+    COEF_CONST(0.00195312500000000000000000000000000000000000000000),
+    COEF_CONST(0.00097656250000000000000000000000000000000000000000),
+    COEF_CONST(0.00048828125000000000000000000000000000000000000000),
+    COEF_CONST(0.00024414062500000000000000000000000000000000000000),
+    COEF_CONST(0.00012207031250000000000000000000000000000000000000),
+    COEF_CONST(0.00006103515625000000000000000000000000000000000000),
+    COEF_CONST(0.00003051757812500000000000000000000000000000000000),
+    COEF_CONST(0.00001525878906250000000000000000000000000000000000),
+    COEF_CONST(0.00000762939453125000000000000000000000000000000000),
+    COEF_CONST(0.00000381469726562500000000000000000000000000000000),
+    COEF_CONST(0.00000190734863281250000000000000000000000000000000),
+    COEF_CONST(0.00000095367431640625000000000000000000000000000000),
+    COEF_CONST(0.00000047683715820312500000000000000000000000000000),
+    COEF_CONST(0.00000023841857910156250000000000000000000000000000),
+    COEF_CONST(0.00000011920928955078125000000000000000000000000000),
+    COEF_CONST(0.00000005960464477539062500000000000000000000000000),
+    COEF_CONST(0.00000002980232238769531300000000000000000000000000),
+    COEF_CONST(0.00000001490116119384765600000000000000000000000000),
+    COEF_CONST(0.00000000745058059692382810000000000000000000000000),
+    COEF_CONST(0.00000000372529029846191410000000000000000000000000),
+    COEF_CONST(0.00000000186264514923095700000000000000000000000000),
+    COEF_CONST(0.00000000093132257461547852000000000000000000000000),
+    COEF_CONST(0.00000000046566128730773926000000000000000000000000),
+    COEF_CONST(0.00000000023283064365386963000000000000000000000000),
+    COEF_CONST(0.00000000011641532182693481000000000000000000000000),
+    COEF_CONST(0.00000000005820766091346740700000000000000000000000),
+    COEF_CONST(0.00000000002910383045673370400000000000000000000000),
+    COEF_CONST(0.00000000001455191522836685200000000000000000000000),
+    COEF_CONST(0.00000000000727595761418342590000000000000000000000),
+    COEF_CONST(0.00000000000363797880709171300000000000000000000000),
+    COEF_CONST(0.00000000000181898940354585650000000000000000000000),
+    COEF_CONST(0.00000000000090949470177292824000000000000000000000),
+    COEF_CONST(0.00000000000045474735088646412000000000000000000000),
+    COEF_CONST(0.00000000000022737367544323206000000000000000000000),
+    COEF_CONST(0.00000000000011368683772161603000000000000000000000),
+    COEF_CONST(0.00000000000005684341886080801500000000000000000000),
+    COEF_CONST(0.00000000000002842170943040400700000000000000000000),
+    COEF_CONST(0.00000000000001421085471520200400000000000000000000),
+    COEF_CONST(0.00000000000000710542735760100190000000000000000000),
+    COEF_CONST(0.00000000000000355271367880050090000000000000000000),
+    COEF_CONST(0.00000000000000177635683940025050000000000000000000),
+    COEF_CONST(0.00000000000000088817841970012523000000000000000000),
+    COEF_CONST(0.00000000000000044408920985006262000000000000000000),
+    COEF_CONST(0.00000000000000022204460492503131000000000000000000),
+    COEF_CONST(0.00000000000000011102230246251565000000000000000000),
+    COEF_CONST(0.00000000000000005551115123125782700000000000000000),
+    COEF_CONST(0.00000000000000002775557561562891400000000000000000),
+    COEF_CONST(0.00000000000000001387778780781445700000000000000000),
+    COEF_CONST(0.00000000000000000693889390390722840000000000000000),
+    COEF_CONST(0.00000000000000000346944695195361420000000000000000),
+    COEF_CONST(0.00000000000000000173472347597680710000000000000000),
+    COEF_CONST(0.00000000000000000086736173798840355000000000000000),
+    COEF_CONST(0.00000000000000000043368086899420177000000000000000),
+    COEF_CONST(0.00000000000000000021684043449710089000000000000000),
+    COEF_CONST(0.00000000000000000010842021724855044000000000000000),
+    COEF_CONST(0.00000000000000000005421010862427522200000000000000),
+    COEF_CONST(0.00000000000000000002710505431213761100000000000000),
+    COEF_CONST(0.00000000000000000001355252715606880500000000000000),
+    COEF_CONST(0.00000000000000000000677626357803440270000000000000),
+    COEF_CONST(0.00000000000000000000338813178901720140000000000000),
+    COEF_CONST(0.00000000000000000000169406589450860070000000000000),
+    COEF_CONST(0.00000000000000000000084703294725430034000000000000),
+    COEF_CONST(0.00000000000000000000042351647362715017000000000000),
+    COEF_CONST(0.00000000000000000000021175823681357508000000000000),
+    COEF_CONST(0.00000000000000000000010587911840678754000000000000),
+    COEF_CONST(0.00000000000000000000005293955920339377100000000000),
+    COEF_CONST(0.00000000000000000000002646977960169688600000000000),
+    COEF_CONST(0.00000000000000000000001323488980084844300000000000),
+    COEF_CONST(0.00000000000000000000000661744490042422140000000000),
+    COEF_CONST(0.00000000000000000000000330872245021211070000000000),
+    COEF_CONST(0.00000000000000000000000165436122510605530000000000),
+    COEF_CONST(0.00000000000000000000000082718061255302767000000000),
+    COEF_CONST(0.00000000000000000000000041359030627651384000000000),
+    COEF_CONST(0.00000000000000000000000020679515313825692000000000),
+    COEF_CONST(0.00000000000000000000000010339757656912846000000000),
+    COEF_CONST(0.00000000000000000000000005169878828456423000000000),
+    COEF_CONST(0.00000000000000000000000002584939414228211500000000),
+    COEF_CONST(0.00000000000000000000000001292469707114105700000000),
+    COEF_CONST(0.00000000000000000000000000646234853557052870000000),
+    COEF_CONST(0.00000000000000000000000000323117426778526440000000),
+    COEF_CONST(0.00000000000000000000000000161558713389263220000000),
+    COEF_CONST(0.00000000000000000000000000080779356694631609000000),
+    COEF_CONST(0.00000000000000000000000000040389678347315804000000),
+    COEF_CONST(0.00000000000000000000000000020194839173657902000000),
+    COEF_CONST(0.00000000000000000000000000010097419586828951000000),
+    COEF_CONST(0.00000000000000000000000000005048709793414475600000),
+    COEF_CONST(0.00000000000000000000000000002524354896707237800000),
+    COEF_CONST(0.00000000000000000000000000001262177448353618900000),
+    COEF_CONST(0.00000000000000000000000000000631088724176809440000),
+    COEF_CONST(0.00000000000000000000000000000315544362088404720000),
+    COEF_CONST(0.00000000000000000000000000000157772181044202360000),
+    COEF_CONST(0.00000000000000000000000000000078886090522101181000),
+    COEF_CONST(0.00000000000000000000000000000039443045261050590000),
+    COEF_CONST(0.00000000000000000000000000000019721522630525295000),
+    COEF_CONST(0.00000000000000000000000000000009860761315262647600),
+    COEF_CONST(0.00000000000000000000000000000004930380657631323800),
+    COEF_CONST(0.00000000000000000000000000000002465190328815661900),
+    COEF_CONST(0.00000000000000000000000000000001232595164407830900),
+    COEF_CONST(0.00000000000000000000000000000000616297582203915470),
+    COEF_CONST(0.00000000000000000000000000000000308148791101957740),
+    COEF_CONST(0.00000000000000000000000000000000154074395550978870),
+    COEF_CONST(0.00000000000000000000000000000000077037197775489434),
+    COEF_CONST(0.00000000000000000000000000000000038518598887744717),
+    COEF_CONST(0.00000000000000000000000000000000019259299443872359),
+    COEF_CONST(0.00000000000000000000000000000000009629649721936179),
+    COEF_CONST(0.00000000000000000000000000000000004814824860968090),
+    COEF_CONST(0.00000000000000000000000000000000002407412430484045),
+    COEF_CONST(0.00000000000000000000000000000000001203706215242022),
+    COEF_CONST(0.00000000000000000000000000000000000601853107621011),
+    COEF_CONST(0.00000000000000000000000000000000000300926553810506),
+    COEF_CONST(0.00000000000000000000000000000000000150463276905253),
+    COEF_CONST(0.00000000000000000000000000000000000075231638452626),
+    COEF_CONST(0.00000000000000000000000000000000000037615819226313),
+    COEF_CONST(0.00000000000000000000000000000000000018807909613157),
+    COEF_CONST(0.00000000000000000000000000000000000009403954806578),
+    COEF_CONST(0.00000000000000000000000000000000000004701977403289),
+    COEF_CONST(0.00000000000000000000000000000000000002350988701645),
+    COEF_CONST(0.00000000000000000000000000000000000001175494350822),
+    COEF_CONST(0.00000000000000000000000000000000000000587747175411),
+    COEF_CONST(0.0)
+};
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/iq_table.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,1347 @@
+/*
+** 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.10 2003/11/12 20:47:57 menno Exp $
+**/
+
+#ifndef IQ_TABLE_H__
+#define IQ_TABLE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* !!!DON'T CHANGE IQ_TABLE_SIZE!!! */
+
+
+#ifndef FIXED_POINT
+
+#define IQ_TABLE_SIZE 256
+
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+
+static real_t iq_table[IQ_TABLE_SIZE] =
+{
+    0.0,
+    1.0,
+    2.5198420997897464,
+    4.3267487109222245,
+    6.3496042078727974,
+    8.5498797333834844,
+    10.902723556992836,
+    13.390518279406722,
+    15.999999999999998,
+    18.720754407467133,
+    21.544346900318832,
+    24.463780996262464,
+    27.47314182127996,
+    30.567350940369842,
+    33.741991698453212,
+    36.993181114957046,
+    40.317473596635935,
+    43.711787041189993,
+    47.173345095760126,
+    50.699631325716943,
+    54.288352331898118,
+    57.937407704003519,
+    61.6448652744185,
+    65.408940536585988,
+    69.227979374755591,
+    73.100443455321638,
+    77.024897778591622,
+    80.999999999999986,
+    85.024491212518527,
+    89.097187944889555,
+    93.216975178615741,
+    97.382800224133163,
+    101.59366732596474,
+    105.84863288986224,
+    110.14680124343441,
+    114.4873208566006,
+    118.86938096020653,
+    123.29220851090024,
+    127.75506545836058,
+    132.25724627755247,
+    136.79807573413572,
+    141.37690685569191,
+    145.99311908523086,
+    150.6461165966291,
+    155.33532675434674,
+    160.06019870205279,
+    164.82020206673349,
+    169.61482576651861,
+    174.44357691188537,
+    179.30597979112557,
+    184.20157493201927,
+    189.12991823257562,
+    194.09058015449685,
+    199.08314497371677,
+    204.1072100829694,
+    209.16238534187647,
+    214.24829247050752,
+    219.36456448277784,
+    224.51084515641216,
+    229.6867885365223,
+    234.89205847013176,
+    240.12632816923249,
+    245.38927980018505,
+    250.68060409747261,
+    255.99999999999991,
+    261.34717430828869,
+    266.72184136106449,
+    272.12372272986045,
+    277.55254693037961,
+    283.0080491494619,
+    288.48997098659891,
+    293.99806020902247,
+    299.53207051947408,
+    305.0917613358298,
+    310.67689758182206,
+    316.28724948815585,
+    321.92259240337177,
+    327.58270661385535,
+    333.26737717243742,
+    338.97639373507025,
+    344.70955040510125,
+    350.46664558470013,
+    356.24748183302603,
+    362.05186573075139,
+    367.87960775058258,
+    373.73052213344511,
+    379.60442677002078,
+    385.50114308734607,
+    391.42049594019937,
+    397.36231350702371,
+    403.32642719014467,
+    409.31267152006262,
+    415.32088406360799,
+    421.35090533576471,
+    427.40257871497619,
+    433.4757503617617,
+    439.5702691404793,
+    445.68598654408271,
+    451.82275662172759,
+    457.98043590909128,
+    464.15888336127773,
+    470.35796028818726,
+    476.5775302922363,
+    482.81745920832043,
+    489.07761504591741,
+    495.35786793323581,
+    501.65809006331688,
+    507.97815564200368,
+    514.31794083769648,
+    520.67732373281672,
+    527.05618427690604,
+    533.45440424129174,
+    539.87186717525128,
+    546.30845836361505,
+    552.76406478574609,
+    559.23857507584194,
+    565.73187948450413,
+    572.24386984152341,
+    578.77443951983378,
+    585.32348340058843,
+    591.89089783931263,
+    598.47658063309257,
+    605.08043098876044,
+    611.70234949203643,
+    618.3422380775919,
+    624.99999999999977,
+    631.67553980553748,
+    638.36876330481164,
+    645.07957754617485,
+    651.80789078990415,
+    658.55361248311499,
+    665.31665323538357,
+    672.09692479505225,
+    678.8943400261943,
+    685.70881288621433,
+    692.540258404062,
+    699.38859265903977,
+    706.25373276018058,
+    713.13559682617972,
+    720.03410396586037,
+    726.94917425915435,
+    733.88072873858209,
+    740.82868937121543,
+    747.79297904110535,
+    754.77352153216191,
+    761.77024151147043,
+    768.78306451302956,
+    775.81191692189896,
+    782.85672595874246,
+    789.91741966475445,
+    796.99392688695798,
+    804.08617726386274,
+    811.19410121147098,
+    818.31762990962227,
+    825.45669528866563,
+    832.61123001644864,
+    839.78116748561604,
+    846.96644180120552,
+    854.16698776853514,
+    861.38274088137143,
+    868.61363731036977,
+    875.85961389178203,
+    883.12060811641959,
+    890.39655811886757,
+    897.68740266694181,
+    904.99308115138172,
+    912.31353357577188,
+    919.64870054668756,
+    926.99852326405619,
+    934.36294351172899,
+    941.74190364825859,
+    949.13534659787422,
+    956.54321584165211,
+    963.96545540887348,
+    971.40200986856541,
+    978.85282432122176,
+    986.31784439069588,
+    993.7970162162635,
+    1001.29028644485,
+    1008.797602223418,
+    1016.3189111915103,
+    1023.8541614739464,
+    1031.4033016736653,
+    1038.9662808647138,
+    1046.5430485853758,
+    1054.1335548314366,
+    1061.7377500495838,
+    1069.3555851309357,
+    1076.9870114046978,
+    1084.6319806319441,
+    1092.2904449995174,
+    1099.9623571140482,
+    1107.6476699960892,
+    1115.3463370743607,
+    1123.058312180106,
+    1130.7835495415541,
+    1138.5220037784854,
+    1146.273629896901,
+    1154.0383832837879,
+    1161.816219701986,
+    1169.607095285146,
+    1177.4109665327808,
+    1185.2277903054078,
+    1193.0575238197798,
+    1200.9001246442001,
+    1208.7555506939248,
+    1216.6237602266442,
+    1224.5047118380478,
+    1232.3983644574657,
+    1240.3046773435874,
+    1248.2236100802568,
+    1256.1551225723395,
+    1264.099175041662,
+    1272.0557280230228,
+    1280.0247423602691,
+    1288.0061792024444,
+    1295.9999999999995,
+    1304.006166501068,
+    1312.0246407478062,
+    1320.0553850727929,
+    1328.0983620954903,
+    1336.1535347187651,
+    1344.2208661254647,
+    1352.3003197750522,
+    1360.3918594002962,
+    1368.4954490040145,
+    1376.6110528558709,
+    1384.7386354892244,
+    1392.8781616980295,
+    1401.0295965337855,
+    1409.1929053025353,
+    1417.3680535619119,
+    1425.5550071182327,
+    1433.7537320236374,
+    1441.9641945732744,
+    1450.1863613025282,
+    1458.4201989842913,
+    1466.6656746262797,
+    1474.9227554683875,
+    1483.1914089800841,
+    1491.4716028578516,
+    1499.7633050226596,
+    1508.0664836174794,
+    1516.3811070048375,
+    1524.7071437644029,
+    1533.0445626906128,
+    1541.3933327903342,
+    1549.7534232805581,
+    1558.1248035861302,
+    1566.507443337515,
+    1574.9013123685909,
+    1583.3063807144795,
+    1591.7226186094069,
+    1600.1499964845941,
+    1608.58848496618,
+    1617.0380548731737
+};
+
+#else
+
+#define IQ_TABLE_SIZE  1026
+
+static real_t iq_table[IQ_TABLE_SIZE] =
+{
+    REAL_CONST(0.0),
+    REAL_CONST(1.0/8.0),
+    REAL_CONST(2.5198420997897464/8.0),
+    REAL_CONST(4.3267487109222245/8.0),
+    REAL_CONST(6.3496042078727974/8.0),
+    REAL_CONST(8.5498797333834844/8.0),
+    REAL_CONST(10.902723556992836/8.0),
+    REAL_CONST(13.390518279406722/8.0),
+    REAL_CONST(15.999999999999998/8.0),
+    REAL_CONST(18.720754407467133/8.0),
+    REAL_CONST(21.544346900318832/8.0),
+    REAL_CONST(24.463780996262464/8.0),
+    REAL_CONST(27.47314182127996/8.0),
+    REAL_CONST(30.567350940369842/8.0),
+    REAL_CONST(33.741991698453212/8.0),
+    REAL_CONST(36.993181114957046/8.0),
+    REAL_CONST(40.317473596635935/8.0),
+    REAL_CONST(43.711787041189993/8.0),
+    REAL_CONST(47.173345095760126/8.0),
+    REAL_CONST(50.699631325716943/8.0),
+    REAL_CONST(54.288352331898118/8.0),
+    REAL_CONST(57.937407704003519/8.0),
+    REAL_CONST(61.6448652744185/8.0),
+    REAL_CONST(65.408940536585988/8.0),
+    REAL_CONST(69.227979374755591/8.0),
+    REAL_CONST(73.100443455321638/8.0),
+    REAL_CONST(77.024897778591622/8.0),
+    REAL_CONST(80.999999999999986/8.0),
+    REAL_CONST(85.024491212518527/8.0),
+    REAL_CONST(89.097187944889555/8.0),
+    REAL_CONST(93.216975178615741/8.0),
+    REAL_CONST(97.382800224133163/8.0),
+    REAL_CONST(101.59366732596474/8.0),
+    REAL_CONST(105.84863288986224/8.0),
+    REAL_CONST(110.14680124343441/8.0),
+    REAL_CONST(114.4873208566006/8.0),
+    REAL_CONST(118.86938096020653/8.0),
+    REAL_CONST(123.29220851090024/8.0),
+    REAL_CONST(127.75506545836058/8.0),
+    REAL_CONST(132.25724627755247/8.0),
+    REAL_CONST(136.79807573413572/8.0),
+    REAL_CONST(141.37690685569191/8.0),
+    REAL_CONST(145.99311908523086/8.0),
+    REAL_CONST(150.6461165966291/8.0),
+    REAL_CONST(155.33532675434674/8.0),
+    REAL_CONST(160.06019870205279/8.0),
+    REAL_CONST(164.82020206673349/8.0),
+    REAL_CONST(169.61482576651861/8.0),
+    REAL_CONST(174.44357691188537/8.0),
+    REAL_CONST(179.30597979112557/8.0),
+    REAL_CONST(184.20157493201927/8.0),
+    REAL_CONST(189.12991823257562/8.0),
+    REAL_CONST(194.09058015449685/8.0),
+    REAL_CONST(199.08314497371677/8.0),
+    REAL_CONST(204.1072100829694/8.0),
+    REAL_CONST(209.16238534187647/8.0),
+    REAL_CONST(214.24829247050752/8.0),
+    REAL_CONST(219.36456448277784/8.0),
+    REAL_CONST(224.51084515641216/8.0),
+    REAL_CONST(229.6867885365223/8.0),
+    REAL_CONST(234.89205847013176/8.0),
+    REAL_CONST(240.12632816923249/8.0),
+    REAL_CONST(245.38927980018505/8.0),
+    REAL_CONST(250.68060409747261/8.0),
+    REAL_CONST(255.99999999999991/8.0),
+    REAL_CONST(261.34717430828869/8.0),
+    REAL_CONST(266.72184136106449/8.0),
+    REAL_CONST(272.12372272986045/8.0),
+    REAL_CONST(277.55254693037961/8.0),
+    REAL_CONST(283.0080491494619/8.0),
+    REAL_CONST(288.48997098659891/8.0),
+    REAL_CONST(293.99806020902247/8.0),
+    REAL_CONST(299.53207051947408/8.0),
+    REAL_CONST(305.0917613358298/8.0),
+    REAL_CONST(310.67689758182206/8.0),
+    REAL_CONST(316.28724948815585/8.0),
+    REAL_CONST(321.92259240337177/8.0),
+    REAL_CONST(327.58270661385535/8.0),
+    REAL_CONST(333.26737717243742/8.0),
+    REAL_CONST(338.97639373507025/8.0),
+    REAL_CONST(344.70955040510125/8.0),
+    REAL_CONST(350.46664558470013/8.0),
+    REAL_CONST(356.24748183302603/8.0),
+    REAL_CONST(362.05186573075139/8.0),
+    REAL_CONST(367.87960775058258/8.0),
+    REAL_CONST(373.73052213344511/8.0),
+    REAL_CONST(379.60442677002078/8.0),
+    REAL_CONST(385.50114308734607/8.0),
+    REAL_CONST(391.42049594019937/8.0),
+    REAL_CONST(397.36231350702371/8.0),
+    REAL_CONST(403.32642719014467/8.0),
+    REAL_CONST(409.31267152006262/8.0),
+    REAL_CONST(415.32088406360799/8.0),
+    REAL_CONST(421.35090533576471/8.0),
+    REAL_CONST(427.40257871497619/8.0),
+    REAL_CONST(433.4757503617617/8.0),
+    REAL_CONST(439.5702691404793/8.0),
+    REAL_CONST(445.68598654408271/8.0),
+    REAL_CONST(451.82275662172759/8.0),
+    REAL_CONST(457.98043590909128/8.0),
+    REAL_CONST(464.15888336127773/8.0),
+    REAL_CONST(470.35796028818726/8.0),
+    REAL_CONST(476.5775302922363/8.0),
+    REAL_CONST(482.81745920832043/8.0),
+    REAL_CONST(489.07761504591741/8.0),
+    REAL_CONST(495.35786793323581/8.0),
+    REAL_CONST(501.65809006331688/8.0),
+    REAL_CONST(507.97815564200368/8.0),
+    REAL_CONST(514.31794083769648/8.0),
+    REAL_CONST(520.67732373281672/8.0),
+    REAL_CONST(527.05618427690604/8.0),
+    REAL_CONST(533.45440424129174/8.0),
+    REAL_CONST(539.87186717525128/8.0),
+    REAL_CONST(546.30845836361505/8.0),
+    REAL_CONST(552.76406478574609/8.0),
+    REAL_CONST(559.23857507584194/8.0),
+    REAL_CONST(565.73187948450413/8.0),
+    REAL_CONST(572.24386984152341/8.0),
+    REAL_CONST(578.77443951983378/8.0),
+    REAL_CONST(585.32348340058843/8.0),
+    REAL_CONST(591.89089783931263/8.0),
+    REAL_CONST(598.47658063309257/8.0),
+    REAL_CONST(605.08043098876044/8.0),
+    REAL_CONST(611.70234949203643/8.0),
+    REAL_CONST(618.3422380775919/8.0),
+    REAL_CONST(624.99999999999977/8.0),
+    REAL_CONST(631.67553980553748/8.0),
+    REAL_CONST(638.36876330481164/8.0),
+    REAL_CONST(645.07957754617485/8.0),
+    REAL_CONST(651.80789078990415/8.0),
+    REAL_CONST(658.55361248311499/8.0),
+    REAL_CONST(665.31665323538357/8.0),
+    REAL_CONST(672.09692479505225/8.0),
+    REAL_CONST(678.8943400261943/8.0),
+    REAL_CONST(685.70881288621433/8.0),
+    REAL_CONST(692.540258404062/8.0),
+    REAL_CONST(699.38859265903977/8.0),
+    REAL_CONST(706.25373276018058/8.0),
+    REAL_CONST(713.13559682617972/8.0),
+    REAL_CONST(720.03410396586037/8.0),
+    REAL_CONST(726.94917425915435/8.0),
+    REAL_CONST(733.88072873858209/8.0),
+    REAL_CONST(740.82868937121543/8.0),
+    REAL_CONST(747.79297904110535/8.0),
+    REAL_CONST(754.77352153216191/8.0),
+    REAL_CONST(761.77024151147043/8.0),
+    REAL_CONST(768.78306451302956/8.0),
+    REAL_CONST(775.81191692189896/8.0),
+    REAL_CONST(782.85672595874246/8.0),
+    REAL_CONST(789.91741966475445/8.0),
+    REAL_CONST(796.99392688695798/8.0),
+    REAL_CONST(804.08617726386274/8.0),
+    REAL_CONST(811.19410121147098/8.0),
+    REAL_CONST(818.31762990962227/8.0),
+    REAL_CONST(825.45669528866563/8.0),
+    REAL_CONST(832.61123001644864/8.0),
+    REAL_CONST(839.78116748561604/8.0),
+    REAL_CONST(846.96644180120552/8.0),
+    REAL_CONST(854.16698776853514/8.0),
+    REAL_CONST(861.38274088137143/8.0),
+    REAL_CONST(868.61363731036977/8.0),
+    REAL_CONST(875.85961389178203/8.0),
+    REAL_CONST(883.12060811641959/8.0),
+    REAL_CONST(890.39655811886757/8.0),
+    REAL_CONST(897.68740266694181/8.0),
+    REAL_CONST(904.99308115138172/8.0),
+    REAL_CONST(912.31353357577188/8.0),
+    REAL_CONST(919.64870054668756/8.0),
+    REAL_CONST(926.99852326405619/8.0),
+    REAL_CONST(934.36294351172899/8.0),
+    REAL_CONST(941.74190364825859/8.0),
+    REAL_CONST(949.13534659787422/8.0),
+    REAL_CONST(956.54321584165211/8.0),
+    REAL_CONST(963.96545540887348/8.0),
+    REAL_CONST(971.40200986856541/8.0),
+    REAL_CONST(978.85282432122176/8.0),
+    REAL_CONST(986.31784439069588/8.0),
+    REAL_CONST(993.7970162162635/8.0),
+    REAL_CONST(1001.29028644485/8.0),
+    REAL_CONST(1008.797602223418/8.0),
+    REAL_CONST(1016.3189111915103/8.0),
+    REAL_CONST(1023.8541614739464/8.0),
+    REAL_CONST(1031.4033016736653/8.0),
+    REAL_CONST(1038.9662808647138/8.0),
+    REAL_CONST(1046.5430485853758/8.0),
+    REAL_CONST(1054.1335548314366/8.0),
+    REAL_CONST(1061.7377500495838/8.0),
+    REAL_CONST(1069.3555851309357/8.0),
+    REAL_CONST(1076.9870114046978/8.0),
+    REAL_CONST(1084.6319806319441/8.0),
+    REAL_CONST(1092.2904449995174/8.0),
+    REAL_CONST(1099.9623571140482/8.0),
+    REAL_CONST(1107.6476699960892/8.0),
+    REAL_CONST(1115.3463370743607/8.0),
+    REAL_CONST(1123.058312180106/8.0),
+    REAL_CONST(1130.7835495415541/8.0),
+    REAL_CONST(1138.5220037784854/8.0),
+    REAL_CONST(1146.273629896901/8.0),
+    REAL_CONST(1154.0383832837879/8.0),
+    REAL_CONST(1161.816219701986/8.0),
+    REAL_CONST(1169.607095285146/8.0),
+    REAL_CONST(1177.4109665327808/8.0),
+    REAL_CONST(1185.2277903054078/8.0),
+    REAL_CONST(1193.0575238197798/8.0),
+    REAL_CONST(1200.9001246442001/8.0),
+    REAL_CONST(1208.7555506939248/8.0),
+    REAL_CONST(1216.6237602266442/8.0),
+    REAL_CONST(1224.5047118380478/8.0),
+    REAL_CONST(1232.3983644574657/8.0),
+    REAL_CONST(1240.3046773435874/8.0),
+    REAL_CONST(1248.2236100802568/8.0),
+    REAL_CONST(1256.1551225723395/8.0),
+    REAL_CONST(1264.099175041662/8.0),
+    REAL_CONST(1272.0557280230228/8.0),
+    REAL_CONST(1280.0247423602691/8.0),
+    REAL_CONST(1288.0061792024444/8.0),
+    REAL_CONST(1295.9999999999995/8.0),
+    REAL_CONST(1304.006166501068/8.0),
+    REAL_CONST(1312.0246407478062/8.0),
+    REAL_CONST(1320.0553850727929/8.0),
+    REAL_CONST(1328.0983620954903/8.0),
+    REAL_CONST(1336.1535347187651/8.0),
+    REAL_CONST(1344.2208661254647/8.0),
+    REAL_CONST(1352.3003197750522/8.0),
+    REAL_CONST(1360.3918594002962/8.0),
+    REAL_CONST(1368.4954490040145/8.0),
+    REAL_CONST(1376.6110528558709/8.0),
+    REAL_CONST(1384.7386354892244/8.0),
+    REAL_CONST(1392.8781616980295/8.0),
+    REAL_CONST(1401.0295965337855/8.0),
+    REAL_CONST(1409.1929053025353/8.0),
+    REAL_CONST(1417.3680535619119/8.0),
+    REAL_CONST(1425.5550071182327/8.0),
+    REAL_CONST(1433.7537320236374/8.0),
+    REAL_CONST(1441.9641945732744/8.0),
+    REAL_CONST(1450.1863613025282/8.0),
+    REAL_CONST(1458.4201989842913/8.0),
+    REAL_CONST(1466.6656746262797/8.0),
+    REAL_CONST(1474.9227554683875/8.0),
+    REAL_CONST(1483.1914089800841/8.0),
+    REAL_CONST(1491.4716028578516/8.0),
+    REAL_CONST(1499.7633050226596/8.0),
+    REAL_CONST(1508.0664836174794/8.0),
+    REAL_CONST(1516.3811070048375/8.0),
+    REAL_CONST(1524.7071437644029/8.0),
+    REAL_CONST(1533.0445626906128/8.0),
+    REAL_CONST(1541.3933327903342/8.0),
+    REAL_CONST(1549.7534232805581/8.0),
+    REAL_CONST(1558.1248035861302/8.0),
+    REAL_CONST(1566.507443337515/8.0),
+    REAL_CONST(1574.9013123685909/8.0),
+    REAL_CONST(1583.3063807144795/8.0),
+    REAL_CONST(1591.7226186094069/8.0),
+    REAL_CONST(1600.1499964845941/8.0),
+    REAL_CONST(1608.58848496618/8.0),
+    REAL_CONST(1617.0380548731737/8.0),
+    REAL_CONST(1625.4986772154357/8.0),
+    REAL_CONST(1633.9703231916887/8.0),
+    REAL_CONST(1642.4529641875577/8.0),
+    REAL_CONST(1650.9465717736346/8.0),
+    REAL_CONST(1659.4511177035752/8.0),
+    REAL_CONST(1667.9665739122186/8.0),
+    REAL_CONST(1676.4929125137353/8.0),
+    REAL_CONST(1685.030105799801/8.0),
+    REAL_CONST(1693.5781262377957/8.0),
+    REAL_CONST(1702.136946469027/8.0),
+    REAL_CONST(1710.7065393069795/8.0),
+    REAL_CONST(1719.2868777355877/8.0),
+    REAL_CONST(1727.8779349075323/8.0),
+    REAL_CONST(1736.4796841425596/8.0),
+    REAL_CONST(1745.092098925825/8.0),
+    REAL_CONST(1753.7151529062583/8.0),
+    REAL_CONST(1762.3488198949503/8.0),
+    REAL_CONST(1770.9930738635628/8.0),
+    REAL_CONST(1779.6478889427597/8.0),
+    REAL_CONST(1788.3132394206564/8.0),
+    REAL_CONST(1796.9890997412947/8.0),
+    REAL_CONST(1805.6754445031333/8.0),
+    REAL_CONST(1814.3722484575621/8.0),
+    REAL_CONST(1823.0794865074322/8.0),
+    REAL_CONST(1831.7971337056094/8.0),
+    REAL_CONST(1840.5251652535437/8.0),
+    REAL_CONST(1849.2635564998579/8.0),
+    REAL_CONST(1858.0122829389563/8.0),
+    REAL_CONST(1866.7713202096493/8.0),
+    REAL_CONST(1875.5406440937966/8.0),
+    REAL_CONST(1884.3202305149687/8.0),
+    REAL_CONST(1893.110055537124/8.0),
+    REAL_CONST(1901.9100953633042/8.0),
+    REAL_CONST(1910.7203263343454/8.0),
+    REAL_CONST(1919.5407249276057/8.0),
+    REAL_CONST(1928.3712677557098/8.0),
+    REAL_CONST(1937.2119315653083/8.0),
+    REAL_CONST(1946.0626932358525/8.0),
+    REAL_CONST(1954.923529778386/8.0),
+    REAL_CONST(1963.79441833435/8.0),
+    REAL_CONST(1972.6753361744036/8.0),
+    REAL_CONST(1981.5662606972594/8.0),
+    REAL_CONST(1990.467169428533/8.0),
+    REAL_CONST(1999.3780400196069/8.0),
+    REAL_CONST(2008.2988502465078/8.0),
+    REAL_CONST(2017.2295780087982/8.0),
+    REAL_CONST(2026.1702013284819/8.0),
+    REAL_CONST(2035.1206983489212/8.0),
+    REAL_CONST(2044.0810473337688/8.0),
+    REAL_CONST(2053.0512266659125/8.0),
+    REAL_CONST(2062.0312148464309/8.0),
+    REAL_CONST(2071.0209904935646/8.0),
+    REAL_CONST(2080.0205323416958/8.0),
+    REAL_CONST(2089.0298192403443/8.0),
+    REAL_CONST(2098.0488301531714/8.0),
+    REAL_CONST(2107.0775441569995/8.0),
+    REAL_CONST(2116.115940440839/8.0),
+    REAL_CONST(2125.1639983049317/8.0),
+    REAL_CONST(2134.2216971597995/8.0),
+    REAL_CONST(2143.2890165253098/8.0),
+    REAL_CONST(2152.3659360297484/8.0),
+    REAL_CONST(2161.4524354089031/8.0),
+    REAL_CONST(2170.5484945051617/8.0),
+    REAL_CONST(2179.6540932666144/8.0),
+    REAL_CONST(2188.7692117461711/8.0),
+    REAL_CONST(2197.8938301006888/8.0),
+    REAL_CONST(2207.0279285901042/8.0),
+    REAL_CONST(2216.1714875765838/8.0),
+    REAL_CONST(2225.324487523676/8.0),
+    REAL_CONST(2234.4869089954782/8.0),
+    REAL_CONST(2243.6587326558101/8.0),
+    REAL_CONST(2252.8399392673982/8.0),
+    REAL_CONST(2262.0305096910702/8.0),
+    REAL_CONST(2271.2304248849537/8.0),
+    REAL_CONST(2280.4396659036897/8.0),
+    REAL_CONST(2289.6582138976523/8.0),
+    REAL_CONST(2298.8860501121762/8.0),
+    REAL_CONST(2308.1231558867926/8.0),
+    REAL_CONST(2317.3695126544767/8.0),
+    REAL_CONST(2326.6251019409005/8.0),
+    REAL_CONST(2335.8899053636933/8.0),
+    REAL_CONST(2345.1639046317132/8.0),
+    REAL_CONST(2354.4470815443233/8.0),
+    REAL_CONST(2363.7394179906792/8.0),
+    REAL_CONST(2373.0408959490205/8.0),
+    REAL_CONST(2382.3514974859731/8.0),
+    REAL_CONST(2391.6712047558558/8.0),
+    REAL_CONST(2400.9999999999991/8.0),
+    REAL_CONST(2410.3378655460651/8.0),
+    REAL_CONST(2419.6847838073813/8.0),
+    REAL_CONST(2429.0407372822747/8.0),
+    REAL_CONST(2438.4057085534191/8.0),
+    REAL_CONST(2447.7796802871858/8.0),
+    REAL_CONST(2457.1626352330004/8.0),
+    REAL_CONST(2466.5545562227112/8.0),
+    REAL_CONST(2475.9554261699564/8.0),
+    REAL_CONST(2485.3652280695474/8.0),
+    REAL_CONST(2494.7839449968492/8.0),
+    REAL_CONST(2504.2115601071737/8.0),
+    REAL_CONST(2513.6480566351788/8.0),
+    REAL_CONST(2523.0934178942675/8.0),
+    REAL_CONST(2532.5476272760025/8.0),
+    REAL_CONST(2542.0106682495189/8.0),
+    REAL_CONST(2551.482524360948/8.0),
+    REAL_CONST(2560.9631792328441/8.0),
+    REAL_CONST(2570.4526165636184/8.0),
+    REAL_CONST(2579.9508201269791/8.0),
+    REAL_CONST(2589.4577737713744/8.0),
+    REAL_CONST(2598.9734614194458/8.0),
+    REAL_CONST(2608.4978670674823/8.0),
+    REAL_CONST(2618.0309747848837/8.0),
+    REAL_CONST(2627.5727687136259/8.0),
+    REAL_CONST(2637.1232330677353/8.0),
+    REAL_CONST(2646.6823521327647/8.0),
+    REAL_CONST(2656.2501102652768/8.0),
+    REAL_CONST(2665.8264918923328/8.0),
+    REAL_CONST(2675.4114815109842/8.0),
+    REAL_CONST(2685.0050636877722/8.0),
+    REAL_CONST(2694.6072230582295/8.0),
+    REAL_CONST(2704.2179443263894/8.0),
+    REAL_CONST(2713.8372122642972/8.0),
+    REAL_CONST(2723.4650117115279/8.0),
+    REAL_CONST(2733.1013275747096/8.0),
+    REAL_CONST(2742.7461448270483/8.0),
+    REAL_CONST(2752.3994485078601/8.0),
+    REAL_CONST(2762.0612237221085/8.0),
+    REAL_CONST(2771.7314556399419/8.0),
+    REAL_CONST(2781.4101294962406/8.0),
+    REAL_CONST(2791.0972305901655/8.0),
+    REAL_CONST(2800.7927442847094/8.0),
+    REAL_CONST(2810.4966560062589/8.0),
+    REAL_CONST(2820.2089512441521/8.0),
+    REAL_CONST(2829.9296155502466/8.0),
+    REAL_CONST(2839.6586345384894/8.0),
+    REAL_CONST(2849.3959938844923/8.0),
+    REAL_CONST(2859.1416793251065/8.0),
+    REAL_CONST(2868.8956766580086/8.0),
+    REAL_CONST(2878.6579717412847/8.0),
+    REAL_CONST(2888.4285504930212/8.0),
+    REAL_CONST(2898.2073988908974/8.0),
+    REAL_CONST(2907.9945029717837/8.0),
+    REAL_CONST(2917.789848831344/8.0),
+    REAL_CONST(2927.5934226236377/8.0),
+    REAL_CONST(2937.4052105607311/8.0),
+    REAL_CONST(2947.2251989123079/8.0),
+    REAL_CONST(2957.0533740052865/8.0),
+    REAL_CONST(2966.8897222234368/8.0),
+    REAL_CONST(2976.734230007005/8.0),
+    REAL_CONST(2986.5868838523397/8.0),
+    REAL_CONST(2996.4476703115197/8.0),
+    REAL_CONST(3006.3165759919889/8.0),
+    REAL_CONST(3016.1935875561908/8.0),
+    REAL_CONST(3026.0786917212095/8.0),
+    REAL_CONST(3035.9718752584108/8.0),
+    REAL_CONST(3045.8731249930906/8.0),
+    REAL_CONST(3055.7824278041207/8.0),
+    REAL_CONST(3065.6997706236039/8.0),
+    REAL_CONST(3075.625140436528/8.0),
+    REAL_CONST(3085.5585242804245/8.0),
+    REAL_CONST(3095.4999092450298/8.0),
+    REAL_CONST(3105.4492824719491/8.0),
+    REAL_CONST(3115.4066311543256/8.0),
+    REAL_CONST(3125.3719425365089/8.0),
+    REAL_CONST(3135.3452039137287/8.0),
+    REAL_CONST(3145.3264026317715/8.0),
+    REAL_CONST(3155.3155260866592/8.0),
+    REAL_CONST(3165.3125617243295/8.0),
+    REAL_CONST(3175.3174970403229/8.0),
+    REAL_CONST(3185.3303195794679/8.0),
+    REAL_CONST(3195.35101693557/8.0),
+    REAL_CONST(3205.3795767511078/8.0),
+    REAL_CONST(3215.4159867169251/8.0),
+    REAL_CONST(3225.460234571929/8.0),
+    REAL_CONST(3235.5123081027928/8.0),
+    REAL_CONST(3245.5721951436558/8.0),
+    REAL_CONST(3255.63988357583/8.0),
+    REAL_CONST(3265.7153613275095/8.0),
+    REAL_CONST(3275.7986163734795/8.0),
+    REAL_CONST(3285.8896367348289/8.0),
+    REAL_CONST(3295.9884104786665/8.0),
+    REAL_CONST(3306.0949257178395/8.0),
+    REAL_CONST(3316.2091706106517/8.0),
+    REAL_CONST(3326.331133360588/8.0),
+    REAL_CONST(3336.4608022160378/8.0),
+    REAL_CONST(3346.5981654700231/8.0),
+    REAL_CONST(3356.7432114599264/8.0),
+    REAL_CONST(3366.8959285672249/8.0),
+    REAL_CONST(3377.0563052172211/8.0),
+    REAL_CONST(3387.2243298787821/8.0),
+    REAL_CONST(3397.3999910640764/8.0),
+    REAL_CONST(3407.5832773283128/8.0),
+    REAL_CONST(3417.7741772694862/8.0),
+    REAL_CONST(3427.9726795281199/8.0),
+    REAL_CONST(3438.1787727870123/8.0),
+    REAL_CONST(3448.3924457709873/8.0),
+    REAL_CONST(3458.6136872466445/8.0),
+    REAL_CONST(3468.8424860221107/8.0),
+    REAL_CONST(3479.0788309467976/8.0),
+    REAL_CONST(3489.3227109111554/8.0),
+    REAL_CONST(3499.5741148464344/8.0),
+    REAL_CONST(3509.8330317244445/8.0),
+    REAL_CONST(3520.0994505573185/8.0),
+    REAL_CONST(3530.3733603972751/8.0),
+    REAL_CONST(3540.6547503363886/8.0),
+    REAL_CONST(3550.9436095063534/8.0),
+    REAL_CONST(3561.239927078258/8.0),
+    REAL_CONST(3571.5436922623535/8.0),
+    REAL_CONST(3581.8548943078308/8.0),
+    REAL_CONST(3592.1735225025936/8.0),
+    REAL_CONST(3602.4995661730372/8.0),
+    REAL_CONST(3612.8330146838275/8.0),
+    REAL_CONST(3623.1738574376814/8.0),
+    REAL_CONST(3633.5220838751502/8.0),
+    REAL_CONST(3643.8776834744031/8.0),
+    REAL_CONST(3654.2406457510142/8.0),
+    REAL_CONST(3664.6109602577494/8.0),
+    REAL_CONST(3674.9886165843564/8.0),
+    REAL_CONST(3685.3736043573545/8.0),
+    REAL_CONST(3695.7659132398294/8.0),
+    REAL_CONST(3706.1655329312248/8.0),
+    REAL_CONST(3716.5724531671399/8.0),
+    REAL_CONST(3726.9866637191262/8.0),
+    REAL_CONST(3737.4081543944876/8.0),
+    REAL_CONST(3747.8369150360782/8.0),
+    REAL_CONST(3758.2729355221072/8.0),
+    REAL_CONST(3768.7162057659411/8.0),
+    REAL_CONST(3779.1667157159077/8.0),
+    REAL_CONST(3789.6244553551055/8.0),
+    REAL_CONST(3800.0894147012082/8.0),
+    REAL_CONST(3810.5615838062768/8.0),
+    REAL_CONST(3821.0409527565694/8.0),
+    REAL_CONST(3831.5275116723533/8.0),
+    REAL_CONST(3842.0212507077194/8.0),
+    REAL_CONST(3852.522160050396/8.0),
+    REAL_CONST(3863.0302299215673/8.0),
+    REAL_CONST(3873.5454505756893/8.0),
+    REAL_CONST(3884.0678123003108/8.0),
+    REAL_CONST(3894.5973054158922/8.0),
+    REAL_CONST(3905.1339202756285/8.0),
+    REAL_CONST(3915.6776472652732/8.0),
+    REAL_CONST(3926.2284768029604/8.0),
+    REAL_CONST(3936.7863993390338/8.0),
+    REAL_CONST(3947.3514053558706/8.0),
+    REAL_CONST(3957.9234853677135/8.0),
+    REAL_CONST(3968.5026299204969/8.0),
+    REAL_CONST(3979.0888295916798/8.0),
+    REAL_CONST(3989.6820749900776/8.0),
+    REAL_CONST(4000.2823567556948/8.0),
+    REAL_CONST(4010.8896655595613/8.0),
+    REAL_CONST(4021.5039921035655/8.0),
+    REAL_CONST(4032.1253271202945/8.0),
+    REAL_CONST(4042.7536613728694/8.0),
+    REAL_CONST(4053.3889856547858/8.0),
+    REAL_CONST(4064.0312907897551/8.0),
+    REAL_CONST(4074.6805676315448/8.0),
+    REAL_CONST(4085.3368070638221/8.0),
+    REAL_CONST(4095.9999999999982/8.0),
+    REAL_CONST(4106.6701373830711/8.0),
+    REAL_CONST(4117.347210185475/8.0),
+    REAL_CONST(4128.0312094089259/8.0),
+    REAL_CONST(4138.722126084268/8.0),
+    REAL_CONST(4149.4199512713267/8.0),
+    REAL_CONST(4160.1246760587583/8.0),
+    REAL_CONST(4170.8362915638982/8.0),
+    REAL_CONST(4181.5547889326181/8.0),
+    REAL_CONST(4192.2801593391769/8.0),
+    REAL_CONST(4203.0123939860741/8.0),
+    REAL_CONST(4213.7514841039101/8.0),
+    REAL_CONST(4224.4974209512384/8.0),
+    REAL_CONST(4235.2501958144258/8.0),
+    REAL_CONST(4246.0098000075095/8.0),
+    REAL_CONST(4256.7762248720574/8.0),
+    REAL_CONST(4267.549461777031/8.0),
+    REAL_CONST(4278.3295021186423/8.0),
+    REAL_CONST(4289.1163373202198/8.0),
+    REAL_CONST(4299.9099588320714/8.0),
+    REAL_CONST(4310.7103581313495/8.0),
+    REAL_CONST(4321.5175267219138/8.0),
+    REAL_CONST(4332.3314561342004/8.0),
+    REAL_CONST(4343.152137925088/8.0),
+    REAL_CONST(4353.9795636777671/8.0),
+    REAL_CONST(4364.8137250016052/8.0),
+    REAL_CONST(4375.6546135320223/8.0),
+    REAL_CONST(4386.5022209303588/8.0),
+    REAL_CONST(4397.3565388837469/8.0),
+    REAL_CONST(4408.2175591049827/8.0),
+    REAL_CONST(4419.0852733324018/8.0),
+    REAL_CONST(4429.9596733297531/8.0),
+    REAL_CONST(4440.8407508860728/8.0),
+    REAL_CONST(4451.7284978155603/8.0),
+    REAL_CONST(4462.6229059574571/8.0),
+    REAL_CONST(4473.5239671759227/8.0),
+    REAL_CONST(4484.4316733599126/8.0),
+    REAL_CONST(4495.3460164230582/8.0),
+    REAL_CONST(4506.2669883035496/8.0),
+    REAL_CONST(4517.1945809640119/8.0),
+    REAL_CONST(4528.1287863913894/8.0),
+    REAL_CONST(4539.069596596828/8.0),
+    REAL_CONST(4550.0170036155587/8.0),
+    REAL_CONST(4560.9709995067806/8.0),
+    REAL_CONST(4571.931576353546/8.0),
+    REAL_CONST(4582.898726262647/8.0),
+    REAL_CONST(4593.8724413645004/8.0),
+    REAL_CONST(4604.8527138130348/8.0),
+    REAL_CONST(4615.8395357855816/8.0),
+    REAL_CONST(4626.8328994827571/8.0),
+    REAL_CONST(4637.8327971283588/8.0),
+    REAL_CONST(4648.8392209692511/8.0),
+    REAL_CONST(4659.8521632752563/8.0),
+    REAL_CONST(4670.8716163390473/8.0),
+    REAL_CONST(4681.8975724760394/8.0),
+    REAL_CONST(4692.9300240242837/8.0),
+    REAL_CONST(4703.9689633443595/8.0),
+    REAL_CONST(4715.0143828192668/8.0),
+    REAL_CONST(4726.0662748543255/8.0),
+    REAL_CONST(4737.1246318770682/8.0),
+    REAL_CONST(4748.1894463371373/8.0),
+    REAL_CONST(4759.2607107061804/8.0),
+    REAL_CONST(4770.3384174777493/8.0),
+    REAL_CONST(4781.4225591671993/8.0),
+    REAL_CONST(4792.5131283115852/8.0),
+    REAL_CONST(4803.6101174695614/8.0),
+    REAL_CONST(4814.7135192212854/8.0),
+    REAL_CONST(4825.8233261683154/8.0),
+    REAL_CONST(4836.9395309335096/8.0),
+    REAL_CONST(4848.0621261609349/8.0),
+    REAL_CONST(4859.1911045157631/8.0),
+    REAL_CONST(4870.3264586841779/8.0),
+    REAL_CONST(4881.4681813732768/8.0),
+    REAL_CONST(4892.6162653109768/8.0),
+    REAL_CONST(4903.7707032459193/8.0),
+    REAL_CONST(4914.931487947375/8.0),
+    REAL_CONST(4926.0986122051509/8.0),
+    REAL_CONST(4937.2720688294967/8.0),
+    REAL_CONST(4948.4518506510112/8.0),
+    REAL_CONST(4959.637950520555/8.0),
+    REAL_CONST(4970.8303613091521/8.0),
+    REAL_CONST(4982.0290759079044/8.0),
+    REAL_CONST(4993.2340872278974/8.0),
+    REAL_CONST(5004.4453882001153/8.0),
+    REAL_CONST(5015.6629717753467/8.0),
+    REAL_CONST(5026.8868309241007/8.0),
+    REAL_CONST(5038.1169586365131/8.0),
+    REAL_CONST(5049.353347922266/8.0),
+    REAL_CONST(5060.5959918104927/8.0),
+    REAL_CONST(5071.8448833496996/8.0),
+    REAL_CONST(5083.1000156076734/8.0),
+    REAL_CONST(5094.3613816713996/8.0),
+    REAL_CONST(5105.6289746469747/8.0),
+    REAL_CONST(5116.9027876595246/8.0),
+    REAL_CONST(5128.18281385312/8.0),
+    REAL_CONST(5139.4690463906918/8.0),
+    REAL_CONST(5150.7614784539473/8.0),
+    REAL_CONST(5162.0601032432933/8.0),
+    REAL_CONST(5173.3649139777472/8.0),
+    REAL_CONST(5184.6759038948594/8.0),
+    REAL_CONST(5195.9930662506322/8.0),
+    REAL_CONST(5207.3163943194386/8.0),
+    REAL_CONST(5218.6458813939435/8.0),
+    REAL_CONST(5229.9815207850224/8.0),
+    REAL_CONST(5241.3233058216847/8.0),
+    REAL_CONST(5252.6712298509919/8.0),
+    REAL_CONST(5264.025286237983/8.0),
+    REAL_CONST(5275.3854683655954/8.0),
+    REAL_CONST(5286.7517696345885/8.0),
+    REAL_CONST(5298.1241834634639/8.0),
+    REAL_CONST(5309.5027032883945/8.0),
+    REAL_CONST(5320.887322563146/8.0),
+    REAL_CONST(5332.2780347589978/8.0),
+    REAL_CONST(5343.6748333646756/8.0),
+    REAL_CONST(5355.0777118862716/8.0),
+    REAL_CONST(5366.4866638471722/8.0),
+    REAL_CONST(5377.901682787985/8.0),
+    REAL_CONST(5389.3227622664635/8.0),
+    REAL_CONST(5400.749895857437/8.0),
+    REAL_CONST(5412.1830771527357/8.0),
+    REAL_CONST(5423.622299761123/8.0),
+    REAL_CONST(5435.067557308219/8.0),
+    REAL_CONST(5446.5188434364318/8.0),
+    REAL_CONST(5457.9761518048872/8.0),
+    REAL_CONST(5469.4394760893592/8.0),
+    REAL_CONST(5480.9088099821975/8.0),
+    REAL_CONST(5492.3841471922606/8.0),
+    REAL_CONST(5503.8654814448455/8.0),
+    REAL_CONST(5515.3528064816201/8.0),
+    REAL_CONST(5526.846116060552/8.0),
+    REAL_CONST(5538.3454039558474/8.0),
+    REAL_CONST(5549.8506639578736/8.0),
+    REAL_CONST(5561.3618898731029/8.0),
+    REAL_CONST(5572.8790755240361/8.0),
+    REAL_CONST(5584.4022147491451/8.0),
+    REAL_CONST(5595.9313014027975/8.0),
+    REAL_CONST(5607.4663293552012/8.0),
+    REAL_CONST(5619.0072924923297/8.0),
+    REAL_CONST(5630.5541847158656/8.0),
+    REAL_CONST(5642.1069999431284/8.0),
+    REAL_CONST(5653.665732107017/8.0),
+    REAL_CONST(5665.230375155943/8.0),
+    REAL_CONST(5676.8009230537655/8.0),
+    REAL_CONST(5688.3773697797333/8.0),
+    REAL_CONST(5699.9597093284156/8.0),
+    REAL_CONST(5711.5479357096474/8.0),
+    REAL_CONST(5723.1420429484588/8.0),
+    REAL_CONST(5734.7420250850209/8.0),
+    REAL_CONST(5746.347876174581/8.0),
+    REAL_CONST(5757.9595902874016/8.0),
+    REAL_CONST(5769.5771615087006/8.0),
+    REAL_CONST(5781.2005839385911/8.0),
+    REAL_CONST(5792.8298516920213/8.0),
+    REAL_CONST(5804.4649588987149/8.0),
+    REAL_CONST(5816.1058997031105/8.0),
+    REAL_CONST(5827.7526682643065/8.0),
+    REAL_CONST(5839.4052587559972/8.0),
+    REAL_CONST(5851.0636653664196/8.0),
+    REAL_CONST(5862.7278822982908/8.0),
+    REAL_CONST(5874.3979037687541/8.0),
+    REAL_CONST(5886.0737240093204/8.0),
+    REAL_CONST(5897.7553372658094/8.0),
+    REAL_CONST(5909.4427377982956/8.0),
+    REAL_CONST(5921.1359198810505/8.0),
+    REAL_CONST(5932.8348778024874/8.0),
+    REAL_CONST(5944.5396058651031/8.0),
+    REAL_CONST(5956.2500983854261/8.0),
+    REAL_CONST(5967.9663496939575/8.0),
+    REAL_CONST(5979.6883541351208/8.0),
+    REAL_CONST(5991.4161060672022/8.0),
+    REAL_CONST(6003.1495998623004/8.0),
+    REAL_CONST(6014.8888299062692/8.0),
+    REAL_CONST(6026.6337905986684/8.0),
+    REAL_CONST(6038.3844763527022/8.0),
+    REAL_CONST(6050.1408815951781/8.0),
+    REAL_CONST(6061.9030007664414/8.0),
+    REAL_CONST(6073.6708283203316/8.0),
+    REAL_CONST(6085.4443587241267/8.0),
+    REAL_CONST(6097.2235864584891/8.0),
+    REAL_CONST(6109.0085060174197/8.0),
+    REAL_CONST(6120.7991119081998/8.0),
+    REAL_CONST(6132.595398651345/8.0),
+    REAL_CONST(6144.3973607805519/8.0),
+    REAL_CONST(6156.2049928426459/8.0),
+    REAL_CONST(6168.0182893975361/8.0),
+    REAL_CONST(6179.8372450181578/8.0),
+    REAL_CONST(6191.6618542904307/8.0),
+    REAL_CONST(6203.4921118132024/8.0),
+    REAL_CONST(6215.3280121982016/8.0),
+    REAL_CONST(6227.1695500699925/8.0),
+    REAL_CONST(6239.0167200659189/8.0),
+    REAL_CONST(6250.8695168360628/8.0),
+    REAL_CONST(6262.7279350431891/8.0),
+    REAL_CONST(6274.5919693627056/8.0),
+    REAL_CONST(6286.4616144826068/8.0),
+    REAL_CONST(6298.3368651034316/8.0),
+    REAL_CONST(6310.2177159382172/8.0),
+    REAL_CONST(6322.1041617124456/8.0),
+    REAL_CONST(6333.9961971640032/8.0),
+    REAL_CONST(6345.8938170431311/8.0),
+    REAL_CONST(6357.7970161123785/8.0),
+    REAL_CONST(6369.7057891465583/8.0),
+    REAL_CONST(6381.6201309327007/8.0),
+    REAL_CONST(6393.5400362700075/8.0),
+    REAL_CONST(6405.4654999698032/8.0),
+    REAL_CONST(6417.3965168554978/8.0),
+    REAL_CONST(6429.3330817625329/8.0),
+    REAL_CONST(6441.2751895383453/8.0),
+    REAL_CONST(6453.2228350423138/8.0),
+    REAL_CONST(6465.176013145724/8.0),
+    REAL_CONST(6477.134718731716/8.0),
+    REAL_CONST(6489.0989466952469/8.0),
+    REAL_CONST(6501.0686919430445/8.0),
+    REAL_CONST(6513.0439493935628/8.0),
+    REAL_CONST(6525.0247139769417/8.0),
+    REAL_CONST(6537.010980634961/8.0),
+    REAL_CONST(6549.002744321001/8.0),
+    REAL_CONST(6560.9999999999973/8.0),
+    REAL_CONST(6573.0027426483985/8.0),
+    REAL_CONST(6585.0109672541284/8.0),
+    REAL_CONST(6597.0246688165371/8.0),
+    REAL_CONST(6609.0438423463656/8.0),
+    REAL_CONST(6621.0684828657004/8.0),
+    REAL_CONST(6633.0985854079354/8.0),
+    REAL_CONST(6645.134145017727/8.0),
+    REAL_CONST(6657.1751567509573/8.0),
+    REAL_CONST(6669.2216156746908/8.0),
+    REAL_CONST(6681.2735168671343/8.0),
+    REAL_CONST(6693.3308554176001/8.0),
+    REAL_CONST(6705.3936264264594/8.0),
+    REAL_CONST(6717.461825005108/8.0),
+    REAL_CONST(6729.535446275926/8.0),
+    REAL_CONST(6741.6144853722335/8.0),
+    REAL_CONST(6753.6989374382601/8.0),
+    REAL_CONST(6765.7887976290967/8.0),
+    REAL_CONST(6777.8840611106634/8.0),
+    REAL_CONST(6789.9847230596661/8.0),
+    REAL_CONST(6802.0907786635626/8.0),
+    REAL_CONST(6814.2022231205201/8.0),
+    REAL_CONST(6826.3190516393797/8.0),
+    REAL_CONST(6838.4412594396181/8.0),
+    REAL_CONST(6850.5688417513074/8.0),
+    REAL_CONST(6862.701793815083/8.0),
+    REAL_CONST(6874.840110882099/8.0),
+    REAL_CONST(6886.9837882139991/8.0),
+    REAL_CONST(6899.1328210828724/8.0),
+    REAL_CONST(6911.2872047712199/8.0),
+    REAL_CONST(6923.4469345719199/8.0),
+    REAL_CONST(6935.6120057881863/8.0),
+    REAL_CONST(6947.7824137335365/8.0),
+    REAL_CONST(6959.9581537317536/8.0),
+    REAL_CONST(6972.1392211168532/8.0),
+    REAL_CONST(6984.3256112330409/8.0),
+    REAL_CONST(6996.5173194346862/8.0),
+    REAL_CONST(7008.7143410862773/8.0),
+    REAL_CONST(7020.9166715623942/8.0),
+    REAL_CONST(7033.1243062476678/8.0),
+    REAL_CONST(7045.3372405367481/8.0),
+    REAL_CONST(7057.5554698342685/8.0),
+    REAL_CONST(7069.7789895548103/8.0),
+    REAL_CONST(7082.0077951228714/8.0),
+    REAL_CONST(7094.2418819728273/8.0),
+    REAL_CONST(7106.4812455489018/8.0),
+    REAL_CONST(7118.7258813051285/8.0),
+    REAL_CONST(7130.9757847053224/8.0),
+    REAL_CONST(7143.2309512230404/8.0),
+    REAL_CONST(7155.4913763415516/8.0),
+    REAL_CONST(7167.7570555538041/8.0),
+    REAL_CONST(7180.0279843623894/8.0),
+    REAL_CONST(7192.3041582795131/8.0),
+    REAL_CONST(7204.5855728269571/8.0),
+    REAL_CONST(7216.8722235360519/8.0),
+    REAL_CONST(7229.1641059476406/8.0),
+    REAL_CONST(7241.4612156120484/8.0),
+    REAL_CONST(7253.7635480890503/8.0),
+    REAL_CONST(7266.0710989478375/8.0),
+    REAL_CONST(7278.3838637669869/8.0),
+    REAL_CONST(7290.7018381344296/8.0),
+    REAL_CONST(7303.0250176474174/8.0),
+    REAL_CONST(7315.3533979124932/8.0),
+    REAL_CONST(7327.6869745454596/8.0),
+    REAL_CONST(7340.0257431713462/8.0),
+    REAL_CONST(7352.3696994243801/8.0),
+    REAL_CONST(7364.7188389479543/8.0),
+    REAL_CONST(7377.0731573945968/8.0),
+    REAL_CONST(7389.4326504259407/8.0),
+    REAL_CONST(7401.7973137126937/8.0),
+    REAL_CONST(7414.1671429346061/8.0),
+    REAL_CONST(7426.5421337804428/8.0),
+    REAL_CONST(7438.922281947951/8.0),
+    REAL_CONST(7451.3075831438346/8.0),
+    REAL_CONST(7463.6980330837177/8.0),
+    REAL_CONST(7476.0936274921214/8.0),
+    REAL_CONST(7488.4943621024304/8.0),
+    REAL_CONST(7500.9002326568652/8.0),
+    REAL_CONST(7513.3112349064522/8.0),
+    REAL_CONST(7525.7273646109943/8.0),
+    REAL_CONST(7538.1486175390446/8.0),
+    REAL_CONST(7550.5749894678729/8.0),
+    REAL_CONST(7563.0064761834419/8.0),
+    REAL_CONST(7575.4430734803736/8.0),
+    REAL_CONST(7587.8847771619248/8.0),
+    REAL_CONST(7600.3315830399597/8.0),
+    REAL_CONST(7612.7834869349153/8.0),
+    REAL_CONST(7625.24048467578/8.0),
+    REAL_CONST(7637.7025721000637/8.0),
+    REAL_CONST(7650.1697450537677/8.0),
+    REAL_CONST(7662.6419993913596/8.0),
+    REAL_CONST(7675.1193309757446/8.0),
+    REAL_CONST(7687.6017356782404/8.0),
+    REAL_CONST(7700.0892093785433/8.0),
+    REAL_CONST(7712.5817479647112/8.0),
+    REAL_CONST(7725.079347333125/8.0),
+    REAL_CONST(7737.5820033884729/8.0),
+    REAL_CONST(7750.0897120437139/8.0),
+    REAL_CONST(7762.6024692200581/8.0),
+    REAL_CONST(7775.1202708469355/8.0),
+    REAL_CONST(7787.6431128619733/8.0),
+    REAL_CONST(7800.1709912109645/8.0),
+    REAL_CONST(7812.7039018478481/8.0),
+    REAL_CONST(7825.2418407346768/8.0),
+    REAL_CONST(7837.7848038415968/8.0),
+    REAL_CONST(7850.3327871468155/8.0),
+    REAL_CONST(7862.8857866365806/8.0),
+    REAL_CONST(7875.4437983051539/8.0),
+    REAL_CONST(7888.006818154784/8.0),
+    REAL_CONST(7900.5748421956796/8.0),
+    REAL_CONST(7913.1478664459901/8.0),
+    REAL_CONST(7925.725886931772/8.0),
+    REAL_CONST(7938.3088996869719/8.0),
+    REAL_CONST(7950.8969007533951/8.0),
+    REAL_CONST(7963.4898861806851/8.0),
+    REAL_CONST(7976.0878520262959/8.0),
+    REAL_CONST(7988.6907943554688/8.0),
+    REAL_CONST(8001.2987092412086/8.0),
+    REAL_CONST(8013.911592764257/8.0),
+    REAL_CONST(8026.5294410130691/8.0),
+    REAL_CONST(8039.1522500837891/8.0),
+    REAL_CONST(8051.7800160802271/8.0),
+    REAL_CONST(8064.412735113835/8.0),
+    REAL_CONST(8077.0504033036796/8.0),
+    REAL_CONST(8089.6930167764222/8.0),
+    REAL_CONST(8102.3405716662946/8.0),
+    REAL_CONST(8114.9930641150731/8.0),
+    REAL_CONST(8127.6504902720571/8.0),
+    REAL_CONST(8140.3128462940449/8.0),
+    REAL_CONST(8152.9801283453098/8.0),
+    REAL_CONST(8165.6523325975786/8.0),
+    REAL_CONST(8178.3294552300049/8.0),
+    REAL_CONST(8191.0114924291529/8.0),
+    REAL_CONST(8203.6984403889655/8.0),
+    REAL_CONST(8216.3902953107463/8.0),
+    REAL_CONST(8229.0870534031419/8.0),
+    REAL_CONST(8241.7887108821069/8.0),
+    REAL_CONST(8254.4952639708936/8.0),
+    REAL_CONST(8267.2067089000211/8.0),
+    REAL_CONST(8279.9230419072574/8.0),
+    REAL_CONST(8292.6442592375952/8.0),
+    REAL_CONST(8305.3703571432306/8.0),
+    REAL_CONST(8318.101331883543/8.0),
+    REAL_CONST(8330.8371797250657/8.0),
+    REAL_CONST(8343.577896941475/8.0),
+    REAL_CONST(8356.3234798135582/8.0),
+    REAL_CONST(8369.0739246291978/8.0),
+    REAL_CONST(8381.8292276833508/8.0),
+    REAL_CONST(8394.5893852780209/8.0),
+    REAL_CONST(8407.3543937222421/8.0),
+    REAL_CONST(8420.1242493320569/8.0),
+    REAL_CONST(8432.8989484304948/8.0),
+    REAL_CONST(8445.6784873475499/8.0),
+    REAL_CONST(8458.4628624201578/8.0),
+    REAL_CONST(8471.2520699921806/8.0),
+    REAL_CONST(8484.0461064143838/8.0),
+    REAL_CONST(8496.8449680444082/8.0),
+    REAL_CONST(8509.6486512467636/8.0),
+    REAL_CONST(8522.4571523927953/8.0),
+    REAL_CONST(8535.270467860666/8.0),
+    REAL_CONST(8548.0885940353437/8.0),
+    REAL_CONST(8560.9115273085663/8.0),
+    REAL_CONST(8573.7392640788403/8.0),
+    REAL_CONST(8586.5718007514006/8.0),
+    REAL_CONST(8599.4091337382069/8.0),
+    REAL_CONST(8612.2512594579148/8.0),
+    REAL_CONST(8625.0981743358552/8.0),
+    REAL_CONST(8637.9498748040205/8.0),
+    REAL_CONST(8650.8063573010386/8.0),
+    REAL_CONST(8663.6676182721567/8.0),
+    REAL_CONST(8676.533654169225/8.0),
+    REAL_CONST(8689.4044614506638/8.0),
+    REAL_CONST(8702.2800365814601/8.0),
+    REAL_CONST(8715.1603760331418/8.0),
+    REAL_CONST(8728.0454762837508/8.0),
+    REAL_CONST(8740.9353338178389/8.0),
+    REAL_CONST(8753.8299451264356/8.0),
+    REAL_CONST(8766.7293067070332/8.0),
+    REAL_CONST(8779.6334150635721/8.0),
+    REAL_CONST(8792.5422667064158/8.0),
+    REAL_CONST(8805.4558581523324/8.0),
+    REAL_CONST(8818.3741859244819/8.0),
+    REAL_CONST(8831.2972465523908/8.0),
+    REAL_CONST(8844.2250365719356/8.0),
+    REAL_CONST(8857.1575525253265/8.0),
+    REAL_CONST(8870.0947909610859/8.0),
+    REAL_CONST(8883.0367484340295/8.0),
+    REAL_CONST(8895.9834215052524/8.0),
+    REAL_CONST(8908.934806742107/8.0),
+    REAL_CONST(8921.8909007181846/8.0),
+    REAL_CONST(8934.8517000132997/8.0),
+    REAL_CONST(8947.817201213471/8.0),
+    REAL_CONST(8960.7874009109/8.0),
+    REAL_CONST(8973.7622957039603/8.0),
+    REAL_CONST(8986.7418821971733/8.0),
+    REAL_CONST(8999.7261570011924/8.0),
+    REAL_CONST(9012.7151167327884/8.0),
+    REAL_CONST(9025.7087580148236/8.0),
+    REAL_CONST(9038.7070774762469/8.0),
+    REAL_CONST(9051.7100717520643/8.0),
+    REAL_CONST(9064.7177374833282/8.0),
+    REAL_CONST(9077.7300713171153/8.0),
+    REAL_CONST(9090.7470699065179/8.0),
+    REAL_CONST(9103.7687299106146/8.0),
+    REAL_CONST(9116.7950479944648/8.0),
+    REAL_CONST(9129.8260208290812/8.0),
+    REAL_CONST(9142.8616450914233/8.0),
+    REAL_CONST(9155.9019174643727/8.0),
+    REAL_CONST(9168.9468346367157/8.0),
+    REAL_CONST(9181.9963933031358/8.0),
+    REAL_CONST(9195.0505901641845/8.0),
+    REAL_CONST(9208.1094219262741/8.0),
+    REAL_CONST(9221.1728853016557/8.0),
+    REAL_CONST(9234.240977008405/8.0),
+    REAL_CONST(9247.3136937704076/8.0),
+    REAL_CONST(9260.3910323173386/8.0),
+    REAL_CONST(9273.472989384647/8.0),
+    REAL_CONST(9286.5595617135423/8.0),
+    REAL_CONST(9299.6507460509747/8.0),
+    REAL_CONST(9312.7465391496207/8.0),
+    REAL_CONST(9325.8469377678684/8.0),
+    REAL_CONST(9338.9519386698012/8.0),
+    REAL_CONST(9352.0615386251757/8.0),
+    REAL_CONST(9365.1757344094131/8.0),
+    REAL_CONST(9378.2945228035842/8.0),
+    REAL_CONST(9391.4179005943843/8.0),
+    REAL_CONST(9404.5458645741273/8.0),
+    REAL_CONST(9417.6784115407263/8.0),
+    REAL_CONST(9430.8155382976747/8.0),
+    REAL_CONST(9443.9572416540359/8.0),
+    REAL_CONST(9457.1035184244265/8.0),
+    REAL_CONST(9470.2543654290002/8.0),
+    REAL_CONST(9483.4097794934296/8.0),
+    REAL_CONST(9496.5697574488931/8.0),
+    REAL_CONST(9509.7342961320664/8.0),
+    REAL_CONST(9522.9033923850911/8.0),
+    REAL_CONST(9536.0770430555804/8.0),
+    REAL_CONST(9549.2552449965824/8.0),
+    REAL_CONST(9562.4379950665825/8.0),
+    REAL_CONST(9575.6252901294793/8.0),
+    REAL_CONST(9588.8171270545736/8.0),
+    REAL_CONST(9602.0135027165488/8.0),
+    REAL_CONST(9615.2144139954635/8.0),
+    REAL_CONST(9628.4198577767274/8.0),
+    REAL_CONST(9641.629830951093/8.0),
+    REAL_CONST(9654.844330414644/8.0),
+    REAL_CONST(9668.0633530687719/8.0),
+    REAL_CONST(9681.286895820167/8.0),
+    REAL_CONST(9694.5149555808002/8.0),
+    REAL_CONST(9707.7475292679192/8.0),
+    REAL_CONST(9720.9846138040157/8.0),
+    REAL_CONST(9734.2262061168276/8.0),
+    REAL_CONST(9747.4723031393187/8.0),
+    REAL_CONST(9760.7229018096641/8.0),
+    REAL_CONST(9773.9779990712323/8.0),
+    REAL_CONST(9787.2375918725811/8.0),
+    REAL_CONST(9800.5016771674327/8.0),
+    REAL_CONST(9813.7702519146696/8.0),
+    REAL_CONST(9827.0433130783094/8.0),
+    REAL_CONST(9840.3208576275028/8.0),
+    REAL_CONST(9853.602882536512/8.0),
+    REAL_CONST(9866.8893847846994/8.0),
+    REAL_CONST(9880.1803613565116/8.0),
+    REAL_CONST(9893.4758092414686/8.0),
+    REAL_CONST(9906.7757254341523/8.0),
+    REAL_CONST(9920.0801069341851/8.0),
+    REAL_CONST(9933.3889507462245/8.0),
+    REAL_CONST(9946.7022538799429/8.0),
+    REAL_CONST(9960.0200133500221/8.0),
+    REAL_CONST(9973.3422261761298/8.0),
+    REAL_CONST(9986.6688893829159/8.0),
+    REAL_CONST(9999.9999999999945/8.0),
+    REAL_CONST(10013.335555061929/8.0),
+    REAL_CONST(10026.675551608221/8.0),
+    REAL_CONST(10040.019986683301/8.0),
+    REAL_CONST(10053.368857336509/8.0),
+    REAL_CONST(10066.722160622081/8.0),
+    REAL_CONST(10080.079893599144/8.0),
+    REAL_CONST(10093.442053331697/8.0),
+    REAL_CONST(10106.808636888598/8.0),
+    REAL_CONST(10120.179641343551/8.0),
+    REAL_CONST(10133.555063775095/8.0),
+    REAL_CONST(10146.934901266595/8.0),
+    REAL_CONST(10160.31915090622/8.0),
+    REAL_CONST(10173.707809786936/8.0),
+    REAL_CONST(10187.100875006496/8.0),
+    REAL_CONST(10200.498343667417/8.0),
+    REAL_CONST(10213.900212876984/8.0),
+    REAL_CONST(10227.306479747222/8.0),
+    REAL_CONST(10240.717141394889/8.0),
+    REAL_CONST(10254.132194941467/8.0),
+    REAL_CONST(10267.551637513146/8.0),
+    REAL_CONST(10280.975466240814/8.0),
+    REAL_CONST(10294.40367826004/8.0),
+    REAL_CONST(10307.836270711066/8.0),
+    REAL_CONST(10321.273240738796/8.0),
+    REAL_CONST(10334.71458549278/8.0)
+};
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/is.c	Mon Oct 24 10:44:27 2005 -0700
@@ -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.17 2003/11/12 20:47:58 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_R(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_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/Input/aac/libfaad2/is.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.11 2003/11/12 20:47:58 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/Input/aac/libfaad2/kbd_win.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,2294 @@
+/*
+** 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.11 2003/11/12 20:47:58 menno Exp $
+**/
+
+#ifndef __KBD_WIN_H__
+#define __KBD_WIN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+
+real_t kbd_long_1024[] =
+{
+    FRAC_CONST(0.00029256153896361),
+    FRAC_CONST(0.00042998567353047),
+    FRAC_CONST(0.00054674074589540),
+    FRAC_CONST(0.00065482304299792),
+    FRAC_CONST(0.00075870195068747),
+    FRAC_CONST(0.00086059331713336),
+    FRAC_CONST(0.00096177541439010),
+    FRAC_CONST(0.0010630609410878),
+    FRAC_CONST(0.0011650036308132),
+    FRAC_CONST(0.0012680012194148),
+    FRAC_CONST(0.0013723517232956),
+    FRAC_CONST(0.0014782864109136),
+    FRAC_CONST(0.0015859901976719),
+    FRAC_CONST(0.0016956148252373),
+    FRAC_CONST(0.0018072876903517),
+    FRAC_CONST(0.0019211179405514),
+    FRAC_CONST(0.0020372007924215),
+    FRAC_CONST(0.0021556206591754),
+    FRAC_CONST(0.0022764534599614),
+    FRAC_CONST(0.0023997683540995),
+    FRAC_CONST(0.0025256290631156),
+    FRAC_CONST(0.0026540948920831),
+    FRAC_CONST(0.0027852215281403),
+    FRAC_CONST(0.0029190616715331),
+    FRAC_CONST(0.0030556655443223),
+    FRAC_CONST(0.0031950812943391),
+    FRAC_CONST(0.0033373553240392),
+    FRAC_CONST(0.0034825325586930),
+    FRAC_CONST(0.0036306566699199),
+    FRAC_CONST(0.0037817702604646),
+    FRAC_CONST(0.0039359150179719),
+    FRAC_CONST(0.0040931318437260),
+    FRAC_CONST(0.0042534609610026),
+    FRAC_CONST(0.0044169420066964),
+    FRAC_CONST(0.0045836141091341),
+    FRAC_CONST(0.0047535159544086),
+    FRAC_CONST(0.0049266858431214),
+    FRAC_CONST(0.0051031617390698),
+    FRAC_CONST(0.0052829813111335),
+    FRAC_CONST(0.0054661819693975),
+    FRAC_CONST(0.0056528008963682),
+    FRAC_CONST(0.0058428750739943),
+    FRAC_CONST(0.0060364413070882),
+    FRAC_CONST(0.0062335362436492),
+    FRAC_CONST(0.0064341963925079),
+    FRAC_CONST(0.0066384581386503),
+    FRAC_CONST(0.0068463577565218),
+    FRAC_CONST(0.0070579314215715),
+    FRAC_CONST(0.0072732152202559),
+    FRAC_CONST(0.0074922451586909),
+    FRAC_CONST(0.0077150571701162),
+    FRAC_CONST(0.0079416871213115),
+    FRAC_CONST(0.0081721708180857),
+    FRAC_CONST(0.0084065440099458),
+    FRAC_CONST(0.0086448423940363),
+    FRAC_CONST(0.0088871016184291),
+    FRAC_CONST(0.0091333572848345),
+    FRAC_CONST(0.0093836449507939),
+    FRAC_CONST(0.0096380001314086),
+    FRAC_CONST(0.0098964583006517),
+    FRAC_CONST(0.010159054892306),
+    FRAC_CONST(0.010425825300561),
+    FRAC_CONST(0.010696804880310),
+    FRAC_CONST(0.010972028947167),
+    FRAC_CONST(0.011251532777236),
+    FRAC_CONST(0.011535351606646),
+    FRAC_CONST(0.011823520630897),
+    FRAC_CONST(0.012116075003993),
+    FRAC_CONST(0.012413049837429),
+    FRAC_CONST(0.012714480198999),
+    FRAC_CONST(0.013020401111478),
+    FRAC_CONST(0.013330847551161),
+    FRAC_CONST(0.013645854446288),
+    FRAC_CONST(0.013965456675352),
+    FRAC_CONST(0.014289689065314),
+    FRAC_CONST(0.014618586389712),
+    FRAC_CONST(0.014952183366697),
+    FRAC_CONST(0.015290514656976),
+    FRAC_CONST(0.015633614861688),
+    FRAC_CONST(0.015981518520214),
+    FRAC_CONST(0.016334260107915),
+    FRAC_CONST(0.016691874033817),
+    FRAC_CONST(0.017054394638241),
+    FRAC_CONST(0.017421856190380),
+    FRAC_CONST(0.017794292885832),
+    FRAC_CONST(0.018171738844085),
+    FRAC_CONST(0.018554228105962),
+    FRAC_CONST(0.018941794631032),
+    FRAC_CONST(0.019334472294980),
+    FRAC_CONST(0.019732294886947),
+    FRAC_CONST(0.020135296106839),
+    FRAC_CONST(0.020543509562604),
+    FRAC_CONST(0.020956968767488),
+    FRAC_CONST(0.021375707137257),
+    FRAC_CONST(0.021799757987407),
+    FRAC_CONST(0.022229154530343),
+    FRAC_CONST(0.022663929872540),
+    FRAC_CONST(0.023104117011689),
+    FRAC_CONST(0.023549748833816),
+    FRAC_CONST(0.024000858110398),
+    FRAC_CONST(0.024457477495451),
+    FRAC_CONST(0.024919639522613),
+    FRAC_CONST(0.025387376602207),
+    FRAC_CONST(0.025860721018295),
+    FRAC_CONST(0.026339704925726),
+    FRAC_CONST(0.026824360347160),
+    FRAC_CONST(0.027314719170100),
+    FRAC_CONST(0.027810813143900),
+    FRAC_CONST(0.028312673876775),
+    FRAC_CONST(0.028820332832801),
+    FRAC_CONST(0.029333821328905),
+    FRAC_CONST(0.029853170531859),
+    FRAC_CONST(0.030378411455255),
+    FRAC_CONST(0.030909574956490),
+    FRAC_CONST(0.031446691733739),
+    FRAC_CONST(0.031989792322926),
+    FRAC_CONST(0.032538907094693),
+    FRAC_CONST(0.033094066251369),
+    FRAC_CONST(0.033655299823935),
+    FRAC_CONST(0.034222637668991),
+    FRAC_CONST(0.034796109465717),
+    FRAC_CONST(0.035375744712844),
+    FRAC_CONST(0.035961572725616),
+    FRAC_CONST(0.036553622632758),
+    FRAC_CONST(0.037151923373446),
+    FRAC_CONST(0.037756503694277),
+    FRAC_CONST(0.038367392146243),
+    FRAC_CONST(0.038984617081711),
+    FRAC_CONST(0.039608206651398),
+    FRAC_CONST(0.040238188801359),
+    FRAC_CONST(0.040874591269976),
+    FRAC_CONST(0.041517441584950),
+    FRAC_CONST(0.042166767060301),
+    FRAC_CONST(0.042822594793376),
+    FRAC_CONST(0.043484951661852),
+    FRAC_CONST(0.044153864320760),
+    FRAC_CONST(0.044829359199509),
+    FRAC_CONST(0.045511462498913),
+    FRAC_CONST(0.046200200188234),
+    FRAC_CONST(0.046895598002228),
+    FRAC_CONST(0.047597681438201),
+    FRAC_CONST(0.048306475753074),
+    FRAC_CONST(0.049022005960455),
+    FRAC_CONST(0.049744296827725),
+    FRAC_CONST(0.050473372873129),
+    FRAC_CONST(0.051209258362879),
+    FRAC_CONST(0.051951977308273),
+    FRAC_CONST(0.052701553462813),
+    FRAC_CONST(0.053458010319350),
+    FRAC_CONST(0.054221371107223),
+    FRAC_CONST(0.054991658789428),
+    FRAC_CONST(0.055768896059787),
+    FRAC_CONST(0.056553105340134),
+    FRAC_CONST(0.057344308777513),
+    FRAC_CONST(0.058142528241393),
+    FRAC_CONST(0.058947785320893),
+    FRAC_CONST(0.059760101322019),
+    FRAC_CONST(0.060579497264926),
+    FRAC_CONST(0.061405993881180),
+    FRAC_CONST(0.062239611611049),
+    FRAC_CONST(0.063080370600799),
+    FRAC_CONST(0.063928290700012),
+    FRAC_CONST(0.064783391458919),
+    FRAC_CONST(0.065645692125747),
+    FRAC_CONST(0.066515211644086),
+    FRAC_CONST(0.067391968650269),
+    FRAC_CONST(0.068275981470777),
+    FRAC_CONST(0.069167268119652),
+    FRAC_CONST(0.070065846295935),
+    FRAC_CONST(0.070971733381121),
+    FRAC_CONST(0.071884946436630),
+    FRAC_CONST(0.072805502201299),
+    FRAC_CONST(0.073733417088896),
+    FRAC_CONST(0.074668707185649),
+    FRAC_CONST(0.075611388247794),
+    FRAC_CONST(0.076561475699152),
+    FRAC_CONST(0.077518984628715),
+    FRAC_CONST(0.078483929788261),
+    FRAC_CONST(0.079456325589986),
+    FRAC_CONST(0.080436186104162),
+    FRAC_CONST(0.081423525056808),
+    FRAC_CONST(0.082418355827392),
+    FRAC_CONST(0.083420691446553),
+    FRAC_CONST(0.084430544593841),
+    FRAC_CONST(0.085447927595483),
+    FRAC_CONST(0.086472852422178),
+    FRAC_CONST(0.087505330686900),
+    FRAC_CONST(0.088545373642744),
+    FRAC_CONST(0.089592992180780),
+    FRAC_CONST(0.090648196827937),
+    FRAC_CONST(0.091710997744919),
+    FRAC_CONST(0.092781404724131),
+    FRAC_CONST(0.093859427187640),
+    FRAC_CONST(0.094945074185163),
+    FRAC_CONST(0.096038354392069),
+    FRAC_CONST(0.097139276107423),
+    FRAC_CONST(0.098247847252041),
+    FRAC_CONST(0.099364075366580),
+    FRAC_CONST(0.10048796760965),
+    FRAC_CONST(0.10161953075597),
+    FRAC_CONST(0.10275877119451),
+    FRAC_CONST(0.10390569492671),
+    FRAC_CONST(0.10506030756469),
+    FRAC_CONST(0.10622261432949),
+    FRAC_CONST(0.10739262004941),
+    FRAC_CONST(0.10857032915821),
+    FRAC_CONST(0.10975574569357),
+    FRAC_CONST(0.11094887329534),
+    FRAC_CONST(0.11214971520402),
+    FRAC_CONST(0.11335827425914),
+    FRAC_CONST(0.11457455289772),
+    FRAC_CONST(0.11579855315274),
+    FRAC_CONST(0.11703027665170),
+    FRAC_CONST(0.11826972461510),
+    FRAC_CONST(0.11951689785504),
+    FRAC_CONST(0.12077179677383),
+    FRAC_CONST(0.12203442136263),
+    FRAC_CONST(0.12330477120008),
+    FRAC_CONST(0.12458284545102),
+    FRAC_CONST(0.12586864286523),
+    FRAC_CONST(0.12716216177615),
+    FRAC_CONST(0.12846340009971),
+    FRAC_CONST(0.12977235533312),
+    FRAC_CONST(0.13108902455375),
+    FRAC_CONST(0.13241340441801),
+    FRAC_CONST(0.13374549116025),
+    FRAC_CONST(0.13508528059173),
+    FRAC_CONST(0.13643276809961),
+    FRAC_CONST(0.13778794864595),
+    FRAC_CONST(0.13915081676677),
+    FRAC_CONST(0.14052136657114),
+    FRAC_CONST(0.14189959174027),
+    FRAC_CONST(0.14328548552671),
+    FRAC_CONST(0.14467904075349),
+    FRAC_CONST(0.14608024981336),
+    FRAC_CONST(0.14748910466804),
+    FRAC_CONST(0.14890559684750),
+    FRAC_CONST(0.15032971744929),
+    FRAC_CONST(0.15176145713790),
+    FRAC_CONST(0.15320080614414),
+    FRAC_CONST(0.15464775426459),
+    FRAC_CONST(0.15610229086100),
+    FRAC_CONST(0.15756440485987),
+    FRAC_CONST(0.15903408475193),
+    FRAC_CONST(0.16051131859170),
+    FRAC_CONST(0.16199609399712),
+    FRAC_CONST(0.16348839814917),
+    FRAC_CONST(0.16498821779156),
+    FRAC_CONST(0.16649553923042),
+    FRAC_CONST(0.16801034833404),
+    FRAC_CONST(0.16953263053270),
+    FRAC_CONST(0.17106237081842),
+    FRAC_CONST(0.17259955374484),
+    FRAC_CONST(0.17414416342714),
+    FRAC_CONST(0.17569618354193),
+    FRAC_CONST(0.17725559732720),
+    FRAC_CONST(0.17882238758238),
+    FRAC_CONST(0.18039653666830),
+    FRAC_CONST(0.18197802650733),
+    FRAC_CONST(0.18356683858343),
+    FRAC_CONST(0.18516295394233),
+    FRAC_CONST(0.18676635319174),
+    FRAC_CONST(0.18837701650148),
+    FRAC_CONST(0.18999492360384),
+    FRAC_CONST(0.19162005379380),
+    FRAC_CONST(0.19325238592940),
+    FRAC_CONST(0.19489189843209),
+    FRAC_CONST(0.19653856928714),
+    FRAC_CONST(0.19819237604409),
+    FRAC_CONST(0.19985329581721),
+    FRAC_CONST(0.20152130528605),
+    FRAC_CONST(0.20319638069594),
+    FRAC_CONST(0.20487849785865),
+    FRAC_CONST(0.20656763215298),
+    FRAC_CONST(0.20826375852540),
+    FRAC_CONST(0.20996685149083),
+    FRAC_CONST(0.21167688513330),
+    FRAC_CONST(0.21339383310678),
+    FRAC_CONST(0.21511766863598),
+    FRAC_CONST(0.21684836451719),
+    FRAC_CONST(0.21858589311922),
+    FRAC_CONST(0.22033022638425),
+    FRAC_CONST(0.22208133582887),
+    FRAC_CONST(0.22383919254503),
+    FRAC_CONST(0.22560376720111),
+    FRAC_CONST(0.22737503004300),
+    FRAC_CONST(0.22915295089517),
+    FRAC_CONST(0.23093749916189),
+    FRAC_CONST(0.23272864382838),
+    FRAC_CONST(0.23452635346201),
+    FRAC_CONST(0.23633059621364),
+    FRAC_CONST(0.23814133981883),
+    FRAC_CONST(0.23995855159925),
+    FRAC_CONST(0.24178219846403),
+    FRAC_CONST(0.24361224691114),
+    FRAC_CONST(0.24544866302890),
+    FRAC_CONST(0.24729141249740),
+    FRAC_CONST(0.24914046059007),
+    FRAC_CONST(0.25099577217522),
+    FRAC_CONST(0.25285731171763),
+    FRAC_CONST(0.25472504328019),
+    FRAC_CONST(0.25659893052556),
+    FRAC_CONST(0.25847893671788),
+    FRAC_CONST(0.26036502472451),
+    FRAC_CONST(0.26225715701781),
+    FRAC_CONST(0.26415529567692),
+    FRAC_CONST(0.26605940238966),
+    FRAC_CONST(0.26796943845439),
+    FRAC_CONST(0.26988536478190),
+    FRAC_CONST(0.27180714189742),
+    FRAC_CONST(0.27373472994256),
+    FRAC_CONST(0.27566808867736),
+    FRAC_CONST(0.27760717748238),
+    FRAC_CONST(0.27955195536071),
+    FRAC_CONST(0.28150238094021),
+    FRAC_CONST(0.28345841247557),
+    FRAC_CONST(0.28542000785059),
+    FRAC_CONST(0.28738712458038),
+    FRAC_CONST(0.28935971981364),
+    FRAC_CONST(0.29133775033492),
+    FRAC_CONST(0.29332117256704),
+    FRAC_CONST(0.29530994257338),
+    FRAC_CONST(0.29730401606034),
+    FRAC_CONST(0.29930334837974),
+    FRAC_CONST(0.30130789453132),
+    FRAC_CONST(0.30331760916521),
+    FRAC_CONST(0.30533244658452),
+    FRAC_CONST(0.30735236074785),
+    FRAC_CONST(0.30937730527195),
+    FRAC_CONST(0.31140723343430),
+    FRAC_CONST(0.31344209817583),
+    FRAC_CONST(0.31548185210356),
+    FRAC_CONST(0.31752644749341),
+    FRAC_CONST(0.31957583629288),
+    FRAC_CONST(0.32162997012390),
+    FRAC_CONST(0.32368880028565),
+    FRAC_CONST(0.32575227775738),
+    FRAC_CONST(0.32782035320134),
+    FRAC_CONST(0.32989297696566),
+    FRAC_CONST(0.33197009908736),
+    FRAC_CONST(0.33405166929523),
+    FRAC_CONST(0.33613763701295),
+    FRAC_CONST(0.33822795136203),
+    FRAC_CONST(0.34032256116495),
+    FRAC_CONST(0.34242141494820),
+    FRAC_CONST(0.34452446094547),
+    FRAC_CONST(0.34663164710072),
+    FRAC_CONST(0.34874292107143),
+    FRAC_CONST(0.35085823023181),
+    FRAC_CONST(0.35297752167598),
+    FRAC_CONST(0.35510074222129),
+    FRAC_CONST(0.35722783841160),
+    FRAC_CONST(0.35935875652060),
+    FRAC_CONST(0.36149344255514),
+    FRAC_CONST(0.36363184225864),
+    FRAC_CONST(0.36577390111444),
+    FRAC_CONST(0.36791956434930),
+    FRAC_CONST(0.37006877693676),
+    FRAC_CONST(0.37222148360070),
+    FRAC_CONST(0.37437762881878),
+    FRAC_CONST(0.37653715682603),
+    FRAC_CONST(0.37870001161834),
+    FRAC_CONST(0.38086613695607),
+    FRAC_CONST(0.38303547636766),
+    FRAC_CONST(0.38520797315322),
+    FRAC_CONST(0.38738357038821),
+    FRAC_CONST(0.38956221092708),
+    FRAC_CONST(0.39174383740701),
+    FRAC_CONST(0.39392839225157),
+    FRAC_CONST(0.39611581767449),
+    FRAC_CONST(0.39830605568342),
+    FRAC_CONST(0.40049904808370),
+    FRAC_CONST(0.40269473648218),
+    FRAC_CONST(0.40489306229101),
+    FRAC_CONST(0.40709396673153),
+    FRAC_CONST(0.40929739083810),
+    FRAC_CONST(0.41150327546197),
+    FRAC_CONST(0.41371156127524),
+    FRAC_CONST(0.41592218877472),
+    FRAC_CONST(0.41813509828594),
+    FRAC_CONST(0.42035022996702),
+    FRAC_CONST(0.42256752381274),
+    FRAC_CONST(0.42478691965848),
+    FRAC_CONST(0.42700835718423),
+    FRAC_CONST(0.42923177591866),
+    FRAC_CONST(0.43145711524314),
+    FRAC_CONST(0.43368431439580),
+    FRAC_CONST(0.43591331247564),
+    FRAC_CONST(0.43814404844658),
+    FRAC_CONST(0.44037646114161),
+    FRAC_CONST(0.44261048926688),
+    FRAC_CONST(0.44484607140589),
+    FRAC_CONST(0.44708314602359),
+    FRAC_CONST(0.44932165147057),
+    FRAC_CONST(0.45156152598727),
+    FRAC_CONST(0.45380270770813),
+    FRAC_CONST(0.45604513466581),
+    FRAC_CONST(0.45828874479543),
+    FRAC_CONST(0.46053347593880),
+    FRAC_CONST(0.46277926584861),
+    FRAC_CONST(0.46502605219277),
+    FRAC_CONST(0.46727377255861),
+    FRAC_CONST(0.46952236445718),
+    FRAC_CONST(0.47177176532752),
+    FRAC_CONST(0.47402191254100),
+    FRAC_CONST(0.47627274340557),
+    FRAC_CONST(0.47852419517009),
+    FRAC_CONST(0.48077620502869),
+    FRAC_CONST(0.48302871012505),
+    FRAC_CONST(0.48528164755674),
+    FRAC_CONST(0.48753495437962),
+    FRAC_CONST(0.48978856761212),
+    FRAC_CONST(0.49204242423966),
+    FRAC_CONST(0.49429646121898),
+    FRAC_CONST(0.49655061548250),
+    FRAC_CONST(0.49880482394273),
+    FRAC_CONST(0.50105902349665),
+    FRAC_CONST(0.50331315103004),
+    FRAC_CONST(0.50556714342194),
+    FRAC_CONST(0.50782093754901),
+    FRAC_CONST(0.51007447028990),
+    FRAC_CONST(0.51232767852971),
+    FRAC_CONST(0.51458049916433),
+    FRAC_CONST(0.51683286910489),
+    FRAC_CONST(0.51908472528213),
+    FRAC_CONST(0.52133600465083),
+    FRAC_CONST(0.52358664419420),
+    FRAC_CONST(0.52583658092832),
+    FRAC_CONST(0.52808575190648),
+    FRAC_CONST(0.53033409422367),
+    FRAC_CONST(0.53258154502092),
+    FRAC_CONST(0.53482804148974),
+    FRAC_CONST(0.53707352087652),
+    FRAC_CONST(0.53931792048690),
+    FRAC_CONST(0.54156117769021),
+    FRAC_CONST(0.54380322992385),
+    FRAC_CONST(0.54604401469766),
+    FRAC_CONST(0.54828346959835),
+    FRAC_CONST(0.55052153229384),
+    FRAC_CONST(0.55275814053768),
+    FRAC_CONST(0.55499323217338),
+    FRAC_CONST(0.55722674513883),
+    FRAC_CONST(0.55945861747062),
+    FRAC_CONST(0.56168878730842),
+    FRAC_CONST(0.56391719289930),
+    FRAC_CONST(0.56614377260214),
+    FRAC_CONST(0.56836846489188),
+    FRAC_CONST(0.57059120836390),
+    FRAC_CONST(0.57281194173835),
+    FRAC_CONST(0.57503060386439),
+    FRAC_CONST(0.57724713372458),
+    FRAC_CONST(0.57946147043912),
+    FRAC_CONST(0.58167355327012),
+    FRAC_CONST(0.58388332162591),
+    FRAC_CONST(0.58609071506528),
+    FRAC_CONST(0.58829567330173),
+    FRAC_CONST(0.59049813620770),
+    FRAC_CONST(0.59269804381879),
+    FRAC_CONST(0.59489533633802),
+    FRAC_CONST(0.59708995413996),
+    FRAC_CONST(0.59928183777495),
+    FRAC_CONST(0.60147092797329),
+    FRAC_CONST(0.60365716564937),
+    FRAC_CONST(0.60584049190582),
+    FRAC_CONST(0.60802084803764),
+    FRAC_CONST(0.61019817553632),
+    FRAC_CONST(0.61237241609393),
+    FRAC_CONST(0.61454351160718),
+    FRAC_CONST(0.61671140418155),
+    FRAC_CONST(0.61887603613527),
+    FRAC_CONST(0.62103735000336),
+    FRAC_CONST(0.62319528854167),
+    FRAC_CONST(0.62534979473088),
+    FRAC_CONST(0.62750081178042),
+    FRAC_CONST(0.62964828313250),
+    FRAC_CONST(0.63179215246597),
+    FRAC_CONST(0.63393236370030),
+    FRAC_CONST(0.63606886099946),
+    FRAC_CONST(0.63820158877577),
+    FRAC_CONST(0.64033049169379),
+    FRAC_CONST(0.64245551467413),
+    FRAC_CONST(0.64457660289729),
+    FRAC_CONST(0.64669370180740),
+    FRAC_CONST(0.64880675711607),
+    FRAC_CONST(0.65091571480603),
+    FRAC_CONST(0.65302052113494),
+    FRAC_CONST(0.65512112263906),
+    FRAC_CONST(0.65721746613689),
+    FRAC_CONST(0.65930949873289),
+    FRAC_CONST(0.66139716782102),
+    FRAC_CONST(0.66348042108842),
+    FRAC_CONST(0.66555920651892),
+    FRAC_CONST(0.66763347239664),
+    FRAC_CONST(0.66970316730947),
+    FRAC_CONST(0.67176824015260),
+    FRAC_CONST(0.67382864013196),
+    FRAC_CONST(0.67588431676768),
+    FRAC_CONST(0.67793521989751),
+    FRAC_CONST(0.67998129968017),
+    FRAC_CONST(0.68202250659876),
+    FRAC_CONST(0.68405879146403),
+    FRAC_CONST(0.68609010541774),
+    FRAC_CONST(0.68811639993588),
+    FRAC_CONST(0.69013762683195),
+    FRAC_CONST(0.69215373826012),
+    FRAC_CONST(0.69416468671849),
+    FRAC_CONST(0.69617042505214),
+    FRAC_CONST(0.69817090645634),
+    FRAC_CONST(0.70016608447958),
+    FRAC_CONST(0.70215591302664),
+    FRAC_CONST(0.70414034636163),
+    FRAC_CONST(0.70611933911096),
+    FRAC_CONST(0.70809284626630),
+    FRAC_CONST(0.71006082318751),
+    FRAC_CONST(0.71202322560554),
+    FRAC_CONST(0.71398000962530),
+    FRAC_CONST(0.71593113172842),
+    FRAC_CONST(0.71787654877613),
+    FRAC_CONST(0.71981621801195),
+    FRAC_CONST(0.72175009706445),
+    FRAC_CONST(0.72367814394990),
+    FRAC_CONST(0.72560031707496),
+    FRAC_CONST(0.72751657523927),
+    FRAC_CONST(0.72942687763803),
+    FRAC_CONST(0.73133118386457),
+    FRAC_CONST(0.73322945391280),
+    FRAC_CONST(0.73512164817975),
+    FRAC_CONST(0.73700772746796),
+    FRAC_CONST(0.73888765298787),
+    FRAC_CONST(0.74076138636020),
+    FRAC_CONST(0.74262888961827),
+    FRAC_CONST(0.74449012521027),
+    FRAC_CONST(0.74634505600152),
+    FRAC_CONST(0.74819364527663),
+    FRAC_CONST(0.75003585674175),
+    FRAC_CONST(0.75187165452661),
+    FRAC_CONST(0.75370100318668),
+    FRAC_CONST(0.75552386770515),
+    FRAC_CONST(0.75734021349500),
+    FRAC_CONST(0.75915000640095),
+    FRAC_CONST(0.76095321270137),
+    FRAC_CONST(0.76274979911019),
+    FRAC_CONST(0.76453973277875),
+    FRAC_CONST(0.76632298129757),
+    FRAC_CONST(0.76809951269819),
+    FRAC_CONST(0.76986929545481),
+    FRAC_CONST(0.77163229848604),
+    FRAC_CONST(0.77338849115651),
+    FRAC_CONST(0.77513784327849),
+    FRAC_CONST(0.77688032511340),
+    FRAC_CONST(0.77861590737340),
+    FRAC_CONST(0.78034456122283),
+    FRAC_CONST(0.78206625827961),
+    FRAC_CONST(0.78378097061667),
+    FRAC_CONST(0.78548867076330),
+    FRAC_CONST(0.78718933170643),
+    FRAC_CONST(0.78888292689189),
+    FRAC_CONST(0.79056943022564),
+    FRAC_CONST(0.79224881607494),
+    FRAC_CONST(0.79392105926949),
+    FRAC_CONST(0.79558613510249),
+    FRAC_CONST(0.79724401933170),
+    FRAC_CONST(0.79889468818046),
+    FRAC_CONST(0.80053811833858),
+    FRAC_CONST(0.80217428696334),
+    FRAC_CONST(0.80380317168028),
+    FRAC_CONST(0.80542475058405),
+    FRAC_CONST(0.80703900223920),
+    FRAC_CONST(0.80864590568089),
+    FRAC_CONST(0.81024544041560),
+    FRAC_CONST(0.81183758642175),
+    FRAC_CONST(0.81342232415032),
+    FRAC_CONST(0.81499963452540),
+    FRAC_CONST(0.81656949894467),
+    FRAC_CONST(0.81813189927991),
+    FRAC_CONST(0.81968681787738),
+    FRAC_CONST(0.82123423755821),
+    FRAC_CONST(0.82277414161874),
+    FRAC_CONST(0.82430651383076),
+    FRAC_CONST(0.82583133844180),
+    FRAC_CONST(0.82734860017528),
+    FRAC_CONST(0.82885828423070),
+    FRAC_CONST(0.83036037628369),
+    FRAC_CONST(0.83185486248609),
+    FRAC_CONST(0.83334172946597),
+    FRAC_CONST(0.83482096432759),
+    FRAC_CONST(0.83629255465130),
+    FRAC_CONST(0.83775648849344),
+    FRAC_CONST(0.83921275438615),
+    FRAC_CONST(0.84066134133716),
+    FRAC_CONST(0.84210223882952),
+    FRAC_CONST(0.84353543682130),
+    FRAC_CONST(0.84496092574524),
+    FRAC_CONST(0.84637869650833),
+    FRAC_CONST(0.84778874049138),
+    FRAC_CONST(0.84919104954855),
+    FRAC_CONST(0.85058561600677),
+    FRAC_CONST(0.85197243266520),
+    FRAC_CONST(0.85335149279457),
+    FRAC_CONST(0.85472279013653),
+    FRAC_CONST(0.85608631890295),
+    FRAC_CONST(0.85744207377513),
+    FRAC_CONST(0.85879004990298),
+    FRAC_CONST(0.86013024290422),
+    FRAC_CONST(0.86146264886346),
+    FRAC_CONST(0.86278726433124),
+    FRAC_CONST(0.86410408632306),
+    FRAC_CONST(0.86541311231838),
+    FRAC_CONST(0.86671434025950),
+    FRAC_CONST(0.86800776855046),
+    FRAC_CONST(0.86929339605590),
+    FRAC_CONST(0.87057122209981),
+    FRAC_CONST(0.87184124646433),
+    FRAC_CONST(0.87310346938840),
+    FRAC_CONST(0.87435789156650),
+    FRAC_CONST(0.87560451414719),
+    FRAC_CONST(0.87684333873173),
+    FRAC_CONST(0.87807436737261),
+    FRAC_CONST(0.87929760257204),
+    FRAC_CONST(0.88051304728038),
+    FRAC_CONST(0.88172070489456),
+    FRAC_CONST(0.88292057925645),
+    FRAC_CONST(0.88411267465117),
+    FRAC_CONST(0.88529699580537),
+    FRAC_CONST(0.88647354788545),
+    FRAC_CONST(0.88764233649580),
+    FRAC_CONST(0.88880336767692),
+    FRAC_CONST(0.88995664790351),
+    FRAC_CONST(0.89110218408260),
+    FRAC_CONST(0.89223998355154),
+    FRAC_CONST(0.89337005407600),
+    FRAC_CONST(0.89449240384793),
+    FRAC_CONST(0.89560704148345),
+    FRAC_CONST(0.89671397602074),
+    FRAC_CONST(0.89781321691786),
+    FRAC_CONST(0.89890477405053),
+    FRAC_CONST(0.89998865770993),
+    FRAC_CONST(0.90106487860034),
+    FRAC_CONST(0.90213344783689),
+    FRAC_CONST(0.90319437694315),
+    FRAC_CONST(0.90424767784873),
+    FRAC_CONST(0.90529336288690),
+    FRAC_CONST(0.90633144479201),
+    FRAC_CONST(0.90736193669708),
+    FRAC_CONST(0.90838485213119),
+    FRAC_CONST(0.90940020501694),
+    FRAC_CONST(0.91040800966776),
+    FRAC_CONST(0.91140828078533),
+    FRAC_CONST(0.91240103345685),
+    FRAC_CONST(0.91338628315231),
+    FRAC_CONST(0.91436404572173),
+    FRAC_CONST(0.91533433739238),
+    FRAC_CONST(0.91629717476594),
+    FRAC_CONST(0.91725257481564),
+    FRAC_CONST(0.91820055488334),
+    FRAC_CONST(0.91914113267664),
+    FRAC_CONST(0.92007432626589),
+    FRAC_CONST(0.92100015408120),
+    FRAC_CONST(0.92191863490944),
+    FRAC_CONST(0.92282978789113),
+    FRAC_CONST(0.92373363251740),
+    FRAC_CONST(0.92463018862687),
+    FRAC_CONST(0.92551947640245),
+    FRAC_CONST(0.92640151636824),
+    FRAC_CONST(0.92727632938624),
+    FRAC_CONST(0.92814393665320),
+    FRAC_CONST(0.92900435969727),
+    FRAC_CONST(0.92985762037477),
+    FRAC_CONST(0.93070374086684),
+    FRAC_CONST(0.93154274367610),
+    FRAC_CONST(0.93237465162328),
+    FRAC_CONST(0.93319948784382),
+    FRAC_CONST(0.93401727578443),
+    FRAC_CONST(0.93482803919967),
+    FRAC_CONST(0.93563180214841),
+    FRAC_CONST(0.93642858899043),
+    FRAC_CONST(0.93721842438279),
+    FRAC_CONST(0.93800133327637),
+    FRAC_CONST(0.93877734091223),
+    FRAC_CONST(0.93954647281807),
+    FRAC_CONST(0.94030875480458),
+    FRAC_CONST(0.94106421296182),
+    FRAC_CONST(0.94181287365556),
+    FRAC_CONST(0.94255476352362),
+    FRAC_CONST(0.94328990947213),
+    FRAC_CONST(0.94401833867184),
+    FRAC_CONST(0.94474007855439),
+    FRAC_CONST(0.94545515680855),
+    FRAC_CONST(0.94616360137644),
+    FRAC_CONST(0.94686544044975),
+    FRAC_CONST(0.94756070246592),
+    FRAC_CONST(0.94824941610434),
+    FRAC_CONST(0.94893161028248),
+    FRAC_CONST(0.94960731415209),
+    FRAC_CONST(0.95027655709525),
+    FRAC_CONST(0.95093936872056),
+    FRAC_CONST(0.95159577885924),
+    FRAC_CONST(0.95224581756115),
+    FRAC_CONST(0.95288951509097),
+    FRAC_CONST(0.95352690192417),
+    FRAC_CONST(0.95415800874314),
+    FRAC_CONST(0.95478286643320),
+    FRAC_CONST(0.95540150607863),
+    FRAC_CONST(0.95601395895871),
+    FRAC_CONST(0.95662025654373),
+    FRAC_CONST(0.95722043049100),
+    FRAC_CONST(0.95781451264084),
+    FRAC_CONST(0.95840253501260),
+    FRAC_CONST(0.95898452980058),
+    FRAC_CONST(0.95956052937008),
+    FRAC_CONST(0.96013056625336),
+    FRAC_CONST(0.96069467314557),
+    FRAC_CONST(0.96125288290073),
+    FRAC_CONST(0.96180522852773),
+    FRAC_CONST(0.96235174318622),
+    FRAC_CONST(0.96289246018262),
+    FRAC_CONST(0.96342741296604),
+    FRAC_CONST(0.96395663512424),
+    FRAC_CONST(0.96448016037959),
+    FRAC_CONST(0.96499802258499),
+    FRAC_CONST(0.96551025571985),
+    FRAC_CONST(0.96601689388602),
+    FRAC_CONST(0.96651797130376),
+    FRAC_CONST(0.96701352230768),
+    FRAC_CONST(0.96750358134269),
+    FRAC_CONST(0.96798818295998),
+    FRAC_CONST(0.96846736181297),
+    FRAC_CONST(0.96894115265327),
+    FRAC_CONST(0.96940959032667),
+    FRAC_CONST(0.96987270976912),
+    FRAC_CONST(0.97033054600270),
+    FRAC_CONST(0.97078313413161),
+    FRAC_CONST(0.97123050933818),
+    FRAC_CONST(0.97167270687887),
+    FRAC_CONST(0.97210976208030),
+    FRAC_CONST(0.97254171033525),
+    FRAC_CONST(0.97296858709871),
+    FRAC_CONST(0.97339042788392),
+    FRAC_CONST(0.97380726825843),
+    FRAC_CONST(0.97421914384017),
+    FRAC_CONST(0.97462609029350),
+    FRAC_CONST(0.97502814332534),
+    FRAC_CONST(0.97542533868127),
+    FRAC_CONST(0.97581771214160),
+    FRAC_CONST(0.97620529951759),
+    FRAC_CONST(0.97658813664749),
+    FRAC_CONST(0.97696625939282),
+    FRAC_CONST(0.97733970363445),
+    FRAC_CONST(0.97770850526884),
+    FRAC_CONST(0.97807270020427),
+    FRAC_CONST(0.97843232435704),
+    FRAC_CONST(0.97878741364771),
+    FRAC_CONST(0.97913800399743),
+    FRAC_CONST(0.97948413132414),
+    FRAC_CONST(0.97982583153895),
+    FRAC_CONST(0.98016314054243),
+    FRAC_CONST(0.98049609422096),
+    FRAC_CONST(0.98082472844313),
+    FRAC_CONST(0.98114907905608),
+    FRAC_CONST(0.98146918188197),
+    FRAC_CONST(0.98178507271438),
+    FRAC_CONST(0.98209678731477),
+    FRAC_CONST(0.98240436140902),
+    FRAC_CONST(0.98270783068385),
+    FRAC_CONST(0.98300723078342),
+    FRAC_CONST(0.98330259730589),
+    FRAC_CONST(0.98359396579995),
+    FRAC_CONST(0.98388137176152),
+    FRAC_CONST(0.98416485063031),
+    FRAC_CONST(0.98444443778651),
+    FRAC_CONST(0.98472016854752),
+    FRAC_CONST(0.98499207816463),
+    FRAC_CONST(0.98526020181980),
+    FRAC_CONST(0.98552457462240),
+    FRAC_CONST(0.98578523160609),
+    FRAC_CONST(0.98604220772560),
+    FRAC_CONST(0.98629553785362),
+    FRAC_CONST(0.98654525677772),
+    FRAC_CONST(0.98679139919726),
+    FRAC_CONST(0.98703399972035),
+    FRAC_CONST(0.98727309286089),
+    FRAC_CONST(0.98750871303556),
+    FRAC_CONST(0.98774089456089),
+    FRAC_CONST(0.98796967165036),
+    FRAC_CONST(0.98819507841154),
+    FRAC_CONST(0.98841714884323),
+    FRAC_CONST(0.98863591683269),
+    FRAC_CONST(0.98885141615285),
+    FRAC_CONST(0.98906368045957),
+    FRAC_CONST(0.98927274328896),
+    FRAC_CONST(0.98947863805473),
+    FRAC_CONST(0.98968139804554),
+    FRAC_CONST(0.98988105642241),
+    FRAC_CONST(0.99007764621618),
+    FRAC_CONST(0.99027120032501),
+    FRAC_CONST(0.99046175151186),
+    FRAC_CONST(0.99064933240208),
+    FRAC_CONST(0.99083397548099),
+    FRAC_CONST(0.99101571309153),
+    FRAC_CONST(0.99119457743191),
+    FRAC_CONST(0.99137060055337),
+    FRAC_CONST(0.99154381435784),
+    FRAC_CONST(0.99171425059582),
+    FRAC_CONST(0.99188194086414),
+    FRAC_CONST(0.99204691660388),
+    FRAC_CONST(0.99220920909823),
+    FRAC_CONST(0.99236884947045),
+    FRAC_CONST(0.99252586868186),
+    FRAC_CONST(0.99268029752989),
+    FRAC_CONST(0.99283216664606),
+    FRAC_CONST(0.99298150649419),
+    FRAC_CONST(0.99312834736847),
+    FRAC_CONST(0.99327271939167),
+    FRAC_CONST(0.99341465251338),
+    FRAC_CONST(0.99355417650825),
+    FRAC_CONST(0.99369132097430),
+    FRAC_CONST(0.99382611533130),
+    FRAC_CONST(0.99395858881910),
+    FRAC_CONST(0.99408877049612),
+    FRAC_CONST(0.99421668923778),
+    FRAC_CONST(0.99434237373503),
+    FRAC_CONST(0.99446585249289),
+    FRAC_CONST(0.99458715382906),
+    FRAC_CONST(0.99470630587254),
+    FRAC_CONST(0.99482333656229),
+    FRAC_CONST(0.99493827364600),
+    FRAC_CONST(0.99505114467878),
+    FRAC_CONST(0.99516197702200),
+    FRAC_CONST(0.99527079784214),
+    FRAC_CONST(0.99537763410962),
+    FRAC_CONST(0.99548251259777),
+    FRAC_CONST(0.99558545988178),
+    FRAC_CONST(0.99568650233767),
+    FRAC_CONST(0.99578566614138),
+    FRAC_CONST(0.99588297726783),
+    FRAC_CONST(0.99597846149005),
+    FRAC_CONST(0.99607214437834),
+    FRAC_CONST(0.99616405129947),
+    FRAC_CONST(0.99625420741595),
+    FRAC_CONST(0.99634263768527),
+    FRAC_CONST(0.99642936685928),
+    FRAC_CONST(0.99651441948352),
+    FRAC_CONST(0.99659781989663),
+    FRAC_CONST(0.99667959222978),
+    FRAC_CONST(0.99675976040620),
+    FRAC_CONST(0.99683834814063),
+    FRAC_CONST(0.99691537893895),
+    FRAC_CONST(0.99699087609774),
+    FRAC_CONST(0.99706486270391),
+    FRAC_CONST(0.99713736163442),
+    FRAC_CONST(0.99720839555593),
+    FRAC_CONST(0.99727798692461),
+    FRAC_CONST(0.99734615798589),
+    FRAC_CONST(0.99741293077431),
+    FRAC_CONST(0.99747832711337),
+    FRAC_CONST(0.99754236861541),
+    FRAC_CONST(0.99760507668158),
+    FRAC_CONST(0.99766647250181),
+    FRAC_CONST(0.99772657705478),
+    FRAC_CONST(0.99778541110799),
+    FRAC_CONST(0.99784299521785),
+    FRAC_CONST(0.99789934972976),
+    FRAC_CONST(0.99795449477828),
+    FRAC_CONST(0.99800845028730),
+    FRAC_CONST(0.99806123597027),
+    FRAC_CONST(0.99811287133042),
+    FRAC_CONST(0.99816337566108),
+    FRAC_CONST(0.99821276804596),
+    FRAC_CONST(0.99826106735952),
+    FRAC_CONST(0.99830829226732),
+    FRAC_CONST(0.99835446122649),
+    FRAC_CONST(0.99839959248609),
+    FRAC_CONST(0.99844370408765),
+    FRAC_CONST(0.99848681386566),
+    FRAC_CONST(0.99852893944805),
+    FRAC_CONST(0.99857009825685),
+    FRAC_CONST(0.99861030750869),
+    FRAC_CONST(0.99864958421549),
+    FRAC_CONST(0.99868794518504),
+    FRAC_CONST(0.99872540702178),
+    FRAC_CONST(0.99876198612738),
+    FRAC_CONST(0.99879769870160),
+    FRAC_CONST(0.99883256074295),
+    FRAC_CONST(0.99886658804953),
+    FRAC_CONST(0.99889979621983),
+    FRAC_CONST(0.99893220065356),
+    FRAC_CONST(0.99896381655254),
+    FRAC_CONST(0.99899465892154),
+    FRAC_CONST(0.99902474256924),
+    FRAC_CONST(0.99905408210916),
+    FRAC_CONST(0.99908269196056),
+    FRAC_CONST(0.99911058634952),
+    FRAC_CONST(0.99913777930986),
+    FRAC_CONST(0.99916428468421),
+    FRAC_CONST(0.99919011612505),
+    FRAC_CONST(0.99921528709576),
+    FRAC_CONST(0.99923981087174),
+    FRAC_CONST(0.99926370054150),
+    FRAC_CONST(0.99928696900779),
+    FRAC_CONST(0.99930962898876),
+    FRAC_CONST(0.99933169301910),
+    FRAC_CONST(0.99935317345126),
+    FRAC_CONST(0.99937408245662),
+    FRAC_CONST(0.99939443202674),
+    FRAC_CONST(0.99941423397457),
+    FRAC_CONST(0.99943349993572),
+    FRAC_CONST(0.99945224136972),
+    FRAC_CONST(0.99947046956130),
+    FRAC_CONST(0.99948819562171),
+    FRAC_CONST(0.99950543049000),
+    FRAC_CONST(0.99952218493439),
+    FRAC_CONST(0.99953846955355),
+    FRAC_CONST(0.99955429477803),
+    FRAC_CONST(0.99956967087154),
+    FRAC_CONST(0.99958460793242),
+    FRAC_CONST(0.99959911589494),
+    FRAC_CONST(0.99961320453077),
+    FRAC_CONST(0.99962688345035),
+    FRAC_CONST(0.99964016210433),
+    FRAC_CONST(0.99965304978499),
+    FRAC_CONST(0.99966555562769),
+    FRAC_CONST(0.99967768861231),
+    FRAC_CONST(0.99968945756473),
+    FRAC_CONST(0.99970087115825),
+    FRAC_CONST(0.99971193791510),
+    FRAC_CONST(0.99972266620792),
+    FRAC_CONST(0.99973306426121),
+    FRAC_CONST(0.99974314015288),
+    FRAC_CONST(0.99975290181568),
+    FRAC_CONST(0.99976235703876),
+    FRAC_CONST(0.99977151346914),
+    FRAC_CONST(0.99978037861326),
+    FRAC_CONST(0.99978895983845),
+    FRAC_CONST(0.99979726437448),
+    FRAC_CONST(0.99980529931507),
+    FRAC_CONST(0.99981307161943),
+    FRAC_CONST(0.99982058811377),
+    FRAC_CONST(0.99982785549283),
+    FRAC_CONST(0.99983488032144),
+    FRAC_CONST(0.99984166903600),
+    FRAC_CONST(0.99984822794606),
+    FRAC_CONST(0.99985456323584),
+    FRAC_CONST(0.99986068096572),
+    FRAC_CONST(0.99986658707386),
+    FRAC_CONST(0.99987228737764),
+    FRAC_CONST(0.99987778757524),
+    FRAC_CONST(0.99988309324717),
+    FRAC_CONST(0.99988820985777),
+    FRAC_CONST(0.99989314275675),
+    FRAC_CONST(0.99989789718072),
+    FRAC_CONST(0.99990247825468),
+    FRAC_CONST(0.99990689099357),
+    FRAC_CONST(0.99991114030376),
+    FRAC_CONST(0.99991523098456),
+    FRAC_CONST(0.99991916772971),
+    FRAC_CONST(0.99992295512891),
+    FRAC_CONST(0.99992659766930),
+    FRAC_CONST(0.99993009973692),
+    FRAC_CONST(0.99993346561824),
+    FRAC_CONST(0.99993669950161),
+    FRAC_CONST(0.99993980547870),
+    FRAC_CONST(0.99994278754604),
+    FRAC_CONST(0.99994564960642),
+    FRAC_CONST(0.99994839547033),
+    FRAC_CONST(0.99995102885747),
+    FRAC_CONST(0.99995355339809),
+    FRAC_CONST(0.99995597263451),
+    FRAC_CONST(0.99995829002249),
+    FRAC_CONST(0.99996050893264),
+    FRAC_CONST(0.99996263265183),
+    FRAC_CONST(0.99996466438460),
+    FRAC_CONST(0.99996660725452),
+    FRAC_CONST(0.99996846430558),
+    FRAC_CONST(0.99997023850356),
+    FRAC_CONST(0.99997193273736),
+    FRAC_CONST(0.99997354982037),
+    FRAC_CONST(0.99997509249183),
+    FRAC_CONST(0.99997656341810),
+    FRAC_CONST(0.99997796519400),
+    FRAC_CONST(0.99997930034415),
+    FRAC_CONST(0.99998057132421),
+    FRAC_CONST(0.99998178052220),
+    FRAC_CONST(0.99998293025975),
+    FRAC_CONST(0.99998402279338),
+    FRAC_CONST(0.99998506031574),
+    FRAC_CONST(0.99998604495686),
+    FRAC_CONST(0.99998697878536),
+    FRAC_CONST(0.99998786380966),
+    FRAC_CONST(0.99998870197921),
+    FRAC_CONST(0.99998949518567),
+    FRAC_CONST(0.99999024526408),
+    FRAC_CONST(0.99999095399401),
+    FRAC_CONST(0.99999162310077),
+    FRAC_CONST(0.99999225425649),
+    FRAC_CONST(0.99999284908128),
+    FRAC_CONST(0.99999340914435),
+    FRAC_CONST(0.99999393596510),
+    FRAC_CONST(0.99999443101421),
+    FRAC_CONST(0.99999489571473),
+    FRAC_CONST(0.99999533144314),
+    FRAC_CONST(0.99999573953040),
+    FRAC_CONST(0.99999612126300),
+    FRAC_CONST(0.99999647788395),
+    FRAC_CONST(0.99999681059383),
+    FRAC_CONST(0.99999712055178),
+    FRAC_CONST(0.99999740887647),
+    FRAC_CONST(0.99999767664709),
+    FRAC_CONST(0.99999792490431),
+    FRAC_CONST(0.99999815465123),
+    FRAC_CONST(0.99999836685427),
+    FRAC_CONST(0.99999856244415),
+    FRAC_CONST(0.99999874231676),
+    FRAC_CONST(0.99999890733405),
+    FRAC_CONST(0.99999905832493),
+    FRAC_CONST(0.99999919608613),
+    FRAC_CONST(0.99999932138304),
+    FRAC_CONST(0.99999943495056),
+    FRAC_CONST(0.99999953749392),
+    FRAC_CONST(0.99999962968950),
+    FRAC_CONST(0.99999971218563),
+    FRAC_CONST(0.99999978560337),
+    FRAC_CONST(0.99999985053727),
+    FRAC_CONST(0.99999990755616),
+    FRAC_CONST(0.99999995720387)
+};
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+real_t kbd_long_960[] = {
+    FRAC_CONST(0.0003021562530949),
+    FRAC_CONST(0.0004452267024786),
+    FRAC_CONST(0.0005674947527496),
+    FRAC_CONST(0.0006812465553466),
+    FRAC_CONST(0.0007910496776387),
+    FRAC_CONST(0.0008991655033895),
+    FRAC_CONST(0.0010068978259384),
+    FRAC_CONST(0.0011150758515751),
+    FRAC_CONST(0.0012242653193642),
+    FRAC_CONST(0.0013348735658205),
+    FRAC_CONST(0.0014472068670273),
+    FRAC_CONST(0.0015615039850448),
+    FRAC_CONST(0.0016779568885263),
+    FRAC_CONST(0.0017967241232412),
+    FRAC_CONST(0.0019179397560955),
+    FRAC_CONST(0.0020417195415393),
+    FRAC_CONST(0.0021681652836642),
+    FRAC_CONST(0.0022973679910599),
+    FRAC_CONST(0.0024294102029937),
+    FRAC_CONST(0.0025643677339078),
+    FRAC_CONST(0.0027023110014772),
+    FRAC_CONST(0.0028433060512612),
+    FRAC_CONST(0.0029874153568025),
+    FRAC_CONST(0.0031346984511728),
+    FRAC_CONST(0.0032852124303662),
+    FRAC_CONST(0.0034390123581190),
+    FRAC_CONST(0.0035961515940931),
+    FRAC_CONST(0.0037566820618961),
+    FRAC_CONST(0.0039206544694386),
+    FRAC_CONST(0.0040881184912194),
+    FRAC_CONST(0.0042591229199617),
+    FRAC_CONST(0.0044337157933972),
+    FRAC_CONST(0.0046119445007641),
+    FRAC_CONST(0.0047938558726415),
+    FRAC_CONST(0.0049794962570131),
+    FRAC_CONST(0.0051689115838900),
+    FRAC_CONST(0.0053621474203763),
+    FRAC_CONST(0.0055592490177131),
+    FRAC_CONST(0.0057602613515573),
+    FRAC_CONST(0.0059652291565289),
+    FRAC_CONST(0.0061741969558843),
+    FRAC_CONST(0.0063872090870253),
+    FRAC_CONST(0.0066043097234387),
+    FRAC_CONST(0.0068255428935640),
+    FRAC_CONST(0.0070509524970088),
+    FRAC_CONST(0.0072805823184660),
+    FRAC_CONST(0.0075144760396340),
+    FRAC_CONST(0.0077526772493942),
+    FRAC_CONST(0.0079952294524673),
+    FRAC_CONST(0.0082421760767325),
+    FRAC_CONST(0.0084935604793733),
+    FRAC_CONST(0.0087494259519870),
+    FRAC_CONST(0.0090098157247792),
+    FRAC_CONST(0.0092747729699467),
+    FRAC_CONST(0.0095443408043399),
+    FRAC_CONST(0.0098185622914832),
+    FRAC_CONST(0.0100974804430226),
+    FRAC_CONST(0.0103811382196612),
+    FRAC_CONST(0.0106695785316351),
+    FRAC_CONST(0.0109628442387771),
+    FRAC_CONST(0.0112609781502091),
+    FRAC_CONST(0.0115640230236993),
+    FRAC_CONST(0.0118720215647169),
+    FRAC_CONST(0.0121850164252137),
+    FRAC_CONST(0.0125030502021561),
+    FRAC_CONST(0.0128261654358321),
+    FRAC_CONST(0.0131544046079532),
+    FRAC_CONST(0.0134878101395681),
+    FRAC_CONST(0.0138264243888068),
+    FRAC_CONST(0.0141702896484671),
+    FRAC_CONST(0.0145194481434592),
+    FRAC_CONST(0.0148739420281182),
+    FRAC_CONST(0.0152338133833959),
+    FRAC_CONST(0.0155991042139432),
+    FRAC_CONST(0.0159698564450882),
+    FRAC_CONST(0.0163461119197227),
+    FRAC_CONST(0.0167279123950996),
+    FRAC_CONST(0.0171152995395520),
+    FRAC_CONST(0.0175083149291368),
+    FRAC_CONST(0.0179070000442104),
+    FRAC_CONST(0.0183113962659409),
+    FRAC_CONST(0.0187215448727609),
+    FRAC_CONST(0.0191374870367659),
+    FRAC_CONST(0.0195592638200623),
+    FRAC_CONST(0.0199869161710679),
+    FRAC_CONST(0.0204204849207691),
+    FRAC_CONST(0.0208600107789370),
+    FRAC_CONST(0.0213055343303066),
+    FRAC_CONST(0.0217570960307201),
+    FRAC_CONST(0.0222147362032386),
+    FRAC_CONST(0.0226784950342228),
+    FRAC_CONST(0.0231484125693867),
+    FRAC_CONST(0.0236245287098244),
+    FRAC_CONST(0.0241068832080138),
+    FRAC_CONST(0.0245955156637973),
+    FRAC_CONST(0.0250904655203431),
+    FRAC_CONST(0.0255917720600868),
+    FRAC_CONST(0.0260994744006559),
+    FRAC_CONST(0.0266136114907790),
+    FRAC_CONST(0.0271342221061795),
+    FRAC_CONST(0.0276613448454576),
+    FRAC_CONST(0.0281950181259587),
+    FRAC_CONST(0.0287352801796329),
+    FRAC_CONST(0.0292821690488833),
+    FRAC_CONST(0.0298357225824074),
+    FRAC_CONST(0.0303959784310299),
+    FRAC_CONST(0.0309629740435296),
+    FRAC_CONST(0.0315367466624615),
+    FRAC_CONST(0.0321173333199732),
+    FRAC_CONST(0.0327047708336193),
+    FRAC_CONST(0.0332990958021720),
+    FRAC_CONST(0.0339003446014307),
+    FRAC_CONST(0.0345085533800302),
+    FRAC_CONST(0.0351237580552491),
+    FRAC_CONST(0.0357459943088193),
+    FRAC_CONST(0.0363752975827358),
+    FRAC_CONST(0.0370117030750704),
+    FRAC_CONST(0.0376552457357870),
+    FRAC_CONST(0.0383059602625614),
+    FRAC_CONST(0.0389638810966056),
+    FRAC_CONST(0.0396290424184964),
+    FRAC_CONST(0.0403014781440112),
+    FRAC_CONST(0.0409812219199691),
+    FRAC_CONST(0.0416683071200799),
+    FRAC_CONST(0.0423627668408009),
+    FRAC_CONST(0.0430646338972016),
+    FRAC_CONST(0.0437739408188385),
+    FRAC_CONST(0.0444907198456388),
+    FRAC_CONST(0.0452150029237951),
+    FRAC_CONST(0.0459468217016708),
+    FRAC_CONST(0.0466862075257170),
+    FRAC_CONST(0.0474331914364021),
+    FRAC_CONST(0.0481878041641539),
+    FRAC_CONST(0.0489500761253148),
+    FRAC_CONST(0.0497200374181119),
+    FRAC_CONST(0.0504977178186404),
+    FRAC_CONST(0.0512831467768636),
+    FRAC_CONST(0.0520763534126273),
+    FRAC_CONST(0.0528773665116913),
+    FRAC_CONST(0.0536862145217772),
+    FRAC_CONST(0.0545029255486345),
+    FRAC_CONST(0.0553275273521232),
+    FRAC_CONST(0.0561600473423164),
+    FRAC_CONST(0.0570005125756209),
+    FRAC_CONST(0.0578489497509179),
+    FRAC_CONST(0.0587053852057233),
+    FRAC_CONST(0.0595698449123695),
+    FRAC_CONST(0.0604423544742077),
+    FRAC_CONST(0.0613229391218317),
+    FRAC_CONST(0.0622116237093247),
+    FRAC_CONST(0.0631084327105284),
+    FRAC_CONST(0.0640133902153352),
+    FRAC_CONST(0.0649265199260043),
+    FRAC_CONST(0.0658478451535027),
+    FRAC_CONST(0.0667773888138695),
+    FRAC_CONST(0.0677151734246072),
+    FRAC_CONST(0.0686612211010977),
+    FRAC_CONST(0.0696155535530446),
+    FRAC_CONST(0.0705781920809429),
+    FRAC_CONST(0.0715491575725758),
+    FRAC_CONST(0.0725284704995383),
+    FRAC_CONST(0.0735161509137906),
+    FRAC_CONST(0.0745122184442388),
+    FRAC_CONST(0.0755166922933461),
+    FRAC_CONST(0.0765295912337720),
+    FRAC_CONST(0.0775509336050437),
+    FRAC_CONST(0.0785807373102561),
+    FRAC_CONST(0.0796190198128044),
+    FRAC_CONST(0.0806657981331473),
+    FRAC_CONST(0.0817210888456026),
+    FRAC_CONST(0.0827849080751753),
+    FRAC_CONST(0.0838572714944183),
+    FRAC_CONST(0.0849381943203265),
+    FRAC_CONST(0.0860276913112652),
+    FRAC_CONST(0.0871257767639319),
+    FRAC_CONST(0.0882324645103534),
+    FRAC_CONST(0.0893477679149177),
+    FRAC_CONST(0.0904716998714418),
+    FRAC_CONST(0.0916042728002747),
+    FRAC_CONST(0.0927454986454381),
+    FRAC_CONST(0.0938953888718020),
+    FRAC_CONST(0.0950539544622996),
+    FRAC_CONST(0.0962212059151784),
+    FRAC_CONST(0.0973971532412897),
+    FRAC_CONST(0.0985818059614169),
+    FRAC_CONST(0.0997751731036425),
+    FRAC_CONST(0.1009772632007537),
+    FRAC_CONST(0.1021880842876888),
+    FRAC_CONST(0.1034076438990227),
+    FRAC_CONST(0.1046359490664932),
+    FRAC_CONST(0.1058730063165681),
+    FRAC_CONST(0.1071188216680533),
+    FRAC_CONST(0.1083734006297428),
+    FRAC_CONST(0.1096367481981100),
+    FRAC_CONST(0.1109088688550422),
+    FRAC_CONST(0.1121897665656167),
+    FRAC_CONST(0.1134794447759207),
+    FRAC_CONST(0.1147779064109143),
+    FRAC_CONST(0.1160851538723372),
+    FRAC_CONST(0.1174011890366591),
+    FRAC_CONST(0.1187260132530751),
+    FRAC_CONST(0.1200596273415457),
+    FRAC_CONST(0.1214020315908810),
+    FRAC_CONST(0.1227532257568719),
+    FRAC_CONST(0.1241132090604651),
+    FRAC_CONST(0.1254819801859856),
+    FRAC_CONST(0.1268595372794049),
+    FRAC_CONST(0.1282458779466558),
+    FRAC_CONST(0.1296409992519942),
+    FRAC_CONST(0.1310448977164081),
+    FRAC_CONST(0.1324575693160745),
+    FRAC_CONST(0.1338790094808633),
+    FRAC_CONST(0.1353092130928902),
+    FRAC_CONST(0.1367481744851168),
+    FRAC_CONST(0.1381958874400010),
+    FRAC_CONST(0.1396523451881945),
+    FRAC_CONST(0.1411175404072910),
+    FRAC_CONST(0.1425914652206223),
+    FRAC_CONST(0.1440741111961058),
+    FRAC_CONST(0.1455654693451402),
+    FRAC_CONST(0.1470655301215526),
+    FRAC_CONST(0.1485742834205956),
+    FRAC_CONST(0.1500917185779945),
+    FRAC_CONST(0.1516178243690463),
+    FRAC_CONST(0.1531525890077689),
+    FRAC_CONST(0.1546960001461024),
+    FRAC_CONST(0.1562480448731608),
+    FRAC_CONST(0.1578087097145364),
+    FRAC_CONST(0.1593779806316558),
+    FRAC_CONST(0.1609558430211876),
+    FRAC_CONST(0.1625422817145027),
+    FRAC_CONST(0.1641372809771871),
+    FRAC_CONST(0.1657408245086070),
+    FRAC_CONST(0.1673528954415270),
+    FRAC_CONST(0.1689734763417811),
+    FRAC_CONST(0.1706025492079969),
+    FRAC_CONST(0.1722400954713725),
+    FRAC_CONST(0.1738860959955082),
+    FRAC_CONST(0.1755405310762898),
+    FRAC_CONST(0.1772033804418275),
+    FRAC_CONST(0.1788746232524467),
+    FRAC_CONST(0.1805542381007349),
+    FRAC_CONST(0.1822422030116404),
+    FRAC_CONST(0.1839384954426268),
+    FRAC_CONST(0.1856430922838810),
+    FRAC_CONST(0.1873559698585756),
+    FRAC_CONST(0.1890771039231862),
+    FRAC_CONST(0.1908064696678625),
+    FRAC_CONST(0.1925440417168546),
+    FRAC_CONST(0.1942897941289937),
+    FRAC_CONST(0.1960437003982277),
+    FRAC_CONST(0.1978057334542116),
+    FRAC_CONST(0.1995758656629525),
+    FRAC_CONST(0.2013540688275098),
+    FRAC_CONST(0.2031403141887507),
+    FRAC_CONST(0.2049345724261595),
+    FRAC_CONST(0.2067368136587033),
+    FRAC_CONST(0.2085470074457521),
+    FRAC_CONST(0.2103651227880538),
+    FRAC_CONST(0.2121911281287646),
+    FRAC_CONST(0.2140249913545346),
+    FRAC_CONST(0.2158666797966480),
+    FRAC_CONST(0.2177161602322188),
+    FRAC_CONST(0.2195733988854414),
+    FRAC_CONST(0.2214383614288963),
+    FRAC_CONST(0.2233110129849106),
+    FRAC_CONST(0.2251913181269740),
+    FRAC_CONST(0.2270792408812093),
+    FRAC_CONST(0.2289747447278976),
+    FRAC_CONST(0.2308777926030592),
+    FRAC_CONST(0.2327883469000885),
+    FRAC_CONST(0.2347063694714437),
+    FRAC_CONST(0.2366318216303919),
+    FRAC_CONST(0.2385646641528076),
+    FRAC_CONST(0.2405048572790267),
+    FRAC_CONST(0.2424523607157545),
+    FRAC_CONST(0.2444071336380283),
+    FRAC_CONST(0.2463691346912334),
+    FRAC_CONST(0.2483383219931741),
+    FRAC_CONST(0.2503146531361985),
+    FRAC_CONST(0.2522980851893767),
+    FRAC_CONST(0.2542885747007335),
+    FRAC_CONST(0.2562860776995335),
+    FRAC_CONST(0.2582905496986215),
+    FRAC_CONST(0.2603019456968142),
+    FRAC_CONST(0.2623202201813464),
+    FRAC_CONST(0.2643453271303700),
+    FRAC_CONST(0.2663772200155053),
+    FRAC_CONST(0.2684158518044454),
+    FRAC_CONST(0.2704611749636135),
+    FRAC_CONST(0.2725131414608710),
+    FRAC_CONST(0.2745717027682799),
+    FRAC_CONST(0.2766368098649151),
+    FRAC_CONST(0.2787084132397296),
+    FRAC_CONST(0.2807864628944707),
+    FRAC_CONST(0.2828709083466482),
+    FRAC_CONST(0.2849616986325523),
+    FRAC_CONST(0.2870587823103237),
+    FRAC_CONST(0.2891621074630737),
+    FRAC_CONST(0.2912716217020546),
+    FRAC_CONST(0.2933872721698803),
+    FRAC_CONST(0.2955090055437973),
+    FRAC_CONST(0.2976367680390041),
+    FRAC_CONST(0.2997705054120213),
+    FRAC_CONST(0.3019101629641097),
+    FRAC_CONST(0.3040556855447379),
+    FRAC_CONST(0.3062070175550981),
+    FRAC_CONST(0.3083641029516701),
+    FRAC_CONST(0.3105268852498334),
+    FRAC_CONST(0.3126953075275265),
+    FRAC_CONST(0.3148693124289546),
+    FRAC_CONST(0.3170488421683428),
+    FRAC_CONST(0.3192338385337370),
+    FRAC_CONST(0.3214242428908514),
+    FRAC_CONST(0.3236199961869606),
+    FRAC_CONST(0.3258210389548392),
+    FRAC_CONST(0.3280273113167459),
+    FRAC_CONST(0.3302387529884521),
+    FRAC_CONST(0.3324553032833160),
+    FRAC_CONST(0.3346769011164010),
+    FRAC_CONST(0.3369034850086373),
+    FRAC_CONST(0.3391349930910280),
+    FRAC_CONST(0.3413713631088974),
+    FRAC_CONST(0.3436125324261830),
+    FRAC_CONST(0.3458584380297697),
+    FRAC_CONST(0.3481090165338656),
+    FRAC_CONST(0.3503642041844199),
+    FRAC_CONST(0.3526239368635820),
+    FRAC_CONST(0.3548881500942010),
+    FRAC_CONST(0.3571567790443668),
+    FRAC_CONST(0.3594297585319891),
+    FRAC_CONST(0.3617070230294185),
+    FRAC_CONST(0.3639885066681048),
+    FRAC_CONST(0.3662741432432950),
+    FRAC_CONST(0.3685638662187693),
+    FRAC_CONST(0.3708576087316147),
+    FRAC_CONST(0.3731553035970366),
+    FRAC_CONST(0.3754568833132069),
+    FRAC_CONST(0.3777622800661488),
+    FRAC_CONST(0.3800714257346570),
+    FRAC_CONST(0.3823842518952546),
+    FRAC_CONST(0.3847006898271841),
+    FRAC_CONST(0.3870206705174334),
+    FRAC_CONST(0.3893441246657958),
+    FRAC_CONST(0.3916709826899639),
+    FRAC_CONST(0.3940011747306560),
+    FRAC_CONST(0.3963346306567764),
+    FRAC_CONST(0.3986712800706062),
+    FRAC_CONST(0.4010110523130271),
+    FRAC_CONST(0.4033538764687756),
+    FRAC_CONST(0.4056996813717284),
+    FRAC_CONST(0.4080483956102172),
+    FRAC_CONST(0.4103999475323736),
+    FRAC_CONST(0.4127542652515031),
+    FRAC_CONST(0.4151112766514873),
+    FRAC_CONST(0.4174709093922143),
+    FRAC_CONST(0.4198330909150365),
+    FRAC_CONST(0.4221977484482556),
+    FRAC_CONST(0.4245648090126334),
+    FRAC_CONST(0.4269341994269293),
+    FRAC_CONST(0.4293058463134616),
+    FRAC_CONST(0.4316796761036958),
+    FRAC_CONST(0.4340556150438547),
+    FRAC_CONST(0.4364335892005536),
+    FRAC_CONST(0.4388135244664580),
+    FRAC_CONST(0.4411953465659639),
+    FRAC_CONST(0.4435789810609000),
+    FRAC_CONST(0.4459643533562509),
+    FRAC_CONST(0.4483513887059016),
+    FRAC_CONST(0.4507400122184019),
+    FRAC_CONST(0.4531301488627497),
+    FRAC_CONST(0.4555217234741947),
+    FRAC_CONST(0.4579146607600593),
+    FRAC_CONST(0.4603088853055777),
+    FRAC_CONST(0.4627043215797521),
+    FRAC_CONST(0.4651008939412254),
+    FRAC_CONST(0.4674985266441709),
+    FRAC_CONST(0.4698971438441951),
+    FRAC_CONST(0.4722966696042580),
+    FRAC_CONST(0.4746970279006055),
+    FRAC_CONST(0.4770981426287164),
+    FRAC_CONST(0.4794999376092619),
+    FRAC_CONST(0.4819023365940778),
+    FRAC_CONST(0.4843052632721476),
+    FRAC_CONST(0.4867086412755978),
+    FRAC_CONST(0.4891123941857028),
+    FRAC_CONST(0.4915164455388997),
+    FRAC_CONST(0.4939207188328126),
+    FRAC_CONST(0.4963251375322855),
+    FRAC_CONST(0.4987296250754225),
+    FRAC_CONST(0.5011341048796359),
+    FRAC_CONST(0.5035385003477012),
+    FRAC_CONST(0.5059427348738168),
+    FRAC_CONST(0.5083467318496706),
+    FRAC_CONST(0.5107504146705106),
+    FRAC_CONST(0.5131537067412193),
+    FRAC_CONST(0.5155565314823923),
+    FRAC_CONST(0.5179588123364193),
+    FRAC_CONST(0.5203604727735667),
+    FRAC_CONST(0.5227614362980630),
+    FRAC_CONST(0.5251616264541841),
+    FRAC_CONST(0.5275609668323384),
+    FRAC_CONST(0.5299593810751532),
+    FRAC_CONST(0.5323567928835578),
+    FRAC_CONST(0.5347531260228663),
+    FRAC_CONST(0.5371483043288580),
+    FRAC_CONST(0.5395422517138538),
+    FRAC_CONST(0.5419348921727899),
+    FRAC_CONST(0.5443261497892862),
+    FRAC_CONST(0.5467159487417104),
+    FRAC_CONST(0.5491042133092364),
+    FRAC_CONST(0.5514908678778958),
+    FRAC_CONST(0.5538758369466227),
+    FRAC_CONST(0.5562590451332913),
+    FRAC_CONST(0.5586404171807443),
+    FRAC_CONST(0.5610198779628133),
+    FRAC_CONST(0.5633973524903286),
+    FRAC_CONST(0.5657727659171199),
+    FRAC_CONST(0.5681460435460047),
+    FRAC_CONST(0.5705171108347663),
+    FRAC_CONST(0.5728858934021188),
+    FRAC_CONST(0.5752523170336598),
+    FRAC_CONST(0.5776163076878088),
+    FRAC_CONST(0.5799777915017323),
+    FRAC_CONST(0.5823366947972535),
+    FRAC_CONST(0.5846929440867458),
+    FRAC_CONST(0.5870464660790119),
+    FRAC_CONST(0.5893971876851449),
+    FRAC_CONST(0.5917450360243719),
+    FRAC_CONST(0.5940899384298793),
+    FRAC_CONST(0.5964318224546208),
+    FRAC_CONST(0.5987706158771039),
+    FRAC_CONST(0.6011062467071583),
+    FRAC_CONST(0.6034386431916822),
+    FRAC_CONST(0.6057677338203681),
+    FRAC_CONST(0.6080934473314057),
+    FRAC_CONST(0.6104157127171639),
+    FRAC_CONST(0.6127344592298474),
+    FRAC_CONST(0.6150496163871310),
+    FRAC_CONST(0.6173611139777690),
+    FRAC_CONST(0.6196688820671789),
+    FRAC_CONST(0.6219728510029997),
+    FRAC_CONST(0.6242729514206247),
+    FRAC_CONST(0.6265691142487051),
+    FRAC_CONST(0.6288612707146283),
+    FRAC_CONST(0.6311493523499663),
+    FRAC_CONST(0.6334332909958958),
+    FRAC_CONST(0.6357130188085891),
+    FRAC_CONST(0.6379884682645743),
+    FRAC_CONST(0.6402595721660647),
+    FRAC_CONST(0.6425262636462578),
+    FRAC_CONST(0.6447884761746012),
+    FRAC_CONST(0.6470461435620266),
+    FRAC_CONST(0.6492991999661505),
+    FRAC_CONST(0.6515475798964411),
+    FRAC_CONST(0.6537912182193508),
+    FRAC_CONST(0.6560300501634142),
+    FRAC_CONST(0.6582640113243098),
+    FRAC_CONST(0.6604930376698862),
+    FRAC_CONST(0.6627170655451516),
+    FRAC_CONST(0.6649360316772256),
+    FRAC_CONST(0.6671498731802533),
+    FRAC_CONST(0.6693585275602818),
+    FRAC_CONST(0.6715619327200959),
+    FRAC_CONST(0.6737600269640164),
+    FRAC_CONST(0.6759527490026566),
+    FRAC_CONST(0.6781400379576392),
+    FRAC_CONST(0.6803218333662715),
+    FRAC_CONST(0.6824980751861787),
+    FRAC_CONST(0.6846687037998949),
+    FRAC_CONST(0.6868336600194123),
+    FRAC_CONST(0.6889928850906855),
+    FRAC_CONST(0.6911463206980928),
+    FRAC_CONST(0.6932939089688525),
+    FRAC_CONST(0.6954355924773949),
+    FRAC_CONST(0.6975713142496884),
+    FRAC_CONST(0.6997010177675195),
+    FRAC_CONST(0.7018246469727265),
+    FRAC_CONST(0.7039421462713862),
+    FRAC_CONST(0.7060534605379528),
+    FRAC_CONST(0.7081585351193496),
+    FRAC_CONST(0.7102573158390105),
+    FRAC_CONST(0.7123497490008750),
+    FRAC_CONST(0.7144357813933307),
+    FRAC_CONST(0.7165153602931092),
+    FRAC_CONST(0.7185884334691287),
+    FRAC_CONST(0.7206549491862871),
+    FRAC_CONST(0.7227148562092042),
+    FRAC_CONST(0.7247681038059106),
+    FRAC_CONST(0.7268146417514855),
+    FRAC_CONST(0.7288544203316418),
+    FRAC_CONST(0.7308873903462577),
+    FRAC_CONST(0.7329135031128549),
+    FRAC_CONST(0.7349327104700221),
+    FRAC_CONST(0.7369449647807855),
+    FRAC_CONST(0.7389502189359237),
+    FRAC_CONST(0.7409484263572271),
+    FRAC_CONST(0.7429395410007016),
+    FRAC_CONST(0.7449235173597176),
+    FRAC_CONST(0.7469003104681008),
+    FRAC_CONST(0.7488698759031670),
+    FRAC_CONST(0.7508321697887005),
+    FRAC_CONST(0.7527871487978728),
+    FRAC_CONST(0.7547347701561059),
+    FRAC_CONST(0.7566749916438754),
+    FRAC_CONST(0.7586077715994560),
+    FRAC_CONST(0.7605330689216074),
+    FRAC_CONST(0.7624508430722016),
+    FRAC_CONST(0.7643610540787891),
+    FRAC_CONST(0.7662636625371070),
+    FRAC_CONST(0.7681586296135255),
+    FRAC_CONST(0.7700459170474343),
+    FRAC_CONST(0.7719254871535672),
+    FRAC_CONST(0.7737973028242671),
+    FRAC_CONST(0.7756613275316875),
+    FRAC_CONST(0.7775175253299340),
+    FRAC_CONST(0.7793658608571425),
+    FRAC_CONST(0.7812062993374951),
+    FRAC_CONST(0.7830388065831744),
+    FRAC_CONST(0.7848633489962533),
+    FRAC_CONST(0.7866798935705233),
+    FRAC_CONST(0.7884884078932579),
+    FRAC_CONST(0.7902888601469138),
+    FRAC_CONST(0.7920812191107668),
+    FRAC_CONST(0.7938654541624850),
+    FRAC_CONST(0.7956415352796368),
+    FRAC_CONST(0.7974094330411343),
+    FRAC_CONST(0.7991691186286133),
+    FRAC_CONST(0.8009205638277465),
+    FRAC_CONST(0.8026637410294932),
+    FRAC_CONST(0.8043986232312831),
+    FRAC_CONST(0.8061251840381346),
+    FRAC_CONST(0.8078433976637077),
+    FRAC_CONST(0.8095532389312917),
+    FRAC_CONST(0.8112546832747255),
+    FRAC_CONST(0.8129477067392539),
+    FRAC_CONST(0.8146322859823164),
+    FRAC_CONST(0.8163083982742698),
+    FRAC_CONST(0.8179760214990457),
+    FRAC_CONST(0.8196351341547393),
+    FRAC_CONST(0.8212857153541345),
+    FRAC_CONST(0.8229277448251595),
+    FRAC_CONST(0.8245612029112778),
+    FRAC_CONST(0.8261860705718113),
+    FRAC_CONST(0.8278023293821971),
+    FRAC_CONST(0.8294099615341773),
+    FRAC_CONST(0.8310089498359212),
+    FRAC_CONST(0.8325992777120815),
+    FRAC_CONST(0.8341809292037831),
+    FRAC_CONST(0.8357538889685445),
+    FRAC_CONST(0.8373181422801330),
+    FRAC_CONST(0.8388736750283521),
+    FRAC_CONST(0.8404204737187619),
+    FRAC_CONST(0.8419585254723335),
+    FRAC_CONST(0.8434878180250348),
+    FRAC_CONST(0.8450083397273509),
+    FRAC_CONST(0.8465200795437368),
+    FRAC_CONST(0.8480230270520029),
+    FRAC_CONST(0.8495171724426350),
+    FRAC_CONST(0.8510025065180464),
+    FRAC_CONST(0.8524790206917633),
+    FRAC_CONST(0.8539467069875448),
+    FRAC_CONST(0.8554055580384357),
+    FRAC_CONST(0.8568555670857525),
+    FRAC_CONST(0.8582967279780043),
+    FRAC_CONST(0.8597290351697464),
+    FRAC_CONST(0.8611524837203691),
+    FRAC_CONST(0.8625670692928198),
+    FRAC_CONST(0.8639727881522599),
+    FRAC_CONST(0.8653696371646555),
+    FRAC_CONST(0.8667576137953045),
+    FRAC_CONST(0.8681367161072958),
+    FRAC_CONST(0.8695069427599065),
+    FRAC_CONST(0.8708682930069319),
+    FRAC_CONST(0.8722207666949527),
+    FRAC_CONST(0.8735643642615368),
+    FRAC_CONST(0.8748990867333771),
+    FRAC_CONST(0.8762249357243662),
+    FRAC_CONST(0.8775419134336067),
+    FRAC_CONST(0.8788500226433579),
+    FRAC_CONST(0.8801492667169208),
+    FRAC_CONST(0.8814396495964587),
+    FRAC_CONST(0.8827211758007560),
+    FRAC_CONST(0.8839938504229149),
+    FRAC_CONST(0.8852576791279895),
+    FRAC_CONST(0.8865126681505587),
+    FRAC_CONST(0.8877588242922386),
+    FRAC_CONST(0.8889961549191320),
+    FRAC_CONST(0.8902246679592184),
+    FRAC_CONST(0.8914443718996848),
+    FRAC_CONST(0.8926552757841945),
+    FRAC_CONST(0.8938573892100969),
+    FRAC_CONST(0.8950507223255798),
+    FRAC_CONST(0.8962352858267605),
+    FRAC_CONST(0.8974110909547198),
+    FRAC_CONST(0.8985781494924783),
+    FRAC_CONST(0.8997364737619142),
+    FRAC_CONST(0.9008860766206249),
+    FRAC_CONST(0.9020269714587307),
+    FRAC_CONST(0.9031591721956235),
+    FRAC_CONST(0.9042826932766591),
+    FRAC_CONST(0.9053975496697941),
+    FRAC_CONST(0.9065037568621681),
+    FRAC_CONST(0.9076013308566311),
+    FRAC_CONST(0.9086902881682180),
+    FRAC_CONST(0.9097706458205682),
+    FRAC_CONST(0.9108424213422940),
+    FRAC_CONST(0.9119056327632955),
+    FRAC_CONST(0.9129602986110235),
+    FRAC_CONST(0.9140064379066919),
+    FRAC_CONST(0.9150440701614393),
+    FRAC_CONST(0.9160732153724396),
+    FRAC_CONST(0.9170938940189634),
+    FRAC_CONST(0.9181061270583908),
+    FRAC_CONST(0.9191099359221748),
+    FRAC_CONST(0.9201053425117579),
+    FRAC_CONST(0.9210923691944400),
+    FRAC_CONST(0.9220710387992010),
+    FRAC_CONST(0.9230413746124764),
+    FRAC_CONST(0.9240034003738882),
+    FRAC_CONST(0.9249571402719298),
+    FRAC_CONST(0.9259026189396085),
+    FRAC_CONST(0.9268398614500427),
+    FRAC_CONST(0.9277688933120170),
+    FRAC_CONST(0.9286897404654957),
+    FRAC_CONST(0.9296024292770939),
+    FRAC_CONST(0.9305069865355076),
+    FRAC_CONST(0.9314034394469048),
+    FRAC_CONST(0.9322918156302762),
+    FRAC_CONST(0.9331721431127471),
+    FRAC_CONST(0.9340444503248519),
+    FRAC_CONST(0.9349087660957711),
+    FRAC_CONST(0.9357651196485313),
+    FRAC_CONST(0.9366135405951697),
+    FRAC_CONST(0.9374540589318637),
+    FRAC_CONST(0.9382867050340261),
+    FRAC_CONST(0.9391115096513655),
+    FRAC_CONST(0.9399285039029165),
+    FRAC_CONST(0.9407377192720349),
+    FRAC_CONST(0.9415391876013639),
+    FRAC_CONST(0.9423329410877687),
+    FRAC_CONST(0.9431190122772415),
+    FRAC_CONST(0.9438974340597782),
+    FRAC_CONST(0.9446682396642262),
+    FRAC_CONST(0.9454314626531054),
+    FRAC_CONST(0.9461871369174033),
+    FRAC_CONST(0.9469352966713429),
+    FRAC_CONST(0.9476759764471278),
+    FRAC_CONST(0.9484092110896616),
+    FRAC_CONST(0.9491350357512457),
+    FRAC_CONST(0.9498534858862532),
+    FRAC_CONST(0.9505645972457831),
+    FRAC_CONST(0.9512684058722927),
+    FRAC_CONST(0.9519649480942105),
+    FRAC_CONST(0.9526542605205314),
+    FRAC_CONST(0.9533363800353921),
+    FRAC_CONST(0.9540113437926313),
+    FRAC_CONST(0.9546791892103320),
+    FRAC_CONST(0.9553399539653500),
+    FRAC_CONST(0.9559936759878265),
+    FRAC_CONST(0.9566403934556893),
+    FRAC_CONST(0.9572801447891388),
+    FRAC_CONST(0.9579129686451244),
+    FRAC_CONST(0.9585389039118085),
+    FRAC_CONST(0.9591579897030224),
+    FRAC_CONST(0.9597702653527108),
+    FRAC_CONST(0.9603757704093711),
+    FRAC_CONST(0.9609745446304828),
+    FRAC_CONST(0.9615666279769324),
+    FRAC_CONST(0.9621520606074324),
+    FRAC_CONST(0.9627308828729358),
+    FRAC_CONST(0.9633031353110477),
+    FRAC_CONST(0.9638688586404335),
+    FRAC_CONST(0.9644280937552258),
+    FRAC_CONST(0.9649808817194311),
+    FRAC_CONST(0.9655272637613366),
+    FRAC_CONST(0.9660672812679171),
+    FRAC_CONST(0.9666009757792454),
+    FRAC_CONST(0.9671283889829055),
+    FRAC_CONST(0.9676495627084089),
+    FRAC_CONST(0.9681645389216160),
+    FRAC_CONST(0.9686733597191652),
+    FRAC_CONST(0.9691760673229058),
+    FRAC_CONST(0.9696727040743406),
+    FRAC_CONST(0.9701633124290767),
+    FRAC_CONST(0.9706479349512860),
+    FRAC_CONST(0.9711266143081750),
+    FRAC_CONST(0.9715993932644684),
+    FRAC_CONST(0.9720663146769026),
+    FRAC_CONST(0.9725274214887337),
+    FRAC_CONST(0.9729827567242596),
+    FRAC_CONST(0.9734323634833574),
+    FRAC_CONST(0.9738762849360358),
+    FRAC_CONST(0.9743145643170059),
+    FRAC_CONST(0.9747472449202687),
+    FRAC_CONST(0.9751743700937215),
+    FRAC_CONST(0.9755959832337850),
+    FRAC_CONST(0.9760121277800496),
+    FRAC_CONST(0.9764228472099433),
+    FRAC_CONST(0.9768281850334235),
+    FRAC_CONST(0.9772281847876897),
+    FRAC_CONST(0.9776228900319223),
+    FRAC_CONST(0.9780123443420448),
+    FRAC_CONST(0.9783965913055132),
+    FRAC_CONST(0.9787756745161313),
+    FRAC_CONST(0.9791496375688939),
+    FRAC_CONST(0.9795185240548578),
+    FRAC_CONST(0.9798823775560431),
+    FRAC_CONST(0.9802412416403639),
+    FRAC_CONST(0.9805951598565897),
+    FRAC_CONST(0.9809441757293399),
+    FRAC_CONST(0.9812883327541090),
+    FRAC_CONST(0.9816276743923267),
+    FRAC_CONST(0.9819622440664515),
+    FRAC_CONST(0.9822920851550995),
+    FRAC_CONST(0.9826172409882086),
+    FRAC_CONST(0.9829377548422400),
+    FRAC_CONST(0.9832536699354163),
+    FRAC_CONST(0.9835650294229984),
+    FRAC_CONST(0.9838718763926001),
+    FRAC_CONST(0.9841742538595437),
+    FRAC_CONST(0.9844722047622547),
+    FRAC_CONST(0.9847657719576983),
+    FRAC_CONST(0.9850549982168574),
+    FRAC_CONST(0.9853399262202529),
+    FRAC_CONST(0.9856205985535073),
+    FRAC_CONST(0.9858970577029519),
+    FRAC_CONST(0.9861693460512790),
+    FRAC_CONST(0.9864375058732389),
+    FRAC_CONST(0.9867015793313820),
+    FRAC_CONST(0.9869616084718489),
+    FRAC_CONST(0.9872176352202061),
+    FRAC_CONST(0.9874697013773301),
+    FRAC_CONST(0.9877178486153397),
+    FRAC_CONST(0.9879621184735767),
+    FRAC_CONST(0.9882025523546365),
+    FRAC_CONST(0.9884391915204485),
+    FRAC_CONST(0.9886720770884069),
+    FRAC_CONST(0.9889012500275530),
+    FRAC_CONST(0.9891267511548089),
+    FRAC_CONST(0.9893486211312621),
+    FRAC_CONST(0.9895669004585049),
+    FRAC_CONST(0.9897816294750255),
+    FRAC_CONST(0.9899928483526520),
+    FRAC_CONST(0.9902005970930525),
+    FRAC_CONST(0.9904049155242876),
+    FRAC_CONST(0.9906058432974180),
+    FRAC_CONST(0.9908034198831690),
+    FRAC_CONST(0.9909976845686489),
+    FRAC_CONST(0.9911886764541239),
+    FRAC_CONST(0.9913764344498495),
+    FRAC_CONST(0.9915609972729590),
+    FRAC_CONST(0.9917424034444086),
+    FRAC_CONST(0.9919206912859797),
+    FRAC_CONST(0.9920958989173397),
+    FRAC_CONST(0.9922680642531603),
+    FRAC_CONST(0.9924372250002933),
+    FRAC_CONST(0.9926034186550070),
+    FRAC_CONST(0.9927666825002789),
+    FRAC_CONST(0.9929270536031491),
+    FRAC_CONST(0.9930845688121325),
+    FRAC_CONST(0.9932392647546895),
+    FRAC_CONST(0.9933911778347579),
+    FRAC_CONST(0.9935403442303433),
+    FRAC_CONST(0.9936867998911693),
+    FRAC_CONST(0.9938305805363887),
+    FRAC_CONST(0.9939717216523539),
+    FRAC_CONST(0.9941102584904481),
+    FRAC_CONST(0.9942462260649764),
+    FRAC_CONST(0.9943796591511174),
+    FRAC_CONST(0.9945105922829353),
+    FRAC_CONST(0.9946390597514524),
+    FRAC_CONST(0.9947650956027824),
+    FRAC_CONST(0.9948887336363228),
+    FRAC_CONST(0.9950100074030103),
+    FRAC_CONST(0.9951289502036336),
+    FRAC_CONST(0.9952455950872091),
+    FRAC_CONST(0.9953599748494155),
+    FRAC_CONST(0.9954721220310890),
+    FRAC_CONST(0.9955820689167787),
+    FRAC_CONST(0.9956898475333619),
+    FRAC_CONST(0.9957954896487196),
+    FRAC_CONST(0.9958990267704713),
+    FRAC_CONST(0.9960004901447701),
+    FRAC_CONST(0.9960999107551559),
+    FRAC_CONST(0.9961973193214694),
+    FRAC_CONST(0.9962927462988245),
+    FRAC_CONST(0.9963862218766388),
+    FRAC_CONST(0.9964777759777242),
+    FRAC_CONST(0.9965674382574342),
+    FRAC_CONST(0.9966552381028704),
+    FRAC_CONST(0.9967412046321465),
+    FRAC_CONST(0.9968253666937095),
+    FRAC_CONST(0.9969077528657186),
+    FRAC_CONST(0.9969883914554805),
+    FRAC_CONST(0.9970673104989413),
+    FRAC_CONST(0.9971445377602348),
+    FRAC_CONST(0.9972201007312871),
+    FRAC_CONST(0.9972940266314749),
+    FRAC_CONST(0.9973663424073412),
+    FRAC_CONST(0.9974370747323638),
+    FRAC_CONST(0.9975062500067785),
+    FRAC_CONST(0.9975738943574574),
+    FRAC_CONST(0.9976400336378379),
+    FRAC_CONST(0.9977046934279079),
+    FRAC_CONST(0.9977678990342401),
+    FRAC_CONST(0.9978296754900812),
+    FRAC_CONST(0.9978900475554902),
+    FRAC_CONST(0.9979490397175296),
+    FRAC_CONST(0.9980066761905056),
+    FRAC_CONST(0.9980629809162593),
+    FRAC_CONST(0.9981179775645063),
+    FRAC_CONST(0.9981716895332257),
+    FRAC_CONST(0.9982241399490979),
+    FRAC_CONST(0.9982753516679893),
+    FRAC_CONST(0.9983253472754841),
+    FRAC_CONST(0.9983741490874634),
+    FRAC_CONST(0.9984217791507299),
+    FRAC_CONST(0.9984682592436778),
+    FRAC_CONST(0.9985136108770075),
+    FRAC_CONST(0.9985578552944850),
+    FRAC_CONST(0.9986010134737439),
+    FRAC_CONST(0.9986431061271304),
+    FRAC_CONST(0.9986841537025921),
+    FRAC_CONST(0.9987241763846056),
+    FRAC_CONST(0.9987631940951476),
+    FRAC_CONST(0.9988012264947044),
+    FRAC_CONST(0.9988382929833222),
+    FRAC_CONST(0.9988744127016956),
+    FRAC_CONST(0.9989096045322947),
+    FRAC_CONST(0.9989438871005292),
+    FRAC_CONST(0.9989772787759494),
+    FRAC_CONST(0.9990097976734847),
+    FRAC_CONST(0.9990414616547146),
+    FRAC_CONST(0.9990722883291779),
+    FRAC_CONST(0.9991022950557125),
+    FRAC_CONST(0.9991314989438310),
+    FRAC_CONST(0.9991599168551279),
+    FRAC_CONST(0.9991875654047181),
+    FRAC_CONST(0.9992144609627068),
+    FRAC_CONST(0.9992406196556911),
+    FRAC_CONST(0.9992660573682882),
+    FRAC_CONST(0.9992907897446957),
+    FRAC_CONST(0.9993148321902777),
+    FRAC_CONST(0.9993381998731797),
+    FRAC_CONST(0.9993609077259696),
+    FRAC_CONST(0.9993829704473038),
+    FRAC_CONST(0.9994044025036201),
+    FRAC_CONST(0.9994252181308537),
+    FRAC_CONST(0.9994454313361775),
+    FRAC_CONST(0.9994650558997651),
+    FRAC_CONST(0.9994841053765757),
+    FRAC_CONST(0.9995025930981609),
+    FRAC_CONST(0.9995205321744921),
+    FRAC_CONST(0.9995379354958073),
+    FRAC_CONST(0.9995548157344778),
+    FRAC_CONST(0.9995711853468930),
+    FRAC_CONST(0.9995870565753632),
+    FRAC_CONST(0.9996024414500382),
+    FRAC_CONST(0.9996173517908444),
+    FRAC_CONST(0.9996317992094352),
+    FRAC_CONST(0.9996457951111574),
+    FRAC_CONST(0.9996593506970310),
+    FRAC_CONST(0.9996724769657434),
+    FRAC_CONST(0.9996851847156547),
+    FRAC_CONST(0.9996974845468164),
+    FRAC_CONST(0.9997093868630000),
+    FRAC_CONST(0.9997209018737374),
+    FRAC_CONST(0.9997320395963699),
+    FRAC_CONST(0.9997428098581069),
+    FRAC_CONST(0.9997532222980933),
+    FRAC_CONST(0.9997632863694836),
+    FRAC_CONST(0.9997730113415246),
+    FRAC_CONST(0.9997824063016426),
+    FRAC_CONST(0.9997914801575380),
+    FRAC_CONST(0.9998002416392840),
+    FRAC_CONST(0.9998086993014300),
+    FRAC_CONST(0.9998168615251084),
+    FRAC_CONST(0.9998247365201450),
+    FRAC_CONST(0.9998323323271717),
+    FRAC_CONST(0.9998396568197407),
+    FRAC_CONST(0.9998467177064404),
+    FRAC_CONST(0.9998535225330116),
+    FRAC_CONST(0.9998600786844637),
+    FRAC_CONST(0.9998663933871905),
+    FRAC_CONST(0.9998724737110845),
+    FRAC_CONST(0.9998783265716498),
+    FRAC_CONST(0.9998839587321121),
+    FRAC_CONST(0.9998893768055266),
+    FRAC_CONST(0.9998945872568815),
+    FRAC_CONST(0.9998995964051983),
+    FRAC_CONST(0.9999044104256269),
+    FRAC_CONST(0.9999090353515359),
+    FRAC_CONST(0.9999134770765971),
+    FRAC_CONST(0.9999177413568642),
+    FRAC_CONST(0.9999218338128448),
+    FRAC_CONST(0.9999257599315647),
+    FRAC_CONST(0.9999295250686255),
+    FRAC_CONST(0.9999331344502529),
+    FRAC_CONST(0.9999365931753376),
+    FRAC_CONST(0.9999399062174669),
+    FRAC_CONST(0.9999430784269460),
+    FRAC_CONST(0.9999461145328103),
+    FRAC_CONST(0.9999490191448277),
+    FRAC_CONST(0.9999517967554878),
+    FRAC_CONST(0.9999544517419835),
+    FRAC_CONST(0.9999569883681778),
+    FRAC_CONST(0.9999594107865607),
+    FRAC_CONST(0.9999617230401926),
+    FRAC_CONST(0.9999639290646355),
+    FRAC_CONST(0.9999660326898712),
+    FRAC_CONST(0.9999680376422052),
+    FRAC_CONST(0.9999699475461585),
+    FRAC_CONST(0.9999717659263435),
+    FRAC_CONST(0.9999734962093266),
+    FRAC_CONST(0.9999751417254756),
+    FRAC_CONST(0.9999767057107922),
+    FRAC_CONST(0.9999781913087290),
+    FRAC_CONST(0.9999796015719915),
+    FRAC_CONST(0.9999809394643231),
+    FRAC_CONST(0.9999822078622751),
+    FRAC_CONST(0.9999834095569596),
+    FRAC_CONST(0.9999845472557860),
+    FRAC_CONST(0.9999856235841805),
+    FRAC_CONST(0.9999866410872889),
+    FRAC_CONST(0.9999876022316609),
+    FRAC_CONST(0.9999885094069193),
+    FRAC_CONST(0.9999893649274085),
+    FRAC_CONST(0.9999901710338274),
+    FRAC_CONST(0.9999909298948430),
+    FRAC_CONST(0.9999916436086862),
+    FRAC_CONST(0.9999923142047299),
+    FRAC_CONST(0.9999929436450469),
+    FRAC_CONST(0.9999935338259505),
+    FRAC_CONST(0.9999940865795161),
+    FRAC_CONST(0.9999946036750835),
+    FRAC_CONST(0.9999950868207405),
+    FRAC_CONST(0.9999955376647868),
+    FRAC_CONST(0.9999959577971798),
+    FRAC_CONST(0.9999963487509599),
+    FRAC_CONST(0.9999967120036571),
+    FRAC_CONST(0.9999970489786785),
+    FRAC_CONST(0.9999973610466748),
+    FRAC_CONST(0.9999976495268890),
+    FRAC_CONST(0.9999979156884846),
+    FRAC_CONST(0.9999981607518545),
+    FRAC_CONST(0.9999983858899099),
+    FRAC_CONST(0.9999985922293493),
+    FRAC_CONST(0.9999987808519092),
+    FRAC_CONST(0.9999989527955938),
+    FRAC_CONST(0.9999991090558848),
+    FRAC_CONST(0.9999992505869332),
+    FRAC_CONST(0.9999993783027293),
+    FRAC_CONST(0.9999994930782556),
+    FRAC_CONST(0.9999995957506171),
+    FRAC_CONST(0.9999996871201549),
+    FRAC_CONST(0.9999997679515386),
+    FRAC_CONST(0.9999998389748399),
+    FRAC_CONST(0.9999999008865869),
+    FRAC_CONST(0.9999999543507984)
+};
+#endif
+
+real_t kbd_short_128[] =
+{
+    FRAC_CONST(4.3795702929468881e-005),
+    FRAC_CONST(0.00011867384265436617),
+    FRAC_CONST(0.0002307165763996192),
+    FRAC_CONST(0.00038947282760568383),
+    FRAC_CONST(0.00060581272288302553),
+    FRAC_CONST(0.00089199695169487453),
+    FRAC_CONST(0.0012617254423430522),
+    FRAC_CONST(0.0017301724373162003),
+    FRAC_CONST(0.0023140071937421476),
+    FRAC_CONST(0.0030313989666022221),
+    FRAC_CONST(0.0039020049735530842),
+    FRAC_CONST(0.0049469401815512024),
+    FRAC_CONST(0.0061887279335368318),
+    FRAC_CONST(0.0076512306364647726),
+    FRAC_CONST(0.0093595599562652423),
+    FRAC_CONST(0.011339966208377799),
+    FRAC_CONST(0.013619706891715299),
+    FRAC_CONST(0.016226894586323766),
+    FRAC_CONST(0.019190324717288168),
+    FRAC_CONST(0.022539283975960878),
+    FRAC_CONST(0.026303340480472455),
+    FRAC_CONST(0.030512117046644357),
+    FRAC_CONST(0.03519504922365594),
+    FRAC_CONST(0.040381130021856941),
+    FRAC_CONST(0.046098643518702249),
+    FRAC_CONST(0.052374889768730587),
+    FRAC_CONST(0.059235903660769147),
+    FRAC_CONST(0.066706170556282418),
+    FRAC_CONST(0.074808341703430481),
+    FRAC_CONST(0.083562952548726227),
+    FRAC_CONST(0.092988147159339674),
+    FRAC_CONST(0.1030994120216919),
+    FRAC_CONST(0.11390932249409955),
+    FRAC_CONST(0.12542730516149531),
+    FRAC_CONST(0.13765941926783826),
+    FRAC_CONST(0.15060816028651081),
+    FRAC_CONST(0.16427228853114245),
+    FRAC_CONST(0.17864668550988483),
+    FRAC_CONST(0.19372224048676889),
+    FRAC_CONST(0.20948576943658073),
+    FRAC_CONST(0.22591996826744942),
+    FRAC_CONST(0.24300340184133981),
+    FRAC_CONST(0.26071052995068139),
+    FRAC_CONST(0.27901177101369551),
+    FRAC_CONST(0.29787360383626599),
+    FRAC_CONST(0.3172587073594233),
+    FRAC_CONST(0.33712613787396362),
+    FRAC_CONST(0.35743154274286698),
+    FRAC_CONST(0.37812740923363009),
+    FRAC_CONST(0.39916334663203618),
+    FRAC_CONST(0.42048639939189658),
+    FRAC_CONST(0.4420413886774246),
+    FRAC_CONST(0.4637712792815169),
+    FRAC_CONST(0.4856175685594023),
+    FRAC_CONST(0.50752069370766872),
+    FRAC_CONST(0.52942045344797806),
+    FRAC_CONST(0.55125643994680196),
+    FRAC_CONST(0.57296847662071559),
+    FRAC_CONST(0.59449705734411495),
+    FRAC_CONST(0.61578378249506627),
+    FRAC_CONST(0.63677178724712891),
+    FRAC_CONST(0.65740615754163356),
+    FRAC_CONST(0.67763432925662526),
+    FRAC_CONST(0.69740646622548552),
+    FRAC_CONST(0.71667581294953808),
+    FRAC_CONST(0.73539901809352737),
+    FRAC_CONST(0.75353642514900732),
+    FRAC_CONST(0.77105232699609816),
+    FRAC_CONST(0.78791518148597028),
+    FRAC_CONST(0.80409778560147072),
+    FRAC_CONST(0.81957740622770781),
+    FRAC_CONST(0.83433586607383625),
+    FRAC_CONST(0.84835958382689225),
+    FRAC_CONST(0.86163956818294229),
+    FRAC_CONST(0.87417136598406997),
+    FRAC_CONST(0.88595496528524853),
+    FRAC_CONST(0.89699465477567619),
+    FRAC_CONST(0.90729884157670959),
+    FRAC_CONST(0.91687983002436779),
+    FRAC_CONST(0.92575356460899649),
+    FRAC_CONST(0.93393934077779084),
+    FRAC_CONST(0.94145948779657318),
+    FRAC_CONST(0.94833902830402828),
+    FRAC_CONST(0.95460531956280026),
+    FRAC_CONST(0.96028768170574896),
+    FRAC_CONST(0.96541701848104766),
+    FRAC_CONST(0.97002543610646474),
+    FRAC_CONST(0.97414586584250062),
+    FRAC_CONST(0.97781169577969584),
+    FRAC_CONST(0.98105641710392333),
+    FRAC_CONST(0.98391328975491177),
+    FRAC_CONST(0.98641503193166202),
+    FRAC_CONST(0.98859353733226141),
+    FRAC_CONST(0.99047962335771556),
+    FRAC_CONST(0.9921028127769449),
+    FRAC_CONST(0.99349115056397752),
+    FRAC_CONST(0.99467105680259038),
+    FRAC_CONST(0.9956672157341897),
+    FRAC_CONST(0.99650250022834352),
+    FRAC_CONST(0.99719793020823266),
+    FRAC_CONST(0.99777266288955657),
+    FRAC_CONST(0.99824401211201486),
+    FRAC_CONST(0.99862749357391212),
+    FRAC_CONST(0.99893689243401962),
+    FRAC_CONST(0.99918434952623147),
+    FRAC_CONST(0.99938046234161726),
+    FRAC_CONST(0.99953439696357238),
+    FRAC_CONST(0.99965400728430465),
+    FRAC_CONST(0.99974595807027455),
+    FRAC_CONST(0.99981584876278362),
+    FRAC_CONST(0.99986833527824281),
+    FRAC_CONST(0.99990724749057802),
+    FRAC_CONST(0.99993570051598468),
+    FRAC_CONST(0.99995619835942084),
+    FRAC_CONST(0.99997072890647543),
+    FRAC_CONST(0.9999808496399144),
+    FRAC_CONST(0.99998776381655818),
+    FRAC_CONST(0.99999238714961569),
+    FRAC_CONST(0.99999540529959718),
+    FRAC_CONST(0.99999732268176988),
+    FRAC_CONST(0.99999850325054862),
+    FRAC_CONST(0.99999920402413744),
+    FRAC_CONST(0.9999996021706401),
+    FRAC_CONST(0.99999981649545566),
+    FRAC_CONST(0.99999992415545547),
+    FRAC_CONST(0.99999997338493041),
+    FRAC_CONST(0.99999999295825959),
+    FRAC_CONST(0.99999999904096815)
+};
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+real_t kbd_short_120[] =
+{
+    FRAC_CONST(0.0000452320086910),
+    FRAC_CONST(0.0001274564692111),
+    FRAC_CONST(0.0002529398385345),
+    FRAC_CONST(0.0004335140496648),
+    FRAC_CONST(0.0006827100966952),
+    FRAC_CONST(0.0010158708222246),
+    FRAC_CONST(0.0014502162869659),
+    FRAC_CONST(0.0020048865156264),
+    FRAC_CONST(0.0027009618393178),
+    FRAC_CONST(0.0035614590925043),
+    FRAC_CONST(0.0046113018122711),
+    FRAC_CONST(0.0058772627936484),
+    FRAC_CONST(0.0073878776584103),
+    FRAC_CONST(0.0091733284512589),
+    FRAC_CONST(0.0112652966728373),
+    FRAC_CONST(0.0136967855861945),
+    FRAC_CONST(0.0165019120857793),
+    FRAC_CONST(0.0197156688892217),
+    FRAC_CONST(0.0233736582950619),
+    FRAC_CONST(0.0275117992367496),
+    FRAC_CONST(0.0321660098468534),
+    FRAC_CONST(0.0373718682174417),
+    FRAC_CONST(0.0431642544948834),
+    FRAC_CONST(0.0495769778717676),
+    FRAC_CONST(0.0566423924273392),
+    FRAC_CONST(0.0643910061132260),
+    FRAC_CONST(0.0728510874761729),
+    FRAC_CONST(0.0820482749475221),
+    FRAC_CONST(0.0920051937045235),
+    FRAC_CONST(0.1027410852163450),
+    FRAC_CONST(0.1142714546239370),
+    FRAC_CONST(0.1266077410648368),
+    FRAC_CONST(0.1397570159398145),
+    FRAC_CONST(0.1537217139274270),
+    FRAC_CONST(0.1684994012857075),
+    FRAC_CONST(0.1840825856392944),
+    FRAC_CONST(0.2004585710384133),
+    FRAC_CONST(0.2176093615976121),
+    FRAC_CONST(0.2355116164824983),
+    FRAC_CONST(0.2541366584185075),
+    FRAC_CONST(0.2734505372545160),
+    FRAC_CONST(0.2934141494343369),
+    FRAC_CONST(0.3139834135200387),
+    FRAC_CONST(0.3351095011824163),
+    FRAC_CONST(0.3567391223361566),
+    FRAC_CONST(0.3788148623608774),
+    FRAC_CONST(0.4012755686250732),
+    FRAC_CONST(0.4240567828288110),
+    FRAC_CONST(0.4470912150133537),
+    FRAC_CONST(0.4703092544619664),
+    FRAC_CONST(0.4936395121456694),
+    FRAC_CONST(0.5170093888596962),
+    FRAC_CONST(0.5403456627591340),
+    FRAC_CONST(0.5635750896430154),
+    FRAC_CONST(0.5866250090612892),
+    FRAC_CONST(0.6094239491338723),
+    FRAC_CONST(0.6319022228794100),
+    FRAC_CONST(0.6539925088563087),
+    FRAC_CONST(0.6756304090216887),
+    FRAC_CONST(0.6967549769155277),
+    FRAC_CONST(0.7173092095766250),
+    FRAC_CONST(0.7372404969921184),
+    FRAC_CONST(0.7565010233699827),
+    FRAC_CONST(0.7750481150999984),
+    FRAC_CONST(0.7928445309277697),
+    FRAC_CONST(0.8098586906021583),
+    FRAC_CONST(0.8260648390616000),
+    FRAC_CONST(0.8414431440907889),
+    FRAC_CONST(0.8559797262966709),
+    FRAC_CONST(0.8696666212110165),
+    FRAC_CONST(0.8825016743142358),
+    FRAC_CONST(0.8944883707784486),
+    FRAC_CONST(0.9056356027326216),
+    FRAC_CONST(0.9159573778427816),
+    FRAC_CONST(0.9254724739583072),
+    FRAC_CONST(0.9342040454819434),
+    FRAC_CONST(0.9421791879559176),
+    FRAC_CONST(0.9494284680976784),
+    FRAC_CONST(0.9559854271440150),
+    FRAC_CONST(0.9618860658493898),
+    FRAC_CONST(0.9671683198119525),
+    FRAC_CONST(0.9718715339497299),
+    FRAC_CONST(0.9760359449042233),
+    FRAC_CONST(0.9797021798981759),
+    FRAC_CONST(0.9829107801140203),
+    FRAC_CONST(0.9857017559923277),
+    FRAC_CONST(0.9881141809867999),
+    FRAC_CONST(0.9901858292742826),
+    FRAC_CONST(0.9919528617340944),
+    FRAC_CONST(0.9934495632180476),
+    FRAC_CONST(0.9947081327749199),
+    FRAC_CONST(0.9957585271195989),
+    FRAC_CONST(0.9966283562984427),
+    FRAC_CONST(0.9973428292485683),
+    FRAC_CONST(0.9979247458259197),
+    FRAC_CONST(0.9983945309245774),
+    FRAC_CONST(0.9987703055583410),
+    FRAC_CONST(0.9990679892449266),
+    FRAC_CONST(0.9993014277313617),
+    FRAC_CONST(0.9994825400228521),
+    FRAC_CONST(0.9996214788122335),
+    FRAC_CONST(0.9997267987294857),
+    FRAC_CONST(0.9998056273097539),
+    FRAC_CONST(0.9998638341781910),
+    FRAC_CONST(0.9999061946325793),
+    FRAC_CONST(0.9999365445321382),
+    FRAC_CONST(0.9999579241373735),
+    FRAC_CONST(0.9999727092594598),
+    FRAC_CONST(0.9999827287418790),
+    FRAC_CONST(0.9999893678912771),
+    FRAC_CONST(0.9999936579844555),
+    FRAC_CONST(0.9999963523959187),
+    FRAC_CONST(0.9999979902130101),
+    FRAC_CONST(0.9999989484358076),
+    FRAC_CONST(0.9999994840031031),
+    FRAC_CONST(0.9999997669534347),
+    FRAC_CONST(0.9999999060327799),
+    FRAC_CONST(0.9999999680107184),
+    FRAC_CONST(0.9999999918774242),
+    FRAC_CONST(0.9999999989770326)
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/libfaad.dsp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,460 @@
+# Microsoft Developer Studio Project File - Name="libfaad" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=libfaad - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "libfaad.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "libfaad.mak" CFG="libfaad - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "libfaad - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "libfaad - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=xicl6.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "libfaad - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+MTL=midl.exe
+F90=df.exe
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD CPP /nologo /G6 /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD BASE RSC /l 0x413 /d "NDEBUG"
+# ADD RSC /l 0x413 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF  "$(CFG)" == "libfaad - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+MTL=midl.exe
+F90=df.exe
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x413 /d "_DEBUG"
+# ADD RSC /l 0x413 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ENDIF 
+
+# Begin Target
+
+# Name "libfaad - Win32 Release"
+# Name "libfaad - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\bits.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\cfft.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\common.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\decoder.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\drc.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\error.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filtbank.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\hcr.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\huffman.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ic_predict.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\is.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\lt_predict.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mdct.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ms.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\output.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\pns.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\pulse.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\rvlc.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_dct.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_dec.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_e_nf.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_fbt.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_hfadj.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_hfgen.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_huff.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_qmf.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_syntax.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_tf_grid.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\specrec.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ssr.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ssr_fb.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ssr_ipqf.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\syntax.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\tns.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Group "codebook"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\codebook\hcb_1.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb_10.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb_11.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb_2.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb_3.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb_4.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb_5.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb_6.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb_7.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb_8.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb_9.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb_sf.h
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\analysis.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\bits.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\cfft.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\cfft_tab.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\common.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\decoder.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\dither.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\drc.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\error.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filtbank.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\fixed.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\huffman.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ic_predict.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\iq_table.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\is.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\kbd_win.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\lt_predict.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mdct.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ms.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\output.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\pns.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\pulse.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\rvlc.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_dct.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_dec.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_e_nf.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_fbt.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_hfadj.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_hfgen.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_huff.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_noise.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_qmf.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_qmf_c.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_syntax.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_tf_grid.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sine_win.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\specrec.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ssr.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\structs.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\syntax.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\tns.h
+# End Source File
+# End Group
+# End Target
+# End Project
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/libfaad.dsw	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "libfaad"=.\libfaad.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/libfaad.sln	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,21 @@
+Microsoft Visual Studio Solution File, Format Version 7.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaad", "libfaad.vcproj", "{4274723E-6B9D-4B3E-A8BE-7566165AA169}"
+EndProject
+Global
+	GlobalSection(SolutionConfiguration) = preSolution
+		ConfigName.0 = Debug
+		ConfigName.1 = Release
+	EndGlobalSection
+	GlobalSection(ProjectDependencies) = postSolution
+	EndGlobalSection
+	GlobalSection(ProjectConfiguration) = postSolution
+		{4274723E-6B9D-4B3E-A8BE-7566165AA169}.Debug.ActiveCfg = Debug|Win32
+		{4274723E-6B9D-4B3E-A8BE-7566165AA169}.Debug.Build.0 = Debug|Win32
+		{4274723E-6B9D-4B3E-A8BE-7566165AA169}.Release.ActiveCfg = Release|Win32
+		{4274723E-6B9D-4B3E-A8BE-7566165AA169}.Release.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+	EndGlobalSection
+	GlobalSection(ExtensibilityAddIns) = postSolution
+	EndGlobalSection
+EndGlobal
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/libfaad.vcproj	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,964 @@
+<?xml version="1.0" encoding = "Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="libfaad"
+	ProjectGUID="{5EFCFACB-1835-422C-ACDA-E3B3A2F51387}"
+	SccProjectName=""
+	SccLocalPath="">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory=".\Release"
+			IntermediateDirectory=".\Release"
+			ConfigurationType="4"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="FALSE"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				OptimizeForProcessor="2"
+				PreprocessorDefinitions="NDEBUG;WIN32;_LIB"
+				StringPooling="TRUE"
+				RuntimeLibrary="0"
+				EnableFunctionLevelLinking="TRUE"
+				UsePrecompiledHeader="2"
+				PrecompiledHeaderFile=".\Release/libfaad.pch"
+				AssemblerListingLocation=".\Release/"
+				ObjectFile=".\Release/"
+				ProgramDataBaseFileName=".\Release/"
+				WarningLevel="3"
+				SuppressStartupBanner="TRUE"
+				Detect64BitPortabilityProblems="TRUE"
+				AdditionalOptions=""/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile=".\Release\libfaad.lib"
+				SuppressStartupBanner="TRUE"
+				AdditionalOptions=""/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1043"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory=".\Debug"
+			IntermediateDirectory=".\Debug"
+			ConfigurationType="4"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="FALSE"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="_DEBUG;WIN32;_LIB"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				UsePrecompiledHeader="2"
+				PrecompiledHeaderFile=".\Debug/libfaad.pch"
+				AssemblerListingLocation=".\Debug/"
+				ObjectFile=".\Debug/"
+				ProgramDataBaseFileName=".\Debug/"
+				WarningLevel="3"
+				SuppressStartupBanner="TRUE"
+				DebugInformationFormat="4"
+				AdditionalOptions=""/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile=".\Debug\libfaad.lib"
+				SuppressStartupBanner="TRUE"
+				AdditionalOptions=""/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1043"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References/>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
+			<File
+				RelativePath="bits.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="cfft.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="common.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="decoder.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="dither.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="drc.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="error.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="filtbank.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="hcr.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="huffman.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="ic_predict.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="is.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="lt_predict.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="mdct.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="mp4.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="ms.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="output.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="pns.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="pulse.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="rvlc.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="sbr_dct.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="sbr_dec.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="sbr_e_nf.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="sbr_fbt.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="sbr_hfadj.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="sbr_hfgen.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="sbr_huff.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="sbr_qmf.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="sbr_syntax.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="sbr_tf_grid.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="specrec.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="ssr.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="ssr_fb.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="ssr_ipqf.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="syntax.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="tns.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						PreprocessorDefinitions=""
+						AdditionalOptions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						AdditionalOptions=""/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl">
+			<File
+				RelativePath="analysis.h"/>
+			<File
+				RelativePath="bits.h"/>
+			<File
+				RelativePath="cfft.h"/>
+			<File
+				RelativePath="cfft_tab.h"/>
+			<File
+				RelativePath="common.h"/>
+			<File
+				RelativePath="decoder.h"/>
+			<File
+				RelativePath="dither.h"/>
+			<File
+				RelativePath="drc.h"/>
+			<File
+				RelativePath="error.h"/>
+			<File
+				RelativePath="filtbank.h"/>
+			<File
+				RelativePath="fixed.h"/>
+			<File
+				RelativePath="codebook\hcb.h"/>
+			<File
+				RelativePath="huffman.h"/>
+			<File
+				RelativePath="ic_predict.h"/>
+			<File
+				RelativePath="iq_table.h"/>
+			<File
+				RelativePath="is.h"/>
+			<File
+				RelativePath="kbd_win.h"/>
+			<File
+				RelativePath="lt_predict.h"/>
+			<File
+				RelativePath="mdct.h"/>
+			<File
+				RelativePath="mp4.h"/>
+			<File
+				RelativePath="ms.h"/>
+			<File
+				RelativePath="output.h"/>
+			<File
+				RelativePath="pns.h"/>
+			<File
+				RelativePath="pulse.h"/>
+			<File
+				RelativePath="rvlc.h"/>
+			<File
+				RelativePath="sbr_dct.h"/>
+			<File
+				RelativePath="sbr_dec.h"/>
+			<File
+				RelativePath="sbr_e_nf.h"/>
+			<File
+				RelativePath="sbr_fbt.h"/>
+			<File
+				RelativePath="sbr_hfadj.h"/>
+			<File
+				RelativePath="sbr_hfgen.h"/>
+			<File
+				RelativePath="sbr_huff.h"/>
+			<File
+				RelativePath="sbr_noise.h"/>
+			<File
+				RelativePath="sbr_qmf.h"/>
+			<File
+				RelativePath="sbr_syntax.h"/>
+			<File
+				RelativePath="sbr_tf_grid.h"/>
+			<File
+				RelativePath="sine_win.h"/>
+			<File
+				RelativePath="specrec.h"/>
+			<File
+				RelativePath="ssr.h"/>
+			<File
+				RelativePath="structs.h"/>
+			<File
+				RelativePath="syntax.h"/>
+			<File
+				RelativePath="tns.h"/>
+			<Filter
+				Name="codebook"
+				Filter="">
+				<File
+					RelativePath="codebook\hcb_1.h"/>
+				<File
+					RelativePath="codebook\hcb_10.h"/>
+				<File
+					RelativePath="codebook\hcb_11.h"/>
+				<File
+					RelativePath="codebook\hcb_2.h"/>
+				<File
+					RelativePath="codebook\hcb_3.h"/>
+				<File
+					RelativePath="codebook\hcb_4.h"/>
+				<File
+					RelativePath="codebook\hcb_5.h"/>
+				<File
+					RelativePath="codebook\hcb_6.h"/>
+				<File
+					RelativePath="codebook\hcb_7.h"/>
+				<File
+					RelativePath="codebook\hcb_8.h"/>
+				<File
+					RelativePath="codebook\hcb_9.h"/>
+				<File
+					RelativePath="codebook\hcb_sf.h"/>
+			</Filter>
+		</Filter>
+	</Files>
+	<Globals/>
+</VisualStudioProject>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/libfaad2.def	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,14 @@
+LIBRARY  libfaad2.dll
+EXPORTS
+;
+; libfaad exports
+;
+faacDecOpen                      @1
+faacDecGetCurrentConfiguration   @2
+faacDecSetConfiguration          @3
+faacDecInit                      @4
+faacDecInit2                     @5
+faacDecDecode                    @6
+faacDecClose                     @7
+faacDecGetErrorMessage           @8
+AudioSpecificConfig              @9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/libfaad2.vcp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,2091 @@
+# Microsoft eMbedded Visual Tools Project File - Name="libfaad2" - Package Owner=<4>
+# Microsoft eMbedded Visual Tools Generated Build File, Format Version 6.02
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (WCE x86) Static Library" 0x8304
+# TARGTYPE "Win32 (WCE ARM) Static Library" 0x8504
+
+CFG=libfaad2 - Win32 (WCE ARM) Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "libfaad2.vcn".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "libfaad2.vcn" CFG="libfaad2 - Win32 (WCE ARM) Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "libfaad2 - Win32 (WCE ARM) Release" (based on "Win32 (WCE ARM) Static Library")
+!MESSAGE "libfaad2 - Win32 (WCE ARM) Debug" (based on "Win32 (WCE ARM) Static Library")
+!MESSAGE "libfaad2 - Win32 (WCE x86) Release" (based on "Win32 (WCE x86) Static Library")
+!MESSAGE "libfaad2 - Win32 (WCE x86) Debug" (based on "Win32 (WCE x86) Static Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+# PROP ATL_Project 2
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "ARMRel"
+# PROP BASE Intermediate_Dir "ARMRel"
+# PROP BASE CPU_ID "{D6518FFC-710F-11D3-99F2-00105A0DF099}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "ARMRel"
+# PROP Intermediate_Dir "ARMRel"
+# PROP CPU_ID "{D6518FFC-710F-11D3-99F2-00105A0DF099}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir ""
+CPP=clarm.exe
+# ADD BASE CPP /nologo /W3 /GX- /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "NDEBUG" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /Oxs /M$(CECrtMT)  /c
+# ADD CPP /nologo /W3 /GX- /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "NDEBUG" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /Oxs /M$(CECrtMT)  /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "ARMDbg"
+# PROP BASE Intermediate_Dir "ARMDbg"
+# PROP BASE CPU_ID "{D6518FFC-710F-11D3-99F2-00105A0DF099}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "ARMDbg"
+# PROP Intermediate_Dir "ARMDbg"
+# PROP CPU_ID "{D6518FFC-710F-11D3-99F2-00105A0DF099}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir ""
+CPP=clarm.exe
+# ADD BASE CPP /nologo /W3 /GX- /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /M$(CECrtMTDebug)  /c
+# ADD CPP /nologo /W3 /GX- /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /M$(CECrtMTDebug)  /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "X86Rel"
+# PROP BASE Intermediate_Dir "X86Rel"
+# PROP BASE CPU_ID "{D6518FF3-710F-11D3-99F2-00105A0DF099}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "X86Rel"
+# PROP Intermediate_Dir "X86Rel"
+# PROP CPU_ID "{D6518FF3-710F-11D3-99F2-00105A0DF099}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir ""
+CPP=cl.exe
+# ADD BASE CPP /nologo /W3 /GX- /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "_i386_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "NDEBUG" /D "_LIB" /YX /Gs8192 /GF /Oxs  /c
+# ADD CPP /nologo /W3 /GX- /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "_i386_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "NDEBUG" /D "_LIB" /YX /Gs8192 /GF /Oxs  /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "X86Dbg"
+# PROP BASE Intermediate_Dir "X86Dbg"
+# PROP BASE CPU_ID "{D6518FF3-710F-11D3-99F2-00105A0DF099}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "X86Dbg"
+# PROP Intermediate_Dir "X86Dbg"
+# PROP CPU_ID "{D6518FF3-710F-11D3-99F2-00105A0DF099}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir ""
+CPP=cl.exe
+# ADD BASE CPP /nologo /W3 /GX- /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "_i386_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "_LIB" /YX /Gs8192 /GF  /c
+# ADD CPP /nologo /W3 /GX- /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "_i386_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "_LIB" /YX /Gs8192 /GF  /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ENDIF 
+
+# Begin Target
+
+# Name "libfaad2 - Win32 (WCE ARM) Release"
+# Name "libfaad2 - Win32 (WCE ARM) Debug"
+# Name "libfaad2 - Win32 (WCE x86) Release"
+# Name "libfaad2 - Win32 (WCE x86) Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Group "codebook"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\codebook\hcb_1.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_HCB_1=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_HCB_1=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_HCB_1=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_HCB_1=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb_10.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_HCB_10=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_HCB_10=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_HCB_10=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_HCB_10=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb_11.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_HCB_11=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_HCB_11=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_HCB_11=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_HCB_11=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb_2.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_HCB_2=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_HCB_2=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_HCB_2=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_HCB_2=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb_3.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_HCB_3=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_HCB_3=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_HCB_3=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_HCB_3=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb_4.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_HCB_4=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_HCB_4=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_HCB_4=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_HCB_4=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb_5.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_HCB_5=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_HCB_5=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_HCB_5=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_HCB_5=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb_6.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_HCB_6=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_HCB_6=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_HCB_6=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_HCB_6=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb_7.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_HCB_7=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_HCB_7=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_HCB_7=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_HCB_7=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb_8.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_HCB_8=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_HCB_8=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_HCB_8=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_HCB_8=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb_9.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_HCB_9=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_HCB_9=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_HCB_9=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_HCB_9=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb_sf.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_HCB_S=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_HCB_S=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_HCB_S=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_HCB_S=\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\bits.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_BITS_=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_BITS_=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_BITS_=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_BITS_=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\cfft.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_CFFT_=\
+	".\cfft.h"\
+	".\cfft_tab.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_CFFT_=\
+	".\cfft.h"\
+	".\cfft_tab.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_CFFT_=\
+	".\cfft.h"\
+	".\cfft_tab.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_CFFT_=\
+	".\cfft.h"\
+	".\cfft_tab.h"\
+	".\common.h"\
+	".\fixed.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\common.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_COMMO=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_COMMO=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_COMMO=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_COMMO=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\syntax.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\data.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_DATA_=\
+	".\common.h"\
+	".\data.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_DATA_=\
+	".\common.h"\
+	".\data.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_DATA_=\
+	".\common.h"\
+	".\data.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_DATA_=\
+	".\common.h"\
+	".\data.h"\
+	".\fixed.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\decoder.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_DECOD=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\common.h"\
+	".\data.h"\
+	".\decoder.h"\
+	".\dither.h"\
+	".\drc.h"\
+	".\error.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\ic_predict.h"\
+	".\is.h"\
+	".\lt_predict.h"\
+	".\mdct.h"\
+	".\mp4.h"\
+	".\ms.h"\
+	".\output.h"\
+	".\pns.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	".\tns.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_DECOD=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\common.h"\
+	".\data.h"\
+	".\decoder.h"\
+	".\dither.h"\
+	".\drc.h"\
+	".\error.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\ic_predict.h"\
+	".\is.h"\
+	".\lt_predict.h"\
+	".\mdct.h"\
+	".\mp4.h"\
+	".\ms.h"\
+	".\output.h"\
+	".\pns.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	".\tns.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_DECOD=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\common.h"\
+	".\data.h"\
+	".\decoder.h"\
+	".\dither.h"\
+	".\drc.h"\
+	".\error.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\ic_predict.h"\
+	".\is.h"\
+	".\lt_predict.h"\
+	".\mdct.h"\
+	".\mp4.h"\
+	".\ms.h"\
+	".\output.h"\
+	".\pns.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	".\tns.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_DECOD=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\common.h"\
+	".\data.h"\
+	".\decoder.h"\
+	".\dither.h"\
+	".\drc.h"\
+	".\error.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\ic_predict.h"\
+	".\is.h"\
+	".\lt_predict.h"\
+	".\mdct.h"\
+	".\mp4.h"\
+	".\ms.h"\
+	".\output.h"\
+	".\pns.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	".\tns.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\dither.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_DITHE=\
+	".\common.h"\
+	".\dither.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_DITHE=\
+	".\common.h"\
+	".\dither.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_DITHE=\
+	".\common.h"\
+	".\dither.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_DITHE=\
+	".\common.h"\
+	".\dither.h"\
+	".\fixed.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\drc.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_DRC_C=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\drc.h"\
+	".\fixed.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_DRC_C=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\drc.h"\
+	".\fixed.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_DRC_C=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\drc.h"\
+	".\fixed.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_DRC_C=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\drc.h"\
+	".\fixed.h"\
+	".\syntax.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\error.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_ERROR=\
+	".\common.h"\
+	".\error.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_ERROR=\
+	".\common.h"\
+	".\error.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_ERROR=\
+	".\common.h"\
+	".\error.h"\
+	".\fixed.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_ERROR=\
+	".\common.h"\
+	".\error.h"\
+	".\fixed.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\filtbank.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_FILTB=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\common.h"\
+	".\decoder.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\ic_predict.h"\
+	".\kbd_win.h"\
+	".\mdct.h"\
+	".\sine_win.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_FILTB=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\common.h"\
+	".\decoder.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\ic_predict.h"\
+	".\kbd_win.h"\
+	".\mdct.h"\
+	".\sine_win.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_FILTB=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\common.h"\
+	".\decoder.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\ic_predict.h"\
+	".\kbd_win.h"\
+	".\mdct.h"\
+	".\sine_win.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_FILTB=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\common.h"\
+	".\decoder.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\ic_predict.h"\
+	".\kbd_win.h"\
+	".\mdct.h"\
+	".\sine_win.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\ic_predict.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_IC_PR=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\ic_predict.h"\
+	".\pns.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_IC_PR=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\ic_predict.h"\
+	".\pns.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_IC_PR=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\ic_predict.h"\
+	".\pns.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_IC_PR=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\ic_predict.h"\
+	".\pns.h"\
+	".\syntax.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\is.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_IS_C2c=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\is.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_IS_C2c=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\is.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_IS_C2c=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\is.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_IS_C2c=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\is.h"\
+	".\syntax.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\lt_predict.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_LT_PR=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\common.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\lt_predict.h"\
+	".\mdct.h"\
+	".\syntax.h"\
+	".\tns.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_LT_PR=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\common.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\lt_predict.h"\
+	".\mdct.h"\
+	".\syntax.h"\
+	".\tns.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_LT_PR=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\common.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\lt_predict.h"\
+	".\mdct.h"\
+	".\syntax.h"\
+	".\tns.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_LT_PR=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\common.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\lt_predict.h"\
+	".\mdct.h"\
+	".\syntax.h"\
+	".\tns.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\mdct.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_MDCT_=\
+	".\cfft.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\mdct.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_MDCT_=\
+	".\cfft.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\mdct.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_MDCT_=\
+	".\cfft.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\mdct.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_MDCT_=\
+	".\cfft.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\mdct.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_MP4_C=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\common.h"\
+	".\data.h"\
+	".\decoder.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\ic_predict.h"\
+	".\mdct.h"\
+	".\mp4.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_MP4_C=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\common.h"\
+	".\data.h"\
+	".\decoder.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\ic_predict.h"\
+	".\mdct.h"\
+	".\mp4.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_MP4_C=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\common.h"\
+	".\data.h"\
+	".\decoder.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\ic_predict.h"\
+	".\mdct.h"\
+	".\mp4.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_MP4_C=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\common.h"\
+	".\data.h"\
+	".\decoder.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\ic_predict.h"\
+	".\mdct.h"\
+	".\mp4.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\ms.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_MS_C34=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\is.h"\
+	".\ms.h"\
+	".\pns.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_MS_C34=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\is.h"\
+	".\ms.h"\
+	".\pns.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_MS_C34=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\is.h"\
+	".\ms.h"\
+	".\pns.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_MS_C34=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\is.h"\
+	".\ms.h"\
+	".\pns.h"\
+	".\syntax.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\output.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_OUTPU=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\common.h"\
+	".\decoder.h"\
+	".\dither.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\ic_predict.h"\
+	".\mdct.h"\
+	".\output.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_OUTPU=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\common.h"\
+	".\decoder.h"\
+	".\dither.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\ic_predict.h"\
+	".\mdct.h"\
+	".\output.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_OUTPU=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\common.h"\
+	".\decoder.h"\
+	".\dither.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\ic_predict.h"\
+	".\mdct.h"\
+	".\output.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_OUTPU=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\common.h"\
+	".\decoder.h"\
+	".\dither.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\ic_predict.h"\
+	".\mdct.h"\
+	".\output.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\pns.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_PNS_C=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\pns.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_PNS_C=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\pns.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_PNS_C=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\pns.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_PNS_C=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\pns.h"\
+	".\syntax.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\pulse.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_PULSE=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\pulse.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_PULSE=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\pulse.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_PULSE=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\pulse.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_PULSE=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\pulse.h"\
+	".\syntax.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\reordered_spectral_data.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_REORD=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\data.h"\
+	".\fixed.h"\
+	".\pulse.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_REORD=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\data.h"\
+	".\fixed.h"\
+	".\pulse.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_REORD=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\data.h"\
+	".\fixed.h"\
+	".\pulse.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_REORD=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\data.h"\
+	".\fixed.h"\
+	".\pulse.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\rvlc_scale_factors.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_RVLC_=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\rvlc_scale_factors.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_RVLC_=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\rvlc_scale_factors.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_RVLC_=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\rvlc_scale_factors.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_RVLC_=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\rvlc_scale_factors.h"\
+	".\syntax.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\specrec.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_SPECR=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\data.h"\
+	".\fixed.h"\
+	".\iq_table.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_SPECR=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\data.h"\
+	".\fixed.h"\
+	".\iq_table.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_SPECR=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\data.h"\
+	".\fixed.h"\
+	".\iq_table.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_SPECR=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\data.h"\
+	".\fixed.h"\
+	".\iq_table.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\syntax.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_SYNTA=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\data.h"\
+	".\decoder.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\huffman.h"\
+	".\ic_predict.h"\
+	".\mdct.h"\
+	".\pulse.h"\
+	".\rvlc_scale_factors.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_SYNTA=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\data.h"\
+	".\decoder.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\huffman.h"\
+	".\ic_predict.h"\
+	".\mdct.h"\
+	".\pulse.h"\
+	".\rvlc_scale_factors.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_SYNTA=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\data.h"\
+	".\decoder.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\huffman.h"\
+	".\ic_predict.h"\
+	".\mdct.h"\
+	".\pulse.h"\
+	".\rvlc_scale_factors.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_SYNTA=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\cfft.h"\
+	".\codebook\hcb.h"\
+	".\common.h"\
+	".\data.h"\
+	".\decoder.h"\
+	".\filtbank.h"\
+	".\fixed.h"\
+	".\huffman.h"\
+	".\ic_predict.h"\
+	".\mdct.h"\
+	".\pulse.h"\
+	".\rvlc_scale_factors.h"\
+	".\specrec.h"\
+	".\syntax.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\tns.c
+
+!IF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release"
+
+DEP_CPP_TNS_C=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\syntax.h"\
+	".\tns.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug"
+
+DEP_CPP_TNS_C=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\syntax.h"\
+	".\tns.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release"
+
+DEP_CPP_TNS_C=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\syntax.h"\
+	".\tns.h"\
+	
+
+!ELSEIF  "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug"
+
+DEP_CPP_TNS_C=\
+	".\analysis.h"\
+	".\bits.h"\
+	".\common.h"\
+	".\fixed.h"\
+	".\syntax.h"\
+	".\tns.h"\
+	
+
+!ENDIF 
+
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\analysis.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\bits.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\cfft.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\cfft_tab.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\common.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\data.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\decoder.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\dither.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\drc.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\error.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filtbank.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\fixed.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\huffman.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ic_predict.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\iq_table.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\is.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\kbd_win.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\lt_predict.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mdct.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ms.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\output.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\pns.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\pulse.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\rvlc_scale_factors.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sine_win.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\specrec.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\syntax.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\tns.h
+# End Source File
+# End Group
+# End Target
+# End Project
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/libfaad2.vcw	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,29 @@
+Microsoft eMbedded Visual Tools Workspace File, Format Version 3.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "libfaad2"=".\libfaad2.vcp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/libfaad2_dll.dsp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,355 @@
+# Microsoft Developer Studio Project File - Name="libfaad2_dll" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=libfaad2_dll - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "libfaad2_dll.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "libfaad2_dll.mak" CFG="libfaad2_dll - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "libfaad2_dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libfaad2_dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=xicl6.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "libfaad2_dll - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "libfaad2_dll___Win32_Release"
+# PROP BASE Intermediate_Dir "libfaad2_dll___Win32_Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "ReleaseDLL"
+# PROP Intermediate_Dir "ReleaseDLL"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libfaad2_dll_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "fftw" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libfaad2_dll_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x407 /d "NDEBUG"
+# ADD RSC /l 0x407 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=xilink6.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"ReleaseDLL/libfaad2.dll"
+
+!ELSEIF  "$(CFG)" == "libfaad2_dll - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "libfaad2_dll___Win32_Debug"
+# PROP BASE Intermediate_Dir "libfaad2_dll___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "DebugDLL"
+# PROP Intermediate_Dir "DebugDLL"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libfaad2_dll_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "fftw" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libfaad2_dll_EXPORTS" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x407 /d "_DEBUG"
+# ADD RSC /l 0x407 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=xilink6.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"DebugDLL/libfaad2.dll" /pdbtype:sept
+
+!ENDIF 
+
+# Begin Target
+
+# Name "libfaad2_dll - Win32 Release"
+# Name "libfaad2_dll - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\bits.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\cfft.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\common.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\decoder.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\dither.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\drc.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\error.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filtbank.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\hcr.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\huffman.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ic_predict.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\is.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\lt_predict.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mdct.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ms.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\output.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\pns.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\pulse.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\rvlc.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_dct.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_dec.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_e_nf.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_fbt.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_hfadj.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_hfgen.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_huff.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_qmf.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_syntax.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbr_tf_grid.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\specrec.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ssr.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ssr_fb.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ssr_ipqf.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\syntax.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\tns.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\analysis.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\bits.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\cfft.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\common.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\data.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\decoder.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\dither.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\drc.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\error.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filtbank.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\codebook\hcb.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\huffman.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ic_predict.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\is.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\kbd_win.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\lt_predict.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mdct.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ms.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\output.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\pns.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\pulse.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\rvlc.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\specrec.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ssr.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\syntax.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Tns.h
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\libfaad2.def
+# End Source File
+# End Target
+# End Project
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/libfaad2_dll.dsw	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "libfaad2_dll"=.\libfaad2_dll.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/libfaad2_dll.sln	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,21 @@
+Microsoft Visual Studio Solution File, Format Version 7.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaad2_dll", "libfaad2_dll.vcproj", "{482DA264-EE88-4575-B208-87C4CB80CD08}"
+EndProject
+Global
+	GlobalSection(SolutionConfiguration) = preSolution
+		ConfigName.0 = Debug
+		ConfigName.1 = Release
+	EndGlobalSection
+	GlobalSection(ProjectDependencies) = postSolution
+	EndGlobalSection
+	GlobalSection(ProjectConfiguration) = postSolution
+		{482DA264-EE88-4575-B208-87C4CB80CD08}.Debug.ActiveCfg = Debug|Win32
+		{482DA264-EE88-4575-B208-87C4CB80CD08}.Debug.Build.0 = Debug|Win32
+		{482DA264-EE88-4575-B208-87C4CB80CD08}.Release.ActiveCfg = Release|Win32
+		{482DA264-EE88-4575-B208-87C4CB80CD08}.Release.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+	EndGlobalSection
+	GlobalSection(ExtensibilityAddIns) = postSolution
+	EndGlobalSection
+EndGlobal
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/libfaad2_dll.vcproj	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,307 @@
+<?xml version="1.0" encoding = "Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.00"
+	Name="libfaad2_dll"
+	SccProjectName=""
+	SccLocalPath="">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory=".\DebugDLL"
+			IntermediateDirectory=".\DebugDLL"
+			ConfigurationType="2"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="FALSE"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="fftw"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;libfaad2_dll_EXPORTS"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="2"
+				PrecompiledHeaderFile=".\DebugDLL/libfaad2_dll.pch"
+				AssemblerListingLocation=".\DebugDLL/"
+				ObjectFile=".\DebugDLL/"
+				ProgramDataBaseFileName=".\DebugDLL/"
+				WarningLevel="3"
+				SuppressStartupBanner="TRUE"
+				DebugInformationFormat="4"
+				CompileAs="0"
+				AdditionalOptions="">
+				<IntelOptions
+					Optimization="0"
+					MinimalRebuild="1"
+					BasicRuntimeChecks="3"
+					RuntimeLibrary="3"
+					AllOptions="/c  /I &quot;fftw&quot; /ZI /nologo /W3 /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_WINDOWS&quot; /D &quot;_USRDLL&quot; /D &quot;libfaad2_dll_EXPORTS&quot; /D &quot;_WINDLL&quot; /D &quot;_MBCS&quot; /Gm /EHsc /RTC1 /MDd /YX&quot;StdAfx.h&quot; /Fp&quot;.\DebugDLL/libfaad2_dll.pch&quot; /Fo&quot;.\DebugDLL/&quot; /Fd&quot;.\DebugDLL/&quot; /Gd"
+					MSOriginalAdditionalOptions=""/>
+			</Tool>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions="/MACHINE:I386"
+				AdditionalDependencies="odbc32.lib odbccp32.lib"
+				OutputFile="DebugDLL/libfaad2.dll"
+				LinkIncremental="2"
+				SuppressStartupBanner="TRUE"
+				ModuleDefinitionFile=".\libfaad2.def"
+				GenerateDebugInformation="TRUE"
+				ProgramDatabaseFile=".\DebugDLL/libfaad2.pdb"
+				ImportLibrary=".\DebugDLL/libfaad2.lib">
+				<IntelOptions
+					AllOptions="/NOLOGO /DLL /OUT:&quot;DebugDLL/libfaad2.dll&quot; /INCREMENTAL odbc32.lib odbccp32.lib /DEF:&quot;.\libfaad2.def&quot; /DEBUG /PDB:&quot;.\DebugDLL/libfaad2.pdb&quot; /TLBID:1 /IMPLIB:&quot;.\DebugDLL/libfaad2.lib&quot; /MACHINE:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"
+					MSOriginalAdditionalOptions="/MACHINE:I386"/>
+			</Tool>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="TRUE"
+				SuppressStartupBanner="TRUE"
+				TargetEnvironment="1"
+				TypeLibraryName=".\DebugDLL/libfaad2_dll.tlb"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1031"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory=".\ReleaseDLL"
+			IntermediateDirectory=".\ReleaseDLL"
+			ConfigurationType="2"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="FALSE"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				GlobalOptimizations="TRUE"
+				InlineFunctionExpansion="1"
+				EnableIntrinsicFunctions="TRUE"
+				FavorSizeOrSpeed="1"
+				OptimizeForProcessor="2"
+				AdditionalIncludeDirectories=""
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;libfaad2_dll_EXPORTS"
+				StringPooling="TRUE"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="TRUE"
+				UsePrecompiledHeader="2"
+				PrecompiledHeaderFile=".\ReleaseDLL/libfaad2_dll.pch"
+				AssemblerListingLocation=".\ReleaseDLL/"
+				ObjectFile=".\ReleaseDLL/"
+				ProgramDataBaseFileName=".\ReleaseDLL/"
+				WarningLevel="3"
+				SuppressStartupBanner="TRUE"
+				CompileAs="0"
+				AdditionalOptions="">
+				<IntelOptions
+					Optimization="2"
+					GlobalOptimizations="1"
+					InlineFuncExpansion="1"
+					OmitFramePtrs="1"
+					StringPooling="1"
+					RuntimeLibrary="2"
+					BufferSecurityCheck="1"
+					FunctionLevelLinking="1"
+					AllOptions="/c  /nologo /W3 /O2 /Og /Ob1 /Oy /D &quot;WIN32&quot; /D &quot;NDEBUG&quot; /D &quot;_WINDOWS&quot; /D &quot;_USRDLL&quot; /D &quot;libfaad2_dll_EXPORTS&quot; /D &quot;_WINDLL&quot; /D &quot;_MBCS&quot; /GF /FD /EHsc /MD /GS /Gy /YX&quot;StdAfx.h&quot; /Fp&quot;.\ReleaseDLL/libfaad2_dll.pch&quot; /Fo&quot;.\ReleaseDLL/&quot; /Fd&quot;.\ReleaseDLL/&quot; /Gd"
+					MSOriginalAdditionalOptions=""/>
+			</Tool>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions="/MACHINE:I386"
+				OutputFile="ReleaseDLL/libfaad2.dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="TRUE"
+				ModuleDefinitionFile=".\libfaad2.def"
+				ProgramDatabaseFile=".\ReleaseDLL/libfaad2.pdb"
+				ImportLibrary=".\ReleaseDLL/libfaad2.lib">
+				<IntelOptions
+					AllOptions="/NOLOGO /DLL /OUT:&quot;ReleaseDLL/libfaad2.dll&quot; /INCREMENTAL:NO /DEF:&quot;.\libfaad2.def&quot; /PDB:&quot;.\ReleaseDLL/libfaad2.pdb&quot; /TLBID:1 /IMPLIB:&quot;.\ReleaseDLL/libfaad2.lib&quot; /MACHINE:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"
+					MSOriginalAdditionalOptions="/MACHINE:I386"/>
+			</Tool>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="TRUE"
+				SuppressStartupBanner="TRUE"
+				TargetEnvironment="1"
+				TypeLibraryName=".\ReleaseDLL/libfaad2_dll.tlb"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1031"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+		</Configuration>
+	</Configurations>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="">
+			<File
+				RelativePath=".\bits.c"/>
+			<File
+				RelativePath=".\cfft.c"/>
+			<File
+				RelativePath="common.c"/>
+			<File
+				RelativePath=".\data.c"/>
+			<File
+				RelativePath=".\decoder.c"/>
+			<File
+				RelativePath="dither.c"/>
+			<File
+				RelativePath=".\drc.c"/>
+			<File
+				RelativePath=".\error.c"/>
+			<File
+				RelativePath=".\filtbank.c"/>
+			<File
+				RelativePath="hcr.c"/>
+			<File
+				RelativePath=".\ic_predict.c"/>
+			<File
+				RelativePath=".\is.c"/>
+			<File
+				RelativePath=".\lt_predict.c"/>
+			<File
+				RelativePath=".\mdct.c"/>
+			<File
+				RelativePath=".\mp4.c"/>
+			<File
+				RelativePath=".\ms.c"/>
+			<File
+				RelativePath=".\output.c"/>
+			<File
+				RelativePath=".\pns.c"/>
+			<File
+				RelativePath=".\pulse.c"/>
+			<File
+				RelativePath="rvlc.c"/>
+			<File
+				RelativePath=".\specrec.c"/>
+			<File
+				RelativePath="ssr.c"/>
+			<File
+				RelativePath=".\syntax.c"/>
+			<File
+				RelativePath=".\tns.c"/>
+			<Filter
+				Name="codebook"
+				Filter="">
+				<File
+					RelativePath=".\codebook\hcb_1.c"/>
+				<File
+					RelativePath=".\codebook\hcb_10.c"/>
+				<File
+					RelativePath=".\codebook\hcb_11.c"/>
+				<File
+					RelativePath=".\codebook\hcb_2.c"/>
+				<File
+					RelativePath=".\codebook\hcb_3.c"/>
+				<File
+					RelativePath=".\codebook\hcb_4.c"/>
+				<File
+					RelativePath=".\codebook\hcb_5.c"/>
+				<File
+					RelativePath=".\codebook\hcb_6.c"/>
+				<File
+					RelativePath=".\codebook\hcb_7.c"/>
+				<File
+					RelativePath=".\codebook\hcb_8.c"/>
+				<File
+					RelativePath=".\codebook\hcb_9.c"/>
+				<File
+					RelativePath=".\codebook\hcb_sf.c"/>
+			</Filter>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="">
+			<File
+				RelativePath=".\Tns.h"/>
+			<File
+				RelativePath=".\analysis.h"/>
+			<File
+				RelativePath=".\bits.h"/>
+			<File
+				RelativePath=".\cfft.h"/>
+			<File
+				RelativePath=".\common.h"/>
+			<File
+				RelativePath=".\data.h"/>
+			<File
+				RelativePath=".\decoder.h"/>
+			<File
+				RelativePath="dither.h"/>
+			<File
+				RelativePath=".\drc.h"/>
+			<File
+				RelativePath=".\error.h"/>
+			<File
+				RelativePath=".\filtbank.h"/>
+			<File
+				RelativePath=".\codebook\hcb.h"/>
+			<File
+				RelativePath=".\huffman.h"/>
+			<File
+				RelativePath=".\ic_predict.h"/>
+			<File
+				RelativePath=".\is.h"/>
+			<File
+				RelativePath=".\kbd_win.h"/>
+			<File
+				RelativePath=".\lt_predict.h"/>
+			<File
+				RelativePath=".\mdct.h"/>
+			<File
+				RelativePath=".\mp4.h"/>
+			<File
+				RelativePath=".\ms.h"/>
+			<File
+				RelativePath=".\output.h"/>
+			<File
+				RelativePath=".\pns.h"/>
+			<File
+				RelativePath=".\pulse.h"/>
+			<File
+				RelativePath="rvlc.h"/>
+			<File
+				RelativePath=".\specrec.h"/>
+			<File
+				RelativePath="ssr.h"/>
+			<File
+				RelativePath=".\syntax.h"/>
+		</Filter>
+		<File
+			RelativePath=".\libfaad2.def"/>
+	</Files>
+	<Globals/>
+</VisualStudioProject>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/lt_predict.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,207 @@
+/*
+** 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.18 2003/11/12 20:47:58 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"
+
+/* check if the object type is an object type that can have LTP */
+uint8_t is_ltp_ot(uint8_t object_type)
+{
+#ifdef LTP_DEC
+    if ((object_type == LTP)
+#ifdef ERROR_RESILIENCE
+        || (object_type == ER_LTP)
+#endif
+#ifdef LD_DEC
+        || (object_type == LD)
+#endif
+        )
+    {
+        return 1;
+    }
+#endif
+
+    return 0;
+}
+
+static real_t codebook[8] =
+{
+    REAL_CONST(0.570829),
+    REAL_CONST(0.696616),
+    REAL_CONST(0.813004),
+    REAL_CONST(0.911304),
+    REAL_CONST(0.984900),
+    REAL_CONST(1.067894),
+    REAL_CONST(1.194601),
+    REAL_CONST(1.369533)
+};
+
+void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec,
+                   int16_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[2048];
+    real_t X_est[2048];
+
+    if (ics->window_sequence != EIGHT_SHORT_SEQUENCE)
+    {
+        if (ltp->data_present)
+        {
+            num_samples = frame_len << 1;
+
+            for(i = 0; i < num_samples; i++)
+            {
+                /* The extra lookback M (N/2 for LD, 0 for LTP) is handled
+                   in the buffer updating */
+
+#if 0
+                x_est[i] = MUL_R_C(lt_pred_stat[num_samples + i - ltp->lag],
+                    codebook[ltp->coef]);
+#else
+                /* lt_pred_stat is a 16 bit int, multiplied with the fixed point real
+                   this gives a real for x_est
+                */
+                x_est[i] = (real_t)lt_pred_stat[num_samples + i - ltp->lag] * codebook[ltp->coef];
+#endif
+            }
+
+            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];
+                    }
+                }
+            }
+        }
+    }
+}
+
+#ifdef FIXED_POINT
+INLINE int16_t real_to_int16(real_t sig_in)
+{
+    if (sig_in >= 0)
+    {
+        sig_in += (1 << (REAL_BITS-1));
+        if (sig_in > REAL_CONST(32767))
+            sig_in = 32767.0f;
+    } else {
+        sig_in += -(1 << (REAL_BITS-1));
+        if (sig_in < REAL_CONST(-32768))
+            sig_in = -32768.0f;
+    }
+
+    return (sig_in >> REAL_BITS);
+}
+#else
+INLINE int16_t real_to_int16(real_t sig_in)
+{
+    if (sig_in >= 0)
+    {
+#ifndef HAS_LRINTF
+        sig_in += 0.5f;
+#endif
+        if (sig_in > REAL_CONST(32767))
+            sig_in = 32767.0f;
+    } else {
+#ifndef HAS_LRINTF
+        sig_in -= 0.5f;
+#endif
+        if (sig_in < REAL_CONST(-32768))
+            sig_in = -32768.0f;
+    }
+
+    return lrintf(sig_in);
+}
+#endif
+
+void lt_update_state(int16_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] = real_to_int16(time[i]);
+            lt_pred_stat[(frame_len * 3) + i] = real_to_int16(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]       = real_to_int16(time[i]);
+            lt_pred_stat[(frame_len * 2) + i] = real_to_int16(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/Input/aac/libfaad2/lt_predict.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,66 @@
+/*
+** 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.11 2003/11/12 20:47:58 menno Exp $
+**/
+
+#ifdef LTP_DEC
+
+#ifndef __LT_PREDICT_H__
+#define __LT_PREDICT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "filtbank.h"
+
+uint8_t is_ltp_ot(uint8_t object_type);
+
+void lt_prediction(ic_stream *ics,
+                   ltp_info *ltp,
+                   real_t *spec,
+                   int16_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(int16_t *lt_pred_stat,
+                     real_t *time,
+                     real_t *overlap,
+                     uint16_t frame_len,
+                     uint8_t object_type);
+
+
+static int16_t real_to_int16(real_t sig_in);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/mdct.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,332 @@
+/*
+** 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.34 2003/11/12 20:47:58 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)
+ */
+#ifdef FIXED_POINT
+real_t const_tab[][5] =
+{
+    {    /* 2048 */
+        COEF_CONST(1),
+        FRAC_CONST(0.99999529380957619),
+        FRAC_CONST(0.0030679567629659761),
+        FRAC_CONST(0.99999992646571789),
+        FRAC_CONST(0.00038349518757139556)
+    }, { /* 1920 */
+        COEF_CONST(/* sqrt(1024/960) */ 1.0327955589886444),
+        FRAC_CONST(0.99999464540169647),
+        FRAC_CONST(0.0032724865065266251),
+        FRAC_CONST(0.99999991633432805),
+        FRAC_CONST(0.00040906153202803459)
+    }, { /* 1024 */
+        COEF_CONST(1),
+        FRAC_CONST(0.99998117528260111),
+        FRAC_CONST(0.0061358846491544753),
+        FRAC_CONST(0.99999970586288223),
+        FRAC_CONST(0.00076699031874270449)
+    }, { /* 960 */
+        COEF_CONST(/* sqrt(512/480) */ 1.0327955589886444),
+        FRAC_CONST(0.99997858166412923),
+        FRAC_CONST(0.0065449379673518581),
+        FRAC_CONST(0.99999966533732598),
+        FRAC_CONST(0.00081812299560725323)
+    }, { /* 256 */
+        COEF_CONST(1),
+        FRAC_CONST(0.99969881869620425),
+        FRAC_CONST(0.024541228522912288),
+        FRAC_CONST(0.99999529380957619),
+        FRAC_CONST(0.0030679567629659761)
+    }, {  /* 240 */
+        COEF_CONST(/* sqrt(256/240) */ 1.0327955589886444),
+        FRAC_CONST(0.99965732497555726),
+        FRAC_CONST(0.026176948307873149),
+        FRAC_CONST(0.99999464540169647),
+        FRAC_CONST(0.0032724865065266251)
+    }
+#ifdef SSR_DEC
+    ,{   /* 512 */
+        COEF_CONST(1),
+        FRAC_CONST(0.9999247018391445),
+        FRAC_CONST(0.012271538285719925),
+        FRAC_CONST(0.99999882345170188),
+        FRAC_CONST(0.0015339801862847655)
+    }, { /* 64 */
+        COEF_CONST(1),
+        FRAC_CONST(0.99518472667219693),
+        FRAC_CONST(0.098017140329560604),
+        FRAC_CONST(0.9999247018391445),
+        FRAC_CONST(0.012271538285719925)
+    }
+#endif
+};
+#endif
+
+uint8_t map_N_to_idx(uint16_t N)
+{
+    /* gives an index into const_tab above */
+    /* for normal AAC deocding (eg. no scalable profile) only */
+    /* index 0 and 4 will be used */
+    switch(N)
+    {
+    case 2048: return 0;
+    case 1920: return 1;
+    case 1024: return 2;
+    case 960:  return 3;
+    case 256:  return 4;
+    case 240:  return 5;
+#ifdef SSR_DEC
+    case 512:  return 6;
+    case 64:   return 7;
+#endif
+    }
+    return 0;
+}
+
+mdct_info *faad_mdct_init(uint16_t N)
+{
+    uint16_t k;
+#ifdef FIXED_POINT
+    uint16_t N_idx;
+    real_t cangle, sangle, c, s, cold;
+#endif
+	real_t scale;
+
+    mdct_info *mdct = (mdct_info*)malloc(sizeof(mdct_info));
+
+    assert(N % 8 == 0);
+
+    mdct->N = N;
+    mdct->sincos = (complex_t*)malloc(N/4*sizeof(complex_t));
+
+#ifdef FIXED_POINT
+    N_idx = map_N_to_idx(N);
+
+    scale = const_tab[N_idx][0];
+    cangle = const_tab[N_idx][1];
+    sangle = const_tab[N_idx][2];
+    c = const_tab[N_idx][3];
+    s = const_tab[N_idx][4];
+#else
+    scale = (real_t)sqrt(2.0 / (real_t)N);
+#endif
+
+    /* (co)sine table build using recurrence relations */
+    /* this can also be done using static table lookup or */
+    /* some form of interpolation */
+    for (k = 0; k < N/4; k++)
+    {
+#ifdef FIXED_POINT
+        RE(mdct->sincos[k]) = c; //MUL_C_C(c,scale);
+        IM(mdct->sincos[k]) = s; //MUL_C_C(s,scale);
+
+        cold = c;
+        c = MUL_F(c,cangle) - MUL_F(s,sangle);
+        s = MUL_F(s,cangle) + MUL_F(cold,sangle);
+#else
+        /* no recurrence, just sines */
+        RE(mdct->sincos[k]) = scale*(real_t)(cos(2.0*M_PI*(k+1./8.) / (real_t)N));
+        IM(mdct->sincos[k]) = scale*(real_t)(sin(2.0*M_PI*(k+1./8.) / (real_t)N));
+#endif
+    }
+
+    /* initialise fft */
+    mdct->cfft = cffti(N/4);
+
+    return mdct;
+}
+
+void faad_mdct_end(mdct_info *mdct)
+{
+    if (mdct != NULL)
+    {
+        cfftu(mdct->cfft);
+
+        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[512];
+    complex_t *sincos = mdct->sincos;
+
+    uint16_t N  = mdct->N;
+    uint16_t N2 = N >> 1;
+    uint16_t N4 = N >> 2;
+    uint16_t N8 = N >> 3;
+
+    /* pre-IFFT complex multiplication */
+    for (k = 0; k < N4; k++)
+    {
+        ComplexMult(&IM(Z1[k]), &RE(Z1[k]),
+            X_in[2*k], X_in[N2 - 1 - 2*k], RE(sincos[k]), IM(sincos[k]));
+    }
+
+    /* complex IFFT, any non-scaling FFT can be used here */
+    cfftb(mdct->cfft, Z1);
+
+    /* post-IFFT complex multiplication */
+    for (k = 0; k < N4; k++)
+    {
+        RE(x) = RE(Z1[k]);
+        IM(x) = IM(Z1[k]);
+        ComplexMult(&IM(Z1[k]), &RE(Z1[k]),
+            IM(x), RE(x), RE(sincos[k]), IM(sincos[k]));
+
+#ifdef FIXED_POINT
+#if (REAL_BITS == 16)
+        if (abs(RE(Z1[k])) > REAL_CONST(16383.5))
+        {
+            if (RE(Z1[k]) > 0) RE(Z1[k]) = REAL_CONST(32767.0);
+            else RE(Z1[k]) = REAL_CONST(-32767.0);
+        } else {
+            RE(Z1[k]) *= 2;
+        }
+        if (abs(IM(Z1[k])) > REAL_CONST(16383.5))
+        {
+            if (IM(Z1[k]) > 0) IM(Z1[k]) = REAL_CONST(32767.0);
+            else IM(Z1[k]) = REAL_CONST(-32767.0);
+        } else {
+            IM(Z1[k]) *= 2;
+        }
+#endif
+#endif
+    }
+
+    /* reordering */
+    for (k = 0; k < N8; k++)
+    {
+        X_out[              2*k] =  IM(Z1[N8 +     k]);
+        X_out[          1 + 2*k] = -RE(Z1[N8 - 1 - k]);
+        X_out[N4 +          2*k] =  RE(Z1[         k]);
+        X_out[N4 +      1 + 2*k] = -IM(Z1[N4 - 1 - k]);
+        X_out[N2 +          2*k] =  RE(Z1[N8 +     k]);
+        X_out[N2 +      1 + 2*k] = -IM(Z1[N8 - 1 - k]);
+        X_out[N2 + N4 +     2*k] = -IM(Z1[         k]);
+        X_out[N2 + N4 + 1 + 2*k] =  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[512];
+    complex_t *sincos = mdct->sincos;
+
+    uint16_t N  = mdct->N;
+    uint16_t N2 = N >> 1;
+    uint16_t N4 = N >> 2;
+    uint16_t N8 = N >> 3;
+
+#ifndef FIXED_POINT
+	real_t scale = REAL_CONST(N);
+#else
+	real_t scale = REAL_CONST(4.0/N);
+#endif
+
+    /* 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];
+
+        ComplexMult(&RE(Z1[k]), &IM(Z1[k]),
+            RE(x), IM(x), RE(sincos[k]), IM(sincos[k]));
+
+        RE(Z1[k]) = MUL_R(RE(Z1[k]), scale);
+        IM(Z1[k]) = MUL_R(IM(Z1[k]), scale);
+
+        RE(x) =  X_in[N2 - 1 - n] - X_in[        n];
+        IM(x) =  X_in[N2 +     n] + X_in[N - 1 - n];
+
+        ComplexMult(&RE(Z1[k + N8]), &IM(Z1[k + N8]),
+            RE(x), IM(x), RE(sincos[k + N8]), IM(sincos[k + N8]));
+
+        RE(Z1[k + N8]) = MUL_R(RE(Z1[k + N8]), scale);
+        IM(Z1[k + N8]) = MUL_R(IM(Z1[k + N8]), scale);
+    }
+
+    /* complex FFT, any non-scaling FFT can be used here  */
+    cfftf(mdct->cfft, Z1);
+
+    /* post-FFT complex multiplication */
+    for (k = 0; k < N4; k++)
+    {
+        uint16_t n = k << 1;
+        ComplexMult(&RE(x), &IM(x),
+            RE(Z1[k]), IM(Z1[k]), RE(sincos[k]), IM(sincos[k]));
+
+        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/Input/aac/libfaad2/mdct.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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: mdct.h,v 1.20 2003/11/12 20:47:58 menno Exp $
+**/
+
+#ifndef __MDCT_H__
+#define __MDCT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+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/Input/aac/libfaad2/mp4.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,267 @@
+/*
+** 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.24 2003/11/12 20:47:58 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 = get_sample_rate(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 = get_sample_rate(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 = (int8_t)(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 = get_sample_rate(mp4ASC->samplingFrequencyIndex);
+                    }
+                }
+            }
+        }
+    }
+
+    /* no SBR signalled, this could mean either implicit signalling or no SBR in this file */
+    /* MPEG specification states: assume SBR on files with samplerate <= 24000 Hz */
+    if (mp4ASC->sbr_present_flag == -1)
+    {
+        if (mp4ASC->samplingFrequency <= 24000)
+        {
+            mp4ASC->samplingFrequency *= 2;
+            mp4ASC->forceUpSampling = 1;
+        }
+    }
+#endif
+
+    faad_endbits(&ld);
+
+    return result;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/mp4.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.15 2003/11/12 20:47:58 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/Input/aac/libfaad2/ms.c	Mon Oct 24 10:44:27 2005 -0700
@@ -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.11 2003/11/12 20:47:58 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/Input/aac/libfaad2/ms.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.10 2003/11/12 20:47:58 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/Input/aac/libfaad2/output.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,261 @@
+/*
+** 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.c,v 1.29 2003/11/12 20:47:58 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include "output.h"
+#include "decoder.h"
+
+#ifndef FIXED_POINT
+
+
+#define FLOAT_SCALE (1.0f/(1<<15))
+
+#define DM_MUL ((real_t)1.0/((real_t)1.0+(real_t)sqrt(2.0)))
+
+
+static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample,
+                                uint8_t downMatrix, uint8_t *internal_channel)
+{
+    if (!downMatrix)
+        return input[internal_channel[channel]][sample];
+
+    if (channel == 0)
+    {
+        return DM_MUL * (input[internal_channel[1]][sample] +
+            input[internal_channel[0]][sample]/(real_t)sqrt(2.) +
+            input[internal_channel[3]][sample]/(real_t)sqrt(2.));
+    } else {
+        return DM_MUL * (input[internal_channel[2]][sample] +
+            input[internal_channel[0]][sample]/(real_t)sqrt(2.) +
+            input[internal_channel[4]][sample]/(real_t)sqrt(2.));
+    }
+}
+
+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++)
+            {
+                real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
+                if (inp >= 0.0f)
+                {
+#ifndef HAS_LRINTF
+                    inp += 0.5f;
+#endif
+                    if (inp >= 32768.0f)
+                    {
+                        inp = 32767.0f;
+                    }
+                } else {
+#ifndef HAS_LRINTF
+                    inp += -0.5f;
+#endif
+                    if (inp <= -32769.0f)
+                    {
+                        inp = -32768.0f;
+                    }
+                }
+                short_sample_buffer[(i*channels)+ch] = (int16_t)lrintf(inp);
+            }
+            break;
+        case FAAD_FMT_24BIT:
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
+                inp *= 256.0f;
+                if (inp >= 0.0f)
+                {
+#ifndef HAS_LRINTF
+                    inp += 0.5f;
+#endif
+                    if (inp >= 8388608.0f)
+                    {
+                        inp = 8388607.0f;
+                    }
+                } else {
+#ifndef HAS_LRINTF
+                    inp += -0.5f;
+#endif
+                    if (inp <= -8388609.0f)
+                    {
+                        inp = -8388608.0f;
+                    }
+                }
+                int_sample_buffer[(i*channels)+ch] = lrintf(inp);
+            }
+            break;
+        case FAAD_FMT_32BIT:
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
+                inp *= 65536.0f;
+                if (inp >= 0.0f)
+                {
+#ifndef HAS_LRINTF
+                    inp += 0.5f;
+#endif
+                    if (inp >= 2147483648.0f)
+                    {
+                        inp = 2147483647.0f;
+                    }
+                } else {
+#ifndef HAS_LRINTF
+                    inp += -0.5f;
+#endif
+                    if (inp <= -2147483649.0f)
+                    {
+                        inp = -2147483648.0f;
+                    }
+                }
+                int_sample_buffer[(i*channels)+ch] = lrintf(inp);
+            }
+            break;
+        case FAAD_FMT_FLOAT:
+            for(i = 0; i < frame_len; i++)
+            {
+                //real_t inp = input[internal_channel][i];
+                real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
+                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];
+                real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
+                double_sample_buffer[(i*channels)+ch] = (double)inp*FLOAT_SCALE;
+            }
+            break;
+        }
+    }
+
+    return sample_buffer;
+}
+
+#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;
+    int32_t *int_sample_buffer = (int32_t*)sample_buffer;
+
+    /* Copy output to a standard PCM buffer */
+    for (ch = 0; ch < channels; ch++)
+    {
+        switch (format)
+        {
+        case FAAD_FMT_16BIT:
+            for(i = 0; i < frame_len; i++)
+            {
+                int32_t tmp = input[ch][i];
+                if (tmp >= 0)
+                {
+                    tmp += (1 << (REAL_BITS-1));
+                    if (tmp >= REAL_CONST(32768))
+                    {
+                        tmp = REAL_CONST(32767);
+                    }
+                } else {
+                    tmp += -(1 << (REAL_BITS-1));
+                    if (tmp <= REAL_CONST(-32769))
+                    {
+                        tmp = REAL_CONST(-32768);
+                    }
+                }
+                tmp >>= REAL_BITS;
+                short_sample_buffer[(i*channels)+ch] = (int16_t)tmp;
+            }
+            break;
+        case FAAD_FMT_24BIT:
+            for(i = 0; i < frame_len; i++)
+            {
+                int32_t tmp = input[ch][i];
+                if (tmp >= 0)
+                {
+                    tmp += (1 << (REAL_BITS-9));
+                    tmp >>= (REAL_BITS-8);
+                    if (tmp >= 8388608)
+                    {
+                        tmp = 8388607;
+                    }
+                } else {
+                    tmp += -(1 << (REAL_BITS-9));
+                    tmp >>= (REAL_BITS-8);
+                    if (tmp <= -8388609)
+                    {
+                        tmp = -8388608;
+                    }
+                }
+                int_sample_buffer[(i*channels)+ch] = (int32_t)tmp;
+            }
+            break;
+        case FAAD_FMT_32BIT:
+            for(i = 0; i < frame_len; i++)
+            {
+                int32_t tmp = input[ch][i];
+                if (tmp >= 0)
+                {
+                    tmp += (1 << (16-REAL_BITS-1));
+                    tmp <<= (16-REAL_BITS);
+                } else {
+                    tmp += -(1 << (16-REAL_BITS-1));
+                    tmp <<= (16-REAL_BITS);
+                }
+                int_sample_buffer[(i*channels)+ch] = (int32_t)tmp;
+            }
+            break;
+        }
+    }
+
+    return sample_buffer;
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/output.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.14 2003/11/12 20:47:58 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/Input/aac/libfaad2/pns.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,255 @@
+/*
+** 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.27 2003/11/12 20:47:58 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include "pns.h"
+
+
+#ifdef FIXED_POINT
+
+#define DIV(A, B) (((int64_t)A << REAL_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 */
+/* !!!! ONLY WORKS FOR EVEN %REAL_BITS% !!!! */
+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 <<= (REAL_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,
+                                   uint8_t sub)
+{
+#ifndef FIXED_POINT
+    uint16_t i;
+    real_t energy = 0.0;
+
+    real_t scale = (real_t)1.0/(real_t)size;
+
+    for (i = 0; i < size; i++)
+    {
+        real_t tmp = scale*(real_t)(int32_t)random_int();
+        spec[i] = tmp;
+        energy += tmp*tmp;
+    }
+
+    scale = (real_t)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++)
+    {
+        /* this can be replaced by a 16 bit random generator!!!! */
+        real_t tmp = (int32_t)random_int();
+        if (tmp < 0)
+            tmp = -(tmp & ((1<<(REAL_BITS-1))-1));
+        else
+            tmp = (tmp & ((1<<(REAL_BITS-1))-1));
+
+        energy += MUL_R(tmp,tmp);
+
+        spec[i] = tmp;
+    }
+
+    energy = fp_sqrt(energy);
+    if (energy > 0)
+    {
+        scale = DIV(REAL_CONST(1),energy);
+
+        exp = scale_factor / 4;
+        frac = scale_factor % 4;
+
+        /* IMDCT pre-scaling */
+        exp -= sub;
+
+        if (exp < 0)
+            scale >>= -exp;
+        else
+            scale <<= exp;
+
+        if (frac)
+            scale = MUL_C(scale, pow2_table[frac + 3]);
+
+        for (i = 0; i < size; i++)
+        {
+            spec[i] = MUL_R(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 object_type)
+{
+    uint8_t g, sfb, b;
+    uint16_t size, offs;
+
+    uint8_t group = 0;
+    uint16_t nshort = frame_len >> 3;
+
+    uint8_t sub = 0;
+
+#ifdef FIXED_POINT
+    /* IMDCT scaling */
+    if (object_type == LD)
+    {
+        sub = 9 /*9*/;
+    } else {
+        if (ics_left->window_sequence == EIGHT_SHORT_SEQUENCE)
+            sub = 7 /*7*/;
+        else
+            sub = 10 /*10*/;
+    }
+#endif
+
+    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, sub);
+                }
+
+/* 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, sub);
+                        }
+                    }
+                }
+            } /* sfb */
+            group++;
+        } /* b */
+    } /* g */
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/pns.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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: pns.h,v 1.17 2003/11/12 20:47:58 menno Exp $
+**/
+
+#ifndef __PNS_H__
+#define __PNS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "common.h"
+
+#include "syntax.h"
+
+#define NOISE_OFFSET 90
+
+void pns_decode(ic_stream *ics_left, ic_stream *ics_right,
+                real_t *spec_left, real_t *spec_right, uint16_t frame_len,
+                uint8_t channel_pair, uint8_t object_type);
+
+static INLINE int32_t random2();
+static void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size,
+                            uint8_t sub);
+
+static INLINE uint8_t is_noise(ic_stream *ics, uint8_t group, uint8_t sfb)
+{
+    if (ics->sfb_cb[group][sfb] == NOISE_HCB)
+        return 1;
+    return 0;
+}
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/pulse.c	Mon Oct 24 10:44:27 2005 -0700
@@ -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.12 2003/11/12 20:47:58 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/Input/aac/libfaad2/pulse.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.11 2003/11/12 20:47:58 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/Input/aac/libfaad2/rvlc.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,511 @@
+/*
+** 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.11 2003/11/12 20:47:58 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] = (uint8_t)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] = (uint8_t)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;
+                    }
+
+                    if (scale_factor < 0)
+                        return 4;
+
+                    ics->scale_factors[g][sfb] = (uint8_t)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;
+}
+
+/* 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/Input/aac/libfaad2/rvlc.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.8 2003/11/12 20:47:58 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/Input/aac/libfaad2/sbr_dct.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,2662 @@
+/*
+** 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.8 2003/11/12 20:47:58 menno Exp $
+**/
+
+#include "common.h"
+
+#ifdef SBR_DEC
+
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+
+
+#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(COEF_CONST(0.7071067811865476), x[16]);
+    f1 = x[0] - f0;
+    f2 = x[0] + f0;
+    f3 = x[8] + x[24];
+    f4 = MUL_C(COEF_CONST(1.3065629648763766), x[8]);
+    f5 = MUL_C(COEF_CONST((-0.9238795325112866)), f3);
+    f6 = MUL_C(COEF_CONST((-0.5411961001461967)), x[24]);
+    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(COEF_CONST(1.1758756024193588), x[4]);
+    f15 = MUL_C(COEF_CONST((-0.9807852804032304)), f13);
+    f16 = MUL_C(COEF_CONST((-0.7856949583871021)), x[28]);
+    f17 = f14 + f15;
+    f18 = f16 - f15;
+    f19 = x[12] + x[20];
+    f20 = MUL_C(COEF_CONST(1.3870398453221473), x[12]);
+    f21 = MUL_C(COEF_CONST((-0.8314696123025455)), f19);
+    f22 = MUL_C(COEF_CONST((-0.2758993792829436)), x[20]);
+    f23 = f20 + f21;
+    f24 = f22 - f21;
+    f25 = f18 - f24;
+    f26 = f18 + f24;
+    f27 = MUL_C(COEF_CONST(0.7071067811865476), f25);
+    f28 = f17 - f23;
+    f29 = f17 + f23;
+    f30 = MUL_C(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(COEF_CONST(1.0932018670017569), x[2]);
+    f43 = MUL_C(COEF_CONST((-0.9951847266721969)), f41);
+    f44 = MUL_C(COEF_CONST((-0.8971675863426368)), x[30]);
+    f45 = f42 + f43;
+    f46 = f44 - f43;
+    f47 = x[6] + x[26];
+    f48 = MUL_C(COEF_CONST(1.2472250129866711), x[6]);
+    f49 = MUL_C(COEF_CONST((-0.9569403357322089)), f47);
+    f50 = MUL_C(COEF_CONST((-0.6666556584777469)), x[26]);
+    f51 = f48 + f49;
+    f52 = f50 - f49;
+    f53 = x[10] + x[22];
+    f54 = MUL_C(COEF_CONST(1.3533180011743526), x[10]);
+    f55 = MUL_C(COEF_CONST((-0.8819212643483551)), f53);
+    f56 = MUL_C(COEF_CONST((-0.4105245275223575)), x[22]);
+    f57 = f54 + f55;
+    f58 = f56 - f55;
+    f59 = x[14] + x[18];
+    f60 = MUL_C(COEF_CONST(1.4074037375263826), x[14]);
+    f61 = MUL_C(COEF_CONST((-0.7730104533627369)), f59);
+    f62 = MUL_C(COEF_CONST((-0.1386171691990913)), x[18]);
+    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(COEF_CONST(0.7071067811865476), f69);
+    f72 = f65 + f67;
+    f73 = MUL_C(COEF_CONST(1.3065629648763766), f65);
+    f74 = MUL_C(COEF_CONST((-0.9238795325112866)), f72);
+    f75 = MUL_C(COEF_CONST((-0.5411961001461967)), f67);
+    f76 = f73 + f74;
+    f77 = f75 - f74;
+    f78 = f45 - f63;
+    f79 = f45 + f63;
+    f80 = f51 - f57;
+    f81 = f51 + f57;
+    f82 = f79 + f81;
+    f83 = MUL_C(COEF_CONST(1.3065629648763770), f79);
+    f84 = MUL_C(COEF_CONST((-0.3826834323650904)), f82);
+    f85 = MUL_C(COEF_CONST(0.5411961001461961), f81);
+    f86 = f83 + f84;
+    f87 = f85 - f84;
+    f88 = f78 - f80;
+    f89 = f78 + f80;
+    f90 = MUL_C(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(COEF_CONST(1.0478631305325901), x[1]);
+    f115 = MUL_C(COEF_CONST((-0.9987954562051724)), f113);
+    f116 = MUL_C(COEF_CONST((-0.9497277818777548)), x[31]);
+    f117 = f114 + f115;
+    f118 = f116 - f115;
+    f119 = x[5] + x[27];
+    f120 = MUL_C(COEF_CONST(1.2130114330978077), x[5]);
+    f121 = MUL_C(COEF_CONST((-0.9700312531945440)), f119);
+    f122 = MUL_C(COEF_CONST((-0.7270510732912803)), x[27]);
+    f123 = f120 + f121;
+    f124 = f122 - f121;
+    f125 = x[9] + x[23];
+    f126 = MUL_C(COEF_CONST(1.3315443865537255), x[9]);
+    f127 = MUL_C(COEF_CONST((-0.9039892931234433)), f125);
+    f128 = MUL_C(COEF_CONST((-0.4764341996931612)), x[23]);
+    f129 = f126 + f127;
+    f130 = f128 - f127;
+    f131 = x[13] + x[19];
+    f132 = MUL_C(COEF_CONST(1.3989068359730781), x[13]);
+    f133 = MUL_C(COEF_CONST((-0.8032075314806453)), f131);
+    f134 = MUL_C(COEF_CONST((-0.2075082269882124)), x[19]);
+    f135 = f132 + f133;
+    f136 = f134 - f133;
+    f137 = x[17] + x[15];
+    f138 = MUL_C(COEF_CONST(1.4125100802019777), x[17]);
+    f139 = MUL_C(COEF_CONST((-0.6715589548470187)), f137);
+    f140 = MUL_C(COEF_CONST(0.0693921705079402), x[15]);
+    f141 = f138 + f139;
+    f142 = f140 - f139;
+    f143 = x[21] + x[11];
+    f144 = MUL_C(COEF_CONST(1.3718313541934939), x[21]);
+    f145 = MUL_C(COEF_CONST((-0.5141027441932219)), f143);
+    f146 = MUL_C(COEF_CONST(0.3436258658070501), x[11]);
+    f147 = f144 + f145;
+    f148 = f146 - f145;
+    f149 = x[25] + x[7];
+    f150 = MUL_C(COEF_CONST(1.2784339185752409), x[25]);
+    f151 = MUL_C(COEF_CONST((-0.3368898533922200)), f149);
+    f152 = MUL_C(COEF_CONST(0.6046542117908008), x[7]);
+    f153 = f150 + f151;
+    f154 = f152 - f151;
+    f155 = x[29] + x[3];
+    f156 = MUL_C(COEF_CONST(1.1359069844201433), x[29]);
+    f157 = MUL_C(COEF_CONST((-0.1467304744553624)), f155);
+    f158 = MUL_C(COEF_CONST(0.8424460355094185), x[3]);
+    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(COEF_CONST(1.1758756024193588), f161);
+    f179 = MUL_C(COEF_CONST((-0.9807852804032304)), f177);
+    f180 = MUL_C(COEF_CONST((-0.7856949583871021)), f163);
+    f181 = f178 + f179;
+    f182 = f180 - f179;
+    f183 = f165 + f167;
+    f184 = MUL_C(COEF_CONST(1.3870398453221475), f165);
+    f185 = MUL_C(COEF_CONST((-0.5555702330196022)), f183);
+    f186 = MUL_C(COEF_CONST(0.2758993792829431), f167);
+    f187 = f184 + f185;
+    f188 = f186 - f185;
+    f189 = f169 + f171;
+    f190 = MUL_C(COEF_CONST(0.7856949583871022), f169);
+    f191 = MUL_C(COEF_CONST(0.1950903220161283), f189);
+    f192 = MUL_C(COEF_CONST(1.1758756024193586), f171);
+    f193 = f190 + f191;
+    f194 = f192 - f191;
+    f195 = f173 + f175;
+    f196 = MUL_C(COEF_CONST((-0.2758993792829430)), f173);
+    f197 = MUL_C(COEF_CONST(0.8314696123025452), f195);
+    f198 = MUL_C(COEF_CONST(1.3870398453221475), f175);
+    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(COEF_CONST(1.3065629648763766), f201);
+    f219 = MUL_C(COEF_CONST((-0.9238795325112866)), f217);
+    f220 = MUL_C(COEF_CONST((-0.5411961001461967)), f203);
+    f221 = f218 + f219;
+    f222 = f220 - f219;
+    f223 = f205 + f207;
+    f224 = MUL_C(COEF_CONST(0.5411961001461969), f205);
+    f225 = MUL_C(COEF_CONST(0.3826834323650898), f223);
+    f226 = MUL_C(COEF_CONST(1.3065629648763766), f207);
+    f227 = f224 + f225;
+    f228 = f226 - f225;
+    f229 = f209 + f211;
+    f230 = MUL_C(COEF_CONST(1.3065629648763766), f209);
+    f231 = MUL_C(COEF_CONST((-0.9238795325112866)), f229);
+    f232 = MUL_C(COEF_CONST((-0.5411961001461967)), f211);
+    f233 = f230 + f231;
+    f234 = f232 - f231;
+    f235 = f213 + f215;
+    f236 = MUL_C(COEF_CONST(0.5411961001461969), f213);
+    f237 = MUL_C(COEF_CONST(0.3826834323650898), f235);
+    f238 = MUL_C(COEF_CONST(1.3065629648763766), f215);
+    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(COEF_CONST(0.7071067811865474), f257);
+    f260 = MUL_C(COEF_CONST(0.7071067811865474), f258);
+    f261 = f245 - f247;
+    f262 = f245 + f247;
+    f263 = MUL_C(COEF_CONST(0.7071067811865474), f261);
+    f264 = MUL_C(COEF_CONST(0.7071067811865474), f262);
+    f265 = f249 - f251;
+    f266 = f249 + f251;
+    f267 = MUL_C(COEF_CONST(0.7071067811865474), f265);
+    f268 = MUL_C(COEF_CONST(0.7071067811865474), f266);
+    f269 = f253 - f255;
+    f270 = f253 + f255;
+    f271 = MUL_C(COEF_CONST(0.7071067811865474), f269);
+    f272 = MUL_C(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(COEF_CONST(0.7071067811865476), f62);
+    f65 = f58 + f60;
+    f66 = MUL_C(COEF_CONST(1.3065629648763766), f58);
+    f67 = MUL_C(COEF_CONST((-0.9238795325112866)), f65);
+    f68 = MUL_C(COEF_CONST((-0.5411961001461967)), f60);
+    y[48] = f66 + f67;
+    y[16] = f68 - f67;
+    f71 = f52 - f54;
+    f72 = f52 + f54;
+    f73 = MUL_C(COEF_CONST(0.7071067811865476), f72);
+    f74 = MUL_C(COEF_CONST(0.7071067811865476), f71);
+    f75 = f50 - f73;
+    f76 = f50 + f73;
+    f77 = f56 - f74;
+    f78 = f56 + f74;
+    f79 = f78 + f76;
+    f80 = MUL_C(COEF_CONST((-0.7856949583871021)), f78);
+    f81 = MUL_C(COEF_CONST(0.9807852804032304), f79);
+    f82 = MUL_C(COEF_CONST(1.1758756024193588), f76);
+    y[8] = f80 + f81;
+    y[56] = f82 - f81;
+    f85 = f77 + f75;
+    f86 = MUL_C(COEF_CONST(0.2758993792829431), f77);
+    f87 = MUL_C(COEF_CONST(0.5555702330196022), f85);
+    f88 = MUL_C(COEF_CONST(1.3870398453221475), f75);
+    y[40] = f86 + f87;
+    y[24] = f88 - f87;
+    f91 = f40 - f42;
+    f92 = f40 + f42;
+    f93 = MUL_C(COEF_CONST(0.7071067811865476), f92);
+    f94 = MUL_C(COEF_CONST(0.7071067811865476), f91);
+    f95 = f38 - f44;
+    f96 = f38 + f44;
+    f97 = MUL_C(COEF_CONST(0.7071067811865476), f96);
+    f98 = MUL_C(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(COEF_CONST((-0.5411961001461969)), f106);
+    f109 = MUL_C(COEF_CONST(0.9238795325112867), f107);
+    f110 = MUL_C(COEF_CONST(1.3065629648763766), f104);
+    f111 = f108 + f109;
+    f112 = f110 - f109;
+    f113 = f105 + f103;
+    f114 = MUL_C(COEF_CONST(1.3065629648763770), f105);
+    f115 = MUL_C(COEF_CONST((-0.3826834323650904)), f113);
+    f116 = MUL_C(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(COEF_CONST((-0.8971675863426361)), f122);
+    f129 = MUL_C(COEF_CONST(0.9951847266721968), f127);
+    f130 = MUL_C(COEF_CONST(1.0932018670017576), f120);
+    y[4] = f128 + f129;
+    y[60] = f130 - f129;
+    f133 = f126 + f124;
+    f134 = MUL_C(COEF_CONST((-0.4105245275223571)), f126);
+    f135 = MUL_C(COEF_CONST(0.8819212643483549), f133);
+    f136 = MUL_C(COEF_CONST(1.3533180011743529), f124);
+    y[20] = f134 + f135;
+    y[44] = f136 - f135;
+    f139 = f121 + f119;
+    f140 = MUL_C(COEF_CONST(0.1386171691990915), f121);
+    f141 = MUL_C(COEF_CONST(0.6343932841636455), f139);
+    f142 = MUL_C(COEF_CONST(1.4074037375263826), f119);
+    y[36] = f140 + f141;
+    y[28] = f142 - f141;
+    f145 = f125 + f123;
+    f146 = MUL_C(COEF_CONST(0.6666556584777466), f125);
+    f147 = MUL_C(COEF_CONST(0.2902846772544623), f145);
+    f148 = MUL_C(COEF_CONST(1.2472250129866711), f123);
+    y[52] = f146 + f147;
+    y[12] = f148 - f147;
+    f151 = f2 + f32;
+    f152 = MUL_C(COEF_CONST(1.0478631305325901), f2);
+    f153 = MUL_C(COEF_CONST((-0.9987954562051724)), f151);
+    f154 = MUL_C(COEF_CONST((-0.9497277818777548)), f32);
+    f155 = f152 + f153;
+    f156 = f154 - f153;
+    f157 = f4 + f30;
+    f158 = MUL_C(COEF_CONST(1.1359069844201428), f4);
+    f159 = MUL_C(COEF_CONST((-0.9891765099647809)), f157);
+    f160 = MUL_C(COEF_CONST((-0.8424460355094190)), f30);
+    f161 = f158 + f159;
+    f162 = f160 - f159;
+    f163 = f6 + f28;
+    f164 = MUL_C(COEF_CONST(1.2130114330978077), f6);
+    f165 = MUL_C(COEF_CONST((-0.9700312531945440)), f163);
+    f166 = MUL_C(COEF_CONST((-0.7270510732912803)), f28);
+    f167 = f164 + f165;
+    f168 = f166 - f165;
+    f169 = f8 + f26;
+    f170 = MUL_C(COEF_CONST(1.2784339185752405), f8);
+    f171 = MUL_C(COEF_CONST((-0.9415440651830209)), f169);
+    f172 = MUL_C(COEF_CONST((-0.6046542117908014)), f26);
+    f173 = f170 + f171;
+    f174 = f172 - f171;
+    f175 = f10 + f24;
+    f176 = MUL_C(COEF_CONST(1.3315443865537255), f10);
+    f177 = MUL_C(COEF_CONST((-0.9039892931234433)), f175);
+    f178 = MUL_C(COEF_CONST((-0.4764341996931612)), f24);
+    f179 = f176 + f177;
+    f180 = f178 - f177;
+    f181 = f12 + f22;
+    f182 = MUL_C(COEF_CONST(1.3718313541934939), f12);
+    f183 = MUL_C(COEF_CONST((-0.8577286100002722)), f181);
+    f184 = MUL_C(COEF_CONST((-0.3436258658070507)), f22);
+    f185 = f182 + f183;
+    f186 = f184 - f183;
+    f187 = f14 + f20;
+    f188 = MUL_C(COEF_CONST(1.3989068359730781), f14);
+    f189 = MUL_C(COEF_CONST((-0.8032075314806453)), f187);
+    f190 = MUL_C(COEF_CONST((-0.2075082269882124)), f20);
+    f191 = f188 + f189;
+    f192 = f190 - f189;
+    f193 = f16 + f18;
+    f194 = MUL_C(COEF_CONST(1.4125100802019774), f16);
+    f195 = MUL_C(COEF_CONST((-0.7409511253549591)), f193);
+    f196 = MUL_C(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(COEF_CONST(0.7071067811865476), f211);
+    f214 = f207 + f209;
+    f215 = MUL_C(COEF_CONST(1.3065629648763766), f207);
+    f216 = MUL_C(COEF_CONST((-0.9238795325112866)), f214);
+    f217 = MUL_C(COEF_CONST((-0.5411961001461967)), f209);
+    f218 = f215 + f216;
+    f219 = f217 - f216;
+    f220 = f201 - f203;
+    f221 = f201 + f203;
+    f222 = MUL_C(COEF_CONST(0.7071067811865476), f221);
+    f223 = MUL_C(COEF_CONST(0.7071067811865476), f220);
+    f224 = f199 - f222;
+    f225 = f199 + f222;
+    f226 = f205 - f223;
+    f227 = f205 + f223;
+    f228 = f227 + f225;
+    f229 = MUL_C(COEF_CONST((-0.7856949583871021)), f227);
+    f230 = MUL_C(COEF_CONST(0.9807852804032304), f228);
+    f231 = MUL_C(COEF_CONST(1.1758756024193588), f225);
+    f232 = f229 + f230;
+    f233 = f231 - f230;
+    f234 = f226 + f224;
+    f235 = MUL_C(COEF_CONST(0.2758993792829431), f226);
+    f236 = MUL_C(COEF_CONST(0.5555702330196022), f234);
+    f237 = MUL_C(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(COEF_CONST(0.7071067811865476), f249);
+    f251 = f247 - f250;
+    f252 = f247 + f250;
+    f253 = MUL_C(COEF_CONST(0.7071067811865476), f248);
+    f254 = f253 - f241;
+    f255 = f253 + f241;
+    f256 = f255 + f252;
+    f257 = MUL_C(COEF_CONST((-0.7856949583871021)), f255);
+    f258 = MUL_C(COEF_CONST(0.9807852804032304), f256);
+    f259 = MUL_C(COEF_CONST(1.1758756024193588), f252);
+    f260 = f257 + f258;
+    f261 = f259 - f258;
+    f262 = f254 + f251;
+    f263 = MUL_C(COEF_CONST((-0.2758993792829430)), f254);
+    f264 = MUL_C(COEF_CONST(0.8314696123025452), f262);
+    f265 = MUL_C(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(COEF_CONST(1.3065629648763770), f269);
+    f274 = MUL_C(COEF_CONST((-0.3826834323650904)), f272);
+    f275 = MUL_C(COEF_CONST(0.5411961001461961), f271);
+    f276 = f273 + f274;
+    f277 = f275 - f274;
+    y[62] = f268 - f270;
+    f279 = f268 + f270;
+    f280 = MUL_C(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(COEF_CONST(0.7071067811865476), f310);
+    f326 = t2[1] - f325;
+    f327 = t2[1] + f325;
+    f328 = f302 + f318;
+    f329 = MUL_C(COEF_CONST(1.3065629648763766), f302);
+    f330 = MUL_C(COEF_CONST((-0.9238795325112866)), f328);
+    f331 = MUL_C(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(COEF_CONST(0.7071067811865476), f339);
+    f341 = f298 - f340;
+    f342 = f298 + f340;
+    f343 = MUL_C(COEF_CONST(0.7071067811865476), f338);
+    f344 = f343 - f322;
+    f345 = f343 + f322;
+    f346 = f345 + f342;
+    f347 = MUL_C(COEF_CONST((-0.7856949583871021)), f345);
+    f348 = MUL_C(COEF_CONST(0.9807852804032304), f346);
+    f349 = MUL_C(COEF_CONST(1.1758756024193588), f342);
+    f350 = f347 + f348;
+    f351 = f349 - f348;
+    f352 = f344 + f341;
+    f353 = MUL_C(COEF_CONST((-0.2758993792829430)), f344);
+    f354 = MUL_C(COEF_CONST(0.8314696123025452), f352);
+    f355 = MUL_C(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(COEF_CONST(5.1011486186891641), f296);
+    f367 = MUL_C(COEF_CONST(1.7224470982383342), f300);
+    f368 = MUL_C(COEF_CONST(1.0606776859903475), f304);
+    f369 = MUL_C(COEF_CONST(0.7881546234512502), f308);
+    f370 = MUL_C(COEF_CONST(0.5024192861881557), f324);
+    f371 = MUL_C(COEF_CONST(0.5224986149396889), f320);
+    f372 = MUL_C(COEF_CONST(0.5669440348163577), f316);
+    f373 = MUL_C(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(COEF_CONST(0.5097955791041592), f375);
+    f383 = MUL_C(COEF_CONST(0.6013448869350453), f377);
+    f384 = MUL_C(COEF_CONST(0.8999762231364156), f379);
+    f385 = MUL_C(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(COEF_CONST(0.7071067811865476), f390);
+    f393 = f386 - f388;
+    f394 = MUL_C(COEF_CONST(1.3065629648763766), f386);
+    f395 = MUL_C(COEF_CONST((-0.9238795325112866)), f393);
+    f396 = MUL_C(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(COEF_CONST(1.3065629648763770), f403);
+    f408 = MUL_C(COEF_CONST((-0.3826834323650904)), f406);
+    f409 = MUL_C(COEF_CONST(0.5411961001461961), f405);
+    f410 = f407 + f408;
+    f411 = f408 - f409;
+    f412 = f402 - f404;
+    f413 = f402 + f404;
+    f414 = MUL_C(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(COEF_CONST(5.1011486186891641), f295);
+    f439 = MUL_C(COEF_CONST(1.7224470982383342), f299);
+    f440 = MUL_C(COEF_CONST(1.0606776859903475), f303);
+    f441 = MUL_C(COEF_CONST(0.7881546234512502), f307);
+    f442 = MUL_C(COEF_CONST(0.5024192861881557), f323);
+    f443 = MUL_C(COEF_CONST(0.5224986149396889), f319);
+    f444 = MUL_C(COEF_CONST(0.5669440348163577), f315);
+    f445 = MUL_C(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(COEF_CONST(0.5097955791041592), f447);
+    f455 = MUL_C(COEF_CONST(0.6013448869350453), f449);
+    f456 = MUL_C(COEF_CONST(0.8999762231364156), f451);
+    f457 = MUL_C(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(COEF_CONST(0.7071067811865476), f462);
+    f465 = f458 - f460;
+    f466 = MUL_C(COEF_CONST(1.3065629648763766), f458);
+    f467 = MUL_C(COEF_CONST((-0.9238795325112866)), f465);
+    f468 = MUL_C(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(COEF_CONST(1.3065629648763770), f475);
+    f480 = MUL_C(COEF_CONST((-0.3826834323650904)), f478);
+    f481 = MUL_C(COEF_CONST(0.5411961001461961), f477);
+    f482 = f479 + f480;
+    f483 = f481 - f480;
+    f484 = f474 + f476;
+    f485 = f476 - f474;
+    f486 = MUL_C(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(COEF_CONST(0.7071067811865476), f309);
+    f495 = t2[63] - f494;
+    f496 = t2[63] + f494;
+    f497 = f317 + f301;
+    f498 = MUL_C(COEF_CONST(1.3065629648763766), f317);
+    f499 = MUL_C(COEF_CONST((-0.9238795325112866)), f497);
+    f500 = MUL_C(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(COEF_CONST(0.5097955791041592), f321);
+    f508 = MUL_C(COEF_CONST(0.6013448869350453), f313);
+    f509 = MUL_C(COEF_CONST(0.8999762231364156), f305);
+    f510 = MUL_C(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(COEF_CONST(0.7071067811865476), f515);
+    f518 = f511 + f513;
+    f519 = MUL_C(COEF_CONST(1.3065629648763766), f511);
+    f520 = MUL_C(COEF_CONST((-0.9238795325112866)), f518);
+    f521 = MUL_C(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(COEF_CONST((-0.9751575901732920)), f536);
+    f553 = MUL_C(COEF_CONST(0.9996988186962043), f551);
+    f554 = MUL_C(COEF_CONST(1.0242400472191164), f423);
+    y[1] = f552 + f553;
+    y[63] = f554 - f553;
+    f557 = f538 + f425;
+    f558 = MUL_C(COEF_CONST((-0.9237258930790228)), f538);
+    f559 = MUL_C(COEF_CONST(0.9972904566786902), f557);
+    f560 = MUL_C(COEF_CONST(1.0708550202783576), f425);
+    y[3] = f558 + f559;
+    y[61] = f560 - f559;
+    f563 = f540 + f427;
+    f564 = MUL_C(COEF_CONST((-0.8700688593994936)), f540);
+    f565 = MUL_C(COEF_CONST(0.9924795345987100), f563);
+    f566 = MUL_C(COEF_CONST(1.1148902097979263), f427);
+    y[5] = f564 + f565;
+    y[59] = f566 - f565;
+    f569 = f542 + f429;
+    f570 = MUL_C(COEF_CONST((-0.8143157536286398)), f542);
+    f571 = MUL_C(COEF_CONST(0.9852776423889412), f569);
+    f572 = MUL_C(COEF_CONST(1.1562395311492426), f429);
+    y[7] = f570 + f571;
+    y[57] = f572 - f571;
+    f575 = f544 + f431;
+    f576 = MUL_C(COEF_CONST((-0.7566008898816587)), f544);
+    f577 = MUL_C(COEF_CONST(0.9757021300385286), f575);
+    f578 = MUL_C(COEF_CONST(1.1948033701953984), f431);
+    y[9] = f576 + f577;
+    y[55] = f578 - f577;
+    f581 = f546 + f433;
+    f582 = MUL_C(COEF_CONST((-0.6970633083205414)), f546);
+    f583 = MUL_C(COEF_CONST(0.9637760657954398), f581);
+    f584 = MUL_C(COEF_CONST(1.2304888232703384), f433);
+    y[11] = f582 + f583;
+    y[53] = f584 - f583;
+    f587 = f548 + f435;
+    f588 = MUL_C(COEF_CONST((-0.6358464401941451)), f548);
+    f589 = MUL_C(COEF_CONST(0.9495281805930367), f587);
+    f590 = MUL_C(COEF_CONST(1.2632099209919283), f435);
+    y[13] = f588 + f589;
+    y[51] = f590 - f589;
+    f593 = f550 + f437;
+    f594 = MUL_C(COEF_CONST((-0.5730977622997506)), f550);
+    f595 = MUL_C(COEF_CONST(0.9329927988347389), f593);
+    f596 = MUL_C(COEF_CONST(1.2928878353697271), f437);
+    y[15] = f594 + f595;
+    y[49] = f596 - f595;
+    f599 = f549 + f436;
+    f600 = MUL_C(COEF_CONST((-0.5089684416985408)), f549);
+    f601 = MUL_C(COEF_CONST(0.9142097557035307), f599);
+    f602 = MUL_C(COEF_CONST(1.3194510697085207), f436);
+    y[17] = f600 + f601;
+    y[47] = f602 - f601;
+    f605 = f434 - f547;
+    f606 = MUL_C(COEF_CONST((-0.4436129715409087)), f547);
+    f607 = MUL_C(COEF_CONST(0.8932243011955153), f605);
+    f608 = MUL_C(COEF_CONST(1.3428356308501219), f434);
+    y[19] = f607 - f606;
+    y[45] = f608 - f607;
+    f611 = f545 + f432;
+    f612 = MUL_C(COEF_CONST((-0.3771887988789273)), f545);
+    f613 = MUL_C(COEF_CONST(0.8700869911087114), f611);
+    f614 = MUL_C(COEF_CONST(1.3629851833384954), f432);
+    y[21] = f612 + f613;
+    y[43] = f614 - f613;
+    f617 = f430 - f543;
+    f618 = MUL_C(COEF_CONST((-0.3098559453626097)), f543);
+    f619 = MUL_C(COEF_CONST(0.8448535652497070), f617);
+    f620 = MUL_C(COEF_CONST(1.3798511851368043), f430);
+    y[23] = f619 - f618;
+    y[41] = f620 - f619;
+    f623 = f541 + f428;
+    f624 = MUL_C(COEF_CONST((-0.2417766217337384)), f541);
+    f625 = MUL_C(COEF_CONST(0.8175848131515837), f623);
+    f626 = MUL_C(COEF_CONST(1.3933930045694289), f428);
+    y[25] = f624 + f625;
+    y[39] = f626 - f625;
+    f629 = f426 - f539;
+    f630 = MUL_C(COEF_CONST((-0.1731148370459794)), f539);
+    f631 = MUL_C(COEF_CONST(0.7883464276266062), f629);
+    f632 = MUL_C(COEF_CONST(1.4035780182072330), f426);
+    y[27] = f631 - f630;
+    y[37] = f632 - f631;
+    f635 = f537 + f424;
+    f636 = MUL_C(COEF_CONST((-0.1040360035527077)), f537);
+    f637 = MUL_C(COEF_CONST(0.7572088465064845), f635);
+    f638 = MUL_C(COEF_CONST(1.4103816894602612), f424);
+    y[29] = f636 + f637;
+    y[35] = f638 - f637;
+    f641 = f422 - f535;
+    f642 = MUL_C(COEF_CONST((-0.0347065382144000)), f535);
+    f643 = MUL_C(COEF_CONST(0.7242470829514669), f641);
+    f644 = MUL_C(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;
+    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];
+
+    DCT4_64_kernel(y, t2);
+}
+
+void DCT4_64_kernel(real_t *y, real_t *t2)
+{
+    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;
+
+    f2 = 0.7071067811865476 * t2[32];
+    f3 = t2[0] - f2;
+    f4 = t2[0] + f2;
+    f5 = t2[16] + t2[48];
+    f6 = 1.3065629648763766 * t2[16];
+    f7 = (-0.9238795325112866) * f5;
+    f8 = (-0.5411961001461967) * t2[48];
+    f9 = f6 + f7;
+    f10 = f8 - f7;
+    f11 = f4 - f10;
+    f12 = f4 + f10;
+    f13 = f3 - f9;
+    f14 = f3 + f9;
+    f15 = t2[8] + t2[56];
+    f16 = 1.1758756024193588 * t2[8];
+    f17 = (-0.9807852804032304) * f15;
+    f18 = (-0.7856949583871021) * t2[56];
+    f19 = f16 + f17;
+    f20 = f18 - f17;
+    f21 = t2[24] + t2[40];
+    f22 = 1.3870398453221473 * t2[24];
+    f23 = (-0.8314696123025455) * f21;
+    f24 = (-0.2758993792829436) * t2[40];
+    f25 = f22 + f23;
+    f26 = f24 - f23;
+    f27 = f20 - f26;
+    f28 = f20 + f26;
+    f29 = 0.7071067811865476 * f27;
+    f30 = f19 - f25;
+    f31 = f19 + f25;
+    f32 = 0.7071067811865476 * f31;
+    f33 = f29 - f32;
+    f34 = f29 + f32;
+    f35 = f12 - f28;
+    f36 = f12 + f28;
+    f37 = f14 - f34;
+    f38 = f14 + f34;
+    f39 = f13 - f33;
+    f40 = f13 + f33;
+    f41 = f11 - f30;
+    f42 = f11 + f30;
+    f43 = t2[4] + t2[60];
+    f44 = 1.0932018670017569 * t2[4];
+    f45 = (-0.9951847266721969) * f43;
+    f46 = (-0.8971675863426368) * t2[60];
+    f47 = f44 + f45;
+    f48 = f46 - f45;
+    f49 = t2[12] + t2[52];
+    f50 = 1.2472250129866711 * t2[12];
+    f51 = (-0.9569403357322089) * f49;
+    f52 = (-0.6666556584777469) * t2[52];
+    f53 = f50 + f51;
+    f54 = f52 - f51;
+    f55 = t2[20] + t2[44];
+    f56 = 1.3533180011743526 * t2[20];
+    f57 = (-0.8819212643483551) * f55;
+    f58 = (-0.4105245275223575) * t2[44];
+    f59 = f56 + f57;
+    f60 = f58 - f57;
+    f61 = t2[28] + t2[36];
+    f62 = 1.4074037375263826 * t2[28];
+    f63 = (-0.7730104533627369) * f61;
+    f64 = (-0.1386171691990913) * t2[36];
+    f65 = f62 + f63;
+    f66 = f64 - f63;
+    f67 = f48 - f66;
+    f68 = f48 + f66;
+    f69 = f54 - f60;
+    f70 = f54 + f60;
+    f71 = f68 - f70;
+    f72 = f68 + f70;
+    f73 = 0.7071067811865476 * f71;
+    f74 = f67 + f69;
+    f75 = 1.3065629648763766 * f67;
+    f76 = (-0.9238795325112866) * f74;
+    f77 = (-0.5411961001461967) * f69;
+    f78 = f75 + f76;
+    f79 = f77 - f76;
+    f80 = f47 - f65;
+    f81 = f47 + f65;
+    f82 = f53 - f59;
+    f83 = f53 + f59;
+    f84 = f81 + f83;
+    f85 = 1.3065629648763770 * f81;
+    f86 = (-0.3826834323650904) * f84;
+    f87 = 0.5411961001461961 * f83;
+    f88 = f85 + f86;
+    f89 = f87 - f86;
+    f90 = f80 - f82;
+    f91 = f80 + f82;
+    f92 = 0.7071067811865476 * f91;
+    f93 = f79 - f89;
+    f94 = f79 + f89;
+    f95 = f73 - f92;
+    f96 = f73 + f92;
+    f97 = f78 - f88;
+    f98 = f78 + f88;
+    f99 = f36 - f72;
+    f100 = f36 + f72;
+    f101 = f38 - f94;
+    f102 = f38 + f94;
+    f103 = f40 - f93;
+    f104 = f40 + f93;
+    f105 = f42 - f96;
+    f106 = f42 + f96;
+    f107 = f41 - f95;
+    f108 = f41 + f95;
+    f109 = f39 - f98;
+    f110 = f39 + f98;
+    f111 = f37 - f97;
+    f112 = f37 + f97;
+    f113 = f35 - f90;
+    f114 = f35 + f90;
+    f115 = t2[2] + t2[62];
+    f116 = 1.0478631305325901 * t2[2];
+    f117 = (-0.9987954562051724) * f115;
+    f118 = (-0.9497277818777548) * t2[62];
+    f119 = f116 + f117;
+    f120 = f118 - f117;
+    f121 = t2[10] + t2[54];
+    f122 = 1.2130114330978077 * t2[10];
+    f123 = (-0.9700312531945440) * f121;
+    f124 = (-0.7270510732912803) * t2[54];
+    f125 = f122 + f123;
+    f126 = f124 - f123;
+    f127 = t2[18] + t2[46];
+    f128 = 1.3315443865537255 * t2[18];
+    f129 = (-0.9039892931234433) * f127;
+    f130 = (-0.4764341996931612) * t2[46];
+    f131 = f128 + f129;
+    f132 = f130 - f129;
+    f133 = t2[26] + t2[38];
+    f134 = 1.3989068359730781 * t2[26];
+    f135 = (-0.8032075314806453) * f133;
+    f136 = (-0.2075082269882124) * t2[38];
+    f137 = f134 + f135;
+    f138 = f136 - f135;
+    f139 = t2[34] + t2[30];
+    f140 = 1.4125100802019777 * t2[34];
+    f141 = (-0.6715589548470187) * f139;
+    f142 = 0.0693921705079402 * t2[30];
+    f143 = f140 + f141;
+    f144 = f142 - f141;
+    f145 = t2[42] + t2[22];
+    f146 = 1.3718313541934939 * t2[42];
+    f147 = (-0.5141027441932219) * f145;
+    f148 = 0.3436258658070501 * t2[22];
+    f149 = f146 + f147;
+    f150 = f148 - f147;
+    f151 = t2[50] + t2[14];
+    f152 = 1.2784339185752409 * t2[50];
+    f153 = (-0.3368898533922200) * f151;
+    f154 = 0.6046542117908008 * t2[14];
+    f155 = f152 + f153;
+    f156 = f154 - f153;
+    f157 = t2[58] + t2[6];
+    f158 = 1.1359069844201433 * t2[58];
+    f159 = (-0.1467304744553624) * f157;
+    f160 = 0.8424460355094185 * t2[6];
+    f161 = f158 + f159;
+    f162 = f160 - f159;
+    f163 = f120 - f144;
+    f164 = f120 + f144;
+    f165 = f119 - f143;
+    f166 = f119 + f143;
+    f167 = f126 - f150;
+    f168 = f126 + f150;
+    f169 = f125 - f149;
+    f170 = f125 + f149;
+    f171 = f132 - f156;
+    f172 = f132 + f156;
+    f173 = f131 - f155;
+    f174 = f131 + f155;
+    f175 = f138 - f162;
+    f176 = f138 + f162;
+    f177 = f137 - f161;
+    f178 = f137 + f161;
+    f179 = f163 + f165;
+    f180 = 1.1758756024193588 * f163;
+    f181 = (-0.9807852804032304) * f179;
+    f182 = (-0.7856949583871021) * f165;
+    f183 = f180 + f181;
+    f184 = f182 - f181;
+    f185 = f167 + f169;
+    f186 = 1.3870398453221475 * f167;
+    f187 = (-0.5555702330196022) * f185;
+    f188 = 0.2758993792829431 * f169;
+    f189 = f186 + f187;
+    f190 = f188 - f187;
+    f191 = f171 + f173;
+    f192 = 0.7856949583871022 * f171;
+    f193 = 0.1950903220161283 * f191;
+    f194 = 1.1758756024193586 * f173;
+    f195 = f192 + f193;
+    f196 = f194 - f193;
+    f197 = f175 + f177;
+    f198 = (-0.2758993792829430) * f175;
+    f199 = 0.8314696123025452 * f197;
+    f200 = 1.3870398453221475 * f177;
+    f201 = f198 + f199;
+    f202 = f200 - f199;
+    f203 = f164 - f172;
+    f204 = f164 + f172;
+    f205 = f166 - f174;
+    f206 = f166 + f174;
+    f207 = f168 - f176;
+    f208 = f168 + f176;
+    f209 = f170 - f178;
+    f210 = f170 + f178;
+    f211 = f184 - f196;
+    f212 = f184 + f196;
+    f213 = f183 - f195;
+    f214 = f183 + f195;
+    f215 = f190 - f202;
+    f216 = f190 + f202;
+    f217 = f189 - f201;
+    f218 = f189 + f201;
+    f219 = f203 + f205;
+    f220 = 1.3065629648763766 * f203;
+    f221 = (-0.9238795325112866) * f219;
+    f222 = (-0.5411961001461967) * f205;
+    f223 = f220 + f221;
+    f224 = f222 - f221;
+    f225 = f207 + f209;
+    f226 = 0.5411961001461969 * f207;
+    f227 = 0.3826834323650898 * f225;
+    f228 = 1.3065629648763766 * f209;
+    f229 = f226 + f227;
+    f230 = f228 - f227;
+    f231 = f211 + f213;
+    f232 = 1.3065629648763766 * f211;
+    f233 = (-0.9238795325112866) * f231;
+    f234 = (-0.5411961001461967) * f213;
+    f235 = f232 + f233;
+    f236 = f234 - f233;
+    f237 = f215 + f217;
+    f238 = 0.5411961001461969 * f215;
+    f239 = 0.3826834323650898 * f237;
+    f240 = 1.3065629648763766 * f217;
+    f241 = f238 + f239;
+    f242 = f240 - f239;
+    f243 = f204 - f208;
+    f244 = f204 + f208;
+    f245 = f206 - f210;
+    f246 = f206 + f210;
+    f247 = f224 - f230;
+    f248 = f224 + f230;
+    f249 = f223 - f229;
+    f250 = f223 + f229;
+    f251 = f212 - f216;
+    f252 = f212 + f216;
+    f253 = f214 - f218;
+    f254 = f214 + f218;
+    f255 = f236 - f242;
+    f256 = f236 + f242;
+    f257 = f235 - f241;
+    f258 = f235 + f241;
+    f259 = f243 - f245;
+    f260 = f243 + f245;
+    f261 = 0.7071067811865474 * f259;
+    f262 = 0.7071067811865474 * f260;
+    f263 = f247 - f249;
+    f264 = f247 + f249;
+    f265 = 0.7071067811865474 * f263;
+    f266 = 0.7071067811865474 * f264;
+    f267 = f251 - f253;
+    f268 = f251 + f253;
+    f269 = 0.7071067811865474 * f267;
+    f270 = 0.7071067811865474 * f268;
+    f271 = f255 - f257;
+    f272 = f255 + f257;
+    f273 = 0.7071067811865474 * f271;
+    f274 = 0.7071067811865474 * f272;
+    f275 = f100 - f244;
+    f276 = f100 + f244;
+    f277 = f102 - f252;
+    f278 = f102 + f252;
+    f279 = f104 - f256;
+    f280 = f104 + f256;
+    f281 = f106 - f248;
+    f282 = f106 + f248;
+    f283 = f108 - f266;
+    f284 = f108 + f266;
+    f285 = f110 - f274;
+    f286 = f110 + f274;
+    f287 = f112 - f270;
+    f288 = f112 + f270;
+    f289 = f114 - f262;
+    f290 = f114 + f262;
+    f291 = f113 - f261;
+    f292 = f113 + f261;
+    f293 = f111 - f269;
+    f294 = f111 + f269;
+    f295 = f109 - f273;
+    f296 = f109 + f273;
+    f297 = f107 - f265;
+    f298 = f107 + f265;
+    f299 = f105 - f250;
+    f300 = f105 + f250;
+    f301 = f103 - f258;
+    f302 = f103 + f258;
+    f303 = f101 - f254;
+    f304 = f101 + f254;
+    f305 = f99 - f246;
+    f306 = f99 + f246;
+    f307 = t2[1] - t2[61];
+    f308 = 1.0478631305325901 * t2[1];
+    f309 = (-0.9987954562051724) * f307;
+    f310 = (-0.9497277818777548) * t2[61];
+    f311 = f308 + f309;
+    f312 = f309 + f310;
+    f313 = t2[9] - t2[53];
+    f314 = 1.2130114330978077 * t2[9];
+    f315 = (-0.9700312531945440) * f313;
+    f316 = (-0.7270510732912803) * t2[53];
+    f317 = f314 + f315;
+    f318 = f315 + f316;
+    f319 = t2[17] - t2[45];
+    f320 = 1.3315443865537255 * t2[17];
+    f321 = (-0.9039892931234433) * f319;
+    f322 = (-0.4764341996931612) * t2[45];
+    f323 = f320 + f321;
+    f324 = f321 + f322;
+    f325 = t2[25] - t2[37];
+    f326 = 1.3989068359730781 * t2[25];
+    f327 = (-0.8032075314806453) * f325;
+    f328 = (-0.2075082269882124) * t2[37];
+    f329 = f326 + f327;
+    f330 = f327 + f328;
+    f331 = t2[33] - t2[29];
+    f332 = 1.4125100802019777 * t2[33];
+    f333 = (-0.6715589548470187) * f331;
+    f334 = 0.0693921705079402 * t2[29];
+    f335 = f332 + f333;
+    f336 = f333 + f334;
+    f337 = t2[41] - t2[21];
+    f338 = 1.3718313541934939 * t2[41];
+    f339 = (-0.5141027441932219) * f337;
+    f340 = 0.3436258658070501 * t2[21];
+    f341 = f338 + f339;
+    f342 = f339 + f340;
+    f343 = t2[49] - t2[13];
+    f344 = 1.2784339185752409 * t2[49];
+    f345 = (-0.3368898533922200) * f343;
+    f346 = 0.6046542117908008 * t2[13];
+    f347 = f344 + f345;
+    f348 = f345 + f346;
+    f349 = t2[57] - t2[5];
+    f350 = 1.1359069844201433 * t2[57];
+    f351 = (-0.1467304744553624) * f349;
+    f352 = 0.8424460355094185 * t2[5];
+    f353 = f350 + f351;
+    f354 = f351 + f352;
+    f355 = f336 - f312;
+    f356 = f312 + f336;
+    f357 = f311 - f335;
+    f358 = f311 + f335;
+    f359 = f342 - f318;
+    f360 = f318 + f342;
+    f361 = f317 - f341;
+    f362 = f317 + f341;
+    f363 = f348 - f324;
+    f364 = f324 + f348;
+    f365 = f323 - f347;
+    f366 = f323 + f347;
+    f367 = f354 - f330;
+    f368 = f330 + f354;
+    f369 = f329 - f353;
+    f370 = f329 + f353;
+    f371 = f355 + f357;
+    f372 = 1.1758756024193588 * f355;
+    f373 = (-0.9807852804032304) * f371;
+    f374 = (-0.7856949583871021) * f357;
+    f375 = f372 + f373;
+    f376 = f374 - f373;
+    f377 = f359 + f361;
+    f378 = 1.3870398453221475 * f359;
+    f379 = (-0.5555702330196022) * f377;
+    f380 = 0.2758993792829431 * f361;
+    f381 = f378 + f379;
+    f382 = f380 - f379;
+    f383 = f363 + f365;
+    f384 = 0.7856949583871022 * f363;
+    f385 = 0.1950903220161283 * f383;
+    f386 = 1.1758756024193586 * f365;
+    f387 = f384 + f385;
+    f388 = f386 - f385;
+    f389 = f367 + f369;
+    f390 = (-0.2758993792829430) * f367;
+    f391 = 0.8314696123025452 * f389;
+    f392 = 1.3870398453221475 * f369;
+    f393 = f390 + f391;
+    f394 = f392 - f391;
+    f395 = f364 - f356;
+    f396 = f356 + f364;
+    f397 = f358 - f366;
+    f398 = f358 + f366;
+    f399 = f368 - f360;
+    f400 = f360 + f368;
+    f401 = f362 - f370;
+    f402 = f362 + f370;
+    f403 = f376 - f388;
+    f404 = f376 + f388;
+    f405 = f375 - f387;
+    f406 = f375 + f387;
+    f407 = f382 - f394;
+    f408 = f382 + f394;
+    f409 = f381 - f393;
+    f410 = f381 + f393;
+    f411 = f395 + f397;
+    f412 = 1.3065629648763766 * f395;
+    f413 = (-0.9238795325112866) * f411;
+    f414 = (-0.5411961001461967) * f397;
+    f415 = f412 + f413;
+    f416 = f414 - f413;
+    f417 = f399 + f401;
+    f418 = 0.5411961001461969 * f399;
+    f419 = 0.3826834323650898 * f417;
+    f420 = 1.3065629648763766 * f401;
+    f421 = f418 + f419;
+    f422 = f420 - f419;
+    f423 = f403 + f405;
+    f424 = 1.3065629648763766 * f403;
+    f425 = (-0.9238795325112866) * f423;
+    f426 = (-0.5411961001461967) * f405;
+    f427 = f424 + f425;
+    f428 = f426 - f425;
+    f429 = f407 + f409;
+    f430 = 0.5411961001461969 * f407;
+    f431 = 0.3826834323650898 * f429;
+    f432 = 1.3065629648763766 * f409;
+    f433 = f430 + f431;
+    f434 = f432 - f431;
+    f435 = f400 - f396;
+    f436 = f396 + f400;
+    f437 = f398 - f402;
+    f438 = f398 + f402;
+    f439 = f416 - f422;
+    f440 = f416 + f422;
+    f441 = f415 - f421;
+    f442 = f415 + f421;
+    f443 = f404 - f408;
+    f444 = f404 + f408;
+    f445 = f406 - f410;
+    f446 = f406 + f410;
+    f447 = f428 - f434;
+    f448 = f428 + f434;
+    f449 = f427 - f433;
+    f450 = f427 + f433;
+    f451 = f435 - f437;
+    f452 = f435 + f437;
+    f453 = 0.7071067811865474 * f451;
+    f454 = 0.7071067811865474 * f452;
+    f455 = f439 - f441;
+    f456 = f439 + f441;
+    f457 = 0.7071067811865474 * f455;
+    f458 = 0.7071067811865474 * f456;
+    f459 = f443 - f445;
+    f460 = f443 + f445;
+    f461 = 0.7071067811865474 * f459;
+    f462 = 0.7071067811865474 * f460;
+    f463 = f447 - f449;
+    f464 = f447 + f449;
+    f465 = 0.7071067811865474 * f463;
+    f466 = 0.7071067811865474 * f464;
+    f467 = 0.7071067811865476 * t2[31];
+    f468 = t2[63] - f467;
+    f469 = t2[63] + f467;
+    f470 = t2[47] + t2[15];
+    f471 = 1.3065629648763766 * t2[47];
+    f472 = (-0.9238795325112866) * f470;
+    f473 = (-0.5411961001461967) * t2[15];
+    f474 = f471 + f472;
+    f475 = f473 - f472;
+    f476 = f469 - f475;
+    f477 = f469 + f475;
+    f478 = f468 - f474;
+    f479 = f468 + f474;
+    f480 = t2[55] + t2[7];
+    f481 = 1.1758756024193588 * t2[55];
+    f482 = (-0.9807852804032304) * f480;
+    f483 = (-0.7856949583871021) * t2[7];
+    f484 = f481 + f482;
+    f485 = f483 - f482;
+    f486 = t2[39] + t2[23];
+    f487 = 1.3870398453221473 * t2[39];
+    f488 = (-0.8314696123025455) * f486;
+    f489 = (-0.2758993792829436) * t2[23];
+    f490 = f487 + f488;
+    f491 = f489 - f488;
+    f492 = f485 - f491;
+    f493 = f485 + f491;
+    f494 = 0.7071067811865476 * f492;
+    f495 = f484 - f490;
+    f496 = f484 + f490;
+    f497 = 0.7071067811865476 * f496;
+    f498 = f494 - f497;
+    f499 = f494 + f497;
+    f500 = f477 - f493;
+    f501 = f477 + f493;
+    f502 = f479 - f499;
+    f503 = f479 + f499;
+    f504 = f478 - f498;
+    f505 = f478 + f498;
+    f506 = f476 - f495;
+    f507 = f476 + f495;
+    f508 = t2[59] + t2[3];
+    f509 = 1.0932018670017569 * t2[59];
+    f510 = (-0.9951847266721969) * f508;
+    f511 = (-0.8971675863426368) * t2[3];
+    f512 = f509 + f510;
+    f513 = f511 - f510;
+    f514 = t2[51] + t2[11];
+    f515 = 1.2472250129866711 * t2[51];
+    f516 = (-0.9569403357322089) * f514;
+    f517 = (-0.6666556584777469) * t2[11];
+    f518 = f515 + f516;
+    f519 = f517 - f516;
+    f520 = t2[43] + t2[19];
+    f521 = 1.3533180011743526 * t2[43];
+    f522 = (-0.8819212643483551) * f520;
+    f523 = (-0.4105245275223575) * t2[19];
+    f524 = f521 + f522;
+    f525 = f523 - f522;
+    f526 = t2[35] + t2[27];
+    f527 = 1.4074037375263826 * t2[35];
+    f528 = (-0.7730104533627369) * f526;
+    f529 = (-0.1386171691990913) * t2[27];
+    f530 = f527 + f528;
+    f531 = f529 - f528;
+    f532 = f513 - f531;
+    f533 = f513 + f531;
+    f534 = f519 - f525;
+    f535 = f519 + f525;
+    f536 = f533 - f535;
+    f537 = f533 + f535;
+    f538 = 0.7071067811865476 * f536;
+    f539 = f532 + f534;
+    f540 = 1.3065629648763766 * f532;
+    f541 = (-0.9238795325112866) * f539;
+    f542 = (-0.5411961001461967) * f534;
+    f543 = f540 + f541;
+    f544 = f542 - f541;
+    f545 = f512 - f530;
+    f546 = f512 + f530;
+    f547 = f518 - f524;
+    f548 = f518 + f524;
+    f549 = f546 + f548;
+    f550 = 1.3065629648763770 * f546;
+    f551 = (-0.3826834323650904) * f549;
+    f552 = 0.5411961001461961 * f548;
+    f553 = f550 + f551;
+    f554 = f552 - f551;
+    f555 = f545 - f547;
+    f556 = f545 + f547;
+    f557 = 0.7071067811865476 * f556;
+    f558 = f544 - f554;
+    f559 = f544 + f554;
+    f560 = f538 - f557;
+    f561 = f538 + f557;
+    f562 = f543 - f553;
+    f563 = f543 + f553;
+    f564 = f501 - f537;
+    f565 = f501 + f537;
+    f566 = f503 - f559;
+    f567 = f503 + f559;
+    f568 = f505 - f558;
+    f569 = f505 + f558;
+    f570 = f507 - f561;
+    f571 = f507 + f561;
+    f572 = f506 - f560;
+    f573 = f506 + f560;
+    f574 = f504 - f563;
+    f575 = f504 + f563;
+    f576 = f502 - f562;
+    f577 = f502 + f562;
+    f578 = f500 - f555;
+    f579 = f500 + f555;
+    f580 = f438 - f565;
+    f581 = f438 + f565;
+    f582 = f446 + f567;
+    f583 = f446 - f567;
+    f584 = f450 - f569;
+    f585 = f450 + f569;
+    f586 = f442 + f571;
+    f587 = f442 - f571;
+    f588 = f457 - f573;
+    f589 = f457 + f573;
+    f590 = f465 + f575;
+    f591 = f465 - f575;
+    f592 = f461 - f577;
+    f593 = f461 + f577;
+    f594 = f453 + f579;
+    f595 = f453 - f579;
+    f596 = f454 - f578;
+    f597 = f454 + f578;
+    f598 = f462 + f576;
+    f599 = f462 - f576;
+    f600 = f466 - f574;
+    f601 = f466 + f574;
+    f602 = f458 + f572;
+    f603 = f458 - f572;
+    f604 = f440 - f570;
+    f605 = f440 + f570;
+    f606 = f448 + f568;
+    f607 = f448 - f568;
+    f608 = f444 - f566;
+    f609 = f444 + f566;
+    f610 = f564 - f436;
+    f611 = f436 + f564;
+    f612 = f581 + f276;
+    f613 = (-0.9876531635534246) * f581;
+    f614 = 0.9999247018391445 * f612;
+    f615 = 1.0121962401248645 * f276;
+    y[0] = f613 + f614;
+    y[63] = f615 - f614;
+    f618 = f583 + f278;
+    f619 = (-0.9625151616469906) * f583;
+    f620 = 0.9993223845883495 * f618;
+    f621 = 1.0361296075297086 * f278;
+    y[1] = f619 + f620;
+    y[62] = f621 - f620;
+    f624 = f585 + f280;
+    f625 = (-0.9367973765979405) * f585;
+    f626 = 0.9981181129001492 * f624;
+    f627 = 1.0594388492023579 * f280;
+    y[2] = f625 + f626;
+    y[61] = f627 - f626;
+    f630 = f587 + f282;
+    f631 = (-0.9105152998383381) * f587;
+    f632 = 0.9963126121827780 * f630;
+    f633 = 1.0821099245272179 * f282;
+    y[3] = f631 + f632;
+    y[60] = f633 - f632;
+    f636 = f589 + f284;
+    f637 = (-0.8836847627084729) * f589;
+    f638 = 0.9939069700023561 * f636;
+    f639 = 1.1041291772962392 * f284;
+    y[4] = f637 + f638;
+    y[59] = f639 - f638;
+    f642 = f591 + f286;
+    f643 = (-0.8563219269206538) * f591;
+    f644 = 0.9909026354277800 * f642;
+    f645 = 1.1254833439349063 * f286;
+    y[5] = f643 + f644;
+    y[58] = f645 - f644;
+    f648 = f593 + f288;
+    f649 = (-0.8284432748239970) * f593;
+    f650 = 0.9873014181578584 * f648;
+    f651 = 1.1461595614917197 * f288;
+    y[6] = f649 + f650;
+    y[57] = f651 - f650;
+    f654 = f595 + f290;
+    f655 = (-0.8000655994760753) * f595;
+    f656 = 0.9831054874312163 * f654;
+    f657 = 1.1661453753863573 * f290;
+    y[7] = f655 + f656;
+    y[56] = f657 - f656;
+    f660 = f597 + f292;
+    f661 = (-0.7712059945274091) * f597;
+    f662 = 0.9783173707196277 * f660;
+    f663 = 1.1854287469118463 * f292;
+    y[8] = f661 + f662;
+    y[55] = f663 - f662;
+    f666 = f599 + f294;
+    f667 = (-0.7418818439248888) * f599;
+    f668 = 0.9729399522055601 * f666;
+    f669 = 1.2039980604862313 * f294;
+    y[9] = f667 + f668;
+    y[54] = f669 - f668;
+    f672 = f601 + f296;
+    f673 = (-0.7121108114403374) * f601;
+    f674 = 0.9669764710448521 * f672;
+    f675 = 1.2218421306493668 * f296;
+    y[10] = f673 + f674;
+    y[53] = f675 - f674;
+    f678 = f603 + f298;
+    f679 = (-0.6819108300305128) * f603;
+    f680 = 0.9604305194155658 * f678;
+    f681 = 1.2389502088006188 * f298;
+    y[11] = f679 + f680;
+    y[52] = f681 - f680;
+    f684 = f605 + f300;
+    f685 = (-0.6513000910349656) * f605;
+    f686 = 0.9533060403541938 * f684;
+    f687 = 1.2553119896734219 * f300;
+    y[12] = f685 + f686;
+    y[51] = f687 - f686;
+    f690 = f607 + f302;
+    f691 = (-0.6202970332182582) * f607;
+    f692 = 0.9456073253805213 * f690;
+    f693 = 1.2709176175427843 * f302;
+    y[13] = f691 + f692;
+    y[50] = f693 - f692;
+    f696 = f609 + f304;
+    f697 = (-0.5889203316631404) * f609;
+    f698 = 0.9373390119125750 * f696;
+    f699 = 1.2857576921620095 * f304;
+    y[14] = f697 + f698;
+    y[49] = f699 - f698;
+    f702 = f306 - f611;
+    f703 = (-0.5571888865213779) * f611;
+    f704 = 0.9285060804732155 * f702;
+    f705 = 1.2998232744250531 * f306;
+    y[15] = f704 - f703;
+    y[48] = f705 - f704;
+    f708 = f610 + f305;
+    f709 = (-0.5251218116290097) * f610;
+    f710 = 0.9191138516900578 * f708;
+    f711 = 1.3131058917511058 * f305;
+    y[16] = f709 + f710;
+    y[47] = f711 - f710;
+    f714 = f608 + f303;
+    f715 = (-0.4927384229928850) * f608;
+    f716 = 0.9091679830905223 * f714;
+    f717 = 1.3255975431881595 * f303;
+    y[17] = f715 + f716;
+    y[46] = f717 - f716;
+    f720 = f606 + f301;
+    f721 = (-0.4600582271554261) * f606;
+    f722 = 0.8986744656939538 * f720;
+    f723 = 1.3372907042324815 * f301;
+    y[18] = f721 + f722;
+    y[45] = f723 - f722;
+    f726 = f604 + f299;
+    f727 = (-0.4271009094446139) * f604;
+    f728 = 0.8876396204028539 * f726;
+    f729 = 1.3481783313610940 * f299;
+    y[19] = f727 + f728;
+    y[44] = f729 - f728;
+    f732 = f602 + f297;
+    f733 = (-0.3938863221162838) * f602;
+    f734 = 0.8760700941954066 * f732;
+    f735 = 1.3582538662745294 * f297;
+    y[20] = f733 + f734;
+    y[43] = f735 - f734;
+    f738 = f600 + f295;
+    f739 = (-0.3604344723958691) * f600;
+    f740 = 0.8639728561215867 * f738;
+    f741 = 1.3675112398473042 * f295;
+    y[21] = f739 + f740;
+    y[42] = f741 - f740;
+    f744 = f598 + f293;
+    f745 = (-0.3267655104267964) * f598;
+    f746 = 0.8513551931052652 * f744;
+    f747 = 1.3759448757837340 * f293;
+    y[22] = f745 + f746;
+    y[41] = f747 - f746;
+    f750 = f596 + f291;
+    f751 = (-0.2928997171327915) * f596;
+    f752 = 0.8382247055548380 * f750;
+    f753 = 1.3835496939768843 * f291;
+    y[23] = f751 + f752;
+    y[40] = f753 - f752;
+    f756 = f594 + f289;
+    f757 = (-0.2588574920014121) * f594;
+    f758 = 0.8245893027850253 * f756;
+    f759 = 1.3903211135686386 * f289;
+    y[24] = f757 + f758;
+    y[39] = f759 - f758;
+    f762 = f592 + f287;
+    f763 = (-0.2246593407961559) * f592;
+    f764 = 0.8104571982525948 * f762;
+    f765 = 1.3962550557090336 * f287;
+    y[25] = f763 + f764;
+    y[38] = f765 - f764;
+    f768 = f590 + f285;
+    f769 = (-0.1903258632045579) * f590;
+    f770 = 0.7958369046088835 * f768;
+    f771 = 1.4013479460132090 * f285;
+    y[26] = f769 + f770;
+    y[37] = f771 - f770;
+    f774 = f588 + f283;
+    f775 = (-0.1558777404297079) * f588;
+    f776 = 0.7807372285720944 * f774;
+    f777 = 1.4055967167144807 * f283;
+    y[27] = f775 + f776;
+    y[36] = f777 - f776;
+    f780 = f586 + f281;
+    f781 = (-0.1213357227326675) * f586;
+    f782 = 0.7651672656224590 * f780;
+    f783 = 1.4089988085122505 * f281;
+    y[28] = f781 + f782;
+    y[35] = f783 - f782;
+    f786 = f584 + f279;
+    f787 = (-0.0867206169332875) * f584;
+    f788 = 0.7491363945234593 * f786;
+    f789 = 1.4115521721136310 * f279;
+    y[29] = f787 + f788;
+    y[34] = f789 - f788;
+    f792 = f582 + f277;
+    f793 = (-0.0520532738769597) * f582;
+    f794 = 0.7326542716724128 * f792;
+    f795 = 1.4132552694678659 * f277;
+    y[30] = f793 + f794;
+    y[33] = f795 - f794;
+    f798 = f580 + f275;
+    f799 = (-0.0173545758748457) * f580;
+    f800 = 0.7157308252838186 * f798;
+    f801 = 1.4141070746927915 * f275;
+    y[31] = f799 + f800;
+    y[32] = f801 - f800;
+}
+
+#endif
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/sbr_dct.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.8 2003/11/12 20:47:58 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 DCT4_64_kernel(real_t *y, real_t *t2);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/sbr_dec.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,358 @@
+/*
+** 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.17 2003/11/12 20:47:58 menno Exp $
+**/
+
+
+#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(uint16_t framelength
+#ifdef DRM
+						, uint8_t IsDRM
+#endif
+                        )
+{
+    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;
+
+#ifdef DRM
+    sbr->Is_DRM_SBR = 0;
+    if (IsDRM)
+    {
+        sbr->Is_DRM_SBR = 1;
+        sbr->tHFGen = T_HFGEN_DRM;
+        sbr->tHFAdj = T_HFADJ_DRM;
+
+        /* "offset" is different in DRM */
+        sbr->bs_samplerate_mode = 0;
+    } else
+#endif
+    {
+        sbr->bs_samplerate_mode = 1;
+        sbr->tHFGen = T_HFGEN;
+        sbr->tHFAdj = T_HFADJ;
+    }
+
+    /* force sbr reset */
+    sbr->bs_start_freq_prev = -1;
+
+    if (framelength == 960)
+    {
+        sbr->numTimeSlotsRate = RATE * NO_TIME_SLOTS_960;
+        sbr->numTimeSlots = NO_TIME_SLOTS_960;
+    } else {
+        sbr->numTimeSlotsRate = RATE * NO_TIME_SLOTS;
+        sbr->numTimeSlots = NO_TIME_SLOTS;
+    }
+
+    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,
+                    const uint8_t just_seeked, const uint8_t upsample_only)
+{
+    int16_t i, k, l;
+
+    uint8_t dont_process = 0;
+    uint8_t ch, channels, ret;
+    real_t *ch_buf;
+
+    qmf_t X[MAX_NTSR][64];
+#ifdef SBR_LOW_POWER
+    real_t deg[64];
+#endif
+
+    bitfile *ld = NULL;
+
+    channels = (sbr->id_aac == ID_SCE) ? 1 : 2;
+
+    if (sbr->data == NULL || sbr->data_size == 0)
+    {
+        ret = 1;
+    } else {
+        ld = (bitfile*)malloc(sizeof(bitfile));
+
+        /* initialise and read the bitstream */
+        faad_initbits(ld, sbr->data, sbr->data_size);
+
+        ret = sbr_extension_data(ld, sbr);
+
+        ret = ld->error ? ld->error : ret;
+        faad_endbits(ld);
+        if (ld) free(ld);
+        ld = NULL;
+    }
+
+    if (sbr->data) free(sbr->data);
+    sbr->data = NULL;
+
+    if (ret || (sbr->header_count == 0))
+    {
+        /* don't process just upsample */
+        dont_process = 1;
+
+        /* Re-activate reset for next frame */
+        if (ret && sbr->Reset)
+            sbr->bs_start_freq_prev = -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));
+            }
+
+            memset(sbr->Xsbr[ch], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t));
+            memset(sbr->Xcodec[ch], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*32 * sizeof(qmf_t));
+        }
+
+        if (ch == 0)
+            ch_buf = left_channel;
+        else
+            ch_buf = right_channel;
+
+        /* subband analysis */
+        if (dont_process)
+            sbr_qmf_analysis_32(sbr, sbr->qmfa[ch], ch_buf, sbr->Xcodec[ch], sbr->tHFGen, 32);
+        else
+            sbr_qmf_analysis_32(sbr, sbr->qmfa[ch], ch_buf, sbr->Xcodec[ch], sbr->tHFGen, sbr->kx);
+
+        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][sbr->tHFAdj + l][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 < sbr->numTimeSlotsRate; l++)
+            {
+                for (k = 0; k < 32; k++)
+                {
+                    QMF_RE(X[l][k]) = QMF_RE(sbr->Xcodec[ch][l + sbr->tHFAdj][k]);
+#ifndef SBR_LOW_POWER
+                    QMF_IM(X[l][k]) = QMF_IM(sbr->Xcodec[ch][l + sbr->tHFAdj][k]);
+#endif
+                }
+                for (k = 32; k < 64; k++)
+                {
+                    QMF_RE(X[l][k]) = 0;
+#ifndef SBR_LOW_POWER
+                    QMF_IM(X[l][k]) = 0;
+#endif
+                }
+            }
+        } else {
+            for (l = 0; l < sbr->numTimeSlotsRate; l++)
+            {
+                uint8_t xover_band;
+
+                if (l < sbr->t_E[ch][0])
+                    xover_band = sbr->kx_prev;
+                else
+                    xover_band = sbr->kx;
+
+#ifdef DRM
+				if (sbr->Is_DRM_SBR)
+					xover_band = sbr->kx;
+#endif
+
+                for (k = 0; k < xover_band; k++)
+                {
+                    QMF_RE(X[l][k]) = QMF_RE(sbr->Xcodec[ch][l + sbr->tHFAdj][k]);
+#ifndef SBR_LOW_POWER
+                    QMF_IM(X[l][k]) = QMF_IM(sbr->Xcodec[ch][l + sbr->tHFAdj][k]);
+#endif
+                }
+                for (k = xover_band; k < 64; k++)
+                {
+                    QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
+#ifndef SBR_LOW_POWER
+                    QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
+#endif
+                }
+#ifdef SBR_LOW_POWER
+                QMF_RE(X[l][xover_band - 1]) += QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][xover_band - 1]);
+#endif
+#ifdef DRM
+                if (sbr->Is_DRM_SBR)
+                {
+                    for (k = xover_band; k < xover_band + 4; k++)
+                    {
+                        QMF_RE(X[l][k]) += QMF_RE(sbr->Xcodec[ch][l + sbr->tHFAdj][k]);
+                        QMF_IM(X[l][k]) += QMF_IM(sbr->Xcodec[ch][l + sbr->tHFAdj][k]);
+                    }
+                }
+#endif
+            }
+        }
+
+        /* subband synthesis */
+        sbr_qmf_synthesis_64(sbr, sbr->qmfs[ch], X, ch_buf);
+
+        for (i = 0; i < sbr->tHFGen; i++)
+        {
+            memmove(sbr->Xcodec[ch][i], sbr->Xcodec[ch][i+sbr->numTimeSlotsRate], 32 * sizeof(qmf_t));
+            memmove(sbr->Xsbr[ch][i], sbr->Xsbr[ch][i+sbr->numTimeSlotsRate], 64 * sizeof(qmf_t));
+        }
+    }
+
+    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/Input/aac/libfaad2/sbr_dec.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,221 @@
+/*
+** 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.12 2003/11/12 20:47:58 menno Exp $
+**/
+
+#ifndef __SBR_DEC_H__
+#define __SBR_DEC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* MAX_NTSRHFG: maximum of number_time_slots * rate + HFGen. DRM: 15*2+32, else 16*2+8 */
+#ifdef DRM
+# define MAX_NTSRHFG 62
+#else
+# define MAX_NTSRHFG 40
+#endif
+#define MAX_NTSR     32 /* max number_time_slots * rate, ok for DRM and not DRM mode */
+
+
+typedef struct {
+    real_t *x;
+    uint8_t channels;
+} qmfa_info;
+
+typedef struct {
+    real_t *v[2];
+    uint8_t v_index;
+    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][MAX_NTSRHFG][64];
+    qmf_t Xcodec[2][MAX_NTSRHFG][32];
+
+#ifdef DRM
+	int8_t lcstereo_flag;
+	uint8_t bs_dataextra;
+	uint16_t data_size_bits;
+    uint8_t Is_DRM_SBR;
+#endif
+
+	uint16_t numTimeSlotsRate;
+	uint16_t numTimeSlots;
+	uint8_t tHFGen;
+	uint8_t tHFAdj;
+
+    /* 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(uint16_t framelength
+#ifdef DRM
+						, uint8_t IsDRM
+#endif
+						);
+void sbrDecodeEnd(sbr_info *sbr);
+
+void sbrDecodeFrame(sbr_info *sbr, real_t *left_channel,
+                    real_t *right_channel,
+                    const uint8_t just_seeked, const uint8_t upsample_only);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/sbr_e_nf.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,215 @@
+/*
+** 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.9 2003/11/14 15:15:51 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;
+
+    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];
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
+
+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];
+                }
+            }
+        }
+    }
+}
+
+/* FIXME: pow() not needed */
+void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch)
+{
+    if (sbr->bs_coupling == 0)
+    {
+        uint8_t l, k;
+        real_t amp = (sbr->amp_res[ch]) ? 1.0f : 0.5f;
+
+        for (l = 0; l < sbr->L_E[ch]; l++)
+        {
+            for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
+            {
+                /* +6 for the *64 */
+                sbr->E_orig[ch][k][l] = (real_t)pow(2, sbr->E[ch][k][l]*amp + 6);
+            }
+        }
+
+        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 {
+                    sbr->Q_orig[ch][k][l] = (real_t)pow(2, NOISE_FLOOR_OFFSET - sbr->Q[ch][k][l]);
+                }
+            }
+        }
+    }
+}
+
+void unmap_envelope_noise(sbr_info *sbr)
+{
+    uint8_t l, k;
+    real_t amp0 = (sbr->amp_res[0]) ? (real_t)1.0 : (real_t)0.5;
+    real_t amp1 = (sbr->amp_res[1]) ? (real_t)1.0 : (real_t)0.5;
+
+    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;
+
+            /* +6: * 64 ; +1: * 2 */
+            l_temp = (real_t)pow(2, sbr->E[0][k][l]*amp0 + 7);
+            /* UN_MAP removed: (x / 4096) same as (x >> 12) */
+            r_temp = (real_t)pow(2, sbr->E[1][k][l]*amp1 - 12);
+
+            sbr->E_orig[1][k][l] = l_temp / ((real_t)1.0 + r_temp);
+            sbr->E_orig[0][k][l] = MUL_R(r_temp, sbr->E_orig[1][k][l]);
+        }
+    }
+    for (l = 0; l < sbr->L_Q[0]; l++)
+    {
+        for (k = 0; k < sbr->N_Q; k++)
+        {
+            if ((sbr->Q[0][k][l] < 0 || sbr->Q[0][k][l] > 30) ||
+                (sbr->Q[1][k][l] < 0 || sbr->Q[1][k][l] > 24 /* 2*panOffset(1) */))
+            {
+                sbr->Q_orig[0][k][l] = 0;
+                sbr->Q_orig[1][k][l] = 0;
+            } else {
+                real_t l_temp, r_temp;
+
+                l_temp = (real_t)pow(2.0, NOISE_FLOOR_OFFSET - sbr->Q[0][k][l] + 1);
+                r_temp = (real_t)pow(2.0, sbr->Q[1][k][l] - 12);
+
+                sbr->Q_orig[1][k][l] = l_temp / ((real_t)1.0 + r_temp);
+                sbr->Q_orig[0][k][l] = MUL_R(r_temp, sbr->Q_orig[1][k][l]);
+            }
+        }
+    }
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/sbr_e_nf.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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_e_nf.h,v 1.7 2003/11/12 20:47:58 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);
+void unmap_envelope_noise(sbr_info *sbr);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/sbr_fbt.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,623 @@
+/*
+** 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.7 2003/11/12 20:47:58 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 */
+uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode,
+                           uint32_t sample_rate)
+{
+    static const uint8_t startMinTable[12] = { 7, 7, 10, 11, 12, 16, 16,
+        17, 24, 32, 35, 48 };
+    static const uint8_t offsetIndexTable[12] = { 5, 5, 4, 4, 4, 3, 2, 1, 0,
+        6, 6, 6 };
+    static const 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 = startMinTable[get_sr_index(sample_rate)];
+    uint8_t offsetIndex = offsetIndexTable[get_sr_index(sample_rate)];
+
+#if 0 /* replaced with table (startMinTable) */
+    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);
+    }
+#endif
+
+    if (bs_samplerate_mode)
+    {
+        return startMin + offset[offsetIndex][bs_start_freq];
+
+#if 0 /* replaced by offsetIndexTable */ 
+        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];
+            }
+        }
+#endif
+    } 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 */
+uint8_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate,
+                          uint8_t k0)
+{
+    if (bs_stop_freq == 15)
+    {
+        return min(64, k0 * 3);
+    } else if (bs_stop_freq == 14) {
+        return min(64, k0 * 2);
+    } else {
+        static const uint8_t stopMinTable[12] = { 13, 15, 20, 21, 23,
+            32, 32, 35, 48, 64, 70, 96 };
+        static const int8_t offset[12][14] = {
+            { 0, 2, 4, 6, 8, 11, 14, 18, 22, 26, 31, 37, 44, 51 },
+            { 0, 2, 4, 6, 8, 11, 14, 18, 22, 26, 31, 36, 42, 49 },
+            { 0, 2, 4, 6, 8, 11, 14, 17, 21, 25, 29, 34, 39, 44 },
+            { 0, 2, 4, 6, 8, 11, 14, 17, 20, 24, 28, 33, 38, 43 },
+            { 0, 2, 4, 6, 8, 11, 14, 17, 20, 24, 28, 32, 36, 41 },
+            { 0, 2, 4, 6, 8, 10, 12, 14, 17, 20, 23, 26, 29, 32 },
+            { 0, 2, 4, 6, 8, 10, 12, 14, 17, 20, 23, 26, 29, 32 },
+            { 0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 20, 23, 26, 29 },
+            { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16 },
+            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+            { 0, -1, -2, -3, -4, -5, -6, -6, -6, -6, -6, -6, -6, -6 },
+            { 0, -3, -6, -9, -12, -15, -18, -20, -22, -24, -26, -28, -30, -32 }
+        };
+#if 0
+        uint8_t i;
+        int32_t stopDk[13], stopDk_t[14], k2;
+#endif
+        uint8_t stopMin = stopMinTable[get_sr_index(sample_rate)];
+
+#if 0 /* replaced by table lookup */
+        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);
+        }
+#endif
+
+#if 0 /* replaced by table lookup */
+        /* diverging power series */
+        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? */
+        qsort(stopDk, 13, sizeof(stopDk[0]), longcmp);
+
+        k2 = stopMin;
+        for (i = 0; i < bs_stop_freq; i++)
+        {
+            k2 += stopDk[i];
+        }
+        return min(64, k2);
+#endif
+        /* bs_stop_freq <= 13 */
+        return min(64, stopMin + offset[get_sr_index(sample_rate)][min(bs_stop_freq, 13)]);
+    }
+
+    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, uint8_t k0, uint8_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] = {0};
+
+    /* mft only defined for k2 > k0 */
+    if (k2 <= k0)
+    {
+        sbr->N_master = 0;
+        return;
+    }
+
+    dk = bs_alter_scale ? 2 : 1;
+
+#if 0 /* replaced by float-less design */
+    nrBands = 2 * (int32_t)((float)(k2-k0)/(dk*2) + (-1+dk)/2.0f);
+#else
+    if (bs_alter_scale)
+    {
+        nrBands = (((k2-k0+2)>>2)<<1);
+    } else {
+        nrBands = (((k2-k0)>>1)<<1);
+    }
+#endif
+    nrBands = min(nrBands, 63);
+
+    k2Achieved = k0 + nrBands * dk;
+    k2Diff = k2 - k2Achieved;
+    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
+}
+
+/*
+   This function finds the number of bands using this formula:
+    bands * log(a1/a0)/log(2.0) + 0.5
+*/
+static int32_t find_bands(uint8_t warp, uint8_t bands, uint8_t a0, uint8_t a1)
+{
+    real_t div = (real_t)log(2.0);
+    if (warp) div *= (real_t)1.3;
+
+    return (int32_t)(bands * log((float)a1/(float)a0)/div + 0.5);
+}
+
+static real_t find_initial_power(uint8_t bands, uint8_t a0, uint8_t a1)
+{
+    return pow((real_t)a1/(real_t)a0, 1.0/(real_t)bands);
+}
+
+/*
+   version for bs_freq_scale > 0
+*/
+void master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2,
+                            uint8_t bs_freq_scale, uint8_t bs_alter_scale)
+{
+    uint8_t k, bands, twoRegions;
+    uint8_t k1;
+    uint8_t nrBand0, nrBand1;
+    int32_t vDk0[64] = {0}, vDk1[64] = {0};
+    int32_t vk0[64] = {0}, vk1[64] = {0};
+    uint8_t temp1[] = { 6, 5, 4 };
+    real_t q, qk;
+    int32_t A_1;
+
+    /* mft only defined for k2 > k0 */
+    if (k2 <= k0)
+    {
+        sbr->N_master = 0;
+        return;
+    }
+
+    bands = temp1[bs_freq_scale-1];
+
+    if ((float)k2/(float)k0 > 2.2449)
+    {
+        twoRegions = 1;
+        k1 = k0 << 1;
+    } else {
+        twoRegions = 0;
+        k1 = k2;
+    }
+
+    nrBand0 = 2 * find_bands(0, bands, k0, k1);
+    nrBand0 = min(nrBand0, 63);
+
+    q = find_initial_power(nrBand0, k0, k1);
+    qk = REAL_CONST(k0);
+    A_1 = (int32_t)(qk + .5);
+    for (k = 0; k <= nrBand0; k++)
+    {
+        int32_t A_0 = A_1;
+        qk *= q;
+        A_1 = (int32_t)(qk + 0.5);
+        vDk0[k] = A_1 - A_0;
+    }
+
+    /* 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 * find_bands(1 /* warped */, bands, k1, k2);
+    nrBand1 = min(nrBand1, 63);
+
+    q = find_initial_power(nrBand1, k1, k2);
+    qk = REAL_CONST(k1);
+    A_1 = (int32_t)(qk + .5);
+    for (k = 0; k <= nrBand1 - 1; k++)
+    {
+        int32_t A_0 = A_1;
+        qk *= q;
+        A_1 = (int32_t)(qk + 0.5);
+        vDk1[k] = A_1 - A_0;
+    }
+
+    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 */
+uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band,
+                                uint8_t k2)
+{
+    uint8_t k, i;
+    uint32_t minus;
+
+    /* The following relation shall be satisfied: bs_xover_band < N_Master */
+    if (sbr->N_master <= bs_xover_band)
+        return 1;
+
+    sbr->N_high = sbr->N_master - bs_xover_band;
+    sbr->N_low = (sbr->N_high>>1) + (sbr->N_high - ((sbr->N_high>>1)<<1));
+
+    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];
+
+    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];
+    }
+
+#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 {
+#if 0
+        sbr->N_Q = max(1, (int32_t)(sbr->bs_noise_bands*(log(k2/(float)sbr->kx)/log(2.0)) + 0.5));
+#else
+        sbr->N_Q = max(1, find_bands(0, sbr->bs_noise_bands, sbr->kx, k2));
+#endif
+        sbr->N_Q = min(5, sbr->N_Q);
+    }
+
+    for (k = 0; k <= sbr->N_Q; k++)
+    {
+        if (k == 0)
+        {
+            i = 0;
+        } else {
+            /* i = i + (int32_t)((sbr->N_low - i)/(sbr->N_Q + 1 - k)); */
+            i = i + (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
+
+    return 0;
+}
+
+/* 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)
+{
+#if 0
+    static const real_t limiterBandsPerOctave[] = { REAL_CONST(1.2),
+        REAL_CONST(2), REAL_CONST(3) };
+#else
+    static const real_t limiterBandsCompare[] = { REAL_CONST(1.328125),
+        REAL_CONST(1.1875), REAL_CONST(1.125) };
+#endif
+    uint8_t k, s;
+    int8_t nrLim;
+#if 0
+    real_t limBands;
+#endif
+
+    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++)
+    {
+        int32_t limTable[100 /*TODO*/] = {0};
+        uint8_t patchBorders[64/*??*/] = {0};
+
+#if 0
+        limBands = limiterBandsPerOctave[s - 1];
+#endif
+
+        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)
+#if 0
+                nOctaves = REAL_CONST(log((float)limTable[k]/(float)limTable[k-1])/log(2.0));
+#endif
+                nOctaves = (real_t)limTable[k]/(real_t)limTable[k-1];
+            else
+                nOctaves = 0;
+
+#if 0
+            if ((MUL(nOctaves,limBands)) < REAL_CONST(0.49))
+#else
+            if (nOctaves < limiterBandsCompare[s - 1])
+#endif
+            {
+                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/Input/aac/libfaad2/sbr_fbt.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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: sbr_fbt.h,v 1.7 2003/11/12 20:47:58 menno Exp $
+**/
+
+#ifndef __SBR_FBT_H__
+#define __SBR_FBT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static int32_t find_bands(uint8_t warp, uint8_t bands, uint8_t a0, uint8_t a1);
+uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode,
+                           uint32_t sample_rate);
+uint8_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate,
+                          uint8_t k0);
+void master_frequency_table_fs0(sbr_info *sbr, uint8_t k0, uint8_t k2,
+                                uint8_t bs_alter_scale);
+void master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2,
+                            uint8_t bs_freq_scale, uint8_t bs_alter_scale);
+uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band,
+                                uint8_t k2);
+void limiter_frequency_table(sbr_info *sbr);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/sbr_hfadj.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,662 @@
+/*
+** 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.8 2003/11/12 20:47:58 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[MAX_NTSRHFG][64]
+#ifdef SBR_LOW_POWER
+                   ,real_t *deg /* aliasing degree */
+#endif
+                   ,uint8_t ch)
+{
+    sbr_hfadj_info adj = {0};
+
+    map_noise_data(sbr, &adj, ch);
+    map_sinusoids(sbr, &adj, ch);
+
+    estimate_current_envelope(sbr, &adj, Xsbr, ch);
+
+    calculate_gain(sbr, &adj, ch);
+
+#ifdef SBR_LOW_POWER
+    calc_gain_groups(sbr, &adj, deg, ch);
+    aliasing_reduction(sbr, &adj, deg, ch);
+#endif
+
+    hf_assembly(sbr, &adj, Xsbr, ch);
+}
+
+static void map_noise_data(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
+{
+    uint8_t l, i;
+    uint32_t m;
+
+    for (l = 0; l < sbr->L_E[ch]; l++)
+    {
+        for (i = 0; i < sbr->N_Q; i++)
+        {
+            for (m = sbr->f_table_noise[i]; m < sbr->f_table_noise[i+1]; m++)
+            {
+                uint8_t k;
+
+                adj->Q_mapped[m - sbr->kx][l] = 0;
+
+                for (k = 0; k < 2; k++)
+                {
+                    if ((sbr->t_E[ch][l] >= sbr->t_Q[ch][k]) &&
+                        (sbr->t_E[ch][l+1] <= sbr->t_Q[ch][k+1]))
+                    {
+                        adj->Q_mapped[m - sbr->kx][l] =
+                            sbr->Q_orig[ch][i][k];
+                    }
+                }
+            }
+        }
+    }
+}
+
+static void map_sinusoids(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
+{
+    uint8_t l, i, m, k, k1, k2, delta_S, l_i, u_i;
+
+    if (sbr->bs_frame_class[ch] == FIXFIX)
+    {
+        sbr->l_A[ch] = -1;
+    } 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;
+                }
+            }
+        }
+    }
+
+    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[MAX_NTSRHFG][64], 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 + sbr->tHFAdj; i < u_i + sbr->tHFAdj; i++)
+                {
+                    nrg += MUL_R(QMF_RE(Xsbr[i][m + sbr->kx]), QMF_RE(Xsbr[i][m + sbr->kx]))
+#ifndef SBR_LOW_POWER
+                        + MUL_R(QMF_IM(Xsbr[i][m + sbr->kx]), QMF_IM(Xsbr[i][m + sbr->kx]))
+#endif
+                        ;
+                }
+
+                sbr->E_curr[ch][m][l] = nrg / div;
+#ifdef SBR_LOW_POWER
+                sbr->E_curr[ch][m][l] *= 2;
+#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));
+
+                    for (i = l_i + sbr->tHFAdj; i < u_i + sbr->tHFAdj; i++)
+                    {
+                        for (j = k_l; j < k_h; j++)
+                        {
+                            nrg += MUL_R(QMF_RE(Xsbr[i][j]), QMF_RE(Xsbr[i][j]))
+#ifndef SBR_LOW_POWER
+                                + MUL_R(QMF_IM(Xsbr[i][j]), QMF_IM(Xsbr[i][j]))
+#endif
+                                ;
+                        }
+                    }
+
+                    sbr->E_curr[ch][k - sbr->kx][l] = nrg / div;
+#ifdef SBR_LOW_POWER
+                    sbr->E_curr[ch][k - sbr->kx][l] *= 2;
+#endif
+                }
+            }
+        }
+    }
+}
+
+#define EPS (1e-12)
+
+#define ONE (1)
+
+
+static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
+{
+    static real_t limGain[] = { 0.5, 1.0, 2.0, 1e10 };
+    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);
+
+            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]);
+                Q_M = sbr->E_orig[ch][table_map_res_to_m[m]][l] * div2;
+
+                /* 12-Nov: Changed S_mapped to S_index_mapped */
+                if (adj->S_index_mapped[m][l] == 0)
+                {
+                    S_M[m] = 0;
+                } else {
+                    real_t div;
+
+                    div = adj->S_index_mapped[m][l] / (1. + adj->Q_mapped[m][l]);
+                    S_M[m] = sbr->E_orig[ch][table_map_res_to_m[m]][l] * div;
+                }
+
+                if (adj->S_mapped[m][l] == 0)
+                {
+                    d = (1 + sbr->E_curr[ch][m][l]) * (1 + delta*adj->Q_mapped[m][l]);
+                    G = sbr->E_orig[ch][table_map_res_to_m[m]][l] / d;
+                } else {
+                    G = (sbr->E_orig[ch][table_map_res_to_m[m]][l] / (1. + sbr->E_curr[ch][m][l])) * div2;
+                }
+
+                /* 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;
+                }
+
+                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];
+            }
+
+            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;
+            }
+        }
+    }
+}
+
+#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_R(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
+                G_target = E_total / (E_total_est + EPS);
+            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_R(alpha, G_target) +
+                    MUL_R((REAL_CONST(1)-alpha), adj->G_lim_boost[l][m-sbr->kx]);
+
+                /* acc: integer */
+                acc += MUL_R(adj->G_lim_boost[l][m-sbr->kx], sbr->E_curr[ch][m-sbr->kx][l]);
+            }
+
+            /* acc: fixed point */
+            if (acc + EPS == 0)
+                acc = 0;
+            else
+                acc = E_total / (acc + EPS);
+            for(m = sbr->f_group[l][(k<<1)]; m < sbr->f_group[l][(k<<1) + 1]; m++)
+            {
+                adj->G_lim_boost[l][m-sbr->kx] = MUL_R(acc, adj->G_lim_boost[l][m-sbr->kx]);
+            }
+        }
+    }
+
+    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++)
+            {
+                 adj->G_lim_boost[l][m] = sqrt(adj->G_lim_boost[l][m]);
+            }
+        }
+    }
+}
+#endif
+
+static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj,
+                        qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch)
+{
+    static real_t h_smooth[] = {
+        COEF_CONST(0.03183050093751), COEF_CONST(0.11516383427084),
+        COEF_CONST(0.21816949906249), COEF_CONST(0.30150283239582),
+        COEF_CONST(0.33333333333333)
+    };
+    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_C(sbr->G_temp_prev[ch][n][m], h_smooth[j]);
+                        Q_filt += MUL_C(sbr->Q_temp_prev[ch][n][m], h_smooth[j]);
+                        j++;
+                    }
+                } 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;
+
+                /* add noise to the output */
+                fIndexNoise = (fIndexNoise + 1) & 511;
+
+                /* the smoothed gain values are applied to Xsbr */
+                /* V is defined, not calculated */
+                QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]))
+                    + MUL_F(Q_filt, RE(V[fIndexNoise]));
+                if (sbr->bs_extension_id == 3 && sbr->bs_extension_data == 42)
+                    QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = 16428320;
+#ifndef SBR_LOW_POWER
+                QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]))
+                    + MUL_F(Q_filt, IM(V[fIndexNoise]));
+#endif
+
+
+                if (adj->S_index_mapped[m][l])
+                {
+                    int8_t rev = ((m + sbr->kx) & 1) ? -1 : 1;
+                    QMF_RE(psi) = MUL_R(adj->S_M_boost[l][m], phi_re[fIndexSine]);
+                    QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += QMF_RE(psi);
+
+#ifndef SBR_LOW_POWER
+                    QMF_IM(psi) = rev * MUL_R(adj->S_M_boost[l][m], phi_im[fIndexSine]);
+                    QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += QMF_IM(psi);
+#else
+                    i_min1 = (fIndexSine - 1) & 3;
+                    i_plus1 = (fIndexSine + 1) & 3;
+
+                    if (m == 0)
+                    {
+                        QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) -=
+                            (rev * MUL_C(MUL_R(adj->S_M_boost[l][0], phi_re[i_plus1]), COEF_CONST(0.00815)));
+                        QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+                            (rev * MUL_C(MUL_R(adj->S_M_boost[l][1], phi_re[i_plus1]), COEF_CONST(0.00815)));
+                    }
+                    if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16))
+                    {
+                        QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+                            (rev * MUL_C(MUL_R(adj->S_M_boost[l][m - 1], phi_re[i_min1]), COEF_CONST(0.00815)));
+                        QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+                            (rev * MUL_C(MUL_R(adj->S_M_boost[l][m + 1], phi_re[i_plus1]), COEF_CONST(0.00815)));
+                    }
+                    if ((m == sbr->M - 1) && (sinusoids < 16) && (m + sbr->kx + 1 < 63))
+                    {
+                        QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+                            (rev * MUL_C(MUL_R(adj->S_M_boost[l][m - 1], phi_re[i_min1]), COEF_CONST(0.00815)));
+                        QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) -=
+                            (rev * MUL_C(MUL_R(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/Input/aac/libfaad2/sbr_hfadj.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.7 2003/11/12 20:47:58 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[MAX_NTSRHFG][64]
+#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[MAX_NTSRHFG][64], uint8_t ch);
+static void additional_component_levels(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch);
+static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch);
+#ifdef SBR_LOW_POWER
+static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch);
+static void aliasing_reduction(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch);
+#endif
+static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj, qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/sbr_hfgen.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,508 @@
+/*
+** 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.10 2003/11/12 20:47:58 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, const qmf_t Xlow[MAX_NTSRHFG][32],
+                   qmf_t Xhigh[MAX_NTSRHFG][64]
+#ifdef SBR_LOW_POWER
+                   ,real_t *deg
+#endif
+                   ,uint8_t ch)
+{
+    uint8_t l, i, x;
+    uint8_t offset, first, last;
+    complex_t alpha_0[64], alpha_1[64];
+#ifdef SBR_LOW_POWER
+    real_t rxx[64];
+#endif
+
+#ifdef DRM
+    if (sbr->Is_DRM_SBR)
+    {
+        offset = sbr->tHFGen;
+        first = 0;
+        last = sbr->numTimeSlotsRate;
+    } else
+#endif
+    {
+        offset = sbr->tHFAdj;
+        first = sbr->t_E[ch][0];
+        last = sbr->t_E[ch][sbr->L_E[ch]];
+    }
+
+    calc_chirp_factors(sbr, ch);
+
+    for (i = first; i < last; i++)
+    {
+        memset(Xhigh[i + offset], 0, 64 * sizeof(qmf_t));
+    }
+
+    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(bw, bw);
+
+
+            /* do the patching */
+            /* with or without filtering */
+            if (bw2 > 0)
+            {
+                RE(a0) = MUL_C(RE(alpha_0[p]), bw);
+                RE(a1) = MUL_C(RE(alpha_1[p]), bw2);
+#ifndef SBR_LOW_POWER
+                IM(a0) = MUL_C(IM(alpha_0[p]), bw);
+                IM(a1) = MUL_C(IM(alpha_1[p]), bw2);
+#endif
+
+				for (l = first; l < last; l++)
+                {
+                    QMF_RE(Xhigh[l + offset][k]) = QMF_RE(Xlow[l + offset][p]);
+#ifndef SBR_LOW_POWER
+                    QMF_IM(Xhigh[l + offset][k]) = QMF_IM(Xlow[l + offset][p]);
+#endif
+
+#ifdef SBR_LOW_POWER
+                    QMF_RE(Xhigh[l + offset][k]) += (
+                        MUL_R(RE(a0), QMF_RE(Xlow[l - 1 + offset][p])) +
+                        MUL_R(RE(a1), QMF_RE(Xlow[l - 2 + offset][p])));
+#else
+                    QMF_RE(Xhigh[l + offset][k]) += (
+                        RE(a0) * QMF_RE(Xlow[l - 1 + offset][p]) -
+                        IM(a0) * QMF_IM(Xlow[l - 1 + offset][p]) +
+                        RE(a1) * QMF_RE(Xlow[l - 2 + offset][p]) -
+                        IM(a1) * QMF_IM(Xlow[l - 2 + offset][p]));
+                    QMF_IM(Xhigh[l + offset][k]) += (
+                        IM(a0) * QMF_RE(Xlow[l - 1 + offset][p]) +
+                        RE(a0) * QMF_IM(Xlow[l - 1 + offset][p]) +
+                        IM(a1) * QMF_RE(Xlow[l - 2 + offset][p]) +
+                        RE(a1) * QMF_IM(Xlow[l - 2 + offset][p]));
+#endif
+                }
+            } else {
+                for (l = first; l < last; l++)
+                {
+                    QMF_RE(Xhigh[l + offset][k]) = QMF_RE(Xlow[l + offset][p]);
+#ifndef SBR_LOW_POWER
+                    QMF_IM(Xhigh[l + offset][k]) = QMF_IM(Xlow[l + offset][p]);
+#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)
+
+#ifdef SBR_LOW_POWER
+static void auto_correlation(sbr_info *sbr, acorr_coef *ac,
+                             const qmf_t buffer[MAX_NTSRHFG][32],
+                             uint8_t bd, uint8_t len)
+{
+    real_t r01 = 0, r02 = 0, r11 = 0;
+    int8_t j;
+    uint8_t offset;
+    const real_t rel = 1 / (1 + 1e-6f);
+
+#ifdef DRM
+    if (sbr->Is_DRM_SBR)
+        offset = sbr->tHFGen;
+    else
+#endif
+    {
+        offset = sbr->tHFAdj;
+    }
+
+    for (j = offset; j < len + offset; j++)
+    {
+        RE(ac->r01) += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-1][bd]);
+        RE(ac->r02) += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-2][bd]);
+        RE(ac->r11) += QMF_RE(buffer[j-1][bd]) * QMF_RE(buffer[j-1][bd]);
+    }
+    RE(ac->r12) = r01 -
+        QMF_RE(buffer[len+offset-1][bd]) * QMF_RE(buffer[len+offset-2][bd]) +
+        QMF_RE(buffer[offset-1][bd]) * QMF_RE(buffer[offset-2][bd]);
+    RE(ac->r22) = r11 -
+        QMF_RE(buffer[len+offset-2][bd]) * QMF_RE(buffer[len+offset-2][bd]) +
+        QMF_RE(buffer[offset-2][bd]) * QMF_RE(buffer[offset-2][bd]);
+    RE(ac->r01) = r01;
+    RE(ac->r02) = r02;
+    RE(ac->r11) = r11;
+
+    ac->det = MUL_R(RE(ac->r11), RE(ac->r22)) - MUL_C(MUL_R(RE(ac->r12), RE(ac->r12)), rel);
+}
+#else
+static void auto_correlation(sbr_info *sbr, acorr_coef *ac, const qmf_t buffer[MAX_NTSRHFG][32],
+                             uint8_t bd, uint8_t len)
+{
+    real_t r01r = 0, r01i = 0, r02r = 0, r02i = 0, r11r = 0;
+    const real_t rel = 1 / (1 + 1e-6f);
+    int8_t j;
+    uint8_t offset;
+
+#ifdef DRM
+    if (sbr->Is_DRM_SBR)
+        offset = sbr->tHFGen;
+    else
+#endif
+    {
+        offset = sbr->tHFAdj;
+    }
+
+    for (j = offset; j < len + offset; j++)
+    {
+        r01r += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-1][bd]) +
+            QMF_IM(buffer[j][bd]) * QMF_IM(buffer[j-1][bd]);
+        r01i += QMF_IM(buffer[j][bd]) * QMF_RE(buffer[j-1][bd]) -
+            QMF_RE(buffer[j][bd]) * QMF_IM(buffer[j-1][bd]);
+        r02r += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-2][bd]) +
+            QMF_IM(buffer[j][bd]) * QMF_IM(buffer[j-2][bd]);
+        r02i += QMF_IM(buffer[j][bd]) * QMF_RE(buffer[j-2][bd]) -
+            QMF_RE(buffer[j][bd]) * QMF_IM(buffer[j-2][bd]);
+        r11r += QMF_RE(buffer[j-1][bd]) * QMF_RE(buffer[j-1][bd]) +
+            QMF_IM(buffer[j-1][bd]) * QMF_IM(buffer[j-1][bd]);
+    }
+
+    RE(ac->r01) = r01r;
+    IM(ac->r01) = r01i;
+    RE(ac->r02) = r02r;
+    IM(ac->r02) = r02i;
+    RE(ac->r11) = r11r;
+
+    RE(ac->r12) = r01r -
+        (QMF_RE(buffer[len+offset-1][bd]) * QMF_RE(buffer[len+offset-2][bd]) + QMF_IM(buffer[len+offset-1][bd]) * QMF_IM(buffer[len+offset-2][bd])) +
+        (QMF_RE(buffer[offset-1][bd]) * QMF_RE(buffer[offset-2][bd]) + QMF_IM(buffer[offset-1][bd]) * QMF_IM(buffer[offset-2][bd]));
+    IM(ac->r12) = r01i -
+        (QMF_IM(buffer[len+offset-1][bd]) * QMF_RE(buffer[len+offset-2][bd]) - QMF_RE(buffer[len+offset-1][bd]) * QMF_IM(buffer[len+offset-2][bd])) +
+        (QMF_IM(buffer[offset-1][bd]) * QMF_RE(buffer[offset-2][bd]) - QMF_RE(buffer[offset-1][bd]) * QMF_IM(buffer[offset-2][bd]));
+    RE(ac->r22) = r11r -
+        (QMF_RE(buffer[len+offset-2][bd]) * QMF_RE(buffer[len+offset-2][bd]) + QMF_IM(buffer[len+offset-2][bd]) * QMF_IM(buffer[len+offset-2][bd])) +
+        (QMF_RE(buffer[offset-2][bd]) * QMF_RE(buffer[offset-2][bd]) + QMF_IM(buffer[offset-2][bd]) * QMF_IM(buffer[offset-2][bd]));
+
+    ac->det = RE(ac->r11) * RE(ac->r22) - rel * (RE(ac->r12) * RE(ac->r12) + IM(ac->r12) * IM(ac->r12));
+}
+#endif
+
+/* calculate linear prediction coefficients using the covariance method */
+static void calc_prediction_coef(sbr_info *sbr, const qmf_t Xlow[MAX_NTSRHFG][32],
+                                 complex_t *alpha_0, complex_t *alpha_1
+#ifdef SBR_LOW_POWER
+                                 , real_t *rxx
+#endif
+                                 )
+{
+    uint8_t k;
+    real_t tmp;
+    acorr_coef ac;
+
+    for (k = 1; k < sbr->f_master[0]; k++)
+    {
+#ifdef DRM
+        if (sbr->Is_DRM_SBR)
+            auto_correlation(sbr, &ac, Xlow, k, 30);
+        else
+#endif
+        {
+            auto_correlation(sbr, &ac, Xlow, k, 38);
+        }
+
+#ifdef SBR_LOW_POWER
+        if (ac.det == 0)
+        {
+            RE(alpha_1[k]) = 0;
+        } else {
+            tmp = MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11));
+            RE(alpha_1[k]) = SBR_DIV(tmp, ac.det);
+        }
+
+        if (RE(ac.r11) == 0)
+        {
+            RE(alpha_0[k]) = 0;
+        } else {
+            tmp = RE(ac.r01) + MUL_R(RE(alpha_1[k]), RE(ac.r12));
+            RE(alpha_0[k]) = -SBR_DIV(tmp, RE(ac.r11));
+        }
+
+        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 = REAL_CONST(1.0) / ac.det;
+            RE(alpha_1[k]) = (RE(ac.r01) * RE(ac.r12) - IM(ac.r01) * IM(ac.r12) - RE(ac.r02) * RE(ac.r11)) * tmp;
+            IM(alpha_1[k]) = (IM(ac.r01) * RE(ac.r12) + RE(ac.r01) * IM(ac.r12) - IM(ac.r02) * RE(ac.r11)) * tmp;
+        }
+
+        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_R(rxx[k-1], rxx[k-1]);
+                }
+            } else if (rxx[k-2] > REAL_CONST(0.0)) {
+                deg[k]   = REAL_CONST(1.0) - MUL_R(rxx[k-1], rxx[k-1]);
+            }
+        }
+
+        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_R(rxx[k-1], rxx[k-1]);
+                }
+            } else if (rxx[k-2] < REAL_CONST(0.0)) {
+                deg[k] = REAL_CONST(1.0) - MUL_R(rxx[k-1], rxx[k-1]);
+            }
+        }
+    }
+}
+#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(COEF_CONST(0.75), sbr->bwArray[ch][i]) + MUL_C(COEF_CONST(0.25), sbr->bwArray_prev[ch][i]);
+        else
+            sbr->bwArray[ch][i] = MUL_C(COEF_CONST(0.90625), sbr->bwArray[ch][i]) + MUL_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;
+    uint8_t goalSb = (uint8_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 (sbr->f_master[k] - sb < 3)
+            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/Input/aac/libfaad2/sbr_hfgen.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.8 2003/11/12 20:47:58 menno Exp $
+**/
+
+#ifndef __SBR_HFGEN_H__
+#define __SBR_HFGEN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void hf_generation(sbr_info *sbr, const qmf_t Xlow[MAX_NTSRHFG][32],
+                   qmf_t Xhigh[MAX_NTSRHFG][64]
+#ifdef SBR_LOW_POWER
+                   ,real_t *deg
+#endif
+                   ,uint8_t ch);
+
+static void calc_prediction_coef(sbr_info *sbr, const qmf_t Xlow[MAX_NTSRHFG][32],
+                                 complex_t *alpha_0, complex_t *alpha_1
+#ifdef SBR_LOW_POWER
+                                 , real_t *rxx
+#endif
+                                 );
+static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg);
+static void calc_chirp_factors(sbr_info *sbr, uint8_t ch);
+static void patch_construction(sbr_info *sbr);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/sbr_huff.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,365 @@
+/*
+** 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.11 2003/11/12 20:47:58 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SBR_DEC
+
+#include "sbr_syntax.h"
+#include "bits.h"
+#include "sbr_huff.h"
+#include "sbr_e_nf.h"
+
+
+typedef const int8_t (*sbr_huff_tab)[2];
+
+static 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 }
+};
+
+static 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 }
+};
+
+static 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 }
+};
+
+static 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 }
+};
+
+static 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 }
+};
+
+static 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 }
+};
+
+static 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 }
+};
+
+static 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 }
+};
+
+
+static const int8_t t_huffman_noise_3_0dB[62][2] = {
+    { -64,   1 },    { -63,   2 },    { -65,   3 },    { -66,   4 },
+    { -62,   5 },    { -67,   6 },    {   7,   8 },    { -61, -68 },
+    {   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 }
+};
+
+static 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 }
+};
+
+
+INLINE 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;
+}
+
+/* table 10 */
+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;
+
+#ifdef DRM
+    if (sbr->Is_DRM_SBR)
+        sbr->amp_res[ch] = sbr->bs_amp_res;
+    else
+#endif
+    {
+        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);
+            }
+        }
+    }
+
+    extract_envelope_data(sbr, ch);
+}
+
+/* table 11 */
+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);
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/sbr_huff.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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: sbr_huff.h,v 1.11 2003/11/12 20:47:58 menno Exp $
+**/
+
+#ifndef __SBR_HUFF_H__
+#define __SBR_HUFF_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+void sbr_envelope(bitfile *ld, sbr_info *sbr, uint8_t ch);
+void sbr_noise(bitfile *ld, sbr_info *sbr, uint8_t ch);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/sbr_noise.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.7 2003/11/12 20:47:58 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[] = {
+    { FRAC_CONST(-0.99948155879974), FRAC_CONST(-0.59483414888382) },
+    { FRAC_CONST(0.97113454341888), FRAC_CONST(-0.67528516054153) },
+    { FRAC_CONST(0.14130051434040), FRAC_CONST(-0.95090985298157) },
+    { FRAC_CONST(-0.47005495429039), FRAC_CONST(-0.37340548634529) },
+    { FRAC_CONST(0.80705064535141), FRAC_CONST(0.29653668403625) },
+    { FRAC_CONST(-0.38981479406357), FRAC_CONST(0.89572608470917) },
+    { FRAC_CONST(-0.01053049881011), FRAC_CONST(-0.66959059238434) },
+    { FRAC_CONST(-0.91266369819641), FRAC_CONST(-0.11522938311100) },
+    { FRAC_CONST(0.54840421676636), FRAC_CONST(0.75221365690231) },
+    { FRAC_CONST(0.40009254217148), FRAC_CONST(-0.98929399251938) },
+    { FRAC_CONST(-0.99867975711823), FRAC_CONST(-0.88147068023682) },
+    { FRAC_CONST(-0.95531076192856), FRAC_CONST(0.90908759832382) },
+    { FRAC_CONST(-0.45725932717323), FRAC_CONST(-0.56716322898865) },
+    { FRAC_CONST(-0.72929674386978), FRAC_CONST(-0.98008275032043) },
+    { FRAC_CONST(0.75622802972794), FRAC_CONST(0.20950329303741) },
+    { FRAC_CONST(0.07069442421198), FRAC_CONST(-0.78247898817062) },
+    { FRAC_CONST(0.74496251344681), FRAC_CONST(-0.91169005632401) },
+    { FRAC_CONST(-0.96440184116364), FRAC_CONST(-0.94739919900894) },
+    { FRAC_CONST(0.30424630641937), FRAC_CONST(-0.49438267946243) },
+    { FRAC_CONST(0.66565030813217), FRAC_CONST(0.64652937650681) },
+    { FRAC_CONST(0.91697007417679), FRAC_CONST(0.17514097690582) },
+    { FRAC_CONST(-0.70774918794632), FRAC_CONST(0.52548652887344) },
+    { FRAC_CONST(-0.70051413774490), FRAC_CONST(-0.45340028405190) },
+    { FRAC_CONST(-0.99496513605118), FRAC_CONST(-0.90071910619736) },
+    { FRAC_CONST(0.98164492845535), FRAC_CONST(-0.77463155984879) },
+    { FRAC_CONST(-0.54671579599380), FRAC_CONST(-0.02570928446949) },
+    { FRAC_CONST(-0.01689629070461), FRAC_CONST(0.00287506449968) },
+    { FRAC_CONST(-0.86110347509384), FRAC_CONST(0.42548584938049) },
+    { FRAC_CONST(-0.98892980813980), FRAC_CONST(-0.87881129980087) },
+    { FRAC_CONST(0.51756626367569), FRAC_CONST(0.66926783323288) },
+    { FRAC_CONST(-0.99635028839111), FRAC_CONST(-0.58107727766037) },
+    { FRAC_CONST(-0.99969369173050), FRAC_CONST(0.98369991779327) },
+    { FRAC_CONST(0.55266261100769), FRAC_CONST(0.59449058771133) },
+    { FRAC_CONST(0.34581178426743), FRAC_CONST(0.94879418611526) },
+    { FRAC_CONST(0.62664210796356), FRAC_CONST(-0.74402970075607) },
+    { FRAC_CONST(-0.77149701118469), FRAC_CONST(-0.33883658051491) },
+    { FRAC_CONST(-0.91592246294022), FRAC_CONST(0.03687901422381) },
+    { FRAC_CONST(-0.76285493373871), FRAC_CONST(-0.91371870040894) },
+    { FRAC_CONST(0.79788339138031), FRAC_CONST(-0.93180972337723) },
+    { FRAC_CONST(0.54473078250885), FRAC_CONST(-0.11919206380844) },
+    { FRAC_CONST(-0.85639280080795), FRAC_CONST(0.42429855465889) },
+    { FRAC_CONST(-0.92882400751114), FRAC_CONST(0.27871808409691) },
+    { FRAC_CONST(-0.11708371341228), FRAC_CONST(-0.99800843000412) },
+    { FRAC_CONST(0.21356749534607), FRAC_CONST(-0.90716296434402) },
+    { FRAC_CONST(-0.76191693544388), FRAC_CONST(0.99768120050430) },
+    { FRAC_CONST(0.98111045360565), FRAC_CONST(-0.95854461193085) },
+    { FRAC_CONST(-0.85913270711899), FRAC_CONST(0.95766568183899) },
+    { FRAC_CONST(-0.93307244777679), FRAC_CONST(0.49431759119034) },
+    { FRAC_CONST(0.30485755205154), FRAC_CONST(-0.70540034770966) },
+    { FRAC_CONST(0.85289651155472), FRAC_CONST(0.46766132116318) },
+    { FRAC_CONST(0.91328084468842), FRAC_CONST(-0.99839597940445) },
+    { FRAC_CONST(-0.05890199914575), FRAC_CONST(0.70741826295853) },
+    { FRAC_CONST(0.28398686647415), FRAC_CONST(0.34633556008339) },
+    { FRAC_CONST(0.95258164405823), FRAC_CONST(-0.54893416166306) },
+    { FRAC_CONST(-0.78566324710846), FRAC_CONST(-0.75568538904190) },
+    { FRAC_CONST(-0.95789498090744), FRAC_CONST(-0.20423194766045) },
+    { FRAC_CONST(0.82411158084869), FRAC_CONST(0.96654617786407) },
+    { FRAC_CONST(-0.65185445547104), FRAC_CONST(-0.88734990358353) },
+    { FRAC_CONST(-0.93643605709076), FRAC_CONST(0.99870789051056) },
+    { FRAC_CONST(0.91427159309387), FRAC_CONST(-0.98290503025055) },
+    { FRAC_CONST(-0.70395684242249), FRAC_CONST(0.58796799182892) },
+    { FRAC_CONST(0.00563771976158), FRAC_CONST(0.61768198013306) },
+    { FRAC_CONST(0.89065051078796), FRAC_CONST(0.52783352136612) },
+    { FRAC_CONST(-0.68683707714081), FRAC_CONST(0.80806946754456) },
+    { FRAC_CONST(0.72165340185165), FRAC_CONST(-0.69259858131409) },
+    { FRAC_CONST(-0.62928247451782), FRAC_CONST(0.13627037405968) },
+    { FRAC_CONST(0.29938435554504), FRAC_CONST(-0.46051329374313) },
+    { FRAC_CONST(-0.91781955957413), FRAC_CONST(-0.74012714624405) },
+    { FRAC_CONST(0.99298715591431), FRAC_CONST(0.40816611051559) },
+    { FRAC_CONST(0.82368296384811), FRAC_CONST(-0.74036049842834) },
+    { FRAC_CONST(-0.98512834310532), FRAC_CONST(-0.99972331523895) },
+    { FRAC_CONST(-0.95915371179581), FRAC_CONST(-0.99237799644470) },
+    { FRAC_CONST(-0.21411126852036), FRAC_CONST(-0.93424820899963) },
+    { FRAC_CONST(-0.68821477890015), FRAC_CONST(-0.26892307400703) },
+    { FRAC_CONST(0.91851997375488), FRAC_CONST(0.09358228743076) },
+    { FRAC_CONST(-0.96062767505646), FRAC_CONST(0.36099094152451) },
+    { FRAC_CONST(0.51646184921265), FRAC_CONST(-0.71373331546783) },
+    { FRAC_CONST(0.61130720376968), FRAC_CONST(0.46950140595436) },
+    { FRAC_CONST(0.47336128354073), FRAC_CONST(-0.27333179116249) },
+    { FRAC_CONST(0.90998309850693), FRAC_CONST(0.96715664863586) },
+    { FRAC_CONST(0.44844800233841), FRAC_CONST(0.99211573600769) },
+    { FRAC_CONST(0.66614890098572), FRAC_CONST(0.96590173244476) },
+    { FRAC_CONST(0.74922239780426), FRAC_CONST(-0.89879858493805) },
+    { FRAC_CONST(-0.99571585655212), FRAC_CONST(0.52785521745682) },
+    { FRAC_CONST(0.97401082515717), FRAC_CONST(-0.16855870187283) },
+    { FRAC_CONST(0.72683745622635), FRAC_CONST(-0.48060774803162) },
+    { FRAC_CONST(0.95432192087173), FRAC_CONST(0.68849605321884) },
+    { FRAC_CONST(-0.72962206602097), FRAC_CONST(-0.76608443260193) },
+    { FRAC_CONST(-0.85359477996826), FRAC_CONST(0.88738125562668) },
+    { FRAC_CONST(-0.81412428617477), FRAC_CONST(-0.97480767965317) },
+    { FRAC_CONST(-0.87930774688721), FRAC_CONST(0.74748307466507) },
+    { FRAC_CONST(-0.71573328971863), FRAC_CONST(-0.98570609092712) },
+    { FRAC_CONST(0.83524298667908), FRAC_CONST(0.83702534437180) },
+    { FRAC_CONST(-0.48086065053940), FRAC_CONST(-0.98848503828049) },
+    { FRAC_CONST(0.97139126062393), FRAC_CONST(0.80093622207642) },
+    { FRAC_CONST(0.51992827653885), FRAC_CONST(0.80247628688812) },
+    { FRAC_CONST(-0.00848591234535), FRAC_CONST(-0.76670128107071) },
+    { FRAC_CONST(-0.70294374227524), FRAC_CONST(0.55359911918640) },
+    { FRAC_CONST(-0.95894426107407), FRAC_CONST(-0.43265503644943) },
+    { FRAC_CONST(0.97079253196716), FRAC_CONST(0.09325857460499) },
+    { FRAC_CONST(-0.92404294013977), FRAC_CONST(0.85507702827454) },
+    { FRAC_CONST(-0.69506472349167), FRAC_CONST(0.98633414506912) },
+    { FRAC_CONST(0.26559203863144), FRAC_CONST(0.73314309120178) },
+    { FRAC_CONST(0.28038442134857), FRAC_CONST(0.14537914097309) },
+    { FRAC_CONST(-0.74138122797012), FRAC_CONST(0.99310338497162) },
+    { FRAC_CONST(-0.01752796024084), FRAC_CONST(-0.82616633176804) },
+    { FRAC_CONST(-0.55126774311066), FRAC_CONST(-0.98898541927338) },
+    { FRAC_CONST(0.97960901260376), FRAC_CONST(-0.94021445512772) },
+    { FRAC_CONST(-0.99196308851242), FRAC_CONST(0.67019015550613) },
+    { FRAC_CONST(-0.67684930562973), FRAC_CONST(0.12631492316723) },
+    { FRAC_CONST(0.09140039235353), FRAC_CONST(-0.20537731051445) },
+    { FRAC_CONST(-0.71658962965012), FRAC_CONST(-0.97788202762604) },
+    { FRAC_CONST(0.81014639139175), FRAC_CONST(0.53722649812698) },
+    { FRAC_CONST(0.40616992115974), FRAC_CONST(-0.26469007134438) },
+    { FRAC_CONST(-0.67680186033249), FRAC_CONST(0.94502049684525) },
+    { FRAC_CONST(0.86849772930145), FRAC_CONST(-0.18333598971367) },
+    { FRAC_CONST(-0.99500381946564), FRAC_CONST(-0.02634122036397) },
+    { FRAC_CONST(0.84329187870026), FRAC_CONST(0.10406957566738) },
+    { FRAC_CONST(-0.09215968847275), FRAC_CONST(0.69540011882782) },
+    { FRAC_CONST(0.99956172704697), FRAC_CONST(-0.12358541786671) },
+    { FRAC_CONST(-0.79732781648636), FRAC_CONST(-0.91582524776459) },
+    { FRAC_CONST(0.96349972486496), FRAC_CONST(0.96640455722809) },
+    { FRAC_CONST(-0.79942780733109), FRAC_CONST(0.64323902130127) },
+    { FRAC_CONST(-0.11566039919853), FRAC_CONST(0.28587844967842) },
+    { FRAC_CONST(-0.39922955632210), FRAC_CONST(0.94129604101181) },
+    { FRAC_CONST(0.99089199304581), FRAC_CONST(-0.92062628269196) },
+    { FRAC_CONST(0.28631284832954), FRAC_CONST(-0.91035044193268) },
+    { FRAC_CONST(-0.83302724361420), FRAC_CONST(-0.67330408096313) },
+    { FRAC_CONST(0.95404446125031), FRAC_CONST(0.49162766337395) },
+    { FRAC_CONST(-0.06449863314629), FRAC_CONST(0.03250560909510) },
+    { FRAC_CONST(-0.99575054645538), FRAC_CONST(0.42389783263206) },
+    { FRAC_CONST(-0.65501141548157), FRAC_CONST(0.82546114921570) },
+    { FRAC_CONST(-0.81254440546036), FRAC_CONST(-0.51627236604691) },
+    { FRAC_CONST(-0.99646371603012), FRAC_CONST(0.84490531682968) },
+    { FRAC_CONST(0.00287840608507), FRAC_CONST(0.64768260717392) },
+    { FRAC_CONST(0.70176988840103), FRAC_CONST(-0.20453028380871) },
+    { FRAC_CONST(0.96361881494522), FRAC_CONST(0.40706968307495) },
+    { FRAC_CONST(-0.68883758783340), FRAC_CONST(0.91338956356049) },
+    { FRAC_CONST(-0.34875586628914), FRAC_CONST(0.71472293138504) },
+    { FRAC_CONST(0.91980081796646), FRAC_CONST(0.66507452726364) },
+    { FRAC_CONST(-0.99009048938751), FRAC_CONST(0.85868018865585) },
+    { FRAC_CONST(0.68865793943405), FRAC_CONST(0.55660319328308) },
+    { FRAC_CONST(-0.99484401941299), FRAC_CONST(-0.20052559673786) },
+    { FRAC_CONST(0.94214510917664), FRAC_CONST(-0.99696427583694) },
+    { FRAC_CONST(-0.67414629459381), FRAC_CONST(0.49548220634460) },
+    { FRAC_CONST(-0.47339352965355), FRAC_CONST(-0.85904330015182) },
+    { FRAC_CONST(0.14323651790619), FRAC_CONST(-0.94145596027374) },
+    { FRAC_CONST(-0.29268294572830), FRAC_CONST(0.05759225040674) },
+    { FRAC_CONST(0.43793860077858), FRAC_CONST(-0.78904968500137) },
+    { FRAC_CONST(-0.36345127224922), FRAC_CONST(0.64874434471130) },
+    { FRAC_CONST(-0.08750604838133), FRAC_CONST(0.97686946392059) },
+    { FRAC_CONST(-0.96495270729065), FRAC_CONST(-0.53960305452347) },
+    { FRAC_CONST(0.55526942014694), FRAC_CONST(0.78891521692276) },
+    { FRAC_CONST(0.73538213968277), FRAC_CONST(0.96452075242996) },
+    { FRAC_CONST(-0.30889773368835), FRAC_CONST(-0.80664390325546) },
+    { FRAC_CONST(0.03574995696545), FRAC_CONST(-0.97325617074966) },
+    { FRAC_CONST(0.98720687627792), FRAC_CONST(0.48409134149551) },
+    { FRAC_CONST(-0.81689298152924), FRAC_CONST(-0.90827703475952) },
+    { FRAC_CONST(0.67866861820221), FRAC_CONST(0.81284505128860) },
+    { FRAC_CONST(-0.15808570384979), FRAC_CONST(0.85279554128647) },
+    { FRAC_CONST(0.80723392963409), FRAC_CONST(-0.24717418849468) },
+    { FRAC_CONST(0.47788757085800), FRAC_CONST(-0.46333149075508) },
+    { FRAC_CONST(0.96367555856705), FRAC_CONST(0.38486748933792) },
+    { FRAC_CONST(-0.99143874645233), FRAC_CONST(-0.24945276975632) },
+    { FRAC_CONST(0.83081877231598), FRAC_CONST(-0.94780850410461) },
+    { FRAC_CONST(-0.58753192424774), FRAC_CONST(0.01290772389621) },
+    { FRAC_CONST(0.95538109540939), FRAC_CONST(-0.85557049512863) },
+    { FRAC_CONST(-0.96490919589996), FRAC_CONST(-0.64020973443985) },
+    { FRAC_CONST(-0.97327101230621), FRAC_CONST(0.12378127872944) },
+    { FRAC_CONST(0.91400367021561), FRAC_CONST(0.57972472906113) },
+    { FRAC_CONST(-0.99925839900970), FRAC_CONST(0.71084845066071) },
+    { FRAC_CONST(-0.86875903606415), FRAC_CONST(-0.20291699469090) },
+    { FRAC_CONST(-0.26240035891533), FRAC_CONST(-0.68264555931091) },
+    { FRAC_CONST(-0.24664412438869), FRAC_CONST(-0.87642270326614) },
+    { FRAC_CONST(0.02416275814176), FRAC_CONST(0.27192914485931) },
+    { FRAC_CONST(0.82068622112274), FRAC_CONST(-0.85087788105011) },
+    { FRAC_CONST(0.88547372817993), FRAC_CONST(-0.89636802673340) },
+    { FRAC_CONST(-0.18173077702522), FRAC_CONST(-0.26152145862579) },
+    { FRAC_CONST(0.09355476498604), FRAC_CONST(0.54845124483109) },
+    { FRAC_CONST(-0.54668414592743), FRAC_CONST(0.95980775356293) },
+    { FRAC_CONST(0.37050989270210), FRAC_CONST(-0.59910142421722) },
+    { FRAC_CONST(-0.70373594760895), FRAC_CONST(0.91227668523788) },
+    { FRAC_CONST(-0.34600785374641), FRAC_CONST(-0.99441426992416) },
+    { FRAC_CONST(-0.68774479627609), FRAC_CONST(-0.30238837003708) },
+    { FRAC_CONST(-0.26843291521072), FRAC_CONST(0.83115667104721) },
+    { FRAC_CONST(0.49072334170341), FRAC_CONST(-0.45359709858894) },
+    { FRAC_CONST(0.38975992798805), FRAC_CONST(0.95515358448029) },
+    { FRAC_CONST(-0.97757124900818), FRAC_CONST(0.05305894464254) },
+    { FRAC_CONST(-0.17325553297997), FRAC_CONST(-0.92770671844482) },
+    { FRAC_CONST(0.99948036670685), FRAC_CONST(0.58285546302795) },
+    { FRAC_CONST(-0.64946246147156), FRAC_CONST(0.68645507097244) },
+    { FRAC_CONST(-0.12016920745373), FRAC_CONST(-0.57147324085236) },
+    { FRAC_CONST(-0.58947455883026), FRAC_CONST(-0.34847131371498) },
+    { FRAC_CONST(-0.41815140843391), FRAC_CONST(0.16276422142982) },
+    { FRAC_CONST(0.99885648488998), FRAC_CONST(0.11136095225811) },
+    { FRAC_CONST(-0.56649613380432), FRAC_CONST(-0.90494865179062) },
+    { FRAC_CONST(0.94138020277023), FRAC_CONST(0.35281917452812) },
+    { FRAC_CONST(-0.75725078582764), FRAC_CONST(0.53650552034378) },
+    { FRAC_CONST(0.20541973412037), FRAC_CONST(-0.94435143470764) },
+    { FRAC_CONST(0.99980372190475), FRAC_CONST(0.79835915565491) },
+    { FRAC_CONST(0.29078277945518), FRAC_CONST(0.35393777489662) },
+    { FRAC_CONST(-0.62858772277832), FRAC_CONST(0.38765692710876) },
+    { FRAC_CONST(0.43440905213356), FRAC_CONST(-0.98546332120895) },
+    { FRAC_CONST(-0.98298585414886), FRAC_CONST(0.21021524071693) },
+    { FRAC_CONST(0.19513028860092), FRAC_CONST(-0.94239830970764) },
+    { FRAC_CONST(-0.95476663112640), FRAC_CONST(0.98364555835724) },
+    { FRAC_CONST(0.93379634618759), FRAC_CONST(-0.70881992578506) },
+    { FRAC_CONST(-0.85235410928726), FRAC_CONST(-0.08342348039150) },
+    { FRAC_CONST(-0.86425095796585), FRAC_CONST(-0.45795026421547) },
+    { FRAC_CONST(0.38879778981209), FRAC_CONST(0.97274428606033) },
+    { FRAC_CONST(0.92045122385025), FRAC_CONST(-0.62433654069901) },
+    { FRAC_CONST(0.89162534475327), FRAC_CONST(0.54950958490372) },
+    { FRAC_CONST(-0.36834338307381), FRAC_CONST(0.96458297967911) },
+    { FRAC_CONST(0.93891763687134), FRAC_CONST(-0.89968353509903) },
+    { FRAC_CONST(0.99267655611038), FRAC_CONST(-0.03757034242153) },
+    { FRAC_CONST(-0.94063472747803), FRAC_CONST(0.41332337260246) },
+    { FRAC_CONST(0.99740225076675), FRAC_CONST(-0.16830494999886) },
+    { FRAC_CONST(-0.35899412631989), FRAC_CONST(-0.46633225679398) },
+    { FRAC_CONST(0.05237237364054), FRAC_CONST(-0.25640362501144) },
+    { FRAC_CONST(0.36703583598137), FRAC_CONST(-0.38653266429901) },
+    { FRAC_CONST(0.91653180122375), FRAC_CONST(-0.30587628483772) },
+    { FRAC_CONST(0.69000804424286), FRAC_CONST(0.90952169895172) },
+    { FRAC_CONST(-0.38658750057220), FRAC_CONST(0.99501574039459) },
+    { FRAC_CONST(-0.29250815510750), FRAC_CONST(0.37444993853569) },
+    { FRAC_CONST(-0.60182201862335), FRAC_CONST(0.86779648065567) },
+    { FRAC_CONST(-0.97418588399887), FRAC_CONST(0.96468526124954) },
+    { FRAC_CONST(0.88461571931839), FRAC_CONST(0.57508403062820) },
+    { FRAC_CONST(0.05198933184147), FRAC_CONST(0.21269661188126) },
+    { FRAC_CONST(-0.53499621152878), FRAC_CONST(0.97241556644440) },
+    { FRAC_CONST(-0.49429559707642), FRAC_CONST(0.98183864355087) },
+    { FRAC_CONST(-0.98935145139694), FRAC_CONST(-0.40249159932137) },
+    { FRAC_CONST(-0.98081380128860), FRAC_CONST(-0.72856897115707) },
+    { FRAC_CONST(-0.27338150143623), FRAC_CONST(0.99950921535492) },
+    { FRAC_CONST(0.06310802698135), FRAC_CONST(-0.54539585113525) },
+    { FRAC_CONST(-0.20461677014828), FRAC_CONST(-0.14209978282452) },
+    { FRAC_CONST(0.66223841905594), FRAC_CONST(0.72528582811356) },
+    { FRAC_CONST(-0.84764343500137), FRAC_CONST(0.02372316829860) },
+    { FRAC_CONST(-0.89039862155914), FRAC_CONST(0.88866579532623) },
+    { FRAC_CONST(0.95903307199478), FRAC_CONST(0.76744925975800) },
+    { FRAC_CONST(0.73504126071930), FRAC_CONST(-0.03747203201056) },
+    { FRAC_CONST(-0.31744435429573), FRAC_CONST(-0.36834111809731) },
+    { FRAC_CONST(-0.34110826253891), FRAC_CONST(0.40211221575737) },
+    { FRAC_CONST(0.47803884744644), FRAC_CONST(-0.39423218369484) },
+    { FRAC_CONST(0.98299193382263), FRAC_CONST(0.01989791356027) },
+    { FRAC_CONST(-0.30963072180748), FRAC_CONST(-0.18076720833778) },
+    { FRAC_CONST(0.99992591142654), FRAC_CONST(-0.26281872391701) },
+    { FRAC_CONST(-0.93149733543396), FRAC_CONST(-0.98313164710999) },
+    { FRAC_CONST(0.99923473596573), FRAC_CONST(-0.80142992734909) },
+    { FRAC_CONST(-0.26024168729782), FRAC_CONST(-0.75999760627747) },
+    { FRAC_CONST(-0.35712513327599), FRAC_CONST(0.19298963248730) },
+    { FRAC_CONST(-0.99899083375931), FRAC_CONST(0.74645155668259) },
+    { FRAC_CONST(0.86557173728943), FRAC_CONST(0.55593866109848) },
+    { FRAC_CONST(0.33408042788506), FRAC_CONST(0.86185956001282) },
+    { FRAC_CONST(0.99010735750198), FRAC_CONST(0.04602397605777) },
+    { FRAC_CONST(-0.66694271564484), FRAC_CONST(-0.91643613576889) },
+    { FRAC_CONST(0.64016789197922), FRAC_CONST(0.15649530291557) },
+    { FRAC_CONST(0.99570536613464), FRAC_CONST(0.45844584703445) },
+    { FRAC_CONST(-0.63431465625763), FRAC_CONST(0.21079117059708) },
+    { FRAC_CONST(-0.07706847041845), FRAC_CONST(-0.89581435918808) },
+    { FRAC_CONST(0.98590087890625), FRAC_CONST(0.88241720199585) },
+    { FRAC_CONST(0.80099332332611), FRAC_CONST(-0.36851897835732) },
+    { FRAC_CONST(0.78368133306503), FRAC_CONST(0.45506998896599) },
+    { FRAC_CONST(0.08707806468010), FRAC_CONST(0.80938994884491) },
+    { FRAC_CONST(-0.86811882257462), FRAC_CONST(0.39347308874130) },
+    { FRAC_CONST(-0.39466530084610), FRAC_CONST(-0.66809433698654) },
+    { FRAC_CONST(0.97875326871872), FRAC_CONST(-0.72467839717865) },
+    { FRAC_CONST(-0.95038563013077), FRAC_CONST(0.89563220739365) },
+    { FRAC_CONST(0.17005239427090), FRAC_CONST(0.54683053493500) },
+    { FRAC_CONST(-0.76910793781281), FRAC_CONST(-0.96226614713669) },
+    { FRAC_CONST(0.99743282794952), FRAC_CONST(0.42697158455849) },
+    { FRAC_CONST(0.95437383651733), FRAC_CONST(0.97002321481705) },
+    { FRAC_CONST(0.99578905105591), FRAC_CONST(-0.54106825590134) },
+    { FRAC_CONST(0.28058260679245), FRAC_CONST(-0.85361421108246) },
+    { FRAC_CONST(0.85256522893906), FRAC_CONST(-0.64567607641220) },
+    { FRAC_CONST(-0.50608539581299), FRAC_CONST(-0.65846014022827) },
+    { FRAC_CONST(-0.97210735082626), FRAC_CONST(-0.23095212876797) },
+    { FRAC_CONST(0.95424050092697), FRAC_CONST(-0.99240148067474) },
+    { FRAC_CONST(-0.96926569938660), FRAC_CONST(0.73775655031204) },
+    { FRAC_CONST(0.30872163176537), FRAC_CONST(0.41514959931374) },
+    { FRAC_CONST(-0.24523839354515), FRAC_CONST(0.63206630945206) },
+    { FRAC_CONST(-0.33813264966011), FRAC_CONST(-0.38661777973175) },
+    { FRAC_CONST(-0.05826828256249), FRAC_CONST(-0.06940773874521) },
+    { FRAC_CONST(-0.22898460924625), FRAC_CONST(0.97054851055145) },
+    { FRAC_CONST(-0.18509915471077), FRAC_CONST(0.47565764188766) },
+    { FRAC_CONST(-0.10488238185644), FRAC_CONST(-0.87769949436188) },
+    { FRAC_CONST(-0.71886587142944), FRAC_CONST(0.78030979633331) },
+    { FRAC_CONST(0.99793875217438), FRAC_CONST(0.90041309595108) },
+    { FRAC_CONST(0.57563304901123), FRAC_CONST(-0.91034334897995) },
+    { FRAC_CONST(0.28909647464752), FRAC_CONST(0.96307784318924) },
+    { FRAC_CONST(0.42188999056816), FRAC_CONST(0.48148649930954) },
+    { FRAC_CONST(0.93335050344467), FRAC_CONST(-0.43537023663521) },
+    { FRAC_CONST(-0.97087377309799), FRAC_CONST(0.86636447906494) },
+    { FRAC_CONST(0.36722871661186), FRAC_CONST(0.65291655063629) },
+    { FRAC_CONST(-0.81093025207520), FRAC_CONST(0.08778370171785) },
+    { FRAC_CONST(-0.26240602135658), FRAC_CONST(-0.92774093151093) },
+    { FRAC_CONST(0.83996498584747), FRAC_CONST(0.55839848518372) },
+    { FRAC_CONST(-0.99909615516663), FRAC_CONST(-0.96024608612061) },
+    { FRAC_CONST(0.74649465084076), FRAC_CONST(0.12144893407822) },
+    { FRAC_CONST(-0.74774593114853), FRAC_CONST(-0.26898062229156) },
+    { FRAC_CONST(0.95781666040421), FRAC_CONST(-0.79047924280167) },
+    { FRAC_CONST(0.95472306013107), FRAC_CONST(-0.08588775992393) },
+    { FRAC_CONST(0.48708331584930), FRAC_CONST(0.99999040365219) },
+    { FRAC_CONST(0.46332037448883), FRAC_CONST(0.10964126139879) },
+    { FRAC_CONST(-0.76497006416321), FRAC_CONST(0.89210927486420) },
+    { FRAC_CONST(0.57397389411926), FRAC_CONST(0.35289704799652) },
+    { FRAC_CONST(0.75374317169189), FRAC_CONST(0.96705216169357) },
+    { FRAC_CONST(-0.59174400568008), FRAC_CONST(-0.89405369758606) },
+    { FRAC_CONST(0.75087904930115), FRAC_CONST(-0.29612672328949) },
+    { FRAC_CONST(-0.98607856035233), FRAC_CONST(0.25034910440445) },
+    { FRAC_CONST(-0.40761056542397), FRAC_CONST(-0.90045571327209) },
+    { FRAC_CONST(0.66929268836975), FRAC_CONST(0.98629492521286) },
+    { FRAC_CONST(-0.97463697195053), FRAC_CONST(-0.00190223299433) },
+    { FRAC_CONST(0.90145510435104), FRAC_CONST(0.99781388044357) },
+    { FRAC_CONST(-0.87259286642075), FRAC_CONST(0.99233585596085) },
+    { FRAC_CONST(-0.91529458761215), FRAC_CONST(-0.15698707103729) },
+    { FRAC_CONST(-0.03305738791823), FRAC_CONST(-0.37205263972282) },
+    { FRAC_CONST(0.07223051041365), FRAC_CONST(-0.88805001974106) },
+    { FRAC_CONST(0.99498009681702), FRAC_CONST(0.97094357013702) },
+    { FRAC_CONST(-0.74904936552048), FRAC_CONST(0.99985486268997) },
+    { FRAC_CONST(0.04585228487849), FRAC_CONST(0.99812334775925) },
+    { FRAC_CONST(-0.89054954051971), FRAC_CONST(-0.31791913509369) },
+    { FRAC_CONST(-0.83782142400742), FRAC_CONST(0.97637635469437) },
+    { FRAC_CONST(0.33454805612564), FRAC_CONST(-0.86231517791748) },
+    { FRAC_CONST(-0.99707579612732), FRAC_CONST(0.93237990140915) },
+    { FRAC_CONST(-0.22827528417110), FRAC_CONST(0.18874759972095) },
+    { FRAC_CONST(0.67248046398163), FRAC_CONST(-0.03646211326122) },
+    { FRAC_CONST(-0.05146538093686), FRAC_CONST(-0.92599701881409) },
+    { FRAC_CONST(0.99947297573090), FRAC_CONST(0.93625229597092) },
+    { FRAC_CONST(0.66951125860214), FRAC_CONST(0.98905825614929) },
+    { FRAC_CONST(-0.99602955579758), FRAC_CONST(-0.44654715061188) },
+    { FRAC_CONST(0.82104903459549), FRAC_CONST(0.99540740251541) },
+    { FRAC_CONST(0.99186509847641), FRAC_CONST(0.72022998332977) },
+    { FRAC_CONST(-0.65284591913223), FRAC_CONST(0.52186721563339) },
+    { FRAC_CONST(0.93885445594788), FRAC_CONST(-0.74895310401917) },
+    { FRAC_CONST(0.96735250949860), FRAC_CONST(0.90891814231873) },
+    { FRAC_CONST(-0.22225968539715), FRAC_CONST(0.57124030590057) },
+    { FRAC_CONST(-0.44132784008980), FRAC_CONST(-0.92688840627670) },
+    { FRAC_CONST(-0.85694974660873), FRAC_CONST(0.88844531774521) },
+    { FRAC_CONST(0.91783040761948), FRAC_CONST(-0.46356892585754) },
+    { FRAC_CONST(0.72556972503662), FRAC_CONST(-0.99899554252625) },
+    { FRAC_CONST(-0.99711579084396), FRAC_CONST(0.58211559057236) },
+    { FRAC_CONST(0.77638977766037), FRAC_CONST(0.94321835041046) },
+    { FRAC_CONST(0.07717324048281), FRAC_CONST(0.58638399839401) },
+    { FRAC_CONST(-0.56049829721451), FRAC_CONST(0.82522302865982) },
+    { FRAC_CONST(0.98398894071579), FRAC_CONST(0.39467439055443) },
+    { FRAC_CONST(0.47546947002411), FRAC_CONST(0.68613046407700) },
+    { FRAC_CONST(0.65675091743469), FRAC_CONST(0.18331636488438) },
+    { FRAC_CONST(0.03273375332355), FRAC_CONST(-0.74933111667633) },
+    { FRAC_CONST(-0.38684144616127), FRAC_CONST(0.51337349414825) },
+    { FRAC_CONST(-0.97346270084381), FRAC_CONST(-0.96549361944199) },
+    { FRAC_CONST(-0.53282153606415), FRAC_CONST(-0.91423267126083) },
+    { FRAC_CONST(0.99817311763763), FRAC_CONST(0.61133575439453) },
+    { FRAC_CONST(-0.50254499912262), FRAC_CONST(-0.88829338550568) },
+    { FRAC_CONST(0.01995873264968), FRAC_CONST(0.85223513841629) },
+    { FRAC_CONST(0.99930381774902), FRAC_CONST(0.94578897953033) },
+    { FRAC_CONST(0.82907766103745), FRAC_CONST(-0.06323442608118) },
+    { FRAC_CONST(-0.58660709857941), FRAC_CONST(0.96840775012970) },
+    { FRAC_CONST(-0.17573736608028), FRAC_CONST(-0.48166921734810) },
+    { FRAC_CONST(0.83434289693832), FRAC_CONST(-0.13023450970650) },
+    { FRAC_CONST(0.05946491286159), FRAC_CONST(0.20511047542095) },
+    { FRAC_CONST(0.81505483388901), FRAC_CONST(-0.94685947895050) },
+    { FRAC_CONST(-0.44976380467415), FRAC_CONST(0.40894573926926) },
+    { FRAC_CONST(-0.89746475219727), FRAC_CONST(0.99846577644348) },
+    { FRAC_CONST(0.39677256345749), FRAC_CONST(-0.74854665994644) },
+    { FRAC_CONST(-0.07588948309422), FRAC_CONST(0.74096214771271) },
+    { FRAC_CONST(0.76343196630478), FRAC_CONST(0.41746628284454) },
+    { FRAC_CONST(-0.74490106105804), FRAC_CONST(0.94725912809372) },
+    { FRAC_CONST(0.64880120754242), FRAC_CONST(0.41336661577225) },
+    { FRAC_CONST(0.62319535017014), FRAC_CONST(-0.93098312616348) },
+    { FRAC_CONST(0.42215818166733), FRAC_CONST(-0.07712787389755) },
+    { FRAC_CONST(0.02704554051161), FRAC_CONST(-0.05417517945170) },
+    { FRAC_CONST(0.80001771450043), FRAC_CONST(0.91542196273804) },
+    { FRAC_CONST(-0.79351830482483), FRAC_CONST(-0.36208897829056) },
+    { FRAC_CONST(0.63872361183167), FRAC_CONST(0.08128252625465) },
+    { FRAC_CONST(0.52890521287918), FRAC_CONST(0.60048872232437) },
+    { FRAC_CONST(0.74238550662994), FRAC_CONST(0.04491915181279) },
+    { FRAC_CONST(0.99096131324768), FRAC_CONST(-0.19451183080673) },
+    { FRAC_CONST(-0.80412328243256), FRAC_CONST(-0.88513815402985) },
+    { FRAC_CONST(-0.64612615108490), FRAC_CONST(0.72198677062988) },
+    { FRAC_CONST(0.11657770723104), FRAC_CONST(-0.83662831783295) },
+    { FRAC_CONST(-0.95053184032440), FRAC_CONST(-0.96939903497696) },
+    { FRAC_CONST(-0.62228870391846), FRAC_CONST(0.82767260074615) },
+    { FRAC_CONST(0.03004475869238), FRAC_CONST(-0.99738895893097) },
+    { FRAC_CONST(-0.97987216711044), FRAC_CONST(0.36526128649712) },
+    { FRAC_CONST(-0.99986982345581), FRAC_CONST(-0.36021611094475) },
+    { FRAC_CONST(0.89110648632050), FRAC_CONST(-0.97894251346588) },
+    { FRAC_CONST(0.10407960414886), FRAC_CONST(0.77357792854309) },
+    { FRAC_CONST(0.95964735746384), FRAC_CONST(-0.35435819625854) },
+    { FRAC_CONST(0.50843232870102), FRAC_CONST(0.96107691526413) },
+    { FRAC_CONST(0.17006334662437), FRAC_CONST(-0.76854026317596) },
+    { FRAC_CONST(0.25872674584389), FRAC_CONST(0.99893301725388) },
+    { FRAC_CONST(-0.01115998718888), FRAC_CONST(0.98496019840240) },
+    { FRAC_CONST(-0.79598701000214), FRAC_CONST(0.97138410806656) },
+    { FRAC_CONST(-0.99264711141586), FRAC_CONST(-0.99542820453644) },
+    { FRAC_CONST(-0.99829661846161), FRAC_CONST(0.01877138763666) },
+    { FRAC_CONST(-0.70801013708115), FRAC_CONST(0.33680686354637) },
+    { FRAC_CONST(-0.70467054843903), FRAC_CONST(0.93272775411606) },
+    { FRAC_CONST(0.99846023321152), FRAC_CONST(-0.98725748062134) },
+    { FRAC_CONST(-0.63364970684052), FRAC_CONST(-0.16473594307899) },
+    { FRAC_CONST(-0.16258217394352), FRAC_CONST(-0.95939123630524) },
+    { FRAC_CONST(-0.43645593523979), FRAC_CONST(-0.94805032014847) },
+    { FRAC_CONST(-0.99848473072052), FRAC_CONST(0.96245169639587) },
+    { FRAC_CONST(-0.16796459257603), FRAC_CONST(-0.98987513780594) },
+    { FRAC_CONST(-0.87979227304459), FRAC_CONST(-0.71725726127625) },
+    { FRAC_CONST(0.44183099269867), FRAC_CONST(-0.93568974733353) },
+    { FRAC_CONST(0.93310177326202), FRAC_CONST(-0.99913311004639) },
+    { FRAC_CONST(-0.93941932916641), FRAC_CONST(-0.56409376859665) },
+    { FRAC_CONST(-0.88590002059937), FRAC_CONST(0.47624599933624) },
+    { FRAC_CONST(0.99971461296082), FRAC_CONST(-0.83889955282211) },
+    { FRAC_CONST(-0.75376385450363), FRAC_CONST(0.00814643409103) },
+    { FRAC_CONST(0.93887686729431), FRAC_CONST(-0.11284527927637) },
+    { FRAC_CONST(0.85126435756683), FRAC_CONST(0.52349251508713) },
+    { FRAC_CONST(0.39701420068741), FRAC_CONST(0.81779634952545) },
+    { FRAC_CONST(-0.37024465203285), FRAC_CONST(-0.87071657180786) },
+    { FRAC_CONST(-0.36024826765060), FRAC_CONST(0.34655734896660) },
+    { FRAC_CONST(-0.93388813734055), FRAC_CONST(-0.84476542472839) },
+    { FRAC_CONST(-0.65298801660538), FRAC_CONST(-0.18439576029778) },
+    { FRAC_CONST(0.11960318684578), FRAC_CONST(0.99899345636368) },
+    { FRAC_CONST(0.94292563199997), FRAC_CONST(0.83163905143738) },
+    { FRAC_CONST(0.75081145763397), FRAC_CONST(-0.35533222556114) },
+    { FRAC_CONST(0.56721979379654), FRAC_CONST(-0.24076835811138) },
+    { FRAC_CONST(0.46857765316963), FRAC_CONST(-0.30140233039856) },
+    { FRAC_CONST(0.97312313318253), FRAC_CONST(-0.99548190832138) },
+    { FRAC_CONST(-0.38299977779388), FRAC_CONST(0.98516911268234) },
+    { FRAC_CONST(0.41025799512863), FRAC_CONST(0.02116736955941) },
+    { FRAC_CONST(0.09638062119484), FRAC_CONST(0.04411984235048) },
+    { FRAC_CONST(-0.85283249616623), FRAC_CONST(0.91475564241409) },
+    { FRAC_CONST(0.88866806030273), FRAC_CONST(-0.99735265970230) },
+    { FRAC_CONST(-0.48202428221703), FRAC_CONST(-0.96805608272552) },
+    { FRAC_CONST(0.27572581171989), FRAC_CONST(0.58634752035141) },
+    { FRAC_CONST(-0.65889132022858), FRAC_CONST(0.58835631608963) },
+    { FRAC_CONST(0.98838084936142), FRAC_CONST(0.99994349479675) },
+    { FRAC_CONST(-0.20651349425316), FRAC_CONST(0.54593044519424) },
+    { FRAC_CONST(-0.62126415967941), FRAC_CONST(-0.59893679618835) },
+    { FRAC_CONST(0.20320105552673), FRAC_CONST(-0.86879181861877) },
+    { FRAC_CONST(-0.97790551185608), FRAC_CONST(0.96290808916092) },
+    { FRAC_CONST(0.11112534999847), FRAC_CONST(0.21484763920307) },
+    { FRAC_CONST(-0.41368338465691), FRAC_CONST(0.28216838836670) },
+    { FRAC_CONST(0.24133038520813), FRAC_CONST(0.51294362545013) },
+    { FRAC_CONST(-0.66393411159515), FRAC_CONST(-0.08249679952860) },
+    { FRAC_CONST(-0.53697830438614), FRAC_CONST(-0.97649902105331) },
+    { FRAC_CONST(-0.97224736213684), FRAC_CONST(0.22081333398819) },
+    { FRAC_CONST(0.87392479181290), FRAC_CONST(-0.12796173989773) },
+    { FRAC_CONST(0.19050361216068), FRAC_CONST(0.01602615416050) },
+    { FRAC_CONST(-0.46353441476822), FRAC_CONST(-0.95249038934708) },
+    { FRAC_CONST(-0.07064096629620), FRAC_CONST(-0.94479805231094) },
+    { FRAC_CONST(-0.92444086074829), FRAC_CONST(-0.10457590222359) },
+    { FRAC_CONST(-0.83822596073151), FRAC_CONST(-0.01695043221116) },
+    { FRAC_CONST(0.75214684009552), FRAC_CONST(-0.99955683946609) },
+    { FRAC_CONST(-0.42102998495102), FRAC_CONST(0.99720942974091) },
+    { FRAC_CONST(-0.72094786167145), FRAC_CONST(-0.35008960962296) },
+    { FRAC_CONST(0.78843313455582), FRAC_CONST(0.52851396799088) },
+    { FRAC_CONST(0.97394025325775), FRAC_CONST(-0.26695942878723) },
+    { FRAC_CONST(0.99206465482712), FRAC_CONST(-0.57010120153427) },
+    { FRAC_CONST(0.76789611577988), FRAC_CONST(-0.76519358158112) },
+    { FRAC_CONST(-0.82002419233322), FRAC_CONST(-0.73530179262161) },
+    { FRAC_CONST(0.81924992799759), FRAC_CONST(0.99698424339294) },
+    { FRAC_CONST(-0.26719850301743), FRAC_CONST(0.68903368711472) },
+    { FRAC_CONST(-0.43311259150505), FRAC_CONST(0.85321813821793) },
+    { FRAC_CONST(0.99194979667664), FRAC_CONST(0.91876250505447) },
+    { FRAC_CONST(-0.80691999197006), FRAC_CONST(-0.32627540826797) },
+    { FRAC_CONST(0.43080005049706), FRAC_CONST(-0.21919095516205) },
+    { FRAC_CONST(0.67709493637085), FRAC_CONST(-0.95478075742722) },
+    { FRAC_CONST(0.56151771545410), FRAC_CONST(-0.70693808794022) },
+    { FRAC_CONST(0.10831862688065), FRAC_CONST(-0.08628837019205) },
+    { FRAC_CONST(0.91229414939880), FRAC_CONST(-0.65987348556519) },
+    { FRAC_CONST(-0.48972892761230), FRAC_CONST(0.56289243698120) },
+    { FRAC_CONST(-0.89033657312393), FRAC_CONST(-0.71656566858292) },
+    { FRAC_CONST(0.65269446372986), FRAC_CONST(0.65916007757187) },
+    { FRAC_CONST(0.67439478635788), FRAC_CONST(-0.81684380769730) },
+    { FRAC_CONST(-0.47770830988884), FRAC_CONST(-0.16789555549622) },
+    { FRAC_CONST(-0.99715977907181), FRAC_CONST(-0.93565785884857) },
+    { FRAC_CONST(-0.90889590978622), FRAC_CONST(0.62034398317337) },
+    { FRAC_CONST(-0.06618622690439), FRAC_CONST(-0.23812216520309) },
+    { FRAC_CONST(0.99430269002914), FRAC_CONST(0.18812555074692) },
+    { FRAC_CONST(0.97686403989792), FRAC_CONST(-0.28664535284042) },
+    { FRAC_CONST(0.94813650846481), FRAC_CONST(-0.97506642341614) },
+    { FRAC_CONST(-0.95434498786926), FRAC_CONST(-0.79607981443405) },
+    { FRAC_CONST(-0.49104782938957), FRAC_CONST(0.32895213365555) },
+    { FRAC_CONST(0.99881172180176), FRAC_CONST(0.88993984460831) },
+    { FRAC_CONST(0.50449168682098), FRAC_CONST(-0.85995072126389) },
+    { FRAC_CONST(0.47162890434265), FRAC_CONST(-0.18680204451084) },
+    { FRAC_CONST(-0.62081581354141), FRAC_CONST(0.75000673532486) },
+    { FRAC_CONST(-0.43867015838623), FRAC_CONST(0.99998068809509) },
+    { FRAC_CONST(0.98630565404892), FRAC_CONST(-0.53578901290894) },
+    { FRAC_CONST(-0.61510360240936), FRAC_CONST(-0.89515018463135) },
+    { FRAC_CONST(-0.03841517493129), FRAC_CONST(-0.69888818264008) },
+    { FRAC_CONST(-0.30102157592773), FRAC_CONST(-0.07667808979750) },
+    { FRAC_CONST(0.41881284117699), FRAC_CONST(0.02188098989427) },
+    { FRAC_CONST(-0.86135452985764), FRAC_CONST(0.98947483301163) },
+    { FRAC_CONST(0.67226862907410), FRAC_CONST(-0.13494388759136) },
+    { FRAC_CONST(-0.70737397670746), FRAC_CONST(-0.76547348499298) },
+    { FRAC_CONST(0.94044947624207), FRAC_CONST(0.09026201069355) },
+    { FRAC_CONST(-0.82386350631714), FRAC_CONST(0.08924768865108) },
+    { FRAC_CONST(-0.32070666551590), FRAC_CONST(0.50143420696259) },
+    { FRAC_CONST(0.57593160867691), FRAC_CONST(-0.98966425657272) },
+    { FRAC_CONST(-0.36326017975807), FRAC_CONST(0.07440242916346) },
+    { FRAC_CONST(0.99979043006897), FRAC_CONST(-0.14130286872387) },
+    { FRAC_CONST(-0.92366021871567), FRAC_CONST(-0.97979295253754) },
+    { FRAC_CONST(-0.44607177376747), FRAC_CONST(-0.54233253002167) },
+    { FRAC_CONST(0.44226801395416), FRAC_CONST(0.71326756477356) },
+    { FRAC_CONST(0.03671907261014), FRAC_CONST(0.63606387376785) },
+    { FRAC_CONST(0.52175426483154), FRAC_CONST(-0.85396826267242) },
+    { FRAC_CONST(-0.94701141119003), FRAC_CONST(-0.01826348155737) },
+    { FRAC_CONST(-0.98759609460831), FRAC_CONST(0.82288712263107) },
+    { FRAC_CONST(0.87434792518616), FRAC_CONST(0.89399492740631) },
+    { FRAC_CONST(-0.93412041664124), FRAC_CONST(0.41374051570892) },
+    { FRAC_CONST(0.96063941717148), FRAC_CONST(0.93116706609726) },
+    { FRAC_CONST(0.97534251213074), FRAC_CONST(0.86150932312012) },
+    { FRAC_CONST(0.99642467498779), FRAC_CONST(0.70190042257309) },
+    { FRAC_CONST(-0.94705086946487), FRAC_CONST(-0.29580041766167) },
+    { FRAC_CONST(0.91599804162979), FRAC_CONST(-0.98147833347321) }
+};
+
+#ifdef __cplusplus
+
+#endif
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/sbr_qmf.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,311 @@
+/*
+** 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.17 2003/11/12 20:47:58 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_qmf_c.h"
+#include "sbr_syntax.h"
+
+
+qmfa_info *qmfa_init(uint8_t channels)
+{
+    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;
+
+    return qmfa;
+}
+
+void qmfa_end(qmfa_info *qmfa)
+{
+    if (qmfa)
+    {
+        if (qmfa->x) free(qmfa->x);
+        free(qmfa);
+    }
+}
+
+void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input,
+                         qmf_t X[MAX_NTSRHFG][32], uint8_t offset, uint8_t kx)
+{
+    real_t u[64];
+#ifndef SBR_LOW_POWER
+    real_t x[64], y[64];
+#else
+    real_t y[32];
+#endif
+    uint16_t in = 0;
+    uint8_t l;
+
+    /* qmf subsample l */
+    for (l = 0; l < sbr->numTimeSlotsRate; 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] = (input[in++]) >> 5;
+#else
+            qmfa->x[n] = input[in++];
+#endif
+        }
+
+        /* window and summation to create array u */
+        for (n = 0; n < 64; n++)
+        {
+            u[n] = MUL_F(qmfa->x[n], qmf_c[2*n]) +
+                MUL_F(qmfa->x[n + 64], qmf_c[2*(n + 64)]) +
+                MUL_F(qmfa->x[n + 128], qmf_c[2*(n + 128)]) +
+                MUL_F(qmfa->x[n + 192], qmf_c[2*(n + 192)]) +
+                MUL_F(qmfa->x[n + 256], qmf_c[2*(n + 256)]);
+        }
+
+        /* 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++)
+        {
+            if (n < kx)
+            {
+#ifdef FIXED_POINT
+                QMF_RE(X[l + offset][n]) = u[n] << 1;
+#else
+                QMF_RE(X[l + offset][n]) = 2. * u[n];
+#endif
+            } else {
+                QMF_RE(X[l + offset][n]) = 0;
+            }
+        }
+#else
+        x[0] = u[0];
+        for (n = 0; n < 31; n++)
+        {
+            x[2*n+1] = u[n+1] + u[63-n];
+            x[2*n+2] = u[n+1] - u[63-n];
+        }
+        x[63] = u[32];
+
+        DCT4_64_kernel(y, x);
+
+        for (n = 0; n < 32; n++)
+        {
+            if (n < kx)
+            {
+#ifdef FIXED_POINT
+                QMF_RE(X[l + offset][n]) = y[n] << 1;
+                QMF_IM(X[l + offset][n]) = -y[63-n] << 1;
+#else
+                QMF_RE(X[l + offset][n]) = 2. * y[n];
+                QMF_IM(X[l + offset][n]) = -2. * y[63-n];
+#endif
+            } else {
+                QMF_RE(X[l + offset][n]) = 0;
+                QMF_IM(X[l + offset][n]) = 0;
+            }
+        }
+#endif
+    }
+}
+
+qmfs_info *qmfs_init(uint8_t channels)
+{
+    qmfs_info *qmfs = (qmfs_info*)malloc(sizeof(qmfs_info));
+
+    qmfs->v[0] = (real_t*)malloc(channels * 10 * sizeof(real_t));
+    memset(qmfs->v[0], 0, channels * 10 * sizeof(real_t));
+    qmfs->v[1] = (real_t*)malloc(channels * 10 * sizeof(real_t));
+    memset(qmfs->v[1], 0, channels * 10 * sizeof(real_t));
+
+    qmfs->v_index = 0;
+
+    qmfs->channels = channels;
+
+    return qmfs;
+}
+
+void qmfs_end(qmfs_info *qmfs)
+{
+    if (qmfs)
+    {
+        if (qmfs->v[0]) free(qmfs->v[0]);
+        if (qmfs->v[1]) free(qmfs->v[1]);
+        free(qmfs);
+    }
+}
+
+#ifdef SBR_LOW_POWER
+void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, const qmf_t X[MAX_NTSRHFG][64],
+                          real_t *output)
+{
+    real_t x[64];
+    int16_t n, k, out = 0;
+    uint8_t l;
+
+
+    /* qmf subsample l */
+    for (l = 0; l < sbr->numTimeSlotsRate; l++)
+    {
+        real_t *v0, *v1;
+
+        /* shift buffers */
+        memmove(qmfs->v[0] + 64, qmfs->v[0], (640-64)*sizeof(real_t));
+        memmove(qmfs->v[1] + 64, qmfs->v[1], (640-64)*sizeof(real_t));
+
+        v0 = qmfs->v[qmfs->v_index];
+        v1 = qmfs->v[(qmfs->v_index + 1) & 0x1];
+        qmfs->v_index = (qmfs->v_index + 1) & 0x1;
+
+        /* calculate 128 samples */
+        for (k = 0; k < 64; k++)
+        {
+#ifdef FIXED_POINT
+            x[k] = QMF_RE(X[l][k]);
+#else
+            x[k] = QMF_RE(X[l][k]) / 32.;
+#endif
+        }
+
+        DCT2_64_unscaled(x, x);
+
+        for (n = 0; n < 32; n++)
+        {
+            v0[n+32] = x[n];
+            v1[n] = x[n+32];
+        }
+        v0[0] = v1[0];
+        for (n = 1; n < 32; n++)
+        {
+            v0[32 - n] =  v0[n + 32];
+            v1[n + 32] = -v1[32 - n];
+        }
+        v1[32] = 0;
+
+        /* calculate 64 output samples and window */
+        for (k = 0; k < 64; k++)
+        {
+            output[out++] = MUL_F(v0[k], qmf_c[k]) +
+                MUL_F(v0[64 + k], qmf_c[64 + k]) +
+                MUL_F(v0[128 + k], qmf_c[128 + k]) +
+                MUL_F(v0[192 + k], qmf_c[192 + k]) +
+                MUL_F(v0[256 + k], qmf_c[256 + k]) +
+                MUL_F(v0[320 + k], qmf_c[320 + k]) +
+                MUL_F(v0[384 + k], qmf_c[384 + k]) +
+                MUL_F(v0[448 + k], qmf_c[448 + k]) +
+                MUL_F(v0[512 + k], qmf_c[512 + k]) +
+                MUL_F(v0[576 + k], qmf_c[576 + k]);
+        }
+    }
+}
+#else
+void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, const qmf_t X[MAX_NTSRHFG][64],
+                          real_t *output)
+{
+    real_t x1[64], x2[64];
+    real_t scale = 1.f/64.f;
+    int16_t n, k, out = 0;
+    uint8_t l;
+
+
+    /* qmf subsample l */
+    for (l = 0; l < sbr->numTimeSlotsRate; l++)
+    {
+        real_t *v0, *v1;
+
+        /* shift buffers */
+        memmove(qmfs->v[0] + 64, qmfs->v[0], (640-64)*sizeof(real_t));
+        memmove(qmfs->v[1] + 64, qmfs->v[1], (640-64)*sizeof(real_t));
+
+        v0 = qmfs->v[qmfs->v_index];
+        v1 = qmfs->v[(qmfs->v_index + 1) & 0x1];
+        qmfs->v_index = (qmfs->v_index + 1) & 0x1;
+
+        /* calculate 128 samples */
+        x1[0] = scale*QMF_RE(X[l][0]);
+        x2[63] = scale*QMF_IM(X[l][0]);
+        for (k = 0; k < 31; k++)
+        {
+            x1[2*k+1] = scale*(QMF_RE(X[l][2*k+1]) - QMF_RE(X[l][2*k+2]));
+            x1[2*k+2] = scale*(QMF_RE(X[l][2*k+1]) + QMF_RE(X[l][2*k+2]));
+
+            x2[61 - 2*k] = scale*(QMF_IM(X[l][2*k+2]) - QMF_IM(X[l][2*k+1]));
+            x2[62 - 2*k] = scale*(QMF_IM(X[l][2*k+2]) + QMF_IM(X[l][2*k+1]));
+        }
+        x1[63] = scale*QMF_RE(X[l][63]);
+        x2[0] = scale*QMF_IM(X[l][63]);
+
+        DCT4_64_kernel(x1, x1);
+        DCT4_64_kernel(x2, x2);
+
+        for (n = 0; n < 32; n++)
+        {
+            v0[   2*n]   =  x2[2*n]   - x1[2*n];
+            v1[63-2*n]   =  x2[2*n]   + x1[2*n];
+            v0[   2*n+1] = -x2[2*n+1] - x1[2*n+1];
+            v1[62-2*n]   = -x2[2*n+1] + x1[2*n+1];
+        }
+
+        /* calculate 64 output samples and window */
+        for (k = 0; k < 64; k++)
+        {
+            output[out++] = MUL_F(v0[k], qmf_c[k]) +
+                MUL_F(v0[64 + k], qmf_c[64 + k]) +
+                MUL_F(v0[128 + k], qmf_c[128 + k]) +
+                MUL_F(v0[192 + k], qmf_c[192 + k]) +
+                MUL_F(v0[256 + k], qmf_c[256 + k]) +
+                MUL_F(v0[320 + k], qmf_c[320 + k]) +
+                MUL_F(v0[384 + k], qmf_c[384 + k]) +
+                MUL_F(v0[448 + k], qmf_c[448 + k]) +
+                MUL_F(v0[512 + k], qmf_c[512 + k]) +
+                MUL_F(v0[576 + k], qmf_c[576 + k]);
+        }
+    }
+}
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/sbr_qmf.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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_qmf.h,v 1.12 2003/11/12 20:47:58 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(sbr_info *sbr, qmfa_info *qmfa, const real_t *input,
+                         qmf_t X[MAX_NTSRHFG][32], uint8_t offset, uint8_t kx);
+void sbr_qmf_synthesis_32(qmfs_info *qmfs, const qmf_t *X,
+                          real_t *output);
+void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, const qmf_t X[MAX_NTSRHFG][64],
+                          real_t *output);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/sbr_qmf_c.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,364 @@
+/*
+** 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.h,v 1.7 2003/11/12 20:47:58 menno Exp $
+**/
+
+#ifndef __SBR_QMF_C_H__
+#define __SBR_QMF_C_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+
+static real_t qmf_c[640] = {
+    FRAC_CONST(0), FRAC_CONST(-0.00055252865047),
+    FRAC_CONST(-0.00056176925738), FRAC_CONST(-0.00049475180896),
+    FRAC_CONST(-0.00048752279712), FRAC_CONST(-0.00048937912498),
+    FRAC_CONST(-0.00050407143497), FRAC_CONST(-0.00052265642972),
+    FRAC_CONST(-0.00054665656337), FRAC_CONST(-0.00056778025613),
+    FRAC_CONST(-0.00058709304852), FRAC_CONST(-0.00061327473938),
+    FRAC_CONST(-0.00063124935319), FRAC_CONST(-0.00065403333621),
+    FRAC_CONST(-0.00067776907764), FRAC_CONST(-0.00069416146273),
+    FRAC_CONST(-0.00071577364744), FRAC_CONST(-0.00072550431222),
+    FRAC_CONST(-0.00074409418541), FRAC_CONST(-0.00074905980532),
+    FRAC_CONST(-0.0007681371927), FRAC_CONST(-0.00077248485949),
+    FRAC_CONST(-0.00078343322877), FRAC_CONST(-0.00077798694927),
+    FRAC_CONST(-0.000780366471), FRAC_CONST(-0.00078014496257),
+    FRAC_CONST(-0.0007757977331), FRAC_CONST(-0.00076307935757),
+    FRAC_CONST(-0.00075300014201), FRAC_CONST(-0.00073193571525),
+    FRAC_CONST(-0.00072153919876), FRAC_CONST(-0.00069179375372),
+    FRAC_CONST(-0.00066504150893), FRAC_CONST(-0.00063415949025),
+    FRAC_CONST(-0.0005946118933), FRAC_CONST(-0.00055645763906),
+    FRAC_CONST(-0.00051455722108), FRAC_CONST(-0.00046063254803),
+    FRAC_CONST(-0.00040951214522), FRAC_CONST(-0.00035011758756),
+    FRAC_CONST(-0.00028969811748), FRAC_CONST(-0.0002098337344),
+    FRAC_CONST(-0.00014463809349), FRAC_CONST(-6.173344072E-005),
+    FRAC_CONST(1.349497418E-005), FRAC_CONST(0.00010943831274),
+    FRAC_CONST(0.00020430170688), FRAC_CONST(0.00029495311041),
+    FRAC_CONST(0.0004026540216), FRAC_CONST(0.00051073884952),
+    FRAC_CONST(0.00062393761391), FRAC_CONST(0.00074580258865),
+    FRAC_CONST(0.00086084433262), FRAC_CONST(0.00098859883015),
+    FRAC_CONST(0.00112501551307), FRAC_CONST(0.00125778846475),
+    FRAC_CONST(0.00139024948272), FRAC_CONST(0.00154432198471),
+    FRAC_CONST(0.00168680832531), FRAC_CONST(0.00183482654224),
+    FRAC_CONST(0.00198411407369), FRAC_CONST(0.00214615835557),
+    FRAC_CONST(0.00230172547746), FRAC_CONST(0.00246256169126),
+    FRAC_CONST(0.00262017586902), FRAC_CONST(0.00278704643465),
+    FRAC_CONST(0.00294694477165), FRAC_CONST(0.00311254206525),
+    FRAC_CONST(0.00327396134847), FRAC_CONST(0.00344188741828),
+    FRAC_CONST(0.00360082681231), FRAC_CONST(0.00376039229104),
+    FRAC_CONST(0.00392074323703), FRAC_CONST(0.00408197531935),
+    FRAC_CONST(0.0042264269227), FRAC_CONST(0.00437307196781),
+    FRAC_CONST(0.00452098527825), FRAC_CONST(0.00466064606118),
+    FRAC_CONST(0.00479325608498), FRAC_CONST(0.00491376035745),
+    FRAC_CONST(0.00503930226013), FRAC_CONST(0.00514073539032),
+    FRAC_CONST(0.00524611661324), FRAC_CONST(0.00534716811982),
+    FRAC_CONST(0.00541967759307), FRAC_CONST(0.00548760401507),
+    FRAC_CONST(0.00554757145088), FRAC_CONST(0.00559380230045),
+    FRAC_CONST(0.00562206432097), FRAC_CONST(0.00564551969164),
+    FRAC_CONST(0.00563891995151), FRAC_CONST(0.00562661141932),
+    FRAC_CONST(0.0055917128663), FRAC_CONST(0.005540436394),
+    FRAC_CONST(0.0054753783077), FRAC_CONST(0.0053838975897),
+    FRAC_CONST(0.00527157587272), FRAC_CONST(0.00513822754514),
+    FRAC_CONST(0.00498396877629), FRAC_CONST(0.004810946906),
+    FRAC_CONST(0.00460395301471), FRAC_CONST(0.00438018617447),
+    FRAC_CONST(0.0041251642327), FRAC_CONST(0.00384564081246),
+    FRAC_CONST(0.00354012465507), FRAC_CONST(0.00320918858098),
+    FRAC_CONST(0.00284467578623), FRAC_CONST(0.00245085400321),
+    FRAC_CONST(0.0020274176185), FRAC_CONST(0.00157846825768),
+    FRAC_CONST(0.00109023290512), FRAC_CONST(0.0005832264248),
+    FRAC_CONST(2.760451905E-005), FRAC_CONST(-0.00054642808664),
+    FRAC_CONST(-0.00115681355227), FRAC_CONST(-0.00180394725893),
+    FRAC_CONST(-0.00248267236449), FRAC_CONST(-0.003193377839),
+    FRAC_CONST(-0.00394011240522), FRAC_CONST(-0.004722259624),
+    FRAC_CONST(-0.00553372111088), FRAC_CONST(-0.00637922932685),
+    FRAC_CONST(-0.00726158168517), FRAC_CONST(-0.00817982333726),
+    FRAC_CONST(-0.00913253296085), FRAC_CONST(-0.01011502154986),
+    FRAC_CONST(-0.01113155480321), FRAC_CONST(-0.01218499959508),
+    FRAC_CONST(0.01327182200351), FRAC_CONST(0.01439046660792),
+    FRAC_CONST(0.01554055533423), FRAC_CONST(0.01673247129989),
+    FRAC_CONST(0.01794333813443), FRAC_CONST(0.01918724313698),
+    FRAC_CONST(0.02045317933555), FRAC_CONST(0.02174675502535),
+    FRAC_CONST(0.02306801692862), FRAC_CONST(0.02441609920285),
+    FRAC_CONST(0.02578758475467), FRAC_CONST(0.02718594296329),
+    FRAC_CONST(0.02860721736385), FRAC_CONST(0.03005026574279),
+    FRAC_CONST(0.03150176087389), FRAC_CONST(0.03297540810337),
+    FRAC_CONST(0.03446209487686), FRAC_CONST(0.03596975605542),
+    FRAC_CONST(0.03748128504252), FRAC_CONST(0.03900536794745),
+    FRAC_CONST(0.04053491705584), FRAC_CONST(0.04206490946367),
+    FRAC_CONST(0.04360975421304), FRAC_CONST(0.04514884056413),
+    FRAC_CONST(0.04668430272642), FRAC_CONST(0.04821657200672),
+    FRAC_CONST(0.04973857556014), FRAC_CONST(0.05125561555216),
+    FRAC_CONST(0.05276307465207), FRAC_CONST(0.05424527683589),
+    FRAC_CONST(0.05571736482138), FRAC_CONST(0.05716164501299),
+    FRAC_CONST(0.0585915683626), FRAC_CONST(0.05998374801761),
+    FRAC_CONST(0.06134551717207), FRAC_CONST(0.06268578081172),
+    FRAC_CONST(0.06397158980681), FRAC_CONST(0.0652247106438),
+    FRAC_CONST(0.06643675122104), FRAC_CONST(0.06760759851228),
+    FRAC_CONST(0.06870438283512), FRAC_CONST(0.06976302447127),
+    FRAC_CONST(0.07076287107266), FRAC_CONST(0.07170026731102),
+    FRAC_CONST(0.07256825833083), FRAC_CONST(0.07336202550803),
+    FRAC_CONST(0.07410036424342), FRAC_CONST(0.07474525581194),
+    FRAC_CONST(0.07531373362019), FRAC_CONST(0.07580083586584),
+    FRAC_CONST(0.07619924793396), FRAC_CONST(0.07649921704119),
+    FRAC_CONST(0.07670934904245), FRAC_CONST(0.07681739756964),
+    FRAC_CONST(0.07682300113923), FRAC_CONST(0.07672049241746),
+    FRAC_CONST(0.07650507183194), FRAC_CONST(0.07617483218536),
+    FRAC_CONST(0.07573057565061), FRAC_CONST(0.0751576255287),
+    FRAC_CONST(0.07446643947564), FRAC_CONST(0.0736406005762),
+    FRAC_CONST(0.07267746427299), FRAC_CONST(0.07158263647903),
+    FRAC_CONST(0.07035330735093), FRAC_CONST(0.06896640131951),
+    FRAC_CONST(0.06745250215166), FRAC_CONST(0.06576906686508),
+    FRAC_CONST(0.06394448059633), FRAC_CONST(0.06196027790387),
+    FRAC_CONST(0.0598166570809), FRAC_CONST(0.05751526919867),
+    FRAC_CONST(0.05504600343009), FRAC_CONST(0.05240938217366),
+    FRAC_CONST(0.04959786763445), FRAC_CONST(0.04663033051701),
+    FRAC_CONST(0.04347687821958), FRAC_CONST(0.04014582784127),
+    FRAC_CONST(0.03664181168133), FRAC_CONST(0.03295839306691),
+    FRAC_CONST(0.02908240060125), FRAC_CONST(0.02503075618909),
+    FRAC_CONST(0.02079970728622), FRAC_CONST(0.01637012582228),
+    FRAC_CONST(0.01176238327857), FRAC_CONST(0.00696368621617),
+    FRAC_CONST(0.00197656014503), FRAC_CONST(-0.00320868968304),
+    FRAC_CONST(-0.00857117491366), FRAC_CONST(-0.01412888273558),
+    FRAC_CONST(-0.01988341292573), FRAC_CONST(-0.02582272888064),
+    FRAC_CONST(-0.03195312745332), FRAC_CONST(-0.03827765720822),
+    FRAC_CONST(-0.04478068215856), FRAC_CONST(-0.05148041767934),
+    FRAC_CONST(-0.05837053268336), FRAC_CONST(-0.06544098531359),
+    FRAC_CONST(-0.07269433008129), FRAC_CONST(-0.08013729344279),
+    FRAC_CONST(-0.08775475365593), FRAC_CONST(-0.09555333528914),
+    FRAC_CONST(-0.10353295311463), FRAC_CONST(-0.1116826931773),
+    FRAC_CONST(-0.120007798468), FRAC_CONST(-0.12850028503878),
+    FRAC_CONST(-0.13715517611934), FRAC_CONST(-0.1459766491187),
+    FRAC_CONST(-0.15496070710605), FRAC_CONST(-0.16409588556669),
+    FRAC_CONST(-0.17338081721706), FRAC_CONST(-0.18281725485142),
+    FRAC_CONST(-0.19239667457267), FRAC_CONST(-0.20212501768103),
+    FRAC_CONST(-0.21197358538056), FRAC_CONST(-0.22196526964149),
+    FRAC_CONST(-0.23206908706791), FRAC_CONST(-0.24230168845974),
+    FRAC_CONST(-0.25264803095722), FRAC_CONST(-0.26310532994603),
+    FRAC_CONST(-0.27366340405625), FRAC_CONST(-0.28432141891085),
+    FRAC_CONST(-0.29507167170646), FRAC_CONST(-0.30590985751916),
+    FRAC_CONST(-0.31682789136456), FRAC_CONST(-0.32781137272105),
+    FRAC_CONST(-0.33887226938665), FRAC_CONST(-0.3499914122931),
+    FRAC_CONST(0.36115899031355), FRAC_CONST(0.37237955463061),
+    FRAC_CONST(0.38363500139043), FRAC_CONST(0.39492117615675),
+    FRAC_CONST(0.40623176767625), FRAC_CONST(0.41756968968409),
+    FRAC_CONST(0.42891199207373), FRAC_CONST(0.44025537543665),
+    FRAC_CONST(0.45159965356824), FRAC_CONST(0.46293080852757),
+    FRAC_CONST(0.47424532146115), FRAC_CONST(0.48552530911099),
+    FRAC_CONST(0.49677082545707), FRAC_CONST(0.50798175000434),
+    FRAC_CONST(0.51912349702391), FRAC_CONST(0.53022408956855),
+    FRAC_CONST(0.54125534487322), FRAC_CONST(0.55220512585061),
+    FRAC_CONST(0.5630789140137), FRAC_CONST(0.57385241316923),
+    FRAC_CONST(0.58454032354679), FRAC_CONST(0.59511230862496),
+    FRAC_CONST(0.6055783538918), FRAC_CONST(0.61591099320291),
+    FRAC_CONST(0.62612426956055), FRAC_CONST(0.63619801077286),
+    FRAC_CONST(0.64612696959461), FRAC_CONST(0.65590163024671),
+    FRAC_CONST(0.66551398801627), FRAC_CONST(0.67496631901712),
+    FRAC_CONST(0.68423532934598), FRAC_CONST(0.69332823767032),
+    FRAC_CONST(0.70223887193539), FRAC_CONST(0.71094104263095),
+    FRAC_CONST(0.71944626349561), FRAC_CONST(0.72774489002994),
+    FRAC_CONST(0.73582117582769), FRAC_CONST(0.74368278636488),
+    FRAC_CONST(0.75131374561237), FRAC_CONST(0.75870807608242),
+    FRAC_CONST(0.76586748650939), FRAC_CONST(0.77277808813327),
+    FRAC_CONST(0.77942875190216), FRAC_CONST(0.7858353120392),
+    FRAC_CONST(0.79197358416424), FRAC_CONST(0.797846641377),
+    FRAC_CONST(0.80344857518505), FRAC_CONST(0.80876950044491),
+    FRAC_CONST(0.81381912706217), FRAC_CONST(0.81857760046468),
+    FRAC_CONST(0.82304198905409), FRAC_CONST(0.8272275347336),
+    FRAC_CONST(0.8311038457152), FRAC_CONST(0.83469373618402),
+    FRAC_CONST(0.83797173378865), FRAC_CONST(0.84095413924722),
+    FRAC_CONST(0.84362382812005), FRAC_CONST(0.84598184698206),
+    FRAC_CONST(0.84803157770763), FRAC_CONST(0.84978051984268),
+    FRAC_CONST(0.85119715249343), FRAC_CONST(0.85230470352147),
+    FRAC_CONST(0.85310209497017), FRAC_CONST(0.85357205739107),
+    FRAC_CONST(0.85373856005937), FRAC_CONST(0.85357205739107),
+    FRAC_CONST(0.85310209497017), FRAC_CONST(0.85230470352147),
+    FRAC_CONST(0.85119715249343), FRAC_CONST(0.84978051984268),
+    FRAC_CONST(0.84803157770763), FRAC_CONST(0.84598184698206),
+    FRAC_CONST(0.84362382812005), FRAC_CONST(0.84095413924722),
+    FRAC_CONST(0.83797173378865), FRAC_CONST(0.83469373618402),
+    FRAC_CONST(0.8311038457152), FRAC_CONST(0.8272275347336),
+    FRAC_CONST(0.82304198905409), FRAC_CONST(0.81857760046468),
+    FRAC_CONST(0.81381912706217), FRAC_CONST(0.80876950044491),
+    FRAC_CONST(0.80344857518505), FRAC_CONST(0.797846641377),
+    FRAC_CONST(0.79197358416424), FRAC_CONST(0.7858353120392),
+    FRAC_CONST(0.77942875190216), FRAC_CONST(0.77277808813327),
+    FRAC_CONST(0.76586748650939), FRAC_CONST(0.75870807608242),
+    FRAC_CONST(0.75131374561237), FRAC_CONST(0.74368278636488),
+    FRAC_CONST(0.73582117582769), FRAC_CONST(0.72774489002994),
+    FRAC_CONST(0.71944626349561), FRAC_CONST(0.71094104263095),
+    FRAC_CONST(0.70223887193539), FRAC_CONST(0.69332823767032),
+    FRAC_CONST(0.68423532934598), FRAC_CONST(0.67496631901712),
+    FRAC_CONST(0.66551398801627), FRAC_CONST(0.65590163024671),
+    FRAC_CONST(0.64612696959461), FRAC_CONST(0.63619801077286),
+    FRAC_CONST(0.62612426956055), FRAC_CONST(0.61591099320291),
+    FRAC_CONST(0.6055783538918), FRAC_CONST(0.59511230862496),
+    FRAC_CONST(0.58454032354679), FRAC_CONST(0.57385241316923),
+    FRAC_CONST(0.5630789140137), FRAC_CONST(0.55220512585061),
+    FRAC_CONST(0.54125534487322), FRAC_CONST(0.53022408956855),
+    FRAC_CONST(0.51912349702391), FRAC_CONST(0.50798175000434),
+    FRAC_CONST(0.49677082545707), FRAC_CONST(0.48552530911099),
+    FRAC_CONST(0.47424532146115), FRAC_CONST(0.46293080852757),
+    FRAC_CONST(0.45159965356824), FRAC_CONST(0.44025537543665),
+    FRAC_CONST(0.42891199207373), FRAC_CONST(0.41756968968409),
+    FRAC_CONST(0.40623176767625), FRAC_CONST(0.39492117615675),
+    FRAC_CONST(0.38363500139043), FRAC_CONST(0.37237955463061),
+    FRAC_CONST(-0.36115899031355), FRAC_CONST(-0.3499914122931),
+    FRAC_CONST(-0.33887226938665), FRAC_CONST(-0.32781137272105),
+    FRAC_CONST(-0.31682789136456), FRAC_CONST(-0.30590985751916),
+    FRAC_CONST(-0.29507167170646), FRAC_CONST(-0.28432141891085),
+    FRAC_CONST(-0.27366340405625), FRAC_CONST(-0.26310532994603),
+    FRAC_CONST(-0.25264803095722), FRAC_CONST(-0.24230168845974),
+    FRAC_CONST(-0.23206908706791), FRAC_CONST(-0.22196526964149),
+    FRAC_CONST(-0.21197358538056), FRAC_CONST(-0.20212501768103),
+    FRAC_CONST(-0.19239667457267), FRAC_CONST(-0.18281725485142),
+    FRAC_CONST(-0.17338081721706), FRAC_CONST(-0.16409588556669),
+    FRAC_CONST(-0.15496070710605), FRAC_CONST(-0.1459766491187),
+    FRAC_CONST(-0.13715517611934), FRAC_CONST(-0.12850028503878),
+    FRAC_CONST(-0.120007798468), FRAC_CONST(-0.1116826931773),
+    FRAC_CONST(-0.10353295311463), FRAC_CONST(-0.09555333528914),
+    FRAC_CONST(-0.08775475365593), FRAC_CONST(-0.08013729344279),
+    FRAC_CONST(-0.07269433008129), FRAC_CONST(-0.06544098531359),
+    FRAC_CONST(-0.05837053268336), FRAC_CONST(-0.05148041767934),
+    FRAC_CONST(-0.04478068215856), FRAC_CONST(-0.03827765720822),
+    FRAC_CONST(-0.03195312745332), FRAC_CONST(-0.02582272888064),
+    FRAC_CONST(-0.01988341292573), FRAC_CONST(-0.01412888273558),
+    FRAC_CONST(-0.00857117491366), FRAC_CONST(-0.00320868968304),
+    FRAC_CONST(0.00197656014503), FRAC_CONST(0.00696368621617),
+    FRAC_CONST(0.01176238327857), FRAC_CONST(0.01637012582228),
+    FRAC_CONST(0.02079970728622), FRAC_CONST(0.02503075618909),
+    FRAC_CONST(0.02908240060125), FRAC_CONST(0.03295839306691),
+    FRAC_CONST(0.03664181168133), FRAC_CONST(0.04014582784127),
+    FRAC_CONST(0.04347687821958), FRAC_CONST(0.04663033051701),
+    FRAC_CONST(0.04959786763445), FRAC_CONST(0.05240938217366),
+    FRAC_CONST(0.05504600343009), FRAC_CONST(0.05751526919867),
+    FRAC_CONST(0.0598166570809), FRAC_CONST(0.06196027790387),
+    FRAC_CONST(0.06394448059633), FRAC_CONST(0.06576906686508),
+    FRAC_CONST(0.06745250215166), FRAC_CONST(0.06896640131951),
+    FRAC_CONST(0.07035330735093), FRAC_CONST(0.07158263647903),
+    FRAC_CONST(0.07267746427299), FRAC_CONST(0.0736406005762),
+    FRAC_CONST(0.07446643947564), FRAC_CONST(0.0751576255287),
+    FRAC_CONST(0.07573057565061), FRAC_CONST(0.07617483218536),
+    FRAC_CONST(0.07650507183194), FRAC_CONST(0.07672049241746),
+    FRAC_CONST(0.07682300113923), FRAC_CONST(0.07681739756964),
+    FRAC_CONST(0.07670934904245), FRAC_CONST(0.07649921704119),
+    FRAC_CONST(0.07619924793396), FRAC_CONST(0.07580083586584),
+    FRAC_CONST(0.07531373362019), FRAC_CONST(0.07474525581194),
+    FRAC_CONST(0.07410036424342), FRAC_CONST(0.07336202550803),
+    FRAC_CONST(0.07256825833083), FRAC_CONST(0.07170026731102),
+    FRAC_CONST(0.07076287107266), FRAC_CONST(0.06976302447127),
+    FRAC_CONST(0.06870438283512), FRAC_CONST(0.06760759851228),
+    FRAC_CONST(0.06643675122104), FRAC_CONST(0.0652247106438),
+    FRAC_CONST(0.06397158980681), FRAC_CONST(0.06268578081172),
+    FRAC_CONST(0.06134551717207), FRAC_CONST(0.05998374801761),
+    FRAC_CONST(0.0585915683626), FRAC_CONST(0.05716164501299),
+    FRAC_CONST(0.05571736482138), FRAC_CONST(0.05424527683589),
+    FRAC_CONST(0.05276307465207), FRAC_CONST(0.05125561555216),
+    FRAC_CONST(0.04973857556014), FRAC_CONST(0.04821657200672),
+    FRAC_CONST(0.04668430272642), FRAC_CONST(0.04514884056413),
+    FRAC_CONST(0.04360975421304), FRAC_CONST(0.04206490946367),
+    FRAC_CONST(0.04053491705584), FRAC_CONST(0.03900536794745),
+    FRAC_CONST(0.03748128504252), FRAC_CONST(0.03596975605542),
+    FRAC_CONST(0.03446209487686), FRAC_CONST(0.03297540810337),
+    FRAC_CONST(0.03150176087389), FRAC_CONST(0.03005026574279),
+    FRAC_CONST(0.02860721736385), FRAC_CONST(0.02718594296329),
+    FRAC_CONST(0.02578758475467), FRAC_CONST(0.02441609920285),
+    FRAC_CONST(0.02306801692862), FRAC_CONST(0.02174675502535),
+    FRAC_CONST(0.02045317933555), FRAC_CONST(0.01918724313698),
+    FRAC_CONST(0.01794333813443), FRAC_CONST(0.01673247129989),
+    FRAC_CONST(0.01554055533423), FRAC_CONST(0.01439046660792),
+    FRAC_CONST(-0.01327182200351), FRAC_CONST(-0.01218499959508),
+    FRAC_CONST(-0.01113155480321), FRAC_CONST(-0.01011502154986),
+    FRAC_CONST(-0.00913253296085), FRAC_CONST(-0.00817982333726),
+    FRAC_CONST(-0.00726158168517), FRAC_CONST(-0.00637922932685),
+    FRAC_CONST(-0.00553372111088), FRAC_CONST(-0.004722259624),
+    FRAC_CONST(-0.00394011240522), FRAC_CONST(-0.003193377839),
+    FRAC_CONST(-0.00248267236449), FRAC_CONST(-0.00180394725893),
+    FRAC_CONST(-0.00115681355227), FRAC_CONST(-0.00054642808664),
+    FRAC_CONST(2.760451905E-005), FRAC_CONST(0.0005832264248),
+    FRAC_CONST(0.00109023290512), FRAC_CONST(0.00157846825768),
+    FRAC_CONST(0.0020274176185), FRAC_CONST(0.00245085400321),
+    FRAC_CONST(0.00284467578623), FRAC_CONST(0.00320918858098),
+    FRAC_CONST(0.00354012465507), FRAC_CONST(0.00384564081246),
+    FRAC_CONST(0.0041251642327), FRAC_CONST(0.00438018617447),
+    FRAC_CONST(0.00460395301471), FRAC_CONST(0.004810946906),
+    FRAC_CONST(0.00498396877629), FRAC_CONST(0.00513822754514),
+    FRAC_CONST(0.00527157587272), FRAC_CONST(0.0053838975897),
+    FRAC_CONST(0.0054753783077), FRAC_CONST(0.005540436394),
+    FRAC_CONST(0.0055917128663), FRAC_CONST(0.00562661141932),
+    FRAC_CONST(0.00563891995151), FRAC_CONST(0.00564551969164),
+    FRAC_CONST(0.00562206432097), FRAC_CONST(0.00559380230045),
+    FRAC_CONST(0.00554757145088), FRAC_CONST(0.00548760401507),
+    FRAC_CONST(0.00541967759307), FRAC_CONST(0.00534716811982),
+    FRAC_CONST(0.00524611661324), FRAC_CONST(0.00514073539032),
+    FRAC_CONST(0.00503930226013), FRAC_CONST(0.00491376035745),
+    FRAC_CONST(0.00479325608498), FRAC_CONST(0.00466064606118),
+    FRAC_CONST(0.00452098527825), FRAC_CONST(0.00437307196781),
+    FRAC_CONST(0.0042264269227), FRAC_CONST(0.00408197531935),
+    FRAC_CONST(0.00392074323703), FRAC_CONST(0.00376039229104),
+    FRAC_CONST(0.00360082681231), FRAC_CONST(0.00344188741828),
+    FRAC_CONST(0.00327396134847), FRAC_CONST(0.00311254206525),
+    FRAC_CONST(0.00294694477165), FRAC_CONST(0.00278704643465),
+    FRAC_CONST(0.00262017586902), FRAC_CONST(0.00246256169126),
+    FRAC_CONST(0.00230172547746), FRAC_CONST(0.00214615835557),
+    FRAC_CONST(0.00198411407369), FRAC_CONST(0.00183482654224),
+    FRAC_CONST(0.00168680832531), FRAC_CONST(0.00154432198471),
+    FRAC_CONST(0.00139024948272), FRAC_CONST(0.00125778846475),
+    FRAC_CONST(0.00112501551307), FRAC_CONST(0.00098859883015),
+    FRAC_CONST(0.00086084433262), FRAC_CONST(0.00074580258865),
+    FRAC_CONST(0.00062393761391), FRAC_CONST(0.00051073884952),
+    FRAC_CONST(0.0004026540216), FRAC_CONST(0.00029495311041),
+    FRAC_CONST(0.00020430170688), FRAC_CONST(0.00010943831274),
+    FRAC_CONST(1.349497418E-005), FRAC_CONST(-6.173344072E-005),
+    FRAC_CONST(-0.00014463809349), FRAC_CONST(-0.0002098337344),
+    FRAC_CONST(-0.00028969811748), FRAC_CONST(-0.00035011758756),
+    FRAC_CONST(-0.00040951214522), FRAC_CONST(-0.00046063254803),
+    FRAC_CONST(-0.00051455722108), FRAC_CONST(-0.00055645763906),
+    FRAC_CONST(-0.0005946118933), FRAC_CONST(-0.00063415949025),
+    FRAC_CONST(-0.00066504150893), FRAC_CONST(-0.00069179375372),
+    FRAC_CONST(-0.00072153919876), FRAC_CONST(-0.00073193571525),
+    FRAC_CONST(-0.00075300014201), FRAC_CONST(-0.00076307935757),
+    FRAC_CONST(-0.0007757977331), FRAC_CONST(-0.00078014496257),
+    FRAC_CONST(-0.000780366471), FRAC_CONST(-0.00077798694927),
+    FRAC_CONST(-0.00078343322877), FRAC_CONST(-0.00077248485949),
+    FRAC_CONST(-0.0007681371927), FRAC_CONST(-0.00074905980532),
+    FRAC_CONST(-0.00074409418541), FRAC_CONST(-0.00072550431222),
+    FRAC_CONST(-0.00071577364744), FRAC_CONST(-0.00069416146273),
+    FRAC_CONST(-0.00067776907764), FRAC_CONST(-0.00065403333621),
+    FRAC_CONST(-0.00063124935319), FRAC_CONST(-0.00061327473938),
+    FRAC_CONST(-0.00058709304852), FRAC_CONST(-0.00056778025613),
+    FRAC_CONST(-0.00054665656337), FRAC_CONST(-0.00052265642972),
+    FRAC_CONST(-0.00050407143497), FRAC_CONST(-0.00048937912498),
+    FRAC_CONST(-0.00048752279712), FRAC_CONST(-0.00049475180896),
+    FRAC_CONST(-0.00056176925738), FRAC_CONST(-0.00055252865047)
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/sbr_syntax.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,830 @@
+/*
+** 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.15 2003/11/12 20:47:58 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 0
+    printf("%d\n", sbr->bs_start_freq_prev);
+    printf("%d\n", sbr->bs_stop_freq_prev);
+    printf("%d\n", sbr->bs_freq_scale_prev);
+    printf("%d\n", sbr->bs_alter_scale_prev);
+    printf("%d\n", sbr->bs_xover_band_prev);
+    printf("%d\n\n", sbr->bs_noise_bands_prev);
+#endif
+
+    /* 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 result;
+#ifdef DRM
+    uint8_t crc_len;
+
+    if (sbr->Is_DRM_SBR)
+        faad_getbits(ld, 8); /* 8-bit CRC */
+    else
+#endif
+    {
+        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"));
+
+#ifdef DRM
+    if (sbr->Is_DRM_SBR)
+    {
+        /* Check CRC, get number of bits for check */
+        if (sbr->id_aac == ID_SCE)
+        {
+            if (sbr->lcstereo_flag)
+            {
+                if (sbr->bs_header_flag)
+                    crc_len = min(76, sbr->data_size_bits);
+                else
+                    crc_len = min(47, sbr->data_size_bits);
+            } else {
+                if (sbr->bs_header_flag)
+                    crc_len = min(74, sbr->data_size_bits);
+                else
+                    crc_len = min(47, sbr->data_size_bits);
+            }
+        } else {
+            if (sbr->bs_header_flag)
+                crc_len = min(120, sbr->data_size_bits);
+            else
+                crc_len = min(93, sbr->data_size_bits);
+        }
+
+        if ((result = faad_check_CRC(ld, crc_len)) > 0)
+            return result;
+
+        /* Rewind and read bits again to set correct position in bit-stream */
+        faad_rewindbits(ld);
+        faad_getbits(ld, 8);
+        faad_get1bit(ld);
+    }
+#endif
+
+    if (sbr->bs_header_flag)
+        sbr_header(ld, sbr);
+
+    /* 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))
+    {
+        uint8_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);
+        }
+        if ((result = derived_frequency_table(sbr, sbr->bs_xover_band, k2)) > 0)
+            return result;
+    }
+
+    if ((result = sbr_data(ld, sbr)) > 0)
+        return result;
+
+    /* no error */
+    return 0;
+}
+
+/* table 3 */
+static void sbr_header(bitfile *ld, sbr_info *sbr)
+{
+    uint8_t bs_header_extra_1, bs_header_extra_2;
+
+    sbr->header_count++;
+
+#ifdef DRM
+    /* protocol_version (should be 0) */
+    if (sbr->Is_DRM_SBR)
+        faad_getbits(ld, 2);
+#endif
+
+    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"));
+#ifdef DRM
+    if (sbr->Is_DRM_SBR)
+        sbr->bs_dataextra = faad_getbits(ld, 1);
+#endif
+    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"));
+#ifdef DRM
+    /* No low complexity stereo support so far */
+    if ((sbr->lcstereo_flag) && (sbr->Is_DRM_SBR))
+        faad_getbits(ld, 2);
+#endif
+
+    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"));
+    } else {
+        /* Default values */
+        sbr->bs_freq_scale = 2;
+        sbr->bs_alter_scale = 1;
+        sbr->bs_noise_bands = 2;
+    }
+
+    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"));
+#ifdef DRM
+        /* reserved */
+        if (sbr->Is_DRM_SBR)
+            faad_get1bit(ld);
+#endif
+    } else {
+        /* Default values */
+        sbr->bs_limiter_bands = 2;
+        sbr->bs_limiter_gains = 2;
+        sbr->bs_interpol_freq = 1;
+        sbr->bs_smoothing_mode = 1;
+    }
+
+#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 uint8_t sbr_data(bitfile *ld, sbr_info *sbr)
+{
+    uint8_t result;
+#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;
+
+#ifdef DRM
+    if (sbr->Is_DRM_SBR)
+        sbr->rate = 2;
+#endif
+
+    switch (sbr->id_aac)
+    {
+    case ID_SCE:
+		if ((result = sbr_single_channel_element(ld, sbr)) > 0)
+			return result;
+        break;
+    case ID_CPE:
+		if ((result = sbr_channel_pair_element(ld, sbr)) > 0)
+			return result;
+        break;
+    }
+
+	return 0;
+}
+
+/* table 5 */
+static uint8_t sbr_single_channel_element(bitfile *ld, sbr_info *sbr)
+{
+    uint8_t result;
+
+#ifdef DRM
+    if (!sbr->Is_DRM_SBR)
+#endif
+    {
+        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"));
+        }
+    }
+
+    if ((result = sbr_grid(ld, sbr, 0)) > 0)
+        return result;
+    sbr_dtdf(ld, sbr, 0);
+    invf_mode(ld, sbr, 0);
+#ifdef DRM
+    if (sbr->Is_DRM_SBR)
+    {
+        /* sbr mode not needed in V1.0. Should be set to 2 by a V1.0 encoder */
+        faad_getbits(ld, 2);
+
+        if (sbr->bs_dataextra)
+            faad_getbits(ld, 3); /* reserved */
+    }
+#endif
+    sbr_envelope(ld, sbr, 0);
+    sbr_noise(ld, sbr, 0);
+
+    envelope_noise_dequantisation(sbr, 0);
+
+    memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t));
+
+#ifdef DRM
+    if (sbr->Is_DRM_SBR)
+        sbr->bs_add_harmonic_flag[0] = 0;
+    else
+#endif
+    {
+        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); */
+#ifdef DRM
+            if (!sbr->Is_DRM_SBR)
+#endif
+            {
+                sbr->bs_extension_data = faad_getbits(ld, 6
+                    DEBUGVAR(1,279,"sbr_single_channel_element(): bs_extension_data"));
+            }
+        }
+
+        /* Corrigendum */
+        faad_getbits(ld, nr_bits_left
+            DEBUGVAR(1,280,"sbr_single_channel_element(): nr_bits_left"));
+    }
+
+    return 0;
+}
+
+/* table 6 */
+static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr)
+{
+    uint8_t n, result;
+
+#ifdef DRM
+    if (!sbr->Is_DRM_SBR)
+#endif
+    {
+        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)
+    {
+        if ((result = sbr_grid(ld, sbr, 0)) > 0)
+            return result;
+
+        /* 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);
+#ifdef DRM
+        if (sbr->Is_DRM_SBR)
+        {
+            /* sbr mode not needed in V1.0. Should be set to 2 by a V1.0 encoder */
+            faad_getbits(ld, 2);
+
+            if (sbr->bs_dataextra)
+                faad_getbits(ld, 3); /* reserved */
+        }
+#endif
+
+        /* 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));
+
+#ifdef DRM
+        if (sbr->Is_DRM_SBR)
+            sbr->bs_add_harmonic_flag[0] = 0;
+        else
+#endif
+        {
+            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);
+
+#ifdef DRM
+        if (sbr->Is_DRM_SBR)
+            sbr->bs_add_harmonic_flag[1] = 0;
+        else
+#endif
+        {
+            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 {
+        if ((result = sbr_grid(ld, sbr, 0)) > 0)
+            return result;
+        if ((result = sbr_grid(ld, sbr, 1)) > 0)
+            return result;
+        sbr_dtdf(ld, sbr, 0);
+        sbr_dtdf(ld, sbr, 1);
+        invf_mode(ld, sbr, 0);
+        invf_mode(ld, sbr, 1);
+#ifdef DRM
+        if (sbr->Is_DRM_SBR)
+        {
+            /* sbr mode not needed in V1.0. Should be set to 2 by a V1.0 encoder */
+            faad_getbits(ld, 2);
+            faad_getbits(ld, 2);
+
+            if (sbr->bs_dataextra)
+                faad_getbits(ld, 6); /* reserved */
+        }
+#endif
+        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));
+
+#ifdef DRM
+        if (sbr->Is_DRM_SBR)
+            sbr->bs_add_harmonic_flag[0] = 0;
+        else
+#endif
+        {
+            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);
+
+#ifdef DRM
+        if (sbr->Is_DRM_SBR)
+            sbr->bs_add_harmonic_flag[1] = 0;
+        else
+#endif
+        {
+            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 (sbr->bs_coupling)
+        unmap_envelope_noise(sbr);
+
+    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); */
+#ifdef DRM
+            if (!sbr->Is_DRM_SBR)
+#endif
+            {
+                sbr->bs_extension_data = faad_getbits(ld, 6
+                    DEBUGVAR(1,280,"sbr_channel_pair_element(): bs_extension_data"));
+            }
+        }
+
+        /* Corrigendum */
+        faad_getbits(ld, nr_bits_left
+            DEBUGVAR(1,280,"sbr_channel_pair_element(): nr_bits_left"));
+    }
+
+    return 0;
+}
+
+/* table 7 */
+static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch)
+{
+    uint8_t i, env, rel, result;
+    uint8_t bs_abs_bord, bs_abs_bord_1;
+    uint16_t bs_num_env;
+
+    sbr->bs_frame_class[ch] = faad_getbits(ld, 2
+        DEBUGVAR(1,248,"sbr_grid(): bs_frame_class"));
+
+    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] = sbr->numTimeSlots;
+        sbr->n_rel_lead[ch] = bs_num_env - 1;
+        sbr->n_rel_trail[ch] = 0;
+        break;
+
+    case FIXVAR:
+#ifdef DRM
+        if (sbr->Is_DRM_SBR)
+        {
+            bs_abs_bord = faad_getbits(ld, 3
+                DEBUGVAR(1,251,"sbr_grid(): bs_abs_bord")) + sbr->numTimeSlots;
+        } else
+#endif
+        {
+            bs_abs_bord = faad_getbits(ld, 2
+                DEBUGVAR(1,251,"sbr_grid(): bs_abs_bord")) + sbr->numTimeSlots;
+        }
+        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:
+#ifdef DRM
+        if (sbr->Is_DRM_SBR)
+        {
+            bs_abs_bord = faad_getbits(ld, 3
+                DEBUGVAR(1,256,"sbr_grid(): bs_abs_bord"));
+        } else
+#endif
+        {
+            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] = sbr->numTimeSlots;
+        sbr->n_rel_lead[ch] = bs_num_env - 1;
+        sbr->n_rel_trail[ch] = 0;
+        break;
+
+    case VARVAR:
+#ifdef DRM
+        if (sbr->Is_DRM_SBR)
+        {
+            bs_abs_bord = faad_getbits(ld, 3
+                DEBUGVAR(1,261,"sbr_grid(): bs_abs_bord_0"));
+            bs_abs_bord_1 = faad_getbits(ld, 3
+                DEBUGVAR(1,262,"sbr_grid(): bs_abs_bord_1")) + sbr->numTimeSlots;
+        }
+        else
+#endif
+        {
+            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")) + sbr->numTimeSlots;
+        }
+        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! */
+    if ((result = envelope_time_border_vector(sbr, ch)) > 0)
+        return result;
+    noise_floor_time_border_vector(sbr, ch);
+
+    return 0;
+}
+
+/* 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;
+
+#ifdef DRM
+    if (sbr->Is_DRM_SBR)
+    {
+        /* Only one inv_mode in DRM */
+        uint8_t invf_mode;
+        invf_mode = faad_getbits(ld, 2
+            DEBUGVAR(1,271,"invf_mode(): bs_invf_mode"));
+        for (n = 0; n < sbr->N_Q; n++)
+            sbr->bs_invf_mode[ch][n] = invf_mode;
+    } else
+#endif
+    {
+        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 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 */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/sbr_syntax.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,76 @@
+/*
+** 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.12 2003/11/12 20:47:58 menno Exp $
+**/
+
+#ifndef __SBR_SYNTAX_H__
+#define __SBR_SYNTAX_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "bits.h"
+
+#ifdef DRM
+# define T_HFGEN_DRM 32
+# define T_HFADJ_DRM 0
+#endif
+#define T_HFGEN 8
+#define T_HFADJ 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_960 15
+#define NO_TIME_SLOTS     16
+#define RATE              2
+
+#define NOISE_FLOOR_OFFSET 6.0
+
+
+uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr);
+static void sbr_header(bitfile *ld, sbr_info *sbr);
+static uint8_t sbr_data(bitfile *ld, sbr_info *sbr);
+static uint8_t sbr_single_channel_element(bitfile *ld, sbr_info *sbr);
+static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr);
+static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch);
+static void sbr_dtdf(bitfile *ld, sbr_info *sbr, uint8_t ch);
+static void invf_mode(bitfile *ld, sbr_info *sbr, uint8_t ch);
+static void sinusoidal_coding(bitfile *ld, sbr_info *sbr, uint8_t ch);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __SBR_SYNTAX_H__ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/sbr_tf_grid.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,243 @@
+/*
+** 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.8 2003/11/12 20:47:58 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"
+
+uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch)
+{
+    uint8_t l, border, temp;
+
+    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:
+            temp = (int) (sbr->numTimeSlots / 4);
+            sbr->t_E[ch][3] = sbr->rate * 3 * temp;
+            sbr->t_E[ch][2] = sbr->rate * 2 * temp;
+            sbr->t_E[ch][1] = sbr->rate * temp;
+            break;
+        case 2:
+            sbr->t_E[ch][1] = sbr->rate * (int) (sbr->numTimeSlots / 2);
+            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++)
+            {
+                if (border < sbr->bs_rel_bord[ch][l])
+                    return 1;
+
+                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];
+
+                if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen)
+                    return 1;
+
+                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];
+
+                if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen)
+                    return 1;
+
+                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++)
+            {
+                if (border < sbr->bs_rel_bord_1[ch][l])
+                    return 1;
+
+                border -= sbr->bs_rel_bord_1[ch][l];
+                sbr->t_E[ch][--i] = sbr->rate * border;
+            }
+        }
+        break;
+    }
+
+    return 0;
+}
+
+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 sbr->numTimeSlots/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/Input/aac/libfaad2/sbr_tf_grid.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.7 2003/11/12 20:47:59 menno Exp $
+**/
+
+#ifndef __SBR_TF_GRID_H__
+#define __SBR_TF_GRID_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch);
+void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch);
+
+static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l);
+static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l);
+static uint8_t middleBorder(sbr_info *sbr, uint8_t ch);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/sine_win.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,4301 @@
+/*
+** 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.9 2003/11/12 20:47:59 menno Exp $
+**/
+
+#ifndef __SINE_WIN_H__
+#define __SINE_WIN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+
+real_t sine_long_1024[] =
+{
+    FRAC_CONST(0.00076699031874270449),
+    FRAC_CONST(0.002300969151425805),
+    FRAC_CONST(0.0038349425697062275),
+    FRAC_CONST(0.0053689069639963425),
+    FRAC_CONST(0.0069028587247297558),
+    FRAC_CONST(0.0084367942423697988),
+    FRAC_CONST(0.0099707099074180308),
+    FRAC_CONST(0.011504602110422714),
+    FRAC_CONST(0.013038467241987334),
+    FRAC_CONST(0.014572301692779064),
+    FRAC_CONST(0.016106101853537287),
+    FRAC_CONST(0.017639864115082053),
+    FRAC_CONST(0.019173584868322623),
+    FRAC_CONST(0.020707260504265895),
+    FRAC_CONST(0.022240887414024961),
+    FRAC_CONST(0.023774461988827555),
+    FRAC_CONST(0.025307980620024571),
+    FRAC_CONST(0.026841439699098531),
+    FRAC_CONST(0.028374835617672099),
+    FRAC_CONST(0.029908164767516555),
+    FRAC_CONST(0.031441423540560301),
+    FRAC_CONST(0.032974608328897335),
+    FRAC_CONST(0.03450771552479575),
+    FRAC_CONST(0.036040741520706229),
+    FRAC_CONST(0.037573682709270494),
+    FRAC_CONST(0.039106535483329888),
+    FRAC_CONST(0.040639296235933736),
+    FRAC_CONST(0.042171961360347947),
+    FRAC_CONST(0.043704527250063421),
+    FRAC_CONST(0.04523699029880459),
+    FRAC_CONST(0.046769346900537863),
+    FRAC_CONST(0.048301593449480144),
+    FRAC_CONST(0.049833726340107277),
+    FRAC_CONST(0.051365741967162593),
+    FRAC_CONST(0.052897636725665324),
+    FRAC_CONST(0.054429407010919133),
+    FRAC_CONST(0.055961049218520569),
+    FRAC_CONST(0.057492559744367566),
+    FRAC_CONST(0.059023934984667931),
+    FRAC_CONST(0.060555171335947788),
+    FRAC_CONST(0.062086265195060088),
+    FRAC_CONST(0.063617212959193106),
+    FRAC_CONST(0.065148011025878833),
+    FRAC_CONST(0.066678655793001557),
+    FRAC_CONST(0.068209143658806329),
+    FRAC_CONST(0.069739471021907307),
+    FRAC_CONST(0.071269634281296401),
+    FRAC_CONST(0.072799629836351673),
+    FRAC_CONST(0.074329454086845756),
+    FRAC_CONST(0.075859103432954447),
+    FRAC_CONST(0.077388574275265049),
+    FRAC_CONST(0.078917863014784942),
+    FRAC_CONST(0.080446966052950014),
+    FRAC_CONST(0.081975879791633066),
+    FRAC_CONST(0.083504600633152432),
+    FRAC_CONST(0.085033124980280275),
+    FRAC_CONST(0.08656144923625117),
+    FRAC_CONST(0.088089569804770507),
+    FRAC_CONST(0.089617483090022959),
+    FRAC_CONST(0.091145185496681005),
+    FRAC_CONST(0.09267267342991331),
+    FRAC_CONST(0.094199943295393204),
+    FRAC_CONST(0.095726991499307162),
+    FRAC_CONST(0.097253814448363271),
+    FRAC_CONST(0.098780408549799623),
+    FRAC_CONST(0.10030677021139286),
+    FRAC_CONST(0.10183289584146653),
+    FRAC_CONST(0.10335878184889961),
+    FRAC_CONST(0.10488442464313497),
+    FRAC_CONST(0.10640982063418768),
+    FRAC_CONST(0.10793496623265365),
+    FRAC_CONST(0.10945985784971798),
+    FRAC_CONST(0.11098449189716339),
+    FRAC_CONST(0.11250886478737869),
+    FRAC_CONST(0.1140329729333672),
+    FRAC_CONST(0.11555681274875526),
+    FRAC_CONST(0.11708038064780059),
+    FRAC_CONST(0.11860367304540072),
+    FRAC_CONST(0.1201266863571015),
+    FRAC_CONST(0.12164941699910553),
+    FRAC_CONST(0.12317186138828048),
+    FRAC_CONST(0.12469401594216764),
+    FRAC_CONST(0.12621587707899035),
+    FRAC_CONST(0.12773744121766231),
+    FRAC_CONST(0.12925870477779614),
+    FRAC_CONST(0.13077966417971171),
+    FRAC_CONST(0.13230031584444465),
+    FRAC_CONST(0.13382065619375472),
+    FRAC_CONST(0.13534068165013421),
+    FRAC_CONST(0.13686038863681638),
+    FRAC_CONST(0.13837977357778389),
+    FRAC_CONST(0.13989883289777721),
+    FRAC_CONST(0.14141756302230302),
+    FRAC_CONST(0.14293596037764267),
+    FRAC_CONST(0.14445402139086047),
+    FRAC_CONST(0.14597174248981221),
+    FRAC_CONST(0.14748912010315357),
+    FRAC_CONST(0.14900615066034845),
+    FRAC_CONST(0.1505228305916774),
+    FRAC_CONST(0.15203915632824605),
+    FRAC_CONST(0.15355512430199345),
+    FRAC_CONST(0.15507073094570051),
+    FRAC_CONST(0.15658597269299843),
+    FRAC_CONST(0.15810084597837698),
+    FRAC_CONST(0.15961534723719306),
+    FRAC_CONST(0.16112947290567881),
+    FRAC_CONST(0.16264321942095031),
+    FRAC_CONST(0.16415658322101581),
+    FRAC_CONST(0.16566956074478412),
+    FRAC_CONST(0.16718214843207294),
+    FRAC_CONST(0.16869434272361733),
+    FRAC_CONST(0.17020614006107807),
+    FRAC_CONST(0.17171753688704997),
+    FRAC_CONST(0.17322852964507032),
+    FRAC_CONST(0.1747391147796272),
+    FRAC_CONST(0.17624928873616788),
+    FRAC_CONST(0.17775904796110717),
+    FRAC_CONST(0.17926838890183575),
+    FRAC_CONST(0.18077730800672859),
+    FRAC_CONST(0.1822858017251533),
+    FRAC_CONST(0.18379386650747845),
+    FRAC_CONST(0.1853014988050819),
+    FRAC_CONST(0.18680869507035927),
+    FRAC_CONST(0.18831545175673212),
+    FRAC_CONST(0.18982176531865641),
+    FRAC_CONST(0.1913276322116309),
+    FRAC_CONST(0.19283304889220523),
+    FRAC_CONST(0.1943380118179886),
+    FRAC_CONST(0.19584251744765785),
+    FRAC_CONST(0.19734656224096592),
+    FRAC_CONST(0.19885014265875009),
+    FRAC_CONST(0.20035325516294045),
+    FRAC_CONST(0.20185589621656805),
+    FRAC_CONST(0.20335806228377332),
+    FRAC_CONST(0.20485974982981442),
+    FRAC_CONST(0.20636095532107551),
+    FRAC_CONST(0.20786167522507507),
+    FRAC_CONST(0.20936190601047416),
+    FRAC_CONST(0.21086164414708486),
+    FRAC_CONST(0.21236088610587842),
+    FRAC_CONST(0.21385962835899375),
+    FRAC_CONST(0.21535786737974555),
+    FRAC_CONST(0.21685559964263262),
+    FRAC_CONST(0.21835282162334632),
+    FRAC_CONST(0.2198495297987787),
+    FRAC_CONST(0.22134572064703081),
+    FRAC_CONST(0.22284139064742112),
+    FRAC_CONST(0.2243365362804936),
+    FRAC_CONST(0.22583115402802617),
+    FRAC_CONST(0.22732524037303886),
+    FRAC_CONST(0.22881879179980222),
+    FRAC_CONST(0.23031180479384544),
+    FRAC_CONST(0.23180427584196478),
+    FRAC_CONST(0.23329620143223159),
+    FRAC_CONST(0.23478757805400097),
+    FRAC_CONST(0.23627840219791957),
+    FRAC_CONST(0.23776867035593419),
+    FRAC_CONST(0.23925837902129998),
+    FRAC_CONST(0.24074752468858843),
+    FRAC_CONST(0.24223610385369601),
+    FRAC_CONST(0.24372411301385216),
+    FRAC_CONST(0.24521154866762754),
+    FRAC_CONST(0.24669840731494241),
+    FRAC_CONST(0.24818468545707478),
+    FRAC_CONST(0.24967037959666857),
+    FRAC_CONST(0.25115548623774192),
+    FRAC_CONST(0.25264000188569552),
+    FRAC_CONST(0.25412392304732062),
+    FRAC_CONST(0.25560724623080738),
+    FRAC_CONST(0.25708996794575312),
+    FRAC_CONST(0.25857208470317034),
+    FRAC_CONST(0.26005359301549519),
+    FRAC_CONST(0.26153448939659552),
+    FRAC_CONST(0.263014770361779),
+    FRAC_CONST(0.26449443242780163),
+    FRAC_CONST(0.26597347211287559),
+    FRAC_CONST(0.26745188593667762),
+    FRAC_CONST(0.26892967042035726),
+    FRAC_CONST(0.27040682208654482),
+    FRAC_CONST(0.27188333745935972),
+    FRAC_CONST(0.27335921306441868),
+    FRAC_CONST(0.27483444542884394),
+    FRAC_CONST(0.27630903108127108),
+    FRAC_CONST(0.27778296655185769),
+    FRAC_CONST(0.27925624837229118),
+    FRAC_CONST(0.28072887307579719),
+    FRAC_CONST(0.28220083719714756),
+    FRAC_CONST(0.28367213727266843),
+    FRAC_CONST(0.28514276984024867),
+    FRAC_CONST(0.28661273143934779),
+    FRAC_CONST(0.28808201861100413),
+    FRAC_CONST(0.28955062789784303),
+    FRAC_CONST(0.29101855584408509),
+    FRAC_CONST(0.29248579899555388),
+    FRAC_CONST(0.29395235389968466),
+    FRAC_CONST(0.29541821710553201),
+    FRAC_CONST(0.29688338516377827),
+    FRAC_CONST(0.2983478546267414),
+    FRAC_CONST(0.29981162204838335),
+    FRAC_CONST(0.30127468398431795),
+    FRAC_CONST(0.30273703699181914),
+    FRAC_CONST(0.30419867762982911),
+    FRAC_CONST(0.30565960245896612),
+    FRAC_CONST(0.3071198080415331),
+    FRAC_CONST(0.30857929094152509),
+    FRAC_CONST(0.31003804772463789),
+    FRAC_CONST(0.31149607495827591),
+    FRAC_CONST(0.3129533692115602),
+    FRAC_CONST(0.31440992705533666),
+    FRAC_CONST(0.31586574506218396),
+    FRAC_CONST(0.31732081980642174),
+    FRAC_CONST(0.31877514786411848),
+    FRAC_CONST(0.32022872581309986),
+    FRAC_CONST(0.32168155023295658),
+    FRAC_CONST(0.32313361770505233),
+    FRAC_CONST(0.32458492481253215),
+    FRAC_CONST(0.32603546814033024),
+    FRAC_CONST(0.327485244275178),
+    FRAC_CONST(0.3289342498056122),
+    FRAC_CONST(0.33038248132198278),
+    FRAC_CONST(0.33182993541646111),
+    FRAC_CONST(0.33327660868304793),
+    FRAC_CONST(0.33472249771758122),
+    FRAC_CONST(0.33616759911774452),
+    FRAC_CONST(0.33761190948307462),
+    FRAC_CONST(0.33905542541496964),
+    FRAC_CONST(0.34049814351669716),
+    FRAC_CONST(0.34194006039340219),
+    FRAC_CONST(0.34338117265211504),
+    FRAC_CONST(0.34482147690175929),
+    FRAC_CONST(0.34626096975316001),
+    FRAC_CONST(0.34769964781905138),
+    FRAC_CONST(0.34913750771408497),
+    FRAC_CONST(0.35057454605483751),
+    FRAC_CONST(0.35201075945981908),
+    FRAC_CONST(0.35344614454948081),
+    FRAC_CONST(0.35488069794622279),
+    FRAC_CONST(0.35631441627440241),
+    FRAC_CONST(0.3577472961603419),
+    FRAC_CONST(0.3591793342323365),
+    FRAC_CONST(0.36061052712066227),
+    FRAC_CONST(0.36204087145758418),
+    FRAC_CONST(0.36347036387736376),
+    FRAC_CONST(0.36489900101626732),
+    FRAC_CONST(0.36632677951257359),
+    FRAC_CONST(0.36775369600658198),
+    FRAC_CONST(0.36917974714062002),
+    FRAC_CONST(0.37060492955905167),
+    FRAC_CONST(0.37202923990828501),
+    FRAC_CONST(0.3734526748367803),
+    FRAC_CONST(0.37487523099505754),
+    FRAC_CONST(0.37629690503570479),
+    FRAC_CONST(0.37771769361338564),
+    FRAC_CONST(0.37913759338484732),
+    FRAC_CONST(0.38055660100892852),
+    FRAC_CONST(0.38197471314656722),
+    FRAC_CONST(0.38339192646080866),
+    FRAC_CONST(0.38480823761681288),
+    FRAC_CONST(0.38622364328186298),
+    FRAC_CONST(0.38763814012537273),
+    FRAC_CONST(0.38905172481889438),
+    FRAC_CONST(0.39046439403612659),
+    FRAC_CONST(0.39187614445292235),
+    FRAC_CONST(0.3932869727472964),
+    FRAC_CONST(0.39469687559943356),
+    FRAC_CONST(0.39610584969169627),
+    FRAC_CONST(0.39751389170863233),
+    FRAC_CONST(0.39892099833698291),
+    FRAC_CONST(0.40032716626569009),
+    FRAC_CONST(0.40173239218590501),
+    FRAC_CONST(0.4031366727909953),
+    FRAC_CONST(0.404540004776553),
+    FRAC_CONST(0.40594238484040251),
+    FRAC_CONST(0.40734380968260797),
+    FRAC_CONST(0.40874427600548136),
+    FRAC_CONST(0.41014378051359024),
+    FRAC_CONST(0.41154231991376522),
+    FRAC_CONST(0.41293989091510808),
+    FRAC_CONST(0.4143364902289991),
+    FRAC_CONST(0.41573211456910536),
+    FRAC_CONST(0.41712676065138787),
+    FRAC_CONST(0.4185204251941097),
+    FRAC_CONST(0.41991310491784362),
+    FRAC_CONST(0.42130479654547964),
+    FRAC_CONST(0.42269549680223295),
+    FRAC_CONST(0.42408520241565156),
+    FRAC_CONST(0.4254739101156238),
+    FRAC_CONST(0.42686161663438643),
+    FRAC_CONST(0.42824831870653196),
+    FRAC_CONST(0.42963401306901638),
+    FRAC_CONST(0.43101869646116703),
+    FRAC_CONST(0.43240236562469014),
+    FRAC_CONST(0.43378501730367852),
+    FRAC_CONST(0.43516664824461926),
+    FRAC_CONST(0.4365472551964012),
+    FRAC_CONST(0.43792683491032286),
+    FRAC_CONST(0.43930538414009995),
+    FRAC_CONST(0.4406828996418729),
+    FRAC_CONST(0.4420593781742147),
+    FRAC_CONST(0.44343481649813848),
+    FRAC_CONST(0.44480921137710488),
+    FRAC_CONST(0.44618255957703007),
+    FRAC_CONST(0.44755485786629301),
+    FRAC_CONST(0.44892610301574326),
+    FRAC_CONST(0.45029629179870861),
+    FRAC_CONST(0.45166542099100249),
+    FRAC_CONST(0.45303348737093158),
+    FRAC_CONST(0.45440048771930358),
+    FRAC_CONST(0.45576641881943464),
+    FRAC_CONST(0.45713127745715698),
+    FRAC_CONST(0.45849506042082627),
+    FRAC_CONST(0.45985776450132954),
+    FRAC_CONST(0.46121938649209238),
+    FRAC_CONST(0.46257992318908681),
+    FRAC_CONST(0.46393937139083852),
+    FRAC_CONST(0.4652977278984346),
+    FRAC_CONST(0.46665498951553092),
+    FRAC_CONST(0.46801115304835983),
+    FRAC_CONST(0.46936621530573752),
+    FRAC_CONST(0.4707201730990716),
+    FRAC_CONST(0.47207302324236866),
+    FRAC_CONST(0.47342476255224153),
+    FRAC_CONST(0.47477538784791712),
+    FRAC_CONST(0.47612489595124358),
+    FRAC_CONST(0.47747328368669806),
+    FRAC_CONST(0.47882054788139389),
+    FRAC_CONST(0.48016668536508839),
+    FRAC_CONST(0.48151169297018986),
+    FRAC_CONST(0.48285556753176567),
+    FRAC_CONST(0.48419830588754903),
+    FRAC_CONST(0.48553990487794696),
+    FRAC_CONST(0.48688036134604734),
+    FRAC_CONST(0.48821967213762679),
+    FRAC_CONST(0.48955783410115744),
+    FRAC_CONST(0.49089484408781509),
+    FRAC_CONST(0.49223069895148602),
+    FRAC_CONST(0.49356539554877477),
+    FRAC_CONST(0.49489893073901126),
+    FRAC_CONST(0.49623130138425825),
+    FRAC_CONST(0.49756250434931915),
+    FRAC_CONST(0.49889253650174459),
+    FRAC_CONST(0.50022139471184068),
+    FRAC_CONST(0.50154907585267539),
+    FRAC_CONST(0.50287557680008699),
+    FRAC_CONST(0.50420089443269034),
+    FRAC_CONST(0.50552502563188539),
+    FRAC_CONST(0.50684796728186321),
+    FRAC_CONST(0.5081697162696146),
+    FRAC_CONST(0.50949026948493636),
+    FRAC_CONST(0.51080962382043904),
+    FRAC_CONST(0.51212777617155469),
+    FRAC_CONST(0.51344472343654346),
+    FRAC_CONST(0.5147604625165012),
+    FRAC_CONST(0.51607499031536663),
+    FRAC_CONST(0.51738830373992906),
+    FRAC_CONST(0.51870039969983495),
+    FRAC_CONST(0.52001127510759604),
+    FRAC_CONST(0.52132092687859566),
+    FRAC_CONST(0.52262935193109661),
+    FRAC_CONST(0.5239365471862486),
+    FRAC_CONST(0.52524250956809471),
+    FRAC_CONST(0.52654723600357944),
+    FRAC_CONST(0.52785072342255523),
+    FRAC_CONST(0.52915296875779061),
+    FRAC_CONST(0.53045396894497632),
+    FRAC_CONST(0.53175372092273332),
+    FRAC_CONST(0.53305222163261945),
+    FRAC_CONST(0.53434946801913752),
+    FRAC_CONST(0.53564545702974109),
+    FRAC_CONST(0.53694018561484291),
+    FRAC_CONST(0.5382336507278217),
+    FRAC_CONST(0.53952584932502889),
+    FRAC_CONST(0.54081677836579667),
+    FRAC_CONST(0.54210643481244392),
+    FRAC_CONST(0.5433948156302848),
+    FRAC_CONST(0.54468191778763453),
+    FRAC_CONST(0.54596773825581757),
+    FRAC_CONST(0.54725227400917409),
+    FRAC_CONST(0.54853552202506739),
+    FRAC_CONST(0.54981747928389091),
+    FRAC_CONST(0.55109814276907543),
+    FRAC_CONST(0.55237750946709607),
+    FRAC_CONST(0.55365557636747931),
+    FRAC_CONST(0.55493234046281037),
+    FRAC_CONST(0.55620779874873993),
+    FRAC_CONST(0.55748194822399155),
+    FRAC_CONST(0.55875478589036831),
+    FRAC_CONST(0.56002630875276038),
+    FRAC_CONST(0.56129651381915147),
+    FRAC_CONST(0.56256539810062656),
+    FRAC_CONST(0.56383295861137817),
+    FRAC_CONST(0.56509919236871398),
+    FRAC_CONST(0.56636409639306384),
+    FRAC_CONST(0.56762766770798623),
+    FRAC_CONST(0.56888990334017586),
+    FRAC_CONST(0.5701508003194703),
+    FRAC_CONST(0.57141035567885723),
+    FRAC_CONST(0.57266856645448116),
+    FRAC_CONST(0.57392542968565075),
+    FRAC_CONST(0.57518094241484508),
+    FRAC_CONST(0.57643510168772183),
+    FRAC_CONST(0.5776879045531228),
+    FRAC_CONST(0.57893934806308178),
+    FRAC_CONST(0.58018942927283168),
+    FRAC_CONST(0.58143814524081017),
+    FRAC_CONST(0.58268549302866846),
+    FRAC_CONST(0.58393146970127618),
+    FRAC_CONST(0.58517607232673041),
+    FRAC_CONST(0.5864192979763605),
+    FRAC_CONST(0.58766114372473666),
+    FRAC_CONST(0.58890160664967572),
+    FRAC_CONST(0.59014068383224882),
+    FRAC_CONST(0.59137837235678758),
+    FRAC_CONST(0.59261466931089113),
+    FRAC_CONST(0.59384957178543363),
+    FRAC_CONST(0.59508307687456996),
+    FRAC_CONST(0.59631518167574371),
+    FRAC_CONST(0.59754588328969316),
+    FRAC_CONST(0.59877517882045872),
+    FRAC_CONST(0.60000306537538894),
+    FRAC_CONST(0.6012295400651485),
+    FRAC_CONST(0.60245460000372375),
+    FRAC_CONST(0.60367824230843037),
+    FRAC_CONST(0.60490046409991982),
+    FRAC_CONST(0.60612126250218612),
+    FRAC_CONST(0.60734063464257293),
+    FRAC_CONST(0.60855857765177945),
+    FRAC_CONST(0.60977508866386843),
+    FRAC_CONST(0.61099016481627166),
+    FRAC_CONST(0.61220380324979795),
+    FRAC_CONST(0.61341600110863859),
+    FRAC_CONST(0.61462675554037505),
+    FRAC_CONST(0.61583606369598509),
+    FRAC_CONST(0.61704392272984976),
+    FRAC_CONST(0.61825032979976025),
+    FRAC_CONST(0.61945528206692402),
+    FRAC_CONST(0.62065877669597214),
+    FRAC_CONST(0.62186081085496536),
+    FRAC_CONST(0.62306138171540126),
+    FRAC_CONST(0.62426048645222065),
+    FRAC_CONST(0.62545812224381436),
+    FRAC_CONST(0.62665428627202935),
+    FRAC_CONST(0.62784897572217646),
+    FRAC_CONST(0.629042187783036),
+    FRAC_CONST(0.63023391964686437),
+    FRAC_CONST(0.63142416850940186),
+    FRAC_CONST(0.63261293156987741),
+    FRAC_CONST(0.63380020603101728),
+    FRAC_CONST(0.63498598909904946),
+    FRAC_CONST(0.63617027798371217),
+    FRAC_CONST(0.63735306989825913),
+    FRAC_CONST(0.63853436205946679),
+    FRAC_CONST(0.63971415168764045),
+    FRAC_CONST(0.64089243600662138),
+    FRAC_CONST(0.64206921224379254),
+    FRAC_CONST(0.64324447763008585),
+    FRAC_CONST(0.64441822939998838),
+    FRAC_CONST(0.64559046479154869),
+    FRAC_CONST(0.64676118104638392),
+    FRAC_CONST(0.64793037540968534),
+    FRAC_CONST(0.64909804513022595),
+    FRAC_CONST(0.65026418746036585),
+    FRAC_CONST(0.65142879965605982),
+    FRAC_CONST(0.65259187897686244),
+    FRAC_CONST(0.65375342268593606),
+    FRAC_CONST(0.65491342805005603),
+    FRAC_CONST(0.6560718923396176),
+    FRAC_CONST(0.65722881282864254),
+    FRAC_CONST(0.65838418679478505),
+    FRAC_CONST(0.65953801151933866),
+    FRAC_CONST(0.6606902842872423),
+    FRAC_CONST(0.66184100238708687),
+    FRAC_CONST(0.66299016311112147),
+    FRAC_CONST(0.66413776375526001),
+    FRAC_CONST(0.66528380161908718),
+    FRAC_CONST(0.66642827400586524),
+    FRAC_CONST(0.66757117822254031),
+    FRAC_CONST(0.66871251157974798),
+    FRAC_CONST(0.66985227139182102),
+    FRAC_CONST(0.67099045497679422),
+    FRAC_CONST(0.67212705965641173),
+    FRAC_CONST(0.67326208275613297),
+    FRAC_CONST(0.67439552160513905),
+    FRAC_CONST(0.67552737353633852),
+    FRAC_CONST(0.67665763588637495),
+    FRAC_CONST(0.6777863059956315),
+    FRAC_CONST(0.67891338120823841),
+    FRAC_CONST(0.68003885887207893),
+    FRAC_CONST(0.68116273633879543),
+    FRAC_CONST(0.68228501096379557),
+    FRAC_CONST(0.68340568010625868),
+    FRAC_CONST(0.6845247411291423),
+    FRAC_CONST(0.68564219139918747),
+    FRAC_CONST(0.68675802828692589),
+    FRAC_CONST(0.68787224916668555),
+    FRAC_CONST(0.68898485141659704),
+    FRAC_CONST(0.69009583241859995),
+    FRAC_CONST(0.69120518955844845),
+    FRAC_CONST(0.69231292022571822),
+    FRAC_CONST(0.69341902181381176),
+    FRAC_CONST(0.69452349171996552),
+    FRAC_CONST(0.69562632734525487),
+    FRAC_CONST(0.6967275260946012),
+    FRAC_CONST(0.69782708537677729),
+    FRAC_CONST(0.69892500260441415),
+    FRAC_CONST(0.70002127519400625),
+    FRAC_CONST(0.70111590056591866),
+    FRAC_CONST(0.70220887614439187),
+    FRAC_CONST(0.70330019935754873),
+    FRAC_CONST(0.70438986763740041),
+    FRAC_CONST(0.7054778784198521),
+    FRAC_CONST(0.70656422914470951),
+    FRAC_CONST(0.70764891725568435),
+    FRAC_CONST(0.70873194020040065),
+    FRAC_CONST(0.70981329543040084),
+    FRAC_CONST(0.71089298040115168),
+    FRAC_CONST(0.71197099257204999),
+    FRAC_CONST(0.71304732940642923),
+    FRAC_CONST(0.71412198837156471),
+    FRAC_CONST(0.71519496693868001),
+    FRAC_CONST(0.71626626258295312),
+    FRAC_CONST(0.71733587278352173),
+    FRAC_CONST(0.71840379502348972),
+    FRAC_CONST(0.71947002678993299),
+    FRAC_CONST(0.72053456557390527),
+    FRAC_CONST(0.72159740887044366),
+    FRAC_CONST(0.72265855417857561),
+    FRAC_CONST(0.72371799900132339),
+    FRAC_CONST(0.72477574084571128),
+    FRAC_CONST(0.72583177722277037),
+    FRAC_CONST(0.72688610564754497),
+    FRAC_CONST(0.72793872363909862),
+    FRAC_CONST(0.72898962872051931),
+    FRAC_CONST(0.73003881841892615),
+    FRAC_CONST(0.73108629026547423),
+    FRAC_CONST(0.73213204179536129),
+    FRAC_CONST(0.73317607054783274),
+    FRAC_CONST(0.73421837406618817),
+    FRAC_CONST(0.73525894989778673),
+    FRAC_CONST(0.73629779559405306),
+    FRAC_CONST(0.73733490871048279),
+    FRAC_CONST(0.73837028680664851),
+    FRAC_CONST(0.73940392744620576),
+    FRAC_CONST(0.74043582819689802),
+    FRAC_CONST(0.74146598663056329),
+    FRAC_CONST(0.74249440032313918),
+    FRAC_CONST(0.74352106685466912),
+    FRAC_CONST(0.74454598380930725),
+    FRAC_CONST(0.74556914877532543),
+    FRAC_CONST(0.74659055934511731),
+    FRAC_CONST(0.74761021311520515),
+    FRAC_CONST(0.74862810768624533),
+    FRAC_CONST(0.74964424066303348),
+    FRAC_CONST(0.75065860965451059),
+    FRAC_CONST(0.75167121227376843),
+    FRAC_CONST(0.75268204613805523),
+    FRAC_CONST(0.75369110886878121),
+    FRAC_CONST(0.75469839809152439),
+    FRAC_CONST(0.75570391143603588),
+    FRAC_CONST(0.75670764653624567),
+    FRAC_CONST(0.75770960103026808),
+    FRAC_CONST(0.75870977256040739),
+    FRAC_CONST(0.75970815877316344),
+    FRAC_CONST(0.76070475731923692),
+    FRAC_CONST(0.76169956585353527),
+    FRAC_CONST(0.76269258203517787),
+    FRAC_CONST(0.76368380352750187),
+    FRAC_CONST(0.76467322799806714),
+    FRAC_CONST(0.76566085311866239),
+    FRAC_CONST(0.76664667656531038),
+    FRAC_CONST(0.76763069601827327),
+    FRAC_CONST(0.76861290916205827),
+    FRAC_CONST(0.76959331368542294),
+    FRAC_CONST(0.7705719072813807),
+    FRAC_CONST(0.7715486876472063),
+    FRAC_CONST(0.77252365248444133),
+    FRAC_CONST(0.77349679949889905),
+    FRAC_CONST(0.77446812640067086),
+    FRAC_CONST(0.77543763090413043),
+    FRAC_CONST(0.77640531072794039),
+    FRAC_CONST(0.7773711635950562),
+    FRAC_CONST(0.77833518723273309),
+    FRAC_CONST(0.7792973793725303),
+    FRAC_CONST(0.78025773775031659),
+    FRAC_CONST(0.78121626010627609),
+    FRAC_CONST(0.7821729441849129),
+    FRAC_CONST(0.78312778773505731),
+    FRAC_CONST(0.78408078850986995),
+    FRAC_CONST(0.78503194426684808),
+    FRAC_CONST(0.78598125276783015),
+    FRAC_CONST(0.7869287117790017),
+    FRAC_CONST(0.78787431907090011),
+    FRAC_CONST(0.78881807241842017),
+    FRAC_CONST(0.78975996960081907),
+    FRAC_CONST(0.79070000840172161),
+    FRAC_CONST(0.79163818660912577),
+    FRAC_CONST(0.79257450201540758),
+    FRAC_CONST(0.79350895241732666),
+    FRAC_CONST(0.79444153561603059),
+    FRAC_CONST(0.79537224941706119),
+    FRAC_CONST(0.79630109163035911),
+    FRAC_CONST(0.7972280600702687),
+    FRAC_CONST(0.79815315255554375),
+    FRAC_CONST(0.79907636690935235),
+    FRAC_CONST(0.79999770095928191),
+    FRAC_CONST(0.8009171525373443),
+    FRAC_CONST(0.80183471947998131),
+    FRAC_CONST(0.80275039962806916),
+    FRAC_CONST(0.80366419082692409),
+    FRAC_CONST(0.804576090926307),
+    FRAC_CONST(0.80548609778042912),
+    FRAC_CONST(0.80639420924795624),
+    FRAC_CONST(0.80730042319201445),
+    FRAC_CONST(0.80820473748019472),
+    FRAC_CONST(0.80910714998455813),
+    FRAC_CONST(0.81000765858164114),
+    FRAC_CONST(0.81090626115245967),
+    FRAC_CONST(0.81180295558251536),
+    FRAC_CONST(0.81269773976179949),
+    FRAC_CONST(0.81359061158479851),
+    FRAC_CONST(0.81448156895049861),
+    FRAC_CONST(0.81537060976239129),
+    FRAC_CONST(0.81625773192847739),
+    FRAC_CONST(0.81714293336127297),
+    FRAC_CONST(0.81802621197781344),
+    FRAC_CONST(0.81890756569965895),
+    FRAC_CONST(0.81978699245289899),
+    FRAC_CONST(0.82066449016815746),
+    FRAC_CONST(0.82154005678059761),
+    FRAC_CONST(0.82241369022992639),
+    FRAC_CONST(0.82328538846040011),
+    FRAC_CONST(0.82415514942082857),
+    FRAC_CONST(0.82502297106458022),
+    FRAC_CONST(0.82588885134958678),
+    FRAC_CONST(0.82675278823834852),
+    FRAC_CONST(0.8276147796979384),
+    FRAC_CONST(0.82847482370000713),
+    FRAC_CONST(0.82933291822078825),
+    FRAC_CONST(0.83018906124110237),
+    FRAC_CONST(0.83104325074636232),
+    FRAC_CONST(0.83189548472657759),
+    FRAC_CONST(0.83274576117635946),
+    FRAC_CONST(0.83359407809492514),
+    FRAC_CONST(0.83444043348610319),
+    FRAC_CONST(0.83528482535833737),
+    FRAC_CONST(0.83612725172469216),
+    FRAC_CONST(0.83696771060285702),
+    FRAC_CONST(0.83780620001515094),
+    FRAC_CONST(0.8386427179885273),
+    FRAC_CONST(0.83947726255457855),
+    FRAC_CONST(0.84030983174954077),
+    FRAC_CONST(0.84114042361429808),
+    FRAC_CONST(0.84196903619438768),
+    FRAC_CONST(0.84279566754000412),
+    FRAC_CONST(0.84362031570600404),
+    FRAC_CONST(0.84444297875191066),
+    FRAC_CONST(0.84526365474191822),
+    FRAC_CONST(0.84608234174489694),
+    FRAC_CONST(0.84689903783439735),
+    FRAC_CONST(0.84771374108865427),
+    FRAC_CONST(0.84852644959059265),
+    FRAC_CONST(0.84933716142783067),
+    FRAC_CONST(0.85014587469268521),
+    FRAC_CONST(0.85095258748217573),
+    FRAC_CONST(0.85175729789802912),
+    FRAC_CONST(0.85256000404668397),
+    FRAC_CONST(0.85336070403929543),
+    FRAC_CONST(0.85415939599173873),
+    FRAC_CONST(0.85495607802461482),
+    FRAC_CONST(0.85575074826325392),
+    FRAC_CONST(0.85654340483771996),
+    FRAC_CONST(0.85733404588281559),
+    FRAC_CONST(0.85812266953808602),
+    FRAC_CONST(0.8589092739478239),
+    FRAC_CONST(0.85969385726107261),
+    FRAC_CONST(0.86047641763163207),
+    FRAC_CONST(0.86125695321806206),
+    FRAC_CONST(0.86203546218368721),
+    FRAC_CONST(0.86281194269660033),
+    FRAC_CONST(0.86358639292966799),
+    FRAC_CONST(0.86435881106053403),
+    FRAC_CONST(0.86512919527162369),
+    FRAC_CONST(0.86589754375014882),
+    FRAC_CONST(0.86666385468811102),
+    FRAC_CONST(0.86742812628230692),
+    FRAC_CONST(0.86819035673433131),
+    FRAC_CONST(0.86895054425058238),
+    FRAC_CONST(0.86970868704226556),
+    FRAC_CONST(0.87046478332539767),
+    FRAC_CONST(0.8712188313208109),
+    FRAC_CONST(0.8719708292541577),
+    FRAC_CONST(0.8727207753559143),
+    FRAC_CONST(0.87346866786138488),
+    FRAC_CONST(0.8742145050107063),
+    FRAC_CONST(0.87495828504885154),
+    FRAC_CONST(0.8757000062256346),
+    FRAC_CONST(0.87643966679571361),
+    FRAC_CONST(0.87717726501859594),
+    FRAC_CONST(0.87791279915864173),
+    FRAC_CONST(0.87864626748506813),
+    FRAC_CONST(0.87937766827195318),
+    FRAC_CONST(0.88010699979824036),
+    FRAC_CONST(0.88083426034774204),
+    FRAC_CONST(0.88155944820914378),
+    FRAC_CONST(0.8822825616760086),
+    FRAC_CONST(0.88300359904678072),
+    FRAC_CONST(0.88372255862478966),
+    FRAC_CONST(0.8844394387182537),
+    FRAC_CONST(0.88515423764028511),
+    FRAC_CONST(0.88586695370889279),
+    FRAC_CONST(0.88657758524698704),
+    FRAC_CONST(0.88728613058238315),
+    FRAC_CONST(0.88799258804780556),
+    FRAC_CONST(0.88869695598089171),
+    FRAC_CONST(0.88939923272419552),
+    FRAC_CONST(0.89009941662519221),
+    FRAC_CONST(0.89079750603628149),
+    FRAC_CONST(0.89149349931479138),
+    FRAC_CONST(0.89218739482298248),
+    FRAC_CONST(0.89287919092805168),
+    FRAC_CONST(0.89356888600213602),
+    FRAC_CONST(0.89425647842231604),
+    FRAC_CONST(0.89494196657062075),
+    FRAC_CONST(0.89562534883403),
+    FRAC_CONST(0.89630662360447966),
+    FRAC_CONST(0.89698578927886397),
+    FRAC_CONST(0.89766284425904075),
+    FRAC_CONST(0.89833778695183419),
+    FRAC_CONST(0.89901061576903907),
+    FRAC_CONST(0.89968132912742393),
+    FRAC_CONST(0.9003499254487356),
+    FRAC_CONST(0.90101640315970233),
+    FRAC_CONST(0.90168076069203773),
+    FRAC_CONST(0.9023429964824442),
+    FRAC_CONST(0.90300310897261704),
+    FRAC_CONST(0.90366109660924798),
+    FRAC_CONST(0.90431695784402832),
+    FRAC_CONST(0.90497069113365325),
+    FRAC_CONST(0.90562229493982516),
+    FRAC_CONST(0.90627176772925766),
+    FRAC_CONST(0.90691910797367803),
+    FRAC_CONST(0.90756431414983252),
+    FRAC_CONST(0.9082073847394887),
+    FRAC_CONST(0.90884831822943912),
+    FRAC_CONST(0.90948711311150543),
+    FRAC_CONST(0.91012376788254157),
+    FRAC_CONST(0.91075828104443757),
+    FRAC_CONST(0.91139065110412232),
+    FRAC_CONST(0.91202087657356823),
+    FRAC_CONST(0.9126489559697939),
+    FRAC_CONST(0.91327488781486776),
+    FRAC_CONST(0.91389867063591168),
+    FRAC_CONST(0.91452030296510445),
+    FRAC_CONST(0.91513978333968526),
+    FRAC_CONST(0.91575711030195672),
+    FRAC_CONST(0.91637228239928914),
+    FRAC_CONST(0.91698529818412289),
+    FRAC_CONST(0.91759615621397295),
+    FRAC_CONST(0.9182048550514309),
+    FRAC_CONST(0.91881139326416994),
+    FRAC_CONST(0.91941576942494696),
+    FRAC_CONST(0.92001798211160657),
+    FRAC_CONST(0.92061802990708386),
+    FRAC_CONST(0.92121591139940873),
+    FRAC_CONST(0.92181162518170812),
+    FRAC_CONST(0.92240516985220988),
+    FRAC_CONST(0.92299654401424625),
+    FRAC_CONST(0.92358574627625656),
+    FRAC_CONST(0.9241727752517912),
+    FRAC_CONST(0.92475762955951391),
+    FRAC_CONST(0.9253403078232062),
+    FRAC_CONST(0.92592080867176996),
+    FRAC_CONST(0.92649913073923051),
+    FRAC_CONST(0.9270752726647401),
+    FRAC_CONST(0.92764923309258118),
+    FRAC_CONST(0.92822101067216944),
+    FRAC_CONST(0.92879060405805702),
+    FRAC_CONST(0.9293580119099355),
+    FRAC_CONST(0.92992323289263956),
+    FRAC_CONST(0.93048626567614978),
+    FRAC_CONST(0.93104710893559517),
+    FRAC_CONST(0.93160576135125783),
+    FRAC_CONST(0.93216222160857432),
+    FRAC_CONST(0.93271648839814025),
+    FRAC_CONST(0.93326856041571205),
+    FRAC_CONST(0.93381843636221096),
+    FRAC_CONST(0.9343661149437259),
+    FRAC_CONST(0.93491159487151609),
+    FRAC_CONST(0.93545487486201462),
+    FRAC_CONST(0.9359959536368313),
+    FRAC_CONST(0.9365348299227555),
+    FRAC_CONST(0.93707150245175919),
+    FRAC_CONST(0.93760596996099999),
+    FRAC_CONST(0.93813823119282436),
+    FRAC_CONST(0.93866828489477017),
+    FRAC_CONST(0.9391961298195699),
+    FRAC_CONST(0.93972176472515334),
+    FRAC_CONST(0.94024518837465088),
+    FRAC_CONST(0.94076639953639607),
+    FRAC_CONST(0.94128539698392866),
+    FRAC_CONST(0.94180217949599765),
+    FRAC_CONST(0.94231674585656378),
+    FRAC_CONST(0.94282909485480271),
+    FRAC_CONST(0.94333922528510772),
+    FRAC_CONST(0.94384713594709269),
+    FRAC_CONST(0.94435282564559475),
+    FRAC_CONST(0.94485629319067721),
+    FRAC_CONST(0.94535753739763229),
+    FRAC_CONST(0.94585655708698391),
+    FRAC_CONST(0.94635335108449059),
+    FRAC_CONST(0.946847918221148),
+    FRAC_CONST(0.94734025733319194),
+    FRAC_CONST(0.94783036726210101),
+    FRAC_CONST(0.94831824685459909),
+    FRAC_CONST(0.94880389496265838),
+    FRAC_CONST(0.94928731044350201),
+    FRAC_CONST(0.94976849215960668),
+    FRAC_CONST(0.95024743897870523),
+    FRAC_CONST(0.95072414977378961),
+    FRAC_CONST(0.95119862342311323),
+    FRAC_CONST(0.95167085881019386),
+    FRAC_CONST(0.95214085482381583),
+    FRAC_CONST(0.95260861035803324),
+    FRAC_CONST(0.9530741243121722),
+    FRAC_CONST(0.95353739559083328),
+    FRAC_CONST(0.95399842310389449),
+    FRAC_CONST(0.95445720576651349),
+    FRAC_CONST(0.95491374249913052),
+    FRAC_CONST(0.95536803222747024),
+    FRAC_CONST(0.95582007388254542),
+    FRAC_CONST(0.95626986640065814),
+    FRAC_CONST(0.95671740872340305),
+    FRAC_CONST(0.9571626997976701),
+    FRAC_CONST(0.95760573857564624),
+    FRAC_CONST(0.9580465240148186),
+    FRAC_CONST(0.9584850550779761),
+    FRAC_CONST(0.95892133073321306),
+    FRAC_CONST(0.95935534995393079),
+    FRAC_CONST(0.9597871117188399),
+    FRAC_CONST(0.96021661501196343),
+    FRAC_CONST(0.96064385882263847),
+    FRAC_CONST(0.96106884214551935),
+    FRAC_CONST(0.961491563980579),
+    FRAC_CONST(0.9619120233331121),
+    FRAC_CONST(0.9623302192137374),
+    FRAC_CONST(0.96274615063839941),
+    FRAC_CONST(0.96315981662837136),
+    FRAC_CONST(0.96357121621025721),
+    FRAC_CONST(0.96398034841599411),
+    FRAC_CONST(0.96438721228285429),
+    FRAC_CONST(0.9647918068534479),
+    FRAC_CONST(0.96519413117572472),
+    FRAC_CONST(0.96559418430297683),
+    FRAC_CONST(0.96599196529384057),
+    FRAC_CONST(0.96638747321229879),
+    FRAC_CONST(0.96678070712768327),
+    FRAC_CONST(0.96717166611467664),
+    FRAC_CONST(0.96756034925331436),
+    FRAC_CONST(0.9679467556289878),
+    FRAC_CONST(0.9683308843324453),
+    FRAC_CONST(0.96871273445979478),
+    FRAC_CONST(0.9690923051125061),
+    FRAC_CONST(0.96946959539741295),
+    FRAC_CONST(0.96984460442671483),
+    FRAC_CONST(0.97021733131797916),
+    FRAC_CONST(0.97058777519414363),
+    FRAC_CONST(0.97095593518351797),
+    FRAC_CONST(0.97132181041978616),
+    FRAC_CONST(0.97168540004200854),
+    FRAC_CONST(0.9720467031946235),
+    FRAC_CONST(0.97240571902744977),
+    FRAC_CONST(0.97276244669568857),
+    FRAC_CONST(0.97311688535992513),
+    FRAC_CONST(0.97346903418613095),
+    FRAC_CONST(0.9738188923456661),
+    FRAC_CONST(0.97416645901528032),
+    FRAC_CONST(0.97451173337711572),
+    FRAC_CONST(0.97485471461870843),
+    FRAC_CONST(0.97519540193299037),
+    FRAC_CONST(0.97553379451829136),
+    FRAC_CONST(0.97586989157834103),
+    FRAC_CONST(0.97620369232227056),
+    FRAC_CONST(0.97653519596461447),
+    FRAC_CONST(0.97686440172531264),
+    FRAC_CONST(0.97719130882971228),
+    FRAC_CONST(0.97751591650856928),
+    FRAC_CONST(0.97783822399805043),
+    FRAC_CONST(0.97815823053973505),
+    FRAC_CONST(0.97847593538061683),
+    FRAC_CONST(0.97879133777310567),
+    FRAC_CONST(0.97910443697502925),
+    FRAC_CONST(0.97941523224963478),
+    FRAC_CONST(0.97972372286559117),
+    FRAC_CONST(0.98002990809698998),
+    FRAC_CONST(0.98033378722334796),
+    FRAC_CONST(0.98063535952960812),
+    FRAC_CONST(0.98093462430614164),
+    FRAC_CONST(0.98123158084874973),
+    FRAC_CONST(0.98152622845866466),
+    FRAC_CONST(0.9818185664425525),
+    FRAC_CONST(0.98210859411251361),
+    FRAC_CONST(0.98239631078608469),
+    FRAC_CONST(0.98268171578624086),
+    FRAC_CONST(0.98296480844139644),
+    FRAC_CONST(0.98324558808540707),
+    FRAC_CONST(0.98352405405757126),
+    FRAC_CONST(0.98380020570263149),
+    FRAC_CONST(0.98407404237077645),
+    FRAC_CONST(0.9843455634176419),
+    FRAC_CONST(0.9846147682043126),
+    FRAC_CONST(0.9848816560973237),
+    FRAC_CONST(0.98514622646866223),
+    FRAC_CONST(0.98540847869576842),
+    FRAC_CONST(0.98566841216153755),
+    FRAC_CONST(0.98592602625432113),
+    FRAC_CONST(0.98618132036792827),
+    FRAC_CONST(0.98643429390162707),
+    FRAC_CONST(0.98668494626014669),
+    FRAC_CONST(0.98693327685367771),
+    FRAC_CONST(0.98717928509787434),
+    FRAC_CONST(0.98742297041385541),
+    FRAC_CONST(0.98766433222820571),
+    FRAC_CONST(0.98790336997297779),
+    FRAC_CONST(0.98814008308569257),
+    FRAC_CONST(0.98837447100934128),
+    FRAC_CONST(0.98860653319238645),
+    FRAC_CONST(0.98883626908876354),
+    FRAC_CONST(0.98906367815788154),
+    FRAC_CONST(0.98928875986462517),
+    FRAC_CONST(0.98951151367935519),
+    FRAC_CONST(0.98973193907791057),
+    FRAC_CONST(0.98995003554160899),
+    FRAC_CONST(0.9901658025572484),
+    FRAC_CONST(0.99037923961710816),
+    FRAC_CONST(0.99059034621895015),
+    FRAC_CONST(0.99079912186602037),
+    FRAC_CONST(0.99100556606704937),
+    FRAC_CONST(0.99120967833625406),
+    FRAC_CONST(0.99141145819333854),
+    FRAC_CONST(0.99161090516349537),
+    FRAC_CONST(0.99180801877740643),
+    FRAC_CONST(0.99200279857124452),
+    FRAC_CONST(0.99219524408667392),
+    FRAC_CONST(0.99238535487085167),
+    FRAC_CONST(0.99257313047642881),
+    FRAC_CONST(0.99275857046155114),
+    FRAC_CONST(0.99294167438986047),
+    FRAC_CONST(0.99312244183049558),
+    FRAC_CONST(0.99330087235809328),
+    FRAC_CONST(0.99347696555278919),
+    FRAC_CONST(0.99365072100021912),
+    FRAC_CONST(0.99382213829151966),
+    FRAC_CONST(0.99399121702332938),
+    FRAC_CONST(0.99415795679778973),
+    FRAC_CONST(0.99432235722254581),
+    FRAC_CONST(0.9944844179107476),
+    FRAC_CONST(0.99464413848105071),
+    FRAC_CONST(0.99480151855761711),
+    FRAC_CONST(0.99495655777011638),
+    FRAC_CONST(0.99510925575372611),
+    FRAC_CONST(0.99525961214913339),
+    FRAC_CONST(0.9954076266025349),
+    FRAC_CONST(0.99555329876563847),
+    FRAC_CONST(0.99569662829566352),
+    FRAC_CONST(0.99583761485534161),
+    FRAC_CONST(0.99597625811291779),
+    FRAC_CONST(0.99611255774215113),
+    FRAC_CONST(0.99624651342231552),
+    FRAC_CONST(0.99637812483820021),
+    FRAC_CONST(0.99650739168011082),
+    FRAC_CONST(0.9966343136438699),
+    FRAC_CONST(0.996758890430818),
+    FRAC_CONST(0.99688112174781385),
+    FRAC_CONST(0.99700100730723529),
+    FRAC_CONST(0.99711854682697998),
+    FRAC_CONST(0.99723374003046616),
+    FRAC_CONST(0.99734658664663323),
+    FRAC_CONST(0.99745708640994191),
+    FRAC_CONST(0.99756523906037575),
+    FRAC_CONST(0.997671044343441),
+    FRAC_CONST(0.99777450201016782),
+    FRAC_CONST(0.99787561181711015),
+    FRAC_CONST(0.99797437352634699),
+    FRAC_CONST(0.99807078690548234),
+    FRAC_CONST(0.99816485172764624),
+    FRAC_CONST(0.99825656777149518),
+    FRAC_CONST(0.99834593482121237),
+    FRAC_CONST(0.99843295266650844),
+    FRAC_CONST(0.99851762110262221),
+    FRAC_CONST(0.99859993993032037),
+    FRAC_CONST(0.99867990895589909),
+    FRAC_CONST(0.99875752799118334),
+    FRAC_CONST(0.99883279685352799),
+    FRAC_CONST(0.99890571536581829),
+    FRAC_CONST(0.99897628335646982),
+    FRAC_CONST(0.99904450065942929),
+    FRAC_CONST(0.99911036711417489),
+    FRAC_CONST(0.99917388256571638),
+    FRAC_CONST(0.99923504686459585),
+    FRAC_CONST(0.99929385986688779),
+    FRAC_CONST(0.99935032143419944),
+    FRAC_CONST(0.9994044314336713),
+    FRAC_CONST(0.99945618973797734),
+    FRAC_CONST(0.99950559622532531),
+    FRAC_CONST(0.99955265077945699),
+    FRAC_CONST(0.99959735328964838),
+    FRAC_CONST(0.9996397036507102),
+    FRAC_CONST(0.99967970176298793),
+    FRAC_CONST(0.99971734753236219),
+    FRAC_CONST(0.99975264087024884),
+    FRAC_CONST(0.99978558169359921),
+    FRAC_CONST(0.99981616992490041),
+    FRAC_CONST(0.99984440549217524),
+    FRAC_CONST(0.99987028832898295),
+    FRAC_CONST(0.99989381837441849),
+    FRAC_CONST(0.99991499557311347),
+    FRAC_CONST(0.999933819875236),
+    FRAC_CONST(0.99995029123649048),
+    FRAC_CONST(0.99996440961811828),
+    FRAC_CONST(0.99997617498689761),
+    FRAC_CONST(0.9999855873151432),
+    FRAC_CONST(0.99999264658070719),
+    FRAC_CONST(0.99999735276697821),
+    FRAC_CONST(0.99999970586288223)
+};
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+real_t sine_long_960[] =
+{
+    FRAC_CONST(0.00081812299560725323),
+    FRAC_CONST(0.0024543667964602917),
+    FRAC_CONST(0.0040906040262347889),
+    FRAC_CONST(0.0057268303042312674),
+    FRAC_CONST(0.0073630412497795667),
+    FRAC_CONST(0.0089992324822505774),
+    FRAC_CONST(0.010635399621067975),
+    FRAC_CONST(0.012271538285719924),
+    FRAC_CONST(0.013907644095770845),
+    FRAC_CONST(0.015543712670873098),
+    FRAC_CONST(0.017179739630778748),
+    FRAC_CONST(0.018815720595351273),
+    FRAC_CONST(0.020451651184577292),
+    FRAC_CONST(0.022087527018578291),
+    FRAC_CONST(0.023723343717622358),
+    FRAC_CONST(0.025359096902135895),
+    FRAC_CONST(0.02699478219271537),
+    FRAC_CONST(0.028630395210139003),
+    FRAC_CONST(0.030265931575378519),
+    FRAC_CONST(0.031901386909610863),
+    FRAC_CONST(0.033536756834229922),
+    FRAC_CONST(0.035172036970858266),
+    FRAC_CONST(0.036807222941358832),
+    FRAC_CONST(0.038442310367846677),
+    FRAC_CONST(0.040077294872700696),
+    FRAC_CONST(0.041712172078575326),
+    FRAC_CONST(0.043346937608412288),
+    FRAC_CONST(0.044981587085452281),
+    FRAC_CONST(0.046616116133246711),
+    FRAC_CONST(0.048250520375669431),
+    FRAC_CONST(0.049884795436928406),
+    FRAC_CONST(0.051518936941577477),
+    FRAC_CONST(0.053152940514528055),
+    FRAC_CONST(0.05478680178106083),
+    FRAC_CONST(0.056420516366837495),
+    FRAC_CONST(0.05805407989791244),
+    FRAC_CONST(0.059687488000744485),
+    FRAC_CONST(0.061320736302208578),
+    FRAC_CONST(0.062953820429607482),
+    FRAC_CONST(0.064586736010683557),
+    FRAC_CONST(0.066219478673630344),
+    FRAC_CONST(0.06785204404710439),
+    FRAC_CONST(0.069484427760236861),
+    FRAC_CONST(0.071116625442645326),
+    FRAC_CONST(0.072748632724445372),
+    FRAC_CONST(0.07438044523626236),
+    FRAC_CONST(0.076012058609243122),
+    FRAC_CONST(0.077643468475067631),
+    FRAC_CONST(0.079274670465960706),
+    FRAC_CONST(0.080905660214703745),
+    FRAC_CONST(0.082536433354646319),
+    FRAC_CONST(0.084166985519717977),
+    FRAC_CONST(0.085797312344439894),
+    FRAC_CONST(0.08742740946393647),
+    FRAC_CONST(0.089057272513947183),
+    FRAC_CONST(0.090686897130838162),
+    FRAC_CONST(0.092316278951613845),
+    FRAC_CONST(0.093945413613928788),
+    FRAC_CONST(0.095574296756099186),
+    FRAC_CONST(0.097202924017114667),
+    FRAC_CONST(0.098831291036649963),
+    FRAC_CONST(0.10045939345507648),
+    FRAC_CONST(0.10208722691347409),
+    FRAC_CONST(0.10371478705364276),
+    FRAC_CONST(0.10534206951811415),
+    FRAC_CONST(0.10696906995016341),
+    FRAC_CONST(0.10859578399382072),
+    FRAC_CONST(0.11022220729388306),
+    FRAC_CONST(0.11184833549592579),
+    FRAC_CONST(0.11347416424631435),
+    FRAC_CONST(0.11509968919221586),
+    FRAC_CONST(0.11672490598161089),
+    FRAC_CONST(0.11834981026330495),
+    FRAC_CONST(0.11997439768694031),
+    FRAC_CONST(0.12159866390300751),
+    FRAC_CONST(0.12322260456285709),
+    FRAC_CONST(0.12484621531871121),
+    FRAC_CONST(0.12646949182367517),
+    FRAC_CONST(0.12809242973174936),
+    FRAC_CONST(0.12971502469784052),
+    FRAC_CONST(0.13133727237777362),
+    FRAC_CONST(0.13295916842830346),
+    FRAC_CONST(0.13458070850712617),
+    FRAC_CONST(0.13620188827289101),
+    FRAC_CONST(0.1378227033852118),
+    FRAC_CONST(0.13944314950467873),
+    FRAC_CONST(0.14106322229286994),
+    FRAC_CONST(0.14268291741236291),
+    FRAC_CONST(0.14430223052674654),
+    FRAC_CONST(0.1459211573006321),
+    FRAC_CONST(0.14753969339966552),
+    FRAC_CONST(0.14915783449053857),
+    FRAC_CONST(0.15077557624100058),
+    FRAC_CONST(0.15239291431987001),
+    FRAC_CONST(0.1540098443970461),
+    FRAC_CONST(0.15562636214352044),
+    FRAC_CONST(0.15724246323138855),
+    FRAC_CONST(0.15885814333386142),
+    FRAC_CONST(0.16047339812527725),
+    FRAC_CONST(0.16208822328111283),
+    FRAC_CONST(0.16370261447799525),
+    FRAC_CONST(0.16531656739371339),
+    FRAC_CONST(0.16693007770722967),
+    FRAC_CONST(0.16854314109869134),
+    FRAC_CONST(0.17015575324944232),
+    FRAC_CONST(0.17176790984203447),
+    FRAC_CONST(0.17337960656023954),
+    FRAC_CONST(0.1749908390890603),
+    FRAC_CONST(0.17660160311474243),
+    FRAC_CONST(0.17821189432478593),
+    FRAC_CONST(0.17982170840795647),
+    FRAC_CONST(0.18143104105429744),
+    FRAC_CONST(0.18303988795514095),
+    FRAC_CONST(0.1846482448031197),
+    FRAC_CONST(0.18625610729217834),
+    FRAC_CONST(0.1878634711175852),
+    FRAC_CONST(0.18947033197594348),
+    FRAC_CONST(0.19107668556520319),
+    FRAC_CONST(0.19268252758467228),
+    FRAC_CONST(0.19428785373502844),
+    FRAC_CONST(0.19589265971833042),
+    FRAC_CONST(0.19749694123802966),
+    FRAC_CONST(0.19910069399898173),
+    FRAC_CONST(0.20070391370745785),
+    FRAC_CONST(0.20230659607115639),
+    FRAC_CONST(0.20390873679921437),
+    FRAC_CONST(0.20551033160221882),
+    FRAC_CONST(0.20711137619221856),
+    FRAC_CONST(0.2087118662827353),
+    FRAC_CONST(0.21031179758877552),
+    FRAC_CONST(0.21191116582684155),
+    FRAC_CONST(0.21350996671494335),
+    FRAC_CONST(0.21510819597260972),
+    FRAC_CONST(0.21670584932089998),
+    FRAC_CONST(0.2183029224824154),
+    FRAC_CONST(0.21989941118131037),
+    FRAC_CONST(0.22149531114330431),
+    FRAC_CONST(0.22309061809569264),
+    FRAC_CONST(0.22468532776735861),
+    FRAC_CONST(0.22627943588878449),
+    FRAC_CONST(0.22787293819206314),
+    FRAC_CONST(0.22946583041090929),
+    FRAC_CONST(0.23105810828067114),
+    FRAC_CONST(0.23264976753834157),
+    FRAC_CONST(0.23424080392256985),
+    FRAC_CONST(0.2358312131736727),
+    FRAC_CONST(0.23742099103364595),
+    FRAC_CONST(0.23901013324617584),
+    FRAC_CONST(0.24059863555665045),
+    FRAC_CONST(0.24218649371217096),
+    FRAC_CONST(0.24377370346156332),
+    FRAC_CONST(0.24536026055538934),
+    FRAC_CONST(0.24694616074595824),
+    FRAC_CONST(0.24853139978733788),
+    FRAC_CONST(0.25011597343536629),
+    FRAC_CONST(0.25169987744766298),
+    FRAC_CONST(0.25328310758364025),
+    FRAC_CONST(0.25486565960451457),
+    FRAC_CONST(0.25644752927331788),
+    FRAC_CONST(0.25802871235490898),
+    FRAC_CONST(0.25960920461598508),
+    FRAC_CONST(0.26118900182509258),
+    FRAC_CONST(0.26276809975263904),
+    FRAC_CONST(0.264346494170904),
+    FRAC_CONST(0.26592418085405067),
+    FRAC_CONST(0.26750115557813692),
+    FRAC_CONST(0.2690774141211269),
+    FRAC_CONST(0.27065295226290209),
+    FRAC_CONST(0.2722277657852728),
+    FRAC_CONST(0.27380185047198918),
+    FRAC_CONST(0.27537520210875299),
+    FRAC_CONST(0.2769478164832283),
+    FRAC_CONST(0.27851968938505312),
+    FRAC_CONST(0.28009081660585067),
+    FRAC_CONST(0.28166119393924061),
+    FRAC_CONST(0.28323081718085019),
+    FRAC_CONST(0.28479968212832563),
+    FRAC_CONST(0.28636778458134327),
+    FRAC_CONST(0.28793512034162105),
+    FRAC_CONST(0.2895016852129294),
+    FRAC_CONST(0.29106747500110264),
+    FRAC_CONST(0.29263248551405047),
+    FRAC_CONST(0.2941967125617686),
+    FRAC_CONST(0.29576015195635058),
+    FRAC_CONST(0.29732279951199847),
+    FRAC_CONST(0.29888465104503475),
+    FRAC_CONST(0.30044570237391266),
+    FRAC_CONST(0.30200594931922808),
+    FRAC_CONST(0.30356538770373032),
+    FRAC_CONST(0.30512401335233358),
+    FRAC_CONST(0.30668182209212791),
+    FRAC_CONST(0.3082388097523906),
+    FRAC_CONST(0.30979497216459695),
+    FRAC_CONST(0.31135030516243201),
+    FRAC_CONST(0.3129048045818012),
+    FRAC_CONST(0.31445846626084178),
+    FRAC_CONST(0.31601128603993378),
+    FRAC_CONST(0.31756325976171151),
+    FRAC_CONST(0.31911438327107416),
+    FRAC_CONST(0.32066465241519732),
+    FRAC_CONST(0.32221406304354389),
+    FRAC_CONST(0.3237626110078754),
+    FRAC_CONST(0.32531029216226293),
+    FRAC_CONST(0.32685710236309828),
+    FRAC_CONST(0.32840303746910487),
+    FRAC_CONST(0.32994809334134939),
+    FRAC_CONST(0.3314922658432522),
+    FRAC_CONST(0.33303555084059877),
+    FRAC_CONST(0.33457794420155085),
+    FRAC_CONST(0.33611944179665709),
+    FRAC_CONST(0.33766003949886464),
+    FRAC_CONST(0.33919973318352969),
+    FRAC_CONST(0.34073851872842903),
+    FRAC_CONST(0.34227639201377064),
+    FRAC_CONST(0.34381334892220483),
+    FRAC_CONST(0.34534938533883547),
+    FRAC_CONST(0.34688449715123082),
+    FRAC_CONST(0.34841868024943456),
+    FRAC_CONST(0.34995193052597684),
+    FRAC_CONST(0.35148424387588523),
+    FRAC_CONST(0.3530156161966958),
+    FRAC_CONST(0.35454604338846402),
+    FRAC_CONST(0.35607552135377557),
+    FRAC_CONST(0.35760404599775775),
+    FRAC_CONST(0.35913161322809023),
+    FRAC_CONST(0.36065821895501554),
+    FRAC_CONST(0.36218385909135092),
+    FRAC_CONST(0.36370852955249849),
+    FRAC_CONST(0.36523222625645668),
+    FRAC_CONST(0.36675494512383078),
+    FRAC_CONST(0.36827668207784414),
+    FRAC_CONST(0.36979743304434909),
+    FRAC_CONST(0.37131719395183754),
+    FRAC_CONST(0.37283596073145214),
+    FRAC_CONST(0.37435372931699717),
+    FRAC_CONST(0.37587049564494951),
+    FRAC_CONST(0.37738625565446909),
+    FRAC_CONST(0.37890100528741022),
+    FRAC_CONST(0.38041474048833229),
+    FRAC_CONST(0.38192745720451066),
+    FRAC_CONST(0.38343915138594736),
+    FRAC_CONST(0.38494981898538222),
+    FRAC_CONST(0.38645945595830333),
+    FRAC_CONST(0.38796805826295838),
+    FRAC_CONST(0.38947562186036483),
+    FRAC_CONST(0.39098214271432141),
+    FRAC_CONST(0.39248761679141814),
+    FRAC_CONST(0.3939920400610481),
+    FRAC_CONST(0.39549540849541737),
+    FRAC_CONST(0.39699771806955625),
+    FRAC_CONST(0.39849896476132979),
+    FRAC_CONST(0.39999914455144892),
+    FRAC_CONST(0.40149825342348083),
+    FRAC_CONST(0.4029962873638599),
+    FRAC_CONST(0.40449324236189854),
+    FRAC_CONST(0.40598911440979762),
+    FRAC_CONST(0.40748389950265762),
+    FRAC_CONST(0.40897759363848879),
+    FRAC_CONST(0.41047019281822261),
+    FRAC_CONST(0.41196169304572178),
+    FRAC_CONST(0.4134520903277914),
+    FRAC_CONST(0.41494138067418929),
+    FRAC_CONST(0.41642956009763715),
+    FRAC_CONST(0.41791662461383078),
+    FRAC_CONST(0.41940257024145089),
+    FRAC_CONST(0.42088739300217382),
+    FRAC_CONST(0.42237108892068231),
+    FRAC_CONST(0.42385365402467584),
+    FRAC_CONST(0.42533508434488143),
+    FRAC_CONST(0.42681537591506419),
+    FRAC_CONST(0.42829452477203828),
+    FRAC_CONST(0.42977252695567697),
+    FRAC_CONST(0.43124937850892364),
+    FRAC_CONST(0.4327250754778022),
+    FRAC_CONST(0.43419961391142781),
+    FRAC_CONST(0.43567298986201736),
+    FRAC_CONST(0.43714519938489987),
+    FRAC_CONST(0.43861623853852766),
+    FRAC_CONST(0.44008610338448595),
+    FRAC_CONST(0.44155478998750436),
+    FRAC_CONST(0.44302229441546676),
+    FRAC_CONST(0.4444886127394222),
+    FRAC_CONST(0.44595374103359531),
+    FRAC_CONST(0.44741767537539667),
+    FRAC_CONST(0.44888041184543348),
+    FRAC_CONST(0.45034194652752002),
+    FRAC_CONST(0.45180227550868812),
+    FRAC_CONST(0.45326139487919759),
+    FRAC_CONST(0.45471930073254679),
+    FRAC_CONST(0.45617598916548296),
+    FRAC_CONST(0.45763145627801283),
+    FRAC_CONST(0.45908569817341294),
+    FRAC_CONST(0.46053871095824001),
+    FRAC_CONST(0.46199049074234161),
+    FRAC_CONST(0.46344103363886635),
+    FRAC_CONST(0.46489033576427435),
+    FRAC_CONST(0.46633839323834758),
+    FRAC_CONST(0.46778520218420055),
+    FRAC_CONST(0.46923075872829029),
+    FRAC_CONST(0.47067505900042683),
+    FRAC_CONST(0.47211809913378361),
+    FRAC_CONST(0.47355987526490806),
+    FRAC_CONST(0.47500038353373153),
+    FRAC_CONST(0.47643962008357982),
+    FRAC_CONST(0.47787758106118372),
+    FRAC_CONST(0.47931426261668875),
+    FRAC_CONST(0.48074966090366611),
+    FRAC_CONST(0.48218377207912272),
+    FRAC_CONST(0.48361659230351117),
+    FRAC_CONST(0.48504811774074069),
+    FRAC_CONST(0.48647834455818684),
+    FRAC_CONST(0.48790726892670194),
+    FRAC_CONST(0.48933488702062544),
+    FRAC_CONST(0.49076119501779414),
+    FRAC_CONST(0.49218618909955225),
+    FRAC_CONST(0.4936098654507618),
+    FRAC_CONST(0.49503222025981269),
+    FRAC_CONST(0.49645324971863303),
+    FRAC_CONST(0.49787295002269943),
+    FRAC_CONST(0.49929131737104687),
+    FRAC_CONST(0.50070834796627917),
+    FRAC_CONST(0.50212403801457872),
+    FRAC_CONST(0.50353838372571758),
+    FRAC_CONST(0.50495138131306638),
+    FRAC_CONST(0.50636302699360547),
+    FRAC_CONST(0.50777331698793449),
+    FRAC_CONST(0.50918224752028263),
+    FRAC_CONST(0.51058981481851906),
+    FRAC_CONST(0.51199601511416237),
+    FRAC_CONST(0.51340084464239111),
+    FRAC_CONST(0.51480429964205421),
+    FRAC_CONST(0.51620637635567967),
+    FRAC_CONST(0.51760707102948678),
+    FRAC_CONST(0.51900637991339404),
+    FRAC_CONST(0.5204042992610306),
+    FRAC_CONST(0.52180082532974559),
+    FRAC_CONST(0.5231959543806185),
+    FRAC_CONST(0.52458968267846895),
+    FRAC_CONST(0.52598200649186677),
+    FRAC_CONST(0.52737292209314235),
+    FRAC_CONST(0.52876242575839572),
+    FRAC_CONST(0.53015051376750777),
+    FRAC_CONST(0.53153718240414882),
+    FRAC_CONST(0.53292242795578992),
+    FRAC_CONST(0.53430624671371152),
+    FRAC_CONST(0.53568863497301467),
+    FRAC_CONST(0.5370695890326298),
+    FRAC_CONST(0.5384491051953274),
+    FRAC_CONST(0.53982717976772743),
+    FRAC_CONST(0.54120380906030963),
+    FRAC_CONST(0.54257898938742311),
+    FRAC_CONST(0.54395271706729609),
+    FRAC_CONST(0.54532498842204646),
+    FRAC_CONST(0.54669579977769045),
+    FRAC_CONST(0.54806514746415402),
+    FRAC_CONST(0.54943302781528081),
+    FRAC_CONST(0.55079943716884383),
+    FRAC_CONST(0.55216437186655387),
+    FRAC_CONST(0.55352782825406999),
+    FRAC_CONST(0.55488980268100907),
+    FRAC_CONST(0.55625029150095584),
+    FRAC_CONST(0.55760929107147217),
+    FRAC_CONST(0.55896679775410718),
+    FRAC_CONST(0.56032280791440714),
+    FRAC_CONST(0.56167731792192455),
+    FRAC_CONST(0.56303032415022869),
+    FRAC_CONST(0.56438182297691453),
+    FRAC_CONST(0.56573181078361312),
+    FRAC_CONST(0.56708028395600085),
+    FRAC_CONST(0.56842723888380908),
+    FRAC_CONST(0.56977267196083425),
+    FRAC_CONST(0.57111657958494688),
+    FRAC_CONST(0.5724589581581021),
+    FRAC_CONST(0.57379980408634845),
+    FRAC_CONST(0.57513911377983773),
+    FRAC_CONST(0.57647688365283478),
+    FRAC_CONST(0.57781311012372738),
+    FRAC_CONST(0.57914778961503466),
+    FRAC_CONST(0.58048091855341843),
+    FRAC_CONST(0.5818124933696911),
+    FRAC_CONST(0.58314251049882604),
+    FRAC_CONST(0.58447096637996743),
+    FRAC_CONST(0.58579785745643886),
+    FRAC_CONST(0.5871231801757536),
+    FRAC_CONST(0.58844693098962408),
+    FRAC_CONST(0.58976910635397084),
+    FRAC_CONST(0.59108970272893235),
+    FRAC_CONST(0.59240871657887517),
+    FRAC_CONST(0.59372614437240179),
+    FRAC_CONST(0.59504198258236196),
+    FRAC_CONST(0.5963562276858605),
+    FRAC_CONST(0.59766887616426767),
+    FRAC_CONST(0.5989799245032289),
+    FRAC_CONST(0.60028936919267273),
+    FRAC_CONST(0.60159720672682204),
+    FRAC_CONST(0.60290343360420195),
+    FRAC_CONST(0.60420804632765002),
+    FRAC_CONST(0.60551104140432543),
+    FRAC_CONST(0.60681241534571839),
+    FRAC_CONST(0.60811216466765883),
+    FRAC_CONST(0.60941028589032709),
+    FRAC_CONST(0.61070677553826169),
+    FRAC_CONST(0.61200163014036979),
+    FRAC_CONST(0.61329484622993602),
+    FRAC_CONST(0.6145864203446314),
+    FRAC_CONST(0.61587634902652377),
+    FRAC_CONST(0.61716462882208556),
+    FRAC_CONST(0.61845125628220421),
+    FRAC_CONST(0.61973622796219074),
+    FRAC_CONST(0.6210195404217892),
+    FRAC_CONST(0.62230119022518593),
+    FRAC_CONST(0.62358117394101897),
+    FRAC_CONST(0.62485948814238634),
+    FRAC_CONST(0.62613612940685637),
+    FRAC_CONST(0.62741109431647646),
+    FRAC_CONST(0.62868437945778133),
+    FRAC_CONST(0.62995598142180387),
+    FRAC_CONST(0.6312258968040827),
+    FRAC_CONST(0.63249412220467238),
+    FRAC_CONST(0.63376065422815175),
+    FRAC_CONST(0.63502548948363347),
+    FRAC_CONST(0.63628862458477287),
+    FRAC_CONST(0.63755005614977711),
+    FRAC_CONST(0.63880978080141437),
+    FRAC_CONST(0.6400677951670225),
+    FRAC_CONST(0.6413240958785188),
+    FRAC_CONST(0.64257867957240766),
+    FRAC_CONST(0.6438315428897915),
+    FRAC_CONST(0.64508268247637779),
+    FRAC_CONST(0.64633209498248945),
+    FRAC_CONST(0.64757977706307335),
+    FRAC_CONST(0.64882572537770888),
+    FRAC_CONST(0.65006993659061751),
+    FRAC_CONST(0.65131240737067142),
+    FRAC_CONST(0.65255313439140239),
+    FRAC_CONST(0.65379211433101081),
+    FRAC_CONST(0.65502934387237444),
+    FRAC_CONST(0.6562648197030575),
+    FRAC_CONST(0.65749853851531959),
+    FRAC_CONST(0.65873049700612374),
+    FRAC_CONST(0.65996069187714679),
+    FRAC_CONST(0.66118911983478657),
+    FRAC_CONST(0.66241577759017178),
+    FRAC_CONST(0.66364066185917048),
+    FRAC_CONST(0.66486376936239888),
+    FRAC_CONST(0.66608509682523009),
+    FRAC_CONST(0.66730464097780284),
+    FRAC_CONST(0.66852239855503071),
+    FRAC_CONST(0.66973836629660977),
+    FRAC_CONST(0.67095254094702894),
+    FRAC_CONST(0.67216491925557675),
+    FRAC_CONST(0.67337549797635199),
+    FRAC_CONST(0.67458427386827102),
+    FRAC_CONST(0.67579124369507693),
+    FRAC_CONST(0.67699640422534846),
+    FRAC_CONST(0.67819975223250772),
+    FRAC_CONST(0.6794012844948305),
+    FRAC_CONST(0.68060099779545302),
+    FRAC_CONST(0.68179888892238183),
+    FRAC_CONST(0.6829949546685018),
+    FRAC_CONST(0.68418919183158522),
+    FRAC_CONST(0.68538159721429948),
+    FRAC_CONST(0.6865721676242168),
+    FRAC_CONST(0.68776089987382172),
+    FRAC_CONST(0.68894779078052026),
+    FRAC_CONST(0.69013283716664853),
+    FRAC_CONST(0.69131603585948032),
+    FRAC_CONST(0.69249738369123692),
+    FRAC_CONST(0.69367687749909468),
+    FRAC_CONST(0.69485451412519361),
+    FRAC_CONST(0.69603029041664599),
+    FRAC_CONST(0.6972042032255451),
+    FRAC_CONST(0.6983762494089728),
+    FRAC_CONST(0.69954642582900894),
+    FRAC_CONST(0.70071472935273893),
+    FRAC_CONST(0.70188115685226271),
+    FRAC_CONST(0.703045705204703),
+    FRAC_CONST(0.70420837129221303),
+    FRAC_CONST(0.70536915200198613),
+    FRAC_CONST(0.70652804422626281),
+    FRAC_CONST(0.70768504486233985),
+    FRAC_CONST(0.70884015081257845),
+    FRAC_CONST(0.70999335898441229),
+    FRAC_CONST(0.711144666290356),
+    FRAC_CONST(0.71229406964801356),
+    FRAC_CONST(0.71344156598008623),
+    FRAC_CONST(0.71458715221438096),
+    FRAC_CONST(0.71573082528381871),
+    FRAC_CONST(0.71687258212644234),
+    FRAC_CONST(0.7180124196854254),
+    FRAC_CONST(0.71915033490907943),
+    FRAC_CONST(0.72028632475086318),
+    FRAC_CONST(0.72142038616938997),
+    FRAC_CONST(0.72255251612843596),
+    FRAC_CONST(0.72368271159694852),
+    FRAC_CONST(0.72481096954905444),
+    FRAC_CONST(0.72593728696406756),
+    FRAC_CONST(0.72706166082649704),
+    FRAC_CONST(0.72818408812605595),
+    FRAC_CONST(0.72930456585766834),
+    FRAC_CONST(0.73042309102147851),
+    FRAC_CONST(0.73153966062285747),
+    FRAC_CONST(0.73265427167241282),
+    FRAC_CONST(0.73376692118599507),
+    FRAC_CONST(0.73487760618470677),
+    FRAC_CONST(0.73598632369490979),
+    FRAC_CONST(0.73709307074823405),
+    FRAC_CONST(0.73819784438158409),
+    FRAC_CONST(0.73930064163714881),
+    FRAC_CONST(0.74040145956240788),
+    FRAC_CONST(0.74150029521014049),
+    FRAC_CONST(0.74259714563843304),
+    FRAC_CONST(0.74369200791068657),
+    FRAC_CONST(0.74478487909562552),
+    FRAC_CONST(0.74587575626730485),
+    FRAC_CONST(0.74696463650511791),
+    FRAC_CONST(0.74805151689380456),
+    FRAC_CONST(0.74913639452345926),
+    FRAC_CONST(0.75021926648953785),
+    FRAC_CONST(0.75130012989286621),
+    FRAC_CONST(0.7523789818396478),
+    FRAC_CONST(0.75345581944147111),
+    FRAC_CONST(0.75453063981531809),
+    FRAC_CONST(0.75560344008357094),
+    FRAC_CONST(0.75667421737402052),
+    FRAC_CONST(0.7577429688198738),
+    FRAC_CONST(0.75880969155976163),
+    FRAC_CONST(0.75987438273774599),
+    FRAC_CONST(0.76093703950332836),
+    FRAC_CONST(0.76199765901145666),
+    FRAC_CONST(0.76305623842253345),
+    FRAC_CONST(0.76411277490242291),
+    FRAC_CONST(0.76516726562245885),
+    FRAC_CONST(0.76621970775945258),
+    FRAC_CONST(0.76727009849569949),
+    FRAC_CONST(0.76831843501898767),
+    FRAC_CONST(0.76936471452260458),
+    FRAC_CONST(0.77040893420534517),
+    FRAC_CONST(0.77145109127151923),
+    FRAC_CONST(0.77249118293095853),
+    FRAC_CONST(0.77352920639902467),
+    FRAC_CONST(0.77456515889661659),
+    FRAC_CONST(0.77559903765017746),
+    FRAC_CONST(0.7766308398917029),
+    FRAC_CONST(0.77766056285874774),
+    FRAC_CONST(0.77868820379443371),
+    FRAC_CONST(0.77971375994745684),
+    FRAC_CONST(0.78073722857209438),
+    FRAC_CONST(0.7817586069282132),
+    FRAC_CONST(0.78277789228127592),
+    FRAC_CONST(0.78379508190234881),
+    FRAC_CONST(0.78481017306810918),
+    FRAC_CONST(0.78582316306085265),
+    FRAC_CONST(0.78683404916849986),
+    FRAC_CONST(0.78784282868460476),
+    FRAC_CONST(0.78884949890836087),
+    FRAC_CONST(0.78985405714460888),
+    FRAC_CONST(0.7908565007038445),
+    FRAC_CONST(0.79185682690222425),
+    FRAC_CONST(0.79285503306157412),
+    FRAC_CONST(0.79385111650939566),
+    FRAC_CONST(0.79484507457887377),
+    FRAC_CONST(0.79583690460888357),
+    FRAC_CONST(0.79682660394399751),
+    FRAC_CONST(0.79781416993449272),
+    FRAC_CONST(0.79879959993635785),
+    FRAC_CONST(0.7997828913113002),
+    FRAC_CONST(0.80076404142675273),
+    FRAC_CONST(0.80174304765588156),
+    FRAC_CONST(0.80271990737759213),
+    FRAC_CONST(0.80369461797653707),
+    FRAC_CONST(0.80466717684312306),
+    FRAC_CONST(0.80563758137351682),
+    FRAC_CONST(0.80660582896965372),
+    FRAC_CONST(0.80757191703924336),
+    FRAC_CONST(0.80853584299577752),
+    FRAC_CONST(0.80949760425853612),
+    FRAC_CONST(0.81045719825259477),
+    FRAC_CONST(0.81141462240883167),
+    FRAC_CONST(0.81236987416393436),
+    FRAC_CONST(0.81332295096040608),
+    FRAC_CONST(0.81427385024657373),
+    FRAC_CONST(0.81522256947659355),
+    FRAC_CONST(0.81616910611045879),
+    FRAC_CONST(0.817113457614006),
+    FRAC_CONST(0.81805562145892186),
+    FRAC_CONST(0.81899559512275044),
+    FRAC_CONST(0.81993337608889916),
+    FRAC_CONST(0.82086896184664637),
+    FRAC_CONST(0.8218023498911472),
+    FRAC_CONST(0.82273353772344116),
+    FRAC_CONST(0.82366252285045805),
+    FRAC_CONST(0.82458930278502529),
+    FRAC_CONST(0.82551387504587381),
+    FRAC_CONST(0.82643623715764558),
+    FRAC_CONST(0.82735638665089983),
+    FRAC_CONST(0.82827432106211907),
+    FRAC_CONST(0.82919003793371693),
+    FRAC_CONST(0.83010353481404364),
+    FRAC_CONST(0.83101480925739324),
+    FRAC_CONST(0.83192385882400965),
+    FRAC_CONST(0.83283068108009373),
+    FRAC_CONST(0.8337352735978093),
+    FRAC_CONST(0.83463763395529011),
+    FRAC_CONST(0.83553775973664579),
+    FRAC_CONST(0.83643564853196872),
+    FRAC_CONST(0.83733129793734051),
+    FRAC_CONST(0.83822470555483797),
+    FRAC_CONST(0.83911586899254031),
+    FRAC_CONST(0.84000478586453453),
+    FRAC_CONST(0.84089145379092289),
+    FRAC_CONST(0.84177587039782842),
+    FRAC_CONST(0.84265803331740163),
+    FRAC_CONST(0.84353794018782702),
+    FRAC_CONST(0.844415588653329),
+    FRAC_CONST(0.8452909763641786),
+    FRAC_CONST(0.84616410097669936),
+    FRAC_CONST(0.84703496015327406),
+    FRAC_CONST(0.84790355156235053),
+    FRAC_CONST(0.84876987287844818),
+    FRAC_CONST(0.8496339217821639),
+    FRAC_CONST(0.85049569596017938),
+    FRAC_CONST(0.85135519310526508),
+    FRAC_CONST(0.85221241091628896),
+    FRAC_CONST(0.85306734709822085),
+    FRAC_CONST(0.85391999936213903),
+    FRAC_CONST(0.85477036542523732),
+    FRAC_CONST(0.85561844301082923),
+    FRAC_CONST(0.85646422984835635),
+    FRAC_CONST(0.85730772367339259),
+    FRAC_CONST(0.85814892222765116),
+    FRAC_CONST(0.85898782325899026),
+    FRAC_CONST(0.85982442452141961),
+    FRAC_CONST(0.86065872377510555),
+    FRAC_CONST(0.86149071878637817),
+    FRAC_CONST(0.8623204073277364),
+    FRAC_CONST(0.86314778717785412),
+    FRAC_CONST(0.8639728561215867),
+    FRAC_CONST(0.86479561194997623),
+    FRAC_CONST(0.86561605246025763),
+    FRAC_CONST(0.86643417545586487),
+    FRAC_CONST(0.8672499787464365),
+    FRAC_CONST(0.86806346014782154),
+    FRAC_CONST(0.8688746174820855),
+    FRAC_CONST(0.86968344857751589),
+    FRAC_CONST(0.87048995126862883),
+    FRAC_CONST(0.87129412339617363),
+    FRAC_CONST(0.87209596280713941),
+    FRAC_CONST(0.8728954673547612),
+    FRAC_CONST(0.87369263489852422),
+    FRAC_CONST(0.87448746330417149),
+    FRAC_CONST(0.87527995044370765),
+    FRAC_CONST(0.8760700941954066),
+    FRAC_CONST(0.87685789244381551),
+    FRAC_CONST(0.87764334307976144),
+    FRAC_CONST(0.87842644400035663),
+    FRAC_CONST(0.8792071931090043),
+    FRAC_CONST(0.87998558831540408),
+    FRAC_CONST(0.88076162753555787),
+    FRAC_CONST(0.88153530869177488),
+    FRAC_CONST(0.88230662971267804),
+    FRAC_CONST(0.88307558853320878),
+    FRAC_CONST(0.88384218309463292),
+    FRAC_CONST(0.8846064113445461),
+    FRAC_CONST(0.88536827123687933),
+    FRAC_CONST(0.88612776073190425),
+    FRAC_CONST(0.88688487779623937),
+    FRAC_CONST(0.88763962040285393),
+    FRAC_CONST(0.8883919865310751),
+    FRAC_CONST(0.88914197416659235),
+    FRAC_CONST(0.88988958130146301),
+    FRAC_CONST(0.8906348059341177),
+    FRAC_CONST(0.89137764606936609),
+    FRAC_CONST(0.89211809971840139),
+    FRAC_CONST(0.89285616489880615),
+    FRAC_CONST(0.89359183963455813),
+    FRAC_CONST(0.89432512195603453),
+    FRAC_CONST(0.89505600990001799),
+    FRAC_CONST(0.89578450150970124),
+    FRAC_CONST(0.8965105948346932),
+    FRAC_CONST(0.89723428793102367),
+    FRAC_CONST(0.89795557886114807),
+    FRAC_CONST(0.89867446569395382),
+    FRAC_CONST(0.89939094650476448),
+    FRAC_CONST(0.90010501937534515),
+    FRAC_CONST(0.900816682393908),
+    FRAC_CONST(0.90152593365511691),
+    FRAC_CONST(0.90223277126009283),
+    FRAC_CONST(0.90293719331641886),
+    FRAC_CONST(0.90363919793814496),
+    FRAC_CONST(0.90433878324579353),
+    FRAC_CONST(0.90503594736636439),
+    FRAC_CONST(0.90573068843333915),
+    FRAC_CONST(0.90642300458668679),
+    FRAC_CONST(0.90711289397286898),
+    FRAC_CONST(0.90780035474484411),
+    FRAC_CONST(0.90848538506207266),
+    FRAC_CONST(0.90916798309052227),
+    FRAC_CONST(0.90984814700267291),
+    FRAC_CONST(0.9105258749775208),
+    FRAC_CONST(0.91120116520058425),
+    FRAC_CONST(0.91187401586390815),
+    FRAC_CONST(0.91254442516606893),
+    FRAC_CONST(0.9132123913121788),
+    FRAC_CONST(0.91387791251389161),
+    FRAC_CONST(0.91454098698940678),
+    FRAC_CONST(0.91520161296347435),
+    FRAC_CONST(0.91585978866739981),
+    FRAC_CONST(0.91651551233904871),
+    FRAC_CONST(0.91716878222285148),
+    FRAC_CONST(0.91781959656980805),
+    FRAC_CONST(0.91846795363749245),
+    FRAC_CONST(0.91911385169005766),
+    FRAC_CONST(0.9197572889982405),
+    FRAC_CONST(0.9203982638393654),
+    FRAC_CONST(0.92103677449734989),
+    FRAC_CONST(0.92167281926270861),
+    FRAC_CONST(0.92230639643255874),
+    FRAC_CONST(0.92293750431062316),
+    FRAC_CONST(0.92356614120723612),
+    FRAC_CONST(0.92419230543934783),
+    FRAC_CONST(0.92481599533052783),
+    FRAC_CONST(0.92543720921097061),
+    FRAC_CONST(0.92605594541749991),
+    FRAC_CONST(0.92667220229357261),
+    FRAC_CONST(0.92728597818928349),
+    FRAC_CONST(0.9278972714613698),
+    FRAC_CONST(0.92850608047321548),
+    FRAC_CONST(0.9291124035948557),
+    FRAC_CONST(0.92971623920298097),
+    FRAC_CONST(0.93031758568094147),
+    FRAC_CONST(0.93091644141875196),
+    FRAC_CONST(0.93151280481309506),
+    FRAC_CONST(0.93210667426732674),
+    FRAC_CONST(0.93269804819147983),
+    FRAC_CONST(0.93328692500226818),
+    FRAC_CONST(0.93387330312309147),
+    FRAC_CONST(0.93445718098403896),
+    FRAC_CONST(0.93503855702189376),
+    FRAC_CONST(0.9356174296801375),
+    FRAC_CONST(0.93619379740895381),
+    FRAC_CONST(0.93676765866523259),
+    FRAC_CONST(0.93733901191257496),
+    FRAC_CONST(0.93790785562129597),
+    FRAC_CONST(0.93847418826842988),
+    FRAC_CONST(0.93903800833773399),
+    FRAC_CONST(0.93959931431969212),
+    FRAC_CONST(0.94015810471151917),
+    FRAC_CONST(0.94071437801716529),
+    FRAC_CONST(0.94126813274731924),
+    FRAC_CONST(0.94181936741941319),
+    FRAC_CONST(0.94236808055762578),
+    FRAC_CONST(0.94291427069288691),
+    FRAC_CONST(0.94345793636288133),
+    FRAC_CONST(0.94399907611205225),
+    FRAC_CONST(0.9445376884916058),
+    FRAC_CONST(0.94507377205951448),
+    FRAC_CONST(0.94560732538052128),
+    FRAC_CONST(0.94613834702614352),
+    FRAC_CONST(0.94666683557467624),
+    FRAC_CONST(0.94719278961119657),
+    FRAC_CONST(0.94771620772756759),
+    FRAC_CONST(0.94823708852244104),
+    FRAC_CONST(0.94875543060126255),
+    FRAC_CONST(0.94927123257627433),
+    FRAC_CONST(0.94978449306651924),
+    FRAC_CONST(0.95029521069784428),
+    FRAC_CONST(0.9508033841029051),
+    FRAC_CONST(0.95130901192116835),
+    FRAC_CONST(0.9518120927989161),
+    FRAC_CONST(0.95231262538924943),
+    FRAC_CONST(0.95281060835209208),
+    FRAC_CONST(0.95330604035419386),
+    FRAC_CONST(0.95379892006913403),
+    FRAC_CONST(0.95428924617732525),
+    FRAC_CONST(0.95477701736601728),
+    FRAC_CONST(0.95526223232929941),
+    FRAC_CONST(0.95574488976810545),
+    FRAC_CONST(0.95622498839021619),
+    FRAC_CONST(0.95670252691026292),
+    FRAC_CONST(0.95717750404973156),
+    FRAC_CONST(0.95764991853696524),
+    FRAC_CONST(0.95811976910716812),
+    FRAC_CONST(0.95858705450240911),
+    FRAC_CONST(0.95905177347162429),
+    FRAC_CONST(0.95951392477062125),
+    FRAC_CONST(0.95997350716208196),
+    FRAC_CONST(0.96043051941556579),
+    FRAC_CONST(0.96088496030751369),
+    FRAC_CONST(0.96133682862125036),
+    FRAC_CONST(0.96178612314698864),
+    FRAC_CONST(0.96223284268183173),
+    FRAC_CONST(0.9626769860297768),
+    FRAC_CONST(0.96311855200171881),
+    FRAC_CONST(0.96355753941545252),
+    FRAC_CONST(0.96399394709567654),
+    FRAC_CONST(0.96442777387399625),
+    FRAC_CONST(0.96485901858892686),
+    FRAC_CONST(0.96528768008589627),
+    FRAC_CONST(0.96571375721724895),
+    FRAC_CONST(0.96613724884224783),
+    FRAC_CONST(0.96655815382707866),
+    FRAC_CONST(0.96697647104485207),
+    FRAC_CONST(0.96739219937560694),
+    FRAC_CONST(0.96780533770631338),
+    FRAC_CONST(0.96821588493087585),
+    FRAC_CONST(0.9686238399501359),
+    FRAC_CONST(0.96902920167187501),
+    FRAC_CONST(0.96943196901081796),
+    FRAC_CONST(0.96983214088863534),
+    FRAC_CONST(0.9702297162339466),
+    FRAC_CONST(0.97062469398232287),
+    FRAC_CONST(0.97101707307629004),
+    FRAC_CONST(0.97140685246533098),
+    FRAC_CONST(0.97179403110588902),
+    FRAC_CONST(0.97217860796137046),
+    FRAC_CONST(0.97256058200214734),
+    FRAC_CONST(0.97293995220556007),
+    FRAC_CONST(0.97331671755592064),
+    FRAC_CONST(0.97369087704451474),
+    FRAC_CONST(0.97406242966960455),
+    FRAC_CONST(0.97443137443643235),
+    FRAC_CONST(0.97479771035722163),
+    FRAC_CONST(0.97516143645118103),
+    FRAC_CONST(0.97552255174450631),
+    FRAC_CONST(0.97588105527038305),
+    FRAC_CONST(0.97623694606898959),
+    FRAC_CONST(0.97659022318749911),
+    FRAC_CONST(0.97694088568008242),
+    FRAC_CONST(0.97728893260791039),
+    FRAC_CONST(0.97763436303915685),
+    FRAC_CONST(0.97797717604900047),
+    FRAC_CONST(0.97831737071962765),
+    FRAC_CONST(0.97865494614023485),
+    FRAC_CONST(0.97898990140703124),
+    FRAC_CONST(0.97932223562324061),
+    FRAC_CONST(0.97965194789910426),
+    FRAC_CONST(0.9799790373518833),
+    FRAC_CONST(0.98030350310586067),
+    FRAC_CONST(0.98062534429234405),
+    FRAC_CONST(0.98094456004966768),
+    FRAC_CONST(0.98126114952319499),
+    FRAC_CONST(0.98157511186532054),
+    FRAC_CONST(0.98188644623547261),
+    FRAC_CONST(0.98219515180011563),
+    FRAC_CONST(0.98250122773275184),
+    FRAC_CONST(0.98280467321392362),
+    FRAC_CONST(0.98310548743121629),
+    FRAC_CONST(0.98340366957925973),
+    FRAC_CONST(0.98369921885973044),
+    FRAC_CONST(0.98399213448135414),
+    FRAC_CONST(0.98428241565990748),
+    FRAC_CONST(0.98457006161822058),
+    FRAC_CONST(0.98485507158617835),
+    FRAC_CONST(0.98513744480072363),
+    FRAC_CONST(0.98541718050585803),
+    FRAC_CONST(0.98569427795264519),
+    FRAC_CONST(0.98596873639921168),
+    FRAC_CONST(0.98624055511074971),
+    FRAC_CONST(0.98650973335951875),
+    FRAC_CONST(0.98677627042484772),
+    FRAC_CONST(0.98704016559313645),
+    FRAC_CONST(0.98730141815785832),
+    FRAC_CONST(0.98756002741956173),
+    FRAC_CONST(0.9878159926858715),
+    FRAC_CONST(0.98806931327149194),
+    FRAC_CONST(0.98831998849820735),
+    FRAC_CONST(0.98856801769488489),
+    FRAC_CONST(0.98881340019747566),
+    FRAC_CONST(0.98905613534901682),
+    FRAC_CONST(0.98929622249963345),
+    FRAC_CONST(0.98953366100653983),
+    FRAC_CONST(0.98976845023404181),
+    FRAC_CONST(0.99000058955353776),
+    FRAC_CONST(0.99023007834352106),
+    FRAC_CONST(0.99045691598958097),
+    FRAC_CONST(0.99068110188440506),
+    FRAC_CONST(0.99090263542778001),
+    FRAC_CONST(0.99112151602659404),
+    FRAC_CONST(0.99133774309483769),
+    FRAC_CONST(0.99155131605360625),
+    FRAC_CONST(0.99176223433110056),
+    FRAC_CONST(0.99197049736262888),
+    FRAC_CONST(0.99217610459060845),
+    FRAC_CONST(0.99237905546456673),
+    FRAC_CONST(0.99257934944114334),
+    FRAC_CONST(0.99277698598409092),
+    FRAC_CONST(0.99297196456427694),
+    FRAC_CONST(0.99316428465968509),
+    FRAC_CONST(0.99335394575541669),
+    FRAC_CONST(0.99354094734369169),
+    FRAC_CONST(0.99372528892385081),
+    FRAC_CONST(0.99390697000235606),
+    FRAC_CONST(0.99408599009279242),
+    FRAC_CONST(0.99426234871586938),
+    FRAC_CONST(0.99443604539942176),
+    FRAC_CONST(0.99460707967841133),
+    FRAC_CONST(0.99477545109492771),
+    FRAC_CONST(0.99494115919819004),
+    FRAC_CONST(0.99510420354454787),
+    FRAC_CONST(0.99526458369748239),
+    FRAC_CONST(0.99542229922760772),
+    FRAC_CONST(0.99557734971267187),
+    FRAC_CONST(0.9957297347375581),
+    FRAC_CONST(0.99587945389428578),
+    FRAC_CONST(0.99602650678201154),
+    FRAC_CONST(0.99617089300703077),
+    FRAC_CONST(0.996312612182778),
+    FRAC_CONST(0.99645166392982831),
+    FRAC_CONST(0.99658804787589839),
+    FRAC_CONST(0.99672176365584741),
+    FRAC_CONST(0.99685281091167788),
+    FRAC_CONST(0.99698118929253687),
+    FRAC_CONST(0.99710689845471678),
+    FRAC_CONST(0.99722993806165661),
+    FRAC_CONST(0.99735030778394196),
+    FRAC_CONST(0.99746800729930707),
+    FRAC_CONST(0.99758303629263489),
+    FRAC_CONST(0.99769539445595812),
+    FRAC_CONST(0.99780508148846014),
+    FRAC_CONST(0.99791209709647588),
+    FRAC_CONST(0.99801644099349218),
+    FRAC_CONST(0.99811811290014918),
+    FRAC_CONST(0.9982171125442405),
+    FRAC_CONST(0.9983134396607144),
+    FRAC_CONST(0.99840709399167404),
+    FRAC_CONST(0.99849807528637868),
+    FRAC_CONST(0.99858638330124405),
+    FRAC_CONST(0.99867201779984294),
+    FRAC_CONST(0.99875497855290607),
+    FRAC_CONST(0.99883526533832245),
+    FRAC_CONST(0.99891287794114036),
+    FRAC_CONST(0.99898781615356746),
+    FRAC_CONST(0.99906007977497147),
+    FRAC_CONST(0.99912966861188113),
+    FRAC_CONST(0.99919658247798593),
+    FRAC_CONST(0.99926082119413751),
+    FRAC_CONST(0.99932238458834954),
+    FRAC_CONST(0.999381272495798),
+    FRAC_CONST(0.99943748475882255),
+    FRAC_CONST(0.9994910212269259),
+    FRAC_CONST(0.99954188175677483),
+    FRAC_CONST(0.99959006621220048),
+    FRAC_CONST(0.99963557446419837),
+    FRAC_CONST(0.99967840639092931),
+    FRAC_CONST(0.99971856187771946),
+    FRAC_CONST(0.99975604081706027),
+    FRAC_CONST(0.99979084310860955),
+    FRAC_CONST(0.99982296865919107),
+    FRAC_CONST(0.99985241738279484),
+    FRAC_CONST(0.99987918920057806),
+    FRAC_CONST(0.99990328404086426),
+    FRAC_CONST(0.9999247018391445),
+    FRAC_CONST(0.99994344253807688),
+    FRAC_CONST(0.99995950608748674),
+    FRAC_CONST(0.99997289244436727),
+    FRAC_CONST(0.99998360157287902),
+    FRAC_CONST(0.9999916334443506),
+    FRAC_CONST(0.99999698803727821),
+    FRAC_CONST(0.99999966533732598)
+};
+#endif
+
+real_t sine_short_128[] =
+{
+    FRAC_CONST(0.0061358846491544753),
+    FRAC_CONST(0.01840672990580482),
+    FRAC_CONST(0.030674803176636626),
+    FRAC_CONST(0.04293825693494082),
+    FRAC_CONST(0.055195244349689934),
+    FRAC_CONST(0.067443919563664051),
+    FRAC_CONST(0.079682437971430126),
+    FRAC_CONST(0.091908956497132724),
+    FRAC_CONST(0.10412163387205459),
+    FRAC_CONST(0.11631863091190475),
+    FRAC_CONST(0.12849811079379317),
+    FRAC_CONST(0.14065823933284921),
+    FRAC_CONST(0.15279718525844344),
+    FRAC_CONST(0.16491312048996989),
+    FRAC_CONST(0.17700422041214875),
+    FRAC_CONST(0.18906866414980619),
+    FRAC_CONST(0.2011046348420919),
+    FRAC_CONST(0.21311031991609136),
+    FRAC_CONST(0.22508391135979283),
+    FRAC_CONST(0.2370236059943672),
+    FRAC_CONST(0.24892760574572015),
+    FRAC_CONST(0.26079411791527551),
+    FRAC_CONST(0.27262135544994898),
+    FRAC_CONST(0.28440753721127188),
+    FRAC_CONST(0.29615088824362379),
+    FRAC_CONST(0.30784964004153487),
+    FRAC_CONST(0.31950203081601569),
+    FRAC_CONST(0.33110630575987643),
+    FRAC_CONST(0.34266071731199438),
+    FRAC_CONST(0.35416352542049034),
+    FRAC_CONST(0.36561299780477385),
+    FRAC_CONST(0.37700741021641826),
+    FRAC_CONST(0.38834504669882625),
+    FRAC_CONST(0.39962419984564679),
+    FRAC_CONST(0.41084317105790391),
+    FRAC_CONST(0.42200027079979968),
+    FRAC_CONST(0.43309381885315196),
+    FRAC_CONST(0.4441221445704292),
+    FRAC_CONST(0.45508358712634384),
+    FRAC_CONST(0.46597649576796618),
+    FRAC_CONST(0.47679923006332209),
+    FRAC_CONST(0.487550160148436),
+    FRAC_CONST(0.49822766697278187),
+    FRAC_CONST(0.50883014254310699),
+    FRAC_CONST(0.51935599016558964),
+    FRAC_CONST(0.52980362468629461),
+    FRAC_CONST(0.54017147272989285),
+    FRAC_CONST(0.55045797293660481),
+    FRAC_CONST(0.56066157619733603),
+    FRAC_CONST(0.57078074588696726),
+    FRAC_CONST(0.58081395809576453),
+    FRAC_CONST(0.59075970185887416),
+    FRAC_CONST(0.60061647938386897),
+    FRAC_CONST(0.61038280627630948),
+    FRAC_CONST(0.6200572117632891),
+    FRAC_CONST(0.62963823891492698),
+    FRAC_CONST(0.63912444486377573),
+    FRAC_CONST(0.64851440102211244),
+    FRAC_CONST(0.65780669329707864),
+    FRAC_CONST(0.66699992230363747),
+    FRAC_CONST(0.67609270357531592),
+    FRAC_CONST(0.68508366777270036),
+    FRAC_CONST(0.693971460889654),
+    FRAC_CONST(0.7027547444572253),
+    FRAC_CONST(0.71143219574521643),
+    FRAC_CONST(0.72000250796138165),
+    FRAC_CONST(0.7284643904482252),
+    FRAC_CONST(0.73681656887736979),
+    FRAC_CONST(0.74505778544146595),
+    FRAC_CONST(0.75318679904361241),
+    FRAC_CONST(0.76120238548426178),
+    FRAC_CONST(0.76910333764557959),
+    FRAC_CONST(0.77688846567323244),
+    FRAC_CONST(0.78455659715557524),
+    FRAC_CONST(0.79210657730021239),
+    FRAC_CONST(0.79953726910790501),
+    FRAC_CONST(0.80684755354379922),
+    FRAC_CONST(0.8140363297059483),
+    FRAC_CONST(0.82110251499110465),
+    FRAC_CONST(0.8280450452577558),
+    FRAC_CONST(0.83486287498638001),
+    FRAC_CONST(0.84155497743689833),
+    FRAC_CONST(0.84812034480329712),
+    FRAC_CONST(0.85455798836540053),
+    FRAC_CONST(0.86086693863776731),
+    FRAC_CONST(0.86704624551569265),
+    FRAC_CONST(0.87309497841829009),
+    FRAC_CONST(0.87901222642863341),
+    FRAC_CONST(0.88479709843093779),
+    FRAC_CONST(0.89044872324475788),
+    FRAC_CONST(0.89596624975618511),
+    FRAC_CONST(0.90134884704602203),
+    FRAC_CONST(0.90659570451491533),
+    FRAC_CONST(0.91170603200542988),
+    FRAC_CONST(0.9166790599210427),
+    FRAC_CONST(0.9215140393420419),
+    FRAC_CONST(0.92621024213831127),
+    FRAC_CONST(0.93076696107898371),
+    FRAC_CONST(0.9351835099389475),
+    FRAC_CONST(0.93945922360218992),
+    FRAC_CONST(0.94359345816196039),
+    FRAC_CONST(0.94758559101774109),
+    FRAC_CONST(0.95143502096900834),
+    FRAC_CONST(0.95514116830577067),
+    FRAC_CONST(0.9587034748958716),
+    FRAC_CONST(0.96212140426904158),
+    FRAC_CONST(0.9653944416976894),
+    FRAC_CONST(0.96852209427441727),
+    FRAC_CONST(0.97150389098625178),
+    FRAC_CONST(0.97433938278557586),
+    FRAC_CONST(0.97702814265775439),
+    FRAC_CONST(0.97956976568544052),
+    FRAC_CONST(0.98196386910955524),
+    FRAC_CONST(0.98421009238692903),
+    FRAC_CONST(0.98630809724459867),
+    FRAC_CONST(0.98825756773074946),
+    FRAC_CONST(0.99005821026229712),
+    FRAC_CONST(0.99170975366909953),
+    FRAC_CONST(0.9932119492347945),
+    FRAC_CONST(0.99456457073425542),
+    FRAC_CONST(0.99576741446765982),
+    FRAC_CONST(0.99682029929116567),
+    FRAC_CONST(0.99772306664419164),
+    FRAC_CONST(0.99847558057329477),
+    FRAC_CONST(0.99907772775264536),
+    FRAC_CONST(0.99952941750109314),
+    FRAC_CONST(0.9998305817958234),
+    FRAC_CONST(0.99998117528260111)
+};
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+real_t sine_short_120[] =
+{
+    FRAC_CONST(0.0065449379673518581),
+    FRAC_CONST(0.019633692460628301),
+    FRAC_CONST(0.032719082821776137),
+    FRAC_CONST(0.045798866936520771),
+    FRAC_CONST(0.058870803651189033),
+    FRAC_CONST(0.071932653156719387),
+    FRAC_CONST(0.084982177372441667),
+    FRAC_CONST(0.09801714032956059),
+    FRAC_CONST(0.11103530855427769),
+    FRAC_CONST(0.12403445145048532),
+    FRAC_CONST(0.13701234168196802),
+    FRAC_CONST(0.14996675555404498),
+    FRAC_CONST(0.16289547339458874),
+    FRAC_CONST(0.17579627993435451),
+    FRAC_CONST(0.18866696468655525),
+    FRAC_CONST(0.2015053223256171),
+    FRAC_CONST(0.21430915306505074),
+    FRAC_CONST(0.2270762630343732),
+    FRAC_CONST(0.23980446465501654),
+    FRAC_CONST(0.25249157701515795),
+    FRAC_CONST(0.26513542624340797),
+    FRAC_CONST(0.27773384588129219),
+    FRAC_CONST(0.29028467725446233),
+    FRAC_CONST(0.3027857698425746),
+    FRAC_CONST(0.31523498164776964),
+    FRAC_CONST(0.32763017956169349),
+    FRAC_CONST(0.33996923973099424),
+    FRAC_CONST(0.35225004792123354),
+    FRAC_CONST(0.36447049987914965),
+    FRAC_CONST(0.37662850169321077),
+    FRAC_CONST(0.38872197015239557),
+    FRAC_CONST(0.40074883310314097),
+    FRAC_CONST(0.41270702980439467),
+    FRAC_CONST(0.42459451128071307),
+    FRAC_CONST(0.43640924067334208),
+    FRAC_CONST(0.44814919358922256),
+    FRAC_CONST(0.45981235844785984),
+    FRAC_CONST(0.47139673682599764),
+    FRAC_CONST(0.48290034380003727),
+    FRAC_CONST(0.49432120828614462),
+    FRAC_CONST(0.50565737337798455),
+    FRAC_CONST(0.51690689668202761),
+    FRAC_CONST(0.52806785065036799),
+    FRAC_CONST(0.53913832291100017),
+    FRAC_CONST(0.55011641659549337),
+    FRAC_CONST(0.56100025066400983),
+    FRAC_CONST(0.57178796022761225),
+    FRAC_CONST(0.58247769686780215),
+    FRAC_CONST(0.59306762895323706),
+    FRAC_CONST(0.60355594195357143),
+    FRAC_CONST(0.61394083875036642),
+    FRAC_CONST(0.62422053994501758),
+    FRAC_CONST(0.63439328416364549),
+    FRAC_CONST(0.64445732835889735),
+    FRAC_CONST(0.65441094810861034),
+    FRAC_CONST(0.66425243791128175),
+    FRAC_CONST(0.67398011147829784),
+    FRAC_CONST(0.68359230202287125),
+    FRAC_CONST(0.69308736254563585),
+    FRAC_CONST(0.70246366611685174),
+    FRAC_CONST(0.71171960615517138),
+    FRAC_CONST(0.72085359670291882),
+    FRAC_CONST(0.7298640726978356),
+    FRAC_CONST(0.73874949024124625),
+    FRAC_CONST(0.74750832686259672),
+    FRAC_CONST(0.75613908178032285),
+    FRAC_CONST(0.76464027615900032),
+    FRAC_CONST(0.77301045336273699),
+    FRAC_CONST(0.78124817920475853),
+    FRAC_CONST(0.78935204219315003),
+    FRAC_CONST(0.79732065377270711),
+    FRAC_CONST(0.80515264856285829),
+    FRAC_CONST(0.81284668459161513),
+    FRAC_CONST(0.82040144352551359),
+    FRAC_CONST(0.82781563089550203),
+    FRAC_CONST(0.83508797631874299),
+    FRAC_CONST(0.84221723371628654),
+    FRAC_CONST(0.84920218152657889),
+    FRAC_CONST(0.85604162291477137),
+    FRAC_CONST(0.86273438597779184),
+    FRAC_CONST(0.86927932394514362),
+    FRAC_CONST(0.87567531537539967),
+    FRAC_CONST(0.88192126434835494),
+    FRAC_CONST(0.88801610065280734),
+    FRAC_CONST(0.89395877996993212),
+    FRAC_CONST(0.8997482840522214),
+    FRAC_CONST(0.90538362089795521),
+    FRAC_CONST(0.91086382492117568),
+    FRAC_CONST(0.91618795711713596),
+    FRAC_CONST(0.92135510522319242),
+    FRAC_CONST(0.9263643838751181),
+    FRAC_CONST(0.93121493475880346),
+    FRAC_CONST(0.93590592675732565),
+    FRAC_CONST(0.94043655609335486),
+    FRAC_CONST(0.94480604646687805),
+    FRAC_CONST(0.94901364918821385),
+    FRAC_CONST(0.95305864330629697),
+    FRAC_CONST(0.95694033573220882),
+    FRAC_CONST(0.9606580613579353),
+    FRAC_CONST(0.96421118317032928),
+    FRAC_CONST(0.96759909236025976),
+    FRAC_CONST(0.9708212084269281),
+    FRAC_CONST(0.97387697927733363),
+    FRAC_CONST(0.97676588132087239),
+    FRAC_CONST(0.97948741955905139),
+    FRAC_CONST(0.98204112767030394),
+    FRAC_CONST(0.98442656808989171),
+    FRAC_CONST(0.98664333208487898),
+    FRAC_CONST(0.98869103982416728),
+    FRAC_CONST(0.99056934044357725),
+    FRAC_CONST(0.99227791210596705),
+    FRAC_CONST(0.99381646205637808),
+    FRAC_CONST(0.99518472667219682),
+    FRAC_CONST(0.99638247150832537),
+    FRAC_CONST(0.99740949133735191),
+    FRAC_CONST(0.99826561018471593),
+    FRAC_CONST(0.99895068135886012),
+    FRAC_CONST(0.99946458747636568),
+    FRAC_CONST(0.99980724048206482),
+    FRAC_CONST(0.99997858166412923)
+};
+#endif
+
+#ifdef LD_DEC
+real_t sine_mid_512[] =
+{
+    FRAC_CONST(0.0015339801862847655),
+    FRAC_CONST(0.0046019261204485705),
+    FRAC_CONST(0.007669828739531097),
+    FRAC_CONST(0.010737659167264491),
+    FRAC_CONST(0.013805388528060391),
+    FRAC_CONST(0.01687298794728171),
+    FRAC_CONST(0.019940428551514441),
+    FRAC_CONST(0.023007681468839369),
+    FRAC_CONST(0.026074717829103901),
+    FRAC_CONST(0.029141508764193722),
+    FRAC_CONST(0.032208025408304586),
+    FRAC_CONST(0.035274238898213947),
+    FRAC_CONST(0.038340120373552694),
+    FRAC_CONST(0.041405640977076739),
+    FRAC_CONST(0.044470771854938668),
+    FRAC_CONST(0.047535484156959303),
+    FRAC_CONST(0.050599749036899282),
+    FRAC_CONST(0.05366353765273052),
+    FRAC_CONST(0.056726821166907748),
+    FRAC_CONST(0.059789570746639868),
+    FRAC_CONST(0.062851757564161406),
+    FRAC_CONST(0.065913352797003805),
+    FRAC_CONST(0.068974327628266746),
+    FRAC_CONST(0.072034653246889332),
+    FRAC_CONST(0.075094300847921305),
+    FRAC_CONST(0.078153241632794232),
+    FRAC_CONST(0.081211446809592441),
+    FRAC_CONST(0.084268887593324071),
+    FRAC_CONST(0.087325535206192059),
+    FRAC_CONST(0.090381360877864983),
+    FRAC_CONST(0.093436335845747787),
+    FRAC_CONST(0.096490431355252593),
+    FRAC_CONST(0.099543618660069319),
+    FRAC_CONST(0.10259586902243628),
+    FRAC_CONST(0.10564715371341062),
+    FRAC_CONST(0.10869744401313872),
+    FRAC_CONST(0.11174671121112659),
+    FRAC_CONST(0.11479492660651008),
+    FRAC_CONST(0.11784206150832498),
+    FRAC_CONST(0.12088808723577708),
+    FRAC_CONST(0.12393297511851216),
+    FRAC_CONST(0.12697669649688587),
+    FRAC_CONST(0.13001922272223335),
+    FRAC_CONST(0.13306052515713906),
+    FRAC_CONST(0.1361005751757062),
+    FRAC_CONST(0.1391393441638262),
+    FRAC_CONST(0.14217680351944803),
+    FRAC_CONST(0.14521292465284746),
+    FRAC_CONST(0.14824767898689603),
+    FRAC_CONST(0.15128103795733022),
+    FRAC_CONST(0.1543129730130201),
+    FRAC_CONST(0.15734345561623825),
+    FRAC_CONST(0.16037245724292828),
+    FRAC_CONST(0.16339994938297323),
+    FRAC_CONST(0.1664259035404641),
+    FRAC_CONST(0.16945029123396796),
+    FRAC_CONST(0.17247308399679595),
+    FRAC_CONST(0.17549425337727143),
+    FRAC_CONST(0.17851377093899751),
+    FRAC_CONST(0.18153160826112497),
+    FRAC_CONST(0.18454773693861962),
+    FRAC_CONST(0.1875621285825296),
+    FRAC_CONST(0.19057475482025274),
+    FRAC_CONST(0.19358558729580361),
+    FRAC_CONST(0.19659459767008022),
+    FRAC_CONST(0.19960175762113097),
+    FRAC_CONST(0.20260703884442113),
+    FRAC_CONST(0.20561041305309924),
+    FRAC_CONST(0.20861185197826349),
+    FRAC_CONST(0.21161132736922755),
+    FRAC_CONST(0.21460881099378676),
+    FRAC_CONST(0.21760427463848364),
+    FRAC_CONST(0.22059769010887351),
+    FRAC_CONST(0.22358902922978999),
+    FRAC_CONST(0.22657826384561),
+    FRAC_CONST(0.22956536582051887),
+    FRAC_CONST(0.23255030703877524),
+    FRAC_CONST(0.23553305940497549),
+    FRAC_CONST(0.23851359484431842),
+    FRAC_CONST(0.24149188530286933),
+    FRAC_CONST(0.24446790274782415),
+    FRAC_CONST(0.24744161916777327),
+    FRAC_CONST(0.25041300657296522),
+    FRAC_CONST(0.25338203699557016),
+    FRAC_CONST(0.25634868248994291),
+    FRAC_CONST(0.25931291513288623),
+    FRAC_CONST(0.26227470702391359),
+    FRAC_CONST(0.26523403028551179),
+    FRAC_CONST(0.26819085706340318),
+    FRAC_CONST(0.27114515952680801),
+    FRAC_CONST(0.27409690986870638),
+    FRAC_CONST(0.2770460803060999),
+    FRAC_CONST(0.27999264308027322),
+    FRAC_CONST(0.28293657045705539),
+    FRAC_CONST(0.28587783472708062),
+    FRAC_CONST(0.28881640820604948),
+    FRAC_CONST(0.29175226323498926),
+    FRAC_CONST(0.29468537218051433),
+    FRAC_CONST(0.2976157074350862),
+    FRAC_CONST(0.30054324141727345),
+    FRAC_CONST(0.30346794657201132),
+    FRAC_CONST(0.30638979537086092),
+    FRAC_CONST(0.30930876031226873),
+    FRAC_CONST(0.31222481392182488),
+    FRAC_CONST(0.31513792875252244),
+    FRAC_CONST(0.31804807738501495),
+    FRAC_CONST(0.32095523242787521),
+    FRAC_CONST(0.32385936651785285),
+    FRAC_CONST(0.32676045232013173),
+    FRAC_CONST(0.32965846252858749),
+    FRAC_CONST(0.33255336986604422),
+    FRAC_CONST(0.3354451470845316),
+    FRAC_CONST(0.33833376696554113),
+    FRAC_CONST(0.34121920232028236),
+    FRAC_CONST(0.34410142598993881),
+    FRAC_CONST(0.34698041084592368),
+    FRAC_CONST(0.34985612979013492),
+    FRAC_CONST(0.35272855575521073),
+    FRAC_CONST(0.35559766170478385),
+    FRAC_CONST(0.35846342063373654),
+    FRAC_CONST(0.36132580556845428),
+    FRAC_CONST(0.36418478956707989),
+    FRAC_CONST(0.36704034571976718),
+    FRAC_CONST(0.3698924471489341),
+    FRAC_CONST(0.37274106700951576),
+    FRAC_CONST(0.37558617848921722),
+    FRAC_CONST(0.37842775480876556),
+    FRAC_CONST(0.38126576922216238),
+    FRAC_CONST(0.38410019501693504),
+    FRAC_CONST(0.38693100551438858),
+    FRAC_CONST(0.38975817406985641),
+    FRAC_CONST(0.39258167407295147),
+    FRAC_CONST(0.39540147894781635),
+    FRAC_CONST(0.39821756215337356),
+    FRAC_CONST(0.40102989718357562),
+    FRAC_CONST(0.40383845756765407),
+    FRAC_CONST(0.40664321687036903),
+    FRAC_CONST(0.40944414869225759),
+    FRAC_CONST(0.41224122666988289),
+    FRAC_CONST(0.41503442447608163),
+    FRAC_CONST(0.41782371582021227),
+    FRAC_CONST(0.42060907444840251),
+    FRAC_CONST(0.42339047414379605),
+    FRAC_CONST(0.42616788872679962),
+    FRAC_CONST(0.42894129205532949),
+    FRAC_CONST(0.43171065802505726),
+    FRAC_CONST(0.43447596056965565),
+    FRAC_CONST(0.43723717366104409),
+    FRAC_CONST(0.43999427130963326),
+    FRAC_CONST(0.44274722756457002),
+    FRAC_CONST(0.44549601651398174),
+    FRAC_CONST(0.44824061228521989),
+    FRAC_CONST(0.45098098904510386),
+    FRAC_CONST(0.45371712100016387),
+    FRAC_CONST(0.45644898239688392),
+    FRAC_CONST(0.45917654752194409),
+    FRAC_CONST(0.46189979070246273),
+    FRAC_CONST(0.46461868630623782),
+    FRAC_CONST(0.46733320874198842),
+    FRAC_CONST(0.47004333245959562),
+    FRAC_CONST(0.47274903195034279),
+    FRAC_CONST(0.47545028174715587),
+    FRAC_CONST(0.47814705642484301),
+    FRAC_CONST(0.48083933060033396),
+    FRAC_CONST(0.48352707893291874),
+    FRAC_CONST(0.48621027612448642),
+    FRAC_CONST(0.48888889691976317),
+    FRAC_CONST(0.4915629161065499),
+    FRAC_CONST(0.49423230851595967),
+    FRAC_CONST(0.49689704902265447),
+    FRAC_CONST(0.49955711254508184),
+    FRAC_CONST(0.50221247404571079),
+    FRAC_CONST(0.50486310853126759),
+    FRAC_CONST(0.50750899105297087),
+    FRAC_CONST(0.51015009670676681),
+    FRAC_CONST(0.51278640063356296),
+    FRAC_CONST(0.51541787801946293),
+    FRAC_CONST(0.51804450409599934),
+    FRAC_CONST(0.52066625414036716),
+    FRAC_CONST(0.52328310347565643),
+    FRAC_CONST(0.52589502747108463),
+    FRAC_CONST(0.52850200154222848),
+    FRAC_CONST(0.531104001151255),
+    FRAC_CONST(0.53370100180715296),
+    FRAC_CONST(0.53629297906596318),
+    FRAC_CONST(0.53887990853100842),
+    FRAC_CONST(0.54146176585312344),
+    FRAC_CONST(0.54403852673088382),
+    FRAC_CONST(0.54661016691083486),
+    FRAC_CONST(0.54917666218771966),
+    FRAC_CONST(0.55173798840470734),
+    FRAC_CONST(0.55429412145362),
+    FRAC_CONST(0.5568450372751601),
+    FRAC_CONST(0.55939071185913614),
+    FRAC_CONST(0.56193112124468947),
+    FRAC_CONST(0.5644662415205195),
+    FRAC_CONST(0.56699604882510868),
+    FRAC_CONST(0.56952051934694714),
+    FRAC_CONST(0.57203962932475705),
+    FRAC_CONST(0.57455335504771576),
+    FRAC_CONST(0.57706167285567944),
+    FRAC_CONST(0.57956455913940563),
+    FRAC_CONST(0.58206199034077544),
+    FRAC_CONST(0.58455394295301533),
+    FRAC_CONST(0.58704039352091797),
+    FRAC_CONST(0.58952131864106394),
+    FRAC_CONST(0.59199669496204099),
+    FRAC_CONST(0.59446649918466443),
+    FRAC_CONST(0.5969307080621965),
+    FRAC_CONST(0.59938929840056454),
+    FRAC_CONST(0.60184224705858003),
+    FRAC_CONST(0.60428953094815596),
+    FRAC_CONST(0.60673112703452448),
+    FRAC_CONST(0.60916701233645321),
+    FRAC_CONST(0.61159716392646191),
+    FRAC_CONST(0.61402155893103838),
+    FRAC_CONST(0.61644017453085365),
+    FRAC_CONST(0.61885298796097632),
+    FRAC_CONST(0.62125997651108755),
+    FRAC_CONST(0.62366111752569453),
+    FRAC_CONST(0.62605638840434352),
+    FRAC_CONST(0.62844576660183271),
+    FRAC_CONST(0.63082922962842447),
+    FRAC_CONST(0.63320675505005719),
+    FRAC_CONST(0.63557832048855611),
+    FRAC_CONST(0.63794390362184406),
+    FRAC_CONST(0.64030348218415167),
+    FRAC_CONST(0.64265703396622686),
+    FRAC_CONST(0.64500453681554393),
+    FRAC_CONST(0.64734596863651206),
+    FRAC_CONST(0.64968130739068319),
+    FRAC_CONST(0.6520105310969595),
+    FRAC_CONST(0.65433361783180044),
+    FRAC_CONST(0.65665054572942894),
+    FRAC_CONST(0.65896129298203732),
+    FRAC_CONST(0.66126583783999227),
+    FRAC_CONST(0.66356415861203977),
+    FRAC_CONST(0.66585623366550972),
+    FRAC_CONST(0.66814204142651845),
+    FRAC_CONST(0.67042156038017309),
+    FRAC_CONST(0.67269476907077286),
+    FRAC_CONST(0.67496164610201193),
+    FRAC_CONST(0.67722217013718033),
+    FRAC_CONST(0.67947631989936497),
+    FRAC_CONST(0.68172407417164971),
+    FRAC_CONST(0.6839654117973154),
+    FRAC_CONST(0.68620031168003859),
+    FRAC_CONST(0.68842875278409044),
+    FRAC_CONST(0.6906507141345346),
+    FRAC_CONST(0.69286617481742463),
+    FRAC_CONST(0.69507511398000088),
+    FRAC_CONST(0.69727751083088652),
+    FRAC_CONST(0.69947334464028377),
+    FRAC_CONST(0.70166259474016845),
+    FRAC_CONST(0.70384524052448494),
+    FRAC_CONST(0.70602126144933974),
+    FRAC_CONST(0.70819063703319529),
+    FRAC_CONST(0.71035334685706231),
+    FRAC_CONST(0.71250937056469232),
+    FRAC_CONST(0.71465868786276898),
+    FRAC_CONST(0.71680127852109954),
+    FRAC_CONST(0.71893712237280438),
+    FRAC_CONST(0.72106619931450811),
+    FRAC_CONST(0.72318848930652735),
+    FRAC_CONST(0.72530397237306066),
+    FRAC_CONST(0.72741262860237577),
+    FRAC_CONST(0.7295144381469969),
+    FRAC_CONST(0.73160938122389252),
+    FRAC_CONST(0.73369743811466026),
+    FRAC_CONST(0.73577858916571348),
+    FRAC_CONST(0.73785281478846598),
+    FRAC_CONST(0.73992009545951609),
+    FRAC_CONST(0.74198041172083096),
+    FRAC_CONST(0.74403374417992918),
+    FRAC_CONST(0.74608007351006378),
+    FRAC_CONST(0.74811938045040349),
+    FRAC_CONST(0.75015164580621496),
+    FRAC_CONST(0.7521768504490427),
+    FRAC_CONST(0.75419497531688917),
+    FRAC_CONST(0.75620600141439454),
+    FRAC_CONST(0.75820990981301528),
+    FRAC_CONST(0.76020668165120242),
+    FRAC_CONST(0.7621962981345789),
+    FRAC_CONST(0.76417874053611667),
+    FRAC_CONST(0.76615399019631281),
+    FRAC_CONST(0.76812202852336531),
+    FRAC_CONST(0.7700828369933479),
+    FRAC_CONST(0.77203639715038441),
+    FRAC_CONST(0.77398269060682279),
+    FRAC_CONST(0.77592169904340758),
+    FRAC_CONST(0.77785340420945304),
+    FRAC_CONST(0.77977778792301444),
+    FRAC_CONST(0.78169483207105939),
+    FRAC_CONST(0.7836045186096382),
+    FRAC_CONST(0.78550682956405393),
+    FRAC_CONST(0.78740174702903132),
+    FRAC_CONST(0.78928925316888565),
+    FRAC_CONST(0.79116933021769009),
+    FRAC_CONST(0.79304196047944364),
+    FRAC_CONST(0.79490712632823701),
+    FRAC_CONST(0.79676481020841872),
+    FRAC_CONST(0.79861499463476082),
+    FRAC_CONST(0.80045766219262271),
+    FRAC_CONST(0.80229279553811572),
+    FRAC_CONST(0.8041203773982657),
+    FRAC_CONST(0.80594039057117628),
+    FRAC_CONST(0.80775281792619036),
+    FRAC_CONST(0.80955764240405126),
+    FRAC_CONST(0.81135484701706373),
+    FRAC_CONST(0.81314441484925359),
+    FRAC_CONST(0.81492632905652662),
+    FRAC_CONST(0.81670057286682785),
+    FRAC_CONST(0.81846712958029866),
+    FRAC_CONST(0.82022598256943469),
+    FRAC_CONST(0.82197711527924155),
+    FRAC_CONST(0.82372051122739132),
+    FRAC_CONST(0.82545615400437744),
+    FRAC_CONST(0.82718402727366902),
+    FRAC_CONST(0.82890411477186487),
+    FRAC_CONST(0.8306164003088462),
+    FRAC_CONST(0.83232086776792968),
+    FRAC_CONST(0.83401750110601813),
+    FRAC_CONST(0.8357062843537526),
+    FRAC_CONST(0.83738720161566194),
+    FRAC_CONST(0.83906023707031263),
+    FRAC_CONST(0.84072537497045807),
+    FRAC_CONST(0.84238259964318596),
+    FRAC_CONST(0.84403189549006641),
+    FRAC_CONST(0.84567324698729907),
+    FRAC_CONST(0.84730663868585832),
+    FRAC_CONST(0.84893205521163961),
+    FRAC_CONST(0.85054948126560337),
+    FRAC_CONST(0.85215890162391983),
+    FRAC_CONST(0.8537603011381113),
+    FRAC_CONST(0.85535366473519603),
+    FRAC_CONST(0.85693897741782865),
+    FRAC_CONST(0.85851622426444274),
+    FRAC_CONST(0.86008539042939014),
+    FRAC_CONST(0.8616464611430813),
+    FRAC_CONST(0.86319942171212416),
+    FRAC_CONST(0.86474425751946238),
+    FRAC_CONST(0.86628095402451299),
+    FRAC_CONST(0.86780949676330321),
+    FRAC_CONST(0.86932987134860673),
+    FRAC_CONST(0.87084206347007886),
+    FRAC_CONST(0.87234605889439154),
+    FRAC_CONST(0.87384184346536675),
+    FRAC_CONST(0.87532940310411078),
+    FRAC_CONST(0.87680872380914576),
+    FRAC_CONST(0.87827979165654146),
+    FRAC_CONST(0.87974259280004741),
+    FRAC_CONST(0.88119711347122198),
+    FRAC_CONST(0.88264333997956279),
+    FRAC_CONST(0.88408125871263499),
+    FRAC_CONST(0.88551085613619995),
+    FRAC_CONST(0.88693211879434208),
+    FRAC_CONST(0.88834503330959624),
+    FRAC_CONST(0.88974958638307289),
+    FRAC_CONST(0.89114576479458318),
+    FRAC_CONST(0.89253355540276469),
+    FRAC_CONST(0.89391294514520325),
+    FRAC_CONST(0.89528392103855758),
+    FRAC_CONST(0.89664647017868015),
+    FRAC_CONST(0.89800057974073988),
+    FRAC_CONST(0.89934623697934146),
+    FRAC_CONST(0.90068342922864686),
+    FRAC_CONST(0.90201214390249307),
+    FRAC_CONST(0.90333236849451182),
+    FRAC_CONST(0.90464409057824624),
+    FRAC_CONST(0.90594729780726846),
+    FRAC_CONST(0.90724197791529593),
+    FRAC_CONST(0.90852811871630612),
+    FRAC_CONST(0.90980570810465222),
+    FRAC_CONST(0.91107473405517625),
+    FRAC_CONST(0.91233518462332275),
+    FRAC_CONST(0.91358704794525081),
+    FRAC_CONST(0.91483031223794609),
+    FRAC_CONST(0.91606496579933161),
+    FRAC_CONST(0.91729099700837791),
+    FRAC_CONST(0.91850839432521225),
+    FRAC_CONST(0.91971714629122736),
+    FRAC_CONST(0.92091724152918952),
+    FRAC_CONST(0.92210866874334507),
+    FRAC_CONST(0.92329141671952764),
+    FRAC_CONST(0.9244654743252626),
+    FRAC_CONST(0.92563083050987272),
+    FRAC_CONST(0.92678747430458175),
+    FRAC_CONST(0.92793539482261789),
+    FRAC_CONST(0.92907458125931575),
+    FRAC_CONST(0.93020502289221907),
+    FRAC_CONST(0.93132670908118043),
+    FRAC_CONST(0.93243962926846236),
+    FRAC_CONST(0.93354377297883617),
+    FRAC_CONST(0.93463912981968078),
+    FRAC_CONST(0.93572568948108037),
+    FRAC_CONST(0.93680344173592156),
+    FRAC_CONST(0.93787237643998989),
+    FRAC_CONST(0.93893248353206449),
+    FRAC_CONST(0.93998375303401394),
+    FRAC_CONST(0.94102617505088926),
+    FRAC_CONST(0.94205973977101731),
+    FRAC_CONST(0.94308443746609349),
+    FRAC_CONST(0.94410025849127266),
+    FRAC_CONST(0.94510719328526061),
+    FRAC_CONST(0.94610523237040334),
+    FRAC_CONST(0.94709436635277722),
+    FRAC_CONST(0.94807458592227623),
+    FRAC_CONST(0.94904588185270056),
+    FRAC_CONST(0.950008245001843),
+    FRAC_CONST(0.95096166631157508),
+    FRAC_CONST(0.95190613680793223),
+    FRAC_CONST(0.95284164760119872),
+    FRAC_CONST(0.95376818988599033),
+    FRAC_CONST(0.95468575494133834),
+    FRAC_CONST(0.95559433413077111),
+    FRAC_CONST(0.95649391890239499),
+    FRAC_CONST(0.95738450078897586),
+    FRAC_CONST(0.95826607140801767),
+    FRAC_CONST(0.95913862246184189),
+    FRAC_CONST(0.96000214573766585),
+    FRAC_CONST(0.96085663310767966),
+    FRAC_CONST(0.96170207652912254),
+    FRAC_CONST(0.96253846804435916),
+    FRAC_CONST(0.96336579978095405),
+    FRAC_CONST(0.96418406395174572),
+    FRAC_CONST(0.96499325285492032),
+    FRAC_CONST(0.96579335887408357),
+    FRAC_CONST(0.96658437447833312),
+    FRAC_CONST(0.96736629222232851),
+    FRAC_CONST(0.96813910474636233),
+    FRAC_CONST(0.96890280477642887),
+    FRAC_CONST(0.96965738512429245),
+    FRAC_CONST(0.9704028386875555),
+    FRAC_CONST(0.97113915844972509),
+    FRAC_CONST(0.9718663374802794),
+    FRAC_CONST(0.97258436893473221),
+    FRAC_CONST(0.97329324605469825),
+    FRAC_CONST(0.97399296216795583),
+    FRAC_CONST(0.97468351068851067),
+    FRAC_CONST(0.97536488511665687),
+    FRAC_CONST(0.97603707903903902),
+    FRAC_CONST(0.97670008612871184),
+    FRAC_CONST(0.97735390014519996),
+    FRAC_CONST(0.97799851493455714),
+    FRAC_CONST(0.9786339244294231),
+    FRAC_CONST(0.97926012264908202),
+    FRAC_CONST(0.97987710369951764),
+    FRAC_CONST(0.98048486177346938),
+    FRAC_CONST(0.98108339115048659),
+    FRAC_CONST(0.98167268619698311),
+    FRAC_CONST(0.98225274136628937),
+    FRAC_CONST(0.98282355119870524),
+    FRAC_CONST(0.98338511032155118),
+    FRAC_CONST(0.98393741344921892),
+    FRAC_CONST(0.98448045538322093),
+    FRAC_CONST(0.98501423101223984),
+    FRAC_CONST(0.98553873531217606),
+    FRAC_CONST(0.98605396334619544),
+    FRAC_CONST(0.98655991026477541),
+    FRAC_CONST(0.98705657130575097),
+    FRAC_CONST(0.98754394179435923),
+    FRAC_CONST(0.98802201714328353),
+    FRAC_CONST(0.98849079285269659),
+    FRAC_CONST(0.98895026451030299),
+    FRAC_CONST(0.98940042779138038),
+    FRAC_CONST(0.98984127845882053),
+    FRAC_CONST(0.99027281236316911),
+    FRAC_CONST(0.99069502544266463),
+    FRAC_CONST(0.99110791372327678),
+    FRAC_CONST(0.9915114733187439),
+    FRAC_CONST(0.99190570043060933),
+    FRAC_CONST(0.99229059134825737),
+    FRAC_CONST(0.99266614244894802),
+    FRAC_CONST(0.99303235019785141),
+    FRAC_CONST(0.99338921114808065),
+    FRAC_CONST(0.9937367219407246),
+    FRAC_CONST(0.99407487930487937),
+    FRAC_CONST(0.9944036800576791),
+    FRAC_CONST(0.9947231211043257),
+    FRAC_CONST(0.99503319943811863),
+    FRAC_CONST(0.99533391214048228),
+    FRAC_CONST(0.99562525638099431),
+    FRAC_CONST(0.99590722941741172),
+    FRAC_CONST(0.99617982859569687),
+    FRAC_CONST(0.99644305135004263),
+    FRAC_CONST(0.99669689520289606),
+    FRAC_CONST(0.99694135776498216),
+    FRAC_CONST(0.99717643673532619),
+    FRAC_CONST(0.9974021299012753),
+    FRAC_CONST(0.99761843513851955),
+    FRAC_CONST(0.99782535041111164),
+    FRAC_CONST(0.99802287377148624),
+    FRAC_CONST(0.99821100336047819),
+    FRAC_CONST(0.99838973740734016),
+    FRAC_CONST(0.99855907422975931),
+    FRAC_CONST(0.99871901223387294),
+    FRAC_CONST(0.99886954991428356),
+    FRAC_CONST(0.99901068585407338),
+    FRAC_CONST(0.99914241872481691),
+    FRAC_CONST(0.99926474728659442),
+    FRAC_CONST(0.99937767038800285),
+    FRAC_CONST(0.99948118696616695),
+    FRAC_CONST(0.99957529604674922),
+    FRAC_CONST(0.99965999674395922),
+    FRAC_CONST(0.99973528826056168),
+    FRAC_CONST(0.99980116988788426),
+    FRAC_CONST(0.99985764100582386),
+    FRAC_CONST(0.9999047010828529),
+    FRAC_CONST(0.99994234967602391),
+    FRAC_CONST(0.99997058643097414),
+    FRAC_CONST(0.9999894110819284),
+    FRAC_CONST(0.99999882345170188)
+};
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+real_t sine_mid_480[] =
+{
+    FRAC_CONST(0.0016362454436240478),
+    FRAC_CONST(0.00490871880799799),
+    FRAC_CONST(0.0081811396039371282),
+    FRAC_CONST(0.011453472786443779),
+    FRAC_CONST(0.014725683311458524),
+    FRAC_CONST(0.017997736136235509),
+    FRAC_CONST(0.021269596219717739),
+    FRAC_CONST(0.024541228522912285),
+    FRAC_CONST(0.027812598009265607),
+    FRAC_CONST(0.03108366964503869),
+    FRAC_CONST(0.034354408399682276),
+    FRAC_CONST(0.037624779246211978),
+    FRAC_CONST(0.04089474716158345),
+    FRAC_CONST(0.044164277127067358),
+    FRAC_CONST(0.047433334128624507),
+    FRAC_CONST(0.050701883157280733),
+    FRAC_CONST(0.053969889209501881),
+    FRAC_CONST(0.057237317287568618),
+    FRAC_CONST(0.060504132399951269),
+    FRAC_CONST(0.063770299561684493),
+    FRAC_CONST(0.06703578379474201),
+    FRAC_CONST(0.070300550128411174),
+    FRAC_CONST(0.073564563599667426),
+    FRAC_CONST(0.076827789253548759),
+    FRAC_CONST(0.080090192143530081),
+    FRAC_CONST(0.083351737331897449),
+    FRAC_CONST(0.086612389890122182),
+    FRAC_CONST(0.089872114899234967),
+    FRAC_CONST(0.093130877450199795),
+    FRAC_CONST(0.096388642644287828),
+    FRAC_CONST(0.09964537559345106),
+    FRAC_CONST(0.1029010414206961),
+    FRAC_CONST(0.10615560526045748),
+    FRAC_CONST(0.10940903225897117),
+    FRAC_CONST(0.11266128757464781),
+    FRAC_CONST(0.11591233637844581),
+    FRAC_CONST(0.11916214385424433),
+    FRAC_CONST(0.1224106751992162),
+    FRAC_CONST(0.12565789562420052),
+    FRAC_CONST(0.12890377035407541),
+    FRAC_CONST(0.13214826462813015),
+    FRAC_CONST(0.13539134370043773),
+    FRAC_CONST(0.13863297284022669),
+    FRAC_CONST(0.14187311733225325),
+    FRAC_CONST(0.14511174247717309),
+    FRAC_CONST(0.14834881359191271),
+    FRAC_CONST(0.15158429601004111),
+    FRAC_CONST(0.15481815508214106),
+    FRAC_CONST(0.1580503561761798),
+    FRAC_CONST(0.16128086467788047),
+    FRAC_CONST(0.16450964599109233),
+    FRAC_CONST(0.16773666553816149),
+    FRAC_CONST(0.17096188876030122),
+    FRAC_CONST(0.17418528111796186),
+    FRAC_CONST(0.17740680809120093),
+    FRAC_CONST(0.18062643518005275),
+    FRAC_CONST(0.18384412790489776),
+    FRAC_CONST(0.18705985180683199),
+    FRAC_CONST(0.19027357244803589),
+    FRAC_CONST(0.19348525541214331),
+    FRAC_CONST(0.19669486630460997),
+    FRAC_CONST(0.19990237075308173),
+    FRAC_CONST(0.20310773440776286),
+    FRAC_CONST(0.20631092294178383),
+    FRAC_CONST(0.20951190205156878),
+    FRAC_CONST(0.21271063745720317),
+    FRAC_CONST(0.21590709490280058),
+    FRAC_CONST(0.2191012401568698),
+    FRAC_CONST(0.22229303901268133),
+    FRAC_CONST(0.22548245728863364),
+    FRAC_CONST(0.22866946082861941),
+    FRAC_CONST(0.23185401550239115),
+    FRAC_CONST(0.23503608720592667),
+    FRAC_CONST(0.23821564186179459),
+    FRAC_CONST(0.24139264541951888),
+    FRAC_CONST(0.24456706385594387),
+    FRAC_CONST(0.24773886317559846),
+    FRAC_CONST(0.25090800941106001),
+    FRAC_CONST(0.25407446862331851),
+    FRAC_CONST(0.25723820690213967),
+    FRAC_CONST(0.26039919036642817),
+    FRAC_CONST(0.26355738516459076),
+    FRAC_CONST(0.26671275747489837),
+    FRAC_CONST(0.2698652735058486),
+    FRAC_CONST(0.27301489949652735),
+    FRAC_CONST(0.27616160171697068),
+    FRAC_CONST(0.27930534646852595),
+    FRAC_CONST(0.28244610008421245),
+    FRAC_CONST(0.2855838289290823),
+    FRAC_CONST(0.28871849940058025),
+    FRAC_CONST(0.29185007792890405),
+    FRAC_CONST(0.29497853097736348),
+    FRAC_CONST(0.2981038250427398),
+    FRAC_CONST(0.30122592665564446),
+    FRAC_CONST(0.30434480238087736),
+    FRAC_CONST(0.30746041881778519),
+    FRAC_CONST(0.31057274260061901),
+    FRAC_CONST(0.31368174039889146),
+    FRAC_CONST(0.31678737891773395),
+    FRAC_CONST(0.31988962489825296),
+    FRAC_CONST(0.32298844511788638),
+    FRAC_CONST(0.32608380639075912),
+    FRAC_CONST(0.32917567556803889),
+    FRAC_CONST(0.33226401953829071),
+    FRAC_CONST(0.33534880522783189),
+    FRAC_CONST(0.33842999960108583),
+    FRAC_CONST(0.34150756966093632),
+    FRAC_CONST(0.34458148244908043),
+    FRAC_CONST(0.34765170504638188),
+    FRAC_CONST(0.35071820457322322),
+    FRAC_CONST(0.35378094818985806),
+    FRAC_CONST(0.35683990309676283),
+    FRAC_CONST(0.35989503653498811),
+    FRAC_CONST(0.36294631578650921),
+    FRAC_CONST(0.36599370817457672),
+    FRAC_CONST(0.36903718106406647),
+    FRAC_CONST(0.37207670186182878),
+    FRAC_CONST(0.37511223801703802),
+    FRAC_CONST(0.37814375702154046),
+    FRAC_CONST(0.38117122641020335),
+    FRAC_CONST(0.38419461376126157),
+    FRAC_CONST(0.38721388669666562),
+    FRAC_CONST(0.39022901288242801),
+    FRAC_CONST(0.39323996002896966),
+    FRAC_CONST(0.39624669589146555),
+    FRAC_CONST(0.39924918827019029),
+    FRAC_CONST(0.40224740501086254),
+    FRAC_CONST(0.40524131400498986),
+    FRAC_CONST(0.40823088319021217),
+    FRAC_CONST(0.41121608055064529),
+    FRAC_CONST(0.41419687411722372),
+    FRAC_CONST(0.41717323196804335),
+    FRAC_CONST(0.42014512222870243),
+    FRAC_CONST(0.42311251307264408),
+    FRAC_CONST(0.42607537272149631),
+    FRAC_CONST(0.4290336694454126),
+    FRAC_CONST(0.43198737156341183),
+    FRAC_CONST(0.43493644744371707),
+    FRAC_CONST(0.43788086550409511),
+    FRAC_CONST(0.44082059421219388),
+    FRAC_CONST(0.44375560208588088),
+    FRAC_CONST(0.44668585769357955),
+    FRAC_CONST(0.4496113296546066),
+    FRAC_CONST(0.45253198663950756),
+    FRAC_CONST(0.45544779737039259),
+    FRAC_CONST(0.45835873062127125),
+    FRAC_CONST(0.46126475521838717),
+    FRAC_CONST(0.46416584004055156),
+    FRAC_CONST(0.46706195401947659),
+    FRAC_CONST(0.46995306614010829),
+    FRAC_CONST(0.47283914544095862),
+    FRAC_CONST(0.47572016101443682),
+    FRAC_CONST(0.47859608200718085),
+    FRAC_CONST(0.4814668776203872),
+    FRAC_CONST(0.48433251711014125),
+    FRAC_CONST(0.4871929697877464),
+    FRAC_CONST(0.49004820502005247),
+    FRAC_CONST(0.49289819222978404),
+    FRAC_CONST(0.49574290089586776),
+    FRAC_CONST(0.49858230055375902),
+    FRAC_CONST(0.50141636079576901),
+    FRAC_CONST(0.50424505127138919),
+    FRAC_CONST(0.50706834168761705),
+    FRAC_CONST(0.50988620180928057),
+    FRAC_CONST(0.51269860145936175),
+    FRAC_CONST(0.51550551051931948),
+    FRAC_CONST(0.51830689892941317),
+    FRAC_CONST(0.5211027366890234),
+    FRAC_CONST(0.52389299385697385),
+    FRAC_CONST(0.52667764055185196),
+    FRAC_CONST(0.52945664695232897),
+    FRAC_CONST(0.53222998329747884),
+    FRAC_CONST(0.53499761988709726),
+    FRAC_CONST(0.53775952708201991),
+    FRAC_CONST(0.54051567530443978),
+    FRAC_CONST(0.54326603503822357),
+    FRAC_CONST(0.54601057682922816),
+    FRAC_CONST(0.54874927128561579),
+    FRAC_CONST(0.55148208907816942),
+    FRAC_CONST(0.55420900094060566),
+    FRAC_CONST(0.55692997766988939),
+    FRAC_CONST(0.559644990126546),
+    FRAC_CONST(0.56235400923497314),
+    FRAC_CONST(0.56505700598375252),
+    FRAC_CONST(0.56775395142596052),
+    FRAC_CONST(0.57044481667947822),
+    FRAC_CONST(0.57312957292730071),
+    FRAC_CONST(0.57580819141784534),
+    FRAC_CONST(0.57848064346525996),
+    FRAC_CONST(0.58114690044973039),
+    FRAC_CONST(0.58380693381778626),
+    FRAC_CONST(0.58646071508260733),
+    FRAC_CONST(0.58910821582432815),
+    FRAC_CONST(0.5917494076903429),
+    FRAC_CONST(0.5943842623956086),
+    FRAC_CONST(0.59701275172294799),
+    FRAC_CONST(0.59963484752335228),
+    FRAC_CONST(0.60225052171628191),
+    FRAC_CONST(0.60485974628996786),
+    FRAC_CONST(0.60746249330171098),
+    FRAC_CONST(0.61005873487818185),
+    FRAC_CONST(0.61264844321571899),
+    FRAC_CONST(0.61523159058062682),
+    FRAC_CONST(0.61780814930947225),
+    FRAC_CONST(0.62037809180938108),
+    FRAC_CONST(0.62294139055833397),
+    FRAC_CONST(0.6254980181054608),
+    FRAC_CONST(0.62804794707133416),
+    FRAC_CONST(0.63059115014826372),
+    FRAC_CONST(0.63312760010058777),
+    FRAC_CONST(0.63565726976496484),
+    FRAC_CONST(0.63818013205066515),
+    FRAC_CONST(0.64069615993986073),
+    FRAC_CONST(0.64320532648791406),
+    FRAC_CONST(0.64570760482366729),
+    FRAC_CONST(0.64820296814972966),
+    FRAC_CONST(0.65069138974276486),
+    FRAC_CONST(0.65317284295377676),
+    FRAC_CONST(0.65564730120839498),
+    FRAC_CONST(0.65811473800715958),
+    FRAC_CONST(0.660575126925805),
+    FRAC_CONST(0.66302844161554231),
+    FRAC_CONST(0.6654746558033422),
+    FRAC_CONST(0.66791374329221598),
+    FRAC_CONST(0.67034567796149647),
+    FRAC_CONST(0.67277043376711676),
+    FRAC_CONST(0.67518798474189046),
+    FRAC_CONST(0.67759830499578866),
+    FRAC_CONST(0.68000136871621808),
+    FRAC_CONST(0.68239715016829683),
+    FRAC_CONST(0.6847856236951303),
+    FRAC_CONST(0.68716676371808583),
+    FRAC_CONST(0.68954054473706683),
+    FRAC_CONST(0.69190694133078579),
+    FRAC_CONST(0.69426592815703603),
+    FRAC_CONST(0.69661747995296419),
+    FRAC_CONST(0.69896157153533944),
+    FRAC_CONST(0.70129817780082437),
+    FRAC_CONST(0.7036272737262429),
+    FRAC_CONST(0.70594883436884903),
+    FRAC_CONST(0.70826283486659336),
+    FRAC_CONST(0.71056925043838959),
+    FRAC_CONST(0.71286805638437978),
+    FRAC_CONST(0.71515922808619936),
+    FRAC_CONST(0.71744274100723993),
+    FRAC_CONST(0.71971857069291278),
+    FRAC_CONST(0.7219866927709101),
+    FRAC_CONST(0.72424708295146689),
+    FRAC_CONST(0.72649971702762028),
+    FRAC_CONST(0.72874457087546896),
+    FRAC_CONST(0.73098162045443171),
+    FRAC_CONST(0.73321084180750484),
+    FRAC_CONST(0.73543221106151868),
+    FRAC_CONST(0.73764570442739286),
+    FRAC_CONST(0.73985129820039208),
+    FRAC_CONST(0.74204896876037885),
+    FRAC_CONST(0.7442386925720671),
+    FRAC_CONST(0.74642044618527381),
+    FRAC_CONST(0.74859420623517081),
+    FRAC_CONST(0.75075994944253421),
+    FRAC_CONST(0.75291765261399446),
+    FRAC_CONST(0.75506729264228367),
+    FRAC_CONST(0.75720884650648446),
+    FRAC_CONST(0.75934229127227548),
+    FRAC_CONST(0.76146760409217706),
+    FRAC_CONST(0.76358476220579641),
+    FRAC_CONST(0.7656937429400712),
+    FRAC_CONST(0.76779452370951196),
+    FRAC_CONST(0.76988708201644451),
+    FRAC_CONST(0.77197139545125026),
+    FRAC_CONST(0.7740474416926072),
+    FRAC_CONST(0.77611519850772781),
+    FRAC_CONST(0.77817464375259782),
+    FRAC_CONST(0.78022575537221317),
+    FRAC_CONST(0.78226851140081632),
+    FRAC_CONST(0.78430288996213138),
+    FRAC_CONST(0.78632886926959822),
+    FRAC_CONST(0.78834642762660623),
+    FRAC_CONST(0.79035554342672631),
+    FRAC_CONST(0.79235619515394229),
+    FRAC_CONST(0.79434836138288134),
+    FRAC_CONST(0.79633202077904397),
+    FRAC_CONST(0.79830715209903147),
+    FRAC_CONST(0.8002737341907743),
+    FRAC_CONST(0.80223174599375802),
+    FRAC_CONST(0.80418116653924954),
+    FRAC_CONST(0.80612197495052085),
+    FRAC_CONST(0.80805415044307316),
+    FRAC_CONST(0.80997767232485907),
+    FRAC_CONST(0.81189251999650469),
+    FRAC_CONST(0.81379867295152986),
+    FRAC_CONST(0.81569611077656778),
+    FRAC_CONST(0.81758481315158371),
+    FRAC_CONST(0.81946475985009259),
+    FRAC_CONST(0.82133593073937561),
+    FRAC_CONST(0.82319830578069586),
+    FRAC_CONST(0.82505186502951278),
+    FRAC_CONST(0.82689658863569615),
+    FRAC_CONST(0.82873245684373809),
+    FRAC_CONST(0.83055944999296494),
+    FRAC_CONST(0.83237754851774781),
+    FRAC_CONST(0.83418673294771239),
+    FRAC_CONST(0.83598698390794668),
+    FRAC_CONST(0.83777828211920935),
+    FRAC_CONST(0.83956060839813562),
+    FRAC_CONST(0.84133394365744296),
+    FRAC_CONST(0.84309826890613537),
+    FRAC_CONST(0.84485356524970701),
+    FRAC_CONST(0.84659981389034411),
+    FRAC_CONST(0.84833699612712676),
+    FRAC_CONST(0.85006509335622882),
+    FRAC_CONST(0.8517840870711173),
+    FRAC_CONST(0.85349395886275037),
+    FRAC_CONST(0.85519469041977514),
+    FRAC_CONST(0.85688626352872277),
+    FRAC_CONST(0.85856866007420429),
+    FRAC_CONST(0.86024186203910447),
+    FRAC_CONST(0.86190585150477417),
+    FRAC_CONST(0.86356061065122347),
+    FRAC_CONST(0.86520612175731115),
+    FRAC_CONST(0.86684236720093533),
+    FRAC_CONST(0.86846932945922151),
+    FRAC_CONST(0.87008699110871135),
+    FRAC_CONST(0.87169533482554817),
+    FRAC_CONST(0.87329434338566281),
+    FRAC_CONST(0.87488399966495822),
+    FRAC_CONST(0.87646428663949283),
+    FRAC_CONST(0.87803518738566277),
+    FRAC_CONST(0.87959668508038291),
+    FRAC_CONST(0.88114876300126743),
+    FRAC_CONST(0.88269140452680916),
+    FRAC_CONST(0.8842245931365561),
+    FRAC_CONST(0.88574831241129048),
+    FRAC_CONST(0.88726254603320276),
+    FRAC_CONST(0.88876727778606746),
+    FRAC_CONST(0.89026249155541637),
+    FRAC_CONST(0.8917481713287112),
+    FRAC_CONST(0.89322430119551532),
+    FRAC_CONST(0.89469086534766362),
+    FRAC_CONST(0.89614784807943237),
+    FRAC_CONST(0.89759523378770689),
+    FRAC_CONST(0.89903300697214927),
+    FRAC_CONST(0.9004611522353636),
+    FRAC_CONST(0.90187965428306172),
+    FRAC_CONST(0.90328849792422594),
+    FRAC_CONST(0.90468766807127299),
+    FRAC_CONST(0.90607714974021469),
+    FRAC_CONST(0.90745692805081868),
+    FRAC_CONST(0.90882698822676755),
+    FRAC_CONST(0.91018731559581767),
+    FRAC_CONST(0.91153789558995579),
+    FRAC_CONST(0.91287871374555518),
+    FRAC_CONST(0.91420975570353069),
+    FRAC_CONST(0.9155310072094921),
+    FRAC_CONST(0.91684245411389753),
+    FRAC_CONST(0.91814408237220391),
+    FRAC_CONST(0.91943587804501858),
+    FRAC_CONST(0.92071782729824769),
+    FRAC_CONST(0.92198991640324446),
+    FRAC_CONST(0.92325213173695675),
+    FRAC_CONST(0.92450445978207241),
+    FRAC_CONST(0.92574688712716402),
+    FRAC_CONST(0.92697940046683291),
+    FRAC_CONST(0.92820198660185149),
+    FRAC_CONST(0.92941463243930444),
+    FRAC_CONST(0.93061732499272909),
+    FRAC_CONST(0.93181005138225426),
+    FRAC_CONST(0.93299279883473885),
+    FRAC_CONST(0.93416555468390772),
+    FRAC_CONST(0.93532830637048769),
+    FRAC_CONST(0.93648104144234268),
+    FRAC_CONST(0.93762374755460598),
+    FRAC_CONST(0.93875641246981323),
+    FRAC_CONST(0.93987902405803303),
+    FRAC_CONST(0.94099157029699743),
+    FRAC_CONST(0.94209403927222979),
+    FRAC_CONST(0.94318641917717327),
+    FRAC_CONST(0.9442686983133165),
+    FRAC_CONST(0.94534086509031956),
+    FRAC_CONST(0.9464029080261378),
+    FRAC_CONST(0.94745481574714419),
+    FRAC_CONST(0.94849657698825252),
+    FRAC_CONST(0.94952818059303667),
+    FRAC_CONST(0.95054961551385087),
+    FRAC_CONST(0.95156087081194762),
+    FRAC_CONST(0.95256193565759528),
+    FRAC_CONST(0.95355279933019343),
+    FRAC_CONST(0.9545334512183884),
+    FRAC_CONST(0.95550388082018611),
+    FRAC_CONST(0.95646407774306541),
+    FRAC_CONST(0.95741403170408834),
+    FRAC_CONST(0.95835373253001133),
+    FRAC_CONST(0.95928317015739362),
+    FRAC_CONST(0.96020233463270466),
+    FRAC_CONST(0.96111121611243155),
+    FRAC_CONST(0.96200980486318388),
+    FRAC_CONST(0.96289809126179782),
+    FRAC_CONST(0.96377606579543984),
+    FRAC_CONST(0.96464371906170809),
+    FRAC_CONST(0.96550104176873297),
+    FRAC_CONST(0.96634802473527726),
+    FRAC_CONST(0.96718465889083372),
+    FRAC_CONST(0.96801093527572268),
+    FRAC_CONST(0.96882684504118799),
+    FRAC_CONST(0.96963237944949143),
+    FRAC_CONST(0.97042752987400682),
+    FRAC_CONST(0.97121228779931179),
+    FRAC_CONST(0.97198664482127939),
+    FRAC_CONST(0.97275059264716823),
+    FRAC_CONST(0.97350412309571066),
+    FRAC_CONST(0.97424722809720088),
+    FRAC_CONST(0.97497989969358168),
+    FRAC_CONST(0.97570213003852857),
+    FRAC_CONST(0.97641391139753486),
+    FRAC_CONST(0.97711523614799412),
+    FRAC_CONST(0.97780609677928154),
+    FRAC_CONST(0.97848648589283505),
+    FRAC_CONST(0.97915639620223371),
+    FRAC_CONST(0.9798158205332762),
+    FRAC_CONST(0.98046475182405801),
+    FRAC_CONST(0.98110318312504607),
+    FRAC_CONST(0.98173110759915416),
+    FRAC_CONST(0.98234851852181571),
+    FRAC_CONST(0.98295540928105563),
+    FRAC_CONST(0.9835517733775615),
+    FRAC_CONST(0.98413760442475307),
+    FRAC_CONST(0.98471289614885038),
+    FRAC_CONST(0.98527764238894122),
+    FRAC_CONST(0.98583183709704714),
+    FRAC_CONST(0.98637547433818806),
+    FRAC_CONST(0.98690854829044583),
+    FRAC_CONST(0.98743105324502667),
+    FRAC_CONST(0.98794298360632238),
+    FRAC_CONST(0.98844433389196995),
+    FRAC_CONST(0.98893509873291074),
+    FRAC_CONST(0.98941527287344755),
+    FRAC_CONST(0.98988485117130098),
+    FRAC_CONST(0.99034382859766479),
+    FRAC_CONST(0.99079220023725967),
+    FRAC_CONST(0.99122996128838525),
+    FRAC_CONST(0.9916571070629725),
+    FRAC_CONST(0.99207363298663342),
+    FRAC_CONST(0.99247953459870997),
+    FRAC_CONST(0.99287480755232194),
+    FRAC_CONST(0.99325944761441354),
+    FRAC_CONST(0.99363345066579889),
+    FRAC_CONST(0.99399681270120555),
+    FRAC_CONST(0.99434952982931812),
+    FRAC_CONST(0.9946915982728195),
+    FRAC_CONST(0.99502301436843166),
+    FRAC_CONST(0.99534377456695422),
+    FRAC_CONST(0.9956538754333033),
+    FRAC_CONST(0.99595331364654771),
+    FRAC_CONST(0.99624208599994479),
+    FRAC_CONST(0.99652018940097464),
+    FRAC_CONST(0.99678762087137318),
+    FRAC_CONST(0.99704437754716424),
+    FRAC_CONST(0.99729045667869021),
+    FRAC_CONST(0.99752585563064111),
+    FRAC_CONST(0.99775057188208349),
+    FRAC_CONST(0.9979646030264866),
+    FRAC_CONST(0.99816794677174903),
+    FRAC_CONST(0.9983606009402225),
+    FRAC_CONST(0.99854256346873571),
+    FRAC_CONST(0.99871383240861611),
+    FRAC_CONST(0.99887440592571108),
+    FRAC_CONST(0.99902428230040718),
+    FRAC_CONST(0.99916345992764877),
+    FRAC_CONST(0.99929193731695531),
+    FRAC_CONST(0.99940971309243731),
+    FRAC_CONST(0.99951678599281069),
+    FRAC_CONST(0.99961315487141078),
+    FRAC_CONST(0.99969881869620425),
+    FRAC_CONST(0.99977377654980037),
+    FRAC_CONST(0.99983802762946083),
+    FRAC_CONST(0.99989157124710804),
+    FRAC_CONST(0.9999344068293331),
+    FRAC_CONST(0.99996653391740109),
+    FRAC_CONST(0.99998795216725689),
+    FRAC_CONST(0.99999866134952808)
+};
+#endif
+
+real_t ld_mid_512[] =
+{
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0.0061358846491544753),
+    FRAC_CONST(0.01840672990580482),
+    FRAC_CONST(0.030674803176636626),
+    FRAC_CONST(0.04293825693494082),
+    FRAC_CONST(0.055195244349689934),
+    FRAC_CONST(0.067443919563664051),
+    FRAC_CONST(0.079682437971430126),
+    FRAC_CONST(0.091908956497132724),
+    FRAC_CONST(0.10412163387205459),
+    FRAC_CONST(0.11631863091190475),
+    FRAC_CONST(0.12849811079379317),
+    FRAC_CONST(0.14065823933284921),
+    FRAC_CONST(0.15279718525844344),
+    FRAC_CONST(0.16491312048996989),
+    FRAC_CONST(0.17700422041214875),
+    FRAC_CONST(0.18906866414980619),
+    FRAC_CONST(0.2011046348420919),
+    FRAC_CONST(0.21311031991609136),
+    FRAC_CONST(0.22508391135979283),
+    FRAC_CONST(0.2370236059943672),
+    FRAC_CONST(0.24892760574572015),
+    FRAC_CONST(0.26079411791527551),
+    FRAC_CONST(0.27262135544994898),
+    FRAC_CONST(0.28440753721127188),
+    FRAC_CONST(0.29615088824362379),
+    FRAC_CONST(0.30784964004153487),
+    FRAC_CONST(0.31950203081601569),
+    FRAC_CONST(0.33110630575987643),
+    FRAC_CONST(0.34266071731199438),
+    FRAC_CONST(0.35416352542049034),
+    FRAC_CONST(0.36561299780477385),
+    FRAC_CONST(0.37700741021641826),
+    FRAC_CONST(0.38834504669882625),
+    FRAC_CONST(0.39962419984564679),
+    FRAC_CONST(0.41084317105790391),
+    FRAC_CONST(0.42200027079979968),
+    FRAC_CONST(0.43309381885315196),
+    FRAC_CONST(0.4441221445704292),
+    FRAC_CONST(0.45508358712634384),
+    FRAC_CONST(0.46597649576796618),
+    FRAC_CONST(0.47679923006332209),
+    FRAC_CONST(0.487550160148436),
+    FRAC_CONST(0.49822766697278187),
+    FRAC_CONST(0.50883014254310699),
+    FRAC_CONST(0.51935599016558964),
+    FRAC_CONST(0.52980362468629461),
+    FRAC_CONST(0.54017147272989285),
+    FRAC_CONST(0.55045797293660481),
+    FRAC_CONST(0.56066157619733603),
+    FRAC_CONST(0.57078074588696726),
+    FRAC_CONST(0.58081395809576453),
+    FRAC_CONST(0.59075970185887416),
+    FRAC_CONST(0.60061647938386897),
+    FRAC_CONST(0.61038280627630948),
+    FRAC_CONST(0.6200572117632891),
+    FRAC_CONST(0.62963823891492698),
+    FRAC_CONST(0.63912444486377573),
+    FRAC_CONST(0.64851440102211244),
+    FRAC_CONST(0.65780669329707864),
+    FRAC_CONST(0.66699992230363747),
+    FRAC_CONST(0.67609270357531592),
+    FRAC_CONST(0.68508366777270036),
+    FRAC_CONST(0.693971460889654),
+    FRAC_CONST(0.7027547444572253),
+    FRAC_CONST(0.71143219574521643),
+    FRAC_CONST(0.72000250796138165),
+    FRAC_CONST(0.7284643904482252),
+    FRAC_CONST(0.73681656887736979),
+    FRAC_CONST(0.74505778544146595),
+    FRAC_CONST(0.75318679904361241),
+    FRAC_CONST(0.76120238548426178),
+    FRAC_CONST(0.76910333764557959),
+    FRAC_CONST(0.77688846567323244),
+    FRAC_CONST(0.78455659715557524),
+    FRAC_CONST(0.79210657730021239),
+    FRAC_CONST(0.79953726910790501),
+    FRAC_CONST(0.80684755354379922),
+    FRAC_CONST(0.8140363297059483),
+    FRAC_CONST(0.82110251499110465),
+    FRAC_CONST(0.8280450452577558),
+    FRAC_CONST(0.83486287498638001),
+    FRAC_CONST(0.84155497743689833),
+    FRAC_CONST(0.84812034480329712),
+    FRAC_CONST(0.85455798836540053),
+    FRAC_CONST(0.86086693863776731),
+    FRAC_CONST(0.86704624551569265),
+    FRAC_CONST(0.87309497841829009),
+    FRAC_CONST(0.87901222642863341),
+    FRAC_CONST(0.88479709843093779),
+    FRAC_CONST(0.89044872324475788),
+    FRAC_CONST(0.89596624975618511),
+    FRAC_CONST(0.90134884704602203),
+    FRAC_CONST(0.90659570451491533),
+    FRAC_CONST(0.91170603200542988),
+    FRAC_CONST(0.9166790599210427),
+    FRAC_CONST(0.9215140393420419),
+    FRAC_CONST(0.92621024213831127),
+    FRAC_CONST(0.93076696107898371),
+    FRAC_CONST(0.9351835099389475),
+    FRAC_CONST(0.93945922360218992),
+    FRAC_CONST(0.94359345816196039),
+    FRAC_CONST(0.94758559101774109),
+    FRAC_CONST(0.95143502096900834),
+    FRAC_CONST(0.95514116830577067),
+    FRAC_CONST(0.9587034748958716),
+    FRAC_CONST(0.96212140426904158),
+    FRAC_CONST(0.9653944416976894),
+    FRAC_CONST(0.96852209427441727),
+    FRAC_CONST(0.97150389098625178),
+    FRAC_CONST(0.97433938278557586),
+    FRAC_CONST(0.97702814265775439),
+    FRAC_CONST(0.97956976568544052),
+    FRAC_CONST(0.98196386910955524),
+    FRAC_CONST(0.98421009238692903),
+    FRAC_CONST(0.98630809724459867),
+    FRAC_CONST(0.98825756773074946),
+    FRAC_CONST(0.99005821026229712),
+    FRAC_CONST(0.99170975366909953),
+    FRAC_CONST(0.9932119492347945),
+    FRAC_CONST(0.99456457073425542),
+    FRAC_CONST(0.99576741446765982),
+    FRAC_CONST(0.99682029929116567),
+    FRAC_CONST(0.99772306664419164),
+    FRAC_CONST(0.99847558057329477),
+    FRAC_CONST(0.99907772775264536),
+    FRAC_CONST(0.99952941750109314),
+    FRAC_CONST(0.9998305817958234),
+    FRAC_CONST(0.99998117528260111),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1)
+};
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+real_t ld_mid_480[] =
+{
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0),
+    FRAC_CONST(0.0065449379673518581),
+    FRAC_CONST(0.019633692460628301),
+    FRAC_CONST(0.032719082821776137),
+    FRAC_CONST(0.045798866936520771),
+    FRAC_CONST(0.058870803651189033),
+    FRAC_CONST(0.071932653156719387),
+    FRAC_CONST(0.084982177372441667),
+    FRAC_CONST(0.09801714032956059),
+    FRAC_CONST(0.11103530855427769),
+    FRAC_CONST(0.12403445145048532),
+    FRAC_CONST(0.13701234168196802),
+    FRAC_CONST(0.14996675555404498),
+    FRAC_CONST(0.16289547339458874),
+    FRAC_CONST(0.17579627993435451),
+    FRAC_CONST(0.18866696468655525),
+    FRAC_CONST(0.2015053223256171),
+    FRAC_CONST(0.21430915306505074),
+    FRAC_CONST(0.2270762630343732),
+    FRAC_CONST(0.23980446465501654),
+    FRAC_CONST(0.25249157701515795),
+    FRAC_CONST(0.26513542624340797),
+    FRAC_CONST(0.27773384588129219),
+    FRAC_CONST(0.29028467725446233),
+    FRAC_CONST(0.3027857698425746),
+    FRAC_CONST(0.31523498164776964),
+    FRAC_CONST(0.32763017956169349),
+    FRAC_CONST(0.33996923973099424),
+    FRAC_CONST(0.35225004792123354),
+    FRAC_CONST(0.36447049987914965),
+    FRAC_CONST(0.37662850169321077),
+    FRAC_CONST(0.38872197015239557),
+    FRAC_CONST(0.40074883310314097),
+    FRAC_CONST(0.41270702980439467),
+    FRAC_CONST(0.42459451128071307),
+    FRAC_CONST(0.43640924067334208),
+    FRAC_CONST(0.44814919358922256),
+    FRAC_CONST(0.45981235844785984),
+    FRAC_CONST(0.47139673682599764),
+    FRAC_CONST(0.48290034380003727),
+    FRAC_CONST(0.49432120828614462),
+    FRAC_CONST(0.50565737337798455),
+    FRAC_CONST(0.51690689668202761),
+    FRAC_CONST(0.52806785065036799),
+    FRAC_CONST(0.53913832291100017),
+    FRAC_CONST(0.55011641659549337),
+    FRAC_CONST(0.56100025066400983),
+    FRAC_CONST(0.57178796022761225),
+    FRAC_CONST(0.58247769686780215),
+    FRAC_CONST(0.59306762895323706),
+    FRAC_CONST(0.60355594195357143),
+    FRAC_CONST(0.61394083875036642),
+    FRAC_CONST(0.62422053994501758),
+    FRAC_CONST(0.63439328416364549),
+    FRAC_CONST(0.64445732835889735),
+    FRAC_CONST(0.65441094810861034),
+    FRAC_CONST(0.66425243791128175),
+    FRAC_CONST(0.67398011147829784),
+    FRAC_CONST(0.68359230202287125),
+    FRAC_CONST(0.69308736254563585),
+    FRAC_CONST(0.70246366611685174),
+    FRAC_CONST(0.71171960615517138),
+    FRAC_CONST(0.72085359670291882),
+    FRAC_CONST(0.7298640726978356),
+    FRAC_CONST(0.73874949024124625),
+    FRAC_CONST(0.74750832686259672),
+    FRAC_CONST(0.75613908178032285),
+    FRAC_CONST(0.76464027615900032),
+    FRAC_CONST(0.77301045336273699),
+    FRAC_CONST(0.78124817920475853),
+    FRAC_CONST(0.78935204219315003),
+    FRAC_CONST(0.79732065377270711),
+    FRAC_CONST(0.80515264856285829),
+    FRAC_CONST(0.81284668459161513),
+    FRAC_CONST(0.82040144352551359),
+    FRAC_CONST(0.82781563089550203),
+    FRAC_CONST(0.83508797631874299),
+    FRAC_CONST(0.84221723371628654),
+    FRAC_CONST(0.84920218152657889),
+    FRAC_CONST(0.85604162291477137),
+    FRAC_CONST(0.86273438597779184),
+    FRAC_CONST(0.86927932394514362),
+    FRAC_CONST(0.87567531537539967),
+    FRAC_CONST(0.88192126434835494),
+    FRAC_CONST(0.88801610065280734),
+    FRAC_CONST(0.89395877996993212),
+    FRAC_CONST(0.8997482840522214),
+    FRAC_CONST(0.90538362089795521),
+    FRAC_CONST(0.91086382492117568),
+    FRAC_CONST(0.91618795711713596),
+    FRAC_CONST(0.92135510522319242),
+    FRAC_CONST(0.9263643838751181),
+    FRAC_CONST(0.93121493475880346),
+    FRAC_CONST(0.93590592675732565),
+    FRAC_CONST(0.94043655609335486),
+    FRAC_CONST(0.94480604646687805),
+    FRAC_CONST(0.94901364918821385),
+    FRAC_CONST(0.95305864330629697),
+    FRAC_CONST(0.95694033573220882),
+    FRAC_CONST(0.9606580613579353),
+    FRAC_CONST(0.96421118317032928),
+    FRAC_CONST(0.96759909236025976),
+    FRAC_CONST(0.9708212084269281),
+    FRAC_CONST(0.97387697927733363),
+    FRAC_CONST(0.97676588132087239),
+    FRAC_CONST(0.97948741955905139),
+    FRAC_CONST(0.98204112767030394),
+    FRAC_CONST(0.98442656808989171),
+    FRAC_CONST(0.98664333208487898),
+    FRAC_CONST(0.98869103982416728),
+    FRAC_CONST(0.99056934044357725),
+    FRAC_CONST(0.99227791210596705),
+    FRAC_CONST(0.99381646205637808),
+    FRAC_CONST(0.99518472667219682),
+    FRAC_CONST(0.99638247150832537),
+    FRAC_CONST(0.99740949133735191),
+    FRAC_CONST(0.99826561018471593),
+    FRAC_CONST(0.99895068135886012),
+    FRAC_CONST(0.99946458747636568),
+    FRAC_CONST(0.99980724048206482),
+    FRAC_CONST(0.99997858166412923),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1),
+    FRAC_CONST(1)
+};
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/specrec.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,964 @@
+/*
+** 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.33 2003/11/12 20:47:59 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"
+#include "ms.h"
+#include "is.h"
+#include "pns.h"
+#include "tns.h"
+#include "lt_predict.h"
+#include "ic_predict.h"
+#ifdef SSR_DEC
+#include "ssr.h"
+#include "ssr_fb.h"
+#endif
+
+#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.
+*/
+static void quant_to_spec(ic_stream *ics, real_t *spec_data, uint16_t frame_len)
+{
+    uint8_t g, sfb, win;
+    uint16_t width, bin, k, gindex;
+
+    real_t tmp_spec[1024] = {0};
+
+    k = 0;
+    gindex = 0;
+
+    for (g = 0; g < ics->num_window_groups; g++)
+    {
+        uint16_t j = 0;
+        uint16_t gincrease = 0;
+        uint16_t win_inc = ics->swb_offset[ics->num_swb];
+
+        for (sfb = 0; sfb < ics->num_swb; sfb++)
+        {
+            width = ics->swb_offset[sfb+1] - ics->swb_offset[sfb];
+
+            for (win = 0; win < ics->window_group_length[g]; win++)
+            {
+                for (bin = 0; bin < width; bin += 4)
+                {
+                    tmp_spec[gindex+(win*win_inc)+j+bin+0] = spec_data[k+0];
+                    tmp_spec[gindex+(win*win_inc)+j+bin+1] = spec_data[k+1];
+                    tmp_spec[gindex+(win*win_inc)+j+bin+2] = spec_data[k+2];
+                    tmp_spec[gindex+(win*win_inc)+j+bin+3] = spec_data[k+3];
+                    gincrease += 4;
+                    k += 4;
+                }
+            }
+            j += width;
+        }
+        gindex += gincrease;
+    }
+
+    memcpy(spec_data, tmp_spec, frame_len*sizeof(real_t));
+}
+
+#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)
+{
+#ifdef FIXED_POINT
+    static const real_t errcorr[] = {
+        REAL_CONST(0), REAL_CONST(1.0/8.0), REAL_CONST(2.0/8.0), REAL_CONST(3.0/8.0),
+        REAL_CONST(4.0/8.0),  REAL_CONST(5.0/8.0), REAL_CONST(6.0/8.0), REAL_CONST(7.0/8.0),
+        REAL_CONST(0)
+    };
+    real_t x1, x2;
+    int16_t sgn = 1;
+
+    if (q < 0)
+    {
+        q = -q;
+        sgn = -1;
+    }
+
+    if (q < IQ_TABLE_SIZE)
+        return sgn * tab[q];
+
+    /* linear interpolation */
+    x1 = tab[q>>3];
+    x2 = tab[(q>>3) + 1];
+    return sgn * 16 * (MUL_R(errcorr[q&7],(x2-x1)) + x1);
+#else
+    real_t sgn = REAL_CONST(1.0);
+
+    if (q < 0)
+    {
+        q = -q;
+        sgn = REAL_CONST(-1.0);
+    }
+
+    if (q < IQ_TABLE_SIZE)
+        return sgn * tab[q];
+
+    return sgn * (real_t)pow(q, 4.0/3.0);
+#endif
+}
+
+static void inverse_quantization(real_t *x_invquant, int16_t *x_quant, uint16_t frame_len)
+{
+    int16_t i;
+    real_t *tab = iq_table;
+
+    for(i = 0; i < frame_len; i+=4)
+    {
+        x_invquant[i] = iquant(x_quant[i], tab);
+        x_invquant[i+1] = iquant(x_quant[i+1], tab);
+        x_invquant[i+2] = iquant(x_quant[i+2], tab);
+        x_invquant[i+3] = iquant(x_quant[i+3], tab);
+    }
+}
+
+#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.59460355750136053335874998528024), /* 2^-0.75 */
+    COEF_CONST(0.70710678118654752440084436210485), /* 2^-0.5 */
+    COEF_CONST(0.84089641525371454303112547623321), /* 2^-0.25 */
+    COEF_CONST(1.0),
+    COEF_CONST(1.1892071150027210667174999705605), /* 2^0.25 */
+    COEF_CONST(1.4142135623730950488016887242097), /* 2^0.5 */
+    COEF_CONST(1.6817928305074290860622509524664) /* 2^0.75 */
+};
+#endif
+
+static void apply_scalefactors(faacDecHandle hDecoder, ic_stream *ics,
+                               real_t *x_invquant, uint16_t frame_len)
+{
+    uint8_t g, sfb;
+    uint16_t top;
+#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 nshort*groups doesn't hurt long blocks, because
+           long blocks only have 1 group, so that means 'groups' is
+           always 0 for long blocks
+        */
+        for (sfb = 0; sfb < ics->max_sfb; sfb++)
+        {
+            top = ics->sect_sfb_offset[g][sfb+1];
+
+#ifndef FIXED_POINT
+            scale = get_scale_factor_gain(ics->scale_factors[g][sfb], hDecoder->pow2_table);
+#else
+            exp = (ics->scale_factors[g][sfb] - 100) / 4;
+            frac = (ics->scale_factors[g][sfb] - 100) % 4;
+
+            /* IMDCT pre-scaling */
+            if (hDecoder->object_type == LD)
+            {
+                exp -= 6 /*9*/;
+            } else {
+                if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+                    exp -= 4 /*7*/;
+                else
+                    exp -= 7 /*10*/;
+            }
+#if (REAL_BITS == 16)
+            exp--;
+#endif
+#endif
+
+            /* minimum size of a sf band is 4 and always a multiple of 4 */
+            for ( ; k < top; k += 4)
+            {
+#ifndef FIXED_POINT
+                x_invquant[k+(groups*nshort)]   = x_invquant[k+(groups*nshort)]   * scale;
+                x_invquant[k+(groups*nshort)+1] = x_invquant[k+(groups*nshort)+1] * scale;
+                x_invquant[k+(groups*nshort)+2] = x_invquant[k+(groups*nshort)+2] * scale;
+                x_invquant[k+(groups*nshort)+3] = x_invquant[k+(groups*nshort)+3] * scale;
+#else
+                if (exp < 0)
+                {
+                    x_invquant[k+(groups*nshort)] >>= -exp;
+                    x_invquant[k+(groups*nshort)+1] >>= -exp;
+                    x_invquant[k+(groups*nshort)+2] >>= -exp;
+                    x_invquant[k+(groups*nshort)+3] >>= -exp;
+                } else {
+                    x_invquant[k+(groups*nshort)] <<= exp;
+                    x_invquant[k+(groups*nshort)+1] <<= exp;
+                    x_invquant[k+(groups*nshort)+2] <<= exp;
+                    x_invquant[k+(groups*nshort)+3] <<= exp;
+                }
+
+                if (frac)
+                {
+                    x_invquant[k+(groups*nshort)]   = MUL_C(x_invquant[k+(groups*nshort)],pow2_table[frac + 3]);
+                    x_invquant[k+(groups*nshort)+1] = MUL_C(x_invquant[k+(groups*nshort)+1],pow2_table[frac + 3]);
+                    x_invquant[k+(groups*nshort)+2] = MUL_C(x_invquant[k+(groups*nshort)+2],pow2_table[frac + 3]);
+                    x_invquant[k+(groups*nshort)+3] = MUL_C(x_invquant[k+(groups*nshort)+3],pow2_table[frac + 3]);
+                }
+#endif
+            }
+        }
+        groups += ics->window_group_length[g];
+    }
+}
+
+void reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics,
+                                element *sce, int16_t *spec_data)
+{
+    real_t spec_coef[1024];
+
+    /* inverse quantization */
+    inverse_quantization(spec_coef, spec_data, hDecoder->frameLength);
+
+    /* apply scalefactors */
+    apply_scalefactors(hDecoder, ics, spec_coef, hDecoder->frameLength);
+
+    /* deinterleave short block grouping */
+    if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+        quant_to_spec(ics, spec_coef, hDecoder->frameLength);
+
+
+    /* pns decoding */
+    pns_decode(ics, NULL, spec_coef, NULL, hDecoder->frameLength, 0, hDecoder->object_type);
+
+#ifdef MAIN_DEC
+    /* MAIN object type prediction */
+    if (hDecoder->object_type == MAIN)
+    {
+        /* allocate the state only when needed */
+        if (hDecoder->pred_stat[sce->channel] == NULL)
+        {
+            hDecoder->pred_stat[sce->channel] = (pred_state*)malloc(hDecoder->frameLength * sizeof(pred_state));
+            reset_all_predictors(hDecoder->pred_stat[sce->channel], hDecoder->frameLength);
+        }
+
+        /* intra channel prediction */
+        ic_prediction(ics, spec_coef, hDecoder->pred_stat[sce->channel], hDecoder->frameLength,
+            hDecoder->sf_index);
+
+        /* 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, hDecoder->pred_stat[sce->channel]);
+    }
+#endif
+
+#ifdef LTP_DEC
+    if (is_ltp_ot(hDecoder->object_type))
+    {
+#ifdef LD_DEC
+        if (hDecoder->object_type == LD)
+        {
+            if (ics->ltp.data_present)
+            {
+                if (ics->ltp.lag_update)
+                    hDecoder->ltp_lag[sce->channel] = ics->ltp.lag;
+            }
+            ics->ltp.lag = hDecoder->ltp_lag[sce->channel];
+        }
+#endif
+
+        /* allocate the state only when needed */
+        if (hDecoder->lt_pred_stat[sce->channel] == NULL)
+        {
+            hDecoder->lt_pred_stat[sce->channel] = (int16_t*)malloc(hDecoder->frameLength*4 * sizeof(int16_t));
+            memset(hDecoder->lt_pred_stat[sce->channel], 0, hDecoder->frameLength*4 * sizeof(int16_t));
+        }
+
+        /* long term prediction */
+        lt_prediction(ics, &(ics->ltp), spec_coef, hDecoder->lt_pred_stat[sce->channel], hDecoder->fb,
+            ics->window_shape, hDecoder->window_shape_prev[sce->channel],
+            hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength);
+    }
+#endif
+
+    /* tns decoding */
+    tns_decode_frame(ics, &(ics->tns), hDecoder->sf_index, hDecoder->object_type,
+        spec_coef, hDecoder->frameLength);
+
+    /* drc decoding */
+    if (hDecoder->drc->present)
+    {
+        if (!hDecoder->drc->exclude_mask[sce->channel] || !hDecoder->drc->excluded_chns_present)
+            drc_decode(hDecoder->drc, spec_coef);
+    }
+
+    if (hDecoder->time_out[sce->channel] == NULL)
+    {
+        hDecoder->time_out[sce->channel] = (real_t*)malloc(hDecoder->frameLength*2*sizeof(real_t));
+        memset(hDecoder->time_out[sce->channel], 0, hDecoder->frameLength*2*sizeof(real_t));
+    }
+
+    /* filter bank */
+#ifdef SSR_DEC
+    if (hDecoder->object_type != SSR)
+    {
+#endif
+        ifilter_bank(hDecoder->fb, ics->window_sequence, ics->window_shape,
+            hDecoder->window_shape_prev[sce->channel], spec_coef,
+            hDecoder->time_out[sce->channel], hDecoder->object_type, hDecoder->frameLength);
+#ifdef SSR_DEC
+    } else {
+        if (hDecoder->ssr_overlap[sce->channel] == NULL)
+        {
+            hDecoder->ssr_overlap[sce->channel] = (real_t*)malloc(2*hDecoder->frameLength*sizeof(real_t));
+            memset(hDecoder->ssr_overlap[sce->channel], 0, 2*hDecoder->frameLength*sizeof(real_t));
+        }
+        if (hDecoder->prev_fmd[sce->channel] == NULL)
+        {
+            uint16_t k;
+            hDecoder->prev_fmd[sce->channel] = (real_t*)malloc(2*hDecoder->frameLength*sizeof(real_t));
+            for (k = 0; k < 2*hDecoder->frameLength; k++)
+                hDecoder->prev_fmd[sce->channel][k] = REAL_CONST(-1);
+        }
+
+        ssr_decode(&(ics->ssr), hDecoder->fb, ics->window_sequence, ics->window_shape,
+            hDecoder->window_shape_prev[sce->channel], spec_coef, hDecoder->time_out[sce->channel],
+            hDecoder->ssr_overlap[sce->channel], hDecoder->ipqf_buffer[sce->channel], hDecoder->prev_fmd[sce->channel],
+            hDecoder->frameLength);
+    }
+#endif
+
+    /* save window shape for next frame */
+    hDecoder->window_shape_prev[sce->channel] = ics->window_shape;
+
+#ifdef LTP_DEC
+    if (is_ltp_ot(hDecoder->object_type))
+    {
+        lt_update_state(hDecoder->lt_pred_stat[sce->channel], hDecoder->time_out[sce->channel],
+            hDecoder->time_out[sce->channel]+hDecoder->frameLength, hDecoder->frameLength, hDecoder->object_type);
+    }
+#endif
+}
+
+void reconstruct_channel_pair(faacDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2,
+                              element *cpe, int16_t *spec_data1, int16_t *spec_data2)
+{
+    real_t spec_coef1[1024];
+    real_t spec_coef2[1024];
+
+    /* inverse quantization */
+    inverse_quantization(spec_coef1, spec_data1, hDecoder->frameLength);
+    inverse_quantization(spec_coef2, spec_data2, hDecoder->frameLength);
+
+    /* apply scalefactors */
+    apply_scalefactors(hDecoder, ics1, spec_coef1, hDecoder->frameLength);
+    apply_scalefactors(hDecoder, ics2, spec_coef2, hDecoder->frameLength);
+
+    /* deinterleave short block grouping */
+    if (ics1->window_sequence == EIGHT_SHORT_SEQUENCE)
+        quant_to_spec(ics1, spec_coef1, hDecoder->frameLength);
+    if (ics2->window_sequence == EIGHT_SHORT_SEQUENCE)
+        quant_to_spec(ics2, spec_coef2, hDecoder->frameLength);
+
+
+    /* pns decoding */
+    if (ics1->ms_mask_present)
+    {
+        pns_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength, 1, hDecoder->object_type);
+    } else {
+        pns_decode(ics1, NULL, spec_coef1, NULL, hDecoder->frameLength, 0, hDecoder->object_type);
+        pns_decode(ics2, NULL, spec_coef2, NULL, hDecoder->frameLength, 0, hDecoder->object_type);
+    }
+
+    /* mid/side decoding */
+    ms_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength);
+
+    /* intensity stereo decoding */
+    is_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength);
+
+#ifdef MAIN_DEC
+    /* MAIN object type prediction */
+    if (hDecoder->object_type == MAIN)
+    {
+        /* allocate the state only when needed */
+        if (hDecoder->pred_stat[cpe->channel] == NULL)
+        {
+            hDecoder->pred_stat[cpe->channel] = (pred_state*)malloc(hDecoder->frameLength * sizeof(pred_state));
+            reset_all_predictors(hDecoder->pred_stat[cpe->channel], hDecoder->frameLength);
+        }
+        if (hDecoder->pred_stat[cpe->paired_channel] == NULL)
+        {
+            hDecoder->pred_stat[cpe->paired_channel] = (pred_state*)malloc(hDecoder->frameLength * sizeof(pred_state));
+            reset_all_predictors(hDecoder->pred_stat[cpe->paired_channel], hDecoder->frameLength);
+        }
+
+        /* intra channel prediction */
+        ic_prediction(ics1, spec_coef1, hDecoder->pred_stat[cpe->channel], hDecoder->frameLength,
+            hDecoder->sf_index);
+        ic_prediction(ics2, spec_coef2, hDecoder->pred_stat[cpe->paired_channel], hDecoder->frameLength,
+            hDecoder->sf_index);
+
+        /* In addition, for scalefactor bands coded by perceptual
+           noise substitution the predictors belonging to the
+           corresponding spectral coefficients are reset.
+        */
+        pns_reset_pred_state(ics1, hDecoder->pred_stat[cpe->channel]);
+        pns_reset_pred_state(ics2, hDecoder->pred_stat[cpe->paired_channel]);
+    }
+#endif
+
+#ifdef LTP_DEC
+    if (is_ltp_ot(hDecoder->object_type))
+    {
+        ltp_info *ltp1 = &(ics1->ltp);
+        ltp_info *ltp2 = (cpe->common_window) ? &(ics2->ltp2) : &(ics2->ltp) ;
+#ifdef LD_DEC
+        if (hDecoder->object_type == LD)
+        {
+            if (ltp1->data_present)
+            {
+                if (ltp1->lag_update)
+                    hDecoder->ltp_lag[cpe->channel] = ltp1->lag;
+            }
+            ltp1->lag = hDecoder->ltp_lag[cpe->channel];
+            if (ltp2->data_present)
+            {
+                if (ltp2->lag_update)
+                    hDecoder->ltp_lag[cpe->paired_channel] = ltp2->lag;
+            }
+            ltp2->lag = hDecoder->ltp_lag[cpe->paired_channel];
+        }
+#endif
+
+        /* allocate the state only when needed */
+        if (hDecoder->lt_pred_stat[cpe->channel] == NULL)
+        {
+            hDecoder->lt_pred_stat[cpe->channel] = (int16_t*)malloc(hDecoder->frameLength*4 * sizeof(int16_t));
+            memset(hDecoder->lt_pred_stat[cpe->channel], 0, hDecoder->frameLength*4 * sizeof(int16_t));
+        }
+        if (hDecoder->lt_pred_stat[cpe->paired_channel] == NULL)
+        {
+            hDecoder->lt_pred_stat[cpe->paired_channel] = (int16_t*)malloc(hDecoder->frameLength*4 * sizeof(int16_t));
+            memset(hDecoder->lt_pred_stat[cpe->paired_channel], 0, hDecoder->frameLength*4 * sizeof(int16_t));
+        }
+
+        /* long term prediction */
+        lt_prediction(ics1, ltp1, spec_coef1, hDecoder->lt_pred_stat[cpe->channel], hDecoder->fb,
+            ics1->window_shape, hDecoder->window_shape_prev[cpe->channel],
+            hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength);
+        lt_prediction(ics2, ltp2, spec_coef2, hDecoder->lt_pred_stat[cpe->paired_channel], hDecoder->fb,
+            ics2->window_shape, hDecoder->window_shape_prev[cpe->paired_channel],
+            hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength);
+    }
+#endif
+
+    /* tns decoding */
+    tns_decode_frame(ics1, &(ics1->tns), hDecoder->sf_index, hDecoder->object_type,
+        spec_coef1, hDecoder->frameLength);
+    tns_decode_frame(ics2, &(ics2->tns), hDecoder->sf_index, hDecoder->object_type,
+        spec_coef2, hDecoder->frameLength);
+
+    /* drc decoding */
+    if (hDecoder->drc->present)
+    {
+        if (!hDecoder->drc->exclude_mask[cpe->channel] || !hDecoder->drc->excluded_chns_present)
+            drc_decode(hDecoder->drc, spec_coef1);
+        if (!hDecoder->drc->exclude_mask[cpe->paired_channel] || !hDecoder->drc->excluded_chns_present)
+            drc_decode(hDecoder->drc, spec_coef2);
+    }
+
+    if (hDecoder->time_out[cpe->channel] == NULL)
+    {
+        hDecoder->time_out[cpe->channel] = (real_t*)malloc(hDecoder->frameLength*2*sizeof(real_t));
+        memset(hDecoder->time_out[cpe->channel], 0, hDecoder->frameLength*2*sizeof(real_t));
+    }
+    if (hDecoder->time_out[cpe->paired_channel] == NULL)
+    {
+        hDecoder->time_out[cpe->paired_channel] = (real_t*)malloc(hDecoder->frameLength*2*sizeof(real_t));
+        memset(hDecoder->time_out[cpe->paired_channel], 0, hDecoder->frameLength*2*sizeof(real_t));
+    }
+
+    /* filter bank */
+#ifdef SSR_DEC
+    if (hDecoder->object_type != SSR)
+    {
+#endif
+        ifilter_bank(hDecoder->fb, ics1->window_sequence, ics1->window_shape,
+            hDecoder->window_shape_prev[cpe->channel], spec_coef1,
+            hDecoder->time_out[cpe->channel], hDecoder->object_type, hDecoder->frameLength);
+        ifilter_bank(hDecoder->fb, ics2->window_sequence, ics2->window_shape,
+            hDecoder->window_shape_prev[cpe->paired_channel], spec_coef2,
+            hDecoder->time_out[cpe->paired_channel], hDecoder->object_type, hDecoder->frameLength);
+#ifdef SSR_DEC
+    } else {
+        if (hDecoder->ssr_overlap[cpe->channel] == NULL)
+        {
+            hDecoder->ssr_overlap[cpe->channel] = (real_t*)malloc(2*hDecoder->frameLength*sizeof(real_t));
+            memset(hDecoder->ssr_overlap[cpe->channel], 0, 2*hDecoder->frameLength*sizeof(real_t));
+        }
+        if (hDecoder->ssr_overlap[cpe->paired_channel] == NULL)
+        {
+            hDecoder->ssr_overlap[cpe->paired_channel] = (real_t*)malloc(2*hDecoder->frameLength*sizeof(real_t));
+            memset(hDecoder->ssr_overlap[cpe->paired_channel], 0, 2*hDecoder->frameLength*sizeof(real_t));
+        }
+        if (hDecoder->prev_fmd[cpe->channel] == NULL)
+        {
+            uint16_t k;
+            hDecoder->prev_fmd[cpe->channel] = (real_t*)malloc(2*hDecoder->frameLength*sizeof(real_t));
+            for (k = 0; k < 2*hDecoder->frameLength; k++)
+                hDecoder->prev_fmd[cpe->channel][k] = REAL_CONST(-1);
+        }
+        if (hDecoder->prev_fmd[cpe->paired_channel] == NULL)
+        {
+            uint16_t k;
+            hDecoder->prev_fmd[cpe->paired_channel] = (real_t*)malloc(2*hDecoder->frameLength*sizeof(real_t));
+            for (k = 0; k < 2*hDecoder->frameLength; k++)
+                hDecoder->prev_fmd[cpe->paired_channel][k] = REAL_CONST(-1);
+        }
+
+        ssr_decode(&(ics1->ssr), hDecoder->fb, ics1->window_sequence, ics1->window_shape,
+            hDecoder->window_shape_prev[cpe->channel], spec_coef1, hDecoder->time_out[cpe->channel],
+            hDecoder->ssr_overlap[cpe->channel], hDecoder->ipqf_buffer[cpe->channel],
+            hDecoder->prev_fmd[cpe->channel], hDecoder->frameLength);
+        ssr_decode(&(ics2->ssr), hDecoder->fb, ics2->window_sequence, ics2->window_shape,
+            hDecoder->window_shape_prev[cpe->paired_channel], spec_coef2, hDecoder->time_out[cpe->paired_channel],
+            hDecoder->ssr_overlap[cpe->paired_channel], hDecoder->ipqf_buffer[cpe->paired_channel],
+            hDecoder->prev_fmd[cpe->paired_channel], hDecoder->frameLength);
+    }
+#endif
+
+    /* save window shape for next frame */
+    hDecoder->window_shape_prev[cpe->channel] = ics1->window_shape;
+    hDecoder->window_shape_prev[cpe->paired_channel] = ics2->window_shape;
+
+#ifdef LTP_DEC
+    if (is_ltp_ot(hDecoder->object_type))
+    {
+        lt_update_state(hDecoder->lt_pred_stat[cpe->channel], hDecoder->time_out[cpe->channel],
+            hDecoder->time_out[cpe->channel]+hDecoder->frameLength, hDecoder->frameLength, hDecoder->object_type);
+        lt_update_state(hDecoder->lt_pred_stat[cpe->paired_channel], hDecoder->time_out[cpe->paired_channel],
+            hDecoder->time_out[cpe->paired_channel]+hDecoder->frameLength, hDecoder->frameLength,
+            hDecoder->object_type);
+    }
+#endif
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/specrec.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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: specrec.h,v 1.20 2003/11/12 20:47:59 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);
+static void quant_to_spec(ic_stream *ics, real_t *spec_data, uint16_t frame_len);
+static void inverse_quantization(real_t *x_invquant, int16_t *x_quant, uint16_t frame_len);
+static void apply_scalefactors(faacDecHandle hDecoder, ic_stream *ics, real_t *x_invquant,
+                               uint16_t frame_len);
+#ifndef FIXED_POINT
+void build_tables(real_t *pow2_table);
+#endif
+
+void reconstruct_channel_pair(faacDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2,
+                              element *cpe, int16_t *spec_data1, int16_t *spec_data2);
+void reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics, element *sce,
+                                int16_t *spec_data);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libfaad2/ssr.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,172 @@
+/*
+** 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.10 2003/11/12 20:47:59 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] = {0};
+    real_t output[1024] = {0};
+
+    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, band, 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,
+                            uint8_t band, 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/Input/aac/libfaad2/ssr.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.10 2003/11/12 20:47:59 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/Input/aac/libfaad2/ssr_fb.c	Mon Oct 24 10:44:27 2005 -0700
@@ -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.8 2003/11/12 20:47:59 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/Input/aac/libfaad2/ssr_fb.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,44 @@
+/*
+** FAAD - Freeware Advanced Audio Decoder
+** Copyright (C) 2002 M. Bakker
+**  
+** 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.
+**
+** $Id: ssr_fb.h,v 1.8 2003/11/12 20:47:59 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/Input/aac/libfaad2/ssr_ipqf.c	Mon Oct 24 10:44:27 2005 -0700
@@ -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.9 2003/11/12 20:47:59 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/Input/aac/libfaad2/ssr_ipqf.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,37 @@
+/*
+** FAAD - Freeware Advanced Audio Decoder
+** Copyright (C) 2002 M. Bakker
+**  
+** 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.
+**
+** $Id: ssr_ipqf.h,v 1.9 2003/11/12 20:47:59 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/Input/aac/libfaad2/ssr_win.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,626 @@
+/*
+** FAAD - Freeware Advanced Audio Decoder
+** Copyright (C) 2002 M. Bakker
+**  
+** 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.
+**
+** $Id: ssr_win.h,v 1.8 2003/11/12 20:47:59 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/Input/aac/libfaad2/structs.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,436 @@
+/*
+** 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.21 2003/11/12 20:47:59 menno Exp $
+**/
+
+#ifndef __STRUCTS_H__
+#define __STRUCTS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "cfft.h"
+#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 {
+    int16_t r[2];
+    int16_t COR[2];
+    int16_t VAR[2];
+} pred_state;
+
+typedef struct {
+    uint16_t N;
+    cfft_info *cfft;
+    complex_t *sincos;
+} 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;
+
+    /* control param */
+    uint8_t old_format;
+} adts_header;
+
+typedef struct
+{
+    uint8_t copyright_id_present;
+    int8_t copyright_id[10];
+    uint8_t original_copy;
+    uint8_t home;
+    uint8_t bitstream_type;
+    uint32_t bitrate;
+    uint8_t num_program_config_elements;
+    uint32_t adif_buffer_fullness;
+
+    /* 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]; /* [0..255] */
+
+    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;
+    int8_t forceUpSampling;
+} mp4AudioSpecificConfig;
+
+typedef struct faacDecConfiguration
+{
+    uint8_t defObjectType;
+    uint32_t defSampleRate;
+    uint8_t outputFormat;
+    uint8_t downMatrix;
+    uint8_t useOldADTSFormat;
+} faacDecConfiguration, *faacDecConfigurationPtr;
+
+typedef struct faacDecFrameInfo
+{
+    uint32_t bytesconsumed;
+    uint32_t samples;
+    uint8_t channels;
+    uint8_t error;
+    uint32_t samplerate;
+
+    /* SBR: 0: off, 1: on; normal, 2: on; downsampled */
+    uint8_t sbr;
+
+    /* MPEG-4 ObjectType */
+    uint8_t object_type;
+
+    /* AAC header type; MP4 will be signalled as RAW also */
+    uint8_t header_type;
+
+    /* multichannel configuration */
+    uint8_t num_front_channels;
+    uint8_t num_side_channels;
+    uint8_t num_back_channels;
+    uint8_t num_lfe_channels;
+    uint8_t channel_position[MAX_CHANNELS];
+} faacDecFrameInfo;
+
+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;
+    uint8_t postSeekResetFlag;
+
+    uint32_t frame;
+
+    uint8_t downMatrix;
+    uint8_t first_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;
+    int8_t forceUpSampling;
+
+    real_t *time_out2[MAX_CHANNELS];
+
+    uint8_t sbr_used[32];
+
+    sbr_info *sbr[32];
+#ifdef DRM
+    int8_t lcstereo_flag;
+#endif
+#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
+    int16_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 element_id[MAX_CHANNELS];
+    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/Input/aac/libfaad2/syntax.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,1898 @@
+/*
+** 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.61 2003/11/12 20:47:59 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"));
+#ifndef ALLOW_SMALL_FRAMELENGTH
+    if (mp4ASC->frameLengthFlag == 1)
+        return -3;
+#endif
+
+    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;
+}
+
+void decode_sce_lfe(faacDecHandle hDecoder,
+                    faacDecFrameInfo *hInfo, bitfile *ld,
+                    uint8_t id_syn_ele)
+{
+    uint8_t channels = hDecoder->fr_channels;
+    uint8_t tag = 0;
+
+    if (channels+1 > MAX_CHANNELS)
+    {
+        hInfo->error = 12;
+        return;
+    }
+    if (hDecoder->fr_ch_ele+1 > MAX_SYNTAX_ELEMENTS)
+    {
+        hInfo->error = 13;
+        return;
+    }
+
+    hInfo->error = single_lfe_channel_element(hDecoder, ld, channels, &tag);
+
+    if (hDecoder->pce_set)
+        hDecoder->internal_channel[hDecoder->pce.sce_channel[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->element_id[hDecoder->fr_ch_ele] = id_syn_ele;
+
+    hDecoder->fr_channels++;
+    hDecoder->fr_ch_ele++;
+}
+
+void decode_cpe(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld,
+                uint8_t id_syn_ele)
+{
+    uint8_t channels = hDecoder->fr_channels;
+    uint8_t tag = 0;
+
+    if (channels+2 > MAX_CHANNELS)
+    {
+        hInfo->error = 12;
+        return;
+    }
+    if (hDecoder->fr_ch_ele+1 > MAX_SYNTAX_ELEMENTS)
+    {
+        hInfo->error = 13;
+        return;
+    }
+
+    hInfo->error = channel_pair_element(hDecoder, ld, channels, &tag);
+
+    if (hDecoder->pce_set)
+    {
+        hDecoder->internal_channel[hDecoder->pce.cpe_channel[tag]] = channels;
+        hDecoder->internal_channel[hDecoder->pce.cpe_channel[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->element_id[hDecoder->fr_ch_ele] = id_syn_ele;
+
+    hDecoder->fr_channels += 2;
+    hDecoder->fr_ch_ele++;
+}
+
+void raw_data_block(faacDecHandle hDecoder, faacDecFrameInfo *hInfo,
+                    bitfile *ld, 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;
+                decode_sce_lfe(hDecoder, hInfo, ld, id_syn_ele);
+                ch_ele++;
+                if (hInfo->error > 0)
+                    return;
+                break;
+            case ID_CPE:
+                if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele;
+                decode_cpe(hDecoder, hInfo, ld, id_syn_ele);
+                ch_ele++;
+                if (hInfo->error > 0)
+                    return;
+                break;
+            case ID_LFE:
+                hDecoder->has_lfe++;
+                decode_sce_lfe(hDecoder, hInfo, ld, id_syn_ele);
+                ch_ele++;
+                if (hInfo->error > 0)
+                    return;
+                break;
+            case ID_CCE: /* not implemented yet, but skip the bits */
+#ifdef COUPLING_DEC
+                hInfo->error = coupling_channel_element(hDecoder, ld);
+#else
+                hInfo->error = 6;
+#endif
+                if (hInfo->error > 0)
+                    return;
+                break;
+            case ID_DSE:
+                data_stream_element(hDecoder, ld);
+                break;
+            case ID_PCE:
+                if ((hInfo->error = program_config_element(pce, ld)) > 0)
+                    return;
+                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;
+#ifdef SBR_DEC
+                if (hDecoder->sbr_used[ch_ele-1])
+                {
+                    hDecoder->sbr_present_flag = 1;
+                    hDecoder->sbr[ch_ele-1]->sample_rate = get_sample_rate(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:
+            decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
+            ch_ele++;
+            if (hInfo->error > 0)
+                return;
+            break;
+        case 2:
+            decode_cpe(hDecoder, hInfo, ld, ID_CPE);
+            ch_ele++;
+            if (hInfo->error > 0)
+                return;
+            break;
+        case 3:
+            decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
+            ch_ele++;
+            decode_cpe(hDecoder, hInfo, ld, ID_CPE);
+            ch_ele++;
+            if (hInfo->error > 0)
+                return;
+            break;
+        case 4:
+            decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
+            ch_ele++;
+            decode_cpe(hDecoder, hInfo, ld, ID_CPE);
+            ch_ele++;
+            decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
+            ch_ele++;
+            if (hInfo->error > 0)
+                return;
+            break;
+        case 5:
+            decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
+            ch_ele++;
+            decode_cpe(hDecoder, hInfo, ld, ID_CPE);
+            ch_ele++;
+            decode_cpe(hDecoder, hInfo, ld, ID_CPE);
+            ch_ele++;
+            if (hInfo->error > 0)
+                return;
+            break;
+        case 6:
+            decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
+            ch_ele++;
+            decode_cpe(hDecoder, hInfo, ld, ID_CPE);
+            ch_ele++;
+            decode_cpe(hDecoder, hInfo, ld, ID_CPE);
+            ch_ele++;
+            decode_sce_lfe(hDecoder, hInfo, ld, ID_LFE);
+            ch_ele++;
+            if (hInfo->error > 0)
+                return;
+            break;
+        case 7:
+            decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
+            ch_ele++;
+            decode_cpe(hDecoder, hInfo, ld, ID_CPE);
+            ch_ele++;
+            decode_cpe(hDecoder, hInfo, ld, ID_CPE);
+            ch_ele++;
+            decode_cpe(hDecoder, hInfo, ld, ID_CPE);
+            ch_ele++;
+            decode_sce_lfe(hDecoder, hInfo, ld, ID_LFE);
+            ch_ele++;
+            if (hInfo->error > 0)
+                return;
+            break;
+        default:
+            hInfo->error = 7;
+            return;
+        }
+#if 0
+        cnt = bits_to_decode() / 8;
+        while (cnt >= 1)
+        {
+            cnt -= extension_payload(cnt);
+        }
+#endif
+    }
+#endif
+
+    /* new in corrigendum 14496-3:2002 */
+#ifdef DRM
+    if (hDecoder->object_type != DRM_ER_LC)
+#endif
+    {
+        faad_byte_align(ld);
+    }
+
+    return;
+}
+
+/* Table 4.4.4 and */
+/* Table 4.4.9 */
+static uint8_t single_lfe_channel_element(faacDecHandle hDecoder, bitfile *ld,
+                                          uint8_t channel, uint8_t *tag)
+{
+    uint8_t retval = 0;
+    element sce = {0};
+    ic_stream *ics = &(sce.ics1);
+    int16_t spec_data[1024] = {0};
+#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"));
+
+    *tag = sce.element_instance_tag;
+    sce.channel = channel;
+    sce.paired_channel = -1;
+
+#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, faad_get_processed_bits(ld) - 8 )) > 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 */
+            }
+        }
+    } else
+#endif
+    {
+        retval = individual_channel_stream(hDecoder, &sce, ld, ics, 0, spec_data);
+        if (retval > 0)
+            return retval;
+    }
+
+    /* noiseless coding is done, spectral reconstruction is done now */
+    reconstruct_single_channel(hDecoder, ics, &sce, spec_data);
+
+    return 0;
+}
+
+/* Table 4.4.5 */
+static uint8_t channel_pair_element(faacDecHandle hDecoder, bitfile *ld,
+                                    uint8_t channels, uint8_t *tag)
+{
+    int16_t spec_data1[1024] = {0};
+    int16_t spec_data2[1024] = {0};
+    element cpe = {0};
+    ic_stream *ics1 = &(cpe.ics1);
+    ic_stream *ics2 = &(cpe.ics2);
+    uint8_t result;
+
+    cpe.channel        = channels;
+    cpe.paired_channel = channels+1;
+
+#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"));
+    *tag = cpe.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, faad_get_processed_bits(ld) - 8 )) > 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 */
+            }
+        }
+    }
+#endif
+
+    /* noiseless coding is done, spectral reconstruction is done now */
+    reconstruct_channel_pair(hDecoder, ics1, ics2, &cpe, spec_data1, spec_data2);
+
+    return 0;
+}
+
+/* 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, max_pred_sfb(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;
+}
+
+#ifdef COUPLING_DEC
+/* 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 = {0};
+    ic_stream ics_empty = {0};
+    int16_t sh_data[1024];
+
+    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;
+}
+#endif
+
+/* 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"));
+    }
+
+    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(hDecoder->frameLength
+#ifdef DRM
+                    , 0
+#endif
+                    );
+            }
+
+            /* read in all the SBR data for processing later on */
+            hDecoder->sbr[sbr_ele]->data = (uint8_t*)faad_getbitbuffer(ld, count*8);
+            hDecoder->sbr[sbr_ele]->data_size = count;
+            /* save id of previous element, this sbr object belongs to that element */
+            hDecoder->sbr[sbr_ele]->id_aac = hDecoder->element_id[sbr_ele];
+        } 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 || scale_factor > 255)
+                    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 ((result = huffman_spectral_data(sect_cb, ld, sp)) > 0)
+                        return result;
+                    if (sect_cb >= FIRST_PAIR_HCB)
+                    {
+                        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"));
+
+    if (adts->old_format == 1)
+    {
+        /* 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/Input/aac/libfaad2/syntax.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,163 @@
+/*
+** 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.42 2003/11/12 20:47:59 menno Exp $
+**/
+
+#ifndef __SYNTAX_H__
+#define __SYNTAX_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "decoder.h"
+#include "drc.h"
+#include "bits.h"
+
+#define MAIN       1
+#define LC         2
+#define SSR        3
+#define LTP        4
+#define HE_AAC     5
+#define LD        23
+#define ER_LC     17
+#define ER_LTP    19
+#define DRM_ER_LC 27 /* special object type for DRM */
+
+/* header types */
+#define RAW        0
+#define ADIF       1
+#define ADTS       2
+
+/* SBR signalling */
+#define NO_SBR           0
+#define SBR_UPSAMPLED    1
+#define SBR_DOWNSAMPLED  2
+#define NO_SBR_UPSAMPLED 3
+
+/* DRM channel definitions */
+#define DRMCH_MONO          1
+#define DRMCH_STEREO        2
+#define DRMCH_SBR_MONO      3
+#define DRMCH_SBR_LC_STEREO 4
+#define DRMCH_SBR_STEREO    5
+
+
+/* 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
+
+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);
+void decode_sce_lfe(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld,
+                    uint8_t id_syn_ele);
+void decode_cpe(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld,
+                uint8_t id_syn_ele);
+void raw_data_block(faacDecHandle hDecoder, faacDecFrameInfo *hInfo,
+                    bitfile *ld, program_config *pce, drc_info *drc);
+
+
+/* static functions */
+static uint8_t single_lfe_channel_element(faacDecHandle hDecoder, bitfile *ld,
+                                          uint8_t channel, uint8_t *tag);
+static uint8_t channel_pair_element(faacDecHandle hDecoder, bitfile *ld,
+                                    uint8_t channel, uint8_t *tag);
+#ifdef COUPLING_DEC
+static uint8_t coupling_channel_element(faacDecHandle hDecoder, bitfile *ld);
+#endif
+static uint16_t data_stream_element(faacDecHandle hDecoder, bitfile *ld);
+static uint8_t program_config_element(program_config *pce, bitfile *ld);
+static uint8_t fill_element(faacDecHandle hDecoder, bitfile *ld, drc_info *drc
+#ifdef SBR_DEC
+                            ,uint8_t sbr_ele
+#endif
+                            );
+static uint8_t individual_channel_stream(faacDecHandle hDecoder, element *ele,
+                                         bitfile *ld, ic_stream *ics, uint8_t scal_flag,
+                                         int16_t *spec_data);
+static uint8_t ics_info(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld,
+                        uint8_t common_window);
+static uint8_t section_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld);
+static uint8_t scale_factor_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld);
+static void gain_control_data(bitfile *ld, ic_stream *ics);
+static uint8_t spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld,
+                             int16_t *spectral_data);
+static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count);
+#ifdef ERROR_RESILIENCE
+uint8_t reordered_spectral_data(faacDecHandle hDecoder, ic_stream *ics,
+                                bitfile *ld, int16_t *spectral_data);
+#endif
+static uint8_t pulse_data(ic_stream *ics, pulse_info *pul, bitfile *ld);
+static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld);
+static 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/Input/aac/libfaad2/tns.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,286 @@
+/*
+** 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.27 2003/11/12 20:47:59 menno Exp $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include "syntax.h"
+#include "tns.h"
+
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+static real_t tns_coef_0_3[] =
+{
+    COEF_CONST(0.0), COEF_CONST(0.4338837391), COEF_CONST(0.7818314825), COEF_CONST(0.9749279122),
+    COEF_CONST(-0.9848077530), COEF_CONST(-0.8660254038), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433),
+    COEF_CONST(-0.4338837391), COEF_CONST(-0.7818314825), COEF_CONST(-0.9749279122), COEF_CONST(-0.9749279122),
+    COEF_CONST(-0.9848077530), COEF_CONST(-0.8660254038), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433)
+};
+static real_t tns_coef_0_4[] =
+{
+    COEF_CONST(0.0), COEF_CONST(0.2079116908), COEF_CONST(0.4067366431), COEF_CONST(0.5877852523),
+    COEF_CONST(0.7431448255), COEF_CONST(0.8660254038), COEF_CONST(0.9510565163), COEF_CONST(0.9945218954),
+    COEF_CONST(-0.9957341763), COEF_CONST(-0.9618256432), COEF_CONST(-0.8951632914), COEF_CONST(-0.7980172273),
+    COEF_CONST(-0.6736956436), COEF_CONST(-0.5264321629), COEF_CONST(-0.3612416662), COEF_CONST(-0.1837495178)
+};
+static real_t tns_coef_1_3[] =
+{
+    COEF_CONST(0.0), COEF_CONST(0.4338837391), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433),
+    COEF_CONST(0.9749279122), COEF_CONST(0.7818314825), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433),
+    COEF_CONST(-0.4338837391), COEF_CONST(-0.7818314825), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433),
+    COEF_CONST(-0.7818314825), COEF_CONST(-0.4338837391), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433)
+};
+static real_t tns_coef_1_4[] =
+{
+    COEF_CONST(0.0), COEF_CONST(0.2079116908), COEF_CONST(0.4067366431), COEF_CONST(0.5877852523),
+    COEF_CONST(-0.6736956436), COEF_CONST(-0.5264321629), COEF_CONST(-0.3612416662), COEF_CONST(-0.1837495178),
+    COEF_CONST(0.9945218954), COEF_CONST(0.9510565163), COEF_CONST(0.8660254038), COEF_CONST(0.7431448255),
+    COEF_CONST(-0.6736956436), COEF_CONST(-0.5264321629), COEF_CONST(-0.3612416662), COEF_CONST(-0.1837495178)
+};
+
+
+/* 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;
+    int16_t size;
+    uint16_t bottom, top, start, end;
+    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 = min(bottom, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE)));
+            start = min(start, ics->max_sfb);
+            start = ics->swb_offset[start];
+
+            end = min(top, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE)));
+            end = min(end, ics->max_sfb);
+            end = ics->swb_offset[end];
+
+            size = end - start;
+            if (size <= 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;
+    int16_t size;
+    uint16_t bottom, top, start, end;
+    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 = min(bottom, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE)));
+            start = min(start, ics->max_sfb);
+            start = ics->swb_offset[start];
+
+            end = min(top, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE)));
+            end = min(end, ics->max_sfb);
+            end = ics->swb_offset[end];
+
+            size = end - start;
+            if (size <= 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(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_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_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/Input/aac/libfaad2/tns.h	Mon Oct 24 10:44:27 2005 -0700
@@ -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.14 2003/11/12 20:47:59 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/API_CHANGES	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,99 @@
+Changes from 0.9.6
+---------------------------
+Modified
+  MP4SetHintTrackRtpPayload
+    payload parameter to get a dynamic payload is MP4_SET_DYNAMIC_PAYLOAD
+    (value 0xff) instead of 0.
+
+Changes from 0.9.5 to 0.9.6
+---------------------------
+Modified
+    MP4GetHintTrackRtpPayload
+    MP4SetHintTrackRtpPayload
+       get/set the encoding params (a=rtpmap <payloadname>/<timescale>[/<encoding params>])
+
+Changes from 0.9.4 to 0.9.5
+---------------------------
+Added
+    MP4GetTrackAudioMpeg4Type()
+        Returns MPEG-4 Audio type (e.g. AAC, CELP, HXVC, MIDI, etc.)
+    MP4ReadSampleFromTime()
+        Variant of MP4ReadSample() that uses time instead of sample id
+        (basically MP4GetSampleIdFromTime() + MP4ReadSample())
+    MP4Info()
+    MP4FileInfo()
+        Returns summary info on tracks in file (from util/mp4info.cpp)
+
+    The following functions add support for mp4 authoring/editting:
+
+    MP4CloneTrack()
+        Make a copy of a specified track, without media samples
+    MP4CopyTrack()
+        Make a copy of a specified track, with or without media samples
+    MP4CopySample()
+        Make a copy of a specified media sample
+
+    MP4AddTrackEdit()
+        Add a track edit list element
+    MP4DeleteTrackEdit()
+        Delete a track edit list element
+    MP4GetTrackNumberOfEdits()
+        Return the number of track edit list elements
+    MP4GetTrackEditTotalDuration()
+        Return the total duration of the track edit list
+    MP4GetTrackEditStart()
+        Return the edit start time for the edit list element
+    MP4GetTrackEditMediaStart()
+        Return the media start time for the edit list element
+    MP4SetTrackEditMediaStart()
+        Set the media start time for the edit list element
+    MP4GetTrackEditDuration()
+        Return the edit list element duration
+    MP4SetTrackEditDuration()
+        Set the edit list element duration
+    MP4GetTrackEditDwell()
+        Return the edit list element dwell parameter, see man page
+    MP4SetTrackEditDwell()
+        Set the edit list element dwell parameter, see man page
+    MP4ReadSampleFromEditTime()
+        Apply the edit list timeline to reading a sample
+    MP4GetSampleIdFromEditTime()
+        Return the sample id for a specified time on the edit list timeline
+
+Modified
+    MP4GetSampleIdFromTime()
+        Semantic change - now returns sample id corresponding 
+        to specified time, not the sample id with the smallest positive
+        start time difference from the specified time.
+
+
+Changes from 0.9.3 to 0.9.4
+---------------------------
+Added
+    MP4GetTrackVideoFrameRate()
+        Returns video frame rate (average rate if video is variable rate).
+
+    MP4GetTrackBitRate()
+        Returns track average bit rate in bits-per-second.
+
+Changes from 0.9.2 to 0.9.3
+---------------------------
+Modified
+    MP4Optimize()
+        Second argument, newFileName, can now be NULL in which case
+        a temporary file is created for the results of the optimization.
+        Upon success, the existing file specified with the first argument 
+        is overwritten with the optimized file.
+
+    MP4GetNumberOfTracks()
+    MP4FindTrackId()
+        Both have a new optional argument, subType, with default value 0.
+        The subType can be specified for audio and video tracks to
+        match only a specific encoding type. See man page for more details.
+
+Added
+    MP4GetTrackVideoWidth()
+        Returns video width in pixels. See man page for caveat.
+
+    MP4GetTrackVideoHeight()
+        Returns video height in pixels. See man page for caveat.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/INTERNALS	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,209 @@
+January 7, 2002
+
+MP4V2 LIBRARY INTERNALS
+=======================
+
+This document provides an overview of the internals of the mp4v2 library 
+to aid those who wish to modify and extend it. Before reading this document,
+I recommend familiarizing yourself with the MP4 (or Quicktime) file format 
+standard and the mp4v2 library API. The API is described in a set of man pages
+in mpeg4ip/doc/mp4v2, or if you prefer by looking at mp4.h.
+
+All the library code is written in C++, however the library API follows uses
+C calling conventions hence is linkable by both C and C++ programs. The
+library has been compiled and used on Linux, BSD, Windows, and Mac OS X.
+Other than libc, the library has no external dependencies, and hence can
+be used independently of the mpeg4ip package if desired.  The library is 
+used for both real-time recording and playback in mpeg4ip, and its runtime 
+performance is up to those tasks. On the IA32 architecture compiled with gcc,
+the stripped library is approximately 600 KB code and initialized data.
+
+It is useful to think of the mp4v2 library as consisting of four layers:
+infrastructure, file format, generic tracks, and type specific track helpers.
+A description of each layer follows, from the fundamental to the optional.
+
+
+Infrastructure
+==============
+
+The infrastructure layer provides basic file I/O, memory allocation, 
+error handling, string utilities, and protected arrays. The source files 
+for this layer are mp4file_io, mp4util, and mp4array. 
+
+Note that the array classes uses preprocessor macros instead of C++ 
+templates. The rationale for this is to increase portability given the 
+sometimes incomplete support by some compilers for templates.
+
+
+File Format
+===========
+
+The file format layer provides the translation from the on-disk MP4 file 
+format to in-memory C++ structures and back to disk. It is intended 
+to exactly match the MP4 specification in syntax and semantics. It 
+represents the majority of the code.
+
+There are three key structures at the file format layer: atoms, properties,
+and descriptors. 
+
+Atoms are the primary containers within an mp4 file. They can contain 
+any combination of properties, other atoms, or descriptors.
+
+The mp4atom files contain the base class for all the atoms, and provide 
+generic functions that cover most cases. However, each atom has it's own 
+subclass contained in file atom_<name>.cpp, where <name> is the four 
+letter name of the atom defined in the MP4 specification. Typically this 
+atom file just specifies the properties of the atom or the possible child 
+atoms in the case of a container atom. In more specialized cases the atom 
+specific file provides routines to initialize, read, or write the atom.
+
+Properties are the atomic pieces of information. The basic types of 
+properties are integers, floats, strings, and byte arrays. For integers 
+and floats there are subclasses that represent the different storage sizes,
+e.g. 8, 16, 24, 32, and 64 bit integers. For strings, there is 1 property 
+class with a number of options regarding exact storage details, e.g. null 
+terminated, fixed length, counted. 
+
+For implementation reasons, there are also two special properties, table 
+and descriptor, that are actually containers for groups of properties. 
+I.e by making these containers provide a property interface much code can 
+be written in a generic fashion.
+
+The mp4property files contain all the property related classes. 
+
+Descriptors are containers that derive from the MPEG conventions and use 
+different encoding rules than the atoms derived from the QuickTime file
+format. This means more use of bitfields and conditional existence with 
+an emphasis on bit efficiency at the cost of encoding/decoding complexity.
+Descriptors can contain other descriptors and/or properties.
+
+The mp4descriptor files contain the generic base class for descriptors. 
+Also the mp4property files have a descriptor wrapper class that allows a 
+descriptor to behave as if it were a property. The specific descriptors 
+are implemented as subclasses of the base class descriptor in manner similar 
+to that of atoms. The descriptors, ocidescriptors, and qosqualifiers files 
+contain these implementations.
+
+Each atom/property/descriptor has a name closely related to that in the 
+MP4 specification. The difference being that the mp4v2 library doesn't 
+use '-' or '_' in property names and capitalizes the first letter of each 
+word, e.g. "thisIsAPropertyName". A complete name specifies the complete 
+container path.  The names follow the C/C++ syntax for elements and array 
+indices. 
+
+Examples are:
+	"moov.mvhd.duration"
+	"moov.trak[2].tkhd.duration"
+	"moov.trak[3].minf.mdia.stbl.stsz[101].sampleSize"
+
+Note "*" can be used as a wildcard for an atom name (only). This is most 
+useful when dealing with the stsd atom which contains child atoms with 
+various names, but shared property names.
+
+Note that internally when performance matters the code looks up a property
+by name once, and then stores the returned pointer to the property class.
+
+
+Generic Tracks
+==============
+
+The two entities at this level are the mp4 file as a whole and the tracks 
+which are contained with it. The mp4file and mp4track files contain the 
+implementation.
+
+The critical work done by this layer is to map the collection of atoms,
+properties, and descriptors that represent a media track into a useful,
+and consistent set of operations. For example, reading or writing a media 
+sample of a track is a relatively simple operation from the library API
+perspective. However there are numerous pieces of information in the mp4
+file that need to be properly used and updated to do this. This layer
+handles all those details.
+
+Given familiarity with the mp4 spec, the code should be straight-forward.
+What may not be immediately obvious are the functions to handle chunks of
+media samples. These exist to allow optimization of the mp4 file layout by
+reordering the chunks on disk to interleave the media sample chunks of
+multiple tracks in time order. (See MP4Optimize API doc).
+
+
+Type Specific Track Helpers 
+===========================
+
+This specialized code goes beyond the meta-information about tracks in
+the mp4 file to understanding and manipulating the information in the
+track samples. There are currently two helpers in the library: 
+the MPEG-4 Systems Helper, and the RTP Hint Track Helper.
+ 
+The MPEG-4 Systems Helper is currently limited to creating the OD, BIFS,
+and SDP information about a minimal audio/video scene consistent with
+the Internet Streaming Media Alliance (ISMA) specifications. We will be
+evaluating how best to generalize the library's helper functions for
+MPEG-4 Systems without overburdening the implementation. The code for 
+this helper is found in the isma and odcommands files.
+
+The RTP Hint Track Helper is more extensive in its support. The hint 
+tracks contain the track packetization information needed to build 
+RTP packets for streaming. The library can construct RTP packets based 
+on the hint track making RTP based servers significantly easier to write.
+
+All code related to rtp hint tracks is in the rtphint files. It would also
+be useful to look at test/mp4broadcaster and mpeg4ip/server/mp4creator for
+examples of how this part of the library API can be used.
+
+
+Library API
+===========
+
+The library API is defined and implemented in the mp4 files. The API uses
+C linkage conventions, and the mp4.h file adapts itself according to whether
+C or C++ is the compilation mode.
+
+All API calls are implemented in mp4.cpp and basically pass thru's to the
+MP4File member functions. This ensures that the library has internal access
+to the same functions as available via the API. All the calls in mp4.cpp use
+C++ try/catch blocks to protect against any runtime errors in the library.
+Upon error the library will print a diagnostic message if the verbostiy level
+has MP4_DETAILS_ERROR set, and return a distinguished error value, typically
+0 or -1.
+
+The test and util subdirectories contain useful examples of how to
+use the library. Also the mp4creator and mp4live programs within
+mpeg4ip demonstrate more complete usage of the library API.
+
+
+Debugging
+=========
+
+Since mp4 files are fairly complicated, extensive debugging support is
+built into the library. Multi-level diagnostic messages are available 
+under the control of a verbosity bitmask described in the API.
+
+Also the library provides the MP4Dump() call which provides an ASCII
+version of the mp4 file meta-information. The mp4dump utilitity is a
+wrapper executable around this function.
+
+The mp4extract program is also provided in the utilities directory
+which is useful for extracting a track from an mp4file and putting the
+media data back into it's own file. It can also extract each sample of
+a track into its own file it that is desired.
+
+When all else fails, mp4 files are amenable to debugging by direct
+examination. Since the atom names are four letter ASCII codes finding
+reference points in a hex dump is feasible. On UNIX, the od command
+is your friend: "od -t x1z -A x [-j 0xXXXXXX] foo.mp4" will print
+a hex and ASCII dump, with hex addresses, starting optionally from
+a specified offset. The library diagnostic messages can provide
+information on where the library is reading or writing.
+
+
+General caveats
+===============
+	
+The coding convention is to use the C++ throw operator whenever an 
+unrecoverable error occurs. This throw is caught at the API layer 
+in mp4.cpp and translated into an error value. 
+
+Be careful about indices. Internally, we follow the C/C++ convention 
+to use zero-based indices. However the MP4 spec uses one-based indices 
+for things like samples and hence the library API uses this convention.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/Makefile.am	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,109 @@
+INCLUDES = -I$(top_srcdir)/include
+noinst_LTLIBRARIES = libmp4v2.la
+libmp4v2_la_SOURCES = \
+	atom_co64.cpp \
+	atom_cprt.cpp \
+	atom_ctts.cpp \
+	atom_dimm.cpp \
+	atom_dinf.cpp \
+	atom_dmax.cpp \
+	atom_dmed.cpp \
+	atom_dref.cpp \
+	atom_drep.cpp \
+	atom_edts.cpp \
+	atom_elst.cpp \
+	atom_esds.cpp \
+	atom_free.cpp \
+	atom_ftyp.cpp \
+	atom_hdlr.cpp \
+	atom_hinf.cpp \
+	atom_hmhd.cpp \
+	atom_hnti.cpp \
+	atom_iods.cpp \
+	atom_maxr.cpp \
+	atom_mdat.cpp \
+	atom_mdhd.cpp \
+	atom_mdia.cpp \
+	atom_mfhd.cpp \
+	atom_minf.cpp \
+	atom_moof.cpp \
+	atom_moov.cpp \
+	atom_mp4a.cpp \
+	atom_mp4s.cpp \
+	atom_mp4v.cpp \
+	atom_mvex.cpp \
+	atom_mvhd.cpp \
+	atom_nmhd.cpp \
+	atom_nump.cpp \
+	atom_payt.cpp \
+	atom_pmax.cpp \
+	atom_root.cpp \
+	atom_rtp.cpp \
+	atom_sdp.cpp \
+	atoms.h \
+	atom_smhd.cpp \
+	atom_snro.cpp \
+	atom_stbl.cpp \
+	atom_stco.cpp \
+	atom_stdp.cpp \
+	atom_stsc.cpp \
+	atom_stsd.cpp \
+	atom_stsh.cpp \
+	atom_stss.cpp \
+	atom_stsz.cpp \
+	atom_stts.cpp \
+	atom_tfhd.cpp \
+	atom_tims.cpp \
+	atom_tkhd.cpp \
+	atom_tmax.cpp \
+	atom_tmin.cpp \
+	atom_tpyl.cpp \
+	atom_traf.cpp \
+	atom_trak.cpp \
+	atom_tref.cpp \
+	atom_treftype.cpp \
+	atom_trex.cpp \
+	atom_trpy.cpp \
+	atom_trun.cpp \
+	atom_tsro.cpp \
+	atom_udta.cpp \
+	atom_url.cpp \
+	atom_urn.cpp \
+	atom_vmhd.cpp \
+	descriptors.cpp \
+	descriptors.h \
+	isma.cpp \
+	mp4array.h \
+	mp4atom.cpp \
+	mp4atom.h \
+	mp4common.h \
+	mp4container.cpp \
+	mp4container.h \
+	mp4.h \
+	mp4.cpp \
+	mp4descriptor.cpp \
+	mp4descriptor.h \
+	mp4file.cpp \
+	mp4file.h \
+	mp4file_io.cpp \
+	mp4info.cpp \
+	mp4property.cpp \
+	mp4property.h \
+	mp4track.cpp \
+	mp4track.h \
+	mp4util.cpp \
+	mp4util.h \
+	ocidescriptors.cpp \
+	ocidescriptors.h \
+	odcommands.cpp \
+	odcommands.h \
+	qosqualifiers.cpp \
+	qosqualifiers.h \
+	rtphint.cpp \
+	rtphint.h 
+
+EXTRA_DIST = API_CHANGES \
+	INTERNALS \
+	libmp4v260.dsp \
+	libmp4v2_st60.dsp \
+	TODO
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/README	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,30 @@
+July 18, 2002
+
+MP4V2 Library
+=============
+
+This library provides functions to read, create, and modify mp4 files.
+
+The detailed documentation of the library is available as a set of man pages 
+in mpeg4ip/doc/mp4v2. The MP4.3 man page gives an overview of the library.
+
+Alternately mp4.h in this directory specifies the complete API.
+
+The file INTERNALS provides an overview of what is happening behind the API. 
+Note that although we using C++ object oriented features internally, that's 
+all hidden behind a flat C style API (with C linkage conventions).
+
+The test and util subdirectories contain some simple programs that use 
+this library.
+
+To use this library in your application, it should be sufficient to:
+
+1) add mpeg4ip/include and mpeg4ip/lib/mp4v2 to your INCLUDE path,
+	e.g. gcc -Impeg4ip/include -Impeg4ip/lib/mp4v2 ...
+
+2) add mpeg4ip/lib/mp4v2/libmp4v2.la (or /usr/local/lib/libmp4v2.la)
+	e.g. gcc ... -o foo foo.cpp mpeg4ip/lib/mp4v2/libmp4v2.a
+
+3) include mp4.h into your code,
+	e.g. #include <mp4.h>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/TODO	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,9 @@
+
+Add ability to create samples referenced in multiple tracks
+
+Add ability to create atoms/properties via set or add operations
+
+Exploit extended format (ISO v2)
+
+List all possible atoms/properties with types
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_co64.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,38 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4Co64Atom::MP4Co64Atom() 
+	: MP4Atom("co64") 
+{
+	AddVersionAndFlags();
+
+	MP4Integer32Property* pCount = 
+		new MP4Integer32Property("entryCount"); 
+	AddProperty(pCount);
+
+	MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
+	AddProperty(pTable);
+
+	pTable->AddProperty(
+		new MP4Integer64Property("chunkOffset"));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_cprt.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,32 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4CprtAtom::MP4CprtAtom() 
+	: MP4Atom("cprt") 
+{
+	AddVersionAndFlags();
+	AddProperty(
+		new MP4Integer16Property("language"));
+	AddProperty(
+		new MP4StringProperty("notice"));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_ctts.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,40 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4CttsAtom::MP4CttsAtom() 
+	: MP4Atom("ctts") 
+{
+	AddVersionAndFlags();
+
+	MP4Integer32Property* pCount = 
+		new MP4Integer32Property("entryCount"); 
+	AddProperty(pCount);
+
+	MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
+	AddProperty(pTable);
+
+	pTable->AddProperty(
+		new MP4Integer32Property("sampleCount"));
+	pTable->AddProperty(
+		new MP4Integer32Property("sampleOffset"));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_dimm.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,29 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4DimmAtom::MP4DimmAtom() 
+	: MP4Atom("dimm") 
+{
+	AddProperty( // bytes of immediate data
+		new MP4Integer64Property("bytes"));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_dinf.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,28 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4DinfAtom::MP4DinfAtom() 
+	: MP4Atom("dinf") 
+{
+	ExpectChildAtom("dref", Required, OnlyOne);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_dmax.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,29 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4DmaxAtom::MP4DmaxAtom() 
+	: MP4Atom("dmax")
+{
+	AddProperty( // max packet duration 
+		new MP4Integer32Property("milliSecs"));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_dmed.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,29 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4DmedAtom::MP4DmedAtom() 
+	: MP4Atom("dmed") 
+{
+	AddProperty( // bytes sent from media data
+		new MP4Integer64Property("bytes"));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_dref.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,56 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4DrefAtom::MP4DrefAtom() 
+	: MP4Atom("dref") 
+{
+	AddVersionAndFlags();
+
+	MP4Integer32Property* pCount = 
+		new MP4Integer32Property("entryCount"); 
+	pCount->SetReadOnly();
+	AddProperty(pCount);
+
+	ExpectChildAtom("url ", Optional, Many);
+	ExpectChildAtom("urn ", Optional, Many);
+}
+
+void MP4DrefAtom::Read() 
+{
+	/* do the usual read */
+	MP4Atom::Read();
+
+	// check that number of children == entryCount
+	MP4Integer32Property* pCount = 
+		(MP4Integer32Property*)m_pProperties[2];
+
+	if (m_pChildAtoms.Size() != pCount->GetValue()) {
+		VERBOSE_READ(GetVerbosity(),
+			MP4Printf("Warning: dref inconsistency with number of entries"));
+
+		/* fix it */
+		pCount->SetReadOnly(false);
+		pCount->SetValue(m_pChildAtoms.Size());
+		pCount->SetReadOnly(true);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_drep.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,29 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4DrepAtom::MP4DrepAtom() 
+	: MP4Atom("drep") 
+{
+	AddProperty( // bytes of repeated data
+		new MP4Integer64Property("bytes"));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_edts.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,28 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4EdtsAtom::MP4EdtsAtom() 
+	: MP4Atom("edts") 
+{ 
+	ExpectChildAtom("elst", Required, OnlyOne);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_elst.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,80 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4ElstAtom::MP4ElstAtom() 
+	: MP4Atom("elst") 
+{ 
+	AddVersionAndFlags();
+
+	MP4Integer32Property* pCount = 
+		new MP4Integer32Property("entryCount"); 
+	AddProperty(pCount);
+
+	MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
+	AddProperty(pTable);
+}
+
+void MP4ElstAtom::AddProperties(u_int8_t version) 
+{
+	MP4TableProperty* pTable = (MP4TableProperty*)m_pProperties[3];
+
+	if (version == 1) {
+		pTable->AddProperty(
+			new MP4Integer64Property("segmentDuration"));
+		pTable->AddProperty(
+			new MP4Integer64Property("mediaTime"));
+	} else {
+		pTable->AddProperty(
+			new MP4Integer32Property("segmentDuration"));
+		pTable->AddProperty(
+			new MP4Integer32Property("mediaTime"));
+	}
+
+	pTable->AddProperty(
+		new MP4Integer16Property("mediaRate"));
+	pTable->AddProperty(
+		new MP4Integer16Property("reserved"));
+}
+
+void MP4ElstAtom::Generate() 
+{
+	SetVersion(0);
+	AddProperties(GetVersion());
+
+	MP4Atom::Generate();
+}
+
+void MP4ElstAtom::Read() 
+{
+	/* read atom version */
+	ReadProperties(0, 1);
+
+	/* need to create the properties based on the atom version */
+	AddProperties(GetVersion());
+
+	/* now we can read the remaining properties */
+	ReadProperties(1);
+
+	Skip();	// to end of atom
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_esds.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,31 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4EsdsAtom::MP4EsdsAtom() 
+	: MP4Atom("esds") 
+{
+	AddVersionAndFlags();
+	AddProperty(
+		new MP4DescriptorProperty(NULL, 
+			MP4ESDescrTag, 0, Required, OnlyOne));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_free.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,43 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4FreeAtom::MP4FreeAtom() 
+	: MP4Atom("free") 
+{
+}
+
+void MP4FreeAtom::Read() 
+{
+	Skip();
+}
+
+void MP4FreeAtom::Write() 
+{
+	ASSERT(m_pFile);
+
+	bool use64 = (GetSize() > (0xFFFFFFFF - 8)); 
+	BeginWrite(use64);
+	m_pFile->SetPosition(m_pFile->GetPosition() + GetSize());
+	FinishWrite(use64);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_ftyp.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,69 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4FtypAtom::MP4FtypAtom() 
+	: MP4Atom("ftyp")
+{
+	MP4StringProperty* pProp = new MP4StringProperty("majorBrand");
+	pProp->SetFixedLength(4);
+	AddProperty(pProp); /* 0 */
+
+	AddProperty( /* 1 */
+		new MP4Integer32Property("minorVersion"));
+
+	MP4Integer32Property* pCount = 
+		new MP4Integer32Property("compatibleBrandsCount"); 
+	pCount->SetImplicit();
+	AddProperty(pCount); /* 2 */
+
+	MP4TableProperty* pTable = 
+		new MP4TableProperty("compatibleBrands", pCount);
+	AddProperty(pTable); /* 3 */
+
+	pProp = new MP4StringProperty("brand");
+	pProp->SetFixedLength(4);
+	pTable->AddProperty(pProp);
+}
+
+void MP4FtypAtom::Generate() 
+{
+	MP4Atom::Generate();
+
+	((MP4StringProperty*)m_pProperties[0])->SetValue("isom");
+
+	MP4StringProperty* pBrandProperty = (MP4StringProperty*)
+		((MP4TableProperty*)m_pProperties[3])->GetProperty(0);
+	ASSERT(pBrandProperty);
+	pBrandProperty->AddValue("mp41");
+	((MP4Integer32Property*)m_pProperties[2])->IncrementValue();
+}
+
+void MP4FtypAtom::Read() 
+{
+	// table entry count computed from atom size
+	((MP4Integer32Property*)m_pProperties[2])->SetReadOnly(false);
+	((MP4Integer32Property*)m_pProperties[2])->SetValue((m_size - 8) / 4);
+	((MP4Integer32Property*)m_pProperties[2])->SetReadOnly(true);
+
+	MP4Atom::Read();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_hdlr.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,64 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4HdlrAtom::MP4HdlrAtom() 
+	: MP4Atom("hdlr")
+{
+	AddVersionAndFlags(); /* 0, 1 */
+	AddReserved("reserved1", 4); /* 2 */
+	MP4StringProperty* pProp = new MP4StringProperty("handlerType");
+	pProp->SetFixedLength(4);
+	AddProperty(pProp); /* 3 */
+	AddReserved("reserved2", 12); /* 4 */
+	AddProperty( /* 5 */
+		new MP4StringProperty("name"));
+}
+
+// There is a spec incompatiblity between QT and MP4
+// QT says name field is a counted string
+// MP4 says name field is a null terminated string
+// Here we attempt to make all things work
+void MP4HdlrAtom::Read() 
+{
+	// read all the properties but the "name" field
+	ReadProperties(0, 5);
+
+	// take a peek at the next byte
+	u_int8_t strLength;
+	m_pFile->PeekBytes(&strLength, 1);
+
+	// if the value matches the remaining atom length
+	if (m_pFile->GetPosition() + strLength + 1 == GetEnd()) {
+		// read a counted string
+		MP4StringProperty* pNameProp = 
+			(MP4StringProperty*)m_pProperties[5];
+		pNameProp->SetCountedFormat(true);
+		ReadProperties(5);
+		pNameProp->SetCountedFormat(false);
+	} else {
+		// read a null terminated string
+		ReadProperties(5);
+	}
+
+	Skip();	// to end of atom
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_hinf.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,57 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4HinfAtom::MP4HinfAtom() 
+	: MP4Atom("hinf")
+{
+	ExpectChildAtom("trpy", Optional, OnlyOne);
+	ExpectChildAtom("nump", Optional, OnlyOne);
+	ExpectChildAtom("tpyl", Optional, OnlyOne);
+	ExpectChildAtom("maxr", Optional, Many);
+	ExpectChildAtom("dmed", Optional, OnlyOne);
+	ExpectChildAtom("dimm", Optional, OnlyOne);
+	ExpectChildAtom("drep", Optional, OnlyOne);
+	ExpectChildAtom("tmin", Optional, OnlyOne);
+	ExpectChildAtom("tmax", Optional, OnlyOne);
+	ExpectChildAtom("pmax", Optional, OnlyOne);
+	ExpectChildAtom("dmax", Optional, OnlyOne);
+	ExpectChildAtom("payt", Optional, OnlyOne);
+}
+
+void MP4HinfAtom::Generate()
+{
+	// hinf is special in that although all it's child atoms
+	// are optional (on read), if we generate it for writing
+	// we really want all the children
+
+	for (u_int32_t i = 0; i < m_pChildAtomInfos.Size(); i++) {
+		MP4Atom* pChildAtom = 
+			CreateAtom(m_pChildAtomInfos[i]->m_name);
+
+		AddChildAtom(pChildAtom);
+
+		// and ask it to self generate
+		pChildAtom->Generate();
+	}
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_hmhd.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,39 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4HmhdAtom::MP4HmhdAtom() 
+	: MP4Atom("hmhd")
+{
+	AddVersionAndFlags();
+
+	AddProperty(	
+		new MP4Integer16Property("maxPduSize")); 
+	AddProperty(	
+		new MP4Integer16Property("avgPduSize")); 
+	AddProperty(	
+		new MP4Integer32Property("maxBitRate")); 
+	AddProperty(	
+		new MP4Integer32Property("avgBitRate")); 
+	AddProperty(	
+		new MP4Integer32Property("slidingAvgBitRate")); 
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_hnti.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,40 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4HntiAtom::MP4HntiAtom() 
+	: MP4Atom("hnti") 
+{
+}
+
+void MP4HntiAtom::Read() 
+{
+	MP4Atom* grandParent = m_pParentAtom->GetParentAtom();
+	ASSERT(grandParent);
+	if (ATOMID(grandParent->GetType()) == ATOMID("trak")) {
+		ExpectChildAtom("sdp ", Optional, OnlyOne);
+	} else {
+		ExpectChildAtom("rtp ", Optional, OnlyOne);
+	}
+
+	MP4Atom::Read();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_iods.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,31 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4IodsAtom::MP4IodsAtom() 
+	: MP4Atom("iods") 
+{
+	AddVersionAndFlags();
+	AddProperty(
+		new MP4DescriptorProperty(NULL, 
+			MP4FileIODescrTag, MP4FileODescrTag, Required, OnlyOne));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_maxr.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,31 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4MaxrAtom::MP4MaxrAtom() 
+	: MP4Atom("maxr") 
+{
+	AddProperty(
+		new MP4Integer32Property("granularity"));
+	AddProperty(
+		new MP4Integer32Property("bytes"));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_mdat.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,38 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4MdatAtom::MP4MdatAtom() 
+	: MP4Atom("mdat") 
+{
+}
+
+void MP4MdatAtom::Read()
+{
+	Skip();
+}
+
+void MP4MdatAtom::Write()
+{
+	// should never get here
+	ASSERT(false);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_mdhd.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,91 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4MdhdAtom::MP4MdhdAtom() 
+	: MP4Atom("mdhd") 
+{
+	AddVersionAndFlags();
+}
+
+void MP4MdhdAtom::AddProperties(u_int8_t version) 
+{
+	if (version == 1) {
+		AddProperty(
+			new MP4Integer64Property("creationTime"));
+		AddProperty(
+			new MP4Integer64Property("modificationTime"));
+	} else {
+		AddProperty(
+			new MP4Integer32Property("creationTime"));
+		AddProperty(
+			new MP4Integer32Property("modificationTime"));
+	}
+
+	AddProperty(
+		new MP4Integer32Property("timeScale"));
+
+	if (version == 1) {
+		AddProperty(
+			new MP4Integer64Property("duration"));
+	} else {
+		AddProperty(
+			new MP4Integer32Property("duration"));
+	}
+
+	AddProperty(
+		new MP4Integer16Property("language"));
+	AddReserved("reserved", 2);
+}
+
+void MP4MdhdAtom::Generate() 
+{
+	u_int8_t version = m_pFile->Use64Bits() ? 1 : 0;
+	SetVersion(version);
+	AddProperties(version);
+
+	MP4Atom::Generate();
+
+	// set creation and modification times
+	MP4Timestamp now = MP4GetAbsTimestamp();
+	if (version == 1) {
+		((MP4Integer64Property*)m_pProperties[2])->SetValue(now);
+		((MP4Integer64Property*)m_pProperties[3])->SetValue(now);
+	} else {
+		((MP4Integer32Property*)m_pProperties[2])->SetValue(now);
+		((MP4Integer32Property*)m_pProperties[3])->SetValue(now);
+	}
+}
+
+void MP4MdhdAtom::Read() 
+{
+	/* read atom version */
+	ReadProperties(0, 1);
+
+	/* need to create the properties based on the atom version */
+	AddProperties(GetVersion());
+
+	/* now we can read the remaining properties */
+	ReadProperties(1);
+
+	Skip();	// to end of atom
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_mdia.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,30 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4MdiaAtom::MP4MdiaAtom() 
+	: MP4Atom("mdia") 
+{
+	ExpectChildAtom("mdhd", Required, OnlyOne);
+	ExpectChildAtom("hdlr", Required, OnlyOne);
+	ExpectChildAtom("minf", Required, OnlyOne);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_mfhd.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,31 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4MfhdAtom::MP4MfhdAtom() 
+	: MP4Atom("mfhd")
+{
+	AddVersionAndFlags();	/* 0, 1 */
+	AddProperty( /* 2 */
+		new MP4Integer32Property("sequenceNumber"));
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_minf.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,33 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4MinfAtom::MP4MinfAtom() 
+	: MP4Atom("minf") 
+{
+	ExpectChildAtom("vmhd", Optional, OnlyOne);
+	ExpectChildAtom("smhd", Optional, OnlyOne);
+	ExpectChildAtom("hmhd", Optional, OnlyOne);
+	ExpectChildAtom("nmhd", Optional, OnlyOne);
+	ExpectChildAtom("dinf", Required, OnlyOne);
+	ExpectChildAtom("stbl", Required, OnlyOne);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_moof.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,30 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4MoofAtom::MP4MoofAtom() 
+	: MP4Atom("moof")
+{
+	ExpectChildAtom("mfhd", Required, OnlyOne);
+	ExpectChildAtom("traf", Optional, Many);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_moov.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,33 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4MoovAtom::MP4MoovAtom() 
+	: MP4Atom("moov")
+{
+	ExpectChildAtom("mvhd", Required, OnlyOne);
+	ExpectChildAtom("iods", Required, OnlyOne);
+	ExpectChildAtom("trak", Required, Many);
+	ExpectChildAtom("udta", Optional, Many);
+	ExpectChildAtom("mvex", Optional, OnlyOne);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_mp4a.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,59 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4Mp4aAtom::MP4Mp4aAtom() 
+	: MP4Atom("mp4a") 
+{
+	AddReserved("reserved1", 6); /* 0 */
+
+	AddProperty( /* 1 */
+		new MP4Integer16Property("dataReferenceIndex"));
+
+	AddReserved("reserved2", 16); /* 2 */
+
+	AddProperty( /* 3 */
+		new MP4Integer16Property("timeScale"));
+
+	AddReserved("reserved3", 2); /* 4 */
+
+	ExpectChildAtom("esds", Required, OnlyOne);
+}
+
+void MP4Mp4aAtom::Generate()
+{
+	MP4Atom::Generate();
+
+	((MP4Integer16Property*)m_pProperties[1])->SetValue(1);
+
+	// property reserved2 has non-zero fixed values
+	static u_int8_t reserved2[16] = {
+		0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x02, 0x00, 0x10,
+		0x00, 0x00, 0x00, 0x00, 
+	};
+	m_pProperties[2]->SetReadOnly(false);
+	((MP4BytesProperty*)m_pProperties[2])->
+		SetValue(reserved2, sizeof(reserved2));
+	m_pProperties[2]->SetReadOnly(true);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_mp4s.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,40 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4Mp4sAtom::MP4Mp4sAtom() 
+	: MP4Atom("mp4s") 
+{
+	AddReserved("reserved1", 6);
+	AddProperty(
+		new MP4Integer16Property("dataReferenceIndex"));
+
+	ExpectChildAtom("esds", Required, OnlyOne);
+}
+
+void MP4Mp4sAtom::Generate()
+{
+	MP4Atom::Generate();
+
+	((MP4Integer16Property*)m_pProperties[1])->SetValue(1);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_mp4v.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,79 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4Mp4vAtom::MP4Mp4vAtom() 
+	: MP4Atom("mp4v")
+{
+	AddReserved("reserved1", 6); /* 0 */
+
+	AddProperty( /* 1 */
+		new MP4Integer16Property("dataReferenceIndex"));
+
+	AddReserved("reserved2", 16); /* 2 */
+
+	AddProperty( /* 3 */
+		new MP4Integer16Property("width"));
+	AddProperty( /* 4 */
+		new MP4Integer16Property("height"));
+
+	AddReserved("reserved3", 14); /* 5 */
+
+	MP4StringProperty* pProp = 
+		new MP4StringProperty("compressorName");
+	pProp->SetFixedLength(32);
+	pProp->SetValue("");
+	AddProperty(pProp); /* 6 */
+
+	AddReserved("reserved4", 4); /* 7 */
+
+	ExpectChildAtom("esds", Required, OnlyOne);
+}
+
+void MP4Mp4vAtom::Generate()
+{
+	MP4Atom::Generate();
+
+	((MP4Integer16Property*)m_pProperties[1])->SetValue(1);
+
+	// property reserved3 has non-zero fixed values
+	static u_int8_t reserved3[14] = {
+		0x00, 0x48, 0x00, 0x00, 
+		0x00, 0x48, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x01,
+	};
+	m_pProperties[5]->SetReadOnly(false);
+	((MP4BytesProperty*)m_pProperties[5])->
+		SetValue(reserved3, sizeof(reserved3));
+	m_pProperties[5]->SetReadOnly(true);
+
+	// property reserved4 has non-zero fixed values
+	static u_int8_t reserved4[4] = {
+		0x00, 0x18, 0xFF, 0xFF, 
+	};
+	m_pProperties[7]->SetReadOnly(false);
+	((MP4BytesProperty*)m_pProperties[7])->
+		SetValue(reserved4, sizeof(reserved4));
+	m_pProperties[7]->SetReadOnly(true);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_mvex.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,28 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4MvexAtom::MP4MvexAtom() 
+	: MP4Atom("mvex")
+{
+	ExpectChildAtom("trex", Required, Many);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_mvhd.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,136 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4MvhdAtom::MP4MvhdAtom() 
+	: MP4Atom("mvhd")
+{
+	AddVersionAndFlags();
+}
+
+void MP4MvhdAtom::AddProperties(u_int8_t version) 
+{
+	if (version == 1) {
+		AddProperty( /* 2 */
+			new MP4Integer64Property("creationTime"));
+		AddProperty( /* 3 */
+			new MP4Integer64Property("modificationTime"));
+	} else {
+		AddProperty( /* 2 */
+			new MP4Integer32Property("creationTime"));
+		AddProperty( /* 3 */
+			new MP4Integer32Property("modificationTime"));
+	}
+
+	AddProperty( /* 4 */
+		new MP4Integer32Property("timeScale"));
+
+	if (version == 1) {
+		AddProperty( /* 5 */
+			new MP4Integer64Property("duration"));
+	} else {
+		AddProperty( /* 5 */
+			new MP4Integer32Property("duration"));
+	}
+
+	MP4Float32Property* pProp;
+
+	pProp = new MP4Float32Property("rate");
+	pProp->SetFixed32Format();
+	AddProperty(pProp); /* 6 */
+
+	pProp = new MP4Float32Property("volume");
+	pProp->SetFixed16Format();
+	AddProperty(pProp); /* 7 */
+
+	AddReserved("reserved1", 70); /* 8 */
+
+	AddProperty( /* 9 */
+		new MP4Integer32Property("nextTrackId"));
+}
+
+void MP4MvhdAtom::Generate() 
+{
+	u_int8_t version = m_pFile->Use64Bits() ? 1 : 0;
+	SetVersion(version);
+	AddProperties(version);
+
+	MP4Atom::Generate();
+
+	// set creation and modification times
+	MP4Timestamp now = MP4GetAbsTimestamp();
+	if (version == 1) {
+		((MP4Integer64Property*)m_pProperties[2])->SetValue(now);
+		((MP4Integer64Property*)m_pProperties[3])->SetValue(now);
+	} else {
+		((MP4Integer32Property*)m_pProperties[2])->SetValue(now);
+		((MP4Integer32Property*)m_pProperties[3])->SetValue(now);
+	}
+
+	((MP4Integer32Property*)m_pProperties[4])->SetValue(1000);
+
+	((MP4Float32Property*)m_pProperties[6])->SetValue(1.0);
+	((MP4Float32Property*)m_pProperties[7])->SetValue(1.0);
+
+	// property reserved has non-zero fixed values
+	static u_int8_t reserved[70] = {
+		0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x01, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x01, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 
+		0x40, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 
+	};
+	m_pProperties[8]->SetReadOnly(false);
+	((MP4BytesProperty*)m_pProperties[8])->
+		SetValue(reserved, sizeof(reserved));
+	m_pProperties[8]->SetReadOnly(true);
+
+	// set next track id
+	((MP4Integer32Property*)m_pProperties[9])->SetValue(1);
+}
+
+void MP4MvhdAtom::Read() 
+{
+	/* read atom version */
+	ReadProperties(0, 1);
+
+	/* need to create the properties based on the atom version */
+	AddProperties(GetVersion());
+
+	/* now we can read the remaining properties */
+	ReadProperties(1);
+
+	Skip();	// to end of atom
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_nmhd.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,28 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4NmhdAtom::MP4NmhdAtom() 
+	: MP4Atom("nmhd") 
+{
+	AddVersionAndFlags();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_nump.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,29 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4NumpAtom::MP4NumpAtom() 
+	: MP4Atom("nump") 
+{
+	AddProperty( // packets sent
+		new MP4Integer64Property("packets"));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_payt.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,31 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4PaytAtom::MP4PaytAtom() 
+	: MP4Atom("payt")
+{
+	AddProperty( 
+		new MP4Integer32Property("payloadNumber"));
+	AddProperty( 
+		new MP4StringProperty("rtpMap", Counted));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_pmax.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,29 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4PmaxAtom::MP4PmaxAtom() 
+	: MP4Atom("pmax") 
+{
+	AddProperty( // max packet size 
+		new MP4Integer32Property("bytes"));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_root.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,123 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4RootAtom::MP4RootAtom() 
+	: MP4Atom(NULL)
+{
+	ExpectChildAtom("ftyp", Required, OnlyOne);
+	ExpectChildAtom("moov", Required, OnlyOne);
+	ExpectChildAtom("mdat", Optional, Many);
+	ExpectChildAtom("free", Optional, Many);
+	ExpectChildAtom("skip", Optional, Many);
+	ExpectChildAtom("udta", Optional, Many);
+	ExpectChildAtom("moof", Optional, Many);
+}
+
+void MP4RootAtom::BeginWrite(bool use64) 
+{
+	// only call under MP4Create() control
+	WriteAtomType("ftyp", OnlyOne);
+
+	m_pChildAtoms[GetLastMdatIndex()]->BeginWrite(m_pFile->Use64Bits());
+}
+
+void MP4RootAtom::Write()
+{
+	// no-op
+}
+
+void MP4RootAtom::FinishWrite(bool use64)
+{
+	// finish writing last mdat atom
+	u_int32_t mdatIndex = GetLastMdatIndex();
+	m_pChildAtoms[mdatIndex]->FinishWrite(m_pFile->Use64Bits());
+
+	// write all atoms after last mdat
+	u_int32_t size = m_pChildAtoms.Size();
+	for (u_int32_t i = mdatIndex + 1; i < size; i++) {
+		m_pChildAtoms[i]->Write();
+	}
+}
+
+void MP4RootAtom::BeginOptimalWrite() 
+{
+	WriteAtomType("ftyp", OnlyOne);
+	WriteAtomType("moov", OnlyOne);
+	WriteAtomType("udta", Many);
+
+	m_pChildAtoms[GetLastMdatIndex()]->BeginWrite(m_pFile->Use64Bits());
+}
+
+void MP4RootAtom::FinishOptimalWrite() 
+{
+	// finish writing mdat
+	m_pChildAtoms[GetLastMdatIndex()]->FinishWrite(m_pFile->Use64Bits());
+
+	// find moov atom
+	u_int32_t size = m_pChildAtoms.Size();
+	MP4Atom* pMoovAtom = NULL;
+
+	u_int32_t i;
+	for (i = 0; i < size; i++) {
+		if (!strcmp("moov", m_pChildAtoms[i]->GetType())) {
+			pMoovAtom = m_pChildAtoms[i];
+			break;
+		}
+	}
+	ASSERT(i < size);
+
+	// rewrite moov so that updated chunkOffsets are written to disk
+	m_pFile->SetPosition(pMoovAtom->GetStart());
+	u_int64_t oldSize = pMoovAtom->GetSize();
+
+	pMoovAtom->Write();
+
+	// sanity check
+	u_int64_t newSize = pMoovAtom->GetSize();
+	ASSERT(oldSize == newSize);
+}
+
+u_int32_t MP4RootAtom::GetLastMdatIndex()
+{
+	for (int32_t i = m_pChildAtoms.Size() - 1; i >= 0; i--) {
+		if (!strcmp("mdat", m_pChildAtoms[i]->GetType())) {
+			return i;
+		}
+	}
+	ASSERT(false);
+	return (u_int32_t)-1;
+}
+
+void MP4RootAtom::WriteAtomType(const char* type, bool onlyOne)
+{
+	u_int32_t size = m_pChildAtoms.Size();
+
+	for (u_int32_t i = 0; i < size; i++) {
+		if (!strcmp(type, m_pChildAtoms[i]->GetType())) {
+			m_pChildAtoms[i]->Write();
+			if (onlyOne) {
+				break;
+			}
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_rtp.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,147 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4RtpAtom::MP4RtpAtom() 
+	: MP4Atom("rtp ")
+{
+	// The atom type "rtp " is used in two complete unrelated ways
+	// i.e. it's real two atoms with the same name
+	// To handle that we need to postpone property creation until
+	// we know who our parent atom is (stsd or hnti) which gives us
+	// the context info we need to know who we are
+}
+
+void MP4RtpAtom::AddPropertiesStsdType()
+{
+	AddReserved("reserved1", 6); /* 0 */
+
+	AddProperty( /* 1 */
+		new MP4Integer16Property("dataReferenceIndex"));
+
+	AddProperty( /* 2 */
+		new MP4Integer16Property("hintTrackVersion"));
+	AddProperty( /* 3 */
+		new MP4Integer16Property("highestCompatibleVersion"));
+	AddProperty( /* 4 */
+		new MP4Integer32Property("maxPacketSize"));
+
+	ExpectChildAtom("tims", Required, OnlyOne);
+	ExpectChildAtom("tsro", Optional, OnlyOne);
+	ExpectChildAtom("snro", Optional, OnlyOne);
+}
+
+void MP4RtpAtom::AddPropertiesHntiType()
+{
+	MP4StringProperty* pProp =
+		new MP4StringProperty("descriptionFormat");
+	pProp->SetFixedLength(4);
+	AddProperty(pProp); /* 0 */
+
+	AddProperty( /* 1 */
+		new MP4StringProperty("sdpText"));
+}
+
+void MP4RtpAtom::Generate() 
+{
+	if (!strcmp(m_pParentAtom->GetType(), "stsd")) {
+		AddPropertiesStsdType();
+		GenerateStsdType();
+	} else if (!strcmp(m_pParentAtom->GetType(), "hnti")) {
+		AddPropertiesHntiType();
+		GenerateHntiType();
+	} else {
+		VERBOSE_WARNING(m_pFile->GetVerbosity(),
+			printf("Warning: rtp atom in unexpected context, can not generate"));
+	}
+}
+
+void MP4RtpAtom::GenerateStsdType() 
+{
+	// generate children
+	MP4Atom::Generate();
+
+	((MP4Integer16Property*)m_pProperties[1])->SetValue(1);
+	((MP4Integer16Property*)m_pProperties[2])->SetValue(1);
+	((MP4Integer16Property*)m_pProperties[3])->SetValue(1);
+}
+
+void MP4RtpAtom::GenerateHntiType() 
+{
+	MP4Atom::Generate();
+
+	((MP4StringProperty*)m_pProperties[0])->SetValue("sdp ");
+}
+
+void MP4RtpAtom::Read()
+{
+	if (!strcmp(m_pParentAtom->GetType(), "stsd")) {
+		AddPropertiesStsdType();
+		ReadStsdType();
+	} else if (!strcmp(m_pParentAtom->GetType(), "hnti")) {
+		AddPropertiesHntiType();
+		ReadHntiType();
+	} else {
+		VERBOSE_READ(m_pFile->GetVerbosity(),
+			printf("rtp atom in unexpected context, can not read"));
+	}
+
+	Skip(); // to end of atom
+}
+
+void MP4RtpAtom::ReadStsdType()
+{
+	MP4Atom::Read();
+}
+
+void MP4RtpAtom::ReadHntiType() 
+{
+	ReadProperties(0, 1);
+
+	// read sdp string, length is implicit in size of atom
+	u_int64_t size = GetEnd() - m_pFile->GetPosition();
+	char* data = (char*)MP4Malloc(size + 1);
+	m_pFile->ReadBytes((u_int8_t*)data, size);
+	data[size] = '\0';
+	((MP4StringProperty*)m_pProperties[1])->SetValue(data);
+	MP4Free(data);
+}
+
+void MP4RtpAtom::Write()
+{
+	if (!strcmp(m_pParentAtom->GetType(), "hnti")) {
+		WriteHntiType();
+	} else {
+		MP4Atom::Write();
+	}
+}
+
+void MP4RtpAtom::WriteHntiType()
+{
+	// since length of string is implicit in size of atom
+	// we need to handle this specially, and not write the terminating \0
+	MP4StringProperty* pSdp = (MP4StringProperty*)m_pProperties[1];
+	pSdp->SetFixedLength(strlen(pSdp->GetValue()));
+	MP4Atom::Write();
+	pSdp->SetFixedLength(0);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_sdp.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,53 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4SdpAtom::MP4SdpAtom() : MP4Atom("sdp ") 
+{
+	AddProperty(
+		new MP4StringProperty("sdpText"));
+}
+
+void MP4SdpAtom::Read() 
+{
+	// read sdp string, length is implicit in size of atom 
+	u_int64_t size = GetEnd() - m_pFile->GetPosition();
+	char* data = (char*)MP4Malloc(size + 1);
+	m_pFile->ReadBytes((u_int8_t*)data, size);
+	data[size] = '\0';
+	((MP4StringProperty*)m_pProperties[0])->SetValue(data);
+	MP4Free(data);
+}
+
+void MP4SdpAtom::Write()
+{
+	// since length of string is implicit in size of atom
+	// we need to handle this specially, and not write the terminating \0
+	MP4StringProperty* pSdp = (MP4StringProperty*)m_pProperties[0];
+	const char* sdpText = pSdp->GetValue();
+	if (sdpText) {
+		pSdp->SetFixedLength(strlen(sdpText));
+	}
+	MP4Atom::Write();
+	pSdp->SetFixedLength(0);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_smhd.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,29 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4SmhdAtom::MP4SmhdAtom() 
+	: MP4Atom("smhd")
+{
+	AddVersionAndFlags();
+	AddReserved("reserved", 4);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_snro.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,30 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4SnroAtom::MP4SnroAtom() 
+	: MP4Atom("snro") 
+{
+	AddProperty( 
+		new MP4Integer32Property("offset"));
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_stbl.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,57 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4StblAtom::MP4StblAtom() 
+	: MP4Atom("stbl") 
+{
+	ExpectChildAtom("stsd", Required, OnlyOne);
+	ExpectChildAtom("stts", Required, OnlyOne);
+	ExpectChildAtom("ctts", Optional, OnlyOne);
+	ExpectChildAtom("stsz", Required, OnlyOne);
+	ExpectChildAtom("stsc", Required, OnlyOne);
+	ExpectChildAtom("stco", Optional, OnlyOne);
+	ExpectChildAtom("co64", Optional, OnlyOne);
+	ExpectChildAtom("stss", Optional, OnlyOne);
+	ExpectChildAtom("stsh", Optional, OnlyOne);
+	ExpectChildAtom("stdp", Optional, OnlyOne);
+}
+
+void MP4StblAtom::Generate()
+{
+	// as usual
+	MP4Atom::Generate();
+
+	// but we also need one of the chunk offset atoms
+	MP4Atom* pChunkOffsetAtom;
+	if (m_pFile->Use64Bits()) {
+		pChunkOffsetAtom = CreateAtom("co64");
+	} else {
+		pChunkOffsetAtom = CreateAtom("stco");
+	}
+
+	AddChildAtom(pChunkOffsetAtom);
+
+	// and ask it to self generate
+	pChunkOffsetAtom->Generate();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_stco.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,38 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4StcoAtom::MP4StcoAtom() 
+	: MP4Atom("stco") 
+{
+	AddVersionAndFlags();
+
+	MP4Integer32Property* pCount = 
+		new MP4Integer32Property("entryCount"); 
+	AddProperty(pCount);
+
+	MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
+	AddProperty(pTable);
+
+	pTable->AddProperty(
+		new MP4Integer32Property("chunkOffset"));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_stdp.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,49 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4StdpAtom::MP4StdpAtom() 
+	: MP4Atom("stdp") 
+{
+	AddVersionAndFlags();
+
+	MP4Integer32Property* pCount = 
+		new MP4Integer32Property("entryCount"); 
+	pCount->SetImplicit();
+	AddProperty(pCount);
+
+	MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
+	AddProperty(pTable);
+
+	pTable->AddProperty(
+		new MP4Integer16Property("priority"));
+}
+
+void MP4StdpAtom::Read() 
+{
+	// table entry count computed from atom size
+	((MP4Integer32Property*)m_pProperties[2])->SetReadOnly(false);
+	((MP4Integer32Property*)m_pProperties[2])->SetValue((m_size - 4) / 2);
+	((MP4Integer32Property*)m_pProperties[2])->SetReadOnly(true);
+
+	MP4Atom::Read();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_stsc.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,78 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4StscAtom::MP4StscAtom() 
+	: MP4Atom("stsc")
+{
+	AddVersionAndFlags();
+
+	MP4Integer32Property* pCount = 
+		new MP4Integer32Property("entryCount"); 
+	AddProperty(pCount);
+
+	MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
+	AddProperty(pTable);
+
+	pTable->AddProperty(
+		new MP4Integer32Property("firstChunk"));
+	pTable->AddProperty(
+		new MP4Integer32Property("samplesPerChunk"));
+	pTable->AddProperty(
+		new MP4Integer32Property("sampleDescriptionIndex"));
+
+	// As an optimization we add an implicit property to this table,
+	// "firstSample" that corresponds to the first sample of the firstChunk
+	MP4Integer32Property* pSample =
+		new MP4Integer32Property("firstSample");
+	pSample->SetImplicit();
+	pTable->AddProperty(pSample);
+}
+
+void MP4StscAtom::Read() 
+{
+	// Read as usual
+	MP4Atom::Read();
+
+	// Compute the firstSample values for later use
+	u_int32_t count = 
+		((MP4Integer32Property*)m_pProperties[2])->GetValue();
+
+	MP4Integer32Property* pFirstChunk = (MP4Integer32Property*)
+		((MP4TableProperty*)m_pProperties[3])->GetProperty(0);
+	MP4Integer32Property* pSamplesPerChunk = (MP4Integer32Property*)
+		((MP4TableProperty*)m_pProperties[3])->GetProperty(1);
+	MP4Integer32Property* pFirstSample = (MP4Integer32Property*)
+		((MP4TableProperty*)m_pProperties[3])->GetProperty(3);
+
+	MP4SampleId sampleId = 1;
+
+	for (u_int32_t i = 0; i < count; i++) {
+		pFirstSample->SetValue(sampleId, i);
+
+		if (i < count - 1) {
+			sampleId +=
+				(pFirstChunk->GetValue(i+1) - pFirstChunk->GetValue(i))
+				 * pSamplesPerChunk->GetValue(i);
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_stsd.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,58 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4StsdAtom::MP4StsdAtom() 
+	: MP4Atom("stsd") 
+{
+	AddVersionAndFlags();
+
+	MP4Integer32Property* pCount = 
+		new MP4Integer32Property("entryCount"); 
+	pCount->SetReadOnly();
+	AddProperty(pCount);
+
+	ExpectChildAtom("mp4a", Optional, Many);
+	ExpectChildAtom("mp4s", Optional, Many);
+	ExpectChildAtom("mp4v", Optional, Many);
+	ExpectChildAtom("rtp ", Optional, Many);
+}
+
+void MP4StsdAtom::Read() 
+{
+	/* do the usual read */
+	MP4Atom::Read();
+
+	// check that number of children == entryCount
+	MP4Integer32Property* pCount = 
+		(MP4Integer32Property*)m_pProperties[2];
+
+	if (m_pChildAtoms.Size() != pCount->GetValue()) {
+		VERBOSE_READ(GetVerbosity(),
+			printf("Warning: stsd inconsistency with number of entries"));
+
+		/* fix it */
+		pCount->SetReadOnly(false);
+		pCount->SetValue(m_pChildAtoms.Size());
+		pCount->SetReadOnly(true);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_stsh.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,40 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4StshAtom::MP4StshAtom() 
+	: MP4Atom("stsh") 
+{
+	AddVersionAndFlags();
+
+	MP4Integer32Property* pCount = 
+		new MP4Integer32Property("entryCount"); 
+	AddProperty(pCount);
+
+	MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
+	AddProperty(pTable);
+
+	pTable->AddProperty(
+		new MP4Integer32Property("shadowedSampleNumber"));
+	pTable->AddProperty(
+		new MP4Integer32Property("syncSampleNumber"));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_stss.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,38 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4StssAtom::MP4StssAtom() 
+	: MP4Atom("stss") 
+{
+	AddVersionAndFlags();
+
+	MP4Integer32Property* pCount = 
+		new MP4Integer32Property("entryCount"); 
+	AddProperty(pCount);
+
+	MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
+	AddProperty(pTable);
+
+	pTable->AddProperty(
+		new MP4Integer32Property("sampleNumber"));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_stsz.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,69 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4StszAtom::MP4StszAtom() 
+	: MP4Atom("stsz") 
+{
+	AddVersionAndFlags(); /* 0, 1 */
+
+	AddProperty( /* 2 */
+		new MP4Integer32Property("sampleSize")); 
+
+	MP4Integer32Property* pCount = 
+		new MP4Integer32Property("sampleCount"); 
+	AddProperty(pCount); /* 3 */
+
+	MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
+	AddProperty(pTable); /* 4 */
+
+	pTable->AddProperty( /* 4/0 */
+		new MP4Integer32Property("sampleSize"));
+}
+
+void MP4StszAtom::Read() 
+{
+	ReadProperties(0, 4);
+
+	u_int32_t sampleSize = 
+		((MP4Integer32Property*)m_pProperties[2])->GetValue();
+
+	// only attempt to read entries table if sampleSize is zero
+	// i.e sample size is not constant
+	m_pProperties[4]->SetImplicit(sampleSize != 0);
+
+	ReadProperties(4);
+
+	Skip();	// to end of atom
+}
+
+void MP4StszAtom::Write() 
+{
+	u_int32_t sampleSize = 
+		((MP4Integer32Property*)m_pProperties[2])->GetValue();
+
+	// only attempt to write entries table if sampleSize is zero
+	// i.e sample size is not constant
+	m_pProperties[4]->SetImplicit(sampleSize != 0);
+
+	MP4Atom::Write();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_stts.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,40 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4SttsAtom::MP4SttsAtom() 
+	: MP4Atom("stts") 
+{
+	AddVersionAndFlags();
+
+	MP4Integer32Property* pCount = 
+		new MP4Integer32Property("entryCount"); 
+	AddProperty(pCount);
+
+	MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
+	AddProperty(pTable);
+
+	pTable->AddProperty(
+		new MP4Integer32Property("sampleCount"));
+	pTable->AddProperty(
+		new MP4Integer32Property("sampleDelta"));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_tfhd.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,69 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4TfhdAtom::MP4TfhdAtom() 
+	: MP4Atom("tfhd")
+{
+	AddVersionAndFlags();	/* 0, 1 */
+	AddProperty( /* 2 */
+		new MP4Integer32Property("trackId"));
+}
+
+void MP4TfhdAtom::AddProperties(u_int32_t flags)
+{
+	if (flags & 0x01) {
+		// note this property is signed 64!
+		AddProperty(
+			new MP4Integer64Property("baseDataOffset"));
+	}
+	if (flags & 0x02) {
+		AddProperty(
+			new MP4Integer32Property("sampleDescriptionIndex"));
+	}
+	if (flags & 0x08) {
+		AddProperty(
+			new MP4Integer32Property("defaultSampleDuration"));
+	}
+	if (flags & 0x10) {
+		AddProperty(
+			new MP4Integer32Property("defaultSampleSize"));
+	}
+	if (flags & 0x20) {
+		AddProperty(
+			new MP4Integer32Property("defaultSampleFlags"));
+	}
+}
+
+void MP4TfhdAtom::Read()
+{
+	/* read atom version, flags, and trackId */
+	ReadProperties(0, 3);
+
+	/* need to create the properties based on the atom flags */
+	AddProperties(GetFlags());
+
+	/* now we can read the remaining properties */
+	ReadProperties(3);
+
+	Skip();	// to end of atom
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_tims.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,30 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4TimsAtom::MP4TimsAtom() 
+	: MP4Atom("tims") 
+{
+	AddProperty( 
+		new MP4Integer32Property("timeScale"));
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_tkhd.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,124 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4TkhdAtom::MP4TkhdAtom() 
+	: MP4Atom("tkhd")
+{
+	AddVersionAndFlags();
+}
+
+void MP4TkhdAtom::AddProperties(u_int8_t version) 
+{
+	if (version == 1) {
+		AddProperty( /* 2 */
+			new MP4Integer64Property("creationTime"));
+		AddProperty( /* 3 */
+			new MP4Integer64Property("modificationTime"));
+	} else { // version == 0
+		AddProperty( /* 2 */
+			new MP4Integer32Property("creationTime"));
+		AddProperty( /* 3 */
+			new MP4Integer32Property("modificationTime"));
+	}
+
+	AddProperty( /* 4 */
+		new MP4Integer32Property("trackId"));
+	AddReserved("reserved1", 4); /* 5 */
+
+	if (version == 1) {
+		AddProperty( /* 6 */
+			new MP4Integer64Property("duration"));
+	} else {
+		AddProperty( /* 6 */
+			new MP4Integer32Property("duration"));
+	}
+
+	AddReserved("reserved2", 12); /* 7 */
+
+	MP4Float32Property* pProp;
+
+	pProp = new MP4Float32Property("volume");
+	pProp->SetFixed16Format();
+	AddProperty(pProp); /* 8 */
+
+	AddReserved("reserved3", 38); /* 9 */
+
+	pProp = new MP4Float32Property("width");
+	pProp->SetFixed32Format();
+	AddProperty(pProp); /* 10 */
+
+	pProp = new MP4Float32Property("height");
+	pProp->SetFixed32Format();
+	AddProperty(pProp); /* 11 */
+}
+
+void MP4TkhdAtom::Generate() 
+{
+	u_int8_t version = m_pFile->Use64Bits() ? 1 : 0;
+	SetVersion(version);
+	AddProperties(version);
+
+	MP4Atom::Generate();
+
+	// set creation and modification times
+	MP4Timestamp now = MP4GetAbsTimestamp();
+	if (version == 1) {
+		((MP4Integer64Property*)m_pProperties[2])->SetValue(now);
+		((MP4Integer64Property*)m_pProperties[3])->SetValue(now);
+	} else {
+		((MP4Integer32Property*)m_pProperties[2])->SetValue(now);
+		((MP4Integer32Property*)m_pProperties[3])->SetValue(now);
+	}
+
+	// property reserved3 has non-zero fixed values
+	static u_int8_t reserved3[38] = {
+		0x00, 0x00, 
+		0x00, 0x01, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x01, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 
+		0x40, 0x00, 0x00, 0x00, 
+	};
+	m_pProperties[9]->SetReadOnly(false);
+	((MP4BytesProperty*)m_pProperties[9])->
+		SetValue(reserved3, sizeof(reserved3));
+	m_pProperties[9]->SetReadOnly(true);
+}
+
+void MP4TkhdAtom::Read() 
+{
+	/* read atom version */
+	ReadProperties(0, 1);
+
+	/* need to create the properties based on the atom version */
+	AddProperties(GetVersion());
+
+	/* now we can read the remaining properties */
+	ReadProperties(1);
+
+	Skip();	// to end of atom
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_tmax.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,29 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4TmaxAtom::MP4TmaxAtom() 
+	: MP4Atom("tmax") 
+{
+	AddProperty( // max relative xmit time
+		new MP4Integer32Property("milliSecs"));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_tmin.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,29 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4TminAtom::MP4TminAtom() 
+	: MP4Atom("tmin") 
+{
+	AddProperty( // min relative xmit time
+		new MP4Integer32Property("milliSecs"));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_tpyl.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,29 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4TpylAtom::MP4TpylAtom() 
+	: MP4Atom("tpyl") 
+{
+	AddProperty( // bytes sent of RTP payload data
+		new MP4Integer64Property("bytes"));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_traf.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,30 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4TrafAtom::MP4TrafAtom() 
+	: MP4Atom("traf")
+{
+	ExpectChildAtom("tfhd", Required, OnlyOne);
+	ExpectChildAtom("trun", Optional, Many);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_trak.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,32 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4TrakAtom::MP4TrakAtom() 
+	: MP4Atom("trak") 
+{
+	ExpectChildAtom("tkhd", Required, OnlyOne);
+	ExpectChildAtom("tref", Optional, OnlyOne);
+	ExpectChildAtom("edts", Optional, OnlyOne);
+	ExpectChildAtom("mdia", Required, OnlyOne);
+	ExpectChildAtom("udta", Optional, Many);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_tref.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,32 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4TrefAtom::MP4TrefAtom() 
+	: MP4Atom("tref")
+{
+	ExpectChildAtom("dpnd", Optional, OnlyOne);
+	ExpectChildAtom("hint", Optional, OnlyOne);
+	ExpectChildAtom("ipir", Optional, OnlyOne);
+	ExpectChildAtom("mpod", Optional, OnlyOne);
+	ExpectChildAtom("sync", Optional, OnlyOne);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_treftype.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,47 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4TrefTypeAtom::MP4TrefTypeAtom(const char* type) 
+	: MP4Atom(type) 
+{
+	MP4Integer32Property* pCount = 
+		new MP4Integer32Property("entryCount"); 
+	pCount->SetImplicit();
+	AddProperty(pCount); /* 0 */
+
+	MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
+	AddProperty(pTable); /* 1 */
+
+	pTable->AddProperty( /* 1, 0 */
+		new MP4Integer32Property("trackId"));
+}
+
+void MP4TrefTypeAtom::Read() 
+{
+	// table entry count computed from atom size
+	((MP4Integer32Property*)m_pProperties[0])->SetReadOnly(false);
+	((MP4Integer32Property*)m_pProperties[0])->SetValue(m_size / 4);
+	((MP4Integer32Property*)m_pProperties[0])->SetReadOnly(true);
+
+	MP4Atom::Read();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_trex.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,39 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4TrexAtom::MP4TrexAtom() 
+	: MP4Atom("trex")
+{
+	AddVersionAndFlags();	/* 0, 1 */
+	AddProperty( /* 2 */
+		new MP4Integer32Property("trackId"));
+	AddProperty( /* 3 */
+		new MP4Integer32Property("defaultSampleDesriptionIndex"));
+	AddProperty( /* 4 */
+		new MP4Integer32Property("defaultSampleDuration"));
+	AddProperty( /* 5 */
+		new MP4Integer32Property("defaultSampleSize"));
+	AddProperty( /* 6 */
+		new MP4Integer32Property("defaultSampleFlags"));
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_trpy.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,29 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4TrpyAtom::MP4TrpyAtom() 
+	: MP4Atom("trpy") 
+{
+	AddProperty( // bytes sent including RTP headers
+		new MP4Integer64Property("bytes"));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_trun.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,78 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4TrunAtom::MP4TrunAtom() 
+	: MP4Atom("trun")
+{
+	AddVersionAndFlags();	/* 0, 1 */
+	AddProperty( /* 2 */
+		new MP4Integer32Property("sampleCount"));
+}
+
+void MP4TrunAtom::AddProperties(u_int32_t flags)
+{
+	if (flags & 0x01) {
+		// Note this is a signed 32 value
+		AddProperty(
+			new MP4Integer32Property("dataOffset"));
+	}
+	if (flags & 0x04) {
+		AddProperty(
+			new MP4Integer32Property("firstSampleFlags"));
+	}
+
+	MP4TableProperty* pTable = 
+		new MP4TableProperty("samples", m_pProperties[2]);
+	AddProperty(pTable);
+
+	if (flags & 0x100) {
+		pTable->AddProperty(
+			new MP4Integer32Property("sampleDuration"));
+	}
+	if (flags & 0x200) {
+		pTable->AddProperty(
+			new MP4Integer32Property("sampleSize"));
+	}
+	if (flags & 0x400) {
+		pTable->AddProperty(
+			new MP4Integer32Property("sampleFlags"));
+	}
+	if (flags & 0x800) {
+		pTable->AddProperty(
+			new MP4Integer32Property("sampleCompositionTimeOffset"));
+	}
+}
+
+void MP4TrunAtom::Read()
+{
+	/* read atom version, flags, and sampleCount */
+	ReadProperties(0, 3);
+
+	/* need to create the properties based on the atom flags */
+	AddProperties(GetFlags());
+
+	/* now we can read the remaining properties */
+	ReadProperties(3);
+
+	Skip();	// to end of atom
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_tsro.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,30 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4TsroAtom::MP4TsroAtom() 
+	: MP4Atom("tsro") 
+{
+	AddProperty( 
+		new MP4Integer32Property("offset"));
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_udta.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,38 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4UdtaAtom::MP4UdtaAtom() 
+	: MP4Atom("udta") 
+{
+	ExpectChildAtom("cprt", Optional, Many);
+	ExpectChildAtom("hnti", Optional, OnlyOne);
+}
+
+void MP4UdtaAtom::Read() 
+{
+	if (ATOMID(m_pParentAtom->GetType()) == ATOMID("trak")) {
+		ExpectChildAtom("hinf", Optional, OnlyOne);
+	}
+
+	MP4Atom::Read();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_url.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,63 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4UrlAtom::MP4UrlAtom() 
+	: MP4Atom("url ")
+{
+	AddVersionAndFlags();
+	AddProperty(new MP4StringProperty("location"));
+}
+
+void MP4UrlAtom::Read() 
+{
+	// read the version and flags properties
+	ReadProperties(0, 2);
+
+	// check if self-contained flag is set
+	if (!(GetFlags() & 1)) {
+		// if not then read url location
+		ReadProperties(2);
+	}
+
+	Skip();	// to end of atom
+}
+
+void MP4UrlAtom::Write() 
+{
+	MP4StringProperty* pLocationProp =
+		(MP4StringProperty*)m_pProperties[2];
+
+	// if no url location has been set
+	// then set self-contained flag
+	// and don't attempt to write anything
+	if (pLocationProp->GetValue() == NULL) {
+		SetFlags(GetFlags() | 1);
+		pLocationProp->SetImplicit(true);
+	} else {
+		SetFlags(GetFlags() & 0xFFFFFE);
+		pLocationProp->SetImplicit(false);
+	}
+
+	// write atom as usual
+	MP4Atom::Write();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_urn.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,44 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4UrnAtom::MP4UrnAtom() 
+	: MP4Atom("urn ")
+{
+	AddVersionAndFlags();
+	AddProperty(new MP4StringProperty("name"));
+	AddProperty(new MP4StringProperty("location"));
+}
+
+void MP4UrnAtom::Read() 
+{
+	// read the version, flags, and name properties
+	ReadProperties(0, 3);
+
+	// check if location is present
+	if (m_pFile->GetPosition() < GetEnd()) {
+		// read it
+		ReadProperties(3);
+	}
+
+	Skip();	// to end of atom
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atom_vmhd.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,37 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4VmhdAtom::MP4VmhdAtom() 
+	: MP4Atom("vmhd") 
+{
+	AddVersionAndFlags();
+	AddReserved("reserved", 8);
+}
+
+void MP4VmhdAtom::Generate()
+{
+	MP4Atom::Generate();
+
+	SetFlags(1);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/atoms.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,446 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#ifndef __MP4_ATOMS_INCLUDED__
+#define __MP4_ATOMS_INCLUDED__
+
+// declare all the atom subclasses
+// i.e. spare us atom_xxxx.h for all the atoms
+//
+// The majority of atoms just need their own constructor declared
+// Some atoms have a few special needs
+// A small minority of atoms need lots of special handling
+
+class MP4RootAtom : public MP4Atom {
+public:
+	MP4RootAtom();
+	void BeginWrite(bool use64 = false);
+	void Write();
+	void FinishWrite(bool use64 = false);
+
+	void BeginOptimalWrite();
+	void FinishOptimalWrite();
+
+protected:
+	u_int32_t GetLastMdatIndex();
+	void WriteAtomType(const char* type, bool onlyOne);
+};
+
+class MP4FtypAtom : public MP4Atom {
+public:
+	MP4FtypAtom();
+	void Generate();
+	void Read();
+};
+
+class MP4MdatAtom : public MP4Atom {
+public:
+	MP4MdatAtom();
+	void Read();
+	void Write();
+};
+
+class MP4MoovAtom : public MP4Atom {
+public:
+	MP4MoovAtom();
+};
+
+class MP4MvhdAtom : public MP4Atom {
+public:
+	MP4MvhdAtom();
+	void Generate();
+	void Read();
+protected:
+	void AddProperties(u_int8_t version);
+};
+
+class MP4IodsAtom : public MP4Atom {
+public:
+	MP4IodsAtom();
+};
+
+class MP4TrakAtom : public MP4Atom {
+public:
+	MP4TrakAtom();
+};
+
+class MP4TkhdAtom : public MP4Atom {
+public:
+	MP4TkhdAtom();
+	void Generate();
+	void Read();
+protected:
+	void AddProperties(u_int8_t version);
+};
+
+class MP4TrefAtom : public MP4Atom {
+public:
+	MP4TrefAtom();
+};
+
+class MP4TrefTypeAtom : public MP4Atom {
+public:
+	MP4TrefTypeAtom(const char* type);
+	void Read();
+};
+
+class MP4MdiaAtom : public MP4Atom {
+public:
+	MP4MdiaAtom();
+};
+
+class MP4MdhdAtom : public MP4Atom {
+public:
+	MP4MdhdAtom();
+	void Generate();
+	void Read();
+protected:
+	void AddProperties(u_int8_t version);
+};
+
+class MP4HdlrAtom : public MP4Atom {
+public:
+	MP4HdlrAtom();
+	void Read();
+};
+
+class MP4MinfAtom : public MP4Atom {
+public:
+	MP4MinfAtom();
+};
+
+class MP4VmhdAtom : public MP4Atom {
+public:
+	MP4VmhdAtom();
+	void Generate();
+};
+
+class MP4SmhdAtom : public MP4Atom {
+public:
+	MP4SmhdAtom();
+};
+
+class MP4HmhdAtom : public MP4Atom {
+public:
+	MP4HmhdAtom();
+};
+
+class MP4NmhdAtom : public MP4Atom {
+public:
+	MP4NmhdAtom();
+};
+
+class MP4DinfAtom : public MP4Atom {
+public:
+	MP4DinfAtom();
+};
+
+class MP4DrefAtom : public MP4Atom {
+public:
+	MP4DrefAtom();
+	void Read();
+};
+
+class MP4UrlAtom : public MP4Atom {
+public:
+	MP4UrlAtom();
+	void Read();
+	void Write();
+};
+
+class MP4UrnAtom : public MP4Atom {
+public:
+	MP4UrnAtom();
+	void Read();
+};
+
+class MP4StblAtom : public MP4Atom {
+public:
+	MP4StblAtom();
+	void Generate();
+};
+
+class MP4StsdAtom : public MP4Atom {
+public:
+	MP4StsdAtom();
+	void Read();
+};
+
+class MP4Mp4aAtom : public MP4Atom {
+public:
+	MP4Mp4aAtom();
+	void Generate();
+};
+
+class MP4Mp4sAtom : public MP4Atom {
+public:
+	MP4Mp4sAtom();
+	void Generate();
+};
+
+class MP4Mp4vAtom : public MP4Atom {
+public:
+	MP4Mp4vAtom();
+	void Generate();
+};
+
+class MP4EsdsAtom : public MP4Atom {
+public:
+	MP4EsdsAtom();
+};
+
+class MP4SttsAtom : public MP4Atom {
+public:
+	MP4SttsAtom();
+};
+
+class MP4CttsAtom : public MP4Atom {
+public:
+	MP4CttsAtom();
+};
+
+class MP4StszAtom : public MP4Atom {
+public:
+	MP4StszAtom();
+	void Read();
+	void Write();
+};
+
+class MP4StscAtom : public MP4Atom {
+public:
+	MP4StscAtom();
+	void Read();
+};
+
+class MP4StcoAtom : public MP4Atom {
+public:
+	MP4StcoAtom();
+};
+
+class MP4Co64Atom : public MP4Atom {
+public:
+	MP4Co64Atom();
+};
+
+class MP4StssAtom : public MP4Atom {
+public:
+	MP4StssAtom();
+};
+
+class MP4StshAtom : public MP4Atom {
+public:
+	MP4StshAtom();
+};
+
+class MP4StdpAtom : public MP4Atom {
+public:
+	MP4StdpAtom();
+	void Read();
+};
+
+class MP4EdtsAtom : public MP4Atom {
+public:
+	MP4EdtsAtom();
+};
+
+class MP4ElstAtom : public MP4Atom {
+public:
+	MP4ElstAtom();
+	void Generate();
+	void Read();
+protected:
+	void AddProperties(u_int8_t version);
+};
+
+class MP4UdtaAtom : public MP4Atom {
+public:
+	MP4UdtaAtom();
+	void Read();
+};
+
+class MP4CprtAtom : public MP4Atom {
+public:
+	MP4CprtAtom();
+};
+
+class MP4HntiAtom : public MP4Atom {
+public:
+	MP4HntiAtom();
+	void Read();
+};
+
+class MP4RtpAtom : public MP4Atom {
+public:
+	MP4RtpAtom();
+	void Generate();
+	void Read();
+	void Write();
+
+protected:
+	void AddPropertiesStsdType();
+	void AddPropertiesHntiType();
+
+	void GenerateStsdType();
+	void GenerateHntiType();
+
+	void ReadStsdType();
+	void ReadHntiType();
+
+	void WriteHntiType();
+};
+
+class MP4TimsAtom : public MP4Atom {
+public:
+	MP4TimsAtom();
+};
+
+class MP4TsroAtom : public MP4Atom {
+public:
+	MP4TsroAtom();
+};
+
+class MP4SnroAtom : public MP4Atom {
+public:
+	MP4SnroAtom();
+};
+
+class MP4SdpAtom : public MP4Atom {
+public:
+	MP4SdpAtom();
+	void Read();
+	void Write();
+};
+
+class MP4HinfAtom : public MP4Atom {
+public:
+	MP4HinfAtom();
+	void Generate();
+};
+
+class MP4TrpyAtom : public MP4Atom {
+public:
+	MP4TrpyAtom();
+};
+
+class MP4NumpAtom : public MP4Atom {
+public:
+	MP4NumpAtom();
+};
+
+class MP4TpylAtom : public MP4Atom {
+public:
+	MP4TpylAtom();
+};
+
+class MP4MaxrAtom : public MP4Atom {
+public:
+	MP4MaxrAtom();
+};
+
+class MP4DmedAtom : public MP4Atom {
+public:
+	MP4DmedAtom();
+};
+
+class MP4DimmAtom : public MP4Atom {
+public:
+	MP4DimmAtom();
+};
+
+class MP4DrepAtom : public MP4Atom {
+public:
+	MP4DrepAtom();
+};
+
+class MP4TminAtom : public MP4Atom {
+public:
+	MP4TminAtom();
+};
+
+class MP4TmaxAtom : public MP4Atom {
+public:
+	MP4TmaxAtom();
+};
+
+class MP4PmaxAtom : public MP4Atom {
+public:
+	MP4PmaxAtom();
+};
+
+class MP4DmaxAtom : public MP4Atom {
+public:
+	MP4DmaxAtom();
+};
+
+class MP4PaytAtom : public MP4Atom {
+public:
+	MP4PaytAtom();
+};
+
+class MP4MvexAtom : public MP4Atom {
+public:
+	MP4MvexAtom();
+};
+
+class MP4TrexAtom : public MP4Atom {
+public:
+	MP4TrexAtom();
+};
+
+class MP4MoofAtom : public MP4Atom {
+public:
+	MP4MoofAtom();
+};
+
+class MP4MfhdAtom : public MP4Atom {
+public:
+	MP4MfhdAtom();
+};
+
+class MP4TrafAtom : public MP4Atom {
+public:
+	MP4TrafAtom();
+};
+
+class MP4TfhdAtom : public MP4Atom {
+public:
+	MP4TfhdAtom();
+	void Read();
+protected:
+	void AddProperties(u_int32_t flags);
+};
+
+class MP4TrunAtom : public MP4Atom {
+public:
+	MP4TrunAtom();
+	void Read();
+protected:
+	void AddProperties(u_int32_t flags);
+};
+
+class MP4FreeAtom : public MP4Atom {
+public:
+	MP4FreeAtom();
+	void Read();
+	void Write();
+};
+
+#endif /* __MP4_ATOMS_INCLUDED__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/descriptors.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,627 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4IODescriptor::MP4IODescriptor()
+	: MP4Descriptor(MP4FileIODescrTag)
+{
+	/* N.B. other member functions depend on the property indicies */
+	AddProperty( /* 0 */
+		new MP4BitfieldProperty("objectDescriptorId", 10));
+	AddProperty( /* 1 */
+		new MP4BitfieldProperty("URLFlag", 1));
+	AddProperty( /* 2 */
+		new MP4BitfieldProperty("includeInlineProfileLevelFlag", 1));
+	AddProperty( /* 3 */
+		new MP4BitfieldProperty("reserved", 4));
+	AddProperty( /* 4 */
+		new MP4StringProperty("URL", Counted));
+	AddProperty( /* 5 */
+		new MP4Integer8Property("ODProfileLevelId"));
+	AddProperty( /* 6 */
+		new MP4Integer8Property("sceneProfileLevelId"));
+	AddProperty( /* 7 */
+		new MP4Integer8Property("audioProfileLevelId"));
+	AddProperty( /* 8 */
+		new MP4Integer8Property("visualProfileLevelId"));
+	AddProperty( /* 9 */
+		new MP4Integer8Property("graphicsProfileLevelId"));
+	AddProperty( /* 10 */ 
+		new MP4DescriptorProperty("esIds", 
+			MP4ESIDIncDescrTag, 0, Required, Many));
+	AddProperty( /* 11 */ 
+		new MP4DescriptorProperty("ociDescr", 
+			MP4OCIDescrTagsStart, MP4OCIDescrTagsEnd, Optional, Many));
+	AddProperty( /* 12 */
+		new MP4DescriptorProperty("ipmpDescrPtr",
+			MP4IPMPPtrDescrTag, 0, Optional, Many));
+	AddProperty( /* 13 */
+		new MP4DescriptorProperty("extDescr",
+			MP4ExtDescrTagsStart, MP4ExtDescrTagsEnd, Optional, Many));
+
+	SetReadMutate(2);
+}
+
+void MP4IODescriptor::Generate()
+{
+	((MP4BitfieldProperty*)m_pProperties[0])->SetValue(1);
+	((MP4BitfieldProperty*)m_pProperties[3])->SetValue(0xF);
+	for (u_int32_t i = 5; i <= 9; i++) {
+		((MP4Integer8Property*)m_pProperties[i])->SetValue(0xFF);
+	}
+}
+
+void MP4IODescriptor::Mutate()
+{
+	bool urlFlag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue();
+
+	m_pProperties[4]->SetImplicit(!urlFlag);
+	for (u_int32_t i = 5; i <= 12; i++) {
+		m_pProperties[i]->SetImplicit(urlFlag);
+	}
+}
+
+MP4ODescriptor::MP4ODescriptor()
+	: MP4Descriptor(MP4FileODescrTag)
+{
+	/* N.B. other member functions depend on the property indicies */
+	AddProperty( /* 0 */
+		new MP4BitfieldProperty("objectDescriptorId", 10));
+	AddProperty( /* 1 */
+		new MP4BitfieldProperty("URLFlag", 1));
+	AddProperty( /* 2 */
+		new MP4BitfieldProperty("reserved", 5));
+	AddProperty( /* 3 */
+		new MP4StringProperty("URL", Counted));
+	AddProperty( /* 4 */ 
+		new MP4DescriptorProperty("esIds", 
+			MP4ESIDRefDescrTag, 0, Required, Many));
+	AddProperty( /* 5 */ 
+		new MP4DescriptorProperty("ociDescr", 
+			MP4OCIDescrTagsStart, MP4OCIDescrTagsEnd, Optional, Many));
+	AddProperty( /* 6 */
+		new MP4DescriptorProperty("ipmpDescrPtr",
+			MP4IPMPPtrDescrTag, 0, Optional, Many));
+	AddProperty( /* 7 */
+		new MP4DescriptorProperty("extDescr",
+			MP4ExtDescrTagsStart, MP4ExtDescrTagsEnd, Optional, Many));
+
+	SetReadMutate(2);
+}
+
+void MP4ODescriptor::Generate()
+{
+	((MP4BitfieldProperty*)m_pProperties[2])->SetValue(0x1F);
+}
+
+void MP4ODescriptor::Mutate()
+{
+	bool urlFlag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue();
+
+	m_pProperties[3]->SetImplicit(!urlFlag);
+	for (u_int32_t i = 4; i <= 6; i++) {
+		m_pProperties[i]->SetImplicit(urlFlag);
+	}
+}
+
+MP4ESIDIncDescriptor::MP4ESIDIncDescriptor()
+	: MP4Descriptor(MP4ESIDIncDescrTag)
+{
+	AddProperty( /* 0 */
+		new MP4Integer32Property("id"));
+}
+
+MP4ESIDRefDescriptor::MP4ESIDRefDescriptor()
+	: MP4Descriptor(MP4ESIDRefDescrTag)
+{
+	AddProperty( /* 0 */
+		new MP4Integer16Property("refIndex"));
+}
+
+MP4ESDescriptor::MP4ESDescriptor()
+	: MP4Descriptor(MP4ESDescrTag)
+{
+	/* N.B. other class functions depend on the property indicies */
+	AddProperty( /* 0 */
+		new MP4Integer16Property("ESID"));
+	AddProperty( /* 1 */
+		new MP4BitfieldProperty("streamDependenceFlag", 1));
+	AddProperty( /* 2 */
+		new MP4BitfieldProperty("URLFlag", 1));
+	AddProperty( /* 3 */
+		new MP4BitfieldProperty("OCRstreamFlag", 1));
+	AddProperty( /* 4 */
+		new MP4BitfieldProperty("streamPriority", 5));
+	AddProperty( /* 5 */
+		new MP4Integer16Property("dependsOnESID"));
+	AddProperty( /* 6 */
+		new MP4StringProperty("URL", Counted));
+	AddProperty( /* 7 */
+		new MP4Integer16Property("OCRESID"));
+	AddProperty( /* 8 */
+		new MP4DescriptorProperty("decConfigDescr",
+			MP4DecConfigDescrTag, 0, Required, OnlyOne));
+	AddProperty( /* 9 */
+		new MP4DescriptorProperty("slConfigDescr",
+			MP4SLConfigDescrTag, 0, Required, OnlyOne));
+	AddProperty( /* 10 */
+		new MP4DescriptorProperty("ipiPtr",
+			MP4IPIPtrDescrTag, 0, Optional, OnlyOne));
+	AddProperty( /* 11 */
+		new MP4DescriptorProperty("ipIds",
+			MP4ContentIdDescrTag, MP4SupplContentIdDescrTag, Optional, Many));
+	AddProperty( /* 12 */
+		new MP4DescriptorProperty("ipmpDescrPtr",
+			MP4IPMPPtrDescrTag, 0, Optional, Many));
+	AddProperty( /* 13 */
+		new MP4DescriptorProperty("langDescr",
+			MP4LanguageDescrTag, 0, Optional, Many));
+	AddProperty( /* 14 */
+		new MP4DescriptorProperty("qosDescr",
+			MP4QosDescrTag, 0, Optional, OnlyOne));
+	AddProperty( /* 15 */
+		new MP4DescriptorProperty("regDescr",
+			MP4RegistrationDescrTag, 0, Optional, OnlyOne));
+	AddProperty( /* 16 */
+		new MP4DescriptorProperty("extDescr",
+			MP4ExtDescrTagsStart, MP4ExtDescrTagsEnd, Optional, Many));
+
+	SetReadMutate(5);
+}
+
+void MP4ESDescriptor::Mutate()
+{
+	bool streamDependFlag = 
+		((MP4BitfieldProperty*)m_pProperties[1])->GetValue();
+	m_pProperties[5]->SetImplicit(!streamDependFlag);
+
+	bool urlFlag = 
+		((MP4BitfieldProperty*)m_pProperties[2])->GetValue();
+	m_pProperties[6]->SetImplicit(!urlFlag);
+
+	bool ocrFlag = 
+		((MP4BitfieldProperty*)m_pProperties[3])->GetValue();
+	m_pProperties[7]->SetImplicit(!ocrFlag);
+}
+
+MP4DecConfigDescriptor::MP4DecConfigDescriptor()
+	: MP4Descriptor(MP4DecConfigDescrTag)
+{
+	AddProperty( /* 0 */
+		new MP4Integer8Property("objectTypeId"));
+	AddProperty( /* 1 */
+		new MP4BitfieldProperty("streamType", 6));
+	AddProperty( /* 2 */
+		new MP4BitfieldProperty("upStream", 1));
+	AddProperty( /* 3 */
+		new MP4BitfieldProperty("reserved", 1));
+	AddProperty( /* 4 */
+		new MP4BitfieldProperty("bufferSizeDB", 24));
+	AddProperty( /* 5 */
+		new MP4Integer32Property("maxBitrate"));
+	AddProperty( /* 6 */
+		new MP4Integer32Property("avgBitrate"));
+	AddProperty( /* 7 */
+		new MP4DescriptorProperty("decSpecificInfo",
+			MP4DecSpecificDescrTag, 0, Optional, OnlyOne));
+	AddProperty( /* 8 */
+		new MP4DescriptorProperty("profileLevelIndicationIndexDescr",
+			MP4ExtProfileLevelDescrTag, 0, Optional, Many));
+}
+
+void MP4DecConfigDescriptor::Generate()
+{
+	((MP4BitfieldProperty*)m_pProperties[3])->SetValue(1);
+}
+
+MP4DecSpecificDescriptor::MP4DecSpecificDescriptor()
+	: MP4Descriptor(MP4DecSpecificDescrTag)
+{
+	AddProperty( /* 0 */
+		new MP4BytesProperty("info"));
+}
+
+void MP4DecSpecificDescriptor::Read(MP4File* pFile)
+{
+	ReadHeader(pFile);
+
+	/* byte properties need to know how long they are before reading */
+	((MP4BytesProperty*)m_pProperties[0])->SetValueSize(m_size);
+
+	ReadProperties(pFile);
+}
+
+MP4SLConfigDescriptor::MP4SLConfigDescriptor()
+	: MP4Descriptor(MP4SLConfigDescrTag)
+{
+	AddProperty( /* 0 */
+		new MP4Integer8Property("predefined"));
+	AddProperty( /* 1 */
+		new MP4BitfieldProperty("useAccessUnitStartFlag", 1));
+	AddProperty( /* 2 */
+		new MP4BitfieldProperty("useAccessUnitEndFlag", 1));
+	AddProperty( /* 3 */
+		new MP4BitfieldProperty("useRandomAccessPointFlag", 1));
+	AddProperty( /* 4 */
+		new MP4BitfieldProperty("hasRandomAccessUnitsOnlyFlag", 1));
+	AddProperty( /* 5 */
+		new MP4BitfieldProperty("usePaddingFlag", 1));
+	AddProperty( /* 6 */
+		new MP4BitfieldProperty("useTimeStampsFlag", 1));
+	AddProperty( /* 7 */
+		new MP4BitfieldProperty("useIdleFlag", 1));
+	AddProperty( /* 8 */
+		new MP4BitfieldProperty("durationFlag", 1));
+	AddProperty( /* 9 */
+		new MP4Integer32Property("timeStampResolution"));
+	AddProperty( /* 10 */
+		new MP4Integer32Property("OCRResolution"));
+	AddProperty( /* 11 */
+		new MP4Integer8Property("timeStampLength"));
+	AddProperty( /* 12 */
+		new MP4Integer8Property("OCRLength"));
+	AddProperty( /* 13 */
+		new MP4Integer8Property("AULength"));
+	AddProperty( /* 14 */
+		new MP4Integer8Property("instantBitrateLength"));
+	AddProperty( /* 15 */
+		new MP4BitfieldProperty("degradationPriortyLength", 4));
+	AddProperty( /* 16 */
+		new MP4BitfieldProperty("AUSeqNumLength", 5));
+	AddProperty( /* 17 */
+		new MP4BitfieldProperty("packetSeqNumLength", 5));
+	AddProperty( /* 18 */
+		new MP4BitfieldProperty("reserved", 2));
+
+	// if durationFlag 
+	AddProperty( /* 19 */
+		new MP4Integer32Property("timeScale"));
+	AddProperty( /* 20 */
+		new MP4Integer16Property("accessUnitDuration"));
+	AddProperty( /* 21 */
+		new MP4Integer16Property("compositionUnitDuration"));
+	
+	// if !useTimeStampsFlag
+	AddProperty( /* 22 */
+		new MP4BitfieldProperty("startDecodingTimeStamp", 64));
+	AddProperty( /* 23 */
+		new MP4BitfieldProperty("startCompositionTimeStamp", 64));
+}
+
+void MP4SLConfigDescriptor::Generate()
+{
+	// by default all tracks in an mp4 file 
+	// use predefined SLConfig descriptor == 2
+	((MP4Integer8Property*)m_pProperties[0])->SetValue(2);
+
+	// which implies UseTimestampsFlag = 1
+	((MP4BitfieldProperty*)m_pProperties[6])->SetValue(1);
+
+	// reserved = 3
+	((MP4BitfieldProperty*)m_pProperties[18])->SetValue(3);
+}
+
+void MP4SLConfigDescriptor::Read(MP4File* pFile)
+{
+	ReadHeader(pFile);
+
+	// read the first property, 'predefined'
+	ReadProperties(pFile, 0, 1);
+
+	// if predefined == 0
+	if (((MP4Integer8Property*)m_pProperties[0])->GetValue() == 0) {
+
+		/* read the next 18 properties */
+		ReadProperties(pFile, 1, 18);
+	}
+
+	// now mutate 
+	Mutate();
+
+	// and read the remaining properties
+	ReadProperties(pFile, 19);
+}
+
+void MP4SLConfigDescriptor::Mutate()
+{
+	u_int32_t i;
+	u_int8_t predefined = 
+		((MP4Integer8Property*)m_pProperties[0])->GetValue();
+
+	if (predefined) {
+		// properties 1-18 are implicit
+		for (i = 1; i < m_pProperties.Size(); i++) {
+			m_pProperties[i]->SetImplicit(true);
+		}
+
+		if (predefined == 1) {
+			// UseTimestampsFlag = 0
+			((MP4BitfieldProperty*)m_pProperties[6])->SetValue(0);
+
+			// TimestampResolution = 1000
+			((MP4Integer32Property*)m_pProperties[9])->SetValue(1000);
+
+			// TimeStampLength = 32
+			((MP4Integer8Property*)m_pProperties[11])->SetValue(32);
+
+		} else if (predefined == 2) {
+			// UseTimestampsFlag = 1
+			((MP4BitfieldProperty*)m_pProperties[6])->SetValue(1);
+		}
+	}
+
+	bool durationFlag = 
+		((MP4BitfieldProperty*)m_pProperties[8])->GetValue();
+
+	for (i = 19; i <= 21; i++) {
+		m_pProperties[i]->SetImplicit(!durationFlag);
+	}
+
+	bool useTimeStampsFlag = 
+		((MP4BitfieldProperty*)m_pProperties[6])->GetValue();
+
+	for (i = 22; i <= 23; i++) {
+		m_pProperties[i]->SetImplicit(useTimeStampsFlag);
+
+		u_int8_t timeStampLength = MIN(64,
+			((MP4Integer8Property*)m_pProperties[11])->GetValue());
+
+		((MP4BitfieldProperty*)m_pProperties[i])->SetNumBits(timeStampLength);
+		
+		// handle a nonsensical situation gracefully
+		if (timeStampLength == 0) {
+			m_pProperties[i]->SetImplicit(true);
+		}
+	}
+}
+
+MP4IPIPtrDescriptor::MP4IPIPtrDescriptor()
+	: MP4Descriptor(MP4IPIPtrDescrTag)
+{
+	AddProperty( /* 0 */
+		new MP4Integer16Property("IPIESId"));
+}
+
+MP4ContentIdDescriptor::MP4ContentIdDescriptor()
+	: MP4Descriptor(MP4ContentIdDescrTag)
+{
+	AddProperty( /* 0 */
+		new MP4BitfieldProperty("compatibility", 2));
+	AddProperty( /* 1 */
+		new MP4BitfieldProperty("contentTypeFlag", 1));
+	AddProperty( /* 2 */
+		new MP4BitfieldProperty("contentIdFlag", 1));
+	AddProperty( /* 3 */
+		new MP4BitfieldProperty("protectedContent", 1));
+	AddProperty( /* 4 */
+		new MP4BitfieldProperty("reserved", 3));
+	AddProperty( /* 5 */
+		new MP4Integer8Property("contentType"));
+	AddProperty( /* 6 */
+		new MP4Integer8Property("contentIdType"));
+	AddProperty( /* 7 */
+		new MP4BytesProperty("contentId"));
+}
+
+void MP4ContentIdDescriptor::Read(MP4File* pFile)
+{
+	ReadHeader(pFile);
+
+	/* read the first property, 'compatiblity' */
+	ReadProperties(pFile, 0, 1);
+
+	/* if compatiblity != 0 */
+	if (((MP4Integer8Property*)m_pProperties[0])->GetValue() != 0) {
+		/* we don't understand it */
+		VERBOSE_READ(pFile->GetVerbosity(),
+			printf("incompatible content id descriptor\n"));
+		return;
+	}
+
+	/* read the next four properties */
+	ReadProperties(pFile, 1, 4);
+
+	/* which allows us to reconfigure ourselves */
+	Mutate();
+
+	/* read the remaining properties */
+	ReadProperties(pFile, 5);
+}
+
+void MP4ContentIdDescriptor::Mutate()
+{
+	bool contentTypeFlag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue();
+	m_pProperties[5]->SetImplicit(!contentTypeFlag);
+
+	bool contentIdFlag = ((MP4BitfieldProperty*)m_pProperties[2])->GetValue();
+	m_pProperties[6]->SetImplicit(!contentIdFlag);
+	m_pProperties[7]->SetImplicit(!contentIdFlag);
+}
+
+MP4SupplContentIdDescriptor::MP4SupplContentIdDescriptor()
+	: MP4Descriptor(MP4SupplContentIdDescrTag)
+{
+	AddProperty( /* 0 */
+		new MP4BytesProperty("languageCode", 3));
+	AddProperty( /* 1 */
+		new MP4StringProperty("title", Counted));
+	AddProperty( /* 2 */
+		new MP4StringProperty("value", Counted));
+}
+
+MP4IPMPPtrDescriptor::MP4IPMPPtrDescriptor()
+	: MP4Descriptor(MP4IPMPPtrDescrTag)
+{
+	AddProperty( /* 0 */
+		new MP4Integer8Property("IPMPDescriptorId"));
+}
+
+MP4IPMPDescriptor::MP4IPMPDescriptor()
+	: MP4Descriptor(MP4IPMPDescrTag)
+{
+	AddProperty( /* 0 */
+		new MP4Integer8Property("IPMPDescriptorId"));
+	AddProperty( /* 1 */
+		new MP4Integer16Property("IPMPSType"));
+	AddProperty( /* 2 */
+		new MP4BytesProperty("IPMPData"));
+	/* note: if IPMPSType == 0, IPMPData is an URL */
+}
+
+void MP4IPMPDescriptor::Read(MP4File* pFile)
+{
+	ReadHeader(pFile);
+
+	/* byte properties need to know how long they are before reading */
+	((MP4BytesProperty*)m_pProperties[2])->SetValueSize(m_size - 3);
+
+	ReadProperties(pFile);
+}
+
+MP4RegistrationDescriptor::MP4RegistrationDescriptor()
+	: MP4Descriptor(MP4RegistrationDescrTag)
+{
+	AddProperty( /* 0 */
+		new MP4Integer32Property("formatIdentifier"));
+	AddProperty( /* 1 */
+		new MP4BytesProperty("additionalIdentificationInfo"));
+}
+
+void MP4RegistrationDescriptor::Read(MP4File* pFile)
+{
+	ReadHeader(pFile);
+
+	/* byte properties need to know how long they are before reading */
+	((MP4BytesProperty*)m_pProperties[1])->SetValueSize(m_size - 4);
+
+	ReadProperties(pFile);
+}
+
+MP4ExtProfileLevelDescriptor::MP4ExtProfileLevelDescriptor()
+	: MP4Descriptor(MP4ExtProfileLevelDescrTag)
+{
+	AddProperty( /* 0 */
+		new MP4Integer8Property("profileLevelIndicationIndex"));
+	AddProperty( /* 1 */
+		new MP4Integer8Property("ODProfileLevelIndication"));
+	AddProperty( /* 2 */
+		new MP4Integer8Property("sceneProfileLevelIndication"));
+	AddProperty( /* 3 */
+		new MP4Integer8Property("audioProfileLevelIndication"));
+	AddProperty( /* 4 */
+		new MP4Integer8Property("visualProfileLevelIndication"));
+	AddProperty( /* 5 */
+		new MP4Integer8Property("graphicsProfileLevelIndication"));
+	AddProperty( /* 6 */
+		new MP4Integer8Property("MPEGJProfileLevelIndication"));
+}
+
+MP4ExtensionDescriptor::MP4ExtensionDescriptor()
+	: MP4Descriptor()
+{
+	AddProperty( /* 0 */
+		new MP4BytesProperty("data"));
+}
+
+void MP4ExtensionDescriptor::Read(MP4File* pFile)
+{
+	ReadHeader(pFile);
+
+	/* byte properties need to know how long they are before reading */
+	((MP4BytesProperty*)m_pProperties[0])->SetValueSize(m_size);
+
+	ReadProperties(pFile);
+}
+
+MP4Descriptor* MP4DescriptorProperty::CreateDescriptor(u_int8_t tag) 
+{
+	MP4Descriptor* pDescriptor = NULL;
+
+	switch (tag) {
+	case MP4ESDescrTag:
+		pDescriptor = new MP4ESDescriptor();
+		break;
+	case MP4DecConfigDescrTag:
+		pDescriptor = new MP4DecConfigDescriptor();
+		break;
+	case MP4DecSpecificDescrTag:
+		pDescriptor = new MP4DecSpecificDescriptor();
+		break;
+	case MP4SLConfigDescrTag:
+		pDescriptor = new MP4SLConfigDescriptor();
+		break;
+	case MP4ContentIdDescrTag:
+		pDescriptor = new MP4ContentIdDescriptor();
+		break;
+	case MP4SupplContentIdDescrTag:
+		pDescriptor = new MP4SupplContentIdDescriptor();
+		break;
+	case MP4IPIPtrDescrTag:
+		pDescriptor = new MP4IPIPtrDescriptor();
+		break;
+	case MP4IPMPPtrDescrTag:
+		pDescriptor = new MP4IPMPPtrDescriptor();
+		break;
+	case MP4IPMPDescrTag:
+		pDescriptor = new MP4IPMPDescriptor();
+		break;
+	case MP4QosDescrTag:
+		pDescriptor = new MP4QosDescriptor();
+		break;
+	case MP4RegistrationDescrTag:
+		pDescriptor = new MP4RegistrationDescriptor();
+		break;
+	case MP4ESIDIncDescrTag:
+		pDescriptor = new MP4ESIDIncDescriptor();
+		break;
+	case MP4ESIDRefDescrTag:
+		pDescriptor = new MP4ESIDRefDescriptor();
+		break;
+	case MP4IODescrTag:
+	case MP4FileIODescrTag:
+		pDescriptor = new MP4IODescriptor();
+		pDescriptor->SetTag(tag);
+		break;
+	case MP4ODescrTag:
+	case MP4FileODescrTag:
+		pDescriptor = new MP4ODescriptor();
+		pDescriptor->SetTag(tag);
+		break;
+	case MP4ExtProfileLevelDescrTag:
+		pDescriptor = new MP4ExtProfileLevelDescriptor();
+		break;
+	}
+
+	if (pDescriptor == NULL) {
+		if (tag >= MP4OCIDescrTagsStart && tag <= MP4OCIDescrTagsEnd) {
+			pDescriptor = CreateOCIDescriptor(tag);
+		}
+
+		if (tag >= MP4ExtDescrTagsStart && tag <= MP4ExtDescrTagsEnd) {
+			pDescriptor = new MP4ExtensionDescriptor();
+			pDescriptor->SetTag(tag);
+		}
+	}
+
+	return pDescriptor;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/descriptors.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,164 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#ifndef __DESCRIPTORS_INCLUDED__
+#define __DESCRIPTORS_INCLUDED__
+
+const u_int8_t MP4ODescrTag					= 0x01; 
+const u_int8_t MP4IODescrTag				= 0x02; 
+const u_int8_t MP4ESDescrTag				= 0x03; 
+const u_int8_t MP4DecConfigDescrTag			= 0x04; 
+const u_int8_t MP4DecSpecificDescrTag		= 0x05; 
+const u_int8_t MP4SLConfigDescrTag		 	= 0x06; 
+const u_int8_t MP4ContentIdDescrTag		 	= 0x07; 
+const u_int8_t MP4SupplContentIdDescrTag 	= 0x08; 
+const u_int8_t MP4IPIPtrDescrTag		 	= 0x09; 
+const u_int8_t MP4IPMPPtrDescrTag		 	= 0x0A; 
+const u_int8_t MP4IPMPDescrTag			 	= 0x0B; 
+const u_int8_t MP4RegistrationDescrTag	 	= 0x0D; 
+const u_int8_t MP4ESIDIncDescrTag			= 0x0E; 
+const u_int8_t MP4ESIDRefDescrTag			= 0x0F; 
+const u_int8_t MP4FileIODescrTag			= 0x10; 
+const u_int8_t MP4FileODescrTag				= 0x11; 
+const u_int8_t MP4ExtProfileLevelDescrTag 	= 0x13; 
+const u_int8_t MP4ExtDescrTagsStart			= 0x80; 
+const u_int8_t MP4ExtDescrTagsEnd			= 0xFE; 
+
+class MP4IODescriptor : public MP4Descriptor {
+public:
+	MP4IODescriptor();
+	void Generate();
+protected:
+	void Mutate();
+};
+
+class MP4ODescriptor : public MP4Descriptor {
+public:
+	MP4ODescriptor();
+	void Generate();
+protected:
+	void Mutate();
+};
+
+class MP4ESIDIncDescriptor : public MP4Descriptor {
+public:
+	MP4ESIDIncDescriptor();
+};
+
+class MP4ESIDRefDescriptor : public MP4Descriptor {
+public:
+	MP4ESIDRefDescriptor();
+};
+
+class MP4ESDescriptor : public MP4Descriptor {
+public:
+	MP4ESDescriptor();
+protected:
+	void Mutate();
+};
+
+class MP4DecConfigDescriptor : public MP4Descriptor {
+public:
+	MP4DecConfigDescriptor();
+	void Generate();
+};
+
+class MP4DecSpecificDescriptor : public MP4Descriptor {
+public:
+	MP4DecSpecificDescriptor();
+	void Read(MP4File* pFile);
+};
+
+class MP4SLConfigDescriptor : public MP4Descriptor {
+public:
+	MP4SLConfigDescriptor();
+	void Generate();
+	void Read(MP4File* pFile);
+protected:
+	void Mutate();
+};
+
+class MP4IPIPtrDescriptor : public MP4Descriptor {
+public:
+	MP4IPIPtrDescriptor();
+};
+
+class MP4ContentIdDescriptor : public MP4Descriptor {
+public:
+	MP4ContentIdDescriptor();
+	void Read(MP4File* pFile);
+protected:
+	void Mutate();
+};
+
+class MP4SupplContentIdDescriptor : public MP4Descriptor {
+public:
+	MP4SupplContentIdDescriptor();
+};
+
+class MP4IPMPPtrDescriptor : public MP4Descriptor {
+public:
+	MP4IPMPPtrDescriptor();
+};
+
+class MP4IPMPDescriptor : public MP4Descriptor {
+public:
+	MP4IPMPDescriptor();
+	void Read(MP4File* pFile);
+};
+
+class MP4RegistrationDescriptor : public MP4Descriptor {
+public:
+	MP4RegistrationDescriptor();
+	void Read(MP4File* pFile);
+};
+
+class MP4ExtProfileLevelDescriptor : public MP4Descriptor {
+public:
+	MP4ExtProfileLevelDescriptor();
+};
+
+class MP4ExtensionDescriptor : public MP4Descriptor {
+public:
+	MP4ExtensionDescriptor();
+	void Read(MP4File* pFile);
+};
+
+// associated values in descriptors
+
+// ES objectTypeId
+const u_int8_t MP4SystemsV1ObjectType			= 0x01; 
+const u_int8_t MP4SystemsV2ObjectType			= 0x02; 
+
+// ES streamType
+const u_int8_t MP4ObjectDescriptionStreamType	= 0x01; 
+const u_int8_t MP4ClockReferenceStreamType		= 0x02; 
+const u_int8_t MP4SceneDescriptionStreamType	= 0x03; 
+const u_int8_t MP4VisualStreamType				= 0x04; 
+const u_int8_t MP4AudioStreamType				= 0x05; 
+const u_int8_t MP4Mpeg7StreamType				= 0x06; 
+const u_int8_t MP4IPMPStreamType				= 0x07; 
+const u_int8_t MP4OCIStreamType					= 0x08; 
+const u_int8_t MP4MPEGJStreamType				= 0x09; 
+const u_int8_t MP4UserPrivateStreamType			= 0x20; 
+
+#endif /* __DESCRIPTORS_INCLUDED__ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/isma.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,827 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+static u_int8_t BifsV2Config[3] = {
+	0x00, 0x00, 0x60 // IsCommandStream = 1, PixelMetric = 1
+};
+
+void MP4File::MakeIsmaCompliant(bool addIsmaComplianceSdp)
+{
+	ProtectWriteOperation("MP4MakeIsmaCompliant");
+
+	if (m_useIsma) {
+		// already done
+		return;
+	}
+	m_useIsma = true;
+
+	// find first audio and/or video tracks
+
+	MP4TrackId audioTrackId = MP4_INVALID_TRACK_ID;
+	try {
+		audioTrackId = FindTrackId(0, MP4_AUDIO_TRACK_TYPE);
+	}
+	catch (MP4Error* e) {
+		delete e;
+	}
+
+	MP4TrackId videoTrackId = MP4_INVALID_TRACK_ID;
+	try {
+		videoTrackId = FindTrackId(0, MP4_VIDEO_TRACK_TYPE);
+	}
+	catch (MP4Error* e) {
+		delete e;
+	}
+
+	u_int64_t fileMsDuration =
+		ConvertFromMovieDuration(GetDuration(), MP4_MSECS_TIME_SCALE);
+
+	// delete any existing OD track
+	if (m_odTrackId != MP4_INVALID_TRACK_ID) {
+		DeleteTrack(m_odTrackId);
+	}
+
+	AddODTrack();
+	SetODProfileLevel(0xFF);
+
+	if (audioTrackId != MP4_INVALID_TRACK_ID) {
+		AddTrackToOd(audioTrackId);
+	}
+
+	if (videoTrackId != MP4_INVALID_TRACK_ID) {
+		AddTrackToOd(videoTrackId);
+	}
+
+	// delete any existing scene track
+	MP4TrackId sceneTrackId = MP4_INVALID_TRACK_ID;
+	try {
+		sceneTrackId = FindTrackId(0, MP4_SCENE_TRACK_TYPE);
+	}
+	catch (MP4Error *e) {
+		delete e;
+	}
+	if (sceneTrackId != MP4_INVALID_TRACK_ID) {
+		DeleteTrack(sceneTrackId);
+	}
+
+	// add scene track
+	sceneTrackId = AddSceneTrack();
+	SetSceneProfileLevel(0xFF);
+	SetGraphicsProfileLevel(0xFF);
+	SetTrackIntegerProperty(sceneTrackId, 
+		"mdia.minf.stbl.stsd.mp4s.esds.decConfigDescr.objectTypeId", 
+		MP4SystemsV2ObjectType);
+	
+	SetTrackESConfiguration(sceneTrackId, 
+		BifsV2Config, sizeof(BifsV2Config));
+
+	u_int8_t* pBytes = NULL;
+	u_int64_t numBytes = 0;
+
+	// write OD Update Command
+	CreateIsmaODUpdateCommandFromFileForFile(
+		m_odTrackId, 
+		audioTrackId, 
+		videoTrackId,
+		&pBytes, 
+		&numBytes);
+
+	WriteSample(m_odTrackId, pBytes, numBytes, fileMsDuration);
+
+	MP4Free(pBytes);
+	pBytes = NULL;
+
+	// write BIFS Scene Replace Command
+	CreateIsmaSceneCommand(
+		MP4_IS_VALID_TRACK_ID(audioTrackId), 
+		MP4_IS_VALID_TRACK_ID(videoTrackId),
+		&pBytes, 
+		&numBytes);
+
+	WriteSample(sceneTrackId, pBytes, numBytes, fileMsDuration);
+
+	MP4Free(pBytes);
+	pBytes = NULL;
+
+	// add session level sdp 
+	CreateIsmaIodFromFile(
+		m_odTrackId, 
+		sceneTrackId, 
+		audioTrackId, 
+		videoTrackId,
+		&pBytes, 
+		&numBytes);
+
+	char* iodBase64 = MP4ToBase64(pBytes, numBytes);
+
+	char* sdpBuf = (char*)MP4Calloc(strlen(iodBase64) + 256);
+
+	if (addIsmaComplianceSdp) {
+		strcpy(sdpBuf, "a=isma-compliance:1,1.0,1\015\012");
+	}
+
+	sprintf(&sdpBuf[strlen(sdpBuf)], 
+		"a=mpeg4-iod: \042data:application/mpeg4-iod;base64,%s\042\015\012",
+		iodBase64);
+
+	SetSessionSdp(sdpBuf);
+
+	VERBOSE_ISMA(GetVerbosity(),
+		printf("IOD SDP = %s\n", sdpBuf));
+
+	MP4Free(iodBase64);
+	iodBase64 = NULL;
+	MP4Free(pBytes);
+	pBytes = NULL;
+	MP4Free(sdpBuf);
+	sdpBuf = NULL;
+}
+
+static void CloneIntegerProperty(
+	MP4Descriptor* pDest, 
+	MP4DescriptorProperty* pSrc,
+	const char* name)
+{
+	MP4IntegerProperty* pGetProperty;
+	MP4IntegerProperty* pSetProperty;
+
+	pSrc->FindProperty(name, (MP4Property**)&pGetProperty);
+	pDest->FindProperty(name, (MP4Property**)&pSetProperty);
+
+	pSetProperty->SetValue(pGetProperty->GetValue());
+} 
+
+void MP4File::CreateIsmaIodFromFile(
+	MP4TrackId odTrackId,
+	MP4TrackId sceneTrackId,
+	MP4TrackId audioTrackId, 
+	MP4TrackId videoTrackId,
+	u_int8_t** ppBytes,
+	u_int64_t* pNumBytes)
+{
+	MP4Descriptor* pIod = new MP4IODescriptor();
+	pIod->SetTag(MP4IODescrTag);
+	pIod->Generate();
+
+	MP4Atom* pIodsAtom = FindAtom("moov.iods");
+	ASSERT(pIodsAtom);
+	MP4DescriptorProperty* pSrcIod = 
+		(MP4DescriptorProperty*)pIodsAtom->GetProperty(2);
+
+	CloneIntegerProperty(pIod, pSrcIod, "objectDescriptorId");
+	CloneIntegerProperty(pIod, pSrcIod, "ODProfileLevelId");
+	CloneIntegerProperty(pIod, pSrcIod, "sceneProfileLevelId");
+	CloneIntegerProperty(pIod, pSrcIod, "audioProfileLevelId");
+	CloneIntegerProperty(pIod, pSrcIod, "visualProfileLevelId");
+	CloneIntegerProperty(pIod, pSrcIod, "graphicsProfileLevelId");
+
+	// mutate esIds from MP4ESIDIncDescrTag to MP4ESDescrTag
+	MP4DescriptorProperty* pEsProperty;
+	pIod->FindProperty("esIds", (MP4Property**)&pEsProperty);
+	pEsProperty->SetTags(MP4ESDescrTag);
+
+	MP4IntegerProperty* pSetProperty;
+
+	// OD
+	MP4Descriptor* pOdEsd =
+		pEsProperty->AddDescriptor(MP4ESDescrTag);
+	pOdEsd->Generate();
+
+	pOdEsd->FindProperty("ESID", 
+		(MP4Property**)&pSetProperty);
+	pSetProperty->SetValue(m_odTrackId);
+
+	pOdEsd->FindProperty("URLFlag", 
+		(MP4Property**)&pSetProperty);
+	pSetProperty->SetValue(1);
+
+	u_int8_t* pBytes;
+	u_int64_t numBytes;
+
+	CreateIsmaODUpdateCommandFromFileForStream(
+		audioTrackId, 
+		videoTrackId,
+		&pBytes, 
+		&numBytes);
+
+	VERBOSE_ISMA(GetVerbosity(),
+		printf("OD data =\n"); MP4HexDump(pBytes, numBytes));
+
+	char* odCmdBase64 = MP4ToBase64(pBytes, numBytes);
+
+	char* urlBuf = (char*)MP4Malloc(strlen(odCmdBase64) + 64);
+
+	sprintf(urlBuf, 
+		"data:application/mpeg4-od-au;base64,%s",
+		odCmdBase64);
+
+	MP4StringProperty* pUrlProperty;
+	pOdEsd->FindProperty("URL", 
+		(MP4Property**)&pUrlProperty);
+	pUrlProperty->SetValue(urlBuf);
+
+	VERBOSE_ISMA(GetVerbosity(),
+		printf("OD data URL = \042%s\042\n", urlBuf));
+
+	MP4Free(odCmdBase64);
+	odCmdBase64 = NULL;
+	MP4Free(pBytes);
+	pBytes = NULL;
+	MP4Free(urlBuf);
+	urlBuf = NULL;
+
+	MP4DescriptorProperty* pSrcDcd = NULL;
+
+	// HACK temporarily point to scene decoder config
+	FindProperty(MakeTrackName(odTrackId, 
+		"mdia.minf.stbl.stsd.mp4s.esds.decConfigDescr"),
+		(MP4Property**)&pSrcDcd);
+	ASSERT(pSrcDcd);
+	MP4Property* pOrgOdEsdProperty = 
+		pOdEsd->GetProperty(8);
+	pOdEsd->SetProperty(8, pSrcDcd);
+
+	// bufferSizeDB needs to be set appropriately
+	MP4BitfieldProperty* pBufferSizeProperty = NULL;
+	pOdEsd->FindProperty("decConfigDescr.bufferSizeDB",
+		(MP4Property**)&pBufferSizeProperty);
+	ASSERT(pBufferSizeProperty);
+	pBufferSizeProperty->SetValue(numBytes);
+
+	// SL config needs to change from 2 (file) to 1 (null)
+	pOdEsd->FindProperty("slConfigDescr.predefined", 
+		(MP4Property**)&pSetProperty);
+	pSetProperty->SetValue(1);
+
+
+	// Scene
+	MP4Descriptor* pSceneEsd =
+		pEsProperty->AddDescriptor(MP4ESDescrTag);
+	pSceneEsd->Generate();
+
+	pSceneEsd->FindProperty("ESID", 
+		(MP4Property**)&pSetProperty);
+	pSetProperty->SetValue(sceneTrackId);
+
+	pSceneEsd->FindProperty("URLFlag", 
+		(MP4Property**)&pSetProperty);
+	pSetProperty->SetValue(1);
+
+	CreateIsmaSceneCommand(
+		MP4_IS_VALID_TRACK_ID(audioTrackId), 
+		MP4_IS_VALID_TRACK_ID(videoTrackId),
+		&pBytes, 
+		&numBytes);
+
+	VERBOSE_ISMA(GetVerbosity(),
+		printf("Scene data =\n"); MP4HexDump(pBytes, numBytes));
+
+	char *sceneCmdBase64 = MP4ToBase64(pBytes, numBytes);
+
+	urlBuf = (char*)MP4Malloc(strlen(sceneCmdBase64) + 64);
+	sprintf(urlBuf, 
+		"data:application/mpeg4-bifs-au;base64,%s",
+		sceneCmdBase64);
+
+	pSceneEsd->FindProperty("URL", 
+		(MP4Property**)&pUrlProperty);
+	pUrlProperty->SetValue(urlBuf);
+
+	VERBOSE_ISMA(GetVerbosity(),
+		printf("Scene data URL = \042%s\042\n", urlBuf));
+
+	MP4Free(sceneCmdBase64);
+	sceneCmdBase64 = NULL;
+	MP4Free(urlBuf);
+	urlBuf = NULL;
+	MP4Free(pBytes);
+	pBytes = NULL;
+
+	// HACK temporarily point to scene decoder config
+	FindProperty(MakeTrackName(sceneTrackId, 
+		"mdia.minf.stbl.stsd.mp4s.esds.decConfigDescr"),
+		(MP4Property**)&pSrcDcd);
+	ASSERT(pSrcDcd);
+	MP4Property* pOrgSceneEsdProperty = 
+		pSceneEsd->GetProperty(8);
+	pSceneEsd->SetProperty(8, pSrcDcd);
+
+	// bufferSizeDB needs to be set
+	pBufferSizeProperty = NULL;
+	pSceneEsd->FindProperty("decConfigDescr.bufferSizeDB",
+		(MP4Property**)&pBufferSizeProperty);
+	ASSERT(pBufferSizeProperty);
+	pBufferSizeProperty->SetValue(numBytes);
+
+	// SL config needs to change from 2 (file) to 1 (null)
+	pSceneEsd->FindProperty("slConfigDescr.predefined", 
+		(MP4Property**)&pSetProperty);
+	pSetProperty->SetValue(1);
+
+
+	// finally get the whole thing written to a memory 
+	pIod->WriteToMemory(this, ppBytes, pNumBytes);
+
+
+	// now carefully replace esd properties before destroying
+	pOdEsd->SetProperty(8, pOrgOdEsdProperty);
+	pSceneEsd->SetProperty(8, pOrgSceneEsdProperty);
+
+	delete pIod;
+
+	VERBOSE_ISMA(GetVerbosity(),
+		printf("IOD data =\n"); MP4HexDump(*ppBytes, *pNumBytes));
+}
+
+void MP4File::CreateIsmaIodFromParams(
+	u_int8_t videoProfile,
+	u_int32_t videoBitrate,
+	u_int8_t* videoConfig,
+	u_int32_t videoConfigLength,
+	u_int8_t audioProfile,
+	u_int32_t audioBitrate,
+	u_int8_t* audioConfig,
+	u_int32_t audioConfigLength,
+	u_int8_t** ppIodBytes,
+	u_int64_t* pIodNumBytes)
+{
+	MP4IntegerProperty* pInt;
+	u_int8_t* pBytes = NULL;
+	u_int64_t numBytes;
+
+	// Create the IOD
+	MP4Descriptor* pIod = new MP4IODescriptor();
+	pIod->SetTag(MP4IODescrTag);
+	pIod->Generate();
+	
+	// Set audio and video profileLevels
+	pIod->FindProperty("audioProfileLevelId", 
+		(MP4Property**)&pInt);
+	pInt->SetValue(audioProfile);
+
+	pIod->FindProperty("visualProfileLevelId", 
+		(MP4Property**)&pInt);
+	pInt->SetValue(videoProfile);
+
+	// Mutate esIds from MP4ESIDIncDescrTag to MP4ESDescrTag
+	MP4DescriptorProperty* pEsProperty;
+	pIod->FindProperty("esIds", (MP4Property**)&pEsProperty);
+	pEsProperty->SetTags(MP4ESDescrTag);
+
+	// Add ES Descriptors
+
+	// Scene
+	CreateIsmaSceneCommand(
+		(audioProfile != 0xFF),
+		(videoProfile != 0xFF),
+		&pBytes, 
+		&numBytes);
+
+	VERBOSE_ISMA(GetVerbosity(),
+		printf("Scene data =\n"); MP4HexDump(pBytes, numBytes));
+
+	char* sceneCmdBase64 = MP4ToBase64(pBytes, numBytes);
+
+	char* urlBuf = 
+		(char*)MP4Malloc(strlen(sceneCmdBase64) + 64);
+	sprintf(urlBuf, 
+		"data:application/mpeg4-bifs-au;base64,%s",
+		sceneCmdBase64);
+
+	VERBOSE_ISMA(GetVerbosity(),
+		printf("Scene data URL = \042%s\042\n", urlBuf));
+
+	/* MP4Descriptor* pSceneEsd = */
+		CreateESD(
+			pEsProperty,
+			201,				// esid
+			MP4SystemsV2ObjectType,
+			MP4SceneDescriptionStreamType,
+			numBytes,			// bufferSize
+			numBytes * 8,		// bitrate
+			BifsV2Config,
+			sizeof(BifsV2Config),
+			urlBuf);
+
+	MP4Free(sceneCmdBase64);
+	sceneCmdBase64 = NULL;
+	MP4Free(urlBuf);
+	urlBuf = NULL;
+	MP4Free(pBytes);
+	pBytes = NULL;
+
+    // OD
+    
+	// Video
+	MP4DescriptorProperty* pVideoEsdProperty =
+		new MP4DescriptorProperty();
+    pVideoEsdProperty->SetTags(MP4ESDescrTag);
+
+	/* MP4Descriptor* pVideoEsd = */
+		CreateESD(
+			pVideoEsdProperty,
+			20,					// esid
+			MP4_MPEG4_VIDEO_TYPE,
+			MP4VisualStreamType,
+			videoBitrate / 8,	// bufferSize
+			videoBitrate,
+			videoConfig,
+			videoConfigLength,
+			NULL);
+
+	// Audio
+    MP4DescriptorProperty* pAudioEsdProperty =
+		new MP4DescriptorProperty();
+    pAudioEsdProperty->SetTags(MP4ESDescrTag);
+        
+	/* MP4Descriptor* pAudioEsd = */
+		CreateESD(
+			pAudioEsdProperty,
+			10,					// esid
+			MP4_MPEG4_AUDIO_TYPE,
+			MP4AudioStreamType,
+			audioBitrate / 8, 	// bufferSize
+			audioBitrate,
+			audioConfig,
+			audioConfigLength,
+			NULL);
+	
+	CreateIsmaODUpdateCommandForStream(
+		pAudioEsdProperty,
+		pVideoEsdProperty, 
+		&pBytes,
+		&numBytes);
+
+	// cleanup temporary descriptor properties
+    delete pAudioEsdProperty;
+    delete pVideoEsdProperty;
+
+	VERBOSE_ISMA(GetVerbosity(),
+		printf("OD data =\n"); MP4HexDump(pBytes, numBytes));
+
+	char* odCmdBase64 = MP4ToBase64(pBytes, numBytes);
+
+	urlBuf = (char*)MP4Malloc(strlen(odCmdBase64) + 64);
+
+	sprintf(urlBuf, 
+		"data:application/mpeg4-od-au;base64,%s",
+		odCmdBase64);
+
+	VERBOSE_ISMA(GetVerbosity(),
+		printf("OD data URL = \042%s\042\n", urlBuf));
+
+	/* MP4Descriptor* pOdEsd = */
+		CreateESD(
+			pEsProperty,
+			101,
+			MP4SystemsV1ObjectType,
+			MP4ObjectDescriptionStreamType,
+			numBytes,		// bufferSize
+			numBytes * 8,	// bitrate
+			NULL,			// config
+			0,				// configLength
+			urlBuf);
+
+	MP4Free(odCmdBase64);
+	odCmdBase64 = NULL;
+	MP4Free(pBytes);
+	pBytes = NULL;
+	MP4Free(urlBuf);
+	urlBuf = NULL;
+
+	// finally get the whole thing written to a memory 
+	pIod->WriteToMemory(this, ppIodBytes, pIodNumBytes);
+
+	delete pIod;
+
+	VERBOSE_ISMA(GetVerbosity(),
+		printf("IOD data =\n"); MP4HexDump(*ppIodBytes, *pIodNumBytes));
+}
+
+MP4Descriptor* MP4File::CreateESD(
+	MP4DescriptorProperty* pEsProperty,
+	u_int32_t esid,
+	u_int8_t objectType,
+	u_int8_t streamType,
+	u_int32_t bufferSize,
+	u_int32_t bitrate,
+	u_int8_t* pConfig,
+	u_int32_t configLength,
+	char* url)
+{
+	MP4IntegerProperty* pInt;
+	MP4StringProperty* pString;
+	MP4BytesProperty* pBytes;
+
+	MP4Descriptor* pEsd =
+		pEsProperty->AddDescriptor(MP4ESDescrTag);
+	pEsd->Generate();
+
+	pEsd->FindProperty("ESID", 
+		(MP4Property**)&pInt);
+	pInt->SetValue(esid);
+
+	pEsd->FindProperty("decConfigDescr.objectTypeId", 
+		(MP4Property**)&pInt);
+	pInt->SetValue(objectType);
+
+	pEsd->FindProperty("decConfigDescr.streamType", 
+		(MP4Property**)&pInt);
+	pInt->SetValue(streamType);
+
+	pEsd->FindProperty("decConfigDescr.bufferSizeDB", 
+		(MP4Property**)&pInt);
+	pInt->SetValue(bufferSize);
+
+	pEsd->FindProperty("decConfigDescr.maxBitrate", 
+		(MP4Property**)&pInt);
+	pInt->SetValue(bitrate);
+
+	pEsd->FindProperty("decConfigDescr.avgBitrate", 
+		(MP4Property**)&pInt);
+	pInt->SetValue(bitrate);
+	
+	MP4DescriptorProperty* pConfigDescrProperty;
+	pEsd->FindProperty("decConfigDescr.decSpecificInfo",
+		(MP4Property**)&pConfigDescrProperty);
+
+	MP4Descriptor* pConfigDescr =
+		pConfigDescrProperty->AddDescriptor(MP4DecSpecificDescrTag);
+	pConfigDescr->Generate();
+
+	pConfigDescrProperty->FindProperty("decSpecificInfo[0].info",
+		(MP4Property**)&pBytes);
+	pBytes->SetValue(pConfig, configLength);
+
+	pEsd->FindProperty("slConfigDescr.predefined", 
+		(MP4Property**)&pInt);
+	pInt->SetValue(1);
+
+	if (url) {
+		pEsd->FindProperty("URLFlag", 
+			(MP4Property**)&pInt);
+		pInt->SetValue(1);
+
+		pEsd->FindProperty("URL", 
+			(MP4Property**)&pString);
+		pString->SetValue(url);
+	}
+
+	return pEsd;
+}
+
+void MP4File::CreateIsmaODUpdateCommandFromFileForFile(
+	MP4TrackId odTrackId,
+	MP4TrackId audioTrackId, 
+	MP4TrackId videoTrackId,
+	u_int8_t** ppBytes,
+	u_int64_t* pNumBytes)
+{
+	MP4Descriptor* pCommand = CreateODCommand(MP4ODUpdateODCommandTag);
+	pCommand->Generate();
+
+	for (u_int8_t i = 0; i < 2; i++) {
+		MP4TrackId trackId;
+		u_int16_t odId;
+
+		if (i == 0) {
+			trackId = audioTrackId;
+			odId = 10;
+		} else {
+			trackId = videoTrackId;
+			odId = 20;
+		}
+
+		if (trackId == MP4_INVALID_TRACK_ID) {
+			continue;
+		}
+
+		MP4DescriptorProperty* pOdDescrProperty =
+				(MP4DescriptorProperty*)(pCommand->GetProperty(0));
+
+		pOdDescrProperty->SetTags(MP4FileODescrTag);
+
+		MP4Descriptor* pOd =
+			pOdDescrProperty->AddDescriptor(MP4FileODescrTag);
+
+		pOd->Generate();
+
+		MP4BitfieldProperty* pOdIdProperty = NULL;
+		pOd->FindProperty("objectDescriptorId", 
+			(MP4Property**)&pOdIdProperty);
+		pOdIdProperty->SetValue(odId);
+
+		MP4DescriptorProperty* pEsIdsDescriptorProperty = NULL;
+		pOd->FindProperty("esIds", 
+			(MP4Property**)&pEsIdsDescriptorProperty);
+		ASSERT(pEsIdsDescriptorProperty);
+
+		pEsIdsDescriptorProperty->SetTags(MP4ESIDRefDescrTag);
+
+		MP4Descriptor *pRefDescriptor =
+			pEsIdsDescriptorProperty->AddDescriptor(MP4ESIDRefDescrTag);
+		pRefDescriptor->Generate();
+
+		MP4Integer16Property* pRefIndexProperty = NULL;
+		pRefDescriptor->FindProperty("refIndex", 
+			(MP4Property**)&pRefIndexProperty);
+		ASSERT(pRefIndexProperty);
+
+		u_int32_t mpodIndex = FindTrackReference(
+			MakeTrackName(odTrackId, "tref.mpod"), trackId);
+		ASSERT(mpodIndex != 0);
+
+		pRefIndexProperty->SetValue(mpodIndex);
+	}
+
+	pCommand->WriteToMemory(this, ppBytes, pNumBytes);
+
+	delete pCommand;
+}
+
+void MP4File::CreateIsmaODUpdateCommandFromFileForStream(
+	MP4TrackId audioTrackId, 
+	MP4TrackId videoTrackId,
+	u_int8_t** ppBytes,
+	u_int64_t* pNumBytes)
+{
+	MP4DescriptorProperty* pAudioEsd = NULL;
+	MP4Integer8Property* pAudioSLConfig = NULL;
+	MP4DescriptorProperty* pVideoEsd = NULL;
+	MP4Integer8Property* pVideoSLConfig = NULL;
+
+	if (audioTrackId != MP4_INVALID_TRACK_ID) {
+		MP4Atom* pEsdsAtom = 
+			FindAtom(MakeTrackName(audioTrackId, 
+				"mdia.minf.stbl.stsd.mp4a.esds"));
+		ASSERT(pEsdsAtom);
+
+		pAudioEsd = (MP4DescriptorProperty*)(pEsdsAtom->GetProperty(2));
+
+		// SL config needs to change from 2 (file) to 1 (null)
+		pAudioEsd->FindProperty("slConfigDescr.predefined", 
+			(MP4Property**)&pAudioSLConfig);
+		ASSERT(pAudioSLConfig);
+		pAudioSLConfig->SetValue(1);
+	}
+
+	if (videoTrackId != MP4_INVALID_TRACK_ID) {
+		MP4Atom* pEsdsAtom = 
+			FindAtom(MakeTrackName(videoTrackId, 
+				"mdia.minf.stbl.stsd.mp4v.esds"));
+		ASSERT(pEsdsAtom);
+
+		pVideoEsd = (MP4DescriptorProperty*)(pEsdsAtom->GetProperty(2));
+
+		// SL config needs to change from 2 (file) to 1 (null)
+		pVideoEsd->FindProperty("slConfigDescr.predefined", 
+			(MP4Property**)&pVideoSLConfig);
+		ASSERT(pVideoSLConfig);
+		pVideoSLConfig->SetValue(1);
+	}
+
+	CreateIsmaODUpdateCommandForStream(
+		pAudioEsd, pVideoEsd, ppBytes, pNumBytes);
+			
+	// return SL config values to 2 (file)
+	if (pAudioSLConfig) {
+		pAudioSLConfig->SetValue(2);
+	}
+	if (pVideoSLConfig) {
+		pVideoSLConfig->SetValue(2);
+	}
+}
+
+void MP4File::CreateIsmaODUpdateCommandForStream(
+	MP4DescriptorProperty* pAudioEsdProperty, 
+	MP4DescriptorProperty* pVideoEsdProperty,
+	u_int8_t** ppBytes,
+	u_int64_t* pNumBytes)
+{
+	MP4Descriptor* pAudioOd = NULL;
+	MP4Descriptor* pVideoOd = NULL;
+
+	MP4Descriptor* pCommand = 
+		CreateODCommand(MP4ODUpdateODCommandTag);
+	pCommand->Generate();
+
+	for (u_int8_t i = 0; i < 2; i++) {
+		u_int16_t odId;
+		MP4DescriptorProperty* pEsdProperty = NULL;
+
+		if (i == 0) {
+			odId = 10;
+			pEsdProperty = pAudioEsdProperty;
+		} else {
+			odId = 20;
+			pEsdProperty = pVideoEsdProperty;
+		}
+
+		if (pEsdProperty == NULL) {
+			continue;
+		}
+
+		MP4DescriptorProperty* pOdDescrProperty =
+			(MP4DescriptorProperty*)(pCommand->GetProperty(0));
+
+		pOdDescrProperty->SetTags(MP4ODescrTag);
+
+		MP4Descriptor* pOd =
+			pOdDescrProperty->AddDescriptor(MP4ODescrTag);
+		pOd->Generate();
+
+		if (i == 0) {
+			pAudioOd = pOd;
+		} else {
+			pVideoOd = pOd;
+		}
+
+		MP4BitfieldProperty* pOdIdProperty = NULL;
+		pOd->FindProperty("objectDescriptorId", 
+			(MP4Property**)&pOdIdProperty);
+		pOdIdProperty->SetValue(odId);
+
+		delete (MP4DescriptorProperty*)pOd->GetProperty(4);
+		pOd->SetProperty(4, pEsdProperty);
+	}
+
+	// serialize OD command
+	pCommand->WriteToMemory(this, ppBytes, pNumBytes);
+
+	// detach from esd descriptor params
+	if (pAudioOd) {
+		pAudioOd->SetProperty(4, NULL);
+	}
+	if (pVideoOd) {
+		pVideoOd->SetProperty(4, NULL);
+	}
+
+	// then destroy
+	delete pCommand;
+}
+
+void MP4File::CreateIsmaSceneCommand(
+	bool hasAudio,
+	bool hasVideo,
+	u_int8_t** ppBytes,
+	u_int64_t* pNumBytes)
+{
+	// from ISMA 1.0 Tech Spec Appendix E
+	static u_int8_t bifsAudioOnly[] = {
+		0xC0, 0x10, 0x12, 
+		0x81, 0x30, 0x2A, 0x05, 0x6D, 0xC0
+	};
+	static u_int8_t bifsVideoOnly[] = {
+		0xC0, 0x10, 0x12, 
+		0x61, 0x04, 
+			0x1F, 0xC0, 0x00, 0x00, 
+			0x1F, 0xC0, 0x00, 0x00,
+		0x44, 0x28, 0x22, 0x82, 0x9F, 0x80
+	};
+	static u_int8_t bifsAudioVideo[] = {
+		0xC0, 0x10, 0x12, 
+		0x81, 0x30, 0x2A, 0x05, 0x6D, 0x26,
+		0x10, 0x41, 0xFC, 0x00, 0x00, 0x01, 0xFC, 0x00, 0x00,
+		0x04, 0x42, 0x82, 0x28, 0x29, 0xF8
+	};
+
+	if (hasAudio && hasVideo) {
+		*pNumBytes = sizeof(bifsAudioVideo);
+		*ppBytes = (u_int8_t*)MP4Malloc(*pNumBytes);
+		memcpy(*ppBytes, bifsAudioVideo, sizeof(bifsAudioVideo));
+
+	} else if (hasAudio) {
+		*pNumBytes = sizeof(bifsAudioOnly);
+		*ppBytes = (u_int8_t*)MP4Malloc(*pNumBytes);
+		memcpy(*ppBytes, bifsAudioOnly, sizeof(bifsAudioOnly));
+
+	} else if (hasVideo) {
+		*pNumBytes = sizeof(bifsVideoOnly);
+		*ppBytes = (u_int8_t*)MP4Malloc(*pNumBytes);
+		memcpy(*ppBytes, bifsVideoOnly, sizeof(bifsVideoOnly));
+	} else {
+		*pNumBytes = 0;
+		*ppBytes = NULL;
+	}
+}	
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/libmp4v260.dsp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,493 @@
+# Microsoft Developer Studio Project File - Name="libmp4v2" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=libmp4v2 - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "libmp4v260.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "libmp4v260.mak" CFG="libmp4v2 - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "libmp4v2 - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "libmp4v2 - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "libmp4v2 - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# SUBTRACT CPP /Fr
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF  "$(CFG)" == "libmp4v2 - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ENDIF 
+
+# Begin Target
+
+# Name "libmp4v2 - Win32 Release"
+# Name "libmp4v2 - Win32 Debug"
+# Begin Group "source"
+
+# PROP Default_Filter ".c, .cpp"
+# Begin Source File
+
+SOURCE=.\atom_co64.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_cprt.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_ctts.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_dimm.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_dinf.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_dmax.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_dmed.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_dref.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_drep.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_edts.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_elst.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_esds.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_free.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_ftyp.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_hdlr.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_hinf.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_hmhd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_hnti.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_iods.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_maxr.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_mdat.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_mdhd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_mdia.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_mfhd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_minf.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_moof.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_moov.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_mp4a.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_mp4s.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_mp4v.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_mvex.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_mvhd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_nmhd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_nump.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_payt.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_pmax.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_root.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_rtp.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_sdp.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_smhd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_snro.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_stbl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_stco.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_stdp.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_stsc.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_stsd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_stsh.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_stss.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_stsz.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_stts.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_tfhd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_tims.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_tkhd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_tmax.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_tmin.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_tpyl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_traf.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_trak.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_tref.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_treftype.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_trex.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_trpy.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_trun.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_tsro.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_udta.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_url.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_urn.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_vmhd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\descriptors.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\isma.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4atom.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4container.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4descriptor.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4file.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4file_io.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4info.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4property.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4track.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4util.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ocidescriptors.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\odcommands.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\qosqualifiers.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\rtphint.cpp
+# End Source File
+# End Group
+# Begin Group "include"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=.\atoms.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\descriptors.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4array.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4atom.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4common.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4container.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4descriptor.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4file.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4property.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4track.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4util.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ocidescriptors.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\odcommands.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\qosqualifiers.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\rtphint.h
+# End Source File
+# End Group
+# End Target
+# End Project
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/libmp4v2_st60.dsp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,492 @@
+# Microsoft Developer Studio Project File - Name="libmp4v2_st" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=libmp4v2_st - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "libmp4v2_st60.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "libmp4v2_st60.mak" CFG="libmp4v2_st - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "libmp4v2_st - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "libmp4v2_st - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "libmp4v2_st - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "ST_Release"
+# PROP Intermediate_Dir "ST_Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF  "$(CFG)" == "libmp4v2_st - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "ST_Debug"
+# PROP Intermediate_Dir "ST_Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ENDIF 
+
+# Begin Target
+
+# Name "libmp4v2_st - Win32 Release"
+# Name "libmp4v2_st - Win32 Debug"
+# Begin Group "source"
+
+# PROP Default_Filter ".c, .cpp"
+# Begin Source File
+
+SOURCE=.\atom_co64.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_cprt.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_ctts.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_dimm.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_dinf.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_dmax.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_dmed.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_dref.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_drep.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_edts.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_elst.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_esds.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_free.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_ftyp.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_hdlr.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_hinf.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_hmhd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_hnti.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_iods.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_maxr.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_mdat.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_mdhd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_mdia.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_mfhd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_minf.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_moof.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_moov.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_mp4a.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_mp4s.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_mp4v.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_mvex.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_mvhd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_nmhd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_nump.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_payt.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_pmax.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_root.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_rtp.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_sdp.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_smhd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_snro.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_stbl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_stco.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_stdp.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_stsc.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_stsd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_stsh.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_stss.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_stsz.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_stts.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_tfhd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_tims.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_tkhd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_tmax.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_tmin.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_tpyl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_traf.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_trak.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_tref.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_treftype.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_trex.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_trpy.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_trun.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_tsro.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_udta.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_url.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_urn.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_vmhd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\descriptors.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\isma.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4atom.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4container.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4descriptor.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4file.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4file_io.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4property.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4track.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4util.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ocidescriptors.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\odcommands.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\qosqualifiers.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\rtphint.cpp
+# End Source File
+# End Group
+# Begin Group "include"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=.\atoms.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\descriptors.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4array.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4atom.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4common.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4container.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4descriptor.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4file.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4property.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4track.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4util.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ocidescriptors.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\odcommands.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\qosqualifiers.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\rtphint.h
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\mp4info.cpp
+# End Source File
+# End Target
+# End Project
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/mp4.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,2448 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+/* 
+ * MP4 library API functions
+ * 
+ * These are wrapper functions that provide C linkage conventions
+ * to the library, and catch any internal errors, ensuring that
+ * a proper return value is given.
+ */
+
+#include "mp4common.h"
+
+#define PRINT_ERROR(e) \
+	VERBOSE_ERROR(((MP4File*)hFile)->GetVerbosity(), e->Print());
+
+/* file operations */
+
+extern "C" MP4FileHandle MP4Read(const char* fileName, u_int32_t verbosity)
+{
+	MP4File* pFile = NULL;
+	try {
+		pFile = new MP4File(verbosity);
+		pFile->Read(fileName);
+		return (MP4FileHandle)pFile;
+	}
+	catch (MP4Error* e) {
+		VERBOSE_ERROR(verbosity, e->Print());
+		delete e;
+		delete pFile;
+		return MP4_INVALID_FILE_HANDLE;
+	}
+}
+
+extern "C" MP4FileHandle MP4Create(const char* fileName, 
+	u_int32_t verbosity, bool use64bits, bool useExtensibleFormat)
+{
+	MP4File* pFile = NULL;
+	try {
+		pFile = new MP4File(verbosity);
+		// LATER useExtensibleFormat, moov first, then mvex's
+		pFile->Create(fileName, use64bits);
+		return (MP4FileHandle)pFile;
+	}
+	catch (MP4Error* e) {
+		VERBOSE_ERROR(verbosity, e->Print());
+		delete e;
+		delete pFile;
+		return MP4_INVALID_FILE_HANDLE;
+	}
+}
+
+extern "C" MP4FileHandle MP4Modify(const char* fileName, 
+	u_int32_t verbosity, bool useExtensibleFormat)
+{
+	MP4File* pFile = NULL;
+	try {
+		pFile = new MP4File(verbosity);
+		// LATER useExtensibleFormat, moov first, then mvex's
+		pFile->Modify(fileName);
+		return (MP4FileHandle)pFile;
+	}
+	catch (MP4Error* e) {
+		VERBOSE_ERROR(verbosity, e->Print());
+		delete e;
+		delete pFile;
+		return MP4_INVALID_FILE_HANDLE;
+	}
+}
+
+extern "C" bool MP4Optimize(const char* existingFileName, 
+	const char* newFileName, 
+	u_int32_t verbosity)
+{
+	try {
+		MP4File* pFile = new MP4File(verbosity);
+		pFile->Optimize(existingFileName, newFileName);
+		delete pFile;
+		return true;
+	}
+	catch (MP4Error* e) {
+		VERBOSE_ERROR(verbosity, e->Print());
+		delete e;
+	}
+	return false;
+}
+
+extern "C" bool MP4Close(MP4FileHandle hFile)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->Close();
+			delete (MP4File*)hFile;
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" bool MP4Dump(
+	MP4FileHandle hFile, 
+	FILE* pDumpFile, 
+	bool dumpImplicits)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->Dump(pDumpFile, dumpImplicits);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+
+/* specific file properties */
+
+extern "C" u_int32_t MP4GetVerbosity(MP4FileHandle hFile)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetVerbosity();
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return 0;
+}
+
+extern "C" bool MP4SetVerbosity(MP4FileHandle hFile, u_int32_t verbosity)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetVerbosity(verbosity);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" MP4Duration MP4GetDuration(MP4FileHandle hFile)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetDuration();
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_DURATION;
+}
+
+extern "C" u_int32_t MP4GetTimeScale(MP4FileHandle hFile)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetTimeScale();
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return 0;
+}
+
+extern "C" bool MP4SetTimeScale(MP4FileHandle hFile, u_int32_t value)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetTimeScale(value);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" u_int8_t MP4GetODProfileLevel(MP4FileHandle hFile)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetODProfileLevel();
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return 0;
+}
+
+extern "C" bool MP4SetODProfileLevel(MP4FileHandle hFile, u_int8_t value)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetODProfileLevel(value);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" u_int8_t MP4GetSceneProfileLevel(MP4FileHandle hFile)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetSceneProfileLevel();
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return 0;
+}
+
+extern "C" bool MP4SetSceneProfileLevel(MP4FileHandle hFile, u_int8_t value)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetSceneProfileLevel(value);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" u_int8_t MP4GetVideoProfileLevel(MP4FileHandle hFile)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetVideoProfileLevel();
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return 0;
+}
+
+extern "C" bool MP4SetVideoProfileLevel(MP4FileHandle hFile, u_int8_t value)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetVideoProfileLevel(value);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" u_int8_t MP4GetAudioProfileLevel(MP4FileHandle hFile)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetAudioProfileLevel();
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return 0;
+}
+
+extern "C" bool MP4SetAudioProfileLevel(MP4FileHandle hFile, u_int8_t value)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetAudioProfileLevel(value);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" u_int8_t MP4GetGraphicsProfileLevel(MP4FileHandle hFile)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetGraphicsProfileLevel();
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return 0;
+}
+
+extern "C" bool MP4SetGraphicsProfileLevel(MP4FileHandle hFile, u_int8_t value)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetGraphicsProfileLevel(value);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+/* generic file properties */
+
+extern "C" u_int64_t MP4GetIntegerProperty(
+	MP4FileHandle hFile, const char* propName)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetIntegerProperty(propName);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return (u_int64_t)-1;
+}
+
+extern "C" float MP4GetFloatProperty(
+	MP4FileHandle hFile, const char* propName)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetFloatProperty(propName);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return NAN;
+}
+
+extern "C" const char* MP4GetStringProperty(
+	MP4FileHandle hFile, const char* propName)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetStringProperty(propName);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return NULL;
+}
+
+extern "C" void MP4GetBytesProperty(
+	MP4FileHandle hFile, const char* propName, 
+	u_int8_t** ppValue, u_int32_t* pValueSize)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->GetBytesProperty(propName, ppValue, pValueSize);
+			return;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	*ppValue = NULL;
+	*pValueSize = 0;
+	return;
+}
+
+extern "C" bool MP4SetIntegerProperty(
+	MP4FileHandle hFile, const char* propName, int64_t value)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetIntegerProperty(propName, value);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" bool MP4SetFloatProperty(
+	MP4FileHandle hFile, const char* propName, float value)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetFloatProperty(propName, value);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" bool MP4SetStringProperty(
+	MP4FileHandle hFile, const char* propName, const char* value)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetStringProperty(propName, value);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" bool MP4SetBytesProperty(
+	MP4FileHandle hFile, const char* propName, 
+	const u_int8_t* pValue, u_int32_t valueSize)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetBytesProperty(propName, pValue, valueSize);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+/* track operations */
+
+extern "C" MP4TrackId MP4AddTrack(
+	MP4FileHandle hFile, const char* type)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->AddSystemsTrack(type);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_TRACK_ID;
+}
+
+extern "C" MP4TrackId MP4AddSystemsTrack(
+	MP4FileHandle hFile, const char* type)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->AddSystemsTrack(type);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_TRACK_ID;
+}
+
+extern "C" MP4TrackId MP4AddODTrack(MP4FileHandle hFile)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->AddODTrack();
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_TRACK_ID;
+}
+
+extern "C" MP4TrackId MP4AddSceneTrack(MP4FileHandle hFile)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->AddSceneTrack();
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_TRACK_ID;
+}
+
+extern "C" MP4TrackId MP4AddAudioTrack(
+	MP4FileHandle hFile, 
+	u_int32_t timeScale, 
+	MP4Duration sampleDuration, 
+	u_int8_t audioType)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->
+				AddAudioTrack(timeScale, sampleDuration, audioType);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_TRACK_ID;
+}
+
+extern "C" MP4TrackId MP4AddVideoTrack(
+	MP4FileHandle hFile, 
+	u_int32_t timeScale, 
+	MP4Duration sampleDuration,
+	u_int16_t width, 
+	u_int16_t height, 
+	u_int8_t videoType)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->AddVideoTrack(
+				timeScale, sampleDuration, width, height, videoType);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_TRACK_ID;
+}
+
+extern "C" MP4TrackId MP4AddHintTrack(
+	MP4FileHandle hFile, MP4TrackId refTrackId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->AddHintTrack(refTrackId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_TRACK_ID;
+}
+
+extern "C" MP4TrackId MP4CloneTrack(
+	MP4FileHandle srcFile, 
+	MP4TrackId srcTrackId,
+	MP4FileHandle dstFile)
+{
+	MP4TrackId dstTrackId = MP4_INVALID_TRACK_ID;
+
+	if (dstFile == NULL) {
+		dstFile = srcFile;
+	}
+
+	const char* trackType = 
+		MP4GetTrackType(srcFile, srcTrackId);
+
+	if (!trackType) {
+		return dstTrackId;
+	}
+
+	if (MP4_IS_VIDEO_TRACK_TYPE(trackType)) {
+		dstTrackId = MP4AddVideoTrack(
+			dstFile,
+			MP4GetTrackTimeScale(srcFile, srcTrackId),
+			MP4GetTrackFixedSampleDuration(srcFile, srcTrackId),
+			MP4GetTrackVideoWidth(srcFile, srcTrackId),
+			MP4GetTrackVideoHeight(srcFile, srcTrackId),
+			MP4GetTrackVideoType(srcFile, srcTrackId));
+
+	} else if (MP4_IS_AUDIO_TRACK_TYPE(trackType)) {
+		dstTrackId = MP4AddAudioTrack(
+			dstFile,
+			MP4GetTrackTimeScale(srcFile, srcTrackId),
+			MP4GetTrackFixedSampleDuration(srcFile, srcTrackId),
+			MP4GetTrackAudioType(srcFile, srcTrackId));
+
+	} else if (MP4_IS_OD_TRACK_TYPE(trackType)) {
+		dstTrackId = MP4AddODTrack(dstFile);
+
+	} else if (MP4_IS_SCENE_TRACK_TYPE(trackType)) {
+		dstTrackId = MP4AddSceneTrack(dstFile);
+
+	} else if (MP4_IS_HINT_TRACK_TYPE(trackType)) {
+		dstTrackId = MP4AddHintTrack(
+			dstFile,
+			MP4GetHintTrackReferenceTrackId(srcFile, srcTrackId));
+
+	} else if (MP4_IS_SYSTEMS_TRACK_TYPE(trackType)) {
+		dstTrackId = MP4AddSystemsTrack(dstFile, trackType);
+
+	} else {
+		dstTrackId = MP4AddTrack(dstFile, trackType);
+	}
+
+	if (dstTrackId == MP4_INVALID_TRACK_ID) {
+		return dstTrackId;
+	}
+
+	MP4SetTrackTimeScale(
+		dstFile, 
+		dstTrackId,
+		MP4GetTrackTimeScale(srcFile, srcTrackId));
+
+	// copy track ES configuration
+	u_int8_t* pConfig = NULL;
+	u_int32_t configSize = 0;
+
+	MP4GetTrackESConfiguration(
+		srcFile, 
+		srcTrackId,
+		&pConfig,
+		&configSize);
+
+	MP4SetTrackESConfiguration(
+		dstFile, 
+		dstTrackId,
+		pConfig,
+		configSize);
+
+		free(pConfig);
+
+	if (MP4_IS_HINT_TRACK_TYPE(trackType)) {
+		// probably not exactly what is wanted
+		// but caller can adjust later to fit their desires
+
+		char* payloadName = NULL;
+		char *encodingParms = NULL;
+		u_int8_t payloadNumber;
+		u_int16_t maxPayloadSize;
+
+		MP4GetHintTrackRtpPayload(
+			srcFile,
+			srcTrackId,
+			&payloadName,
+			&payloadNumber,
+			&maxPayloadSize,
+			&encodingParms);
+
+		MP4SetHintTrackRtpPayload(
+			dstFile,
+			dstTrackId,
+			payloadName,
+			&payloadNumber,
+			maxPayloadSize,
+			encodingParms);
+
+		MP4SetHintTrackSdp(
+			dstFile,
+			dstTrackId,
+			MP4GetHintTrackSdp(srcFile, srcTrackId));
+	}
+
+	return dstTrackId;
+}
+
+extern "C" MP4TrackId MP4CopyTrack(
+	MP4FileHandle srcFile, 
+	MP4TrackId srcTrackId,
+	MP4FileHandle dstFile, 
+	bool applyEdits)
+{
+	bool copySamples = true;	// LATER allow false => reference samples
+
+	MP4TrackId dstTrackId =
+		MP4CloneTrack(srcFile, srcTrackId, dstFile);
+
+	if (dstTrackId == MP4_INVALID_TRACK_ID) {
+		return dstTrackId;
+	}
+
+	bool viaEdits =
+		applyEdits && MP4GetTrackNumberOfEdits(srcFile, srcTrackId);
+
+	MP4SampleId sampleId = 0;
+	MP4SampleId numSamples = 
+		MP4GetTrackNumberOfSamples(srcFile, srcTrackId);
+
+	MP4Timestamp when = 0;
+	MP4Duration editsDuration = 
+		MP4GetTrackEditTotalDuration(srcFile, srcTrackId);
+
+	while (true) {
+		MP4Duration sampleDuration = MP4_INVALID_DURATION;
+
+		if (viaEdits) {
+			sampleId = MP4GetSampleIdFromEditTime(
+				srcFile,
+				srcTrackId,
+				when,
+				NULL,
+				&sampleDuration);
+
+			// in theory, this shouldn't happen
+			if (sampleId == MP4_INVALID_SAMPLE_ID) {
+				MP4DeleteTrack(dstFile, dstTrackId);
+				return MP4_INVALID_TRACK_ID;
+			}
+
+			when += sampleDuration;
+
+			if (when >= editsDuration) {
+				break;
+			}
+		} else {
+			sampleId++;
+			if (sampleId > numSamples) {
+				break;
+			}
+		}
+
+		bool rc = false;
+
+		if (copySamples) {
+			rc = MP4CopySample(
+				srcFile,
+				srcTrackId,
+				sampleId,
+				dstFile,
+				dstTrackId,
+				sampleDuration);
+
+		} else {
+			rc = MP4ReferenceSample(
+				srcFile,
+				srcTrackId,
+				sampleId,
+				dstFile,
+				dstTrackId,
+				sampleDuration);
+		}
+
+		if (!rc) {
+			MP4DeleteTrack(dstFile, dstTrackId);
+			return MP4_INVALID_TRACK_ID;
+		}
+	}
+
+	return dstTrackId;
+}
+
+extern "C" bool MP4DeleteTrack(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->DeleteTrack(trackId);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" u_int32_t MP4GetNumberOfTracks(
+	MP4FileHandle hFile, 
+	const char* type,
+	u_int8_t subType)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetNumberOfTracks(type, subType);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return 0;
+}
+
+extern "C" MP4TrackId MP4FindTrackId(
+	MP4FileHandle hFile, 
+	u_int16_t index, 
+	const char* type,
+	u_int8_t subType)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->FindTrackId(index, type, subType);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_TRACK_ID;
+}
+
+extern "C" u_int16_t MP4FindTrackIndex(
+	MP4FileHandle hFile, MP4TrackId trackId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->FindTrackIndex(trackId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return (u_int16_t)-1;
+}
+
+/* specific track properties */
+
+extern "C" const char* MP4GetTrackType(
+	MP4FileHandle hFile, MP4TrackId trackId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetTrackType(trackId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return NULL;
+}
+
+extern "C" MP4Duration MP4GetTrackDuration(
+	MP4FileHandle hFile, MP4TrackId trackId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetTrackDuration(trackId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_DURATION;
+}
+
+extern "C" u_int32_t MP4GetTrackTimeScale(
+	MP4FileHandle hFile, MP4TrackId trackId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetTrackTimeScale(trackId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return 0;
+}
+
+extern "C" bool MP4SetTrackTimeScale(
+	MP4FileHandle hFile, MP4TrackId trackId, u_int32_t value)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetTrackTimeScale(trackId, value);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" u_int8_t MP4GetTrackAudioType(
+	MP4FileHandle hFile, MP4TrackId trackId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetTrackAudioType(trackId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_AUDIO_TYPE;
+}
+
+extern "C" u_int8_t MP4GetTrackAudioMpeg4Type(
+	MP4FileHandle hFile, MP4TrackId trackId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetTrackAudioMpeg4Type(trackId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_MPEG4_INVALID_AUDIO_TYPE;
+}
+
+
+extern "C" u_int8_t MP4GetTrackVideoType(
+	MP4FileHandle hFile, MP4TrackId trackId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetTrackVideoType(trackId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_VIDEO_TYPE;
+}
+
+extern "C" MP4Duration MP4GetTrackFixedSampleDuration(
+	MP4FileHandle hFile, MP4TrackId trackId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetTrackFixedSampleDuration(trackId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_DURATION;
+}
+
+extern "C" u_int32_t MP4GetTrackBitRate(
+	MP4FileHandle hFile, MP4TrackId trackId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetTrackIntegerProperty(trackId,
+				"mdia.minf.stbl.stsd.*.esds.decConfigDescr.avgBitrate");
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return 0;
+}
+
+extern "C" void MP4GetTrackESConfiguration(
+	MP4FileHandle hFile, MP4TrackId trackId, 
+	u_int8_t** ppConfig, u_int32_t* pConfigSize)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->GetTrackESConfiguration(
+				trackId, ppConfig, pConfigSize);
+			return;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	*ppConfig = NULL;
+	*pConfigSize = 0;
+	return;
+}
+
+extern "C" bool MP4SetTrackESConfiguration(
+	MP4FileHandle hFile, MP4TrackId trackId, 
+	const u_int8_t* pConfig, u_int32_t configSize)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetTrackESConfiguration(
+				trackId, pConfig, configSize);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" MP4SampleId MP4GetTrackNumberOfSamples(
+	MP4FileHandle hFile, MP4TrackId trackId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetTrackNumberOfSamples(trackId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return 0;
+}
+
+extern "C" u_int16_t MP4GetTrackVideoWidth(
+	MP4FileHandle hFile, MP4TrackId trackId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetTrackIntegerProperty(trackId,
+				"mdia.minf.stbl.stsd.mp4v.width");
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return 0;
+}
+
+extern "C" u_int16_t MP4GetTrackVideoHeight(
+	MP4FileHandle hFile, MP4TrackId trackId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetTrackIntegerProperty(trackId,
+				"mdia.minf.stbl.stsd.mp4v.height");
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return 0;
+}
+
+extern "C" float MP4GetTrackVideoFrameRate(
+	MP4FileHandle hFile, MP4TrackId trackId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetTrackVideoFrameRate(trackId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return 0.0;
+}
+
+/* generic track properties */
+
+extern "C" u_int64_t MP4GetTrackIntegerProperty(
+	MP4FileHandle hFile, MP4TrackId trackId, 
+	const char* propName)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetTrackIntegerProperty(trackId, 
+				propName);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return (u_int64_t)-1;
+}
+
+extern "C" float MP4GetTrackFloatProperty(
+	MP4FileHandle hFile, MP4TrackId trackId, 
+	const char* propName)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetTrackFloatProperty(trackId, propName);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return NAN;
+}
+
+extern "C" const char* MP4GetTrackStringProperty(
+	MP4FileHandle hFile, MP4TrackId trackId, 
+	const char* propName)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetTrackStringProperty(trackId, propName);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return NULL;
+}
+
+extern "C" void MP4GetTrackBytesProperty(
+	MP4FileHandle hFile, MP4TrackId trackId, const char* propName, 
+	u_int8_t** ppValue, u_int32_t* pValueSize)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->GetTrackBytesProperty(
+				trackId, propName, ppValue, pValueSize);
+			return;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	*ppValue = NULL;
+	*pValueSize = 0;
+	return;
+}
+
+extern "C" bool MP4SetTrackIntegerProperty(
+	MP4FileHandle hFile, MP4TrackId trackId, 
+	const char* propName, int64_t value)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetTrackIntegerProperty(trackId, 
+				propName, value);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" bool MP4SetTrackFloatProperty(
+	MP4FileHandle hFile, MP4TrackId trackId, 
+	const char* propName, float value)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetTrackFloatProperty(trackId, propName, value);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" bool MP4SetTrackStringProperty(
+	MP4FileHandle hFile, MP4TrackId trackId, 
+	const char* propName, const char* value)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetTrackStringProperty(trackId, propName, value);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" bool MP4SetTrackBytesProperty(
+	MP4FileHandle hFile, MP4TrackId trackId, 
+	const char* propName, const u_int8_t* pValue, u_int32_t valueSize)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetTrackBytesProperty(
+				trackId, propName, pValue, valueSize);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+/* sample operations */
+
+extern "C" bool MP4ReadSample(
+	/* input parameters */
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4SampleId sampleId,
+	/* output parameters */
+	u_int8_t** ppBytes, 
+	u_int32_t* pNumBytes, 
+	MP4Timestamp* pStartTime, 
+	MP4Duration* pDuration,
+	MP4Duration* pRenderingOffset, 
+	bool* pIsSyncSample)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->ReadSample(
+				trackId, 
+				sampleId, 
+				ppBytes, 
+				pNumBytes, 
+				pStartTime, 
+				pDuration, 
+				pRenderingOffset, 
+				pIsSyncSample);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	*pNumBytes = 0;
+	return false;
+}
+
+extern "C" bool MP4ReadSampleFromTime(
+	/* input parameters */
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4Timestamp when,
+	/* output parameters */
+	u_int8_t** ppBytes, 
+	u_int32_t* pNumBytes, 
+	MP4Timestamp* pStartTime, 
+	MP4Duration* pDuration,
+	MP4Duration* pRenderingOffset, 
+	bool* pIsSyncSample)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			MP4SampleId sampleId = 
+				((MP4File*)hFile)->GetSampleIdFromTime(
+					trackId, when, false);
+
+			((MP4File*)hFile)->ReadSample(
+				trackId, 
+				sampleId, 
+				ppBytes, 
+				pNumBytes, 
+				pStartTime, 
+				pDuration, 
+				pRenderingOffset, 
+				pIsSyncSample);
+
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	*pNumBytes = 0;
+	return false;
+}
+
+extern "C" bool MP4WriteSample(
+	MP4FileHandle hFile,
+	MP4TrackId trackId,
+	u_int8_t* pBytes, 
+	u_int32_t numBytes,
+	MP4Duration duration,
+	MP4Duration renderingOffset, 
+	bool isSyncSample)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->WriteSample(
+				trackId, 
+				pBytes, 
+				numBytes, 
+				duration, 
+				renderingOffset, 
+				isSyncSample);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" bool MP4CopySample(
+	MP4FileHandle srcFile,
+	MP4TrackId srcTrackId, 
+	MP4SampleId srcSampleId,
+	MP4FileHandle dstFile,
+	MP4TrackId dstTrackId,
+	MP4Duration dstSampleDuration)
+{
+	bool rc;
+	u_int8_t* pBytes = NULL; 
+	u_int32_t numBytes = 0;
+	MP4Duration sampleDuration;
+	MP4Duration renderingOffset;
+	bool isSyncSample;
+
+	// Note: we leave it up to the caller to ensure that the
+	// source and destination tracks are compatible.
+	// i.e. copying audio samples into a video track 
+	// is unlikely to do anything useful
+
+	rc = MP4ReadSample(
+		srcFile,
+		srcTrackId,
+		srcSampleId,
+		&pBytes,
+		&numBytes,
+		NULL,
+		&sampleDuration,
+		&renderingOffset,
+		&isSyncSample);
+
+	if (!rc) {
+		return false;
+	}
+
+	if (dstFile == MP4_INVALID_FILE_HANDLE) {
+		dstFile = srcFile;
+	}
+	if (dstTrackId == MP4_INVALID_TRACK_ID) {
+		dstTrackId = srcTrackId;
+	}
+	if (dstSampleDuration != MP4_INVALID_DURATION) {
+		sampleDuration = dstSampleDuration;
+	}
+
+	rc = MP4WriteSample(
+		dstFile,
+		dstTrackId,
+		pBytes,
+		numBytes,
+		sampleDuration,
+		renderingOffset,		
+		isSyncSample);
+
+	free(pBytes);
+
+	return rc;
+}
+
+extern "C" bool MP4ReferenceSample(
+	MP4FileHandle srcFile,
+	MP4TrackId srcTrackId, 
+	MP4SampleId srcSampleId,
+	MP4FileHandle dstFile,
+	MP4TrackId dstTrackId,
+	MP4Duration dstSampleDuration)
+{
+	// LATER Not yet implemented
+	return false;
+}
+
+extern "C" u_int32_t MP4GetSampleSize(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4SampleId sampleId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetSampleSize(
+				trackId, sampleId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return 0;
+}
+
+extern "C" u_int32_t MP4GetTrackMaxSampleSize(
+	MP4FileHandle hFile,
+	MP4TrackId trackId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetTrackMaxSampleSize(trackId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return 0;
+}
+
+extern "C" MP4SampleId MP4GetSampleIdFromTime(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4Timestamp when, 
+	bool wantSyncSample)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetSampleIdFromTime(
+				trackId, when, wantSyncSample);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_SAMPLE_ID;
+}
+
+extern "C" MP4Timestamp MP4GetSampleTime(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4SampleId sampleId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetSampleTime(
+				trackId, sampleId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_TIMESTAMP;
+}
+
+extern "C" MP4Duration MP4GetSampleDuration(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4SampleId sampleId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetSampleDuration(
+				trackId, sampleId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_DURATION;
+}
+
+extern "C" MP4Duration MP4GetSampleRenderingOffset(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4SampleId sampleId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetSampleRenderingOffset(
+				trackId, sampleId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_DURATION;
+}
+
+extern "C" bool MP4SetSampleRenderingOffset(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4SampleId sampleId,
+	MP4Duration renderingOffset)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetSampleRenderingOffset(
+				trackId, sampleId, renderingOffset);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" int8_t MP4GetSampleSync(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4SampleId sampleId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetSampleSync(
+				trackId, sampleId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return -1;
+}
+
+
+extern "C" u_int64_t MP4ConvertFromMovieDuration(
+	MP4FileHandle hFile,
+	MP4Duration duration,
+	u_int32_t timeScale)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->ConvertFromMovieDuration(
+				duration, timeScale);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return (u_int64_t)MP4_INVALID_DURATION;
+}
+
+extern "C" u_int64_t MP4ConvertFromTrackTimestamp(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4Timestamp timeStamp,
+	u_int32_t timeScale)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->ConvertFromTrackTimestamp(
+				trackId, timeStamp, timeScale);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return (u_int64_t)MP4_INVALID_TIMESTAMP;
+}
+
+extern "C" MP4Timestamp MP4ConvertToTrackTimestamp(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	u_int64_t timeStamp,
+	u_int32_t timeScale)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->ConvertToTrackTimestamp(
+				trackId, timeStamp, timeScale);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_TIMESTAMP;
+}
+
+extern "C" u_int64_t MP4ConvertFromTrackDuration(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4Duration duration,
+	u_int32_t timeScale)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->ConvertFromTrackDuration(
+				trackId, duration, timeScale);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return (u_int64_t)MP4_INVALID_DURATION;
+}
+
+extern "C" MP4Duration MP4ConvertToTrackDuration(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	u_int64_t duration,
+	u_int32_t timeScale)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->ConvertToTrackDuration(
+				trackId, duration, timeScale);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_DURATION;
+}
+
+extern "C" bool MP4GetHintTrackRtpPayload(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	char** ppPayloadName,
+	u_int8_t* pPayloadNumber,
+	u_int16_t* pMaxPayloadSize,
+	char **ppEncodingParams)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->GetHintTrackRtpPayload(
+				hintTrackId, ppPayloadName, pPayloadNumber, pMaxPayloadSize,
+				ppEncodingParams);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" bool MP4SetHintTrackRtpPayload(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	const char* pPayloadName,
+	u_int8_t* pPayloadNumber,
+	u_int16_t maxPayloadSize,
+	const char *encode_params)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetHintTrackRtpPayload(
+				hintTrackId, pPayloadName, pPayloadNumber, maxPayloadSize, encode_params);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" const char* MP4GetSessionSdp(
+	MP4FileHandle hFile)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetSessionSdp();
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return NULL;
+}
+
+extern "C" bool MP4SetSessionSdp(
+	MP4FileHandle hFile,
+	const char* sdpString)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetSessionSdp(sdpString);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" bool MP4AppendSessionSdp(
+	MP4FileHandle hFile,
+	const char* sdpString)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->AppendSessionSdp(sdpString);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" const char* MP4GetHintTrackSdp(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetHintTrackSdp(hintTrackId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return NULL;
+}
+
+extern "C" bool MP4SetHintTrackSdp(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	const char* sdpString)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetHintTrackSdp(hintTrackId, sdpString);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" bool MP4AppendHintTrackSdp(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	const char* sdpString)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->AppendHintTrackSdp(hintTrackId, sdpString);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" MP4TrackId MP4GetHintTrackReferenceTrackId(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->
+				GetHintTrackReferenceTrackId(hintTrackId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_TRACK_ID;
+}
+
+extern "C" bool MP4ReadRtpHint(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	MP4SampleId hintSampleId,
+	u_int16_t* pNumPackets)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->ReadRtpHint(
+				hintTrackId, hintSampleId, pNumPackets);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" u_int16_t MP4GetRtpHintNumberOfPackets(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetRtpHintNumberOfPackets(hintTrackId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return 0;
+}
+
+extern "C" int8_t MP4GetRtpPacketBFrame(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	u_int16_t packetIndex)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->
+				GetRtpPacketBFrame(hintTrackId, packetIndex);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return -1;
+}
+
+extern "C" int32_t MP4GetRtpPacketTransmitOffset(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	u_int16_t packetIndex)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->
+				GetRtpPacketTransmitOffset(hintTrackId, packetIndex);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return 0;
+}
+
+extern "C" bool MP4ReadRtpPacket(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	u_int16_t packetIndex,
+	u_int8_t** ppBytes, 
+	u_int32_t* pNumBytes,
+	u_int32_t ssrc,
+	bool includeHeader,
+	bool includePayload)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->ReadRtpPacket(
+				hintTrackId, packetIndex, 
+				ppBytes, pNumBytes, 
+				ssrc, includeHeader, includePayload);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" MP4Timestamp MP4GetRtpTimestampStart(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetRtpTimestampStart(hintTrackId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_TIMESTAMP;
+}
+
+extern "C" bool MP4SetRtpTimestampStart(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	MP4Timestamp rtpStart)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetRtpTimestampStart(
+				hintTrackId, rtpStart);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" bool MP4AddRtpHint(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId)
+{
+	return MP4AddRtpVideoHint(hFile, hintTrackId, false, 0);
+}
+
+extern "C" bool MP4AddRtpVideoHint(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	bool isBframe, 
+	u_int32_t timestampOffset)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->AddRtpHint(hintTrackId, 
+				isBframe, timestampOffset);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" bool MP4AddRtpPacket(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	bool setMbit,
+	int32_t transmitOffset)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->AddRtpPacket(
+				hintTrackId, setMbit, transmitOffset);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" bool MP4AddRtpImmediateData(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	const u_int8_t* pBytes,
+	u_int32_t numBytes)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->AddRtpImmediateData(hintTrackId, 
+				pBytes, numBytes);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" bool MP4AddRtpSampleData(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	MP4SampleId sampleId,
+	u_int32_t dataOffset,
+	u_int32_t dataLength)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->AddRtpSampleData(
+				hintTrackId, sampleId, dataOffset, dataLength);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" bool MP4AddRtpESConfigurationPacket(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->AddRtpESConfigurationPacket(hintTrackId);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" bool MP4WriteRtpHint(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	MP4Duration duration,
+	bool isSyncSample)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->WriteRtpHint(
+				hintTrackId, duration, isSyncSample);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+/* ISMA specific operations */
+
+extern "C" bool MP4MakeIsmaCompliant(
+	const char* fileName, 
+	u_int32_t verbosity,
+	bool addIsmaComplianceSdp)
+{
+	MP4File* pFile = NULL;
+
+	try {
+		pFile = new MP4File(verbosity);
+		pFile->Modify(fileName);
+		pFile->MakeIsmaCompliant(addIsmaComplianceSdp);
+		pFile->Close();
+		delete pFile;
+		return true;
+	}
+	catch (MP4Error* e) {
+		VERBOSE_ERROR(verbosity, e->Print());
+		delete e;
+	}
+	delete pFile;
+	return false;
+}
+
+extern "C" char* MP4MakeIsmaSdpIod(
+	u_int8_t videoProfile,
+	u_int32_t videoBitrate,
+	u_int8_t* videoConfig,
+	u_int32_t videoConfigLength,
+	u_int8_t audioProfile,
+	u_int32_t audioBitrate,
+	u_int8_t* audioConfig,
+	u_int32_t audioConfigLength,
+	u_int32_t verbosity)
+{
+	MP4File* pFile = NULL;
+
+	try {
+		pFile = new MP4File(verbosity);
+
+		u_int8_t* pBytes = NULL;
+		u_int64_t numBytes = 0;
+
+		pFile->CreateIsmaIodFromParams(
+			videoProfile,
+			videoBitrate,
+			videoConfig,
+			videoConfigLength,
+			audioProfile,
+			audioBitrate,
+			audioConfig,
+			audioConfigLength,
+			&pBytes,
+			&numBytes);
+
+		char* iodBase64 = 
+			MP4ToBase64(pBytes, numBytes);
+		MP4Free(pBytes);
+
+		char* sdpIod = 
+			(char*)MP4Malloc(strlen(iodBase64) + 64);
+		sprintf(sdpIod,
+			"a=mpeg4-iod: \042data:application/mpeg4-iod;base64,%s\042",
+			iodBase64);
+		MP4Free(iodBase64);
+
+		delete pFile;
+
+		return sdpIod;
+	}
+	catch (MP4Error* e) {
+		VERBOSE_ERROR(verbosity, e->Print());
+		delete e;
+	}
+	delete pFile;
+	return NULL;
+}
+
+/* Edit list */
+
+extern "C" MP4EditId MP4AddTrackEdit(
+	MP4FileHandle hFile,
+	MP4TrackId trackId,
+	MP4EditId editId,
+	MP4Timestamp startTime,
+	MP4Duration duration,
+	bool dwell)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			MP4EditId editId =
+				((MP4File*)hFile)->AddTrackEdit(trackId, editId);
+
+			if (editId != MP4_INVALID_EDIT_ID) {
+				((MP4File*)hFile)->SetTrackEditMediaStart(
+					trackId, editId, startTime);
+				((MP4File*)hFile)->SetTrackEditDuration(
+					trackId, editId, duration);
+				((MP4File*)hFile)->SetTrackEditDwell(
+					trackId, editId, dwell);
+			}
+
+			return editId;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_EDIT_ID;
+}
+
+extern "C" bool MP4DeleteTrackEdit(
+	MP4FileHandle hFile,
+	MP4TrackId trackId,
+	MP4EditId editId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->DeleteTrackEdit(trackId, editId);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" u_int32_t MP4GetTrackNumberOfEdits(
+	MP4FileHandle hFile,
+	MP4TrackId trackId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetTrackNumberOfEdits(trackId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return 0;
+}
+
+extern "C" MP4Timestamp MP4GetTrackEditMediaStart(
+	MP4FileHandle hFile,
+	MP4TrackId trackId,
+	MP4EditId editId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetTrackEditMediaStart(
+				trackId, editId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_TIMESTAMP;
+}
+
+extern "C" MP4Duration MP4GetTrackEditTotalDuration(
+	MP4FileHandle hFile,
+	MP4TrackId trackId,
+	MP4EditId editId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetTrackEditTotalDuration(
+				trackId, editId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_DURATION;
+}
+
+extern "C" bool MP4SetTrackEditMediaStart(
+	MP4FileHandle hFile,
+	MP4TrackId trackId,
+	MP4EditId editId,
+	MP4Timestamp startTime)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetTrackEditMediaStart(
+				trackId, editId, startTime);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" MP4Duration MP4GetTrackEditDuration(
+	MP4FileHandle hFile,
+	MP4TrackId trackId,
+	MP4EditId editId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetTrackEditDuration(trackId, editId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_DURATION;
+}
+
+extern "C" bool MP4SetTrackEditDuration(
+	MP4FileHandle hFile,
+	MP4TrackId trackId,
+	MP4EditId editId,
+	MP4Duration duration)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetTrackEditDuration(trackId, editId, duration);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" int8_t MP4GetTrackEditDwell(
+	MP4FileHandle hFile,
+	MP4TrackId trackId,
+	MP4EditId editId)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetTrackEditDwell(trackId, editId);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return -1;
+}
+
+extern "C" bool MP4SetTrackEditDwell(
+	MP4FileHandle hFile,
+	MP4TrackId trackId,
+	MP4EditId editId,
+	bool dwell)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			((MP4File*)hFile)->SetTrackEditDwell(trackId, editId, dwell);
+			return true;
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return false;
+}
+
+extern "C" bool MP4ReadSampleFromEditTime(
+	/* input parameters */
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4Timestamp when,
+	/* output parameters */
+	u_int8_t** ppBytes, 
+	u_int32_t* pNumBytes, 
+	MP4Timestamp* pStartTime, 
+	MP4Duration* pDuration,
+	MP4Duration* pRenderingOffset, 
+	bool* pIsSyncSample)
+{
+	MP4SampleId sampleId = 
+		MP4GetSampleIdFromEditTime(
+			hFile,
+			trackId, 
+			when, 
+			pStartTime,
+			pDuration);
+
+	return MP4ReadSample(
+		hFile,
+		trackId, 
+		sampleId, 
+		ppBytes, 
+		pNumBytes, 
+		NULL,
+		NULL, 
+		pRenderingOffset, 
+		pIsSyncSample);
+}
+
+extern "C" MP4SampleId MP4GetSampleIdFromEditTime(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4Timestamp when,
+	MP4Timestamp* pStartTime,
+	MP4Duration* pDuration)
+{
+	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
+		try {
+			return ((MP4File*)hFile)->GetSampleIdFromEditTime(
+				trackId, when, pStartTime, pDuration);
+		}
+		catch (MP4Error* e) {
+			PRINT_ERROR(e);
+			delete e;
+		}
+	}
+	return MP4_INVALID_SAMPLE_ID;
+}
+
+/* Utlities */
+
+extern "C" char* MP4BinaryToBase16(
+	const u_int8_t* pData, 
+	u_int32_t dataSize)
+{
+	if (pData || dataSize == 0) {
+		try {
+			return MP4ToBase16(pData, dataSize);
+		}
+		catch (MP4Error* e) {
+			delete e;
+		}
+	}
+	return NULL;
+}
+
+extern "C" char* MP4BinaryToBase64(
+	const u_int8_t* pData, 
+	u_int32_t dataSize)
+{
+	if (pData || dataSize == 0) {
+		try {
+			return MP4ToBase64(pData, dataSize);
+		}
+		catch (MP4Error* e) {
+			delete e;
+		}
+	}
+	return NULL;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/mp4.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,891 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#ifndef __MP4_INCLUDED__
+#define __MP4_INCLUDED__
+
+/* include system and project specific headers */
+#include "mpeg4ip.h"
+
+#include <math.h>	/* to define float HUGE_VAL and/or NAN */
+#ifndef NAN
+#define NAN HUGE_VAL
+#endif
+
+#ifdef __cplusplus
+/* exploit C++ ability of default values for function parameters */
+#define DEFAULT(x)	=x
+#else
+#define DEFAULT(x)
+#endif
+
+/* MP4 API types */
+typedef void*		MP4FileHandle;
+typedef u_int32_t	MP4TrackId;
+typedef u_int32_t	MP4SampleId;
+typedef u_int64_t	MP4Timestamp;
+typedef u_int64_t	MP4Duration;
+typedef u_int32_t	MP4EditId;
+
+/* Invalid values for API types */
+#define MP4_INVALID_FILE_HANDLE	((MP4FileHandle)NULL)
+#define MP4_INVALID_TRACK_ID	((MP4TrackId)0)
+#define MP4_INVALID_SAMPLE_ID	((MP4SampleId)0)
+#define MP4_INVALID_TIMESTAMP	((MP4Timestamp)-1)
+#define MP4_INVALID_DURATION	((MP4Duration)-1)
+#define MP4_INVALID_EDIT_ID		((MP4EditId)0)
+
+/* Macros to test for API type validity */
+#define MP4_IS_VALID_FILE_HANDLE(x)	((x) != MP4_INVALID_FILE_HANDLE) 
+#define MP4_IS_VALID_TRACK_ID(x)	((x) != MP4_INVALID_TRACK_ID) 
+#define MP4_IS_VALID_SAMPLE_ID(x)	((x) != MP4_INVALID_SAMPLE_ID) 
+#define MP4_IS_VALID_TIMESTAMP(x)	((x) != MP4_INVALID_TIMESTAMP) 
+#define MP4_IS_VALID_DURATION(x)	((x) != MP4_INVALID_DURATION) 
+#define MP4_IS_VALID_EDIT_ID(x)		((x) != MP4_INVALID_EDIT_ID) 
+
+/* MP4 verbosity levels - e.g. MP4SetVerbosity() */
+#define MP4_DETAILS_ALL				0xFFFFFFFF
+#define MP4_DETAILS_ERROR			0x00000001
+#define MP4_DETAILS_WARNING			0x00000002
+#define MP4_DETAILS_READ			0x00000004
+#define MP4_DETAILS_WRITE			0x00000008
+#define MP4_DETAILS_FIND			0x00000010
+#define MP4_DETAILS_TABLE			0x00000020
+#define MP4_DETAILS_SAMPLE			0x00000040
+#define MP4_DETAILS_HINT			0x00000080
+#define MP4_DETAILS_ISMA			0x00000100
+#define MP4_DETAILS_EDIT			0x00000200
+
+#define MP4_DETAILS_READ_ALL		\
+	(MP4_DETAILS_READ | MP4_DETAILS_TABLE | MP4_DETAILS_SAMPLE)
+#define MP4_DETAILS_WRITE_ALL		\
+	(MP4_DETAILS_WRITE | MP4_DETAILS_TABLE | MP4_DETAILS_SAMPLE)
+
+/*
+ * MP4 Known track type names - e.g. MP4GetNumberOfTracks(type) 
+ *
+ * Note this first group of track types should be created 
+ * via the MP4Add<Type>Track() functions, and not MP4AddTrack(type)
+ */
+#define MP4_OD_TRACK_TYPE		"odsm"
+#define MP4_SCENE_TRACK_TYPE	"sdsm"
+#define MP4_AUDIO_TRACK_TYPE	"soun"
+#define MP4_VIDEO_TRACK_TYPE	"vide"
+#define MP4_HINT_TRACK_TYPE		"hint"
+/*
+ * This second set of track types should be created 
+ * via MP4AddSystemsTrack(type)
+ */
+#define MP4_CLOCK_TRACK_TYPE	"crsm"
+#define MP4_MPEG7_TRACK_TYPE	"m7sm"
+#define MP4_OCI_TRACK_TYPE		"ocsm"
+#define MP4_IPMP_TRACK_TYPE		"ipsm"
+#define MP4_MPEGJ_TRACK_TYPE	"mjsm"
+
+#define MP4_IS_VIDEO_TRACK_TYPE(type) \
+	(!strcasecmp(type, MP4_VIDEO_TRACK_TYPE))
+
+#define MP4_IS_AUDIO_TRACK_TYPE(type) \
+	(!strcasecmp(type, MP4_AUDIO_TRACK_TYPE))
+
+#define MP4_IS_OD_TRACK_TYPE(type) \
+	(!strcasecmp(type, MP4_OD_TRACK_TYPE))
+
+#define MP4_IS_SCENE_TRACK_TYPE(type) \
+	(!strcasecmp(type, MP4_SCENE_TRACK_TYPE))
+
+#define MP4_IS_HINT_TRACK_TYPE(type) \
+	(!strcasecmp(type, MP4_HINT_TRACK_TYPE))
+
+#define MP4_IS_SYSTEMS_TRACK_TYPE(type) \
+	(!strcasecmp(type, MP4_CLOCK_TRACK_TYPE) \
+	|| !strcasecmp(type, MP4_MPEG7_TRACK_TYPE) \
+	|| !strcasecmp(type, MP4_OCI_TRACK_TYPE) \
+	|| !strcasecmp(type, MP4_IPMP_TRACK_TYPE) \
+	|| !strcasecmp(type, MP4_MPEGJ_TRACK_TYPE))
+
+/* MP4 Audio track types - see MP4AddAudioTrack()*/
+#define MP4_INVALID_AUDIO_TYPE			0x00
+#define MP4_MPEG1_AUDIO_TYPE			0x6B
+#define MP4_MPEG2_AUDIO_TYPE			0x69
+#define MP4_MP3_AUDIO_TYPE				MP4_MPEG2_AUDIO_TYPE
+#define MP4_MPEG2_AAC_MAIN_AUDIO_TYPE	0x66
+#define MP4_MPEG2_AAC_LC_AUDIO_TYPE		0x67
+#define MP4_MPEG2_AAC_SSR_AUDIO_TYPE	0x68
+#define MP4_MPEG2_AAC_AUDIO_TYPE		MP4_MPEG2_AAC_MAIN_AUDIO_TYPE
+#define MP4_MPEG4_AUDIO_TYPE			0x40
+#define MP4_PRIVATE_AUDIO_TYPE			0xC0
+#define MP4_PCM16_LITTLE_ENDIAN_AUDIO_TYPE	0xE0	/* a private definition */
+#define MP4_VORBIS_AUDIO_TYPE			0xE1	/* a private definition */
+#define MP4_AC3_AUDIO_TYPE				0xE2	/* a private definition */
+#define MP4_ALAW_AUDIO_TYPE				0xE3	/* a private definition */
+#define MP4_ULAW_AUDIO_TYPE				0xE4	/* a private definition */
+#define MP4_G723_AUDIO_TYPE                             0xE5    /* a private definition */
+#define MP4_PCM16_BIG_ENDIAN_AUDIO_TYPE         0xE6 /* a private definition */
+
+/* MP4 MPEG-4 Audio types from 14496-3 Table 1.5.1 */
+#define MP4_MPEG4_INVALID_AUDIO_TYPE		0
+#define MP4_MPEG4_AAC_MAIN_AUDIO_TYPE		1
+#define MP4_MPEG4_AAC_LC_AUDIO_TYPE			2
+#define MP4_MPEG4_AAC_SSR_AUDIO_TYPE		3
+#define MP4_MPEG4_AAC_LTP_AUDIO_TYPE		4
+#define MP4_MPEG4_AAC_SCALABLE_AUDIO_TYPE	6
+#define MP4_MPEG4_CELP_AUDIO_TYPE			8
+#define MP4_MPEG4_HVXC_AUDIO_TYPE			9
+#define MP4_MPEG4_TTSI_AUDIO_TYPE			12
+#define MP4_MPEG4_MAIN_SYNTHETIC_AUDIO_TYPE	13
+#define MP4_MPEG4_WAVETABLE_AUDIO_TYPE		14
+#define MP4_MPEG4_MIDI_AUDIO_TYPE			15
+#define MP4_MPEG4_ALGORITHMIC_FX_AUDIO_TYPE	16
+
+/* MP4 Audio type utilities following common usage */
+#define MP4_IS_MP3_AUDIO_TYPE(type) \
+	((type) == MP4_MPEG1_AUDIO_TYPE || (type) == MP4_MPEG2_AUDIO_TYPE) 
+
+#define MP4_IS_MPEG2_AAC_AUDIO_TYPE(type) \
+	(((type) >= MP4_MPEG2_AAC_MAIN_AUDIO_TYPE \
+		&& (type) <= MP4_MPEG2_AAC_SSR_AUDIO_TYPE))
+
+#define MP4_IS_MPEG4_AAC_AUDIO_TYPE(mpeg4Type) \
+	(((mpeg4Type) >= MP4_MPEG4_AAC_MAIN_AUDIO_TYPE \
+		&& (mpeg4Type) <= MP4_MPEG4_AAC_LTP_AUDIO_TYPE) \
+	  || (mpeg4Type) == MP4_MPEG4_AAC_SCALABLE_AUDIO_TYPE)
+
+#define MP4_IS_AAC_AUDIO_TYPE(type) \
+	(MP4_IS_MPEG2_AAC_AUDIO_TYPE(type) \
+	|| (type) == MP4_MPEG4_AUDIO_TYPE)
+
+/* MP4 Video track types - see MP4AddVideoTrack() */
+#define MP4_INVALID_VIDEO_TYPE			0x00
+#define MP4_MPEG1_VIDEO_TYPE			0x6A
+#define MP4_MPEG2_SIMPLE_VIDEO_TYPE		0x60
+#define MP4_MPEG2_MAIN_VIDEO_TYPE		0x61
+#define MP4_MPEG2_SNR_VIDEO_TYPE		0x62
+#define MP4_MPEG2_SPATIAL_VIDEO_TYPE	0x63
+#define MP4_MPEG2_HIGH_VIDEO_TYPE		0x64
+#define MP4_MPEG2_442_VIDEO_TYPE		0x65
+#define MP4_MPEG2_VIDEO_TYPE			MP4_MPEG2_MAIN_VIDEO_TYPE
+#define MP4_MPEG4_VIDEO_TYPE			0x20
+#define MP4_JPEG_VIDEO_TYPE				0x6C
+#define MP4_PRIVATE_VIDEO_TYPE			0xD0
+#define MP4_YUV12_VIDEO_TYPE			0xF0	/* a private definition */
+#define MP4_H264_VIDEO_TYPE				0xF1	/* a private definition */
+#define MP4_H263_VIDEO_TYPE				0xF2	/* a private definition */
+#define MP4_H261_VIDEO_TYPE				0xF3	/* a private definition */
+
+/* MP4 Video type utilities */
+#define MP4_IS_MPEG1_VIDEO_TYPE(type) \
+	((type) == MP4_MPEG1_VIDEO_TYPE)
+
+#define MP4_IS_MPEG2_VIDEO_TYPE(type) \
+	(((type) >= MP4_MPEG2_SIMPLE_VIDEO_TYPE \
+		&& (type) <= MP4_MPEG2_442_VIDEO_TYPE) \
+	  || MP4_IS_MPEG1_VIDEO_TYPE(type))
+
+#define MP4_IS_MPEG4_VIDEO_TYPE(type) \
+	((type) == MP4_MPEG4_VIDEO_TYPE)
+
+
+/* MP4 API declarations */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* file operations */
+
+MP4FileHandle MP4Create(
+	const char* fileName, 
+	u_int32_t verbosity DEFAULT(0),
+	bool use64bits DEFAULT(0),
+	bool useExtensibleFormat DEFAULT(0));
+
+MP4FileHandle MP4Modify(
+	const char* fileName, 
+	u_int32_t verbosity DEFAULT(0),
+	bool useExtensibleFormat DEFAULT(0));
+
+MP4FileHandle MP4Read(
+	const char* fileName, 
+	u_int32_t verbosity DEFAULT(0));
+
+bool MP4Close(
+	MP4FileHandle hFile);
+
+bool MP4Optimize(
+	const char* existingFileName, 
+	const char* newFileName DEFAULT(NULL), 
+	u_int32_t verbosity DEFAULT(0));
+
+bool MP4Dump(
+	MP4FileHandle hFile, 
+	FILE* pDumpFile DEFAULT(NULL), 
+	bool dumpImplicits DEFAULT(0));
+
+char* MP4Info(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId DEFAULT(MP4_INVALID_TRACK_ID));
+
+char* MP4FileInfo(
+	const char* fileName,
+	MP4TrackId trackId DEFAULT(MP4_INVALID_TRACK_ID));
+
+/* file properties */
+
+/* specific file properties */
+
+u_int32_t MP4GetVerbosity(MP4FileHandle hFile);
+
+bool MP4SetVerbosity(MP4FileHandle hFile, u_int32_t verbosity);
+
+MP4Duration MP4GetDuration(MP4FileHandle hFile);
+
+u_int32_t MP4GetTimeScale(MP4FileHandle hFile);
+
+bool MP4SetTimeScale(MP4FileHandle hFile, u_int32_t value);
+
+u_int8_t MP4GetODProfileLevel(MP4FileHandle hFile);
+
+bool MP4SetODProfileLevel(MP4FileHandle hFile, u_int8_t value);
+
+u_int8_t MP4GetSceneProfileLevel(MP4FileHandle hFile);
+
+bool MP4SetSceneProfileLevel(MP4FileHandle hFile, u_int8_t value);
+
+u_int8_t MP4GetVideoProfileLevel(MP4FileHandle hFile);
+
+bool MP4SetVideoProfileLevel(MP4FileHandle hFile, u_int8_t value);
+
+u_int8_t MP4GetAudioProfileLevel(MP4FileHandle hFile);
+
+bool MP4SetAudioProfileLevel(MP4FileHandle hFile, u_int8_t value);
+
+u_int8_t MP4GetGraphicsProfileLevel(MP4FileHandle hFile);
+
+bool MP4SetGraphicsProfileLevel(MP4FileHandle hFile, u_int8_t value);
+
+/* generic file properties */
+
+u_int64_t MP4GetIntegerProperty(
+	MP4FileHandle hFile, 
+	const char* propName);
+
+float MP4GetFloatProperty(
+	MP4FileHandle hFile, 
+	const char* propName);
+
+const char* MP4GetStringProperty(
+	MP4FileHandle hFile, 
+	const char* propName);
+
+void MP4GetBytesProperty(
+	MP4FileHandle hFile, 
+	const char* propName,
+	u_int8_t** ppValue, 
+	u_int32_t* pValueSize);
+
+bool MP4SetIntegerProperty(
+	MP4FileHandle hFile, 
+	const char* propName, 
+	int64_t value);
+
+bool MP4SetFloatProperty(
+	MP4FileHandle hFile, 
+	const char* propName, 
+	float value);
+
+bool MP4SetStringProperty(
+	MP4FileHandle hFile, const char* propName, const char* value);
+
+bool MP4SetBytesProperty(
+	MP4FileHandle hFile, const char* propName, 
+	const u_int8_t* pValue, u_int32_t valueSize);
+
+/* track operations */
+
+MP4TrackId MP4AddTrack(
+	MP4FileHandle hFile, 
+	const char* type);
+
+MP4TrackId MP4AddSystemsTrack(
+	MP4FileHandle hFile, 
+	const char* type);
+
+MP4TrackId MP4AddODTrack(
+	MP4FileHandle hFile);
+
+MP4TrackId MP4AddSceneTrack(
+	MP4FileHandle hFile);
+
+MP4TrackId MP4AddAudioTrack(
+	MP4FileHandle hFile, 
+	u_int32_t timeScale, 
+	MP4Duration sampleDuration,
+	u_int8_t audioType DEFAULT(MP4_MPEG4_AUDIO_TYPE));
+
+MP4TrackId MP4AddVideoTrack(
+	MP4FileHandle hFile, 
+	u_int32_t timeScale, 
+	MP4Duration sampleDuration,
+	u_int16_t width, 
+	u_int16_t height,
+	u_int8_t videoType DEFAULT(MP4_MPEG4_VIDEO_TYPE));
+
+MP4TrackId MP4AddHintTrack(
+	MP4FileHandle hFile, 
+	MP4TrackId refTrackId);
+
+MP4TrackId MP4CloneTrack(
+	MP4FileHandle srcFile, 
+	MP4TrackId srcTrackId,
+	MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE));
+
+MP4TrackId MP4CopyTrack(
+	MP4FileHandle srcFile, 
+	MP4TrackId srcTrackId,
+	MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE), 
+	bool applyEdits DEFAULT(false));
+
+bool MP4DeleteTrack(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId);
+
+u_int32_t MP4GetNumberOfTracks(
+	MP4FileHandle hFile, 
+	const char* type DEFAULT(NULL),
+	u_int8_t subType DEFAULT(0));
+
+MP4TrackId MP4FindTrackId(
+	MP4FileHandle hFile, 
+	u_int16_t index, 
+	const char* type DEFAULT(NULL),
+	u_int8_t subType DEFAULT(0));
+
+u_int16_t MP4FindTrackIndex(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId);
+
+/* track properties */
+
+/* specific track properties */
+
+const char* MP4GetTrackType(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId);
+
+MP4Duration MP4GetTrackDuration(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId);
+
+u_int32_t MP4GetTrackTimeScale(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId);
+
+bool MP4SetTrackTimeScale(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId, 
+	u_int32_t value);
+
+u_int8_t MP4GetTrackAudioType(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId);
+
+u_int8_t MP4GetTrackAudioMpeg4Type(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId);
+
+u_int8_t MP4GetTrackVideoType(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId);
+
+/* returns MP4_INVALID_DURATION if track samples do not have a fixed duration */
+MP4Duration MP4GetTrackFixedSampleDuration(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId);
+
+u_int32_t MP4GetTrackBitRate(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId);
+
+void MP4GetTrackESConfiguration(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId, 
+	u_int8_t** ppConfig, 
+	u_int32_t* pConfigSize);
+
+bool MP4SetTrackESConfiguration(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId, 
+	const u_int8_t* pConfig, 
+	u_int32_t configSize);
+
+MP4SampleId MP4GetTrackNumberOfSamples(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId);
+
+u_int16_t MP4GetTrackVideoWidth(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId);
+
+u_int16_t MP4GetTrackVideoHeight(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId);
+
+float MP4GetTrackVideoFrameRate(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId);
+
+/* generic track properties */
+
+u_int64_t MP4GetTrackIntegerProperty(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId, 
+	const char* propName);
+
+float MP4GetTrackFloatProperty(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId, 
+	const char* propName);
+
+const char* MP4GetTrackStringProperty(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId, 
+	const char* propName);
+
+void MP4GetTrackBytesProperty(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId, 
+	const char* propName,
+	u_int8_t** ppValue, 
+	u_int32_t* pValueSize);
+
+bool MP4SetTrackIntegerProperty(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId, 
+	const char* propName, 
+	int64_t value);
+
+bool MP4SetTrackFloatProperty(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId, 
+	const char* propName, 
+	float value);
+
+bool MP4SetTrackStringProperty(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId, 
+	const char* propName, 
+	const char* value);
+
+bool MP4SetTrackBytesProperty(
+	MP4FileHandle hFile, 
+	MP4TrackId trackId, 
+	const char* propName, 
+	const u_int8_t* pValue, 
+	u_int32_t valueSize);
+
+/* sample operations */
+
+bool MP4ReadSample(
+	/* input parameters */
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4SampleId sampleId,
+	/* input/output parameters */
+	u_int8_t** ppBytes, 
+	u_int32_t* pNumBytes, 
+	/* output parameters */
+	MP4Timestamp* pStartTime DEFAULT(NULL), 
+	MP4Duration* pDuration DEFAULT(NULL),
+	MP4Duration* pRenderingOffset DEFAULT(NULL), 
+	bool* pIsSyncSample DEFAULT(NULL));
+
+/* uses (unedited) time to specify sample instead of sample id */
+bool MP4ReadSampleFromTime(
+	/* input parameters */
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4Timestamp when,
+	/* input/output parameters */
+	u_int8_t** ppBytes, 
+	u_int32_t* pNumBytes, 
+	/* output parameters */
+	MP4Timestamp* pStartTime DEFAULT(NULL), 
+	MP4Duration* pDuration DEFAULT(NULL),
+	MP4Duration* pRenderingOffset DEFAULT(NULL), 
+	bool* pIsSyncSample DEFAULT(NULL));
+
+bool MP4WriteSample(
+	MP4FileHandle hFile,
+	MP4TrackId trackId,
+	u_int8_t* pBytes, 
+	u_int32_t numBytes,
+	MP4Duration duration DEFAULT(MP4_INVALID_DURATION),
+	MP4Duration renderingOffset DEFAULT(0), 
+	bool isSyncSample DEFAULT(true));
+
+bool MP4CopySample(
+	MP4FileHandle srcFile,
+	MP4TrackId srcTrackId, 
+	MP4SampleId srcSampleId,
+	MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE),
+	MP4TrackId dstTrackId DEFAULT(MP4_INVALID_TRACK_ID),
+	MP4Duration dstSampleDuration DEFAULT(MP4_INVALID_DURATION));
+
+/* Note this function is not yet implemented */
+bool MP4ReferenceSample(
+	MP4FileHandle srcFile,
+	MP4TrackId srcTrackId, 
+	MP4SampleId srcSampleId,
+	MP4FileHandle dstFile,
+	MP4TrackId dstTrackId,
+	MP4Duration dstSampleDuration DEFAULT(MP4_INVALID_DURATION));
+
+u_int32_t MP4GetSampleSize(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4SampleId sampleId);
+
+u_int32_t MP4GetTrackMaxSampleSize(
+	MP4FileHandle hFile,
+	MP4TrackId trackId); 
+
+MP4SampleId MP4GetSampleIdFromTime(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4Timestamp when, 
+	bool wantSyncSample DEFAULT(false));
+
+MP4Timestamp MP4GetSampleTime(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4SampleId sampleId);
+
+MP4Duration MP4GetSampleDuration(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4SampleId sampleId);
+
+MP4Duration MP4GetSampleRenderingOffset(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4SampleId sampleId);
+
+bool MP4SetSampleRenderingOffset(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4SampleId sampleId,
+	MP4Duration renderingOffset);
+
+int8_t MP4GetSampleSync(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4SampleId sampleId);
+
+/* rtp hint track operations */
+
+bool MP4GetHintTrackRtpPayload(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	char** ppPayloadName DEFAULT(NULL),
+	u_int8_t* pPayloadNumber DEFAULT(NULL),
+	u_int16_t* pMaxPayloadSize DEFAULT(NULL),
+	char **ppEncodingParams DEFAULT(NULL));
+
+#define MP4_SET_DYNAMIC_PAYLOAD 0xff
+
+bool MP4SetHintTrackRtpPayload(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	const char* pPayloadName,
+	u_int8_t* pPayloadNumber,
+	u_int16_t maxPayloadSize DEFAULT(0),
+	const char *encode_params DEFAULT(NULL));
+
+const char* MP4GetSessionSdp(
+	MP4FileHandle hFile);
+
+bool MP4SetSessionSdp(
+	MP4FileHandle hFile,
+	const char* sdpString);
+
+bool MP4AppendSessionSdp(
+	MP4FileHandle hFile,
+	const char* sdpString);
+
+const char* MP4GetHintTrackSdp(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId);
+
+bool MP4SetHintTrackSdp(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	const char* sdpString);
+
+bool MP4AppendHintTrackSdp(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	const char* sdpString);
+
+MP4TrackId MP4GetHintTrackReferenceTrackId(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId);
+
+bool MP4ReadRtpHint(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	MP4SampleId hintSampleId,
+	u_int16_t* pNumPackets DEFAULT(NULL));
+
+u_int16_t MP4GetRtpHintNumberOfPackets(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId);
+
+int8_t MP4GetRtpPacketBFrame(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	u_int16_t packetIndex);
+
+int32_t MP4GetRtpPacketTransmitOffset(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	u_int16_t packetIndex);
+
+bool MP4ReadRtpPacket(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	u_int16_t packetIndex,
+	u_int8_t** ppBytes, 
+	u_int32_t* pNumBytes,
+	u_int32_t ssrc DEFAULT(0),
+	bool includeHeader DEFAULT(true),
+	bool includePayload DEFAULT(true));
+
+MP4Timestamp MP4GetRtpTimestampStart(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId);
+
+bool MP4SetRtpTimestampStart(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	MP4Timestamp rtpStart);
+
+bool MP4AddRtpHint(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId);
+
+bool MP4AddRtpVideoHint(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	bool isBframe DEFAULT(false), 
+	u_int32_t timestampOffset DEFAULT(0));
+
+bool MP4AddRtpPacket(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	bool setMbit DEFAULT(false),
+	int32_t transmitOffset DEFAULT(0));
+
+bool MP4AddRtpImmediateData(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	const u_int8_t* pBytes,
+	u_int32_t numBytes);
+
+bool MP4AddRtpSampleData(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	MP4SampleId sampleId,
+	u_int32_t dataOffset,
+	u_int32_t dataLength);
+
+bool MP4AddRtpESConfigurationPacket(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId);
+
+bool MP4WriteRtpHint(
+	MP4FileHandle hFile,
+	MP4TrackId hintTrackId,
+	MP4Duration duration,
+	bool isSyncSample DEFAULT(true));
+
+/* ISMA specific utilities */
+
+bool MP4MakeIsmaCompliant(const char* fileName, 
+	u_int32_t verbosity DEFAULT(0),
+	bool addIsmaComplianceSdp DEFAULT(true));
+
+char* MP4MakeIsmaSdpIod(
+	u_int8_t videoProfile,
+	u_int32_t videoBitrate,
+	u_int8_t* videoConfig,
+	u_int32_t videoConfigLength,
+	u_int8_t audioProfile,
+	u_int32_t audioBitrate,
+	u_int8_t* audioConfig,
+	u_int32_t audioConfigLength,
+	u_int32_t verbosity DEFAULT(0));
+
+/* edit list */
+
+/* NOTE this section of functionality 
+ * has not yet been fully tested 
+ */
+
+MP4EditId MP4AddTrackEdit(
+	MP4FileHandle hFile,
+	MP4TrackId trackId,
+	MP4EditId editId DEFAULT(MP4_INVALID_EDIT_ID),
+	MP4Timestamp startTime DEFAULT(0),
+	MP4Duration duration DEFAULT(0),
+	bool dwell DEFAULT(false));
+
+bool MP4DeleteTrackEdit(
+	MP4FileHandle hFile,
+	MP4TrackId trackId,
+	MP4EditId editId);
+
+u_int32_t MP4GetTrackNumberOfEdits(
+	MP4FileHandle hFile,
+	MP4TrackId trackId);
+
+MP4Timestamp MP4GetTrackEditStart(
+	MP4FileHandle hFile,
+	MP4TrackId trackId,
+	MP4EditId editId);
+
+MP4Duration MP4GetTrackEditTotalDuration(
+	MP4FileHandle hFile,
+	MP4TrackId trackId,
+	MP4EditId editId DEFAULT(MP4_INVALID_EDIT_ID));
+
+MP4Timestamp MP4GetTrackEditMediaStart(
+	MP4FileHandle hFile,
+	MP4TrackId trackId,
+	MP4EditId editId);
+
+bool MP4SetTrackEditMediaStart(
+	MP4FileHandle hFile,
+	MP4TrackId trackId,
+	MP4EditId editId,
+	MP4Timestamp startTime);
+
+MP4Duration MP4GetTrackEditDuration(
+	MP4FileHandle hFile,
+	MP4TrackId trackId,
+	MP4EditId editId);
+
+bool MP4SetTrackEditDuration(
+	MP4FileHandle hFile,
+	MP4TrackId trackId,
+	MP4EditId editId,
+	MP4Duration duration);
+
+int8_t MP4GetTrackEditDwell(
+	MP4FileHandle hFile,
+	MP4TrackId trackId,
+	MP4EditId editId);
+
+bool MP4SetTrackEditDwell(
+	MP4FileHandle hFile,
+	MP4TrackId trackId,
+	MP4EditId editId,
+	bool dwell);
+
+bool MP4ReadSampleFromEditTime(
+	/* input parameters */
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4Timestamp when, 
+	/* input/output parameters */
+	u_int8_t** ppBytes, 
+	u_int32_t* pNumBytes, 
+	/* output parameters */
+	MP4Timestamp* pStartTime DEFAULT(NULL), 
+	MP4Duration* pDuration DEFAULT(NULL),
+	MP4Duration* pRenderingOffset DEFAULT(NULL), 
+	bool* pIsSyncSample DEFAULT(NULL));
+
+MP4SampleId MP4GetSampleIdFromEditTime(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4Timestamp when, 
+	MP4Timestamp* pStartTime DEFAULT(NULL), 
+	MP4Duration* pDuration DEFAULT(NULL));
+
+/* time conversion utilties */
+
+/* predefined values for timeScale parameter below */
+#define MP4_SECONDS_TIME_SCALE		1
+#define MP4_MILLISECONDS_TIME_SCALE 1000
+#define MP4_MICROSECONDS_TIME_SCALE 1000000
+#define MP4_NANOSECONDS_TIME_SCALE 	1000000000
+
+#define MP4_SECS_TIME_SCALE 	MP4_SECONDS_TIME_SCALE
+#define MP4_MSECS_TIME_SCALE	MP4_MILLISECONDS_TIME_SCALE
+#define MP4_USECS_TIME_SCALE	MP4_MICROSECONDS_TIME_SCALE
+#define MP4_NSECS_TIME_SCALE	MP4_NANOSECONDS_TIME_SCALE
+
+u_int64_t MP4ConvertFromMovieDuration(
+	MP4FileHandle hFile,
+	MP4Duration duration,
+	u_int32_t timeScale);
+
+u_int64_t MP4ConvertFromTrackTimestamp(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4Timestamp timeStamp,
+	u_int32_t timeScale);
+
+MP4Timestamp MP4ConvertToTrackTimestamp(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	u_int64_t timeStamp,
+	u_int32_t timeScale);
+
+u_int64_t MP4ConvertFromTrackDuration(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	MP4Duration duration,
+	u_int32_t timeScale);
+
+MP4Duration MP4ConvertToTrackDuration(
+	MP4FileHandle hFile,
+	MP4TrackId trackId, 
+	u_int64_t duration,
+	u_int32_t timeScale);
+
+char* MP4BinaryToBase16(
+	const u_int8_t* pData, 
+	u_int32_t dataSize);
+
+char* MP4BinaryToBase64(
+	const u_int8_t* pData, 
+	u_int32_t dataSize);
+
+#ifdef __cplusplus
+}
+#endif
+
+/* undefined our utlity macro to avoid conflicts */
+#undef DEFAULT
+
+#endif /* __MP4_INCLUDED__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/mp4array.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,130 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#ifndef __MP4_ARRAY_INCLUDED__
+#define __MP4_ARRAY_INCLUDED__
+
+typedef u_int32_t MP4ArrayIndex;
+
+class MP4Array {
+public:
+	MP4Array() {
+		m_numElements = 0;
+		m_maxNumElements = 0;
+	}
+
+	inline bool ValidIndex(MP4ArrayIndex index) {
+		if (m_numElements == 0 || index > m_numElements - 1) {
+			return false;
+		}
+		return true;
+	}
+
+	inline MP4ArrayIndex Size(void) {
+		return m_numElements;
+	}
+
+	inline MP4ArrayIndex MaxSize(void) {
+		return m_maxNumElements;
+	}
+
+protected:
+	MP4ArrayIndex	m_numElements;
+	MP4ArrayIndex	m_maxNumElements;
+};
+
+// macro to generate subclasses
+// we use this as an alternative to templates
+// due to the excessive compile time price of extensive template usage
+
+#define MP4ARRAY_DECL(name, type) \
+	class name##Array : public MP4Array { \
+	public: \
+		name##Array() { \
+			m_elements = NULL; \
+		} \
+		\
+		~name##Array() { \
+			MP4Free(m_elements); \
+		} \
+		\
+		inline void Add(type newElement) { \
+			Insert(newElement, m_numElements); \
+		} \
+		\
+		void Insert(type newElement, MP4ArrayIndex newIndex) { \
+			if (newIndex > m_numElements) { \
+				throw new MP4Error(ERANGE, "MP4Array::Insert"); \
+			} \
+			if (m_numElements == m_maxNumElements) { \
+				m_maxNumElements = MAX(m_maxNumElements, 1) * 2; \
+				m_elements = (type*)MP4Realloc(m_elements, \
+					m_maxNumElements * sizeof(type)); \
+			} \
+			memmove(&m_elements[newIndex + 1], &m_elements[newIndex], \
+				(m_numElements - newIndex) * sizeof(type)); \
+			m_elements[newIndex] = newElement; \
+			m_numElements++; \
+		} \
+		\
+		void Delete(MP4ArrayIndex index) { \
+			if (!ValidIndex(index)) { \
+				throw new MP4Error(ERANGE, "MP4Array::Delete"); \
+			} \
+			memmove(&m_elements[index], &m_elements[index + 1], \
+				(m_numElements - index) * sizeof(type)); \
+			m_numElements--; \
+		} \
+		void Resize(MP4ArrayIndex newSize) { \
+			m_numElements = newSize; \
+			m_maxNumElements = newSize; \
+			m_elements = (type*)MP4Realloc(m_elements, \
+				m_maxNumElements * sizeof(type)); \
+		} \
+		\
+		type& operator[](MP4ArrayIndex index) { \
+			if (!ValidIndex(index)) { \
+				throw new MP4Error(ERANGE, "MP4Array::[]"); \
+			} \
+			return m_elements[index]; \
+		} \
+		\
+	protected: \
+		type*	m_elements; \
+	};
+
+MP4ARRAY_DECL(MP4Integer8, u_int8_t)
+
+MP4ARRAY_DECL(MP4Integer16, u_int16_t)
+
+MP4ARRAY_DECL(MP4Integer32, u_int32_t)
+
+MP4ARRAY_DECL(MP4Integer64, u_int64_t)
+
+MP4ARRAY_DECL(MP4Float32, float)
+
+MP4ARRAY_DECL(MP4Float64, double)
+
+MP4ARRAY_DECL(MP4String, char*)
+
+MP4ARRAY_DECL(MP4Bytes, u_int8_t*)
+
+#endif /* __MP4_ARRAY_INCLUDED__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/mp4atom.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,790 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+#include "atoms.h"
+
+MP4AtomInfo::MP4AtomInfo(const char* name, bool mandatory, bool onlyOne) 
+{
+	m_name = name;
+	m_mandatory = mandatory;
+	m_onlyOne = onlyOne;
+	m_count = 0;
+}
+
+MP4Atom::MP4Atom(const char* type) 
+{
+	SetType(type);
+	m_unknownType = FALSE;
+	m_pFile = NULL;
+	m_start = 0;
+	m_end = 0;
+	m_size = 0;
+	m_pParentAtom = NULL;
+	m_depth = 0xFF;
+}
+
+MP4Atom::~MP4Atom()
+{
+	u_int32_t i;
+
+	for (i = 0; i < m_pProperties.Size(); i++) {
+		delete m_pProperties[i];
+	}
+	for (i = 0; i < m_pChildAtomInfos.Size(); i++) {
+		delete m_pChildAtomInfos[i];
+	}
+	for (i = 0; i < m_pChildAtoms.Size(); i++) {
+		delete m_pChildAtoms[i];
+	}
+}
+
+MP4Atom* MP4Atom::CreateAtom(const char* type)
+{
+	MP4Atom* pAtom = NULL;
+
+	if (type == NULL) {
+		pAtom = new MP4RootAtom();
+	} else if (type[0] == 'c') {
+		if (ATOMID(type) == ATOMID("ctts")) {
+			pAtom = new MP4CttsAtom();
+		} else if (ATOMID(type) == ATOMID("co64")) {
+			pAtom = new MP4Co64Atom();
+		} else if (ATOMID(type) == ATOMID("cprt")) {
+			pAtom = new MP4CprtAtom();
+		}
+	} else if (type[0] == 'd') {
+		if (ATOMID(type) == ATOMID("dinf")) {
+			pAtom = new MP4DinfAtom();
+		} else if (ATOMID(type) == ATOMID("dref")) {
+			pAtom = new MP4DrefAtom();
+		} else if (ATOMID(type) == ATOMID("dpnd")) {
+			pAtom = new MP4TrefTypeAtom(type);
+		} else if (ATOMID(type) == ATOMID("dmed")) {
+			pAtom = new MP4DmedAtom();
+		} else if (ATOMID(type) == ATOMID("dimm")) {
+			pAtom = new MP4DimmAtom();
+		} else if (ATOMID(type) == ATOMID("drep")) {
+			pAtom = new MP4DrepAtom();
+		} else if (ATOMID(type) == ATOMID("dmax")) {
+			pAtom = new MP4DmaxAtom();
+		}
+	} else if (type[0] == 'e') {
+		if (ATOMID(type) == ATOMID("esds")) {
+			pAtom = new MP4EsdsAtom();
+		} else if (ATOMID(type) == ATOMID("edts")) {
+			pAtom = new MP4EdtsAtom();
+		} else if (ATOMID(type) == ATOMID("elst")) {
+			pAtom = new MP4ElstAtom();
+		}
+	} else if (type[0] == 'h') {
+		if (ATOMID(type) == ATOMID("hdlr")) {
+			pAtom = new MP4HdlrAtom();
+		} else if (ATOMID(type) == ATOMID("hmhd")) {
+			pAtom = new MP4HmhdAtom();
+		} else if (ATOMID(type) == ATOMID("hint")) {
+			pAtom = new MP4TrefTypeAtom(type);
+		} else if (ATOMID(type) == ATOMID("hnti")) {
+			pAtom = new MP4HntiAtom();
+		} else if (ATOMID(type) == ATOMID("hinf")) {
+			pAtom = new MP4HinfAtom();
+		}
+	} else if (type[0] == 'm') {
+		if (ATOMID(type) == ATOMID("mdia")) {
+			pAtom = new MP4MdiaAtom();
+		} else if (ATOMID(type) == ATOMID("minf")) {
+			pAtom = new MP4MinfAtom();
+		} else if (ATOMID(type) == ATOMID("mdhd")) {
+			pAtom = new MP4MdhdAtom();
+		} else if (ATOMID(type) == ATOMID("mdat")) {
+			pAtom = new MP4MdatAtom();
+		} else if (ATOMID(type) == ATOMID("moov")) {
+			pAtom = new MP4MoovAtom();
+		} else if (ATOMID(type) == ATOMID("mvhd")) {
+			pAtom = new MP4MvhdAtom();
+		} else if (ATOMID(type) == ATOMID("mpod")) {
+			pAtom = new MP4TrefTypeAtom(type);
+		} else if (ATOMID(type) == ATOMID("mp4a")) {
+			pAtom = new MP4Mp4aAtom();
+		} else if (ATOMID(type) == ATOMID("mp4s")) {
+			pAtom = new MP4Mp4sAtom();
+		} else if (ATOMID(type) == ATOMID("mp4v")) {
+			pAtom = new MP4Mp4vAtom();
+		} else if (ATOMID(type) == ATOMID("moof")) {
+			pAtom = new MP4MoofAtom();
+		} else if (ATOMID(type) == ATOMID("mfhd")) {
+			pAtom = new MP4MfhdAtom();
+		} else if (ATOMID(type) == ATOMID("mvex")) {
+			pAtom = new MP4MvexAtom();
+		} else if (ATOMID(type) == ATOMID("maxr")) {
+			pAtom = new MP4MaxrAtom();
+		}
+	} else if (type[0] == 's') {
+		if (ATOMID(type) == ATOMID("stbl")) {
+			pAtom = new MP4StblAtom();
+		} else if (ATOMID(type) == ATOMID("stsd")) {
+			pAtom = new MP4StsdAtom();
+		} else if (ATOMID(type) == ATOMID("stts")) {
+			pAtom = new MP4SttsAtom();
+		} else if (ATOMID(type) == ATOMID("stsz")) {
+			pAtom = new MP4StszAtom();
+		} else if (ATOMID(type) == ATOMID("stsc")) {
+			pAtom = new MP4StscAtom();
+		} else if (ATOMID(type) == ATOMID("stco")) {
+			pAtom = new MP4StcoAtom();
+		} else if (ATOMID(type) == ATOMID("stss")) {
+			pAtom = new MP4StssAtom();
+		} else if (ATOMID(type) == ATOMID("stsh")) {
+			pAtom = new MP4StshAtom();
+		} else if (ATOMID(type) == ATOMID("stdp")) {
+			pAtom = new MP4StdpAtom();
+		} else if (ATOMID(type) == ATOMID("smhd")) {
+			pAtom = new MP4SmhdAtom();
+		} else if (ATOMID(type) == ATOMID("sdp ")) {
+			pAtom = new MP4SdpAtom();
+		} else if (ATOMID(type) == ATOMID("snro")) {
+			pAtom = new MP4SnroAtom();
+		} else if (ATOMID(type) == ATOMID("sync")) {
+			pAtom = new MP4TrefTypeAtom(type);
+		} else if (ATOMID(type) == ATOMID("skip")) {
+			pAtom = new MP4FreeAtom();
+			pAtom->SetType("skip");
+		}
+	} else if (type[0] == 't') {
+		if (ATOMID(type) == ATOMID("trak")) {
+			pAtom = new MP4TrakAtom();
+		} else if (ATOMID(type) == ATOMID("tkhd")) {
+			pAtom = new MP4TkhdAtom();
+		} else if (ATOMID(type) == ATOMID("tref")) {
+			pAtom = new MP4TrefAtom();
+		} else if (ATOMID(type) == ATOMID("traf")) {
+			pAtom = new MP4TrafAtom();
+		} else if (ATOMID(type) == ATOMID("tfhd")) {
+			pAtom = new MP4TfhdAtom();
+		} else if (ATOMID(type) == ATOMID("trex")) {
+			pAtom = new MP4TrexAtom();
+		} else if (ATOMID(type) == ATOMID("trun")) {
+			pAtom = new MP4TrunAtom();
+		} else if (ATOMID(type) == ATOMID("tmin")) {
+			pAtom = new MP4TminAtom();
+		} else if (ATOMID(type) == ATOMID("tmax")) {
+			pAtom = new MP4TmaxAtom();
+		} else if (ATOMID(type) == ATOMID("trpy")) {
+			pAtom = new MP4TrpyAtom();
+		} else if (ATOMID(type) == ATOMID("tpyl")) {
+			pAtom = new MP4TpylAtom();
+		} else if (ATOMID(type) == ATOMID("tims")) {
+			pAtom = new MP4TimsAtom();
+		} else if (ATOMID(type) == ATOMID("tsro")) {
+			pAtom = new MP4TsroAtom();
+		}
+	} else if (type[0] == 'u') {
+		if (ATOMID(type) == ATOMID("udta")) {
+			pAtom = new MP4UdtaAtom();
+		} else if (ATOMID(type) == ATOMID("url ")) {
+			pAtom = new MP4UrlAtom();
+		} else if (ATOMID(type) == ATOMID("urn ")) {
+			pAtom = new MP4UrnAtom();
+		}
+	} else {
+		if (ATOMID(type) == ATOMID("free")) {
+			pAtom = new MP4FreeAtom();
+		} else if (ATOMID(type) == ATOMID("ftyp")) {
+			pAtom = new MP4FtypAtom();
+		} else if (ATOMID(type) == ATOMID("iods")) {
+			pAtom = new MP4IodsAtom();
+		} else if (ATOMID(type) == ATOMID("ipir")) {
+			pAtom = new MP4TrefTypeAtom(type);
+		} else if (ATOMID(type) == ATOMID("nmhd")) {
+			pAtom = new MP4NmhdAtom();
+		} else if (ATOMID(type) == ATOMID("nump")) {
+			pAtom = new MP4NumpAtom();
+		} else if (ATOMID(type) == ATOMID("pmax")) {
+			pAtom = new MP4PmaxAtom();
+		} else if (ATOMID(type) == ATOMID("payt")) {
+			pAtom = new MP4PaytAtom();
+		} else if (ATOMID(type) == ATOMID("rtp ")) {
+			pAtom = new MP4RtpAtom();
+		} else if (ATOMID(type) == ATOMID("vmhd")) {
+			pAtom = new MP4VmhdAtom();
+		}
+	}
+
+	if (pAtom == NULL) {
+		pAtom = new MP4Atom(type);
+		pAtom->SetUnknownType(true);
+	}
+
+	ASSERT(pAtom);
+	return pAtom;
+}
+
+// generate a skeletal self
+
+void MP4Atom::Generate()
+{
+	u_int32_t i;
+
+	// for all properties
+	for (i = 0; i < m_pProperties.Size(); i++) {
+		// ask it to self generate
+		m_pProperties[i]->Generate();
+	}
+
+	// for all mandatory, single child atom types
+	for (i = 0; i < m_pChildAtomInfos.Size(); i++) {
+		if (m_pChildAtomInfos[i]->m_mandatory
+		  && m_pChildAtomInfos[i]->m_onlyOne) {
+
+			// create the mandatory, single child atom
+			MP4Atom* pChildAtom = 
+				CreateAtom(m_pChildAtomInfos[i]->m_name);
+
+			AddChildAtom(pChildAtom);
+
+			// and ask it to self generate
+			pChildAtom->Generate();
+		}
+	}
+}
+
+MP4Atom* MP4Atom::ReadAtom(MP4File* pFile, MP4Atom* pParentAtom)
+{
+	u_int8_t hdrSize = 8;
+	u_int8_t extendedType[16];
+
+	u_int64_t pos = pFile->GetPosition();
+
+	VERBOSE_READ(pFile->GetVerbosity(), 
+		printf("ReadAtom: pos = 0x"LLX"\n", pos));
+
+	u_int64_t dataSize = pFile->ReadUInt32();
+
+	char type[5];
+	pFile->ReadBytes((u_int8_t*)&type[0], 4);
+	type[4] = '\0';
+	
+	// extended size
+	if (dataSize == 1) {
+		dataSize = pFile->ReadUInt64(); 
+		hdrSize += 8;
+	}
+
+	// extended type
+	if (ATOMID(type) == ATOMID("uuid")) {
+		pFile->ReadBytes(extendedType, sizeof(extendedType));
+		hdrSize += sizeof(extendedType);
+	}
+
+	if (dataSize == 0) {
+		// extends to EOF
+		dataSize = pFile->GetSize() - pos;
+	}
+
+	dataSize -= hdrSize;
+
+	VERBOSE_READ(pFile->GetVerbosity(), 
+		printf("ReadAtom: type = %s data-size = "LLU" (0x"LLX")\n", 
+			type, dataSize, dataSize));
+
+	if (pos + hdrSize + dataSize > pParentAtom->GetEnd()) {
+		VERBOSE_READ(pFile->GetVerbosity(), 
+			printf("ReadAtom: invalid atom size, extends outside parent atom\n"));
+		throw new MP4Error("invalid atom size", "ReadAtom");
+	}
+
+
+	MP4Atom* pAtom = CreateAtom(type);
+	pAtom->SetFile(pFile);
+	pAtom->SetStart(pos);
+	pAtom->SetEnd(pos + hdrSize + dataSize);
+	pAtom->SetSize(dataSize);
+	if (ATOMID(type) == ATOMID("uuid")) {
+		pAtom->SetExtendedType(extendedType);
+	}
+	if (pAtom->IsUnknownType()) {
+		if (!IsReasonableType(pAtom->GetType())) {
+			VERBOSE_READ(pFile->GetVerbosity(),
+				printf("Warning: atom type %s is suspect\n", pAtom->GetType()));
+		} else {
+			VERBOSE_READ(pFile->GetVerbosity(),
+				printf("Info: atom type %s is unknown\n", pAtom->GetType()));
+		}
+
+		if (dataSize > 0) {
+			pAtom->AddProperty(
+				new MP4BytesProperty("data", dataSize));
+		}
+	}
+
+	pAtom->SetParentAtom(pParentAtom);
+
+	pAtom->Read();
+
+	return pAtom;
+}
+
+bool MP4Atom::IsReasonableType(const char* type)
+{
+	for (u_int8_t i = 0; i < 4; i++) {
+		if (isalnum(type[i])) {
+			continue;
+		}
+		if (i == 3 && type[i] == ' ') {
+			continue;
+		}
+		return false;
+	}
+	return true;
+}
+
+// generic read
+void MP4Atom::Read()
+{
+	ASSERT(m_pFile);
+
+	if (ATOMID(m_type) != 0 && m_size > 1000000) {
+		VERBOSE_READ(GetVerbosity(), 
+			printf("Warning: %s atom size "LLU" is suspect\n",
+				m_type, m_size));
+	}
+
+	ReadProperties();
+
+	// read child atoms, if we expect there to be some
+	if (m_pChildAtomInfos.Size() > 0) {
+		ReadChildAtoms();
+	}
+
+	Skip();	// to end of atom
+}
+
+void MP4Atom::Skip()
+{
+	if (m_pFile->GetPosition() != m_end) {
+		VERBOSE_READ(m_pFile->GetVerbosity(),
+			printf("Skip: "LLU" bytes\n", m_end - m_pFile->GetPosition()));
+	}
+	m_pFile->SetPosition(m_end);
+}
+
+MP4Atom* MP4Atom::FindAtom(const char* name)
+{
+	if (!IsMe(name)) {
+		return NULL;
+	}
+
+	if (!IsRootAtom()) {
+		VERBOSE_FIND(m_pFile->GetVerbosity(),
+			printf("FindAtom: matched %s\n", name));
+
+		name = MP4NameAfterFirst(name);
+
+		// I'm the sought after atom 
+		if (name == NULL) {
+			return this;
+		}
+	}
+
+	// else it's one of my children
+	return FindChildAtom(name);
+}
+
+bool MP4Atom::FindProperty(const char *name, 
+	MP4Property** ppProperty, u_int32_t* pIndex)
+{
+	if (!IsMe(name)) {
+		return false;
+	}
+
+	if (!IsRootAtom()) {
+		VERBOSE_FIND(m_pFile->GetVerbosity(),
+			printf("FindProperty: matched %s\n", name));
+
+		name = MP4NameAfterFirst(name);
+
+		// no property name given
+		if (name == NULL) {
+			return false;
+		}
+	}
+
+	return FindContainedProperty(name, ppProperty, pIndex);
+}
+
+bool MP4Atom::IsMe(const char* name)
+{
+	if (name == NULL) {
+		return false;
+	}
+
+	// root atom always matches
+	if (!strcmp(m_type, "")) {
+		return true;
+	}
+
+	// check if our atom name is specified as the first component
+	if (!MP4NameFirstMatches(m_type, name)) {
+		return false;
+	}
+
+	return true;
+}
+
+MP4Atom* MP4Atom::FindChildAtom(const char* name)
+{
+	u_int32_t atomIndex = 0;
+
+	// get the index if we have one, e.g. moov.trak[2].mdia...
+	MP4NameFirstIndex(name, &atomIndex);
+
+	// need to get to the index'th child atom of the right type
+	for (u_int32_t i = 0; i < m_pChildAtoms.Size(); i++) {
+		if (MP4NameFirstMatches(m_pChildAtoms[i]->GetType(), name)) {
+			if (atomIndex == 0) {
+				// this is the one, ask it to match
+				return m_pChildAtoms[i]->FindAtom(name);
+			}
+			atomIndex--;
+		}
+	}
+
+	return NULL;
+}
+
+bool MP4Atom::FindContainedProperty(const char *name,
+	MP4Property** ppProperty, u_int32_t* pIndex)
+{
+	u_int32_t numProperties = m_pProperties.Size();
+	u_int32_t i;
+	// check all of our properties
+	for (i = 0; i < numProperties; i++) {
+		if (m_pProperties[i]->FindProperty(name, ppProperty, pIndex)) {
+			return true;
+		}
+	}
+
+	// not one of our properties, 
+	// presumably one of our children's properties
+	// check child atoms...
+
+	// check if we have an index, e.g. trak[2].mdia...
+	u_int32_t atomIndex = 0;
+	MP4NameFirstIndex(name, &atomIndex);
+
+	// need to get to the index'th child atom of the right type
+	for (i = 0; i < m_pChildAtoms.Size(); i++) {
+		if (MP4NameFirstMatches(m_pChildAtoms[i]->GetType(), name)) {
+			if (atomIndex == 0) {
+				// this is the one, ask it to match
+				return m_pChildAtoms[i]->FindProperty(name, ppProperty, pIndex);
+			}
+			atomIndex--;
+		}
+	}
+
+	VERBOSE_FIND(m_pFile->GetVerbosity(),
+		printf("FindProperty: no match for %s\n", name));
+	return false;
+}
+
+void MP4Atom::ReadProperties(u_int32_t startIndex, u_int32_t count)
+{
+	u_int32_t numProperties = MIN(count, m_pProperties.Size() - startIndex);
+
+	// read any properties of the atom
+	for (u_int32_t i = startIndex; i < startIndex + numProperties; i++) {
+
+		m_pProperties[i]->Read(m_pFile);
+
+		if (m_pFile->GetPosition() > m_end) {
+			VERBOSE_READ(GetVerbosity(), 
+				printf("ReadProperties: insufficient data for property: %s pos 0x"LLX" atom end 0x"LLX"\n",
+					m_pProperties[i]->GetName(), 
+					m_pFile->GetPosition(), m_end)); 
+
+			throw new MP4Error("atom is too small", "Atom ReadProperties");
+		}
+
+		if (m_pProperties[i]->GetType() == TableProperty) {
+			VERBOSE_READ_TABLE(GetVerbosity(), 
+				printf("Read: "); m_pProperties[i]->Dump(stdout, 0, true));
+		} else if (m_pProperties[i]->GetType() != DescriptorProperty) {
+			VERBOSE_READ(GetVerbosity(), 
+				printf("Read: "); m_pProperties[i]->Dump(stdout, 0, true));
+		}
+	}
+}
+
+void MP4Atom::ReadChildAtoms()
+{
+	VERBOSE_READ(GetVerbosity(), 
+		printf("ReadChildAtoms: of %s\n", m_type[0] ? m_type : "root"));
+
+	// read any child atoms
+	while (m_pFile->GetPosition() < m_end) {
+		MP4Atom* pChildAtom = MP4Atom::ReadAtom(m_pFile, this);
+
+		AddChildAtom(pChildAtom);
+
+		MP4AtomInfo* pChildAtomInfo = FindAtomInfo(pChildAtom->GetType());
+
+		// if child atom is of known type
+		// but not expected here print warning
+		if (pChildAtomInfo == NULL && !pChildAtom->IsUnknownType()) {
+			VERBOSE_READ(GetVerbosity(),
+				printf("Warning: In atom %s unexpected child atom %s\n",
+					GetType(), pChildAtom->GetType()));
+		}
+
+		// if child atoms should have just one instance
+		// and this is more than one, print warning
+		if (pChildAtomInfo) {
+			pChildAtomInfo->m_count++;
+
+			if (pChildAtomInfo->m_onlyOne && pChildAtomInfo->m_count > 1) {
+				VERBOSE_READ(GetVerbosity(),
+					printf("Warning: In atom %s multiple child atoms %s\n",
+						GetType(), pChildAtom->GetType()));
+			}
+		}
+	}
+
+	// if mandatory child atom doesn't exist, print warning
+	u_int32_t numAtomInfo = m_pChildAtomInfos.Size();
+	for (u_int32_t i = 0; i < numAtomInfo; i++) {
+		if (m_pChildAtomInfos[i]->m_mandatory
+		  && m_pChildAtomInfos[i]->m_count == 0) {
+				VERBOSE_READ(GetVerbosity(),
+					printf("Warning: In atom %s missing child atom %s\n",
+						GetType(), m_pChildAtomInfos[i]->m_name));
+		}
+	}
+
+	VERBOSE_READ(GetVerbosity(), 
+		printf("ReadChildAtoms: finished %s\n", m_type));
+}
+
+MP4AtomInfo* MP4Atom::FindAtomInfo(const char* name)
+{
+	u_int32_t numAtomInfo = m_pChildAtomInfos.Size();
+	for (u_int32_t i = 0; i < numAtomInfo; i++) {
+		if (ATOMID(m_pChildAtomInfos[i]->m_name) == ATOMID(name)) {
+			return m_pChildAtomInfos[i];
+		}
+	}
+	return NULL;
+}
+
+// generic write
+void MP4Atom::Write()
+{
+	ASSERT(m_pFile);
+
+	BeginWrite();
+
+	WriteProperties();
+
+	WriteChildAtoms();
+
+	FinishWrite();
+}
+
+void MP4Atom::BeginWrite(bool use64)
+{
+	m_start = m_pFile->GetPosition();
+	if (use64) {
+		m_pFile->WriteUInt32(1);
+	} else {
+		m_pFile->WriteUInt32(0);
+	}
+	m_pFile->WriteBytes((u_int8_t*)&m_type[0], 4);
+	if (use64) {
+		m_pFile->WriteUInt64(0);
+	}
+	if (ATOMID(m_type) == ATOMID("uuid")) {
+		m_pFile->WriteBytes(m_extendedType, sizeof(m_extendedType));
+	}
+}
+
+void MP4Atom::FinishWrite(bool use64)
+{
+	m_end = m_pFile->GetPosition();
+	m_size = (m_end - m_start);
+	if (use64) {
+		m_pFile->SetPosition(m_start + 8);
+		m_pFile->WriteUInt64(m_size);
+	} else {
+		ASSERT(m_size <= (u_int64_t)0xFFFFFFFF);
+		m_pFile->SetPosition(m_start);
+		m_pFile->WriteUInt32(m_size);
+	}
+	m_pFile->SetPosition(m_end);
+
+	// adjust size to just reflect data portion of atom
+	m_size -= (use64 ? 16 : 8);
+	if (ATOMID(m_type) == ATOMID("uuid")) {
+		m_size -= sizeof(m_extendedType);
+	}
+}
+
+void MP4Atom::WriteProperties(u_int32_t startIndex, u_int32_t count)
+{
+	u_int32_t numProperties = MIN(count, m_pProperties.Size() - startIndex);
+
+	VERBOSE_WRITE(GetVerbosity(), 
+		printf("Write: type %s\n", m_type));
+
+	for (u_int32_t i = startIndex; i < startIndex + numProperties; i++) {
+		m_pProperties[i]->Write(m_pFile);
+
+		if (m_pProperties[i]->GetType() == TableProperty) {
+			VERBOSE_WRITE_TABLE(GetVerbosity(), 
+				printf("Write: "); m_pProperties[i]->Dump(stdout, 0, false));
+		} else {
+			VERBOSE_WRITE(GetVerbosity(), 
+				printf("Write: "); m_pProperties[i]->Dump(stdout, 0, false));
+		}
+	}
+}
+
+void MP4Atom::WriteChildAtoms()
+{
+	u_int32_t size = m_pChildAtoms.Size();
+	for (u_int32_t i = 0; i < size; i++) {
+		m_pChildAtoms[i]->Write();
+	}
+
+	VERBOSE_WRITE(GetVerbosity(), 
+		printf("Write: finished %s\n", m_type));
+}
+
+void MP4Atom::AddProperty(MP4Property* pProperty) 
+{
+	ASSERT(pProperty);
+	m_pProperties.Add(pProperty);
+	pProperty->SetParentAtom(this);
+}
+
+void MP4Atom::AddVersionAndFlags()
+{
+	AddProperty(new MP4Integer8Property("version"));
+	AddProperty(new MP4Integer24Property("flags"));
+}
+
+void MP4Atom::AddReserved(char* name, u_int32_t size) 
+{
+	MP4BytesProperty* pReserved = new MP4BytesProperty(name, size); 
+	pReserved->SetReadOnly();
+	AddProperty(pReserved);
+}
+
+void MP4Atom::ExpectChildAtom(const char* name, bool mandatory, bool onlyOne)
+{
+	m_pChildAtomInfos.Add(new MP4AtomInfo(name, mandatory, onlyOne));
+}
+
+u_int8_t MP4Atom::GetVersion()
+{
+	if (strcmp("version", m_pProperties[0]->GetName())) {
+		return 0;
+	}
+	return ((MP4Integer8Property*)m_pProperties[0])->GetValue();
+}
+
+void MP4Atom::SetVersion(u_int8_t version) 
+{
+	if (strcmp("version", m_pProperties[0]->GetName())) {
+		return;
+	}
+	((MP4Integer8Property*)m_pProperties[0])->SetValue(version);
+}
+
+u_int32_t MP4Atom::GetFlags()
+{
+	if (strcmp("flags", m_pProperties[1]->GetName())) {
+		return 0;
+	}
+	return ((MP4Integer24Property*)m_pProperties[1])->GetValue();
+}
+
+void MP4Atom::SetFlags(u_int32_t flags) 
+{
+	if (strcmp("flags", m_pProperties[1]->GetName())) {
+		return;
+	}
+	((MP4Integer24Property*)m_pProperties[1])->SetValue(flags);
+}
+
+void MP4Atom::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits)
+{
+	if (m_type[0] != '\0') {
+		Indent(pFile, indent);
+		fprintf(pFile, "type %s\n", m_type);
+	}
+
+	u_int32_t i;
+	u_int32_t size;
+
+	// dump our properties
+	size = m_pProperties.Size();
+	for (i = 0; i < size; i++) {
+
+		/* skip details of tables unless we're told to be verbose */
+		if (m_pProperties[i]->GetType() == TableProperty
+		  && !(GetVerbosity() & MP4_DETAILS_TABLE)) {
+			Indent(pFile, indent + 1);
+			fprintf(pFile, "<table entries suppressed>\n");
+			continue;
+		}
+
+		m_pProperties[i]->Dump(pFile, indent + 1, dumpImplicits);
+	}
+
+	// dump our children
+	size = m_pChildAtoms.Size();
+	for (i = 0; i < size; i++) {
+		m_pChildAtoms[i]->Dump(pFile, indent + 1, dumpImplicits);
+	}
+}
+
+u_int32_t MP4Atom::GetVerbosity() 
+{
+	ASSERT(m_pFile);
+	return m_pFile->GetVerbosity();
+}
+
+u_int8_t MP4Atom::GetDepth()
+{
+	if (m_depth < 0xFF) {
+		return m_depth;
+	}
+
+	MP4Atom *pAtom = this;
+	m_depth = 0;
+
+	while ((pAtom = pAtom->GetParentAtom()) != NULL) {
+		m_depth++;
+		ASSERT(m_depth < 255);
+	}
+	return m_depth;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/mp4atom.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,231 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#ifndef __MP4_ATOM_INCLUDED__
+#define __MP4_ATOM_INCLUDED__
+
+class MP4Atom;
+MP4ARRAY_DECL(MP4Atom, MP4Atom*);
+
+#define Required	true
+#define Optional	false
+#define OnlyOne		true
+#define Many		false
+#define Counted		true
+
+/* helper class */
+class MP4AtomInfo {
+public:
+	MP4AtomInfo() {
+		m_name = NULL;
+	}
+	MP4AtomInfo(const char* name, bool mandatory, bool onlyOne);
+
+	const char* m_name;
+	bool m_mandatory;
+	bool m_onlyOne;
+	u_int32_t m_count;
+};
+
+MP4ARRAY_DECL(MP4AtomInfo, MP4AtomInfo*);
+
+class MP4Atom {
+public:
+	MP4Atom(const char* type = NULL);
+	virtual ~MP4Atom();
+
+	static MP4Atom* ReadAtom(MP4File* pFile, MP4Atom* pParentAtom);
+	static MP4Atom* CreateAtom(const char* type);
+	static bool IsReasonableType(const char* type);
+
+	MP4File* GetFile() {
+		return m_pFile;
+	};
+	void SetFile(MP4File* pFile) {
+		m_pFile = pFile;
+	};
+
+	u_int64_t GetStart() {
+		return m_start;
+	};
+	void SetStart(u_int64_t pos) {
+		m_start = pos;
+	};
+
+	u_int64_t GetEnd() {
+		return m_end;
+	};
+	void SetEnd(u_int64_t pos) {
+		m_end = pos;
+	};
+
+	u_int64_t GetSize() {
+		return m_size;
+	}
+	void SetSize(u_int64_t size) {
+		m_size = size;
+	}
+
+	const char* GetType() {
+		return m_type;
+	};
+	void SetType(const char* type) {
+		if (type) {
+			ASSERT(strlen(type) == 4);
+			memcpy(m_type, type, 4);
+			m_type[4] = '\0';
+		} else {
+			memset(m_type, 0, 5);
+		}
+	}
+
+	void GetExtendedType(u_int8_t* pExtendedType) {
+		memcpy(pExtendedType, m_extendedType, sizeof(m_extendedType));
+	};
+	void SetExtendedType(u_int8_t* pExtendedType) {
+		memcpy(m_extendedType, pExtendedType, sizeof(m_extendedType));
+	};
+
+	bool IsUnknownType() {
+		return m_unknownType;
+	}
+	void SetUnknownType(bool unknownType = true) {
+		m_unknownType = unknownType;
+	}
+
+	bool IsRootAtom() {
+		return m_type[0] == '\0';
+	}
+
+	MP4Atom* GetParentAtom() {
+		return m_pParentAtom;
+	}
+	void SetParentAtom(MP4Atom* pParentAtom) {
+		m_pParentAtom = pParentAtom;
+	}
+
+	void AddChildAtom(MP4Atom* pChildAtom) {
+		pChildAtom->SetFile(m_pFile);
+		pChildAtom->SetParentAtom(this);
+		m_pChildAtoms.Add(pChildAtom);
+	}
+
+	void InsertChildAtom(MP4Atom* pChildAtom, u_int32_t index) {
+		pChildAtom->SetFile(m_pFile);
+		pChildAtom->SetParentAtom(this);
+		m_pChildAtoms.Insert(pChildAtom, index);
+	}
+
+	void DeleteChildAtom(MP4Atom* pChildAtom) {
+		for (MP4ArrayIndex i = 0; i < m_pChildAtoms.Size(); i++) {
+			if (m_pChildAtoms[i] == pChildAtom) {
+				m_pChildAtoms.Delete(i);
+				return;
+			}
+		}
+	}
+
+	u_int32_t GetNumberOfChildAtoms() {
+		return m_pChildAtoms.Size();
+	}
+
+	MP4Atom* GetChildAtom(u_int32_t index) {
+		return m_pChildAtoms[index];
+	}
+
+	MP4Property* GetProperty(u_int32_t index) {
+		return m_pProperties[index];
+	}
+
+	MP4Atom* FindAtom(const char* name);
+
+	MP4Atom* FindChildAtom(const char* name);
+
+	bool FindProperty(const char* name, 
+		MP4Property** ppProperty, u_int32_t* pIndex = NULL);
+
+	u_int32_t GetFlags();
+	void SetFlags(u_int32_t flags);
+
+	u_int8_t GetDepth();
+
+	void Skip();
+
+	virtual void Generate();
+	virtual void Read();
+	virtual void BeginWrite(bool use64 = false);
+	virtual void Write();
+	virtual void FinishWrite(bool use64 = false);
+	virtual void Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits);
+
+protected:
+	void AddProperty(MP4Property* pProperty);
+
+	void AddVersionAndFlags();
+
+	void AddReserved(char* name, u_int32_t size);
+
+	void ExpectChildAtom(const char* name, 
+		bool mandatory, bool onlyOne = true);
+
+	MP4AtomInfo* FindAtomInfo(const char* name);
+
+	bool IsMe(const char* name);
+
+	bool FindContainedProperty(const char* name, 
+		MP4Property** ppProperty, u_int32_t* pIndex);
+
+	void ReadProperties(
+		u_int32_t startIndex = 0, u_int32_t count = 0xFFFFFFFF);
+	void ReadChildAtoms();
+
+	void WriteProperties(
+		u_int32_t startIndex = 0, u_int32_t count = 0xFFFFFFFF);
+	void WriteChildAtoms();
+
+	u_int8_t GetVersion();
+	void SetVersion(u_int8_t version);
+
+	/* debugging aid */
+	u_int32_t GetVerbosity();
+
+protected:
+	MP4File*	m_pFile;
+	u_int64_t	m_start;
+	u_int64_t	m_end;
+	u_int64_t	m_size;
+	char		m_type[5];
+	bool		m_unknownType;
+	u_int8_t	m_extendedType[16];
+
+	MP4Atom*	m_pParentAtom;
+	u_int8_t	m_depth;
+
+	MP4PropertyArray	m_pProperties;
+	MP4AtomInfoArray 	m_pChildAtomInfos;
+	MP4AtomArray		m_pChildAtoms;
+};
+
+inline u_int32_t ATOMID(const char* type) {
+	return STRTOINT32(type);
+}
+
+#endif /* __MP4_ATOM_INCLUDED__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/mp4common.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,50 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#ifndef __MP4_COMMON_INCLUDED__
+#define __MP4_COMMON_INCLUDED__
+
+// common includes for everything 
+// with an internal view of the library
+// i.e. all the .cpp's just #include "mp4common.h"
+
+#include "mpeg4ip.h"
+
+#include "mp4.h"
+#include "mp4util.h"
+#include "mp4array.h"
+#include "mp4track.h"
+#include "mp4file.h"
+#include "mp4property.h"
+#include "mp4container.h"
+#include "mp4descriptor.h"
+#include "mp4atom.h"
+
+#include "atoms.h"
+#include "descriptors.h"
+#include "ocidescriptors.h"
+#include "qosqualifiers.h"
+
+#include "odcommands.h"
+
+#include "rtphint.h"
+
+#endif /* __MP4_COMMON_INCLUDED__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/mp4container.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,227 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4Container::~MP4Container()
+{
+	for (u_int32_t i = 0; i < m_pProperties.Size(); i++) {
+		delete m_pProperties[i];
+	}
+}
+
+void MP4Container::AddProperty(MP4Property* pProperty) 
+{
+	ASSERT(pProperty);
+	m_pProperties.Add(pProperty);
+}
+
+bool MP4Container::FindProperty(const char *name,
+	MP4Property** ppProperty, u_int32_t* pIndex)
+{
+	if (pIndex) {
+		*pIndex = 0;	// set the default answer for index
+	}
+
+	u_int32_t numProperties = m_pProperties.Size();
+
+	for (u_int32_t i = 0; i < numProperties; i++) {
+		if (m_pProperties[i]->FindProperty(name, ppProperty, pIndex)) { 
+			return true;
+		}
+	}
+	return false;
+}
+
+void MP4Container::FindIntegerProperty(const char* name, 
+	MP4Property** ppProperty, u_int32_t* pIndex)
+{
+	if (!FindProperty(name, ppProperty, pIndex)) {
+		throw new MP4Error("no such property", 
+			"MP4Container::FindIntegerProperty");
+	}
+
+	switch ((*ppProperty)->GetType()) {
+	case Integer8Property:
+	case Integer16Property:
+	case Integer24Property:
+	case Integer32Property:
+	case Integer64Property:
+		break;
+	default:
+		throw new MP4Error("type mismatch", 
+			"MP4Container::FindIntegerProperty");
+	}
+}
+
+u_int64_t MP4Container::GetIntegerProperty(const char* name)
+{
+	MP4Property* pProperty;
+	u_int32_t index;
+
+	FindIntegerProperty(name, &pProperty, &index);
+
+	return ((MP4IntegerProperty*)pProperty)->GetValue(index);
+}
+
+void MP4Container::SetIntegerProperty(const char* name, u_int64_t value)
+{
+	MP4Property* pProperty = NULL;
+	u_int32_t index = 0;
+
+	FindIntegerProperty(name, &pProperty, &index);
+
+	((MP4IntegerProperty*)pProperty)->SetValue(value, index);
+}
+
+void MP4Container::FindFloatProperty(const char* name, 
+	MP4Property** ppProperty, u_int32_t* pIndex)
+{
+	if (!FindProperty(name, ppProperty, pIndex)) {
+		throw new MP4Error("no such property",
+			 "MP4Container::FindFloatProperty");
+	}
+	if ((*ppProperty)->GetType() != Float32Property) {
+		throw new MP4Error("type mismatch", 
+			"MP4Container::FindFloatProperty");
+	}
+}
+
+float MP4Container::GetFloatProperty(const char* name)
+{
+	MP4Property* pProperty;
+	u_int32_t index;
+
+	FindFloatProperty(name, &pProperty, &index);
+
+	return ((MP4Float32Property*)pProperty)->GetValue(index);
+}
+
+void MP4Container::SetFloatProperty(const char* name, float value)
+{
+	MP4Property* pProperty;
+	u_int32_t index;
+
+	FindFloatProperty(name, &pProperty, &index);
+
+	((MP4Float32Property*)pProperty)->SetValue(value, index);
+}
+
+void MP4Container::FindStringProperty(const char* name, 
+	MP4Property** ppProperty, u_int32_t* pIndex)
+{
+	if (!FindProperty(name, ppProperty, pIndex)) {
+		throw new MP4Error("no such property",
+			"MP4Container::FindStringProperty");
+	}
+	if ((*ppProperty)->GetType() != StringProperty) {
+		throw new MP4Error("type mismatch", 
+			"MP4Container::FindStringProperty");
+	}
+}
+
+const char* MP4Container::GetStringProperty(const char* name)
+{
+	MP4Property* pProperty;
+	u_int32_t index;
+
+	FindStringProperty(name, &pProperty, &index);
+
+	return ((MP4StringProperty*)pProperty)->GetValue(index);
+}
+
+void MP4Container::SetStringProperty(const char* name, const char* value)
+{
+	MP4Property* pProperty;
+	u_int32_t index;
+
+	FindStringProperty(name, &pProperty, &index);
+
+	((MP4StringProperty*)pProperty)->SetValue(value, index);
+}
+
+void MP4Container::FindBytesProperty(const char* name, 
+	MP4Property** ppProperty, u_int32_t* pIndex)
+{
+	if (!FindProperty(name, ppProperty, pIndex)) {
+		throw new MP4Error("no such property",
+			"MP4Container::FindBytesProperty");
+	}
+	if ((*ppProperty)->GetType() != BytesProperty) {
+		throw new MP4Error("type mismatch",
+			"MP4Container::FindBytesProperty");
+	}
+}
+
+void MP4Container::GetBytesProperty(const char* name, 
+	u_int8_t** ppValue, u_int32_t* pValueSize)
+{
+	MP4Property* pProperty;
+	u_int32_t index;
+
+	FindBytesProperty(name, &pProperty, &index);
+
+	((MP4BytesProperty*)pProperty)->GetValue(ppValue, pValueSize, index);
+}
+
+void MP4Container::SetBytesProperty(const char* name, 
+	const u_int8_t* pValue, u_int32_t valueSize)
+{
+	MP4Property* pProperty;
+	u_int32_t index;
+
+	FindBytesProperty(name, &pProperty, &index);
+
+	((MP4BytesProperty*)pProperty)->SetValue(pValue, valueSize, index);
+}
+
+void MP4Container::Read(MP4File* pFile)
+{
+	u_int32_t numProperties = m_pProperties.Size();
+
+	for (u_int32_t i = 0; i < numProperties; i++) {
+		m_pProperties[i]->Read(pFile);
+	}
+}
+
+void MP4Container::Write(MP4File* pFile)
+{
+	u_int32_t numProperties = m_pProperties.Size();
+
+	if (numProperties == 0) {
+		WARNING(numProperties == 0);
+		return;
+	}
+
+	for (u_int32_t i = 0; i < numProperties; i++) {
+		m_pProperties[i]->Write(pFile);
+	}
+}
+
+void MP4Container::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits)
+{
+	u_int32_t numProperties = m_pProperties.Size();
+
+	for (u_int32_t i = 0; i < numProperties; i++) {
+		m_pProperties[i]->Dump(pFile, indent, dumpImplicits);
+	}
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/mp4container.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,84 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#ifndef __MP4_CONTAINER_INCLUDED__
+#define __MP4_CONTAINER_INCLUDED__
+
+// base class - container of mp4 properties
+class MP4Container {
+public:
+	MP4Container() { }
+
+	virtual ~MP4Container();
+
+	void AddProperty(MP4Property* pProperty);
+
+	virtual void Read(MP4File* pFile);
+
+	virtual void Write(MP4File* pFile);
+
+	virtual void Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits);
+
+	MP4Property* GetProperty(u_int32_t index) {
+		return m_pProperties[index];
+	}
+
+	// LATER MP4Property* GetProperty(const char* name); throw on error
+	// LATER MP4Property* FindProperty(const char* name, u_int32_t* pIndex = NULL); returns NULL on error
+
+	bool FindProperty(const char* name, 
+	  MP4Property** ppProperty, u_int32_t* pIndex = NULL);
+
+	void FindIntegerProperty(const char* name, 
+		MP4Property** ppProperty, u_int32_t* pIndex = NULL);
+
+	u_int64_t GetIntegerProperty(const char* name);
+
+	void SetIntegerProperty(const char* name, u_int64_t value);
+
+	void FindFloatProperty(const char* name, 
+		MP4Property** ppProperty, u_int32_t* pIndex = NULL);
+
+	float GetFloatProperty(const char* name);
+
+	void SetFloatProperty(const char* name, float value);
+
+	void FindStringProperty(const char* name, 
+		MP4Property** ppProperty, u_int32_t* pIndex = NULL);
+
+	const char* GetStringProperty(const char* name);
+
+	void SetStringProperty(const char* name, const char* value);
+
+	void FindBytesProperty(const char* name, 
+		MP4Property** ppProperty, u_int32_t* pIndex = NULL);
+
+	void GetBytesProperty(const char* name,
+		u_int8_t** ppValue, u_int32_t* pValueSize);
+
+	void SetBytesProperty(const char* name, 
+		const u_int8_t* pValue, u_int32_t valueSize);
+
+protected:
+	MP4PropertyArray	m_pProperties;
+};
+
+#endif /* __MP4_CONTAINER_INCLUDED__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/mp4descriptor.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,211 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4Descriptor::MP4Descriptor(u_int8_t tag) {
+	m_tag = tag;
+	m_pParentAtom = NULL;
+	m_start = 0;
+	m_size = 0;
+	m_readMutatePoint = 0;
+}
+
+MP4Descriptor::~MP4Descriptor() 
+{
+	for (u_int32_t i = 0; i < m_pProperties.Size(); i++) {
+		delete m_pProperties[i];
+	}
+}
+
+void MP4Descriptor::AddProperty(MP4Property* pProperty) 
+{
+	ASSERT(pProperty);
+	m_pProperties.Add(pProperty);
+	pProperty->SetParentAtom(m_pParentAtom);
+}
+
+bool MP4Descriptor::FindContainedProperty(const char *name,
+	MP4Property** ppProperty, u_int32_t* pIndex)
+{
+	u_int32_t numProperties = m_pProperties.Size();
+
+	for (u_int32_t i = 0; i < numProperties; i++) {
+		if (m_pProperties[i]->FindProperty(name, ppProperty, pIndex)) { 
+			return true;
+		}
+	}
+	return false;
+}
+
+void MP4Descriptor::Generate()
+{
+	// generate properties
+	for (u_int32_t i = 0; i < m_pProperties.Size(); i++) {
+		m_pProperties[i]->Generate();
+	}
+}
+
+void MP4Descriptor::Read(MP4File* pFile)
+{
+	ReadHeader(pFile);
+
+	ReadProperties(pFile, 0, m_readMutatePoint);
+
+	Mutate();
+
+	ReadProperties(pFile, m_readMutatePoint);
+
+	// flush any leftover read bits
+	pFile->FlushReadBits();
+}
+
+void MP4Descriptor::ReadHeader(MP4File* pFile)
+{
+	VERBOSE_READ(pFile->GetVerbosity(),
+		printf("ReadDescriptor: pos = 0x%llx\n", 
+			pFile->GetPosition()));
+
+	// read tag and length
+	u_int8_t tag = pFile->ReadUInt8();
+	if (m_tag) {
+		ASSERT(tag == m_tag);
+	} else {
+		m_tag = tag;
+	}
+	m_size = pFile->ReadMpegLength();
+	m_start = pFile->GetPosition();
+
+	VERBOSE_READ(pFile->GetVerbosity(),
+		printf("ReadDescriptor: tag 0x%02x data size %u (0x%x)\n", 
+			m_tag, m_size, m_size));
+}
+
+void MP4Descriptor::ReadProperties(MP4File* pFile, 
+	u_int32_t propStartIndex, u_int32_t propCount)
+{
+	u_int32_t numProperties = MIN(propCount, 
+		m_pProperties.Size() - propStartIndex);
+
+	for (u_int32_t i = propStartIndex; 
+	  i < propStartIndex + numProperties; i++) {
+
+		MP4Property* pProperty = m_pProperties[i];
+
+		int32_t remaining = m_size - (pFile->GetPosition() - m_start);
+
+		if (pProperty->GetType() == DescriptorProperty) {
+		   	if (remaining > 0) {
+				// place a limit on how far this sub-descriptor looks
+				((MP4DescriptorProperty*)pProperty)->SetSizeLimit(remaining);
+				pProperty->Read(pFile);
+			} // else do nothing, empty descriptor
+		} else {
+			// non-descriptor property
+			if (remaining >= 0) {
+				pProperty->Read(pFile);
+
+				if (pProperty->GetType() == TableProperty) {
+					VERBOSE_READ_TABLE(pFile->GetVerbosity(), 
+						printf("Read: "); pProperty->Dump(stdout, 0, true));
+				} else {
+					VERBOSE_READ(pFile->GetVerbosity(), 
+						printf("Read: "); pProperty->Dump(stdout, 0, true));
+				}
+			} else {
+				VERBOSE_ERROR(pFile->GetVerbosity(),
+					printf("Overran descriptor, tag %u data size %u property %u\n",
+					m_tag, m_size, i));
+				throw new MP4Error("overran descriptor",
+					 "MP4Descriptor::ReadProperties");
+			}
+		} 
+	}
+}
+
+void MP4Descriptor::Write(MP4File* pFile)
+{
+	// call virtual function to adapt properties before writing
+	Mutate();
+
+	u_int32_t numProperties = m_pProperties.Size();
+
+	if (numProperties == 0) {
+		WARNING(numProperties == 0);
+		return;
+	}
+
+	// write tag and length placeholder
+	pFile->WriteUInt8(m_tag);
+	u_int64_t lengthPos = pFile->GetPosition();
+	pFile->WriteMpegLength(0);
+	u_int64_t startPos = pFile->GetPosition();
+
+	for (u_int32_t i = 0; i < numProperties; i++) {
+		m_pProperties[i]->Write(pFile);
+	}
+
+	// align with byte boundary (rarely necessary)
+	pFile->PadWriteBits();
+
+	// go back and write correct length
+	u_int64_t endPos = pFile->GetPosition();
+	pFile->SetPosition(lengthPos);
+	pFile->WriteMpegLength(endPos - startPos);
+	pFile->SetPosition(endPos);
+}
+
+void MP4Descriptor::WriteToMemory(MP4File* pFile,
+	u_int8_t** ppBytes, u_int64_t* pNumBytes)
+{
+	// use memory buffer to save descriptor in memory
+	// instead of going directly to disk
+
+	pFile->EnableMemoryBuffer();
+
+	Write(pFile);
+
+	pFile->DisableMemoryBuffer(ppBytes, pNumBytes);
+}
+
+void MP4Descriptor::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits)
+{
+	// call virtual function to adapt properties before dumping
+	Mutate();
+
+	u_int32_t numProperties = m_pProperties.Size();
+
+	if (numProperties == 0) {
+		WARNING(numProperties == 0);
+		return;
+	}
+	for (u_int32_t i = 0; i < numProperties; i++) {
+		m_pProperties[i]->Dump(pFile, indent, dumpImplicits);
+	}
+}
+
+u_int8_t MP4Descriptor::GetDepth() 
+{
+	if (m_pParentAtom) {
+		return m_pParentAtom->GetDepth();
+	}
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/mp4descriptor.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,96 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#ifndef __MP4_DESCRIPTOR_INCLUDED__
+#define __MP4_DESCRIPTOR_INCLUDED__
+
+class MP4Descriptor {
+public:
+	MP4Descriptor(u_int8_t tag = 0);
+
+	virtual ~MP4Descriptor();
+
+	u_int8_t GetTag() {
+		return m_tag;
+	}
+	void SetTag(u_int8_t tag) {
+		m_tag = tag;
+	}
+
+	void SetParentAtom(MP4Atom* pParentAtom) {
+		m_pParentAtom = pParentAtom;
+		for (u_int32_t i = 0; i < m_pProperties.Size(); i++) {
+			m_pProperties[i]->SetParentAtom(pParentAtom);
+		}
+	}
+
+	void AddProperty(MP4Property* pProperty);
+
+	virtual void Generate();
+	virtual void Read(MP4File* pFile);
+	virtual void Write(MP4File* pFile);
+	virtual void Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits);
+
+	MP4Property* GetProperty(u_int32_t index) {
+		return m_pProperties[index];
+	}
+
+	// use with extreme caution
+	void SetProperty(u_int32_t index, MP4Property* pProperty) {
+		m_pProperties[index] = pProperty;
+	}
+
+	bool FindProperty(const char* name, 
+	  MP4Property** ppProperty, u_int32_t* pIndex = NULL) {
+		return FindContainedProperty(name, ppProperty, pIndex);
+	}
+
+	void WriteToMemory(MP4File* pFile,
+		 u_int8_t** ppBytes, u_int64_t* pNumBytes);
+
+protected:
+	void SetReadMutate(u_int32_t propIndex) {
+		m_readMutatePoint = propIndex;
+	}
+
+	void ReadHeader(MP4File* pFile);
+	void ReadProperties(MP4File* pFile,
+		u_int32_t startIndex = 0, u_int32_t count = 0xFFFFFFFF);
+
+	virtual void Mutate() {
+		// default is a no-op
+	};
+
+	bool FindContainedProperty(const char* name,
+		MP4Property** ppProperty, u_int32_t* pIndex);
+
+	u_int8_t GetDepth();
+
+protected:
+	MP4Atom*			m_pParentAtom;
+	u_int8_t			m_tag;
+	u_int64_t			m_start;
+	u_int32_t			m_size;
+	MP4PropertyArray	m_pProperties;
+	u_int32_t			m_readMutatePoint;
+};
+
+#endif /* __MP4_DESCRIPTOR_INCLUDED__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/mp4file.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,2279 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4File::MP4File(u_int32_t verbosity)
+{
+	m_fileName = NULL;
+	m_pFile = NULL;
+	m_orgFileSize = 0;
+	m_fileSize = 0;
+	m_pRootAtom = NULL;
+	m_odTrackId = MP4_INVALID_TRACK_ID;
+
+	m_verbosity = verbosity;
+	m_mode = 0;
+	m_use64bits = false;
+	m_useIsma = false;
+
+	m_pModificationProperty = NULL;
+	m_pTimeScaleProperty = NULL;
+	m_pDurationProperty = NULL;
+
+	m_memoryBuffer = NULL;
+	m_memoryBufferSize = 0;
+	m_memoryBufferPosition = 0;
+
+	m_numReadBits = 0;
+	m_bufReadBits = 0;
+	m_numWriteBits = 0;
+	m_bufWriteBits = 0;
+}
+
+MP4File::~MP4File()
+{
+	MP4Free(m_fileName);
+	delete m_pRootAtom;
+	for (u_int32_t i = 0; i < m_pTracks.Size(); i++) {
+		delete m_pTracks[i];
+	}
+	MP4Free(m_memoryBuffer);	// just in case
+}
+
+void MP4File::Read(const char* fileName)
+{
+	m_fileName = MP4Stralloc(fileName);
+	m_mode = 'r';
+
+	Open("rb");
+
+	ReadFromFile();
+
+	CacheProperties();
+}
+
+void MP4File::Create(const char* fileName, bool use64bits)
+{
+	m_fileName = MP4Stralloc(fileName);
+	m_mode = 'w';
+	m_use64bits = use64bits;
+
+	Open("wb+");
+
+	// generate a skeletal atom tree
+	m_pRootAtom = MP4Atom::CreateAtom(NULL);
+	m_pRootAtom->SetFile(this);
+	m_pRootAtom->Generate();
+
+	CacheProperties();
+
+	// create mdat, and insert it after ftyp, and before moov
+	InsertChildAtom(m_pRootAtom, "mdat", 1);
+
+	// start writing
+	m_pRootAtom->BeginWrite();
+}
+
+void MP4File::Modify(const char* fileName)
+{
+	m_fileName = MP4Stralloc(fileName);
+	m_mode = 'r';
+
+	Open("rb+");
+	ReadFromFile();
+
+	m_mode = 'w';
+
+	// find the moov atom
+	MP4Atom* pMoovAtom = m_pRootAtom->FindAtom("moov");
+	u_int32_t numAtoms;
+
+	if (pMoovAtom == NULL) {
+		// there isn't one, odd but we can still proceed
+		pMoovAtom = AddChildAtom(m_pRootAtom, "moov");
+	} else {
+		numAtoms = m_pRootAtom->GetNumberOfChildAtoms();
+
+		// work backwards thru the top level atoms
+		int32_t i;
+		bool lastAtomIsMoov = true;
+		MP4Atom* pLastAtom = NULL;
+
+		for (i = numAtoms - 1; i >= 0; i--) {
+			MP4Atom* pAtom = m_pRootAtom->GetChildAtom(i);
+			const char* type = pAtom->GetType();
+			
+			// get rid of any trailing free or skips
+			if (!strcmp(type, "free") || !strcmp(type, "skip")) {
+				m_pRootAtom->DeleteChildAtom(pAtom);
+				continue;
+			}
+
+			if (strcmp(type, "moov")) {
+				if (pLastAtom == NULL) {
+					pLastAtom = pAtom;
+					lastAtomIsMoov = false;
+				}
+				continue;
+			}
+
+			// now at moov atom
+
+			// multiple moov atoms?!?
+			if (pAtom != pMoovAtom) {
+				throw new MP4Error(
+					"Badly formed mp4 file, multiple moov atoms", 
+					"MP4Modify");
+			}
+
+			if (lastAtomIsMoov) {
+				// position to start of moov atom,
+				// effectively truncating file 
+				// prior to adding new mdat
+				SetPosition(pMoovAtom->GetStart());
+
+			} else { // last atom isn't moov
+				// need to place a free atom 
+				MP4Atom* pFreeAtom = MP4Atom::CreateAtom("free");
+
+				// in existing position of the moov atom
+				m_pRootAtom->InsertChildAtom(pFreeAtom, i);
+				m_pRootAtom->DeleteChildAtom(pMoovAtom);
+				m_pRootAtom->AddChildAtom(pMoovAtom);
+
+				// write free atom to disk
+				SetPosition(pMoovAtom->GetStart());
+				pFreeAtom->SetSize(pMoovAtom->GetSize());
+				pFreeAtom->Write();
+
+				// finally set our file position to the end of the last atom
+				SetPosition(pLastAtom->GetEnd());
+			}
+
+			break;
+		}
+		ASSERT(i != -1);
+	}
+
+	CacheProperties();	// of moov atom
+
+	numAtoms = m_pRootAtom->GetNumberOfChildAtoms();
+
+	// insert another mdat prior to moov atom (the last atom)
+	MP4Atom* pMdatAtom = InsertChildAtom(m_pRootAtom, "mdat", numAtoms - 1);
+
+	// start writing new mdat
+	pMdatAtom->BeginWrite();
+}
+
+void MP4File::Optimize(const char* orgFileName, const char* newFileName)
+{
+	m_fileName = MP4Stralloc(orgFileName);
+	m_mode = 'r';
+
+	// first load meta-info into memory
+	Open("rb");
+	ReadFromFile();
+
+	CacheProperties();	// of moov atom
+
+	// now switch over to writing the new file
+	MP4Free(m_fileName);
+
+	// create a temporary file if necessary
+	if (newFileName == NULL) {
+		m_fileName = MP4Stralloc(TempFileName());
+	} else {
+		m_fileName = MP4Stralloc(newFileName);
+	}
+
+	FILE* pReadFile = m_pFile;
+	m_pFile = NULL;
+	m_mode = 'w';
+
+	Open("wb");
+
+	SetIntegerProperty("moov.mvhd.modificationTime", 
+		MP4GetAbsTimestamp());
+
+	// writing meta info in the optimal order
+	((MP4RootAtom*)m_pRootAtom)->BeginOptimalWrite();
+
+	// write data in optimal order
+	RewriteMdat(pReadFile, m_pFile);
+
+	// finish writing
+	((MP4RootAtom*)m_pRootAtom)->FinishOptimalWrite();
+
+	// cleanup
+	fclose(m_pFile);
+	m_pFile = NULL;
+	fclose(pReadFile);
+
+	// move temporary file into place
+	if (newFileName == NULL) {
+		Rename(m_fileName, orgFileName);
+	}
+}
+
+void MP4File::RewriteMdat(FILE* pReadFile, FILE* pWriteFile)
+{
+	u_int32_t numTracks = m_pTracks.Size();
+
+	MP4ChunkId* chunkIds = new MP4ChunkId[numTracks];
+	MP4ChunkId* maxChunkIds = new MP4ChunkId[numTracks];
+	MP4Timestamp* nextChunkTimes = new MP4Timestamp[numTracks];
+
+	for (u_int32_t i = 0; i < numTracks; i++) {
+		chunkIds[i] = 1;
+		maxChunkIds[i] = m_pTracks[i]->GetNumberOfChunks();
+		nextChunkTimes[i] = MP4_INVALID_TIMESTAMP;
+	}
+
+	while (true) {
+		u_int32_t nextTrackIndex = (u_int32_t)-1;
+		MP4Timestamp nextTime = MP4_INVALID_TIMESTAMP;
+
+		for (u_int32_t i = 0; i < numTracks; i++) {
+			if (chunkIds[i] > maxChunkIds[i]) {
+				continue;
+			}
+
+			if (nextChunkTimes[i] == MP4_INVALID_TIMESTAMP) {
+				MP4Timestamp chunkTime =
+					m_pTracks[i]->GetChunkTime(chunkIds[i]);
+
+				nextChunkTimes[i] = MP4ConvertTime(chunkTime,
+					m_pTracks[i]->GetTimeScale(), GetTimeScale());
+			}
+
+			// time is not earliest so far
+			if (nextChunkTimes[i] > nextTime) {
+				continue;
+			}
+
+			// prefer hint tracks to media tracks if times are equal
+			if (nextChunkTimes[i] == nextTime 
+			  && strcmp(m_pTracks[i]->GetType(), MP4_HINT_TRACK_TYPE)) {
+				continue;
+			}
+
+			// this is our current choice of tracks
+			nextTime = nextChunkTimes[i];
+			nextTrackIndex = i;
+		}
+
+		if (nextTrackIndex == (u_int32_t)-1) {
+			break;
+		}
+
+		// point into original mp4 file for read chunk call
+		m_pFile = pReadFile;
+		m_mode = 'r';
+
+		u_int8_t* pChunk;
+		u_int32_t chunkSize;
+
+		m_pTracks[nextTrackIndex]->
+			ReadChunk(chunkIds[nextTrackIndex], &pChunk, &chunkSize);
+
+		// point back at the new mp4 file for write chunk
+		m_pFile = pWriteFile;
+		m_mode = 'w';
+
+		m_pTracks[nextTrackIndex]->
+			RewriteChunk(chunkIds[nextTrackIndex], pChunk, chunkSize);
+
+		MP4Free(pChunk);
+
+		chunkIds[nextTrackIndex]++;
+		nextChunkTimes[nextTrackIndex] = MP4_INVALID_TIMESTAMP;
+	}
+
+	delete [] chunkIds;
+	delete [] maxChunkIds;
+	delete [] nextChunkTimes;
+}
+
+void MP4File::Open(const char* fmode)
+{
+	ASSERT(m_pFile == NULL);
+
+#ifdef O_LARGEFILE
+	// UGH! fopen doesn't open a file in 64-bit mode, period.
+	// So we need to use open() and then fdopen()
+	int fd;
+	int flags = O_LARGEFILE;
+
+	if (strchr(fmode, '+')) {
+		flags |= O_CREAT | O_RDWR;
+		if (fmode[0] == 'w') {
+			flags |= O_TRUNC;
+		}
+	} else {
+		if (fmode[0] == 'w') {
+			flags |= O_CREAT | O_TRUNC | O_WRONLY;
+		} else {
+			flags |= O_RDONLY;
+		}
+	}
+	fd = open(m_fileName, flags, 0666); 
+
+	if (fd >= 0) {
+		m_pFile = fdopen(fd, fmode);
+	}
+#else
+	m_pFile = fopen(m_fileName, fmode);
+#endif
+	if (m_pFile == NULL) {
+		throw new MP4Error(errno, "failed", "MP4Open");
+	}
+
+	if (m_mode == 'r') {
+		struct stat s;
+		if (fstat(fileno(m_pFile), &s) < 0) {
+			throw new MP4Error(errno, "stat failed", "MP4Open");
+		}
+		m_orgFileSize = m_fileSize = s.st_size;
+	} else {
+		m_orgFileSize = m_fileSize = 0;
+	}
+}
+
+void MP4File::ReadFromFile()
+{
+	// ensure we start at beginning of file
+	SetPosition(0);
+
+	// create a new root atom
+	ASSERT(m_pRootAtom == NULL);
+	m_pRootAtom = MP4Atom::CreateAtom(NULL);
+
+	u_int64_t fileSize = GetSize();
+
+	m_pRootAtom->SetFile(this);
+	m_pRootAtom->SetStart(0);
+	m_pRootAtom->SetSize(fileSize);
+	m_pRootAtom->SetEnd(fileSize);
+
+	m_pRootAtom->Read();
+
+	// create MP4Track's for any tracks in the file
+	GenerateTracks();
+}
+
+void MP4File::GenerateTracks()
+{
+	u_int32_t trackIndex = 0;
+
+	while (true) {
+		char trackName[32];
+		snprintf(trackName, sizeof(trackName), "moov.trak[%u]", trackIndex);
+
+		// find next trak atom
+		MP4Atom* pTrakAtom = m_pRootAtom->FindAtom(trackName);
+
+		// done, no more trak atoms
+		if (pTrakAtom == NULL) {
+			break;
+		}
+
+		// find track id property
+		MP4Integer32Property* pTrackIdProperty = NULL;
+		pTrakAtom->FindProperty(
+			"trak.tkhd.trackId",
+			(MP4Property**)&pTrackIdProperty);
+
+		// find track type property
+		MP4StringProperty* pTypeProperty = NULL;
+		pTrakAtom->FindProperty(
+			"trak.mdia.hdlr.handlerType",
+			(MP4Property**)&pTypeProperty);
+
+		// ensure we have the basics properties
+		if (pTrackIdProperty && pTypeProperty) {
+
+			m_trakIds.Add(pTrackIdProperty->GetValue());
+
+			MP4Track* pTrack = NULL;
+			try {
+				if (!strcmp(pTypeProperty->GetValue(), MP4_HINT_TRACK_TYPE)) {
+					pTrack = new MP4RtpHintTrack(this, pTrakAtom);
+				} else {
+					pTrack = new MP4Track(this, pTrakAtom);
+				}
+				m_pTracks.Add(pTrack);
+			}
+			catch (MP4Error* e) {
+				VERBOSE_ERROR(m_verbosity, e->Print());
+				delete e;
+			}
+
+			// remember when we encounter the OD track
+			if (pTrack && !strcmp(pTrack->GetType(), MP4_OD_TRACK_TYPE)) {
+				if (m_odTrackId == MP4_INVALID_TRACK_ID) {
+					m_odTrackId = pTrackIdProperty->GetValue();
+				} else {
+					VERBOSE_READ(GetVerbosity(),
+						printf("Warning: multiple OD tracks present\n"));
+				}
+			}
+		} else {
+			m_trakIds.Add(0);
+		}
+
+		trackIndex++;
+	}
+}
+
+void MP4File::CacheProperties()
+{
+	FindIntegerProperty("moov.mvhd.modificationTime", 
+		(MP4Property**)&m_pModificationProperty);
+
+	FindIntegerProperty("moov.mvhd.timeScale", 
+		(MP4Property**)&m_pTimeScaleProperty);
+
+	FindIntegerProperty("moov.mvhd.duration", 
+		(MP4Property**)&m_pDurationProperty);
+}
+
+void MP4File::BeginWrite()
+{
+	m_pRootAtom->BeginWrite();
+}
+
+void MP4File::FinishWrite()
+{
+	// for all tracks, flush chunking buffers
+	for (u_int32_t i = 0; i < m_pTracks.Size(); i++) {
+		ASSERT(m_pTracks[i]);
+		m_pTracks[i]->FinishWrite();
+	}
+
+	// ask root atom to write
+	m_pRootAtom->FinishWrite();
+
+	// check if file shrunk, e.g. we deleted a track
+	if (GetSize() < m_orgFileSize) {
+		// just use a free atom to mark unused space
+		// MP4Optimize() should be used to clean up this space
+		MP4Atom* pFreeAtom = MP4Atom::CreateAtom("free");
+		ASSERT(pFreeAtom);
+		pFreeAtom->SetFile(this);
+		pFreeAtom->SetSize(MAX(m_orgFileSize - (m_fileSize + 8), 0));
+		pFreeAtom->Write();
+		delete pFreeAtom;
+	}
+}
+
+MP4Duration MP4File::UpdateDuration(MP4Duration duration)
+{
+	MP4Duration currentDuration = GetDuration();
+	if (duration > currentDuration) {
+		SetDuration(duration);
+		return duration;
+	}
+	return currentDuration;
+}
+
+void MP4File::Dump(FILE* pDumpFile, bool dumpImplicits)
+{
+	if (pDumpFile == NULL) {
+		pDumpFile = stdout;
+	}
+
+	fprintf(pDumpFile, "Dumping %s meta-information...\n", m_fileName);
+	m_pRootAtom->Dump(pDumpFile, 0, dumpImplicits);
+}
+
+void MP4File::Close()
+{
+	if (m_mode == 'w') {
+		SetIntegerProperty("moov.mvhd.modificationTime", 
+			MP4GetAbsTimestamp());
+
+		FinishWrite();
+	}
+
+	fclose(m_pFile);
+	m_pFile = NULL;
+}
+
+const char* MP4File::TempFileName()
+{
+	// there are so many attempts in libc to get this right
+	// that for portablity reasons, it's best just to roll our own
+#ifndef _WIN32
+	static char tempFileName[64];
+	u_int32_t i;
+	for (i = getpid(); i < 0xFFFFFFFF; i++) {
+		sprintf(tempFileName, "./tmp%u.mp4", i);
+		if (access(tempFileName, F_OK) != 0) {
+			break;
+		}
+	}
+	if (i == 0xFFFFFFFF) {
+		throw new MP4Error("can't create temporary file", "TempFileName");
+	}
+#else
+	static char tempFileName[MAX_PATH + 3];
+	GetTempFileName(".", // dir. for temp. files 
+					"mp4",                // temp. filename prefix 
+					0,                    // create unique name 
+					tempFileName);        // buffer for name 
+#endif
+
+	return tempFileName;
+}
+
+void MP4File::Rename(const char* oldFileName, const char* newFileName)
+{
+	int rc;
+
+#ifdef _WIN32
+	rc = remove(newFileName);
+	if (rc == 0) {
+		rc = rename(oldFileName, newFileName);
+	}
+#else
+	rc = rename(oldFileName, newFileName);
+#endif
+	if (rc != 0) {
+		throw new MP4Error(errno, "can't overwrite existing file", "Rename");
+	}
+}
+
+void MP4File::ProtectWriteOperation(char* where)
+{
+	if (m_mode == 'r') {
+		throw new MP4Error("operation not permitted in read mode", where);
+	}
+}
+
+MP4Track* MP4File::GetTrack(MP4TrackId trackId)
+{
+	return m_pTracks[FindTrackIndex(trackId)];
+}
+
+MP4Atom* MP4File::FindAtom(const char* name)
+{
+	MP4Atom* pAtom = NULL;
+	if (!name || !strcmp(name, "")) {
+		pAtom = m_pRootAtom;
+	} else {
+		pAtom = m_pRootAtom->FindAtom(name);
+	}
+	return pAtom;
+}
+
+MP4Atom* MP4File::AddChildAtom(
+	const char* parentName, 
+	const char* childName)
+{
+	return AddChildAtom(FindAtom(parentName), childName);
+}
+
+MP4Atom* MP4File::AddChildAtom(
+	MP4Atom* pParentAtom, 
+	const char* childName)
+{
+	return InsertChildAtom(pParentAtom, childName, 
+		pParentAtom->GetNumberOfChildAtoms());
+}
+
+MP4Atom* MP4File::InsertChildAtom(
+	const char* parentName, 
+	const char* childName, 
+	u_int32_t index)
+{
+	return InsertChildAtom(FindAtom(parentName), childName, index); 
+}
+
+MP4Atom* MP4File::InsertChildAtom(
+	MP4Atom* pParentAtom, 
+	const char* childName, 
+	u_int32_t index)
+{
+	MP4Atom* pChildAtom = MP4Atom::CreateAtom(childName);
+
+	ASSERT(pParentAtom);
+	pParentAtom->InsertChildAtom(pChildAtom, index);
+
+	pChildAtom->Generate();
+
+	return pChildAtom;
+}
+
+MP4Atom* MP4File::AddDescendantAtoms(
+	const char* ancestorName, 
+	const char* descendantNames)
+{
+	return AddDescendantAtoms(FindAtom(ancestorName), descendantNames);
+}
+
+MP4Atom* MP4File::AddDescendantAtoms(
+	MP4Atom* pAncestorAtom, const char* descendantNames)
+{
+	ASSERT(pAncestorAtom);
+
+	MP4Atom* pParentAtom = pAncestorAtom;
+	MP4Atom* pChildAtom = NULL;
+
+	while (true) {
+		char* childName = MP4NameFirst(descendantNames);
+
+		if (childName == NULL) {
+			break;
+		}
+
+		descendantNames = MP4NameAfterFirst(descendantNames);
+
+		pChildAtom = pParentAtom->FindChildAtom(childName);
+
+		if (pChildAtom == NULL) {
+			pChildAtom = AddChildAtom(pParentAtom, childName);
+		}
+
+		pParentAtom = pChildAtom;
+
+		MP4Free(childName);
+	}
+
+	return pChildAtom;
+}
+
+bool MP4File::FindProperty(const char* name, 
+	MP4Property** ppProperty, u_int32_t* pIndex)
+{
+	if (pIndex) {
+		*pIndex = 0;	// set the default answer for index
+	}
+
+	return m_pRootAtom->FindProperty(name, ppProperty, pIndex);
+}
+
+void MP4File::FindIntegerProperty(const char* name, 
+	MP4Property** ppProperty, u_int32_t* pIndex)
+{
+	if (!FindProperty(name, ppProperty, pIndex)) {
+		throw new MP4Error("no such property - %s", "MP4File::FindIntegerProperty", name);
+	}
+
+	switch ((*ppProperty)->GetType()) {
+	case Integer8Property:
+	case Integer16Property:
+	case Integer24Property:
+	case Integer32Property:
+	case Integer64Property:
+		break;
+	default:
+	  throw new MP4Error("type mismatch - property %s type %d", "MP4File::FindIntegerProperty", name, (*ppProperty)->GetType());
+	}
+}
+
+u_int64_t MP4File::GetIntegerProperty(const char* name)
+{
+	MP4Property* pProperty;
+	u_int32_t index;
+
+	FindIntegerProperty(name, &pProperty, &index);
+
+	return ((MP4IntegerProperty*)pProperty)->GetValue(index);
+}
+
+void MP4File::SetIntegerProperty(const char* name, u_int64_t value)
+{
+	ProtectWriteOperation("SetIntegerProperty");
+
+	MP4Property* pProperty = NULL;
+	u_int32_t index = 0;
+
+	FindIntegerProperty(name, &pProperty, &index);
+
+	((MP4IntegerProperty*)pProperty)->SetValue(value, index);
+}
+
+void MP4File::FindFloatProperty(const char* name, 
+	MP4Property** ppProperty, u_int32_t* pIndex)
+{
+	if (!FindProperty(name, ppProperty, pIndex)) {
+		throw new MP4Error("no such property - %s", "MP4File::FindFloatProperty", name);
+	}
+	if ((*ppProperty)->GetType() != Float32Property) {
+		throw new MP4Error("type mismatch - property %s type %d", 
+				   "MP4File::FindFloatProperty",
+				   name, 
+				   (*ppProperty)->GetType());
+	}
+}
+
+float MP4File::GetFloatProperty(const char* name)
+{
+	MP4Property* pProperty;
+	u_int32_t index;
+
+	FindFloatProperty(name, &pProperty, &index);
+
+	return ((MP4Float32Property*)pProperty)->GetValue(index);
+}
+
+void MP4File::SetFloatProperty(const char* name, float value)
+{
+	ProtectWriteOperation("SetFloatProperty");
+
+	MP4Property* pProperty;
+	u_int32_t index;
+
+	FindFloatProperty(name, &pProperty, &index);
+
+	((MP4Float32Property*)pProperty)->SetValue(value, index);
+}
+
+void MP4File::FindStringProperty(const char* name, 
+	MP4Property** ppProperty, u_int32_t* pIndex)
+{
+	if (!FindProperty(name, ppProperty, pIndex)) {
+		throw new MP4Error("no such property - %s", "MP4File::FindStringProperty", name);
+	}
+	if ((*ppProperty)->GetType() != StringProperty) {
+		throw new MP4Error("type mismatch - property %s type %d", "MP4File::FindStringProperty",
+				   name, (*ppProperty)->GetType());
+	}
+}
+
+const char* MP4File::GetStringProperty(const char* name)
+{
+	MP4Property* pProperty;
+	u_int32_t index;
+
+	FindStringProperty(name, &pProperty, &index);
+
+	return ((MP4StringProperty*)pProperty)->GetValue(index);
+}
+
+void MP4File::SetStringProperty(const char* name, const char* value)
+{
+	ProtectWriteOperation("SetStringProperty");
+
+	MP4Property* pProperty;
+	u_int32_t index;
+
+	FindStringProperty(name, &pProperty, &index);
+
+	((MP4StringProperty*)pProperty)->SetValue(value, index);
+}
+
+void MP4File::FindBytesProperty(const char* name, 
+	MP4Property** ppProperty, u_int32_t* pIndex)
+{
+	if (!FindProperty(name, ppProperty, pIndex)) {
+		throw new MP4Error("no such property %s", "MP4File::FindBytesProperty", name);
+	}
+	if ((*ppProperty)->GetType() != BytesProperty) {
+		throw new MP4Error("type mismatch - property %s - type %d", "MP4File::FindBytesProperty", name, (*ppProperty)->GetType());
+	}
+}
+
+void MP4File::GetBytesProperty(const char* name, 
+	u_int8_t** ppValue, u_int32_t* pValueSize)
+{
+	MP4Property* pProperty;
+	u_int32_t index;
+
+	FindBytesProperty(name, &pProperty, &index);
+
+	((MP4BytesProperty*)pProperty)->GetValue(ppValue, pValueSize, index);
+}
+
+void MP4File::SetBytesProperty(const char* name, 
+	const u_int8_t* pValue, u_int32_t valueSize)
+{
+	ProtectWriteOperation("SetBytesProperty");
+
+	MP4Property* pProperty;
+	u_int32_t index;
+
+	FindBytesProperty(name, &pProperty, &index);
+
+	((MP4BytesProperty*)pProperty)->SetValue(pValue, valueSize, index);
+}
+
+
+// track functions
+
+MP4TrackId MP4File::AddTrack(const char* type, u_int32_t timeScale)
+{
+	ProtectWriteOperation("AddTrack");
+
+	// create and add new trak atom
+	MP4Atom* pTrakAtom = AddChildAtom("moov", "trak");
+
+	// allocate a new track id
+	MP4TrackId trackId = AllocTrackId();
+
+	m_trakIds.Add(trackId);
+
+	// set track id
+	MP4Integer32Property* pInteger32Property = NULL;
+	pTrakAtom->FindProperty(
+		"trak.tkhd.trackId", (MP4Property**)&pInteger32Property);
+	ASSERT(pInteger32Property);
+	pInteger32Property->SetValue(trackId);
+
+	// set track type
+	const char* normType = MP4Track::NormalizeTrackType(type);
+
+	// sanity check for user defined types
+	if (strlen(normType) > 4) {
+		VERBOSE_WARNING(m_verbosity, 
+			printf("AddTrack: type truncated to four characters\n"));
+		// StringProperty::SetValue() will do the actual truncation
+	}
+
+	MP4StringProperty* pStringProperty = NULL;
+	pTrakAtom->FindProperty(
+		"trak.mdia.hdlr.handlerType", (MP4Property**)&pStringProperty);
+	ASSERT(pStringProperty);
+	pStringProperty->SetValue(normType);
+
+	// set track time scale
+	pInteger32Property = NULL;
+	pTrakAtom->FindProperty(
+		"trak.mdia.mdhd.timeScale", (MP4Property**)&pInteger32Property);
+	ASSERT(pInteger32Property);
+	pInteger32Property->SetValue(timeScale ? timeScale : 1000);
+
+	// now have enough to create MP4Track object
+	MP4Track* pTrack = NULL;
+	if (!strcmp(normType, MP4_HINT_TRACK_TYPE)) {
+		pTrack = new MP4RtpHintTrack(this, pTrakAtom);
+	} else {
+		pTrack = new MP4Track(this, pTrakAtom);
+	}
+	m_pTracks.Add(pTrack);
+
+	// mark non-hint tracks as enabled
+	if (strcmp(normType, MP4_HINT_TRACK_TYPE)) {
+		SetTrackIntegerProperty(trackId, "tkhd.flags", 1);
+	}
+
+	// mark track as contained in this file
+	// LATER will provide option for external data references
+	AddDataReference(trackId, NULL);
+
+	return trackId;
+}
+
+void MP4File::AddTrackToIod(MP4TrackId trackId)
+{
+	MP4DescriptorProperty* pDescriptorProperty = NULL;
+	m_pRootAtom->FindProperty("moov.iods.esIds", 
+		(MP4Property**)&pDescriptorProperty);
+	ASSERT(pDescriptorProperty);
+
+	MP4Descriptor* pDescriptor = 
+		pDescriptorProperty->AddDescriptor(MP4ESIDIncDescrTag);
+	ASSERT(pDescriptor);
+
+	MP4Integer32Property* pIdProperty = NULL;
+	pDescriptor->FindProperty("id", 
+		(MP4Property**)&pIdProperty);
+	ASSERT(pIdProperty);
+
+	pIdProperty->SetValue(trackId);
+}
+
+void MP4File::RemoveTrackFromIod(MP4TrackId trackId)
+{
+	MP4DescriptorProperty* pDescriptorProperty = NULL;
+	m_pRootAtom->FindProperty("moov.iods.esIds",
+		(MP4Property**)&pDescriptorProperty);
+	ASSERT(pDescriptorProperty);
+
+	for (u_int32_t i = 0; i < pDescriptorProperty->GetCount(); i++) {
+		static char name[32];
+		snprintf(name, sizeof(name), "esIds[%u].id", i);
+
+		MP4Integer32Property* pIdProperty = NULL;
+		pDescriptorProperty->FindProperty(name, 
+			(MP4Property**)&pIdProperty);
+		ASSERT(pIdProperty);
+
+		if (pIdProperty->GetValue() == trackId) {
+			pDescriptorProperty->DeleteDescriptor(i);
+			break;
+		}
+	}
+}
+
+void MP4File::AddTrackToOd(MP4TrackId trackId)
+{
+	if (!m_odTrackId) {
+		return;
+	}
+
+	AddTrackReference(MakeTrackName(m_odTrackId, "tref.mpod"), trackId);
+}
+
+void MP4File::RemoveTrackFromOd(MP4TrackId trackId)
+{
+	if (!m_odTrackId) {
+		return;
+	}
+
+	RemoveTrackReference(MakeTrackName(m_odTrackId, "tref.mpod"), trackId);
+}
+
+void MP4File::GetTrackReferenceProperties(const char* trefName,
+	MP4Property** ppCountProperty, MP4Property** ppTrackIdProperty)
+{
+	char propName[1024];
+
+	snprintf(propName, sizeof(propName), "%s.%s", trefName, "entryCount");
+	m_pRootAtom->FindProperty(propName, ppCountProperty);
+	ASSERT(*ppCountProperty);
+
+	snprintf(propName, sizeof(propName), "%s.%s", trefName, "entries.trackId");
+	m_pRootAtom->FindProperty(propName, ppTrackIdProperty);
+	ASSERT(*ppTrackIdProperty);
+}
+
+void MP4File::AddTrackReference(const char* trefName, MP4TrackId refTrackId)
+{
+	MP4Integer32Property* pCountProperty = NULL;
+	MP4Integer32Property* pTrackIdProperty = NULL;
+
+	GetTrackReferenceProperties(trefName,
+		(MP4Property**)&pCountProperty, 
+		(MP4Property**)&pTrackIdProperty);
+
+	pTrackIdProperty->AddValue(refTrackId);
+	pCountProperty->IncrementValue();
+}
+
+u_int32_t MP4File::FindTrackReference(const char* trefName, 
+	MP4TrackId refTrackId)
+{
+	MP4Integer32Property* pCountProperty = NULL;
+	MP4Integer32Property* pTrackIdProperty = NULL;
+
+	GetTrackReferenceProperties(trefName, 
+		(MP4Property**)&pCountProperty, 
+		(MP4Property**)&pTrackIdProperty);
+
+	for (u_int32_t i = 0; i < pCountProperty->GetValue(); i++) {
+		if (refTrackId == pTrackIdProperty->GetValue(i)) {
+			return i + 1;	// N.B. 1 not 0 based index
+		}
+	}
+	return 0;
+}
+
+void MP4File::RemoveTrackReference(const char* trefName, MP4TrackId refTrackId)
+{
+	MP4Integer32Property* pCountProperty = NULL;
+	MP4Integer32Property* pTrackIdProperty = NULL;
+
+	GetTrackReferenceProperties(trefName,
+		(MP4Property**)&pCountProperty, 
+		(MP4Property**)&pTrackIdProperty);
+
+	for (u_int32_t i = 0; i < pCountProperty->GetValue(); i++) {
+		if (refTrackId == pTrackIdProperty->GetValue(i)) {
+			pTrackIdProperty->DeleteValue(i);
+			pCountProperty->IncrementValue(-1);
+		}
+	}
+}
+
+void MP4File::AddDataReference(MP4TrackId trackId, const char* url)
+{
+	MP4Atom* pDrefAtom = 
+		FindAtom(MakeTrackName(trackId, "mdia.minf.dinf.dref"));
+	ASSERT(pDrefAtom);
+
+	MP4Integer32Property* pCountProperty = NULL;
+	pDrefAtom->FindProperty("dref.entryCount", 
+		(MP4Property**)&pCountProperty);
+	ASSERT(pCountProperty);
+	pCountProperty->IncrementValue();
+
+	MP4Atom* pUrlAtom = AddChildAtom(pDrefAtom, "url ");
+
+	if (url && url[0] != '\0') {
+		pUrlAtom->SetFlags(pUrlAtom->GetFlags() & 0xFFFFFE);
+
+		MP4StringProperty* pUrlProperty = NULL;
+		pUrlAtom->FindProperty("url .location",
+			(MP4Property**)&pUrlProperty);
+		ASSERT(pUrlProperty);
+		pUrlProperty->SetValue(url);
+	} else {
+		pUrlAtom->SetFlags(pUrlAtom->GetFlags() | 1);
+	}
+}
+
+MP4TrackId MP4File::AddSystemsTrack(const char* type)
+{
+	const char* normType = MP4Track::NormalizeTrackType(type); 
+
+	// TBD if user type, fix name to four chars, and warn
+
+	MP4TrackId trackId = AddTrack(type, MP4_MSECS_TIME_SCALE);
+
+	InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "nmhd", 0);
+
+	AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), "mp4s");
+
+	// stsd is a unique beast in that it has a count of the number 
+	// of child atoms that needs to be incremented after we add the mp4s atom
+	MP4Integer32Property* pStsdCountProperty;
+	FindIntegerProperty(
+		MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"),
+		(MP4Property**)&pStsdCountProperty);
+	pStsdCountProperty->IncrementValue();
+
+	SetTrackIntegerProperty(trackId, 
+		"mdia.minf.stbl.stsd.mp4s.esds.ESID", trackId);
+
+	SetTrackIntegerProperty(trackId, 
+		"mdia.minf.stbl.stsd.mp4s.esds.decConfigDescr.objectTypeId", 
+		MP4SystemsV1ObjectType);
+
+	SetTrackIntegerProperty(trackId, 
+		"mdia.minf.stbl.stsd.mp4s.esds.decConfigDescr.streamType", 
+		ConvertTrackTypeToStreamType(normType));
+
+	return trackId;
+}
+
+MP4TrackId MP4File::AddODTrack()
+{
+	// until a demonstrated need emerges
+	// we limit ourselves to one object description track
+	if (m_odTrackId != MP4_INVALID_TRACK_ID) {
+		throw new MP4Error("object description track already exists",
+			"AddObjectDescriptionTrack");
+	}
+
+	m_odTrackId = AddSystemsTrack(MP4_OD_TRACK_TYPE);
+
+	AddTrackToIod(m_odTrackId);
+
+	AddDescendantAtoms(MakeTrackName(m_odTrackId, NULL), "tref.mpod");
+
+	return m_odTrackId;
+}
+
+MP4TrackId MP4File::AddSceneTrack()
+{
+	MP4TrackId trackId = AddSystemsTrack(MP4_SCENE_TRACK_TYPE);
+
+	AddTrackToIod(trackId);
+	AddTrackToOd(trackId);
+
+	return trackId;
+}
+
+MP4TrackId MP4File::AddAudioTrack(
+	u_int32_t timeScale, 
+	MP4Duration sampleDuration, 
+	u_int8_t audioType)
+{
+	MP4TrackId trackId = AddTrack(MP4_AUDIO_TRACK_TYPE, timeScale);
+
+	AddTrackToOd(trackId);
+
+	SetTrackFloatProperty(trackId, "tkhd.volume", 1.0);
+
+	InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "smhd", 0);
+
+	AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), "mp4a");
+
+	// stsd is a unique beast in that it has a count of the number 
+	// of child atoms that needs to be incremented after we add the mp4a atom
+	MP4Integer32Property* pStsdCountProperty;
+	FindIntegerProperty(
+		MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"),
+		(MP4Property**)&pStsdCountProperty);
+	pStsdCountProperty->IncrementValue();
+
+	SetTrackIntegerProperty(trackId, 
+		"mdia.minf.stbl.stsd.mp4a.timeScale", timeScale);
+
+	SetTrackIntegerProperty(trackId, 
+		"mdia.minf.stbl.stsd.mp4a.esds.ESID", trackId);
+
+	SetTrackIntegerProperty(trackId, 
+		"mdia.minf.stbl.stsd.mp4a.esds.decConfigDescr.objectTypeId", 
+		audioType);
+
+	SetTrackIntegerProperty(trackId, 
+		"mdia.minf.stbl.stsd.mp4a.esds.decConfigDescr.streamType", 
+		MP4AudioStreamType);
+
+	m_pTracks[FindTrackIndex(trackId)]->
+		SetFixedSampleDuration(sampleDuration);
+
+	return trackId;
+}
+
+MP4TrackId MP4File::AddVideoTrack(
+	u_int32_t timeScale, 
+	MP4Duration sampleDuration, 
+	u_int16_t width, 
+	u_int16_t height, 
+	u_int8_t videoType)
+{
+	MP4TrackId trackId = AddTrack(MP4_VIDEO_TRACK_TYPE, timeScale);
+
+	AddTrackToOd(trackId);
+
+	SetTrackFloatProperty(trackId, "tkhd.width", width);
+	SetTrackFloatProperty(trackId, "tkhd.height", height);
+
+	InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "vmhd", 0);
+
+	AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), "mp4v");
+
+	// stsd is a unique beast in that it has a count of the number 
+	// of child atoms that needs to be incremented after we add the mp4v atom
+	MP4Integer32Property* pStsdCountProperty;
+	FindIntegerProperty(
+		MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"),
+		(MP4Property**)&pStsdCountProperty);
+	pStsdCountProperty->IncrementValue();
+
+	SetTrackIntegerProperty(trackId, 
+		"mdia.minf.stbl.stsd.mp4v.width", width);
+	SetTrackIntegerProperty(trackId, 
+		"mdia.minf.stbl.stsd.mp4v.height", height);
+
+	SetTrackIntegerProperty(trackId, 
+		"mdia.minf.stbl.stsd.mp4v.esds.ESID", trackId);
+
+	SetTrackIntegerProperty(trackId, 
+		"mdia.minf.stbl.stsd.mp4v.esds.decConfigDescr.objectTypeId", 
+		videoType);
+
+	SetTrackIntegerProperty(trackId, 
+		"mdia.minf.stbl.stsd.mp4v.esds.decConfigDescr.streamType", 
+		MP4VisualStreamType);
+
+	SetTrackIntegerProperty(trackId, 
+		"mdia.minf.stbl.stsz.sampleSize", sampleDuration);
+
+	m_pTracks[FindTrackIndex(trackId)]->
+		SetFixedSampleDuration(sampleDuration);
+
+	return trackId;
+}
+
+MP4TrackId MP4File::AddHintTrack(MP4TrackId refTrackId)
+{
+	// validate reference track id
+	FindTrackIndex(refTrackId);
+
+	MP4TrackId trackId = 
+		AddTrack(MP4_HINT_TRACK_TYPE, GetTrackTimeScale(refTrackId));
+
+	InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "hmhd", 0);
+
+	AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), "rtp ");
+
+	// stsd is a unique beast in that it has a count of the number 
+	// of child atoms that needs to be incremented after we add the rtp atom
+	MP4Integer32Property* pStsdCountProperty;
+	FindIntegerProperty(
+		MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"),
+		(MP4Property**)&pStsdCountProperty);
+	pStsdCountProperty->IncrementValue();
+
+	SetTrackIntegerProperty(trackId, 
+		"mdia.minf.stbl.stsd.rtp .tims.timeScale", 
+		GetTrackTimeScale(trackId));
+
+	AddDescendantAtoms(MakeTrackName(trackId, NULL), "tref.hint");
+
+	AddTrackReference(MakeTrackName(trackId, "tref.hint"), refTrackId);
+
+	AddDescendantAtoms(MakeTrackName(trackId, NULL), "udta.hnti.sdp ");
+
+	AddDescendantAtoms(MakeTrackName(trackId, NULL), "udta.hinf");
+
+	return trackId;
+}
+
+void MP4File::DeleteTrack(MP4TrackId trackId)
+{
+	ProtectWriteOperation("MP4DeleteTrack");
+
+	u_int32_t trakIndex = FindTrakAtomIndex(trackId);
+	u_int16_t trackIndex = FindTrackIndex(trackId);
+	MP4Track* pTrack = m_pTracks[trackIndex];
+
+	MP4Atom* pTrakAtom = pTrack->GetTrakAtom();
+	ASSERT(pTrakAtom);
+
+	MP4Atom* pMoovAtom = FindAtom("moov");
+	ASSERT(pMoovAtom);
+
+	RemoveTrackFromIod(trackId);
+	RemoveTrackFromOd(trackId);
+
+	if (trackId == m_odTrackId) {
+		m_odTrackId = 0;
+	}
+
+	pMoovAtom->DeleteChildAtom(pTrakAtom);
+
+	m_trakIds.Delete(trakIndex);
+
+	m_pTracks.Delete(trackIndex);
+
+	delete pTrack;
+	delete pTrakAtom;
+}
+
+u_int32_t MP4File::GetNumberOfTracks(const char* type, u_int8_t subType)
+{
+	if (type == NULL) {
+		return m_pTracks.Size();
+	} 
+
+	u_int32_t typeSeen = 0;
+	const char* normType = MP4Track::NormalizeTrackType(type);
+
+	for (u_int32_t i = 0; i < m_pTracks.Size(); i++) {
+		if (!strcmp(normType, m_pTracks[i]->GetType())) {
+			if (subType) {
+				if (normType == MP4_AUDIO_TRACK_TYPE) {
+					if (subType != GetTrackAudioType(m_pTracks[i]->GetId())) {
+						continue;
+					}
+				} else if (normType == MP4_VIDEO_TRACK_TYPE) {
+					if (subType != GetTrackVideoType(m_pTracks[i]->GetId())) {
+						continue;
+					}
+				} 
+				// else unknown subtype, ignore it
+			}
+			typeSeen++;
+		}
+	}
+	return typeSeen;
+}
+
+MP4TrackId MP4File::AllocTrackId()
+{
+	MP4TrackId trackId = 
+		GetIntegerProperty("moov.mvhd.nextTrackId");
+
+	if (trackId <= 0xFFFF) {
+		// check that nextTrackid is correct
+		try {
+			FindTrackIndex(trackId);
+			// ERROR, this trackId is in use
+		}
+		catch (MP4Error* e) {
+			// OK, this trackId is not in use, proceed
+			delete e;
+			SetIntegerProperty("moov.mvhd.nextTrackId", trackId + 1);
+			return trackId;
+		}
+	}
+
+	// we need to search for a track id
+	for (trackId = 1; trackId <= 0xFFFF; trackId++) {
+		try {
+			FindTrackIndex(trackId);
+			// KEEP LOOKING, this trackId is in use
+		}
+		catch (MP4Error* e) {
+			// OK, this trackId is not in use, proceed
+			delete e;
+			return trackId;
+		}
+	}
+
+	// extreme case where mp4 file has 2^16 tracks in it
+	throw new MP4Error("too many existing tracks", "AddTrack");
+	return MP4_INVALID_TRACK_ID;		// to keep MSVC happy
+}
+
+MP4TrackId MP4File::FindTrackId(
+	u_int16_t trackIndex, const char* type, u_int8_t subType)
+{
+	if (type == NULL) {
+		return m_pTracks[trackIndex]->GetId();
+	} 
+
+	u_int32_t typeSeen = 0;
+	const char* normType = MP4Track::NormalizeTrackType(type);
+
+	for (u_int32_t i = 0; i < m_pTracks.Size(); i++) {
+		if (!strcmp(normType, m_pTracks[i]->GetType())) {
+			if (subType) {
+				if (normType == MP4_AUDIO_TRACK_TYPE) {
+					if (subType != GetTrackAudioType(m_pTracks[i]->GetId())) {
+						continue;
+					}
+				} else if (normType == MP4_VIDEO_TRACK_TYPE) {
+					if (subType != GetTrackVideoType(m_pTracks[i]->GetId())) {
+						continue;
+					}
+				} 
+				// else unknown subtype, ignore it
+			}
+
+			if (trackIndex == typeSeen) {
+				return m_pTracks[i]->GetId();
+			}
+
+			typeSeen++;
+		}
+	}
+
+	throw new MP4Error("Track index doesn't exist - track %d type %s", 
+			   "FindTrackId", 
+			   trackIndex, type); 
+	return MP4_INVALID_TRACK_ID; // satisfy MS compiler
+}
+
+u_int16_t MP4File::FindTrackIndex(MP4TrackId trackId)
+{
+	for (u_int32_t i = 0; i < m_pTracks.Size() && i <= 0xFFFF; i++) {
+		if (m_pTracks[i]->GetId() == trackId) {
+			return (u_int16_t)i;
+		}
+	}
+	
+	throw new MP4Error("Track id %d doesn't exist", "FindTrackIndex", trackId); 
+	return (u_int16_t)-1; // satisfy MS compiler
+}
+
+u_int16_t MP4File::FindTrakAtomIndex(MP4TrackId trackId)
+{
+	if (trackId) {
+		for (u_int32_t i = 0; i < m_trakIds.Size(); i++) {
+			if (m_trakIds[i] == trackId) {
+				return i;
+			}
+		}
+	}
+
+	throw new MP4Error("Track id %d doesn't exist", "FindTrakAtomIndex",
+			   trackId); 
+	return (u_int16_t)-1; // satisfy MS compiler
+}
+
+u_int32_t MP4File::GetSampleSize(MP4TrackId trackId, MP4SampleId sampleId)
+{
+	return m_pTracks[FindTrackIndex(trackId)]->GetSampleSize(sampleId);
+}
+
+u_int32_t MP4File::GetTrackMaxSampleSize(MP4TrackId trackId)
+{
+	return m_pTracks[FindTrackIndex(trackId)]->GetMaxSampleSize();
+}
+
+MP4SampleId MP4File::GetSampleIdFromTime(MP4TrackId trackId, 
+	MP4Timestamp when, bool wantSyncSample)
+{
+	return m_pTracks[FindTrackIndex(trackId)]->
+		GetSampleIdFromTime(when, wantSyncSample);
+}
+
+MP4Timestamp MP4File::GetSampleTime(
+	MP4TrackId trackId, MP4SampleId sampleId)
+{
+	MP4Timestamp timestamp;
+	m_pTracks[FindTrackIndex(trackId)]->
+		GetSampleTimes(sampleId, &timestamp, NULL);
+	return timestamp;
+}
+
+MP4Duration MP4File::GetSampleDuration(
+	MP4TrackId trackId, MP4SampleId sampleId)
+{
+	MP4Duration duration;
+	m_pTracks[FindTrackIndex(trackId)]->
+		GetSampleTimes(sampleId, NULL, &duration);
+	return duration; 
+}
+
+MP4Duration MP4File::GetSampleRenderingOffset(
+	MP4TrackId trackId, MP4SampleId sampleId)
+{
+	return m_pTracks[FindTrackIndex(trackId)]->
+		GetSampleRenderingOffset(sampleId);
+}
+
+bool MP4File::GetSampleSync(MP4TrackId trackId, MP4SampleId sampleId)
+{
+	return m_pTracks[FindTrackIndex(trackId)]->IsSyncSample(sampleId);
+}
+
+void MP4File::ReadSample(MP4TrackId trackId, MP4SampleId sampleId,
+		u_int8_t** ppBytes, u_int32_t* pNumBytes, 
+		MP4Timestamp* pStartTime, MP4Duration* pDuration,
+		MP4Duration* pRenderingOffset, bool* pIsSyncSample)
+{
+	m_pTracks[FindTrackIndex(trackId)]->
+		ReadSample(sampleId, ppBytes, pNumBytes, 
+			pStartTime, pDuration, pRenderingOffset, pIsSyncSample);
+}
+
+void MP4File::WriteSample(MP4TrackId trackId,
+		u_int8_t* pBytes, u_int32_t numBytes,
+		MP4Duration duration, MP4Duration renderingOffset, bool isSyncSample)
+{
+	ProtectWriteOperation("MP4WriteSample");
+
+	m_pTracks[FindTrackIndex(trackId)]->
+		WriteSample(pBytes, numBytes, duration, renderingOffset, isSyncSample);
+
+	m_pModificationProperty->SetValue(MP4GetAbsTimestamp());
+}
+
+void MP4File::SetSampleRenderingOffset(MP4TrackId trackId, 
+	MP4SampleId sampleId, MP4Duration renderingOffset)
+{
+	ProtectWriteOperation("MP4SetSampleRenderingOffset");
+
+	m_pTracks[FindTrackIndex(trackId)]->
+		SetSampleRenderingOffset(sampleId, renderingOffset);
+
+	m_pModificationProperty->SetValue(MP4GetAbsTimestamp());
+}
+
+char* MP4File::MakeTrackName(MP4TrackId trackId, const char* name)
+{
+	u_int16_t trakIndex = FindTrakAtomIndex(trackId);
+
+	static char trakName[1024];
+	if (name == NULL || name[0] == '\0') {
+		snprintf(trakName, sizeof(trakName), 
+			"moov.trak[%u]", trakIndex);
+	} else {
+		snprintf(trakName, sizeof(trakName), 
+			"moov.trak[%u].%s", trakIndex, name);
+	}
+	return trakName;
+}
+
+u_int64_t MP4File::GetTrackIntegerProperty(MP4TrackId trackId, const char* name)
+{
+	return GetIntegerProperty(MakeTrackName(trackId, name));
+}
+
+void MP4File::SetTrackIntegerProperty(MP4TrackId trackId, const char* name, 
+	int64_t value)
+{
+	SetIntegerProperty(MakeTrackName(trackId, name), value);
+}
+
+float MP4File::GetTrackFloatProperty(MP4TrackId trackId, const char* name)
+{
+	return GetFloatProperty(MakeTrackName(trackId, name));
+}
+
+void MP4File::SetTrackFloatProperty(MP4TrackId trackId, const char* name, 
+	float value)
+{
+	SetFloatProperty(MakeTrackName(trackId, name), value);
+}
+
+const char* MP4File::GetTrackStringProperty(MP4TrackId trackId, const char* name)
+{
+	return GetStringProperty(MakeTrackName(trackId, name));
+}
+
+void MP4File::SetTrackStringProperty(MP4TrackId trackId, const char* name,
+	const char* value)
+{
+	SetStringProperty(MakeTrackName(trackId, name), value);
+}
+
+void MP4File::GetTrackBytesProperty(MP4TrackId trackId, const char* name, 
+	u_int8_t** ppValue, u_int32_t* pValueSize)
+{
+	GetBytesProperty(MakeTrackName(trackId, name), ppValue, pValueSize);
+}
+
+void MP4File::SetTrackBytesProperty(MP4TrackId trackId, const char* name, 
+	const u_int8_t* pValue, u_int32_t valueSize)
+{
+	SetBytesProperty(MakeTrackName(trackId, name), pValue, valueSize);
+}
+
+
+// file level convenience functions
+
+MP4Duration MP4File::GetDuration()
+{
+	return m_pDurationProperty->GetValue();
+}
+
+void MP4File::SetDuration(MP4Duration value)
+{
+	m_pDurationProperty->SetValue(value);
+}
+
+u_int32_t MP4File::GetTimeScale()
+{
+	return m_pTimeScaleProperty->GetValue();
+}
+
+void MP4File::SetTimeScale(u_int32_t value)
+{
+	if (value == 0) {
+		throw new MP4Error("invalid value", "SetTimeScale");
+	}
+	m_pTimeScaleProperty->SetValue(value);
+}
+
+u_int8_t MP4File::GetODProfileLevel()
+{
+	return GetIntegerProperty("moov.iods.ODProfileLevelId");
+}
+
+void MP4File::SetODProfileLevel(u_int8_t value)
+{
+	SetIntegerProperty("moov.iods.ODProfileLevelId", value);
+}
+ 
+u_int8_t MP4File::GetSceneProfileLevel()
+{
+	return GetIntegerProperty("moov.iods.sceneProfileLevelId");
+}
+
+void MP4File::SetSceneProfileLevel(u_int8_t value)
+{
+	SetIntegerProperty("moov.iods.sceneProfileLevelId", value);
+}
+ 
+u_int8_t MP4File::GetVideoProfileLevel()
+{
+	return GetIntegerProperty("moov.iods.visualProfileLevelId");
+}
+
+void MP4File::SetVideoProfileLevel(u_int8_t value)
+{
+	SetIntegerProperty("moov.iods.visualProfileLevelId", value);
+}
+ 
+u_int8_t MP4File::GetAudioProfileLevel()
+{
+	return GetIntegerProperty("moov.iods.audioProfileLevelId");
+}
+
+void MP4File::SetAudioProfileLevel(u_int8_t value)
+{
+	SetIntegerProperty("moov.iods.audioProfileLevelId", value);
+}
+ 
+u_int8_t MP4File::GetGraphicsProfileLevel()
+{
+	return GetIntegerProperty("moov.iods.graphicsProfileLevelId");
+}
+
+void MP4File::SetGraphicsProfileLevel(u_int8_t value)
+{
+	SetIntegerProperty("moov.iods.graphicsProfileLevelId", value);
+}
+ 
+const char* MP4File::GetSessionSdp()
+{
+	return GetStringProperty("moov.udta.hnti.rtp .sdpText");
+}
+
+void MP4File::SetSessionSdp(const char* sdpString)
+{
+	AddDescendantAtoms("moov", "udta.hnti.rtp ");
+
+	SetStringProperty("moov.udta.hnti.rtp .sdpText", sdpString);
+}
+
+void MP4File::AppendSessionSdp(const char* sdpFragment)
+{
+	const char* oldSdpString = NULL;
+	try {
+		oldSdpString = GetSessionSdp();
+	}
+	catch (MP4Error* e) {
+		delete e;
+		SetSessionSdp(sdpFragment);
+		return;
+	}
+
+	char* newSdpString =
+		(char*)MP4Malloc(strlen(oldSdpString) + strlen(sdpFragment) + 1);
+	strcpy(newSdpString, oldSdpString);
+	strcat(newSdpString, sdpFragment);
+	SetSessionSdp(newSdpString);
+	MP4Free(newSdpString);
+}
+
+
+// track level convenience functions
+
+MP4SampleId MP4File::GetTrackNumberOfSamples(MP4TrackId trackId)
+{
+	return m_pTracks[FindTrackIndex(trackId)]->GetNumberOfSamples();
+}
+
+const char* MP4File::GetTrackType(MP4TrackId trackId)
+{
+	return m_pTracks[FindTrackIndex(trackId)]->GetType();
+}
+
+u_int32_t MP4File::GetTrackTimeScale(MP4TrackId trackId)
+{
+	return m_pTracks[FindTrackIndex(trackId)]->GetTimeScale();
+}
+
+void MP4File::SetTrackTimeScale(MP4TrackId trackId, u_int32_t value)
+{
+	if (value == 0) {
+		throw new MP4Error("invalid value", "SetTrackTimeScale");
+	}
+	SetTrackIntegerProperty(trackId, "mdia.mdhd.timeScale", value);
+}
+
+MP4Duration MP4File::GetTrackDuration(MP4TrackId trackId)
+{
+	return GetTrackIntegerProperty(trackId, "mdia.mdhd.duration");
+}
+
+u_int8_t MP4File::GetTrackAudioType(MP4TrackId trackId)
+{
+	return GetTrackIntegerProperty(trackId, 
+		"mdia.minf.stbl.stsd.mp4a.esds.decConfigDescr.objectTypeId");
+}
+
+u_int8_t MP4File::GetTrackAudioMpeg4Type(MP4TrackId trackId)
+{
+	// verify that track is an MPEG-4 audio track 
+	if (GetTrackAudioType(trackId) != MP4_MPEG4_AUDIO_TYPE) {
+		return MP4_MPEG4_INVALID_AUDIO_TYPE;
+	}
+
+	u_int8_t* pEsConfig = NULL;
+	u_int32_t esConfigSize;
+
+	// The Mpeg4 audio type (AAC, CELP, HXVC, ...)
+	// is the first 5 bits of the ES configuration
+
+	GetTrackESConfiguration(trackId, &pEsConfig, &esConfigSize);
+
+	if (esConfigSize < 1) {
+		return MP4_MPEG4_INVALID_AUDIO_TYPE;
+	}
+
+	u_int8_t mpeg4Type = (pEsConfig[0] >> 3);
+
+	free(pEsConfig);
+
+	return mpeg4Type;
+}
+
+u_int8_t MP4File::GetTrackVideoType(MP4TrackId trackId)
+{
+	return GetTrackIntegerProperty(trackId, 
+		"mdia.minf.stbl.stsd.mp4v.esds.decConfigDescr.objectTypeId");
+}
+
+MP4Duration MP4File::GetTrackFixedSampleDuration(MP4TrackId trackId)
+{
+	return m_pTracks[FindTrackIndex(trackId)]->GetFixedSampleDuration();
+}
+
+float MP4File::GetTrackVideoFrameRate(MP4TrackId trackId)
+{
+	MP4SampleId numSamples =
+		GetTrackNumberOfSamples(trackId);
+#ifdef _WIN32
+	int64_t
+#else
+	u_int64_t 
+#endif
+		msDuration =
+		ConvertFromTrackDuration(trackId, 
+			GetTrackDuration(trackId), MP4_MSECS_TIME_SCALE);
+
+	if (msDuration == 0) {
+		return 0.0;
+	}
+
+	return ((double)numSamples / (double)msDuration) * MP4_MSECS_TIME_SCALE;
+}
+
+void MP4File::GetTrackESConfiguration(MP4TrackId trackId, 
+	u_int8_t** ppConfig, u_int32_t* pConfigSize)
+{
+	GetTrackBytesProperty(trackId, 
+		"mdia.minf.stbl.stsd.*[0].esds.decConfigDescr.decSpecificInfo[0].info",
+		ppConfig, pConfigSize);
+}
+
+void MP4File::SetTrackESConfiguration(MP4TrackId trackId, 
+	const u_int8_t* pConfig, u_int32_t configSize)
+{
+	// get a handle on the track decoder config descriptor 
+	MP4DescriptorProperty* pConfigDescrProperty = NULL;
+	FindProperty(MakeTrackName(trackId, 
+		"mdia.minf.stbl.stsd.*[0].esds.decConfigDescr.decSpecificInfo"),
+		(MP4Property**)&pConfigDescrProperty);
+
+	if (pConfigDescrProperty == NULL) {
+		// probably trackId refers to a hint track
+		throw new MP4Error("no such property", "MP4SetTrackESConfiguration");
+	}
+
+	// lookup the property to store the configuration
+	MP4BytesProperty* pInfoProperty = NULL;
+	pConfigDescrProperty->FindProperty("decSpecificInfo[0].info",
+		(MP4Property**)&pInfoProperty);
+
+	// configuration being set for the first time
+	if (pInfoProperty == NULL) {
+		// need to create a new descriptor to hold it
+		MP4Descriptor* pConfigDescr =
+			pConfigDescrProperty->AddDescriptor(MP4DecSpecificDescrTag);
+		pConfigDescr->Generate();
+
+		pConfigDescrProperty->FindProperty(
+			"decSpecificInfo[0].info",
+			(MP4Property**)&pInfoProperty);
+		ASSERT(pInfoProperty);
+	}
+
+	// set the value
+	pInfoProperty->SetValue(pConfig, configSize);
+}
+
+const char* MP4File::GetHintTrackSdp(MP4TrackId hintTrackId)
+{
+	return GetTrackStringProperty(hintTrackId, "udta.hnti.sdp .sdpText");
+}
+
+void MP4File::SetHintTrackSdp(MP4TrackId hintTrackId, const char* sdpString)
+{
+	MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)];
+
+	if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) {
+		throw new MP4Error("track is not a hint track", 
+			"MP4SetHintTrackSdp");
+	}
+
+	AddDescendantAtoms(
+		MakeTrackName(hintTrackId, NULL), "udta.hnti.sdp ");
+
+	SetTrackStringProperty(hintTrackId, "udta.hnti.sdp .sdpText", sdpString);
+}
+
+void MP4File::AppendHintTrackSdp(MP4TrackId hintTrackId, 
+	const char* sdpFragment)
+{
+	const char* oldSdpString = NULL;
+	try {
+		oldSdpString = GetHintTrackSdp(hintTrackId);
+	}
+	catch (MP4Error* e) {
+		delete e;
+		SetHintTrackSdp(hintTrackId, sdpFragment);
+		return;
+	}
+
+	char* newSdpString =
+		(char*)MP4Malloc(strlen(oldSdpString) + strlen(sdpFragment) + 1);
+	strcpy(newSdpString, oldSdpString);
+	strcat(newSdpString, sdpFragment);
+	SetHintTrackSdp(hintTrackId, newSdpString);
+	MP4Free(newSdpString);
+}
+
+void MP4File::GetHintTrackRtpPayload(
+	MP4TrackId hintTrackId,
+	char** ppPayloadName,
+	u_int8_t* pPayloadNumber,
+	u_int16_t* pMaxPayloadSize,
+	char **ppEncodingParams)
+{
+	MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)];
+
+	if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) {
+		throw new MP4Error("track is not a hint track", 
+			"MP4GetHintTrackRtpPayload");
+	}
+
+	((MP4RtpHintTrack*)pTrack)->GetPayload(
+		ppPayloadName, pPayloadNumber, pMaxPayloadSize, ppEncodingParams);
+}
+
+void MP4File::SetHintTrackRtpPayload(MP4TrackId hintTrackId,
+	const char* payloadName, u_int8_t* pPayloadNumber, u_int16_t maxPayloadSize,
+				     const char *encoding_params)
+{
+	MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)];
+
+	if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) {
+		throw new MP4Error("track is not a hint track", 
+			"MP4SetHintTrackRtpPayload");
+	}
+
+	u_int8_t payloadNumber;
+	if (pPayloadNumber && *pPayloadNumber != MP4_SET_DYNAMIC_PAYLOAD) {
+		payloadNumber = *pPayloadNumber;
+	} else {
+		payloadNumber = AllocRtpPayloadNumber();
+		if (pPayloadNumber) {
+			*pPayloadNumber = payloadNumber;
+		}
+	}
+
+	((MP4RtpHintTrack*)pTrack)->SetPayload(
+		payloadName, payloadNumber, maxPayloadSize, encoding_params);
+}
+
+u_int8_t MP4File::AllocRtpPayloadNumber()
+{
+	MP4Integer32Array usedPayloads;
+	u_int32_t i;
+
+	// collect rtp payload numbers in use by existing tracks
+	for (i = 0; i < m_pTracks.Size(); i++) {
+		MP4Atom* pTrakAtom = m_pTracks[i]->GetTrakAtom();
+
+		MP4Integer32Property* pPayloadProperty = NULL;
+		pTrakAtom->FindProperty("trak.udta.hinf.payt.payloadNumber",
+			(MP4Property**)&pPayloadProperty);
+
+		if (pPayloadProperty) {
+			usedPayloads.Add(pPayloadProperty->GetValue());
+		}
+	}
+
+	// search dynamic payload range for an available slot
+	u_int8_t payload;
+	for (payload = 96; payload < 128; payload++) {
+		for (i = 0; i < usedPayloads.Size(); i++) {
+			if (payload == usedPayloads[i]) {
+				break;
+			}
+		}
+		if (i == usedPayloads.Size()) {
+			break;
+		}
+	}
+
+	if (payload >= 128) {
+		throw new MP4Error("no more available rtp payload numbers",
+			"AllocRtpPayloadNumber");
+	}
+
+	return payload;
+}
+
+MP4TrackId MP4File::GetHintTrackReferenceTrackId(
+	MP4TrackId hintTrackId)
+{
+	MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)];
+
+	if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) {
+		throw new MP4Error("track is not a hint track", 
+			"MP4GetHintTrackReferenceTrackId");
+	}
+
+	MP4Track* pRefTrack = ((MP4RtpHintTrack*)pTrack)->GetRefTrack();
+
+	if (pRefTrack == NULL) {
+		return MP4_INVALID_TRACK_ID;
+	}
+	return pRefTrack->GetId();
+}
+
+void MP4File::ReadRtpHint(
+	MP4TrackId hintTrackId,
+	MP4SampleId hintSampleId,
+	u_int16_t* pNumPackets)
+{
+	MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)];
+
+	if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) {
+		throw new MP4Error("track is not a hint track", "MP4ReadRtpHint");
+	}
+	((MP4RtpHintTrack*)pTrack)->
+		ReadHint(hintSampleId, pNumPackets);
+}
+
+u_int16_t MP4File::GetRtpHintNumberOfPackets(
+	MP4TrackId hintTrackId)
+{
+	MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)];
+
+	if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) {
+		throw new MP4Error("track is not a hint track", 
+			"MP4GetRtpHintNumberOfPackets");
+	}
+	return ((MP4RtpHintTrack*)pTrack)->GetHintNumberOfPackets();
+}
+
+int8_t MP4File::GetRtpPacketBFrame(
+	MP4TrackId hintTrackId,
+	u_int16_t packetIndex)
+{
+	MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)];
+
+	if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) {
+		throw new MP4Error("track is not a hint track", 
+			"MP4GetRtpHintBFrame");
+	}
+	return ((MP4RtpHintTrack*)pTrack)->GetPacketBFrame(packetIndex);
+}
+
+int32_t MP4File::GetRtpPacketTransmitOffset(
+	MP4TrackId hintTrackId,
+	u_int16_t packetIndex)
+{
+	MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)];
+
+	if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) {
+		throw new MP4Error("track is not a hint track", 
+			"MP4GetRtpPacketTransmitOffset");
+	}
+	return ((MP4RtpHintTrack*)pTrack)->GetPacketTransmitOffset(packetIndex);
+}
+
+void MP4File::ReadRtpPacket(
+	MP4TrackId hintTrackId,
+	u_int16_t packetIndex,
+	u_int8_t** ppBytes, 
+	u_int32_t* pNumBytes,
+	u_int32_t ssrc,
+	bool includeHeader,
+	bool includePayload)
+{
+	MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)];
+
+	if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) {
+		throw new MP4Error("track is not a hint track", "MP4ReadPacket");
+	}
+	((MP4RtpHintTrack*)pTrack)->ReadPacket(
+		packetIndex, ppBytes, pNumBytes,
+		ssrc, includeHeader, includePayload);
+}
+
+MP4Timestamp MP4File::GetRtpTimestampStart(
+	MP4TrackId hintTrackId)
+{
+	MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)];
+
+	if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) {
+		throw new MP4Error("track is not a hint track", 
+			"MP4GetRtpTimestampStart");
+	}
+	return ((MP4RtpHintTrack*)pTrack)->GetRtpTimestampStart();
+}
+
+void MP4File::SetRtpTimestampStart(
+	MP4TrackId hintTrackId,
+	MP4Timestamp rtpStart)
+{
+	MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)];
+
+	if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) {
+		throw new MP4Error("track is not a hint track", 
+			"MP4SetRtpTimestampStart");
+	}
+	((MP4RtpHintTrack*)pTrack)->SetRtpTimestampStart(rtpStart);
+}
+
+void MP4File::AddRtpHint(MP4TrackId hintTrackId, 
+	bool isBframe, u_int32_t timestampOffset)
+{
+	ProtectWriteOperation("MP4AddRtpHint");
+
+	MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)];
+
+	if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) {
+		throw new MP4Error("track is not a hint track", "MP4AddRtpHint");
+	}
+	((MP4RtpHintTrack*)pTrack)->AddHint(isBframe, timestampOffset);
+}
+
+void MP4File::AddRtpPacket(
+	MP4TrackId hintTrackId, bool setMbit, int32_t transmitOffset)
+{
+	ProtectWriteOperation("MP4AddRtpPacket");
+
+	MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)];
+
+	if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) {
+		throw new MP4Error("track is not a hint track", "MP4AddRtpPacket");
+	}
+	((MP4RtpHintTrack*)pTrack)->AddPacket(setMbit, transmitOffset);
+}
+
+void MP4File::AddRtpImmediateData(MP4TrackId hintTrackId, 
+	const u_int8_t* pBytes, u_int32_t numBytes)
+{
+	ProtectWriteOperation("MP4AddRtpImmediateData");
+
+	MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)];
+
+	if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) {
+		throw new MP4Error("track is not a hint track", 
+			"MP4AddRtpImmediateData");
+	}
+	((MP4RtpHintTrack*)pTrack)->AddImmediateData(pBytes, numBytes);
+}
+
+void MP4File::AddRtpSampleData(MP4TrackId hintTrackId, 
+	MP4SampleId sampleId, u_int32_t dataOffset, u_int32_t dataLength)
+{
+	ProtectWriteOperation("MP4AddRtpSampleData");
+
+	MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)];
+
+	if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) {
+		throw new MP4Error("track is not a hint track", 
+			"MP4AddRtpSampleData");
+	}
+	((MP4RtpHintTrack*)pTrack)->AddSampleData(
+		sampleId, dataOffset, dataLength);
+}
+
+void MP4File::AddRtpESConfigurationPacket(MP4TrackId hintTrackId)
+{
+	ProtectWriteOperation("MP4AddRtpESConfigurationPacket");
+
+	MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)];
+
+	if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) {
+		throw new MP4Error("track is not a hint track", 
+			"MP4AddRtpESConfigurationPacket");
+	}
+	((MP4RtpHintTrack*)pTrack)->AddESConfigurationPacket();
+}
+
+void MP4File::WriteRtpHint(MP4TrackId hintTrackId,
+	MP4Duration duration, bool isSyncSample)
+{
+	ProtectWriteOperation("MP4WriteRtpHint");
+
+	MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)];
+
+	if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) {
+		throw new MP4Error("track is not a hint track", 
+			"MP4WriteRtpHint");
+	}
+	((MP4RtpHintTrack*)pTrack)->WriteHint(duration, isSyncSample);
+}
+
+u_int64_t MP4File::ConvertFromMovieDuration(
+	MP4Duration duration,
+	u_int32_t timeScale)
+{
+	return MP4ConvertTime((u_int64_t)duration, 
+		GetTimeScale(), timeScale);
+}
+
+u_int64_t MP4File::ConvertFromTrackTimestamp(
+	MP4TrackId trackId, 
+	MP4Timestamp timeStamp,
+	u_int32_t timeScale)
+{
+	return MP4ConvertTime((u_int64_t)timeStamp, 
+		GetTrackTimeScale(trackId), timeScale);
+}
+
+MP4Timestamp MP4File::ConvertToTrackTimestamp(
+	MP4TrackId trackId, 
+	u_int64_t timeStamp,
+	u_int32_t timeScale)
+{
+	return (MP4Timestamp)MP4ConvertTime(timeStamp, 
+		timeScale, GetTrackTimeScale(trackId));
+}
+
+u_int64_t MP4File::ConvertFromTrackDuration(
+	MP4TrackId trackId, 
+	MP4Duration duration,
+	u_int32_t timeScale)
+{
+	return MP4ConvertTime((u_int64_t)duration, 
+		GetTrackTimeScale(trackId), timeScale);
+}
+
+MP4Duration MP4File::ConvertToTrackDuration(
+	MP4TrackId trackId, 
+	u_int64_t duration,
+	u_int32_t timeScale)
+{
+	return (MP4Duration)MP4ConvertTime(duration, 
+		timeScale, GetTrackTimeScale(trackId));
+}
+
+u_int8_t MP4File::ConvertTrackTypeToStreamType(const char* trackType)
+{
+	u_int8_t streamType;
+
+	if (!strcmp(trackType, MP4_OD_TRACK_TYPE)) {
+		streamType = MP4ObjectDescriptionStreamType;
+	} else if (!strcmp(trackType, MP4_SCENE_TRACK_TYPE)) {
+		streamType = MP4SceneDescriptionStreamType;
+	} else if (!strcmp(trackType, MP4_CLOCK_TRACK_TYPE)) {
+		streamType = MP4ClockReferenceStreamType;
+	} else if (!strcmp(trackType, MP4_MPEG7_TRACK_TYPE)) {
+		streamType = MP4Mpeg7StreamType;
+	} else if (!strcmp(trackType, MP4_OCI_TRACK_TYPE)) {
+		streamType = MP4OCIStreamType;
+	} else if (!strcmp(trackType, MP4_IPMP_TRACK_TYPE)) {
+		streamType = MP4IPMPStreamType;
+	} else if (!strcmp(trackType, MP4_MPEGJ_TRACK_TYPE)) {
+		streamType = MP4MPEGJStreamType;
+	} else {
+		streamType = MP4UserPrivateStreamType;
+	}
+
+	return streamType;
+}
+
+// edit list
+
+char* MP4File::MakeTrackEditName(
+	MP4TrackId trackId,
+	MP4EditId editId,
+	const char* name)
+{
+	char* trakName = MakeTrackName(trackId, NULL);
+
+	static char editName[1024];
+	snprintf(editName, sizeof(editName), 
+		"%s.edts.elst.entries[%u].%s", 
+		trakName, editId - 1, name);
+	return editName;
+}
+
+MP4EditId MP4File::AddTrackEdit(
+	MP4TrackId trackId,
+	MP4EditId editId)
+{
+	ProtectWriteOperation("AddTrackEdit");
+	return m_pTracks[FindTrackIndex(trackId)]->AddEdit(editId);
+}
+
+void MP4File::DeleteTrackEdit(
+	MP4TrackId trackId,
+	MP4EditId editId)
+{
+	ProtectWriteOperation("DeleteTrackEdit");
+	m_pTracks[FindTrackIndex(trackId)]->DeleteEdit(editId);
+}
+
+u_int32_t MP4File::GetTrackNumberOfEdits(
+	MP4TrackId trackId)
+{
+	return GetTrackIntegerProperty(trackId, "edts.elst.entryCount");
+}
+
+MP4Duration MP4File::GetTrackEditTotalDuration(
+	MP4TrackId trackId,
+	MP4EditId editId)
+{
+	return m_pTracks[FindTrackIndex(trackId)]->GetEditTotalDuration(editId);
+}
+
+MP4Timestamp MP4File::GetTrackEditStart(
+	MP4TrackId trackId,
+	MP4EditId editId)
+{
+	return m_pTracks[FindTrackIndex(trackId)]->GetEditStart(editId);
+}
+
+MP4Timestamp MP4File::GetTrackEditMediaStart(
+	MP4TrackId trackId,
+	MP4EditId editId)
+{
+	return GetIntegerProperty(
+		MakeTrackEditName(trackId, editId, "mediaTime"));
+}
+
+void MP4File::SetTrackEditMediaStart(
+	MP4TrackId trackId,
+	MP4EditId editId,
+	MP4Timestamp startTime)
+{
+	SetIntegerProperty(
+		MakeTrackEditName(trackId, editId, "mediaTime"),
+		startTime);
+}
+
+MP4Duration MP4File::GetTrackEditDuration(
+	MP4TrackId trackId,
+	MP4EditId editId)
+{
+	return GetIntegerProperty(
+		MakeTrackEditName(trackId, editId, "segmentDuration"));
+}
+
+void MP4File::SetTrackEditDuration(
+	MP4TrackId trackId,
+	MP4EditId editId,
+	MP4Duration duration)
+{
+	SetIntegerProperty(
+		MakeTrackEditName(trackId, editId, "segmentDuration"),
+		duration);
+}
+
+bool MP4File::GetTrackEditDwell(
+	MP4TrackId trackId,
+	MP4EditId editId)
+{
+	return (GetIntegerProperty(
+		MakeTrackEditName(trackId, editId, "mediaRate")) == 0);
+}
+
+void MP4File::SetTrackEditDwell(
+	MP4TrackId trackId,
+	MP4EditId editId,
+	bool dwell)
+{
+	SetIntegerProperty(
+		MakeTrackEditName(trackId, editId, "mediaRate"),
+		(dwell ? 0 : 1));
+}
+
+MP4SampleId MP4File::GetSampleIdFromEditTime(
+	MP4TrackId trackId,
+	MP4Timestamp when,
+	MP4Timestamp* pStartTime,
+	MP4Duration* pDuration)
+{
+	return m_pTracks[FindTrackIndex(trackId)]->GetSampleIdFromEditTime(
+		when, pStartTime, pDuration);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/mp4file.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,627 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#ifndef __MP4_FILE_INCLUDED__
+#define __MP4_FILE_INCLUDED__
+
+// forward declarations
+class MP4Atom;
+class MP4Property;
+class MP4Float32Property;
+class MP4StringProperty;
+class MP4BytesProperty;
+class MP4Descriptor;
+class MP4DescriptorProperty;
+
+class MP4File {
+public: /* equivalent to MP4 library API */
+	MP4File(u_int32_t verbosity = 0);
+	~MP4File();
+
+	/* file operations */
+	void Read(const char* fileName);
+	void Create(const char* fileName, bool use64bits);
+	void Modify(const char* fileName);
+	void Optimize(const char* orgFileName, 
+		const char* newFileName = NULL);
+	void Dump(FILE* pDumpFile = NULL, bool dumpImplicits = false);
+	void Close();
+
+	/* library property per file */
+
+	u_int32_t GetVerbosity() {
+		return m_verbosity;
+	}
+	void SetVerbosity(u_int32_t verbosity) {
+		m_verbosity = verbosity;
+	}
+
+	bool Use64Bits() {
+		return m_use64bits;
+	}
+
+	/* file properties */
+
+	u_int64_t GetIntegerProperty(const char* name);
+	float GetFloatProperty(const char* name);
+	const char* GetStringProperty(const char* name);
+	void GetBytesProperty(const char* name,
+		u_int8_t** ppValue, u_int32_t* pValueSize);
+
+	void SetIntegerProperty(const char* name, u_int64_t value);
+	void SetFloatProperty(const char* name, float value);
+	void SetStringProperty(const char* name, const char* value);
+	void SetBytesProperty(const char* name, 
+		const u_int8_t* pValue, u_int32_t valueSize);
+
+	// file level convenience functions
+
+	MP4Duration GetDuration();
+	void SetDuration(MP4Duration value);
+
+	u_int32_t GetTimeScale();
+	void SetTimeScale(u_int32_t value);
+
+	u_int8_t GetODProfileLevel();
+	void SetODProfileLevel(u_int8_t value);
+
+	u_int8_t GetSceneProfileLevel();
+	void SetSceneProfileLevel(u_int8_t value);
+
+	u_int8_t GetVideoProfileLevel();
+	void SetVideoProfileLevel(u_int8_t value);
+
+	u_int8_t GetAudioProfileLevel();
+	void SetAudioProfileLevel(u_int8_t value);
+
+	u_int8_t GetGraphicsProfileLevel();
+	void SetGraphicsProfileLevel(u_int8_t value);
+
+	const char* GetSessionSdp();
+	void SetSessionSdp(const char* sdpString);
+	void AppendSessionSdp(const char* sdpString);
+
+	/* track operations */
+
+	MP4TrackId AddTrack(const char* type, u_int32_t timeScale = 1000);
+	void DeleteTrack(MP4TrackId trackId);
+
+	u_int32_t GetNumberOfTracks(const char* type = NULL, u_int8_t subType = 0);
+
+	MP4TrackId AllocTrackId();
+	MP4TrackId FindTrackId(u_int16_t trackIndex, 
+		const char* type = NULL, u_int8_t subType = 0);
+	u_int16_t FindTrackIndex(MP4TrackId trackId);
+	u_int16_t FindTrakAtomIndex(MP4TrackId trackId);
+
+	/* track properties */
+
+	u_int64_t GetTrackIntegerProperty(
+		MP4TrackId trackId, const char* name);
+	float GetTrackFloatProperty(
+		MP4TrackId trackId, const char* name);
+	const char* GetTrackStringProperty(
+		MP4TrackId trackId, const char* name);
+	void GetTrackBytesProperty(
+		MP4TrackId trackId, const char* name,
+		u_int8_t** ppValue, u_int32_t* pValueSize);
+
+	void SetTrackIntegerProperty(
+		MP4TrackId trackId, const char* name, int64_t value);
+	void SetTrackFloatProperty(
+		MP4TrackId trackId, const char* name, float value);
+	void SetTrackStringProperty(
+		MP4TrackId trackId, const char* name, const char* value);
+	void SetTrackBytesProperty(
+		MP4TrackId trackId, const char* name, 
+		const u_int8_t* pValue, u_int32_t valueSize);
+
+	/* sample operations */
+
+	u_int32_t GetSampleSize(MP4TrackId trackId, MP4SampleId sampleId);
+
+	u_int32_t GetTrackMaxSampleSize(MP4TrackId trackId);
+
+	MP4SampleId GetSampleIdFromTime(MP4TrackId trackId, 
+		MP4Timestamp when, bool wantSyncSample = false);
+
+	MP4Timestamp GetSampleTime(
+		MP4TrackId trackId, MP4SampleId sampleId);
+
+	MP4Duration GetSampleDuration(
+		MP4TrackId trackId, MP4SampleId sampleId);
+
+	MP4Duration GetSampleRenderingOffset(
+		MP4TrackId trackId, MP4SampleId sampleId);
+
+	bool GetSampleSync(
+		MP4TrackId trackId, MP4SampleId sampleId);
+
+	void ReadSample(
+		// input parameters
+		MP4TrackId trackId, 
+		MP4SampleId sampleId,
+		// output parameters
+		u_int8_t** ppBytes, 
+		u_int32_t* pNumBytes, 
+		MP4Timestamp* pStartTime = NULL, 
+		MP4Duration* pDuration = NULL,
+		MP4Duration* pRenderingOffset = NULL, 
+		bool* pIsSyncSample = NULL);
+
+	void WriteSample(
+		MP4TrackId trackId,
+		u_int8_t* pBytes, 
+		u_int32_t numBytes,
+		MP4Duration duration = 0,
+		MP4Duration renderingOffset = 0, 
+		bool isSyncSample = true);
+
+	void SetSampleRenderingOffset(
+		MP4TrackId trackId, 
+		MP4SampleId sampleId,
+		MP4Duration renderingOffset);
+
+	/* track level convenience functions */
+
+	MP4TrackId AddSystemsTrack(const char* type);
+
+	MP4TrackId AddODTrack();
+
+	MP4TrackId AddSceneTrack();
+
+	MP4TrackId AddAudioTrack(
+		u_int32_t timeScale, 
+		MP4Duration sampleDuration,
+		u_int8_t audioType);
+
+	MP4TrackId AddVideoTrack(
+		u_int32_t timeScale, 
+		MP4Duration sampleDuration,
+		u_int16_t width, 
+		u_int16_t height, 
+		u_int8_t videoType);
+
+	MP4TrackId AddHintTrack(MP4TrackId refTrackId);
+
+	MP4SampleId GetTrackNumberOfSamples(MP4TrackId trackId);
+
+	const char* GetTrackType(MP4TrackId trackId);
+
+	MP4Duration GetTrackDuration(MP4TrackId trackId);
+
+	u_int32_t GetTrackTimeScale(MP4TrackId trackId);
+	void SetTrackTimeScale(MP4TrackId trackId, u_int32_t value);
+
+	u_int8_t GetTrackAudioType(MP4TrackId trackId);
+	u_int8_t GetTrackAudioMpeg4Type(MP4TrackId trackId);
+	u_int8_t GetTrackVideoType(MP4TrackId trackId);
+
+	MP4Duration GetTrackFixedSampleDuration(MP4TrackId trackId);
+
+	float GetTrackVideoFrameRate(MP4TrackId trackId);
+
+	void GetTrackESConfiguration(MP4TrackId trackId, 
+		u_int8_t** ppConfig, u_int32_t* pConfigSize);
+	void SetTrackESConfiguration(MP4TrackId trackId, 
+		const u_int8_t* pConfig, u_int32_t configSize);
+
+	const char* GetHintTrackSdp(MP4TrackId hintTrackId);
+	void SetHintTrackSdp(MP4TrackId hintTrackId, const char* sdpString);
+	void AppendHintTrackSdp(MP4TrackId hintTrackId, const char* sdpString);
+
+	// ISMA specific functions
+
+	void MakeIsmaCompliant(bool addIsmaComplianceSdp = true);
+
+	void CreateIsmaIodFromParams(
+		u_int8_t videoProfile,
+		u_int32_t videoBitrate,
+		u_int8_t* videoConfig,
+		u_int32_t videoConfigLength,
+		u_int8_t audioProfile,
+		u_int32_t audioBitrate,
+		u_int8_t* audioConfig,
+		u_int32_t audioConfigLength,
+		u_int8_t** ppBytes,
+		u_int64_t* pNumBytes);
+
+	// time convenience functions
+
+	u_int64_t ConvertFromMovieDuration(
+		MP4Duration duration,
+		u_int32_t timeScale);
+
+	u_int64_t ConvertFromTrackTimestamp(
+		MP4TrackId trackId, 
+		MP4Timestamp timeStamp,
+		u_int32_t timeScale);
+
+	MP4Timestamp ConvertToTrackTimestamp(
+		MP4TrackId trackId, 
+		u_int64_t timeStamp,
+		u_int32_t timeScale);
+
+	u_int64_t ConvertFromTrackDuration(
+		MP4TrackId trackId, 
+		MP4Duration duration,
+		u_int32_t timeScale);
+
+	MP4Duration ConvertToTrackDuration(
+		MP4TrackId trackId, 
+		u_int64_t duration,
+		u_int32_t timeScale);
+
+	// specialized operations
+
+	void GetHintTrackRtpPayload(
+		MP4TrackId hintTrackId,
+		char** ppPayloadName = NULL,
+		u_int8_t* pPayloadNumber = NULL,
+		u_int16_t* pMaxPayloadSize = NULL,
+		char **ppEncodingParams = NULL);
+
+	void SetHintTrackRtpPayload(
+		MP4TrackId hintTrackId,
+		const char* payloadName,
+		u_int8_t* pPayloadNumber,
+		u_int16_t maxPayloadSize,
+		const char *encoding_params);
+
+	MP4TrackId GetHintTrackReferenceTrackId(
+		MP4TrackId hintTrackId);
+
+	void ReadRtpHint(
+		MP4TrackId hintTrackId,
+		MP4SampleId hintSampleId,
+		u_int16_t* pNumPackets = NULL);
+
+	u_int16_t GetRtpHintNumberOfPackets(
+		MP4TrackId hintTrackId);
+
+	int8_t GetRtpPacketBFrame(
+		MP4TrackId hintTrackId,
+		u_int16_t packetIndex);
+
+	int32_t GetRtpPacketTransmitOffset(
+		MP4TrackId hintTrackId,
+		u_int16_t packetIndex);
+
+	void ReadRtpPacket(
+		MP4TrackId hintTrackId,
+		u_int16_t packetIndex,
+		u_int8_t** ppBytes, 
+		u_int32_t* pNumBytes,
+		u_int32_t ssrc = 0,
+		bool includeHeader = true,
+		bool includePayload = true);
+
+	MP4Timestamp GetRtpTimestampStart(
+		MP4TrackId hintTrackId);
+
+	void SetRtpTimestampStart(
+		MP4TrackId hintTrackId,
+		MP4Timestamp rtpStart);
+
+	void AddRtpHint(
+		MP4TrackId hintTrackId,
+		bool isBframe, 
+		u_int32_t timestampOffset);
+
+	void AddRtpPacket(
+		MP4TrackId hintTrackId, 
+		bool setMbit,
+		int32_t transmitOffset);
+
+	void AddRtpImmediateData(
+		MP4TrackId hintTrackId,
+		const u_int8_t* pBytes,
+		u_int32_t numBytes);
+
+	void AddRtpSampleData(
+		MP4TrackId hintTrackId,
+		MP4SampleId sampleId,
+		u_int32_t dataOffset,
+		u_int32_t dataLength);
+
+	void AddRtpESConfigurationPacket(
+		MP4TrackId hintTrackId);
+
+	void WriteRtpHint(
+		MP4TrackId hintTrackId,
+		MP4Duration duration,
+		bool isSyncSample);
+
+	u_int8_t AllocRtpPayloadNumber();
+
+	// edit list related
+
+	char* MakeTrackEditName(
+		MP4TrackId trackId,
+		MP4EditId editId,
+		const char* name);
+
+	MP4EditId AddTrackEdit(
+		MP4TrackId trackId,
+		MP4EditId editId = MP4_INVALID_EDIT_ID);
+
+	void DeleteTrackEdit(
+		MP4TrackId trackId,
+		MP4EditId editId);
+
+	u_int32_t GetTrackNumberOfEdits(
+		MP4TrackId trackId);
+
+	MP4Timestamp GetTrackEditStart(
+		MP4TrackId trackId,
+		MP4EditId editId);
+
+	MP4Duration GetTrackEditTotalDuration(
+		MP4TrackId trackId,
+		MP4EditId editId);
+
+	MP4Timestamp GetTrackEditMediaStart(
+		MP4TrackId trackId,
+		MP4EditId editId);
+
+	void SetTrackEditMediaStart(
+		MP4TrackId trackId,
+		MP4EditId editId,
+		MP4Timestamp startTime);
+
+	MP4Duration GetTrackEditDuration(
+		MP4TrackId trackId,
+		MP4EditId editId);
+
+	void SetTrackEditDuration(
+		MP4TrackId trackId,
+		MP4EditId editId,
+		MP4Duration duration);
+
+	bool GetTrackEditDwell(
+		MP4TrackId trackId,
+		MP4EditId editId);
+
+	void SetTrackEditDwell(
+		MP4TrackId trackId,
+		MP4EditId editId,
+		bool dwell);
+
+	MP4SampleId GetSampleIdFromEditTime(
+		MP4TrackId trackId,
+		MP4Timestamp when,
+		MP4Timestamp* pStartTime = NULL,
+		MP4Duration* pDuration = NULL);
+
+	/* end of MP4 API */
+
+	/* "protected" interface to be used only by friends in library */
+
+	u_int64_t GetPosition(FILE* pFile = NULL);
+	void SetPosition(u_int64_t pos, FILE* pFile = NULL);
+
+	u_int64_t GetSize();
+
+	u_int32_t ReadBytes(
+		u_int8_t* pBytes, u_int32_t numBytes, FILE* pFile = NULL);
+	u_int64_t ReadUInt(u_int8_t size);
+	u_int8_t ReadUInt8();
+	u_int16_t ReadUInt16();
+	u_int32_t ReadUInt24();
+	u_int32_t ReadUInt32();
+	u_int64_t ReadUInt64();
+	float ReadFixed16();
+	float ReadFixed32();
+	float ReadFloat();
+	char* ReadString();
+	char* ReadCountedString(
+		u_int8_t charSize = 1, bool allowExpandedCount = false);
+	u_int64_t ReadBits(u_int8_t numBits);
+	void FlushReadBits();
+	u_int32_t ReadMpegLength();
+
+	u_int32_t PeekBytes(
+		u_int8_t* pBytes, u_int32_t numBytes, FILE* pFile = NULL);
+
+	void WriteBytes(u_int8_t* pBytes, u_int32_t numBytes, FILE* pFile = NULL);
+	void WriteUInt(u_int64_t value, u_int8_t size);
+	void WriteUInt8(u_int8_t value);
+	void WriteUInt16(u_int16_t value);
+	void WriteUInt24(u_int32_t value);
+	void WriteUInt32(u_int32_t value);
+	void WriteUInt64(u_int64_t value);
+	void WriteFixed16(float value);
+	void WriteFixed32(float value);
+	void WriteFloat(float value);
+	void WriteString(char* string);
+	void WriteCountedString(char* string, 
+		u_int8_t charSize = 1, bool allowExpandedCount = false);
+	void WriteBits(u_int64_t bits, u_int8_t numBits);
+	void PadWriteBits(u_int8_t pad = 0);
+	void FlushWriteBits();
+	void WriteMpegLength(u_int32_t value, bool compact = false);
+
+	void EnableMemoryBuffer(
+		u_int8_t* pBytes = NULL, u_int64_t numBytes = 0);
+	void DisableMemoryBuffer(
+		u_int8_t** ppBytes = NULL, u_int64_t* pNumBytes = NULL);
+
+	char GetMode() {
+		return m_mode;
+	}
+
+	MP4Track* GetTrack(MP4TrackId trackId);
+
+	MP4Duration UpdateDuration(MP4Duration duration);
+
+	MP4Atom* FindAtom(const char* name);
+
+	MP4Atom* AddChildAtom(
+		const char* parentName, 
+		const char* childName);
+
+	MP4Atom* AddChildAtom(
+		MP4Atom* pParentAtom, 
+		const char* childName);
+
+	MP4Atom* InsertChildAtom(
+		const char* parentName, 
+		const char* childName, 
+		u_int32_t index);
+
+	MP4Atom* InsertChildAtom(
+		MP4Atom* pParentAtom, 
+		const char* childName, 
+		u_int32_t index);
+
+	MP4Atom* AddDescendantAtoms(
+		const char* ancestorName, 
+		const char* childName);
+
+	MP4Atom* AddDescendantAtoms(
+		MP4Atom* pAncestorAtom,
+		const char* childName);
+
+protected:
+	void Open(const char* fmode);
+	void ReadFromFile();
+	void GenerateTracks();
+	void BeginWrite();
+	void FinishWrite();
+	void CacheProperties();
+	void RewriteMdat(FILE* pReadFile, FILE* pWriteFile);
+
+	const char* TempFileName();
+	void Rename(const char* existingFileName, const char* newFileName);
+
+	void ProtectWriteOperation(char* where);
+
+	void FindIntegerProperty(const char* name, 
+		MP4Property** ppProperty, u_int32_t* pIndex = NULL);
+	void FindFloatProperty(const char* name, 
+		MP4Property** ppProperty, u_int32_t* pIndex = NULL);
+	void FindStringProperty(const char* name, 
+		MP4Property** ppProperty, u_int32_t* pIndex = NULL);
+	void FindBytesProperty(const char* name, 
+		MP4Property** ppProperty, u_int32_t* pIndex = NULL);
+
+	bool FindProperty(const char* name,
+		MP4Property** ppProperty, u_int32_t* pIndex = NULL);
+
+	void AddTrackToIod(MP4TrackId trackId);
+
+	void RemoveTrackFromIod(MP4TrackId trackId);
+
+	void AddTrackToOd(MP4TrackId trackId);
+
+	void RemoveTrackFromOd(MP4TrackId trackId);
+
+	void GetTrackReferenceProperties(const char* trefName,
+		MP4Property** ppCountProperty, MP4Property** ppTrackIdProperty);
+
+	void AddTrackReference(const char* trefName, MP4TrackId refTrackId);
+
+	u_int32_t FindTrackReference(const char* trefName, MP4TrackId refTrackId);
+
+	void RemoveTrackReference(const char* trefName, MP4TrackId refTrackId);
+
+	void AddDataReference(MP4TrackId trackId, const char* url);
+
+	char* MakeTrackName(MP4TrackId trackId, const char* name);
+
+	u_int8_t ConvertTrackTypeToStreamType(const char* trackType);
+
+	void CreateIsmaIodFromFile(
+		MP4TrackId odTrackId,
+		MP4TrackId sceneTrackId,
+		MP4TrackId audioTrackId, 
+		MP4TrackId videoTrackId,
+		u_int8_t** ppBytes,
+		u_int64_t* pNumBytes);
+
+	MP4Descriptor* CreateESD(
+		MP4DescriptorProperty* pEsProperty,
+		u_int32_t esid,
+		u_int8_t objectType,
+		u_int8_t streamType,
+		u_int32_t bufferSize,
+		u_int32_t bitrate,
+		u_int8_t* pConfig,
+		u_int32_t configLength,
+		char* url);
+
+	void CreateIsmaODUpdateCommandFromFileForFile(
+		MP4TrackId odTrackId,
+		MP4TrackId audioTrackId, 
+		MP4TrackId videoTrackId,
+		u_int8_t** ppBytes,
+		u_int64_t* pNumBytes);
+
+	void CreateIsmaODUpdateCommandFromFileForStream(
+		MP4TrackId audioTrackId, 
+		MP4TrackId videoTrackId,
+		u_int8_t** ppBytes,
+		u_int64_t* pNumBytes);
+
+	void CreateIsmaODUpdateCommandForStream(
+		MP4DescriptorProperty* pAudioEsdProperty, 
+		MP4DescriptorProperty* pVideoEsdProperty,
+		u_int8_t** ppBytes,
+		u_int64_t* pNumBytes);
+
+	void CreateIsmaSceneCommand(
+		bool hasAudio,
+		bool hasVideo,
+		u_int8_t** ppBytes, 
+		u_int64_t* pNumBytes);
+
+protected:
+	char*			m_fileName;
+	FILE*			m_pFile;
+	u_int64_t		m_orgFileSize;
+	u_int64_t		m_fileSize;
+	MP4Atom*		m_pRootAtom;
+	MP4Integer32Array m_trakIds;
+	MP4TrackArray	m_pTracks;
+	MP4TrackId		m_odTrackId;
+	u_int32_t		m_verbosity;
+	char			m_mode;
+	bool			m_use64bits;
+	bool			m_useIsma;
+
+	// cached properties
+	MP4IntegerProperty*		m_pModificationProperty;
+	MP4Integer32Property*	m_pTimeScaleProperty;
+	MP4IntegerProperty*		m_pDurationProperty;
+
+	// read/write in memory
+	u_int8_t*	m_memoryBuffer;
+	u_int64_t	m_memoryBufferPosition;
+	u_int64_t	m_memoryBufferSize;
+
+	// bit read/write buffering
+	u_int8_t	m_numReadBits;
+	u_int8_t	m_bufReadBits;
+	u_int8_t	m_numWriteBits;
+	u_int8_t	m_bufWriteBits;
+};
+
+#endif /* __MP4_FILE_INCLUDED__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/mp4file_io.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,563 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+#ifdef HAVE_FPOS_T_POS
+#define FPOS_TO_UINT64(x)		((u_int64_t)((x).__pos))
+#define UINT64_TO_FPOS(x, y)	((x).__pos = (y))
+#else 
+#define FPOS_TO_UINT64(x)		((u_int64_t)(x))
+#define UINT64_TO_FPOS(x, y)	((x) = (fpos)(y))
+#endif
+
+// MP4File low level IO support
+
+u_int64_t MP4File::GetPosition(FILE* pFile)
+{
+	if (m_memoryBuffer == NULL) {
+		if (pFile == NULL) {
+			ASSERT(m_pFile);
+			pFile = m_pFile;
+		}
+
+		fpos_t fpos;
+		if (fgetpos(pFile, &fpos) < 0) {
+			throw new MP4Error(errno, "MP4GetPosition");
+		}
+		return FPOS_TO_UINT64(fpos);
+	} else {
+		return m_memoryBufferPosition;
+	}
+}
+
+void MP4File::SetPosition(u_int64_t pos, FILE* pFile)
+{
+	if (m_memoryBuffer == NULL) {
+		if (pFile == NULL) {
+			ASSERT(m_pFile);
+			pFile = m_pFile;
+		}
+
+		fpos_t fpos;
+		VAR_TO_FPOS(fpos, pos);
+		if (fsetpos(pFile, &fpos) < 0) {
+			throw new MP4Error(errno, "MP4SetPosition");
+		}
+	} else {
+		if (pos >= m_memoryBufferSize) {
+		  //		  abort();
+			throw new MP4Error("position out of range", "MP4SetPosition");
+		}
+		m_memoryBufferPosition = pos;
+	}
+}
+
+u_int64_t MP4File::GetSize()
+{
+	if (m_mode == 'w') {
+		// we're always positioned at the end of file in write mode
+		// except for short intervals in ReadSample and FinishWrite routines
+		// so we rely on the faster approach of GetPosition()
+		// instead of flushing to disk, and then stat'ing the file
+		m_fileSize = GetPosition();
+	} // else read mode, fileSize was determined at Open()
+
+	return m_fileSize;
+}
+
+u_int32_t MP4File::ReadBytes(u_int8_t* pBytes, u_int32_t numBytes, FILE* pFile)
+{
+	// handle degenerate cases
+	if (numBytes == 0) {
+		return 0;
+	}
+
+	ASSERT(pBytes);
+	WARNING(m_numReadBits > 0);
+
+	if (pFile == NULL) {
+		pFile = m_pFile;
+	}
+	ASSERT(pFile);
+
+	if (m_memoryBuffer == NULL) {
+		if (fread(pBytes, 1, numBytes, pFile) != numBytes) {
+			if (feof(pFile)) {
+				throw new MP4Error(
+					"not enough bytes, reached end-of-file",
+					"MP4ReadBytes");
+			} else {
+				throw new MP4Error(errno, "MP4ReadBytes");
+			}
+		}
+	} else {
+		if (m_memoryBufferPosition + numBytes > m_memoryBufferSize) {
+			throw new MP4Error(
+				"not enough bytes, reached end-of-memory",
+				"MP4ReadBytes");
+		}
+		memcpy(pBytes, &m_memoryBuffer[m_memoryBufferPosition], numBytes);
+		m_memoryBufferPosition += numBytes;
+	}
+	return numBytes;
+}
+
+u_int32_t MP4File::PeekBytes(u_int8_t* pBytes, u_int32_t numBytes, FILE* pFile)
+{
+	u_int64_t pos = GetPosition(pFile);
+	ReadBytes(pBytes, numBytes, pFile);
+	SetPosition(pos, pFile);
+	return numBytes;
+}
+
+void MP4File::EnableMemoryBuffer(u_int8_t* pBytes, u_int64_t numBytes) 
+{
+	ASSERT(m_memoryBuffer == NULL);
+
+	if (pBytes) {
+		m_memoryBuffer = pBytes;
+		m_memoryBufferSize = numBytes;
+	} else {
+		if (numBytes) {	
+			m_memoryBufferSize = numBytes;
+		} else {
+			m_memoryBufferSize = 4096;
+		}
+		m_memoryBuffer = (u_int8_t*)MP4Malloc(m_memoryBufferSize);
+	}
+	m_memoryBufferPosition = 0;
+}
+
+void MP4File::DisableMemoryBuffer(u_int8_t** ppBytes, u_int64_t* pNumBytes) 
+{
+	ASSERT(m_memoryBuffer != NULL);
+
+	if (ppBytes) {
+		*ppBytes = m_memoryBuffer;
+	}
+	if (pNumBytes) {
+		*pNumBytes = m_memoryBufferPosition;
+	}
+
+	m_memoryBuffer = NULL;
+	m_memoryBufferSize = 0;
+	m_memoryBufferPosition = 0;
+}
+
+void MP4File::WriteBytes(u_int8_t* pBytes, u_int32_t numBytes, FILE* pFile)
+{
+	ASSERT(m_numWriteBits == 0 || m_numWriteBits >= 8);
+
+	if (pBytes == NULL || numBytes == 0) {
+		return;
+	}
+
+	if (m_memoryBuffer == NULL) {
+		if (pFile == NULL) {
+			ASSERT(m_pFile);
+			pFile = m_pFile;
+		}
+
+		u_int32_t rc = fwrite(pBytes, 1, numBytes, pFile);
+		if (rc != numBytes) {
+			throw new MP4Error(errno, "MP4WriteBytes");
+		}
+	} else {
+		if (m_memoryBufferPosition + numBytes > m_memoryBufferSize) {
+			m_memoryBufferSize = 2 * (m_memoryBufferSize + numBytes);
+			m_memoryBuffer = (u_int8_t*)
+				MP4Realloc(m_memoryBuffer, m_memoryBufferSize);
+		}
+		memcpy(&m_memoryBuffer[m_memoryBufferPosition], pBytes, numBytes);
+		m_memoryBufferPosition += numBytes;
+	}
+}
+
+u_int64_t MP4File::ReadUInt(u_int8_t size)
+{
+	switch (size) {
+	case 1:
+		return ReadUInt8();
+	case 2:
+		return ReadUInt16();
+	case 3:
+		return ReadUInt24();
+	case 4:
+		return ReadUInt32();
+	case 8:
+		return ReadUInt64();
+	default:
+		ASSERT(false);
+		return 0;
+	}
+}
+
+void MP4File::WriteUInt(u_int64_t value, u_int8_t size)
+{
+	switch (size) {
+	case 1:
+		WriteUInt8(value);
+	case 2:
+		WriteUInt16(value);
+	case 3:
+		WriteUInt24(value);
+	case 4:
+		WriteUInt32(value);
+	case 8:
+		WriteUInt64(value);
+	default:
+		ASSERT(false);
+	}
+}
+
+u_int8_t MP4File::ReadUInt8()
+{
+	u_int8_t data;
+	ReadBytes(&data, 1);
+	return data;
+}
+
+void MP4File::WriteUInt8(u_int8_t value)
+{
+	WriteBytes(&value, 1);
+}
+
+u_int16_t MP4File::ReadUInt16()
+{
+	u_int8_t data[2];
+	ReadBytes(&data[0], 2);
+	return ((data[0] << 8) | data[1]);
+}
+
+void MP4File::WriteUInt16(u_int16_t value)
+{
+	u_int8_t data[2];
+	data[0] = (value >> 8) & 0xFF;
+	data[1] = value & 0xFF;
+	WriteBytes(data, 2);
+}
+
+u_int32_t MP4File::ReadUInt24()
+{
+	u_int8_t data[3];
+	ReadBytes(&data[0], 3);
+	return ((data[0] << 16) | (data[1] << 8) | data[2]);
+}
+
+void MP4File::WriteUInt24(u_int32_t value)
+{
+	u_int8_t data[3];
+	data[0] = (value >> 16) & 0xFF;
+	data[1] = (value >> 8) & 0xFF;
+	data[2] = value & 0xFF;
+	WriteBytes(data, 3);
+}
+
+u_int32_t MP4File::ReadUInt32()
+{
+	u_int8_t data[4];
+	ReadBytes(&data[0], 4);
+	return ((data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]);
+}
+
+void MP4File::WriteUInt32(u_int32_t value)
+{
+	u_int8_t data[4];
+	data[0] = (value >> 24) & 0xFF;
+	data[1] = (value >> 16) & 0xFF;
+	data[2] = (value >> 8) & 0xFF;
+	data[3] = value & 0xFF;
+	WriteBytes(data, 4);
+}
+
+u_int64_t MP4File::ReadUInt64()
+{
+	u_int8_t data[8];
+	u_int64_t result = 0;
+	u_int64_t temp;
+
+	ReadBytes(&data[0], 8);
+	
+	for (int i = 0; i < 8; i++) {
+		temp = data[i];
+		result |= temp << ((7 - i) * 8);
+	}
+	return result;
+}
+
+void MP4File::WriteUInt64(u_int64_t value)
+{
+	u_int8_t data[8];
+
+	for (int i = 7; i >= 0; i--) {
+		data[i] = value & 0xFF;
+		value >>= 8;
+	}
+	WriteBytes(data, 8);
+}
+
+float MP4File::ReadFixed16()
+{
+	u_int8_t iPart = ReadUInt8();
+	u_int8_t fPart = ReadUInt8();
+
+	return iPart + (((float)fPart) / 0x100);
+}
+
+void MP4File::WriteFixed16(float value)
+{
+	if (value >= 0x100) {
+		throw new MP4Error(ERANGE, "MP4WriteFixed16");
+	}
+
+	u_int8_t iPart = (u_int8_t)value;
+	u_int8_t fPart = (u_int8_t)((value - iPart) * 0x100);
+
+	WriteUInt8(iPart);
+	WriteUInt8(fPart);
+}
+
+float MP4File::ReadFixed32()
+{
+	u_int16_t iPart = ReadUInt16();
+	u_int16_t fPart = ReadUInt16();
+
+	return iPart + (((float)fPart) / 0x10000);
+}
+
+void MP4File::WriteFixed32(float value)
+{
+	if (value >= 0x10000) {
+		throw new MP4Error(ERANGE, "MP4WriteFixed32");
+	}
+
+	u_int16_t iPart = (u_int16_t)value;
+	u_int16_t fPart = (u_int16_t)((value - iPart) * 0x10000);
+
+	WriteUInt16(iPart);
+	WriteUInt16(fPart);
+}
+
+float MP4File::ReadFloat()
+{
+	union {
+		float f;
+		u_int32_t i;
+	} u;
+
+	u.i = ReadUInt32();
+	return u.f;
+}
+
+void MP4File::WriteFloat(float value)
+{
+	union {
+		float f;
+		u_int32_t i;
+	} u;
+
+	u.f = value;
+	WriteUInt32(u.i);
+}
+
+char* MP4File::ReadString()
+{
+	u_int32_t length = 0;
+	u_int32_t alloced = 64;
+	char* data = (char*)MP4Malloc(alloced);
+
+	do {
+		if (length == alloced) {
+			data = (char*)MP4Realloc(data, alloced * 2);
+		}
+		ReadBytes((u_int8_t*)&data[length], 1);
+		length++;
+	} while (data[length - 1] != 0);
+
+	data = (char*)MP4Realloc(data, length);
+	return data;
+}
+
+void MP4File::WriteString(char* string)
+{
+	if (string == NULL) {
+		static u_int8_t zero = 0;
+		WriteBytes(&zero, 1);
+	} else {
+		WriteBytes((u_int8_t*)string, strlen(string) + 1);
+	}
+}
+
+char* MP4File::ReadCountedString(u_int8_t charSize, bool allowExpandedCount)
+{
+	u_int32_t charLength;
+	if (allowExpandedCount) {
+		u_int8_t b;
+		charLength = 0;
+		do {
+			b = ReadUInt8();
+			charLength += b;
+		} while (b == 255);
+	} else {
+		charLength = ReadUInt8();
+	}
+
+	u_int32_t byteLength = charLength * charSize;
+	char* data = (char*)MP4Malloc(byteLength + 1);
+	if (byteLength > 0) {
+		ReadBytes((u_int8_t*)data, byteLength);
+	}
+	data[byteLength] = '\0';
+	return data;
+}
+
+void MP4File::WriteCountedString(char* string, 
+	u_int8_t charSize, bool allowExpandedCount)
+{
+	u_int32_t byteLength;
+	if (string) {
+		byteLength = strlen(string);
+	} else {
+		byteLength = 0;
+	}
+	u_int32_t charLength = byteLength / charSize;
+
+	if (allowExpandedCount) {
+		while (charLength >= 0xFF) {
+			WriteUInt8(0xFF);
+			charLength -= 0xFF;
+		}		
+		WriteUInt8(charLength);
+	} else {
+		if (charLength > 255) {
+			throw new MP4Error(ERANGE, "MP4WriteCountedString");
+		}
+		WriteUInt8(charLength);
+	}
+
+	if (byteLength > 0) {
+		WriteBytes((u_int8_t*)string, byteLength);
+	}
+}
+
+u_int64_t MP4File::ReadBits(u_int8_t numBits)
+{
+	ASSERT(numBits > 0);
+	ASSERT(numBits <= 64);
+
+	u_int64_t bits = 0;
+
+	for (u_int8_t i = numBits; i > 0; i--) {
+		if (m_numReadBits == 0) {
+			ReadBytes(&m_bufReadBits, 1);
+			m_numReadBits = 8;
+		}
+		bits = (bits << 1) | ((m_bufReadBits >> (--m_numReadBits)) & 1);
+	}
+
+	return bits;
+}
+
+void MP4File::FlushReadBits()
+{
+	// eat any remaining bits in the read buffer
+	m_numReadBits = 0;
+}
+
+void MP4File::WriteBits(u_int64_t bits, u_int8_t numBits)
+{
+	ASSERT(numBits <= 64);
+
+	for (u_int8_t i = numBits; i > 0; i--) {
+		m_bufWriteBits |= 
+			(((bits >> (i - 1)) & 1) << (8 - ++m_numWriteBits));
+	
+		if (m_numWriteBits == 8) {
+			FlushWriteBits();
+		}
+	}
+}
+
+void MP4File::PadWriteBits(u_int8_t pad)
+{
+	if (m_numWriteBits) {
+		WriteBits(pad ? 0xFF : 0x00, 8 - m_numWriteBits);
+	}
+}
+
+void MP4File::FlushWriteBits()
+{
+	if (m_numWriteBits > 0) {
+		WriteBytes(&m_bufWriteBits, 1);
+		m_numWriteBits = 0;
+		m_bufWriteBits = 0;
+	}
+}
+
+u_int32_t MP4File::ReadMpegLength()
+{
+	u_int32_t length = 0;
+	u_int8_t numBytes = 0;
+	u_int8_t b;
+
+	do {
+		b = ReadUInt8();
+		length = (length << 7) | (b & 0x7F);
+		numBytes++;
+	} while ((b & 0x80) && numBytes < 4);
+
+	return length;
+}
+
+void MP4File::WriteMpegLength(u_int32_t value, bool compact)
+{
+	if (value > 0x0FFFFFFF) {
+		throw new MP4Error(ERANGE, "MP4WriteMpegLength");
+	}
+
+	int8_t numBytes;
+
+	if (compact) {
+		if (value <= 0x7F) {
+			numBytes = 1;
+		} else if (value <= 0x3FFF) {
+			numBytes = 2;
+		} else if (value <= 0x1FFFFF) {
+			numBytes = 3;
+		} else {
+			numBytes = 4;
+		}
+	} else {
+		numBytes = 4;
+	}
+
+	int8_t i = numBytes;
+	do {
+		i--;
+		u_int8_t b = (value >> (i * 7)) & 0x7F;
+		if (i > 0) {
+			b |= 0x80;
+		}
+		WriteUInt8(b);
+	} while (i > 0);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/mp4info.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,346 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001-2002.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+static char* PrintAudioInfo(
+	MP4FileHandle mp4File, 
+	MP4TrackId trackId)
+{
+	static const char* mpeg4AudioNames[] = {
+		"MPEG-4 Main @ L1",
+		"MPEG-4 Main @ L2",
+		"MPEG-4 Main @ L3",
+		"MPEG-4 Main @ L4",
+		"MPEG-4 Scalable @ L1",
+		"MPEG-4 Scalable @ L2",
+		"MPEG-4 Scalable @ L3",
+		"MPEG-4 Scalable @ L4",
+		"MPEG-4 Speech @ L1",
+		"MPEG-4 Speech @ L2",
+		"MPEG-4 Synthesis @ L1",
+		"MPEG-4 Synthesis @ L2",
+		"MPEG-4 Synthesis @ L3",
+	};
+	static u_int8_t numMpeg4AudioTypes = 
+		sizeof(mpeg4AudioNames) / sizeof(char*);
+
+	static u_int8_t mpegAudioTypes[] = {
+		MP4_MPEG2_AAC_MAIN_AUDIO_TYPE,	// 0x66
+		MP4_MPEG2_AAC_LC_AUDIO_TYPE,	// 0x67
+		MP4_MPEG2_AAC_SSR_AUDIO_TYPE,	// 0x68
+		MP4_MPEG2_AUDIO_TYPE,			// 0x69
+		MP4_MPEG1_AUDIO_TYPE,			// 0x6B
+		MP4_PCM16_LITTLE_ENDIAN_AUDIO_TYPE,
+		MP4_VORBIS_AUDIO_TYPE,
+		MP4_ALAW_AUDIO_TYPE,
+		MP4_ULAW_AUDIO_TYPE,
+		MP4_G723_AUDIO_TYPE,
+		MP4_PCM16_BIG_ENDIAN_AUDIO_TYPE,
+	};
+	static const char* mpegAudioNames[] = {
+		"MPEG-2 AAC Main",
+		"MPEG-2 AAC LC",
+		"MPEG-2 AAC SSR",
+		"MPEG-2 (MP3)",
+		"MPEG-1 (MP3)",
+		"PCM16 (little endian)",
+		"OGG VORBIS",
+		"G.711 aLaw",
+		"G.711 uLaw",
+		"G.723.1",
+		"PCM16 (big endian)",
+	};
+	static u_int8_t numMpegAudioTypes = 
+		sizeof(mpegAudioTypes) / sizeof(u_int8_t);
+
+	u_int8_t type =
+		MP4GetTrackAudioType(mp4File, trackId);
+	const char* typeName = "Unknown";
+
+	if (type == MP4_MPEG4_AUDIO_TYPE) {
+		type = MP4GetAudioProfileLevel(mp4File);
+		if (type > 0 && type <= numMpeg4AudioTypes) {
+			typeName = mpeg4AudioNames[type - 1];
+		} else {
+			typeName = "MPEG-4";
+		}
+	} else {
+		for (u_int8_t i = 0; i < numMpegAudioTypes; i++) {
+			if (type == mpegAudioTypes[i]) {
+				typeName = mpegAudioNames[i];
+				break;
+			}
+		}
+	}
+
+	u_int32_t timeScale =
+		MP4GetTrackTimeScale(mp4File, trackId);
+
+	MP4Duration trackDuration =
+		MP4GetTrackDuration(mp4File, trackId);
+
+	double msDuration =
+#ifdef _WIN32
+		(int64_t)
+#endif
+		MP4ConvertFromTrackDuration(mp4File, trackId, 
+			trackDuration, MP4_MSECS_TIME_SCALE);
+
+	u_int32_t avgBitRate =
+		MP4GetTrackBitRate(mp4File, trackId);
+
+	char *sInfo = (char*)MP4Malloc(256);
+
+	// type duration avgBitrate samplingFrequency
+	sprintf(sInfo,	
+		"%u\taudio\t%s, %.3f secs, %u kbps, %u Hz\n", 
+		trackId, 
+		typeName,
+		msDuration / 1000.0, 
+		(avgBitRate + 500) / 1000, 
+		timeScale);
+
+	return sInfo;
+}
+
+static char* PrintVideoInfo(
+	MP4FileHandle mp4File, 
+	MP4TrackId trackId)
+{
+	static const char* mpeg4VideoNames[] = {
+		"MPEG-4 Simple @ L3",
+		"MPEG-4 Simple @ L2",
+		"MPEG-4 Simple @ L1",
+		"MPEG-4 Simple Scalable @ L2",
+		"MPEG-4 Simple Scalable @ L1",
+		"MPEG-4 Core @ L2",
+		"MPEG-4 Core @ L1",
+		"MPEG-4 Main @ L4",
+		"MPEG-4 Main @ L3",
+		"MPEG-4 Main @ L2",
+		"MPEG-4 Main @ L1",
+		"MPEG-4 N-Bit @ L2",
+		"MPEG-4 Hybrid @ L2",
+		"MPEG-4 Hybrid @ L1",
+		"MPEG-4 Hybrid @ L1",
+	};
+	static u_int8_t numMpeg4VideoTypes = 
+		sizeof(mpeg4VideoNames) / sizeof(char*);
+
+	static u_int8_t mpegVideoTypes[] = {
+		MP4_MPEG2_SIMPLE_VIDEO_TYPE,	// 0x60
+		MP4_MPEG2_MAIN_VIDEO_TYPE,		// 0x61
+		MP4_MPEG2_SNR_VIDEO_TYPE,		// 0x62
+		MP4_MPEG2_SPATIAL_VIDEO_TYPE,	// 0x63
+		MP4_MPEG2_HIGH_VIDEO_TYPE,		// 0x64
+		MP4_MPEG2_442_VIDEO_TYPE,		// 0x65
+		MP4_MPEG1_VIDEO_TYPE,			// 0x6A
+		MP4_JPEG_VIDEO_TYPE,			// 0x6C
+		MP4_YUV12_VIDEO_TYPE,			
+		MP4_H264_VIDEO_TYPE,
+		MP4_H263_VIDEO_TYPE,		
+		MP4_H261_VIDEO_TYPE,
+	};
+	static const char* mpegVideoNames[] = {
+		"MPEG-2 Simple",
+		"MPEG-2 Main",
+		"MPEG-2 SNR",
+		"MPEG-2 Spatial",
+		"MPEG-2 High",
+		"MPEG-2 4:2:2",
+		"MPEG-1",
+		"JPEG",
+		"YUV12",
+		"H.264",
+		"H.263",
+		"H.261",
+	};
+	static u_int8_t numMpegVideoTypes = 
+		sizeof(mpegVideoTypes) / sizeof(u_int8_t);
+
+	u_int8_t type =
+		MP4GetTrackVideoType(mp4File, trackId);
+	const char* typeName = "Unknown";
+
+	if (type == MP4_MPEG4_VIDEO_TYPE) {
+		type = MP4GetVideoProfileLevel(mp4File);
+		if (type > 0 && type <= numMpeg4VideoTypes) {
+			typeName = mpeg4VideoNames[type - 1];
+		} else {
+			typeName = "MPEG-4";
+		}
+	} else {
+		for (u_int8_t i = 0; i < numMpegVideoTypes; i++) {
+			if (type == mpegVideoTypes[i]) {
+				typeName = mpegVideoNames[i];
+				break;
+			}
+		}
+	}
+
+	MP4Duration trackDuration =
+		MP4GetTrackDuration(mp4File, trackId);
+
+	double msDuration =
+#ifdef _WIN32
+		(int64_t)
+#endif
+		MP4ConvertFromTrackDuration(mp4File, trackId, 
+			trackDuration, MP4_MSECS_TIME_SCALE);
+
+	u_int32_t avgBitRate =
+		MP4GetTrackBitRate(mp4File, trackId);
+
+	// Note not all mp4 implementations set width and height correctly
+	// The real answer can be buried inside the ES configuration info
+	u_int16_t width = MP4GetTrackVideoWidth(mp4File, trackId); 
+
+	u_int16_t height = MP4GetTrackVideoHeight(mp4File, trackId); 
+
+	float fps = MP4GetTrackVideoFrameRate(mp4File, trackId);
+
+	char *sInfo = (char*)MP4Malloc(256);
+
+	// type duration avgBitrate frameSize frameRate
+	sprintf(sInfo, 
+		"%u\tvideo\t%s, %.3f secs, %u kbps, %ux%u @ %.2f fps\n", 
+		trackId, 
+		typeName,
+		msDuration / 1000.0, 
+		(avgBitRate + 500) / 1000,
+		width,	
+		height,
+		fps
+	);
+
+	return sInfo;
+}
+
+static char* PrintHintInfo(
+	MP4FileHandle mp4File, 
+	MP4TrackId trackId)
+{
+	MP4TrackId referenceTrackId =
+		MP4GetHintTrackReferenceTrackId(mp4File, trackId);
+
+	char* payloadName = NULL;
+	MP4GetHintTrackRtpPayload(mp4File, trackId, &payloadName);		
+
+	char *sInfo = (char*)MP4Malloc(256);
+
+	sprintf(sInfo,
+		"%u\thint\tPayload %s for track %u\n", 
+		trackId, 
+		payloadName,
+		referenceTrackId);
+
+	free(payloadName);
+
+	return sInfo;
+}
+
+static char* PrintTrackInfo(
+	MP4FileHandle mp4File,
+	MP4TrackId trackId)
+{
+	char* trackInfo = NULL;
+
+	const char* trackType = 
+		MP4GetTrackType(mp4File, trackId);
+
+	if (!strcmp(trackType, MP4_AUDIO_TRACK_TYPE)) {
+		trackInfo = PrintAudioInfo(mp4File, trackId);
+	} else if (!strcmp(trackType, MP4_VIDEO_TRACK_TYPE)) {
+		trackInfo = PrintVideoInfo(mp4File, trackId);
+	} else if (!strcmp(trackType, MP4_HINT_TRACK_TYPE)) {
+		trackInfo = PrintHintInfo(mp4File, trackId);
+	} else {
+		trackInfo = (char*)MP4Malloc(256);
+		if (!strcmp(trackType, MP4_OD_TRACK_TYPE)) {
+			sprintf(trackInfo, 
+				"%u\tod\tObject Descriptors\n", 
+				trackId);
+		} else if (!strcmp(trackType, MP4_SCENE_TRACK_TYPE)) {
+			sprintf(trackInfo,
+				"%u\tscene\tBIFS\n", 
+				trackId);
+		} else {
+			sprintf(trackInfo,
+					"%u\t%s\n", 
+					trackId, trackType);
+		}
+	}
+
+	return trackInfo;
+}
+
+extern "C" char* MP4Info(
+	MP4FileHandle mp4File,
+	MP4TrackId trackId)
+{
+	char* info = NULL;
+
+	if (MP4_IS_VALID_FILE_HANDLE(mp4File)) {
+		try {
+			if (trackId == MP4_INVALID_TRACK_ID) {
+				info = (char*)MP4Calloc(4*1024);
+
+				sprintf(info, "Track\tType\tInfo\n");
+
+				u_int32_t numTracks = MP4GetNumberOfTracks(mp4File);
+
+				for (u_int32_t i = 0; i < numTracks; i++) {
+					trackId = MP4FindTrackId(mp4File, i);
+					char* trackInfo = PrintTrackInfo(mp4File, trackId);
+					strcat(info, trackInfo);
+					MP4Free(trackInfo);
+				}
+			} else {
+				info = PrintTrackInfo(mp4File, trackId);
+			}
+		}
+		catch (MP4Error* e) {
+			delete e;
+		}
+	}
+
+	return info;
+}
+
+extern "C" char* MP4FileInfo(
+	const char* fileName,
+	MP4TrackId trackId)
+{
+	MP4FileHandle mp4File = 
+		MP4Read(fileName);
+
+	if (!mp4File) {
+		return NULL;
+	}
+
+	char* info = MP4Info(mp4File, trackId);
+
+	MP4Close(mp4File);
+
+	return info;	// caller should free this
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/mp4property.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,875 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4Property::MP4Property(const char* name)
+{
+	m_name = name;
+	m_pParentAtom = NULL;
+	m_readOnly = false;
+	m_implicit = false;
+}
+
+bool MP4Property::FindProperty(const char* name, 
+	MP4Property** ppProperty, u_int32_t* pIndex) 
+{
+	if (name == NULL) {
+		return false;
+	}
+
+	if (!strcasecmp(m_name, name)) {
+		if (m_pParentAtom) {
+			VERBOSE_FIND(m_pParentAtom->GetFile()->GetVerbosity(),
+				printf("FindProperty: matched %s\n", name));
+		}
+
+		*ppProperty = this;
+		return true;
+	}
+	return false;
+}
+
+// Integer Property
+
+u_int64_t MP4IntegerProperty::GetValue(u_int32_t index)
+{
+	switch (this->GetType()) {
+	case Integer8Property:
+		return ((MP4Integer8Property*)this)->GetValue(index);
+	case Integer16Property:
+		return ((MP4Integer16Property*)this)->GetValue(index);
+	case Integer24Property:
+		return ((MP4Integer24Property*)this)->GetValue(index);
+	case Integer32Property:
+		return ((MP4Integer32Property*)this)->GetValue(index);
+	case Integer64Property:
+		return ((MP4Integer64Property*)this)->GetValue(index);
+	default:
+		ASSERT(FALSE);
+	}
+	return (0);
+}
+
+void MP4IntegerProperty::SetValue(u_int64_t value, u_int32_t index)
+{
+	switch (this->GetType()) {
+	case Integer8Property:
+		((MP4Integer8Property*)this)->SetValue(value, index);
+		break;
+	case Integer16Property:
+		((MP4Integer16Property*)this)->SetValue(value, index);
+		break;
+	case Integer24Property:
+		((MP4Integer24Property*)this)->SetValue(value, index);
+		break;
+	case Integer32Property:
+		((MP4Integer32Property*)this)->SetValue(value, index);
+		break;
+	case Integer64Property:
+		((MP4Integer64Property*)this)->SetValue(value, index);
+		break;
+	default:
+		ASSERT(FALSE);
+	}
+}
+
+void MP4IntegerProperty::InsertValue(u_int64_t value, u_int32_t index)
+{
+	switch (this->GetType()) {
+	case Integer8Property:
+		((MP4Integer8Property*)this)->InsertValue(value, index);
+		break;
+	case Integer16Property:
+		((MP4Integer16Property*)this)->InsertValue(value, index);
+		break;
+	case Integer24Property:
+		((MP4Integer24Property*)this)->InsertValue(value, index);
+		break;
+	case Integer32Property:
+		((MP4Integer32Property*)this)->InsertValue(value, index);
+		break;
+	case Integer64Property:
+		((MP4Integer64Property*)this)->InsertValue(value, index);
+		break;
+	default:
+		ASSERT(FALSE);
+	}
+}
+
+void MP4IntegerProperty::DeleteValue(u_int32_t index)
+{
+	switch (this->GetType()) {
+	case Integer8Property:
+		((MP4Integer8Property*)this)->DeleteValue(index);
+		break;
+	case Integer16Property:
+		((MP4Integer16Property*)this)->DeleteValue(index);
+		break;
+	case Integer24Property:
+		((MP4Integer24Property*)this)->DeleteValue(index);
+		break;
+	case Integer32Property:
+		((MP4Integer32Property*)this)->DeleteValue(index);
+		break;
+	case Integer64Property:
+		((MP4Integer64Property*)this)->DeleteValue(index);
+		break;
+	default:
+		ASSERT(FALSE);
+	}
+}
+
+void MP4IntegerProperty::IncrementValue(int32_t increment, u_int32_t index)
+{
+	SetValue(GetValue() + increment);
+}
+
+void MP4Integer8Property::Dump(FILE* pFile, u_int8_t indent,
+	bool dumpImplicits, u_int32_t index)
+{
+	if (m_implicit && !dumpImplicits) {
+		return;
+	}
+	Indent(pFile, indent);
+	fprintf(pFile, "%s = %u (0x%02x)\n", 
+		m_name, m_values[index], m_values[index]);
+}
+
+void MP4Integer16Property::Dump(FILE* pFile, u_int8_t indent,
+	bool dumpImplicits, u_int32_t index)
+{
+	if (m_implicit && !dumpImplicits) {
+		return;
+	}
+	Indent(pFile, indent);
+	fprintf(pFile, "%s = %u (0x%04x)\n", 
+		m_name, m_values[index], m_values[index]);
+}
+
+void MP4Integer24Property::Dump(FILE* pFile, u_int8_t indent,
+	bool dumpImplicits, u_int32_t index)
+{
+	if (m_implicit && !dumpImplicits) {
+		return;
+	}
+	Indent(pFile, indent);
+	fprintf(pFile, "%s = %u (0x%06x)\n", 
+		m_name, m_values[index], m_values[index]);
+}
+
+void MP4Integer32Property::Dump(FILE* pFile, u_int8_t indent,
+	bool dumpImplicits, u_int32_t index)
+{
+	if (m_implicit && !dumpImplicits) {
+		return;
+	}
+	Indent(pFile, indent);
+	fprintf(pFile, "%s = %u (0x%08x)\n", 
+		m_name, m_values[index], m_values[index]);
+}
+
+void MP4Integer64Property::Dump(FILE* pFile, u_int8_t indent,
+	bool dumpImplicits, u_int32_t index)
+{
+	if (m_implicit && !dumpImplicits) {
+		return;
+	}
+	Indent(pFile, indent);
+	fprintf(pFile, 
+#ifdef _WIN32
+		"%s = "LLU" (0x%016I64x)\n", 
+#else
+		"%s = "LLU" (0x%016llx)\n", 
+#endif
+		m_name, m_values[index], m_values[index]);
+}
+
+// MP4BitfieldProperty
+
+void MP4BitfieldProperty::Read(MP4File* pFile, u_int32_t index)
+{
+	if (m_implicit) {
+		return;
+	}
+	m_values[index] = pFile->ReadBits(m_numBits);
+}
+
+void MP4BitfieldProperty::Write(MP4File* pFile, u_int32_t index)
+{
+	if (m_implicit) {
+		return;
+	}
+	pFile->WriteBits(m_values[index], m_numBits);
+}
+
+void MP4BitfieldProperty::Dump(FILE* pFile, u_int8_t indent,
+	bool dumpImplicits, u_int32_t index)
+{
+	if (m_implicit && !dumpImplicits) {
+		return;
+	}
+	Indent(pFile, indent);
+
+	u_int8_t hexWidth = m_numBits / 4;
+	if (hexWidth == 0 || (m_numBits % 4)) {
+		hexWidth++;
+	}
+	fprintf(pFile, 
+#ifdef _WIN32
+		"%s = "LLU" (0x%0*I64x) <%u bits>\n", 
+#else
+		"%s = "LLU" (0x%0*llx) <%u bits>\n", 
+#endif
+		m_name, m_values[index], (int)hexWidth, m_values[index], m_numBits);
+}
+
+// MP4Float32Property
+
+void MP4Float32Property::Read(MP4File* pFile, u_int32_t index) 
+{
+	if (m_implicit) {
+		return;
+	}
+	if (m_useFixed16Format) {
+		m_values[index] = pFile->ReadFixed16();
+	} else if (m_useFixed32Format) {
+		m_values[index] = pFile->ReadFixed32();
+	} else {
+		m_values[index] = pFile->ReadFloat();
+	}
+}
+
+void MP4Float32Property::Write(MP4File* pFile, u_int32_t index) 
+{
+	if (m_implicit) {
+		return;
+	}
+	if (m_useFixed16Format) {
+		pFile->WriteFixed16(m_values[index]);
+	} else if (m_useFixed32Format) {
+		pFile->WriteFixed32(m_values[index]);
+	} else {
+		pFile->WriteFloat(m_values[index]);
+	}
+}
+
+void MP4Float32Property::Dump(FILE* pFile, u_int8_t indent,
+	bool dumpImplicits, u_int32_t index)
+{
+	if (m_implicit && !dumpImplicits) {
+		return;
+	}
+	Indent(pFile, indent);
+	fprintf(pFile, "%s = %f\n", 
+		m_name, m_values[index]);
+}
+
+// MP4StringProperty
+
+MP4StringProperty::MP4StringProperty(char* name, 
+	bool useCountedFormat, bool useUnicode)
+	: MP4Property(name)
+{
+	SetCount(1);
+	m_values[0] = NULL;
+	m_useCountedFormat = useCountedFormat;
+	m_useExpandedCount = false;
+	m_useUnicode = useUnicode;
+	m_fixedLength = 0;	// length not fixed
+}
+
+MP4StringProperty::~MP4StringProperty() 
+{
+	u_int32_t count = GetCount();
+	for (u_int32_t i = 0; i < count; i++) {
+		MP4Free(m_values[i]);
+	}
+}
+
+void MP4StringProperty::SetCount(u_int32_t count) 
+{
+	u_int32_t oldCount = m_values.Size();
+
+	m_values.Resize(count);
+
+	for (u_int32_t i = oldCount; i < count; i++) {
+		m_values[i] = NULL;
+	}
+}
+
+void MP4StringProperty::SetValue(const char* value, u_int32_t index) 
+{
+	if (m_readOnly) {
+		throw new MP4Error(EACCES, "property is read-only", m_name);
+	}
+
+	MP4Free(m_values[index]);
+
+	if (m_fixedLength) {
+		m_values[index] = (char*)MP4Calloc(m_fixedLength + 1);
+		if (value) {
+			strncpy(m_values[index], value, m_fixedLength);
+		}
+	} else {
+		if (value) {
+			m_values[index] = MP4Stralloc(value);
+		} else {
+			m_values[index] = NULL;
+		}
+	}
+}
+
+void MP4StringProperty::Read(MP4File* pFile, u_int32_t index)
+{
+	if (m_implicit) {
+		return;
+	}
+	if (m_useCountedFormat) {
+		m_values[index] = pFile->ReadCountedString(
+			(m_useUnicode ? 2 : 1), m_useExpandedCount);
+	} else if (m_fixedLength) {
+		MP4Free(m_values[index]);
+		m_values[index] = (char*)MP4Calloc(m_fixedLength + 1);
+		pFile->ReadBytes((u_int8_t*)m_values[index], m_fixedLength);
+	} else {
+		m_values[index] = pFile->ReadString();
+	}
+}
+
+void MP4StringProperty::Write(MP4File* pFile, u_int32_t index)
+{
+	if (m_implicit) {
+		return;
+	}
+	if (m_useCountedFormat) {
+		pFile->WriteCountedString(m_values[index],
+			(m_useUnicode ? 2 : 1), m_useExpandedCount);
+	} else if (m_fixedLength) {
+		pFile->WriteBytes((u_int8_t*)m_values[index], m_fixedLength);
+	} else {
+		pFile->WriteString(m_values[index]);
+	}
+}
+
+void MP4StringProperty::Dump(FILE* pFile, u_int8_t indent,
+	bool dumpImplicits, u_int32_t index)
+{
+	if (m_implicit && !dumpImplicits) {
+		return;
+	}
+	Indent(pFile, indent);
+	if (m_useUnicode) {
+		fprintf(pFile, "%s = %ls\n", m_name, (wchar_t*)m_values[index]);
+	} else {
+		fprintf(pFile, "%s = %s\n", m_name, m_values[index]);
+	}
+}
+
+// MP4BytesProperty
+
+MP4BytesProperty::MP4BytesProperty(char* name, u_int32_t valueSize)
+	: MP4Property(name)
+{
+	SetCount(1);
+	m_values[0] = (u_int8_t*)MP4Calloc(valueSize);
+	m_valueSizes[0] = valueSize;
+	m_fixedValueSize = 0;
+}
+
+MP4BytesProperty::~MP4BytesProperty() 
+{
+	u_int32_t count = GetCount();
+	for (u_int32_t i = 0; i < count; i++) {
+		MP4Free(m_values[i]);
+	}
+}
+  
+void MP4BytesProperty::SetCount(u_int32_t count) 
+{
+	u_int32_t oldCount = m_values.Size();
+
+	m_values.Resize(count);
+	m_valueSizes.Resize(count);
+
+	for (u_int32_t i = oldCount; i < count; i++) {
+		m_values[i] = NULL;
+		m_valueSizes[i] = 0;
+	}
+}
+
+void MP4BytesProperty::SetValue(const u_int8_t* pValue, u_int32_t valueSize, 
+	u_int32_t index) 
+{
+	if (m_readOnly) {
+		throw new MP4Error(EACCES, "property is read-only", m_name);
+	}
+	if (m_fixedValueSize) {
+		if (valueSize > m_fixedValueSize) {
+			throw new MP4Error("value size exceeds fixed value size",
+				"MP4BytesProperty::SetValue");
+		}
+		if (m_values[index] == NULL) {
+			m_values[index] = (u_int8_t*)MP4Calloc(m_fixedValueSize);
+			m_valueSizes[index] = m_fixedValueSize;
+		}
+		if (pValue) {
+			memcpy(m_values[index], pValue, valueSize);
+		}
+	} else {
+		MP4Free(m_values[index]);
+		if (pValue) {
+			m_values[index] = (u_int8_t*)MP4Malloc(valueSize);
+			memcpy(m_values[index], pValue, valueSize);
+			m_valueSizes[index] = valueSize;
+		} else {
+			m_values[index] = NULL;
+			m_valueSizes[index] = 0;
+		}
+	}
+}
+
+void MP4BytesProperty::SetValueSize(u_int32_t valueSize, u_int32_t index) 
+{
+	if (m_fixedValueSize) {
+		throw new MP4Error("can't change size of fixed sized property",
+			"MP4BytesProperty::SetValueSize");
+	}
+	if (m_values[index] != NULL) {
+		m_values[index] = (u_int8_t*)MP4Realloc(m_values[index], valueSize);
+	}
+	m_valueSizes[index] = valueSize;
+}
+
+void MP4BytesProperty::SetFixedSize(u_int32_t fixedSize) 
+{
+	m_fixedValueSize = 0;
+	for (u_int32_t i = 0; i < GetCount(); i++) {
+		SetValueSize(fixedSize, i);
+	}
+	m_fixedValueSize = fixedSize;
+}
+
+void MP4BytesProperty::Read(MP4File* pFile, u_int32_t index)
+{
+	if (m_implicit) {
+		return;
+	}
+	MP4Free(m_values[index]);
+	m_values[index] = (u_int8_t*)MP4Malloc(m_valueSizes[index]);
+	pFile->ReadBytes(m_values[index], m_valueSizes[index]);
+}
+
+void MP4BytesProperty::Write(MP4File* pFile, u_int32_t index)
+{
+	if (m_implicit) {
+		return;
+	}
+	pFile->WriteBytes(m_values[index], m_valueSizes[index]);
+}
+
+void MP4BytesProperty::Dump(FILE* pFile, u_int8_t indent,
+	bool dumpImplicits, u_int32_t index)
+{
+	if (m_implicit && !dumpImplicits) {
+		return;
+	}
+	Indent(pFile, indent);
+	fprintf(pFile, "%s = <%u bytes> ", m_name, m_valueSizes[index]);
+	for (u_int32_t i = 0; i < m_valueSizes[index]; i++) {
+		if ((i % 16) == 0 && m_valueSizes[index] > 16) {
+			fprintf(pFile, "\n");
+			Indent(pFile, indent);
+		}
+		fprintf(pFile, "%02x ", m_values[index][i]);
+	}
+	fprintf(pFile, "\n");
+}
+
+// MP4TableProperty
+
+MP4TableProperty::MP4TableProperty(char* name, MP4Property* pCountProperty)
+	: MP4Property(name) 
+{
+	ASSERT(pCountProperty->GetType() == Integer8Property
+		|| pCountProperty->GetType() == Integer32Property);
+	m_pCountProperty = pCountProperty;
+	m_pCountProperty->SetReadOnly();
+}
+
+MP4TableProperty::~MP4TableProperty()
+{
+	for (u_int32_t i = 0; i < m_pProperties.Size(); i++) {
+		delete m_pProperties[i];
+	}
+}
+
+void MP4TableProperty::AddProperty(MP4Property* pProperty) 
+{
+	ASSERT(pProperty);
+	ASSERT(pProperty->GetType() != TableProperty);
+	ASSERT(pProperty->GetType() != DescriptorProperty);
+	m_pProperties.Add(pProperty);
+	pProperty->SetParentAtom(m_pParentAtom);
+	pProperty->SetCount(0);
+}
+
+bool MP4TableProperty::FindProperty(const char *name,
+	MP4Property** ppProperty, u_int32_t* pIndex)
+{
+	ASSERT(m_name);
+
+	// check if first component of name matches ourselves
+	if (!MP4NameFirstMatches(m_name, name)) {
+		return false;
+	}
+
+	// check if the specified table entry exists
+	u_int32_t index;
+	bool haveIndex = MP4NameFirstIndex(name, &index);
+	if (haveIndex) {
+		if (index >= GetCount()) {
+			return false;
+		}
+		if (pIndex) {
+			*pIndex = index;
+		}
+	}
+
+	VERBOSE_FIND(m_pParentAtom->GetFile()->GetVerbosity(),
+		printf("FindProperty: matched %s\n", name));
+
+	// get name of table property
+	const char *tablePropName = MP4NameAfterFirst(name);
+	if (tablePropName == NULL) {
+		if (!haveIndex) {
+			*ppProperty = this;
+			return true;
+		}
+		return false;
+	}
+
+	// check if this table property exists
+	return FindContainedProperty(tablePropName, ppProperty, pIndex);
+}
+
+bool MP4TableProperty::FindContainedProperty(const char *name,
+	MP4Property** ppProperty, u_int32_t* pIndex)
+{
+	u_int32_t numProperties = m_pProperties.Size();
+
+	for (u_int32_t i = 0; i < numProperties; i++) {
+		if (m_pProperties[i]->FindProperty(name, ppProperty, pIndex)) {
+			return true;
+		}
+	}
+	return false;
+}
+
+void MP4TableProperty::Read(MP4File* pFile, u_int32_t index)
+{
+	ASSERT(index == 0);
+
+	if (m_implicit) {
+		return;
+	}
+
+	u_int32_t numProperties = m_pProperties.Size();
+
+	if (numProperties == 0) {
+		WARNING(numProperties == 0);
+		return;
+	}
+
+	u_int32_t numEntries = GetCount();
+
+	/* for each property set size */
+	for (u_int32_t j = 0; j < numProperties; j++) {
+		m_pProperties[j]->SetCount(numEntries);
+	}
+
+	for (u_int32_t i = 0; i < numEntries; i++) {
+		ReadEntry(pFile, i);
+	}
+}
+
+void MP4TableProperty::ReadEntry(MP4File* pFile, u_int32_t index)
+{
+	for (u_int32_t j = 0; j < m_pProperties.Size(); j++) {
+		m_pProperties[j]->Read(pFile, index);
+	}
+}
+
+void MP4TableProperty::Write(MP4File* pFile, u_int32_t index)
+{
+	ASSERT(index == 0);
+
+	if (m_implicit) {
+		return;
+	}
+
+	u_int32_t numProperties = m_pProperties.Size();
+
+	if (numProperties == 0) {
+		WARNING(numProperties == 0);
+		return;
+	}
+
+	u_int32_t numEntries = GetCount();
+
+	ASSERT(m_pProperties[0]->GetCount() == numEntries);
+
+	for (u_int32_t i = 0; i < numEntries; i++) {
+		WriteEntry(pFile, i);
+	}
+}
+
+void MP4TableProperty::WriteEntry(MP4File* pFile, u_int32_t index)
+{
+	for (u_int32_t j = 0; j < m_pProperties.Size(); j++) {
+		m_pProperties[j]->Write(pFile, index);
+	}
+}
+
+void MP4TableProperty::Dump(FILE* pFile, u_int8_t indent,
+	bool dumpImplicits, u_int32_t index)
+{
+	ASSERT(index == 0);
+
+	// implicit tables just can't be dumped
+	if (m_implicit) {
+		return;
+	}
+
+	u_int32_t numProperties = m_pProperties.Size();
+
+	if (numProperties == 0) {
+		WARNING(numProperties == 0);
+		return;
+	}
+
+	u_int32_t numEntries = GetCount();
+
+	for (u_int32_t i = 0; i < numEntries; i++) {
+		for (u_int32_t j = 0; j < numProperties; j++) {
+			m_pProperties[j]->Dump(pFile, indent + 1, dumpImplicits, i);
+		}
+	}
+}
+
+// MP4DescriptorProperty
+  
+MP4DescriptorProperty::MP4DescriptorProperty(char* name, 
+	u_int8_t tagsStart, u_int8_t tagsEnd, bool mandatory, bool onlyOne)
+	: MP4Property(name) 
+{ 
+	SetTags(tagsStart, tagsEnd);
+	m_sizeLimit = 0;
+	m_mandatory = mandatory;
+	m_onlyOne = onlyOne;
+}
+
+MP4DescriptorProperty::~MP4DescriptorProperty() 
+{
+	for (u_int32_t i = 0; i < m_pDescriptors.Size(); i++) {
+		delete m_pDescriptors[i];
+	}
+}
+
+void MP4DescriptorProperty::SetParentAtom(MP4Atom* pParentAtom) {
+	m_pParentAtom = pParentAtom;
+	for (u_int32_t i = 0; i < m_pDescriptors.Size(); i++) {
+		m_pDescriptors[i]->SetParentAtom(pParentAtom);
+	}
+}
+
+MP4Descriptor* MP4DescriptorProperty::AddDescriptor(u_int8_t tag)
+{
+	// check that tag is in expected range
+	ASSERT(tag >= m_tagsStart && tag <= m_tagsEnd);
+
+	MP4Descriptor* pDescriptor = CreateDescriptor(tag);
+	ASSERT(pDescriptor);
+
+	m_pDescriptors.Add(pDescriptor);
+	pDescriptor->SetParentAtom(m_pParentAtom);
+
+	return pDescriptor;
+}
+
+void MP4DescriptorProperty::DeleteDescriptor(u_int32_t index)
+{
+	delete m_pDescriptors[index];
+	m_pDescriptors.Delete(index);
+}
+
+void MP4DescriptorProperty::Generate()
+{
+	// generate a default descriptor
+	// if it is mandatory, and single
+	if (m_mandatory && m_onlyOne) {
+		MP4Descriptor* pDescriptor = 
+			AddDescriptor(m_tagsStart);
+		pDescriptor->Generate();
+	}
+}
+
+bool MP4DescriptorProperty::FindProperty(const char *name,
+	MP4Property** ppProperty, u_int32_t* pIndex)
+{
+	// we're unnamed, so just check contained properties
+	if (m_name == NULL || !strcmp(m_name, "")) {
+		return FindContainedProperty(name, ppProperty, pIndex);
+	}
+
+	// check if first component of name matches ourselves
+	if (!MP4NameFirstMatches(m_name, name)) {
+		return false;
+	}
+
+	// check if the specific descriptor entry exists
+	u_int32_t descrIndex;
+	bool haveDescrIndex = MP4NameFirstIndex(name, &descrIndex);
+
+	if (haveDescrIndex && descrIndex >= GetCount()) {
+		return false;
+	}
+
+	if (m_pParentAtom) {
+		VERBOSE_FIND(m_pParentAtom->GetFile()->GetVerbosity(),
+			printf("FindProperty: matched %s\n", name));
+	}
+
+	// get name of descriptor property
+	name = MP4NameAfterFirst(name);
+	if (name == NULL) {
+		if (!haveDescrIndex) {
+			*ppProperty = this;
+			return true;
+		}
+		return false;
+	}
+
+	/* check rest of name */
+	if (haveDescrIndex) {
+		return m_pDescriptors[descrIndex]->FindProperty(name, 
+			ppProperty, pIndex); 
+	} else {
+		return FindContainedProperty(name, ppProperty, pIndex);
+	}
+}
+
+bool MP4DescriptorProperty::FindContainedProperty(const char *name,
+	MP4Property** ppProperty, u_int32_t* pIndex)
+{
+	for (u_int32_t i = 0; i < m_pDescriptors.Size(); i++) {
+		if (m_pDescriptors[i]->FindProperty(name, ppProperty, pIndex)) {
+			return true;
+		}
+	}
+	return false;
+}
+
+void MP4DescriptorProperty::Read(MP4File* pFile, u_int32_t index)
+{
+	ASSERT(index == 0);
+
+	if (m_implicit) {
+		return;
+	}
+
+	u_int64_t start = pFile->GetPosition();
+
+	while (true) {
+		// enforce size limitation
+		if (m_sizeLimit && pFile->GetPosition() >= start + m_sizeLimit) {
+			break;
+		}
+
+		u_int8_t tag;
+		try {
+			pFile->PeekBytes(&tag, 1);
+		}
+		catch (MP4Error* e) {
+			if (pFile->GetPosition() >= pFile->GetSize()) {
+				// EOF
+				delete e;
+				break;
+			}
+			throw e;
+		}
+
+		// check if tag is in desired range
+		if (tag < m_tagsStart || tag > m_tagsEnd) {
+			break;
+		}
+
+		MP4Descriptor* pDescriptor = 
+			AddDescriptor(tag);
+
+		pDescriptor->Read(pFile);
+	}
+
+	// warnings
+	if (m_mandatory && m_pDescriptors.Size() == 0) {
+		VERBOSE_READ(pFile->GetVerbosity(),
+			printf("Warning: Mandatory descriptor 0x%02x missing\n",
+				m_tagsStart));
+	} else if (m_onlyOne && m_pDescriptors.Size() > 1) {
+		VERBOSE_READ(pFile->GetVerbosity(),
+			printf("Warning: Descriptor 0x%02x has more than one instance\n",
+				m_tagsStart));
+	}
+}
+
+void MP4DescriptorProperty::Write(MP4File* pFile, u_int32_t index)
+{
+	ASSERT(index == 0);
+
+	if (m_implicit) {
+		return;
+	}
+
+	for (u_int32_t i = 0; i < m_pDescriptors.Size(); i++) {
+		m_pDescriptors[i]->Write(pFile);
+	}
+}
+
+void MP4DescriptorProperty::Dump(FILE* pFile, u_int8_t indent,
+	bool dumpImplicits, u_int32_t index)
+{
+	ASSERT(index == 0);
+
+	if (m_implicit && !dumpImplicits) {
+		return;
+	}
+
+	if (m_name) {
+		Indent(pFile, indent);
+		fprintf(pFile, "%s\n", m_name);
+		indent++;
+	}
+
+	for (u_int32_t i = 0; i < m_pDescriptors.Size(); i++) {
+		m_pDescriptors[i]->Dump(pFile, indent, dumpImplicits);
+	}
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/mp4property.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,549 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#ifndef __MP4_PROPERTY_INCLUDED__
+#define __MP4_PROPERTY_INCLUDED__
+
+// forward declarations
+class MP4Atom;
+
+class MP4Descriptor;
+MP4ARRAY_DECL(MP4Descriptor, MP4Descriptor*);
+
+enum MP4PropertyType {
+	Integer8Property,
+	Integer16Property,
+	Integer24Property,
+	Integer32Property,
+	Integer64Property,
+	Float32Property,
+	StringProperty,
+	BytesProperty,
+	TableProperty,
+	DescriptorProperty,
+};
+
+class MP4Property {
+public:
+	MP4Property(const char *name = NULL);
+
+	virtual ~MP4Property() { }
+
+	MP4Atom* GetParentAtom() {
+		return m_pParentAtom;
+	}
+	virtual void SetParentAtom(MP4Atom* pParentAtom) {
+		m_pParentAtom = pParentAtom;
+	}
+
+	const char *GetName() {
+		return m_name;
+	}
+
+	virtual MP4PropertyType GetType() = NULL; 
+
+	bool IsReadOnly() {
+		return m_readOnly;
+	}
+	void SetReadOnly(bool value = true) {
+		m_readOnly = value;
+	}
+
+	bool IsImplicit() {
+		return m_implicit;
+	}
+	void SetImplicit(bool value = true) {
+		m_implicit = value;
+	}
+
+	virtual u_int32_t GetCount() = NULL;
+	virtual void SetCount(u_int32_t count) = NULL;
+
+	virtual void Generate() { /* default is a no-op */ };
+
+	virtual void Read(MP4File* pFile, u_int32_t index = 0) = NULL;
+
+	virtual void Write(MP4File* pFile, u_int32_t index = 0) = NULL;
+
+	virtual void Dump(FILE* pFile, u_int8_t indent,
+		bool dumpImplicits, u_int32_t index = 0) = NULL;
+
+	virtual bool FindProperty(const char* name,
+		MP4Property** ppProperty, u_int32_t* pIndex = NULL);
+
+protected:
+	MP4Atom* m_pParentAtom;
+	const char* m_name;
+	bool m_readOnly;
+	bool m_implicit;
+};
+
+MP4ARRAY_DECL(MP4Property, MP4Property*);
+
+class MP4IntegerProperty : public MP4Property {
+protected:
+	MP4IntegerProperty(char* name)
+		: MP4Property(name) { };
+
+public:
+	u_int64_t GetValue(u_int32_t index = 0);
+
+	void SetValue(u_int64_t value, u_int32_t index = 0);
+
+	void InsertValue(u_int64_t value, u_int32_t index = 0);
+
+	void DeleteValue(u_int32_t index = 0);
+
+	void IncrementValue(int32_t increment = 1, u_int32_t index = 0);
+};
+
+#define MP4INTEGER_PROPERTY_DECL2(isize, xsize) \
+	class MP4Integer##xsize##Property : public MP4IntegerProperty { \
+	public: \
+		MP4Integer##xsize##Property(char* name) \
+			: MP4IntegerProperty(name) { \
+			SetCount(1); \
+			m_values[0] = 0; \
+		} \
+		\
+		MP4PropertyType GetType() { \
+			return Integer##xsize##Property; \
+		} \
+		\
+		u_int32_t GetCount() { \
+			return m_values.Size(); \
+		} \
+		void SetCount(u_int32_t count) { \
+			m_values.Resize(count); \
+		} \
+		\
+		u_int##isize##_t GetValue(u_int32_t index = 0) { \
+			return m_values[index]; \
+		} \
+		\
+		void SetValue(u_int##isize##_t value, u_int32_t index = 0) { \
+			if (m_readOnly) { \
+				throw new MP4Error(EACCES, "property is read-only", m_name); \
+			} \
+			m_values[index] = value; \
+		} \
+		void AddValue(u_int##isize##_t value) { \
+			m_values.Add(value); \
+		} \
+		void InsertValue(u_int##isize##_t value, u_int32_t index) { \
+			m_values.Insert(value, index); \
+		} \
+		void DeleteValue(u_int32_t index) { \
+			m_values.Delete(index); \
+		} \
+		void IncrementValue(int32_t increment = 1, u_int32_t index = 0) { \
+			m_values[index] += increment; \
+		} \
+		void Read(MP4File* pFile, u_int32_t index = 0) { \
+			if (m_implicit) { \
+				return; \
+			} \
+			m_values[index] = pFile->ReadUInt##xsize(); \
+		} \
+		\
+		void Write(MP4File* pFile, u_int32_t index = 0) { \
+			if (m_implicit) { \
+				return; \
+			} \
+			pFile->WriteUInt##xsize(m_values[index]); \
+		} \
+		void Dump(FILE* pFile, u_int8_t indent, \
+			bool dumpImplicits, u_int32_t index = 0); \
+	\
+	protected: \
+		MP4Integer##isize##Array m_values; \
+	};
+
+#define MP4INTEGER_PROPERTY_DECL(size) \
+	MP4INTEGER_PROPERTY_DECL2(size, size)
+
+MP4INTEGER_PROPERTY_DECL(8);
+MP4INTEGER_PROPERTY_DECL(16);
+MP4INTEGER_PROPERTY_DECL2(32, 24);
+MP4INTEGER_PROPERTY_DECL(32);
+MP4INTEGER_PROPERTY_DECL(64);
+
+class MP4BitfieldProperty : public MP4Integer64Property {
+public:
+	MP4BitfieldProperty(char* name, u_int8_t numBits)
+		: MP4Integer64Property(name) {
+		ASSERT(numBits != 0);
+		ASSERT(numBits <= 64);
+		m_numBits = numBits;
+	}
+
+	u_int8_t GetNumBits() {
+		return m_numBits;
+	}
+	void SetNumBits(u_int8_t numBits) {
+		m_numBits = numBits;
+	}
+
+	void Read(MP4File* pFile, u_int32_t index = 0);
+	void Write(MP4File* pFile, u_int32_t index = 0);
+	void Dump(FILE* pFile, u_int8_t indent,
+		 bool dumpImplicits, u_int32_t index = 0);
+
+protected:
+	u_int8_t m_numBits;
+};
+
+class MP4Float32Property : public MP4Property {
+public:
+	MP4Float32Property(char* name)
+		: MP4Property(name) {
+		m_useFixed16Format = false;
+		m_useFixed32Format = false;
+		SetCount(1);
+		m_values[0] = 0.0;
+	}
+
+	MP4PropertyType GetType() {
+		return Float32Property;
+	}
+
+	u_int32_t GetCount() {
+		return m_values.Size();
+	}
+	void SetCount(u_int32_t count) {
+		m_values.Resize(count);
+	}
+
+	float GetValue(u_int32_t index = 0) {
+		return m_values[index];
+	}
+
+	void SetValue(float value, u_int32_t index = 0) {
+		if (m_readOnly) {
+			throw new MP4Error(EACCES, "property is read-only", m_name);
+		}
+		m_values[index] = value;
+	}
+
+	void AddValue(float value) {
+		m_values.Add(value);
+	}
+
+	void InsertValue(float value, u_int32_t index) {
+		m_values.Insert(value, index);
+	}
+
+	bool IsFixed16Format() {
+		return m_useFixed16Format;
+	}
+
+	void SetFixed16Format(bool useFixed16Format = true) {
+		m_useFixed16Format = useFixed16Format;
+	}
+
+	bool IsFixed32Format() {
+		return m_useFixed32Format;
+	}
+
+	void SetFixed32Format(bool useFixed32Format = true) {
+		m_useFixed32Format = useFixed32Format;
+	}
+
+	void Read(MP4File* pFile, u_int32_t index = 0);
+	void Write(MP4File* pFile, u_int32_t index = 0);
+	void Dump(FILE* pFile, u_int8_t indent,
+		 bool dumpImplicits, u_int32_t index = 0);
+
+protected:
+	bool m_useFixed16Format;
+	bool m_useFixed32Format;
+	MP4Float32Array m_values;
+};
+
+class MP4StringProperty : public MP4Property {
+public:
+	MP4StringProperty(char* name, 
+	  bool useCountedFormat = false, bool useUnicode = false);
+
+	~MP4StringProperty();
+
+	MP4PropertyType GetType() {
+		return StringProperty;
+	}
+
+	u_int32_t GetCount() {
+		return m_values.Size();
+	}
+
+	void SetCount(u_int32_t count);
+
+	const char* GetValue(u_int32_t index = 0) {
+		return m_values[index];
+	}
+
+	void SetValue(const char* value, u_int32_t index = 0);
+
+	void AddValue(char* value) {
+		u_int32_t count = GetCount();
+		SetCount(count + 1); 
+		SetValue(value, count);
+	}
+
+	bool IsCountedFormat() {
+		return m_useCountedFormat;
+	}
+
+	void SetCountedFormat(bool useCountedFormat) {
+		m_useCountedFormat = useCountedFormat;
+	}
+
+	bool IsExpandedCountedFormat() {
+		return m_useExpandedCount;
+	}
+
+	void SetExpandedCountedFormat(bool useExpandedCount) {
+		m_useExpandedCount = useExpandedCount;
+	}
+
+	bool IsUnicode() {
+		return m_useUnicode;
+	}
+
+	void SetUnicode(bool useUnicode) {
+		m_useUnicode = useUnicode;
+	}
+
+	u_int32_t GetFixedLength() {
+		return m_fixedLength;
+	}
+
+	void SetFixedLength(u_int32_t fixedLength) {
+		m_fixedLength = fixedLength;
+	}
+
+	void Read(MP4File* pFile, u_int32_t index = 0);
+	void Write(MP4File* pFile, u_int32_t index = 0);
+	void Dump(FILE* pFile, u_int8_t indent,
+		 bool dumpImplicits, u_int32_t index = 0);
+
+protected:
+	bool m_useCountedFormat;
+	bool m_useExpandedCount;
+	bool m_useUnicode;
+	u_int32_t m_fixedLength;
+
+	MP4StringArray m_values;
+};
+
+class MP4BytesProperty : public MP4Property {
+public:
+	MP4BytesProperty(char* name, u_int32_t valueSize = 0);
+
+	~MP4BytesProperty();
+
+	MP4PropertyType GetType() {
+		return BytesProperty;
+	}
+
+	u_int32_t GetCount() {
+		return m_values.Size();
+	}
+
+	void SetCount(u_int32_t count);
+
+	void GetValue(u_int8_t** ppValue, u_int32_t* pValueSize, 
+	  u_int32_t index = 0) {
+		// N.B. caller must free memory
+		*ppValue = (u_int8_t*)MP4Malloc(m_valueSizes[index]);
+		memcpy(*ppValue, m_values[index], m_valueSizes[index]);
+		*pValueSize = m_valueSizes[index];
+	}
+
+	void CopyValue(u_int8_t* pValue, u_int32_t index = 0) {
+		// N.B. caller takes responsbility for valid pointer
+		// and sufficient memory at the destination
+		memcpy(pValue, m_values[index], m_valueSizes[index]);
+	}
+
+	void SetValue(const u_int8_t* pValue, u_int32_t valueSize, 
+		u_int32_t index = 0);
+
+	void AddValue(u_int8_t* pValue, u_int32_t valueSize) {
+		u_int32_t count = GetCount();
+		SetCount(count + 1); 
+		SetValue(pValue, valueSize, count);
+	}
+
+	u_int32_t GetValueSize(u_int32_t valueSize, u_int32_t index = 0) {
+		return m_valueSizes[index];
+	}
+
+	void SetValueSize(u_int32_t valueSize, u_int32_t index = 0);
+
+	u_int32_t GetFixedSize() {
+		return m_fixedValueSize;
+	}
+
+	void SetFixedSize(u_int32_t fixedSize);
+
+	void Read(MP4File* pFile, u_int32_t index = 0);
+	void Write(MP4File* pFile, u_int32_t index = 0);
+	void Dump(FILE* pFile, u_int8_t indent,
+		 bool dumpImplicits, u_int32_t index = 0);
+
+protected:
+	u_int32_t			m_fixedValueSize;
+	MP4Integer32Array	m_valueSizes;
+	MP4BytesArray		m_values;
+};
+
+class MP4TableProperty : public MP4Property {
+public:
+	MP4TableProperty(char* name, MP4Property* pCountProperty);
+
+	~MP4TableProperty();
+
+	MP4PropertyType GetType() {
+		return TableProperty;
+	}
+
+	void SetParentAtom(MP4Atom* pParentAtom) {
+		m_pParentAtom = pParentAtom;
+		for (u_int32_t i = 0; i < m_pProperties.Size(); i++) {
+			m_pProperties[i]->SetParentAtom(pParentAtom);
+		}
+	}
+
+	void AddProperty(MP4Property* pProperty);
+
+	MP4Property* GetProperty(u_int32_t index) {
+		return m_pProperties[index];
+	}
+
+	u_int32_t GetCount() {
+		if (m_pCountProperty->GetType() == Integer8Property) {
+			return ((MP4Integer8Property*)m_pCountProperty)->GetValue();
+		} else {
+			return ((MP4Integer32Property*)m_pCountProperty)->GetValue();
+		} 
+	}
+	void SetCount(u_int32_t count) {
+		if (m_pCountProperty->GetType() == Integer8Property) {
+			((MP4Integer8Property*)m_pCountProperty)->SetValue(count);
+		} else {
+			((MP4Integer32Property*)m_pCountProperty)->SetValue(count);
+		} 
+	}
+
+	void Read(MP4File* pFile, u_int32_t index = 0);
+	void Write(MP4File* pFile, u_int32_t index = 0);
+	void Dump(FILE* pFile, u_int8_t indent,
+		 bool dumpImplicits, u_int32_t index = 0);
+
+	bool FindProperty(const char* name,
+		MP4Property** ppProperty, u_int32_t* pIndex = NULL);
+
+protected:
+	virtual void ReadEntry(MP4File* pFile, u_int32_t index);
+	virtual void WriteEntry(MP4File* pFile, u_int32_t index);
+
+	bool FindContainedProperty(const char* name,
+		MP4Property** ppProperty, u_int32_t* pIndex);
+
+protected:
+	MP4Property*		m_pCountProperty;
+	MP4PropertyArray	m_pProperties;
+};
+
+class MP4DescriptorProperty : public MP4Property {
+public:
+	MP4DescriptorProperty(char* name = NULL, 
+	  u_int8_t tagsStart = 0, u_int8_t tagsEnd = 0,
+	  bool mandatory = false, bool onlyOne = false);
+
+	~MP4DescriptorProperty();
+
+	MP4PropertyType GetType() {
+		return DescriptorProperty;
+	}
+
+	void SetParentAtom(MP4Atom* pParentAtom);
+
+	void SetSizeLimit(u_int64_t sizeLimit) {
+		m_sizeLimit = sizeLimit;
+	}
+
+	u_int32_t GetCount() {
+		return m_pDescriptors.Size();
+	}
+	void SetCount(u_int32_t count) {
+		m_pDescriptors.Resize(count);
+	}
+
+	void SetTags(u_int8_t tagsStart, u_int8_t tagsEnd = 0) {
+		m_tagsStart = tagsStart;
+		m_tagsEnd = tagsEnd ? tagsEnd : tagsStart;
+	}
+
+	MP4Descriptor* AddDescriptor(u_int8_t tag);
+
+	void AppendDescriptor(MP4Descriptor* pDescriptor) {
+		m_pDescriptors.Add(pDescriptor);
+	}
+
+	void DeleteDescriptor(u_int32_t index);
+
+	void Generate();
+	void Read(MP4File* pFile, u_int32_t index = 0);
+	void Write(MP4File* pFile, u_int32_t index = 0);
+	void Dump(FILE* pFile, u_int8_t indent,
+		 bool dumpImplicits, u_int32_t index = 0);
+
+	bool FindProperty(const char* name,
+		MP4Property** ppProperty, u_int32_t* pIndex = NULL);
+
+protected:
+	virtual MP4Descriptor* CreateDescriptor(u_int8_t tag);
+
+	bool FindContainedProperty(const char* name,
+		MP4Property** ppProperty, u_int32_t* pIndex);
+
+protected:
+	u_int8_t			m_tagsStart;
+	u_int8_t			m_tagsEnd;
+	u_int64_t			m_sizeLimit;
+	bool				m_mandatory;
+	bool				m_onlyOne;
+	MP4DescriptorArray	m_pDescriptors;
+};
+
+class MP4QosQualifierProperty : public MP4DescriptorProperty {
+public:
+	MP4QosQualifierProperty(char* name = NULL, 
+	  u_int8_t tagsStart = 0, u_int8_t tagsEnd = 0,
+	  bool mandatory = false, bool onlyOne = false) :
+	MP4DescriptorProperty(name, tagsStart, tagsEnd, mandatory, onlyOne) { }
+
+protected:
+	MP4Descriptor* CreateDescriptor(u_int8_t tag);
+};
+
+#endif /* __MP4_PROPERTY_INCLUDED__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/mp4track.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,1624 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4Track::MP4Track(MP4File* pFile, MP4Atom* pTrakAtom) 
+{
+	m_pFile = pFile;
+	m_pTrakAtom = pTrakAtom;
+
+	m_lastStsdIndex = 0;
+	m_lastSampleFile = NULL;
+
+	m_cachedReadSampleId = MP4_INVALID_SAMPLE_ID;
+	m_pCachedReadSample = NULL;
+	m_cachedReadSampleSize = 0;
+
+	m_writeSampleId = 1;
+	m_fixedSampleDuration = 0;
+	m_pChunkBuffer = NULL;
+	m_chunkBufferSize = 0;
+	m_chunkSamples = 0;
+	m_chunkDuration = 0;
+
+	m_samplesPerChunk = 0;
+	m_durationPerChunk = 0;
+
+	bool success = true;
+
+	MP4Integer32Property* pTrackIdProperty;
+	success &= m_pTrakAtom->FindProperty(
+		"trak.tkhd.trackId",
+		(MP4Property**)&pTrackIdProperty);
+	if (success) {
+		m_trackId = pTrackIdProperty->GetValue();
+	}
+
+	success &= m_pTrakAtom->FindProperty(
+		"trak.mdia.mdhd.timeScale", 
+		(MP4Property**)&m_pTimeScaleProperty);
+	if (success) {
+		// default chunking is 1 second of samples
+		m_durationPerChunk = m_pTimeScaleProperty->GetValue();
+	}
+
+	success &= m_pTrakAtom->FindProperty(
+		"trak.tkhd.duration", 
+		(MP4Property**)&m_pTrackDurationProperty);
+
+	success &= m_pTrakAtom->FindProperty(
+		"trak.mdia.mdhd.duration", 
+		(MP4Property**)&m_pMediaDurationProperty);
+
+	success &= m_pTrakAtom->FindProperty(
+		"trak.tkhd.modificationTime", 
+		(MP4Property**)&m_pTrackModificationProperty);
+
+	success &= m_pTrakAtom->FindProperty(
+		"trak.mdia.mdhd.modificationTime", 
+		(MP4Property**)&m_pMediaModificationProperty);
+
+	success &= m_pTrakAtom->FindProperty(
+		"trak.mdia.hdlr.handlerType",
+		(MP4Property**)&m_pTypeProperty);
+
+	// get handles on sample size information
+
+	success &= m_pTrakAtom->FindProperty(
+		"trak.mdia.minf.stbl.stsz.sampleSize",
+		(MP4Property**)&m_pStszFixedSampleSizeProperty);
+	
+	success &= m_pTrakAtom->FindProperty(
+		"trak.mdia.minf.stbl.stsz.sampleCount",
+		(MP4Property**)&m_pStszSampleCountProperty);
+
+	success &= m_pTrakAtom->FindProperty(
+		"trak.mdia.minf.stbl.stsz.entries.sampleSize",
+		(MP4Property**)&m_pStszSampleSizeProperty);
+
+	// get handles on information needed to map sample id's to file offsets
+
+	success &= m_pTrakAtom->FindProperty(
+		"trak.mdia.minf.stbl.stsc.entryCount",
+		(MP4Property**)&m_pStscCountProperty);
+
+	success &= m_pTrakAtom->FindProperty(
+		"trak.mdia.minf.stbl.stsc.entries.firstChunk",
+		(MP4Property**)&m_pStscFirstChunkProperty);
+
+	success &= m_pTrakAtom->FindProperty(
+		"trak.mdia.minf.stbl.stsc.entries.samplesPerChunk",
+		(MP4Property**)&m_pStscSamplesPerChunkProperty);
+
+	success &= m_pTrakAtom->FindProperty(
+		"trak.mdia.minf.stbl.stsc.entries.sampleDescriptionIndex",
+		(MP4Property**)&m_pStscSampleDescrIndexProperty);
+
+	success &= m_pTrakAtom->FindProperty(
+		"trak.mdia.minf.stbl.stsc.entries.firstSample",
+		(MP4Property**)&m_pStscFirstSampleProperty);
+
+	bool haveStco = m_pTrakAtom->FindProperty(
+		"trak.mdia.minf.stbl.stco.entryCount",
+		(MP4Property**)&m_pChunkCountProperty);
+
+	if (haveStco) {
+		success &= m_pTrakAtom->FindProperty(
+			"trak.mdia.minf.stbl.stco.entries.chunkOffset",
+			(MP4Property**)&m_pChunkOffsetProperty);
+	} else {
+		success &= m_pTrakAtom->FindProperty(
+			"trak.mdia.minf.stbl.co64.entryCount",
+			(MP4Property**)&m_pChunkCountProperty);
+
+		success &= m_pTrakAtom->FindProperty(
+			"trak.mdia.minf.stbl.co64.entries.chunkOffset",
+			(MP4Property**)&m_pChunkOffsetProperty);
+	}
+
+	// get handles on sample timing info
+
+	success &= m_pTrakAtom->FindProperty(
+		"trak.mdia.minf.stbl.stts.entryCount",
+		(MP4Property**)&m_pSttsCountProperty);
+	
+	success &= m_pTrakAtom->FindProperty(
+		"trak.mdia.minf.stbl.stts.entries.sampleCount",
+		(MP4Property**)&m_pSttsSampleCountProperty);
+	
+	success &= m_pTrakAtom->FindProperty(
+		"trak.mdia.minf.stbl.stts.entries.sampleDelta",
+		(MP4Property**)&m_pSttsSampleDeltaProperty);
+	
+	// get handles on rendering offset info if it exists
+
+	m_pCttsCountProperty = NULL;
+	m_pCttsSampleCountProperty = NULL;
+	m_pCttsSampleOffsetProperty = NULL;
+
+	bool haveCtts = m_pTrakAtom->FindProperty(
+		"trak.mdia.minf.stbl.ctts.entryCount",
+		(MP4Property**)&m_pCttsCountProperty);
+
+	if (haveCtts) {
+		success &= m_pTrakAtom->FindProperty(
+			"trak.mdia.minf.stbl.ctts.entries.sampleCount",
+			(MP4Property**)&m_pCttsSampleCountProperty);
+
+		success &= m_pTrakAtom->FindProperty(
+			"trak.mdia.minf.stbl.ctts.entries.sampleOffset",
+			(MP4Property**)&m_pCttsSampleOffsetProperty);
+	}
+
+	// get handles on sync sample info if it exists
+
+	m_pStssCountProperty = NULL;
+	m_pStssSampleProperty = NULL;
+
+	bool haveStss = m_pTrakAtom->FindProperty(
+		"trak.mdia.minf.stbl.stss.entryCount",
+		(MP4Property**)&m_pStssCountProperty);
+
+	if (haveStss) {
+		success &= m_pTrakAtom->FindProperty(
+			"trak.mdia.minf.stbl.stss.entries.sampleNumber",
+			(MP4Property**)&m_pStssSampleProperty);
+	}
+
+	// edit list
+	InitEditListProperties();
+
+	// was everything found?
+	if (!success) {
+		throw new MP4Error("invalid track", "MP4Track::MP4Track");
+	}
+}
+
+MP4Track::~MP4Track()
+{
+	MP4Free(m_pCachedReadSample);
+	MP4Free(m_pChunkBuffer);
+}
+
+const char* MP4Track::GetType()
+{
+	return m_pTypeProperty->GetValue();
+}
+
+void MP4Track::SetType(const char* type) 
+{
+	m_pTypeProperty->SetValue(NormalizeTrackType(type));
+}
+
+void MP4Track::ReadSample(
+	MP4SampleId sampleId,
+	u_int8_t** ppBytes, 
+	u_int32_t* pNumBytes, 
+	MP4Timestamp* pStartTime, 
+	MP4Duration* pDuration,
+	MP4Duration* pRenderingOffset, 
+	bool* pIsSyncSample)
+{
+	if (sampleId == MP4_INVALID_SAMPLE_ID) {
+		throw new MP4Error("sample id can't be zero", 
+			"MP4Track::ReadSample");
+	}
+
+	// handle unusual case of wanting to read a sample
+	// that is still sitting in the write chunk buffer
+	if (m_pChunkBuffer && sampleId >= m_writeSampleId - m_chunkSamples) {
+		WriteChunkBuffer();
+	}
+
+	FILE* pFile = GetSampleFile(sampleId);
+
+	if (pFile == (FILE*)-1) {
+		throw new MP4Error("sample is located in an inaccessible file",
+			"MP4Track::ReadSample");
+	}
+
+	u_int64_t fileOffset = GetSampleFileOffset(sampleId);
+
+	u_int32_t sampleSize = GetSampleSize(sampleId);
+	if (*ppBytes != NULL && *pNumBytes < sampleSize) {
+		throw new MP4Error("sample buffer is too small",
+			 "MP4Track::ReadSample");
+	}
+	*pNumBytes = sampleSize;
+
+	VERBOSE_READ_SAMPLE(m_pFile->GetVerbosity(),
+		printf("ReadSample: track %u id %u offset 0x"LLX" size %u (0x%x)\n",
+			m_trackId, sampleId, fileOffset, *pNumBytes, *pNumBytes));
+
+	bool bufferMalloc = false;
+	if (*ppBytes == NULL) {
+		*ppBytes = (u_int8_t*)MP4Malloc(*pNumBytes);
+		bufferMalloc = true;
+	}
+
+	u_int64_t oldPos = m_pFile->GetPosition(pFile); // only used in mode == 'w'
+	try { 
+		m_pFile->SetPosition(fileOffset, pFile);
+		m_pFile->ReadBytes(*ppBytes, *pNumBytes, pFile);
+
+		if (pStartTime || pDuration) {
+			GetSampleTimes(sampleId, pStartTime, pDuration);
+
+			VERBOSE_READ_SAMPLE(m_pFile->GetVerbosity(),
+				printf("ReadSample:  start "LLU" duration "LLD"\n",
+					(pStartTime ? *pStartTime : 0), 
+					(pDuration ? *pDuration : 0)));
+		}
+		if (pRenderingOffset) {
+			*pRenderingOffset = GetSampleRenderingOffset(sampleId);
+
+			VERBOSE_READ_SAMPLE(m_pFile->GetVerbosity(),
+				printf("ReadSample:  renderingOffset "LLD"\n",
+					*pRenderingOffset));
+		}
+		if (pIsSyncSample) {
+			*pIsSyncSample = IsSyncSample(sampleId);
+
+			VERBOSE_READ_SAMPLE(m_pFile->GetVerbosity(),
+				printf("ReadSample:  isSyncSample %u\n",
+					*pIsSyncSample));
+		}
+	}
+
+	catch (MP4Error* e) {
+		if (bufferMalloc) {
+			// let's not leak memory
+			MP4Free(*ppBytes);
+			*ppBytes = NULL;
+		}
+		if (m_pFile->GetMode() == 'w') {
+			m_pFile->SetPosition(oldPos, pFile);
+		}
+		throw e;
+	}
+
+	if (m_pFile->GetMode() == 'w') {
+		m_pFile->SetPosition(oldPos, pFile);
+	}
+}
+
+void MP4Track::ReadSampleFragment(
+	MP4SampleId sampleId,
+	u_int32_t sampleOffset,
+	u_int16_t sampleLength,
+	u_int8_t* pDest)
+{
+	if (sampleId == MP4_INVALID_SAMPLE_ID) {
+		throw new MP4Error("invalid sample id", 
+			"MP4Track::ReadSampleFragment");
+	}
+
+	if (sampleId != m_cachedReadSampleId) {
+		MP4Free(m_pCachedReadSample);
+		m_pCachedReadSample = NULL;
+		m_cachedReadSampleSize = 0;
+		m_cachedReadSampleId = MP4_INVALID_SAMPLE_ID;
+
+		ReadSample(
+			sampleId,
+			&m_pCachedReadSample,
+			&m_cachedReadSampleSize);
+
+		m_cachedReadSampleId = sampleId;
+	}
+
+	if (sampleOffset + sampleLength > m_cachedReadSampleSize) {
+		throw new MP4Error("offset and/or length are too large", 
+			"MP4Track::ReadSampleFragment");
+	}
+
+	memcpy(pDest, &m_pCachedReadSample[sampleOffset], sampleLength);
+}
+
+void MP4Track::WriteSample(
+	u_int8_t* pBytes, 
+	u_int32_t numBytes,
+	MP4Duration duration, 
+	MP4Duration renderingOffset, 
+	bool isSyncSample)
+{
+	VERBOSE_WRITE_SAMPLE(m_pFile->GetVerbosity(),
+		printf("WriteSample: track %u id %u size %u (0x%x) ",
+			m_trackId, m_writeSampleId, numBytes, numBytes));
+
+	if (pBytes == NULL && numBytes > 0) {
+		throw new MP4Error("no sample data", "MP4WriteSample");
+	}
+
+	if (duration == MP4_INVALID_DURATION) {
+		duration = GetFixedSampleDuration();
+	}
+
+	VERBOSE_WRITE_SAMPLE(m_pFile->GetVerbosity(),
+		printf("duration "LLU"\n", duration));
+
+	// append sample bytes to chunk buffer
+	m_pChunkBuffer = (u_int8_t*)MP4Realloc(m_pChunkBuffer, 
+		m_chunkBufferSize + numBytes);
+	memcpy(&m_pChunkBuffer[m_chunkBufferSize], pBytes, numBytes);
+	m_chunkBufferSize += numBytes;
+	m_chunkSamples++;
+	m_chunkDuration += duration;
+
+	UpdateSampleSizes(m_writeSampleId, numBytes);
+
+	UpdateSampleTimes(duration);
+
+	UpdateRenderingOffsets(m_writeSampleId, renderingOffset);
+
+	UpdateSyncSamples(m_writeSampleId, isSyncSample);
+
+	if (IsChunkFull(m_writeSampleId)) {
+		WriteChunkBuffer();
+	}
+
+	UpdateDurations(duration);
+
+	UpdateModificationTimes();
+
+	m_writeSampleId++;
+}
+
+void MP4Track::WriteChunkBuffer()
+{
+	if (m_chunkBufferSize == 0) {
+		return;
+	}
+
+	u_int64_t chunkOffset = m_pFile->GetPosition();
+
+	// write chunk buffer
+	m_pFile->WriteBytes(m_pChunkBuffer, m_chunkBufferSize);
+
+	VERBOSE_WRITE_SAMPLE(m_pFile->GetVerbosity(),
+		printf("WriteChunk: track %u offset 0x"LLX" size %u (0x%x) numSamples %u\n",
+			m_trackId, chunkOffset, m_chunkBufferSize, 
+			m_chunkBufferSize, m_chunkSamples));
+
+	UpdateSampleToChunk(m_writeSampleId, 
+		m_pChunkCountProperty->GetValue() + 1, 
+		m_chunkSamples);
+
+	UpdateChunkOffsets(chunkOffset);
+
+	// clean up chunk buffer
+	MP4Free(m_pChunkBuffer);
+	m_pChunkBuffer = NULL;
+	m_chunkBufferSize = 0;
+	m_chunkSamples = 0;
+	m_chunkDuration = 0;
+}
+
+void MP4Track::FinishWrite()
+{
+	// write out any remaining samples in chunk buffer
+	WriteChunkBuffer();
+
+	// record buffer size and bitrates
+	MP4BitfieldProperty* pBufferSizeProperty;
+
+	if (m_pTrakAtom->FindProperty(
+	  "trak.mdia.minf.stbl.stsd.*.esds.decConfigDescr.bufferSizeDB",
+	  (MP4Property**)&pBufferSizeProperty)) {
+		pBufferSizeProperty->SetValue(GetMaxSampleSize());
+	}
+
+	MP4Integer32Property* pBitrateProperty;
+
+	if (m_pTrakAtom->FindProperty(
+	  "trak.mdia.minf.stbl.stsd.*.esds.decConfigDescr.maxBitrate",
+	  (MP4Property**)&pBitrateProperty)) {
+		pBitrateProperty->SetValue(GetMaxBitrate());
+	}
+
+	if (m_pTrakAtom->FindProperty(
+	  "trak.mdia.minf.stbl.stsd.*.esds.decConfigDescr.avgBitrate",
+	  (MP4Property**)&pBitrateProperty)) {
+		pBitrateProperty->SetValue(GetAvgBitrate());
+	}
+}
+
+bool MP4Track::IsChunkFull(MP4SampleId sampleId)
+{
+	if (m_samplesPerChunk) {
+		return m_chunkSamples >= m_samplesPerChunk;
+	}
+
+	ASSERT(m_durationPerChunk);
+	return m_chunkDuration >= m_durationPerChunk;
+}
+
+u_int32_t MP4Track::GetNumberOfSamples()
+{
+	return m_pStszSampleCountProperty->GetValue();
+}
+
+u_int32_t MP4Track::GetSampleSize(MP4SampleId sampleId)
+{
+	u_int32_t fixedSampleSize = 
+		m_pStszFixedSampleSizeProperty->GetValue(); 
+
+	if (fixedSampleSize != 0) {
+		return fixedSampleSize;
+	}
+	return m_pStszSampleSizeProperty->GetValue(sampleId - 1);
+}
+
+u_int32_t MP4Track::GetMaxSampleSize()
+{
+	u_int32_t fixedSampleSize = 
+		m_pStszFixedSampleSizeProperty->GetValue(); 
+
+	if (fixedSampleSize != 0) {
+		return fixedSampleSize;
+	}
+
+	u_int32_t maxSampleSize = 0;
+	u_int32_t numSamples = m_pStszSampleSizeProperty->GetCount();
+	for (MP4SampleId sid = 1; sid <= numSamples; sid++) {
+		u_int32_t sampleSize =
+			m_pStszSampleSizeProperty->GetValue(sid - 1);
+		if (sampleSize > maxSampleSize) {
+			maxSampleSize = sampleSize;
+		}
+	}
+	return maxSampleSize;
+}
+
+u_int64_t MP4Track::GetTotalOfSampleSizes()
+{
+	u_int32_t fixedSampleSize = 
+		m_pStszFixedSampleSizeProperty->GetValue(); 
+
+	// if fixed sample size, just need to multiply by number of samples
+	if (fixedSampleSize != 0) {
+		return fixedSampleSize * GetNumberOfSamples();
+	}
+
+	// else non-fixed sample size, sum them
+	u_int64_t totalSampleSizes = 0;
+	u_int32_t numSamples = m_pStszSampleSizeProperty->GetCount();
+	for (MP4SampleId sid = 1; sid <= numSamples; sid++) {
+		u_int32_t sampleSize =
+			m_pStszSampleSizeProperty->GetValue(sid - 1);
+		totalSampleSizes += sampleSize;
+	}
+	return totalSampleSizes;
+}
+
+void MP4Track::UpdateSampleSizes(MP4SampleId sampleId, u_int32_t numBytes)
+{
+	// for first sample
+	if (sampleId == 1) {
+		if (numBytes > 0) {
+			// presume sample size is fixed
+			m_pStszFixedSampleSizeProperty->SetValue(numBytes); 
+		} else {
+			// special case of first sample is zero bytes in length
+			// leave m_pStszFixedSampleSizeProperty at 0
+			// start recording variable sample sizes
+			m_pStszSampleSizeProperty->AddValue(0);
+		}
+
+	} else { // sampleId > 1
+		u_int32_t fixedSampleSize = 
+			m_pStszFixedSampleSizeProperty->GetValue(); 
+
+		if (fixedSampleSize == 0 || numBytes != fixedSampleSize) {
+			// sample size is not fixed
+
+			if (fixedSampleSize) {
+				// need to clear fixed sample size
+				m_pStszFixedSampleSizeProperty->SetValue(0); 
+
+				// and create sizes for all previous samples
+				for (MP4SampleId sid = 1; sid < sampleId; sid++) {
+					m_pStszSampleSizeProperty->AddValue(fixedSampleSize);
+				}
+			}
+
+			// add size value for this sample
+			m_pStszSampleSizeProperty->AddValue(numBytes);
+		}
+	}
+
+	m_pStszSampleCountProperty->IncrementValue();
+}
+
+u_int32_t MP4Track::GetAvgBitrate()
+{
+	if (GetDuration() == 0) {
+		return 0;
+	}
+
+	u_int64_t durationSecs =
+		MP4ConvertTime(GetDuration(), GetTimeScale(), MP4_SECS_TIME_SCALE);
+
+	if (GetDuration() % GetTimeScale() != 0) {
+		durationSecs++;
+	}
+
+	return (GetTotalOfSampleSizes() * 8) / durationSecs;
+}
+
+u_int32_t MP4Track::GetMaxBitrate()
+{
+	u_int32_t timeScale = GetTimeScale();
+	MP4SampleId numSamples = GetNumberOfSamples();
+	u_int32_t maxBytesPerSec = 0;
+	u_int32_t bytesThisSec = 0;
+	MP4Timestamp thisSec = 0;
+
+	for (MP4SampleId sid = 1; sid <= numSamples; sid++) {
+		u_int32_t sampleSize;
+		MP4Timestamp sampleTime;
+
+		sampleSize = GetSampleSize(sid);
+
+		GetSampleTimes(sid, &sampleTime, NULL);
+
+		// sample counts for current second
+		if (sampleTime < thisSec + timeScale) {
+			bytesThisSec += sampleSize;
+		} else { // sample is in a future second
+			if (bytesThisSec > maxBytesPerSec) {
+				maxBytesPerSec = bytesThisSec;
+			}
+
+			thisSec = sampleTime - (sampleTime % timeScale);
+			bytesThisSec = sampleSize;
+		}
+	}
+
+	// last second (or partial second) 
+	if (bytesThisSec > maxBytesPerSec) {
+		maxBytesPerSec = bytesThisSec;
+	}
+
+	return maxBytesPerSec * 8;
+}
+
+u_int32_t MP4Track::GetSampleStscIndex(MP4SampleId sampleId)
+{
+	u_int32_t stscIndex;
+	u_int32_t numStscs = m_pStscCountProperty->GetValue();
+
+	if (numStscs == 0) {
+		throw new MP4Error("No data chunks exist", "GetSampleStscIndex");
+	}
+
+	for (stscIndex = 0; stscIndex < numStscs; stscIndex++) {
+		if (sampleId < m_pStscFirstSampleProperty->GetValue(stscIndex)) {
+			ASSERT(stscIndex != 0);
+			stscIndex -= 1;
+			break;
+		}
+	}
+	if (stscIndex == numStscs) {
+		ASSERT(stscIndex != 0);
+		stscIndex -= 1;
+	}
+
+	return stscIndex;
+}
+
+FILE* MP4Track::GetSampleFile(MP4SampleId sampleId)
+{
+	u_int32_t stscIndex =
+		GetSampleStscIndex(sampleId);
+
+	u_int32_t stsdIndex = 
+		m_pStscSampleDescrIndexProperty->GetValue(stscIndex);
+
+	// check if the answer will be the same as last time
+	if (m_lastStsdIndex && stsdIndex == m_lastStsdIndex) {
+		return m_lastSampleFile;
+	}
+
+	MP4Atom* pStsdAtom = 
+		m_pTrakAtom->FindAtom("trak.mdia.minf.stbl.stsd");
+	ASSERT(pStsdAtom);
+
+	MP4Atom* pStsdEntryAtom = 
+		pStsdAtom->GetChildAtom(stsdIndex - 1);
+	ASSERT(pStsdEntryAtom);
+
+	MP4Integer16Property* pDrefIndexProperty = NULL;
+	pStsdEntryAtom->FindProperty(
+		"*.dataReferenceIndex",
+		(MP4Property**)&pDrefIndexProperty);
+	
+	if (pDrefIndexProperty == NULL) {
+		throw new MP4Error("invalid stsd entry", "GetSampleFile");
+	}
+
+	u_int32_t drefIndex =
+		pDrefIndexProperty->GetValue();
+
+	MP4Atom* pDrefAtom =
+		m_pTrakAtom->FindAtom("trak.mdia.minf.dinf.dref");
+	ASSERT(pDrefAtom);
+
+	MP4Atom* pUrlAtom =
+		pDrefAtom->GetChildAtom(drefIndex - 1);
+	ASSERT(pUrlAtom);
+
+	FILE* pFile;
+
+	if (pUrlAtom->GetFlags() & 1) {
+		pFile = NULL;	// self-contained
+	} else {
+		MP4StringProperty* pLocationProperty = NULL;
+		pUrlAtom->FindProperty(
+			"*.location", 
+			(MP4Property**)&pLocationProperty);
+		ASSERT(pLocationProperty);
+
+		const char* url = pLocationProperty->GetValue();
+
+		VERBOSE_READ_SAMPLE(m_pFile->GetVerbosity(),
+			printf("dref url = %s\n", url));
+
+		pFile = (FILE*)-1;
+
+		// attempt to open url if it's a file url 
+		// currently this is the only thing we understand
+		if (!strncmp(url, "file:", 5)) {
+			const char* fileName = url + 5;
+			if (!strncmp(fileName, "//", 2)) {
+				fileName = strchr(fileName + 2, '/');
+			}
+			if (fileName) {
+				pFile = fopen(fileName, "rb");
+				if (!pFile) {
+					pFile = (FILE*)-1;
+				}
+			}
+		} 
+	}
+
+	if (m_lastSampleFile) {
+		fclose(m_lastSampleFile);
+	}
+
+	// cache the answer
+	m_lastStsdIndex = stsdIndex;
+	m_lastSampleFile = pFile;
+
+	return pFile;
+}
+
+u_int64_t MP4Track::GetSampleFileOffset(MP4SampleId sampleId)
+{
+	u_int32_t stscIndex =
+		GetSampleStscIndex(sampleId);
+
+	u_int32_t firstChunk = 
+		m_pStscFirstChunkProperty->GetValue(stscIndex);
+
+	MP4SampleId firstSample = 
+		m_pStscFirstSampleProperty->GetValue(stscIndex);
+
+	u_int32_t samplesPerChunk = 
+		m_pStscSamplesPerChunkProperty->GetValue(stscIndex);
+
+	MP4ChunkId chunkId = firstChunk +
+		((sampleId - firstSample) / samplesPerChunk);
+
+	u_int64_t chunkOffset = m_pChunkOffsetProperty->GetValue(chunkId - 1);
+
+	MP4SampleId firstSampleInChunk = 
+		sampleId - ((sampleId - firstSample) % samplesPerChunk);
+
+	// need cumulative samples sizes from firstSample to sampleId - 1
+	u_int32_t sampleOffset = 0;
+	for (MP4SampleId i = firstSampleInChunk; i < sampleId; i++) {
+		sampleOffset += GetSampleSize(i);
+	}
+
+	return chunkOffset + sampleOffset;
+}
+
+void MP4Track::UpdateSampleToChunk(MP4SampleId sampleId,
+	 MP4ChunkId chunkId, u_int32_t samplesPerChunk)
+{
+	u_int32_t numStsc = m_pStscCountProperty->GetValue();
+
+	// if samplesPerChunk == samplesPerChunk of last entry
+	if (numStsc && samplesPerChunk == 
+	  m_pStscSamplesPerChunkProperty->GetValue(numStsc-1)) {
+
+		// nothing to do
+
+	} else {
+		// add stsc entry
+		m_pStscFirstChunkProperty->AddValue(chunkId);
+		m_pStscSamplesPerChunkProperty->AddValue(samplesPerChunk);
+		m_pStscSampleDescrIndexProperty->AddValue(1);
+		m_pStscFirstSampleProperty->AddValue(sampleId - samplesPerChunk + 1);
+
+		m_pStscCountProperty->IncrementValue();
+	}
+}
+
+void MP4Track::UpdateChunkOffsets(u_int64_t chunkOffset)
+{
+	if (m_pChunkOffsetProperty->GetType() == Integer32Property) {
+		((MP4Integer32Property*)m_pChunkOffsetProperty)->AddValue(chunkOffset);
+	} else {
+		((MP4Integer64Property*)m_pChunkOffsetProperty)->AddValue(chunkOffset);
+	}
+	m_pChunkCountProperty->IncrementValue();
+}
+
+MP4Duration MP4Track::GetFixedSampleDuration()
+{
+	u_int32_t numStts = m_pSttsCountProperty->GetValue();
+
+	if (numStts == 0) {
+		return m_fixedSampleDuration;
+	}
+	if (numStts != 1) {
+		return MP4_INVALID_DURATION;	// sample duration is not fixed
+	}
+	return m_pSttsSampleDeltaProperty->GetValue(0);
+}
+
+bool MP4Track::SetFixedSampleDuration(MP4Duration duration)
+{
+	u_int32_t numStts = m_pSttsCountProperty->GetValue();
+
+	// setting this is only allowed before samples have been written
+	if (numStts != 0) {
+		return false;
+	}
+	m_fixedSampleDuration = duration;
+	return true;
+}
+
+void MP4Track::GetSampleTimes(MP4SampleId sampleId,
+	MP4Timestamp* pStartTime, MP4Duration* pDuration)
+{
+	u_int32_t numStts = m_pSttsCountProperty->GetValue();
+	MP4SampleId sid = 1;
+	MP4Duration elapsed = 0;
+
+	for (u_int32_t sttsIndex = 0; sttsIndex < numStts; sttsIndex++) {
+		u_int32_t sampleCount = 
+			m_pSttsSampleCountProperty->GetValue(sttsIndex);
+		u_int32_t sampleDelta = 
+			m_pSttsSampleDeltaProperty->GetValue(sttsIndex);
+
+		if (sampleId <= sid + sampleCount - 1) {
+			if (pStartTime) {
+				*pStartTime = elapsed + ((sampleId - sid) * sampleDelta);
+			}
+			if (pDuration) {
+				*pDuration = sampleDelta;
+			}
+			return;
+		}
+		sid += sampleCount;
+		elapsed += sampleCount * sampleDelta;
+	}
+
+	throw new MP4Error("sample id out of range", 
+		"MP4Track::GetSampleTimes");
+}
+
+MP4SampleId MP4Track::GetSampleIdFromTime(
+	MP4Timestamp when, 
+	bool wantSyncSample) 
+{
+	u_int32_t numStts = m_pSttsCountProperty->GetValue();
+	MP4SampleId sid = 1;
+	MP4Duration elapsed = 0;
+
+	for (u_int32_t sttsIndex = 0; sttsIndex < numStts; sttsIndex++) {
+		u_int32_t sampleCount = 
+			m_pSttsSampleCountProperty->GetValue(sttsIndex);
+		u_int32_t sampleDelta = 
+			m_pSttsSampleDeltaProperty->GetValue(sttsIndex);
+
+		if (sampleDelta == 0 && sttsIndex < numStts - 1) {
+			VERBOSE_READ(m_pFile->GetVerbosity(),
+				printf("Warning: Zero sample duration, stts entry %u\n",
+				sttsIndex));
+		}
+
+		MP4Duration d = when - elapsed;
+
+		if (d <= sampleCount * sampleDelta) {
+			MP4SampleId sampleId = sid;
+			if (sampleDelta) {
+				sampleId += (d / sampleDelta);
+			}
+
+			if (wantSyncSample) {
+				return GetNextSyncSample(sampleId);
+			}
+			return sampleId;
+		}
+
+		sid += sampleCount;
+		elapsed += sampleCount * sampleDelta;
+	}
+
+	throw new MP4Error("time out of range", 
+		"MP4Track::GetSampleIdFromTime");
+
+	return 0; // satisfy MS compiler
+}
+
+void MP4Track::UpdateSampleTimes(MP4Duration duration)
+{
+	u_int32_t numStts = m_pSttsCountProperty->GetValue();
+
+	// if duration == duration of last entry
+	if (numStts 
+	  && duration == m_pSttsSampleDeltaProperty->GetValue(numStts-1)) {
+		// increment last entry sampleCount
+		m_pSttsSampleCountProperty->IncrementValue(1, numStts-1);
+
+	} else {
+		// add stts entry, sampleCount = 1, sampleDuration = duration
+		m_pSttsSampleCountProperty->AddValue(1);
+		m_pSttsSampleDeltaProperty->AddValue(duration);
+		m_pSttsCountProperty->IncrementValue();;
+	}
+}
+
+u_int32_t MP4Track::GetSampleCttsIndex(MP4SampleId sampleId, 
+	MP4SampleId* pFirstSampleId)
+{
+	u_int32_t numCtts = m_pCttsCountProperty->GetValue();
+
+	MP4SampleId sid = 1;
+	
+	for (u_int32_t cttsIndex = 0; cttsIndex < numCtts; cttsIndex++) {
+		u_int32_t sampleCount = 
+			m_pCttsSampleCountProperty->GetValue(cttsIndex);
+
+		if (sampleId <= sid + sampleCount - 1) {
+			if (pFirstSampleId) {
+				*pFirstSampleId = sid;
+			}
+			return cttsIndex;
+		}
+		sid += sampleCount;
+	}
+
+	throw new MP4Error("sample id out of range", 
+		"MP4Track::GetSampleCttsIndex");
+	return 0; // satisfy MS compiler
+}
+
+MP4Duration MP4Track::GetSampleRenderingOffset(MP4SampleId sampleId)
+{
+	if (m_pCttsCountProperty == NULL) {
+		return 0;
+	}
+	if (m_pCttsCountProperty->GetValue() == 0) {
+		return 0;
+	}
+
+	u_int32_t cttsIndex = GetSampleCttsIndex(sampleId);
+
+	return m_pCttsSampleOffsetProperty->GetValue(cttsIndex);
+}
+
+void MP4Track::UpdateRenderingOffsets(MP4SampleId sampleId, 
+	MP4Duration renderingOffset)
+{
+	// if ctts atom doesn't exist
+	if (m_pCttsCountProperty == NULL) {
+
+		// no rendering offset, so nothing to do
+		if (renderingOffset == 0) {
+			return;
+		}
+
+		// else create a ctts atom
+		MP4Atom* pCttsAtom = AddAtom("trak.mdia.minf.stbl", "ctts");
+
+		// and get handles on the properties
+		pCttsAtom->FindProperty(
+			"ctts.entryCount",
+			(MP4Property**)&m_pCttsCountProperty);
+
+		pCttsAtom->FindProperty(
+			"ctts.entries.sampleCount",
+			(MP4Property**)&m_pCttsSampleCountProperty);
+
+		pCttsAtom->FindProperty(
+			"ctts.entries.sampleOffset",
+			(MP4Property**)&m_pCttsSampleOffsetProperty);
+
+		// if this is not the first sample
+		if (sampleId > 1) {
+			// add a ctts entry for all previous samples
+			// with rendering offset equal to zero
+			m_pCttsSampleCountProperty->AddValue(sampleId - 1);
+			m_pCttsSampleOffsetProperty->AddValue(0);
+			m_pCttsCountProperty->IncrementValue();;
+		}
+	}
+
+	// ctts atom exists (now)
+
+	u_int32_t numCtts = m_pCttsCountProperty->GetValue();
+
+	// if renderingOffset == renderingOffset of last entry
+	if (numCtts && renderingOffset
+	   == m_pCttsSampleOffsetProperty->GetValue(numCtts-1)) {
+
+		// increment last entry sampleCount
+		m_pCttsSampleCountProperty->IncrementValue(1, numCtts-1);
+
+	} else {
+		// add ctts entry, sampleCount = 1, sampleOffset = renderingOffset
+		m_pCttsSampleCountProperty->AddValue(1);
+		m_pCttsSampleOffsetProperty->AddValue(renderingOffset);
+		m_pCttsCountProperty->IncrementValue();
+	}
+}
+
+void MP4Track::SetSampleRenderingOffset(MP4SampleId sampleId,
+	 MP4Duration renderingOffset)
+{
+	// check if any ctts entries exist
+	if (m_pCttsCountProperty == NULL
+	  || m_pCttsCountProperty->GetValue() == 0) {
+		// if not then Update routine can be used 
+		// to create a ctts entry for samples before this one
+		// and a ctts entry for this sample 
+		UpdateRenderingOffsets(sampleId, renderingOffset);
+
+		// but we also need a ctts entry 
+		// for all samples after this one
+		u_int32_t afterSamples = GetNumberOfSamples() - sampleId;
+
+		if (afterSamples) {
+			m_pCttsSampleCountProperty->AddValue(afterSamples);
+			m_pCttsSampleOffsetProperty->AddValue(0);
+			m_pCttsCountProperty->IncrementValue();;
+		}
+
+		return;
+	}
+
+	MP4SampleId firstSampleId;
+	u_int32_t cttsIndex = GetSampleCttsIndex(sampleId, &firstSampleId);
+
+	// do nothing in the degenerate case
+	if (renderingOffset == 
+	  m_pCttsSampleOffsetProperty->GetValue(cttsIndex)) {
+		return;
+	}
+
+	u_int32_t sampleCount =
+		m_pCttsSampleCountProperty->GetValue(cttsIndex);
+
+	// if this sample has it's own ctts entry
+	if (sampleCount == 1) {
+		// then just set the value, 
+		// note we don't attempt to collapse entries
+		m_pCttsSampleOffsetProperty->SetValue(renderingOffset, cttsIndex);
+		return;
+	}
+
+	MP4SampleId lastSampleId = firstSampleId + sampleCount - 1;
+
+	// else we share this entry with other samples
+	// we need to insert our own entry
+	if (sampleId == firstSampleId) {
+		// our sample is the first one
+		m_pCttsSampleCountProperty->
+			InsertValue(1, cttsIndex);
+		m_pCttsSampleOffsetProperty->
+			InsertValue(renderingOffset, cttsIndex);
+
+		m_pCttsSampleCountProperty->
+			SetValue(sampleCount - 1, cttsIndex + 1);
+
+		m_pCttsCountProperty->IncrementValue();
+
+	} else if (sampleId == lastSampleId) {
+		// our sample is the last one
+		m_pCttsSampleCountProperty->
+			InsertValue(1, cttsIndex + 1);
+		m_pCttsSampleOffsetProperty->
+			InsertValue(renderingOffset, cttsIndex + 1);
+
+		m_pCttsSampleCountProperty->
+			SetValue(sampleCount - 1, cttsIndex);
+
+		m_pCttsCountProperty->IncrementValue();
+
+	} else {
+		// our sample is in the middle, UGH!
+
+		// insert our new entry
+		m_pCttsSampleCountProperty->
+			InsertValue(1, cttsIndex + 1);
+		m_pCttsSampleOffsetProperty->
+			InsertValue(renderingOffset, cttsIndex + 1);
+
+		// adjust count of previous entry
+		m_pCttsSampleCountProperty->
+			SetValue(sampleId - firstSampleId, cttsIndex);
+
+		// insert new entry for those samples beyond our sample
+		m_pCttsSampleCountProperty->
+			InsertValue(lastSampleId - sampleId, cttsIndex + 2);
+		u_int32_t oldRenderingOffset =
+			m_pCttsSampleOffsetProperty->GetValue(cttsIndex);
+		m_pCttsSampleOffsetProperty->
+			InsertValue(oldRenderingOffset, cttsIndex + 2);
+
+		m_pCttsCountProperty->IncrementValue(2);
+	}
+}
+
+bool MP4Track::IsSyncSample(MP4SampleId sampleId)
+{
+	if (m_pStssCountProperty == NULL) {
+		return true;
+	}
+
+	u_int32_t numStss = m_pStssCountProperty->GetValue();
+	
+	for (u_int32_t stssIndex = 0; stssIndex < numStss; stssIndex++) {
+		MP4SampleId syncSampleId = 
+			m_pStssSampleProperty->GetValue(stssIndex);
+
+		if (sampleId == syncSampleId) {
+			return true;
+		} 
+		if (sampleId < syncSampleId) {
+			break;
+		}
+	}
+
+	return false;
+}
+
+// N.B. "next" is inclusive of this sample id
+MP4SampleId MP4Track::GetNextSyncSample(MP4SampleId sampleId)
+{
+	if (m_pStssCountProperty == NULL) {
+		return sampleId;
+	}
+
+	u_int32_t numStss = m_pStssCountProperty->GetValue();
+	
+	for (u_int32_t stssIndex = 0; stssIndex < numStss; stssIndex++) {
+		MP4SampleId syncSampleId = 
+			m_pStssSampleProperty->GetValue(stssIndex);
+
+		if (sampleId > syncSampleId) {
+			continue;
+		}
+		return syncSampleId;
+	}
+
+	// LATER check stsh for alternate sample
+
+	return MP4_INVALID_SAMPLE_ID;
+}
+
+void MP4Track::UpdateSyncSamples(MP4SampleId sampleId, bool isSyncSample)
+{
+	if (isSyncSample) {
+		// if stss atom exists, add entry
+		if (m_pStssCountProperty) {
+			m_pStssSampleProperty->AddValue(sampleId);
+			m_pStssCountProperty->IncrementValue();
+		} // else nothing to do (yet)
+
+	} else { // !isSyncSample
+		// if stss atom doesn't exist, create one
+		if (m_pStssCountProperty == NULL) {
+
+			MP4Atom* pStssAtom = AddAtom("trak.mdia.minf.stbl", "stss");
+
+			pStssAtom->FindProperty(
+				"stss.entryCount",
+				(MP4Property**)&m_pStssCountProperty);
+
+			pStssAtom->FindProperty(
+				"stss.entries.sampleNumber",
+				(MP4Property**)&m_pStssSampleProperty);
+
+			// set values for all samples that came before this one
+			for (MP4SampleId sid = 1; sid < sampleId; sid++) {
+				m_pStssSampleProperty->AddValue(sid);
+				m_pStssCountProperty->IncrementValue();
+			}
+		} // else nothing to do
+	}
+}
+
+MP4Atom* MP4Track::AddAtom(char* parentName, char* childName)
+{
+	MP4Atom* pChildAtom = MP4Atom::CreateAtom(childName);
+
+	MP4Atom* pParentAtom = m_pTrakAtom->FindAtom(parentName);
+	ASSERT(pParentAtom);
+
+	pParentAtom->AddChildAtom(pChildAtom);
+
+	pChildAtom->Generate();
+
+	return pChildAtom;
+}
+
+u_int64_t MP4Track::GetDuration()
+{
+	return m_pMediaDurationProperty->GetValue();
+}
+
+u_int32_t MP4Track::GetTimeScale()
+{
+	return m_pTimeScaleProperty->GetValue();
+}
+
+void MP4Track::UpdateDurations(MP4Duration duration)
+{
+	// update media, track, and movie durations
+	m_pMediaDurationProperty->SetValue(
+		m_pMediaDurationProperty->GetValue() + duration);
+
+	MP4Duration movieDuration = ToMovieDuration(duration);
+	m_pTrackDurationProperty->SetValue(
+		m_pTrackDurationProperty->GetValue() + movieDuration);
+
+	m_pFile->UpdateDuration(m_pTrackDurationProperty->GetValue());
+}
+
+MP4Duration MP4Track::ToMovieDuration(MP4Duration trackDuration)
+{
+	return (trackDuration * m_pFile->GetTimeScale()) 
+		/ m_pTimeScaleProperty->GetValue();
+}
+
+void MP4Track::UpdateModificationTimes()
+{
+	// update media and track modification times
+	MP4Timestamp now = MP4GetAbsTimestamp();
+	m_pMediaModificationProperty->SetValue(now);
+	m_pTrackModificationProperty->SetValue(now);
+}
+
+u_int32_t MP4Track::GetNumberOfChunks()
+{
+	return m_pChunkOffsetProperty->GetCount();
+}
+
+u_int32_t MP4Track::GetChunkStscIndex(MP4ChunkId chunkId)
+{
+	u_int32_t stscIndex;
+	u_int32_t numStscs = m_pStscCountProperty->GetValue();
+
+	ASSERT(chunkId);
+	ASSERT(numStscs > 0);
+
+	for (stscIndex = 0; stscIndex < numStscs; stscIndex++) {
+		if (chunkId < m_pStscFirstChunkProperty->GetValue(stscIndex)) {
+			ASSERT(stscIndex != 0);
+			break;
+		}
+	}
+	return stscIndex - 1;
+}
+
+MP4Timestamp MP4Track::GetChunkTime(MP4ChunkId chunkId)
+{
+	u_int32_t stscIndex = GetChunkStscIndex(chunkId);
+
+	MP4ChunkId firstChunkId = 
+		m_pStscFirstChunkProperty->GetValue(stscIndex);
+
+	MP4SampleId firstSample = 
+		m_pStscFirstSampleProperty->GetValue(stscIndex);
+
+	u_int32_t samplesPerChunk = 
+		m_pStscSamplesPerChunkProperty->GetValue(stscIndex);
+
+	MP4SampleId firstSampleInChunk = 
+		firstSample + ((chunkId - firstChunkId) * samplesPerChunk);
+
+	MP4Timestamp chunkTime;
+
+	GetSampleTimes(firstSampleInChunk, &chunkTime, NULL);
+
+	return chunkTime;
+}
+
+u_int32_t MP4Track::GetChunkSize(MP4ChunkId chunkId)
+{
+	u_int32_t stscIndex = GetChunkStscIndex(chunkId);
+
+	MP4ChunkId firstChunkId = 
+		m_pStscFirstChunkProperty->GetValue(stscIndex);
+
+	MP4SampleId firstSample = 
+		m_pStscFirstSampleProperty->GetValue(stscIndex);
+
+	u_int32_t samplesPerChunk = 
+		m_pStscSamplesPerChunkProperty->GetValue(stscIndex);
+
+	MP4SampleId firstSampleInChunk = 
+		firstSample + ((chunkId - firstChunkId) * samplesPerChunk);
+
+	// need cumulative sizes of samples in chunk 
+	u_int32_t chunkSize = 0;
+	for (u_int32_t i = 0; i < samplesPerChunk; i++) {
+		chunkSize += GetSampleSize(firstSampleInChunk + i);
+	}
+
+	return chunkSize;
+}
+
+void MP4Track::ReadChunk(MP4ChunkId chunkId, 
+	u_int8_t** ppChunk, u_int32_t* pChunkSize)
+{
+	ASSERT(chunkId);
+	ASSERT(ppChunk);
+	ASSERT(pChunkSize);
+
+	u_int64_t chunkOffset = 
+		m_pChunkOffsetProperty->GetValue(chunkId - 1);
+
+	*pChunkSize = GetChunkSize(chunkId);
+	*ppChunk = (u_int8_t*)MP4Malloc(*pChunkSize);
+
+	VERBOSE_READ_SAMPLE(m_pFile->GetVerbosity(),
+		printf("ReadChunk: track %u id %u offset 0x"LLX" size %u (0x%x)\n",
+			m_trackId, chunkId, chunkOffset, *pChunkSize, *pChunkSize));
+
+	u_int64_t oldPos = m_pFile->GetPosition(); // only used in mode == 'w'
+	try {
+		m_pFile->SetPosition(chunkOffset);
+		m_pFile->ReadBytes(*ppChunk, *pChunkSize);
+	}
+	catch (MP4Error* e) {
+		// let's not leak memory
+		MP4Free(*ppChunk);
+		*ppChunk = NULL;
+
+		if (m_pFile->GetMode() == 'w') {
+			m_pFile->SetPosition(oldPos);
+		}
+		throw e;
+	}
+
+	if (m_pFile->GetMode() == 'w') {
+		m_pFile->SetPosition(oldPos);
+	}
+}
+
+void MP4Track::RewriteChunk(MP4ChunkId chunkId, 
+	u_int8_t* pChunk, u_int32_t chunkSize)
+{
+	u_int64_t chunkOffset = m_pFile->GetPosition();
+
+	m_pFile->WriteBytes(pChunk, chunkSize);
+
+	m_pChunkOffsetProperty->SetValue(chunkOffset, chunkId - 1);
+
+	VERBOSE_WRITE_SAMPLE(m_pFile->GetVerbosity(),
+		printf("RewriteChunk: track %u id %u offset 0x"LLX" size %u (0x%x)\n",
+			m_trackId, chunkId, chunkOffset, chunkSize, chunkSize)); 
+}
+
+// map track type name aliases to official names
+
+const char* MP4Track::NormalizeTrackType(const char* type)
+{
+	if (!strcasecmp(type, "vide")
+	  || !strcasecmp(type, "video")
+	  || !strcasecmp(type, "mp4v")) {
+		return MP4_VIDEO_TRACK_TYPE;
+	}
+
+	if (!strcasecmp(type, "soun")
+	  || !strcasecmp(type, "sound")
+	  || !strcasecmp(type, "audio")
+	  || !strcasecmp(type, "mp4a")) {
+		return MP4_AUDIO_TRACK_TYPE;
+	}
+
+	if (!strcasecmp(type, "sdsm")
+	  || !strcasecmp(type, "scene")
+	  || !strcasecmp(type, "bifs")) {
+		return MP4_SCENE_TRACK_TYPE;
+	}
+
+	if (!strcasecmp(type, "odsm")
+	  || !strcasecmp(type, "od")) {
+		return MP4_OD_TRACK_TYPE;
+	}
+
+	return type;
+}
+
+bool MP4Track::InitEditListProperties()
+{
+	m_pElstCountProperty = NULL;
+	m_pElstMediaTimeProperty = NULL;
+	m_pElstDurationProperty = NULL;
+	m_pElstRateProperty = NULL;
+	m_pElstReservedProperty = NULL;
+
+	MP4Atom* pElstAtom =
+		m_pTrakAtom->FindAtom("trak.edts.elst");
+
+	if (!pElstAtom) {
+		return false;
+	}
+
+	pElstAtom->FindProperty(
+		"elst.entryCount",
+		(MP4Property**)&m_pElstCountProperty);
+
+	pElstAtom->FindProperty(
+		"elst.entries.mediaTime",
+		(MP4Property**)&m_pElstMediaTimeProperty);
+
+	pElstAtom->FindProperty(
+		"elst.entries.segmentDuration",
+		(MP4Property**)&m_pElstDurationProperty);
+
+	pElstAtom->FindProperty(
+		"elst.entries.mediaRate",
+		(MP4Property**)&m_pElstRateProperty);
+
+	pElstAtom->FindProperty(
+		"elst.entries.reserved",
+		(MP4Property**)&m_pElstReservedProperty);
+
+	return m_pElstCountProperty
+		&& m_pElstMediaTimeProperty
+		&& m_pElstDurationProperty
+		&& m_pElstRateProperty
+		&& m_pElstReservedProperty;
+}
+
+MP4EditId MP4Track::AddEdit(MP4EditId editId)
+{
+	if (!m_pElstCountProperty) {
+		m_pFile->AddDescendantAtoms(m_pTrakAtom, "edts.elst");
+		InitEditListProperties();
+	}
+
+	if (editId == MP4_INVALID_EDIT_ID) {
+		editId = m_pElstCountProperty->GetValue() + 1;
+	}
+
+	m_pElstMediaTimeProperty->InsertValue(0, editId - 1);
+	m_pElstDurationProperty->InsertValue(0, editId - 1);
+	m_pElstRateProperty->InsertValue(1, editId - 1);
+	m_pElstReservedProperty->InsertValue(0, editId - 1);
+
+	m_pElstCountProperty->IncrementValue();
+
+	return editId;
+}
+
+void MP4Track::DeleteEdit(MP4EditId editId)
+{
+	if (editId == MP4_INVALID_EDIT_ID) {
+		throw new MP4Error("edit id can't be zero", 
+			"MP4Track::DeleteEdit");
+	}
+
+	if (!m_pElstCountProperty
+	  || m_pElstCountProperty->GetValue() == 0) {
+		throw new MP4Error("no edits exist", 
+			"MP4Track::DeleteEdit");
+	}
+
+	m_pElstMediaTimeProperty->DeleteValue(editId - 1);
+	m_pElstDurationProperty->DeleteValue(editId - 1);
+	m_pElstRateProperty->DeleteValue(editId - 1);
+	m_pElstReservedProperty->DeleteValue(editId - 1);
+
+	m_pElstCountProperty->IncrementValue(-1);
+
+	// clean up if last edit is deleted
+	if (m_pElstCountProperty->GetValue() == 0) {
+		m_pElstCountProperty = NULL;
+		m_pElstMediaTimeProperty = NULL;
+		m_pElstDurationProperty = NULL;
+		m_pElstRateProperty = NULL;
+		m_pElstReservedProperty = NULL;
+
+		m_pTrakAtom->DeleteChildAtom(
+			m_pTrakAtom->FindAtom("trak.edts"));
+	}
+}
+
+MP4Timestamp MP4Track::GetEditStart(
+	MP4EditId editId) 
+{
+	if (editId == MP4_INVALID_EDIT_ID) {
+		return MP4_INVALID_TIMESTAMP;
+	} else if (editId == 1) {
+		return 0;
+	}
+	return (MP4Timestamp)GetEditTotalDuration(editId - 1);
+}	
+
+MP4Duration MP4Track::GetEditTotalDuration(
+	MP4EditId editId)
+{
+	u_int32_t numEdits = 0;
+
+	if (m_pElstCountProperty) {
+		numEdits = m_pElstCountProperty->GetValue();
+	}
+
+	if (editId == MP4_INVALID_EDIT_ID) {
+		editId = numEdits;
+	}
+
+	if (numEdits == 0 || editId > numEdits) {
+		return MP4_INVALID_DURATION;
+	}
+
+	MP4Duration totalDuration = 0;
+
+	for (MP4EditId eid = 1; eid <= editId; eid++) {
+		totalDuration += 
+			m_pElstDurationProperty->GetValue(eid - 1);
+	}
+
+	return totalDuration;
+}
+
+MP4SampleId MP4Track::GetSampleIdFromEditTime(
+	MP4Timestamp editWhen, 
+	MP4Timestamp* pStartTime, 
+	MP4Duration* pDuration)
+{
+	MP4SampleId sampleId = MP4_INVALID_SAMPLE_ID;
+	u_int32_t numEdits = 0;
+
+	if (m_pElstCountProperty) {
+		numEdits = m_pElstCountProperty->GetValue();
+	}
+
+	if (numEdits) {
+		MP4Duration editElapsedDuration = 0;
+
+		for (MP4EditId editId = 1; editId <= numEdits; editId++) {
+			// remember edit segment's start time (in edit timeline)
+			MP4Timestamp editStartTime = 
+				(MP4Timestamp)editElapsedDuration;
+
+			// accumulate edit segment's duration
+			editElapsedDuration += 
+				m_pElstDurationProperty->GetValue(editId - 1);
+
+			// calculate difference between the specified edit time
+			// and the end of this edit segment
+			if (editElapsedDuration - editWhen <= 0) {
+				// the specified time has not yet been reached
+				continue;
+			}
+
+			// 'editWhen' is within this edit segment
+
+			// calculate the specified edit time
+			// relative to just this edit segment
+			MP4Duration editOffset =
+				editWhen - editStartTime;
+
+			// calculate the media (track) time that corresponds
+			// to the specified edit time based on the edit list
+			MP4Timestamp mediaWhen = 
+				m_pElstMediaTimeProperty->GetValue(editId - 1)
+				+ editOffset;
+
+			// lookup the sample id for the media time
+			sampleId = GetSampleIdFromTime(mediaWhen, false);
+
+			// lookup the sample's media start time and duration
+			MP4Timestamp sampleStartTime;
+			MP4Duration sampleDuration;
+
+			GetSampleTimes(sampleId, &sampleStartTime, &sampleDuration);
+
+			// calculate the difference if any between when the sample
+			// would naturally start and when it starts in the edit timeline 
+			MP4Duration sampleStartOffset =
+				mediaWhen - sampleStartTime;
+
+			// calculate the start time for the sample in the edit time line
+			MP4Timestamp editSampleStartTime =
+				editWhen - MIN(editOffset, sampleStartOffset);
+
+			MP4Duration editSampleDuration = 0;
+
+			// calculate how long this sample lasts in the edit list timeline
+			if (m_pElstRateProperty->GetValue(editId - 1) == 0) {
+				// edit segment is a "dwell"
+				// so sample duration is that of the edit segment
+				editSampleDuration =
+					m_pElstDurationProperty->GetValue(editId - 1);
+
+			} else {
+				// begin with the natural sample duration
+				editSampleDuration = sampleDuration;
+
+				// now shorten that if the edit segment starts
+				// after the sample would naturally start 
+				if (editOffset < sampleStartOffset) {
+					editSampleDuration -= sampleStartOffset - editOffset;
+				}
+
+				// now shorten that if the edit segment ends
+				// before the sample would naturally end
+				if (editElapsedDuration 
+				  < editSampleStartTime + sampleDuration) {
+					editSampleDuration -= (editSampleStartTime + sampleDuration) 
+						- editElapsedDuration;
+				}
+			}
+
+			if (pStartTime) {
+				*pStartTime = editSampleStartTime;
+			}
+
+			if (pDuration) {
+				*pDuration = editSampleDuration;
+			}
+
+			VERBOSE_EDIT(m_pFile->GetVerbosity(),
+				printf("GetSampleIdFromEditTime: when %llu "
+					"sampleId %u start %llu duration %lld\n", 
+					editWhen, sampleId, 
+					editSampleStartTime, editSampleDuration));
+
+			return sampleId;
+		}
+
+		throw new MP4Error("time out of range", 
+			"MP4Track::GetSampleIdFromEditTime");
+
+	} else { // no edit list
+		sampleId = GetSampleIdFromTime(editWhen, false);
+
+		if (pStartTime || pDuration) {
+			GetSampleTimes(sampleId, pStartTime, pDuration);
+		}
+	}
+
+	return sampleId;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/mp4track.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,240 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#ifndef __MP4_TRACK_INCLUDED__
+#define __MP4_TRACK_INCLUDED__
+
+typedef u_int32_t MP4ChunkId;
+
+// forward declarations
+class MP4File;
+class MP4Atom;
+class MP4Property;
+class MP4IntegerProperty;
+class MP4Integer16Property;
+class MP4Integer32Property;
+class MP4Integer64Property;
+class MP4StringProperty;
+
+class MP4Track {
+public:
+	MP4Track(MP4File* pFile, MP4Atom* pTrakAtom);
+
+	virtual ~MP4Track();
+
+	MP4TrackId GetId() {
+		return m_trackId;
+	}
+
+	const char* GetType();
+
+	void SetType(const char* type);
+
+	MP4File* GetFile() {
+		return m_pFile;
+	}
+
+	MP4Atom* GetTrakAtom() {
+		return m_pTrakAtom;
+	}
+
+	void ReadSample(
+		// input parameters
+		MP4SampleId sampleId,
+		// output parameters
+		u_int8_t** ppBytes, 
+		u_int32_t* pNumBytes, 
+		MP4Timestamp* pStartTime = NULL, 
+		MP4Duration* pDuration = NULL,
+		MP4Duration* pRenderingOffset = NULL, 
+		bool* pIsSyncSample = NULL);
+
+	void WriteSample(
+		u_int8_t* pBytes, 
+		u_int32_t numBytes,
+		MP4Duration duration = 0,
+		MP4Duration renderingOffset = 0, 
+		bool isSyncSample = true);
+
+	virtual void FinishWrite();
+
+	u_int64_t 	GetDuration();		// in track timeScale units
+	u_int32_t	GetTimeScale();
+	u_int32_t	GetNumberOfSamples();
+	u_int32_t	GetSampleSize(MP4SampleId sampleId);
+	u_int32_t	GetMaxSampleSize();
+	u_int64_t 	GetTotalOfSampleSizes();
+	u_int32_t	GetAvgBitrate();	// in bps
+	u_int32_t	GetMaxBitrate();	// in bps
+
+	MP4Duration GetFixedSampleDuration();
+	bool		SetFixedSampleDuration(MP4Duration duration);
+
+	void		GetSampleTimes(MP4SampleId sampleId,
+					MP4Timestamp* pStartTime, MP4Duration* pDuration);
+
+	bool		IsSyncSample(MP4SampleId sampleId);
+
+	MP4SampleId GetSampleIdFromTime(
+		MP4Timestamp when, 
+		bool wantSyncSample = false);
+
+	MP4Duration	GetSampleRenderingOffset(MP4SampleId sampleId);
+	void		SetSampleRenderingOffset(MP4SampleId sampleId,
+					MP4Duration renderingOffset);
+
+	MP4EditId	AddEdit(
+		MP4EditId editId = MP4_INVALID_EDIT_ID);
+
+	void		DeleteEdit(
+		MP4EditId editId);
+
+	MP4Timestamp GetEditStart(
+		MP4EditId editId);
+
+	MP4Timestamp GetEditTotalDuration(
+		MP4EditId editId);
+
+	MP4SampleId GetSampleIdFromEditTime(
+		MP4Timestamp editWhen, 
+		MP4Timestamp* pStartTime = NULL, 
+		MP4Duration* pDuration = NULL);
+
+	static const char* NormalizeTrackType(const char* type);
+
+	// special operation for use during hint track packet assembly
+	void ReadSampleFragment(
+		MP4SampleId sampleId,
+		u_int32_t sampleOffset,
+		u_int16_t sampleLength,
+		u_int8_t* pDest);
+
+	// special operations for use during optimization
+
+	u_int32_t GetNumberOfChunks();
+
+	MP4Timestamp GetChunkTime(MP4ChunkId chunkId);
+
+	void ReadChunk(MP4ChunkId chunkId, 
+		u_int8_t** ppChunk, u_int32_t* pChunkSize);
+
+	void RewriteChunk(MP4ChunkId chunkId, 
+		u_int8_t* pChunk, u_int32_t chunkSize);
+
+protected:
+	bool		InitEditListProperties();
+
+	FILE*		GetSampleFile(MP4SampleId sampleId);
+	u_int64_t	GetSampleFileOffset(MP4SampleId sampleId);
+	u_int32_t	GetSampleStscIndex(MP4SampleId sampleId);
+	u_int32_t	GetChunkStscIndex(MP4ChunkId chunkId);
+	u_int32_t	GetChunkSize(MP4ChunkId chunkId);
+	u_int32_t	GetSampleCttsIndex(MP4SampleId sampleId, 
+					MP4SampleId* pFirstSampleId = NULL);
+	MP4SampleId	GetNextSyncSample(MP4SampleId sampleId);
+
+	void UpdateSampleSizes(MP4SampleId sampleId, 
+		u_int32_t numBytes);
+	bool IsChunkFull(MP4SampleId sampleId);
+	void UpdateSampleToChunk(MP4SampleId sampleId,
+		 MP4ChunkId chunkId, u_int32_t samplesPerChunk);
+	void UpdateChunkOffsets(u_int64_t chunkOffset);
+	void UpdateSampleTimes(MP4Duration duration);
+	void UpdateRenderingOffsets(MP4SampleId sampleId, 
+		MP4Duration renderingOffset);
+	void UpdateSyncSamples(MP4SampleId sampleId, 
+		bool isSyncSample);
+
+	MP4Atom* AddAtom(char* parentName, char* childName);
+
+	void UpdateDurations(MP4Duration duration);
+	MP4Duration ToMovieDuration(MP4Duration trackDuration);
+
+	void UpdateModificationTimes();
+
+	void WriteChunkBuffer();
+
+protected:
+	MP4File*	m_pFile;
+	MP4Atom* 	m_pTrakAtom;		// moov.trak[]
+	MP4TrackId	m_trackId;			// moov.trak[].tkhd.trackId
+	MP4StringProperty* m_pTypeProperty;	// moov.trak[].mdia.hdlr.handlerType
+
+	u_int32_t	m_lastStsdIndex;
+	FILE*	 	m_lastSampleFile;
+
+	// for efficient construction of hint track packets
+	MP4SampleId	m_cachedReadSampleId;
+	u_int8_t* 	m_pCachedReadSample;
+	u_int32_t	m_cachedReadSampleSize;
+
+	// for writing
+	MP4SampleId m_writeSampleId;
+	MP4Duration m_fixedSampleDuration;
+	u_int8_t* 	m_pChunkBuffer;
+	u_int32_t	m_chunkBufferSize;
+	u_int32_t	m_chunkSamples;
+	MP4Duration m_chunkDuration;
+
+	// controls for chunking
+	u_int32_t 	m_samplesPerChunk;
+	MP4Duration m_durationPerChunk;
+
+	MP4Integer32Property* m_pTimeScaleProperty;
+	MP4IntegerProperty* m_pTrackDurationProperty;		// 32 or 64 bits
+	MP4IntegerProperty* m_pMediaDurationProperty;		// 32 or 64 bits
+	MP4IntegerProperty* m_pTrackModificationProperty;	// 32 or 64 bits
+	MP4IntegerProperty* m_pMediaModificationProperty;	// 32 or 64 bits
+
+	MP4Integer32Property* m_pStszFixedSampleSizeProperty;
+	MP4Integer32Property* m_pStszSampleCountProperty;
+	MP4Integer32Property* m_pStszSampleSizeProperty;
+
+	MP4Integer32Property* m_pStscCountProperty;
+	MP4Integer32Property* m_pStscFirstChunkProperty;
+	MP4Integer32Property* m_pStscSamplesPerChunkProperty;
+	MP4Integer32Property* m_pStscSampleDescrIndexProperty;
+	MP4Integer32Property* m_pStscFirstSampleProperty;
+
+	MP4Integer32Property* m_pChunkCountProperty;
+	MP4IntegerProperty*   m_pChunkOffsetProperty;		// 32 or 64 bits
+
+	MP4Integer32Property* m_pSttsCountProperty;
+	MP4Integer32Property* m_pSttsSampleCountProperty;
+	MP4Integer32Property* m_pSttsSampleDeltaProperty;
+
+	MP4Integer32Property* m_pCttsCountProperty;
+	MP4Integer32Property* m_pCttsSampleCountProperty;
+	MP4Integer32Property* m_pCttsSampleOffsetProperty;
+
+	MP4Integer32Property* m_pStssCountProperty;
+	MP4Integer32Property* m_pStssSampleProperty;
+
+	MP4Integer32Property* m_pElstCountProperty;
+	MP4IntegerProperty*   m_pElstMediaTimeProperty;		// 32 or 64 bits
+	MP4IntegerProperty*   m_pElstDurationProperty;		// 32 or 64 bits
+	MP4Integer16Property* m_pElstRateProperty;
+	MP4Integer16Property* m_pElstReservedProperty;
+};
+
+MP4ARRAY_DECL(MP4Track, MP4Track*);
+
+#endif /* __MP4_TRACK_INCLUDED__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/mp4util.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,242 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+void MP4Error::Print(FILE* pFile)
+{
+	fprintf(pFile, "MP4ERROR: ");
+	if (m_where) {
+		fprintf(pFile, "%s", m_where);
+	}
+	if (m_errstring) {
+		if (m_where) {
+			fprintf(pFile, ": ");
+		}
+		fprintf(pFile, "%s", m_errstring);
+	}
+	if (m_errno) {
+		if (m_where || m_errstring) {
+			fprintf(pFile, ": ");
+		}
+		fprintf(pFile, "%s", strerror(m_errno));
+	}
+	fprintf(pFile, "\n");
+}
+
+void MP4HexDump(
+	u_int8_t* pBytes, u_int32_t numBytes,
+	FILE* pFile, u_int8_t indent)
+{
+	if (pFile == NULL) {
+		pFile = stdout;
+	}
+	Indent(pFile, indent);
+	fprintf(pFile, "<%u bytes> ", numBytes);
+	for (u_int32_t i = 0; i < numBytes; i++) {
+		if ((i % 16) == 0 && numBytes > 16) {
+			fprintf(pFile, "\n");
+			Indent(pFile, indent);
+		}
+		fprintf(pFile, "%02x ", pBytes[i]);
+	}
+	fprintf(pFile, "\n");
+}
+
+bool MP4NameFirstMatches(const char* s1, const char* s2) 
+{
+	if (s1 == NULL || *s1 == '\0' || s2 == NULL || *s2 == '\0') {
+		return false;
+	}
+
+	if (*s2 == '*') {
+		return true;
+	}
+
+	while (*s1 != '\0') {
+		if (*s2 == '\0' || strchr("[.", *s2)) {
+			break;
+		}
+		if (tolower(*s1) != tolower(*s2)) {
+			return false;
+		}
+		s1++;
+		s2++;
+	}
+	return true;
+}
+
+bool MP4NameFirstIndex(const char* s, u_int32_t* pIndex)
+{
+	if (s == NULL) {
+		return false;
+	}
+
+	while (*s != '\0' && *s != '.') {
+		if (*s == '[') {
+			s++;
+			ASSERT(pIndex);
+			if (sscanf(s, "%u", pIndex) != 1) {
+				return false;
+			}
+			return true;
+		}
+		s++;
+	}
+	return false;
+}
+
+char* MP4NameFirst(const char *s)
+{
+	if (s == NULL) {
+		return NULL;
+	}
+
+	const char* end = s;
+
+	while (*end != '\0' && *end != '.') {
+		end++;
+	}
+
+	char* first = (char*)MP4Calloc((end - s) + 1);
+
+	if (first) {
+		strncpy(first, s, end - s);
+	}
+
+	return first;
+}
+
+const char* MP4NameAfterFirst(const char *s)
+{
+	if (s == NULL) {
+		return NULL;
+	}
+
+	while (*s != '\0') {
+		if (*s == '.') {
+			s++;
+			if (*s == '\0') {
+				return NULL;
+			}
+			return s;
+		}
+		s++;
+	}
+	return NULL;
+}
+
+char* MP4ToBase16(const u_int8_t* pData, u_int32_t dataSize)
+{
+	if (dataSize) {
+		ASSERT(pData);
+	}
+
+	char* s = (char*)MP4Calloc((2 * dataSize) + 1);
+
+	u_int32_t i, j;
+	for (i = 0, j = 0; i < dataSize; i++) {
+		sprintf(&s[j], "%02x", pData[i]);
+		j += 2;
+	}
+
+	return s;	/* N.B. caller is responsible for free'ing s */
+}
+
+char* MP4ToBase64(const u_int8_t* pData, u_int32_t dataSize)
+{
+	if (dataSize) {
+		ASSERT(pData);
+	}
+
+	static char encoding[64] = {
+		'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
+		'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f',
+		'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
+		'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/'
+	};
+
+	char* s = (char*)MP4Calloc((((dataSize + 2) * 4) / 3) + 1);
+
+	const u_int8_t* src = pData;
+	char* dest = s;
+	u_int32_t numGroups = dataSize / 3;
+
+	for (u_int32_t i = 0; i < numGroups; i++) {
+		*dest++ = encoding[src[0] >> 2];
+		*dest++ = encoding[((src[0] & 0x03) << 4) | (src[1] >> 4)];
+		*dest++ = encoding[((src[1] & 0x0F) << 2) | (src[2] >> 6)];
+		*dest++ = encoding[src[2] & 0x3F];
+		src += 3;
+	}
+
+	if (dataSize % 3 == 1) {
+		*dest++ = encoding[src[0] >> 2];
+		*dest++ = encoding[((src[0] & 0x03) << 4)];
+		*dest++ = '=';
+		*dest++ = '=';
+	} else if (dataSize % 3 == 2) {
+		*dest++ = encoding[src[0] >> 2];
+		*dest++ = encoding[((src[0] & 0x03) << 4) | (src[1] >> 4)];
+		*dest++ = encoding[((src[1] & 0x0F) << 2)];
+		*dest++ = '=';
+	}
+
+	return s;	/* N.B. caller is responsible for free'ing s */
+}
+
+// log2 of value, rounded up
+static u_int8_t ilog2(u_int64_t value)
+{
+	u_int64_t powerOf2 = 1;
+	for (u_int8_t i = 0; i < 64; i++) {
+		if (value <= powerOf2) {
+			return i;
+		}
+		powerOf2 <<= 1;
+	} 
+	return 64;
+}
+
+u_int64_t MP4ConvertTime(u_int64_t t, 
+	u_int32_t oldTimeScale, u_int32_t newTimeScale)
+{
+	// avoid float point exception
+	if (oldTimeScale == 0) {
+		throw new MP4Error("division by zero", "MP4ConvertTime");
+	}
+
+	// check if we can safely use integer operations
+	if (ilog2(t) + ilog2(newTimeScale) <= 64) {
+		return (t * newTimeScale) / oldTimeScale;
+	}
+
+	// final resort is to use floating point
+	double d = ((double)newTimeScale / (double)oldTimeScale) + 0.5;
+#ifdef _WINDOWS
+	d *= (double)(int64_t)t;
+#else
+	d *= (double)t;
+#endif
+
+	return (u_int64_t)d;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/mp4util.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,231 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#ifndef __MP4_UTIL_INCLUDED__
+#define __MP4_UTIL_INCLUDED__
+#include <assert.h>
+
+#ifndef ASSERT
+#ifdef NDEBUG
+#define ASSERT(expr)
+#else
+#define ASSERT(expr) \
+	if (!(expr)) { \
+		fflush(stdout); \
+		assert((expr)); \
+	}
+#endif
+#endif
+#ifdef NDEBUG
+#define WARNING(expr)
+#else
+#define WARNING(expr) \
+	if (expr) { \
+		fflush(stdout); \
+		fprintf(stderr, "Warning (%s) in %s at line %u\n", \
+			__STRING(expr), __FILE__, __LINE__); \
+	}
+#endif
+
+#define VERBOSE(exprverbosity, verbosity, expr)	\
+	if (((exprverbosity) & (verbosity)) == (exprverbosity)) { expr; }
+
+#define VERBOSE_ERROR(verbosity, expr)		\
+	VERBOSE(MP4_DETAILS_ERROR, verbosity, expr)
+
+#define VERBOSE_WARNING(verbosity, expr)		\
+	VERBOSE(MP4_DETAILS_WARNING, verbosity, expr)
+
+#define VERBOSE_READ(verbosity, expr)		\
+	VERBOSE(MP4_DETAILS_READ, verbosity, expr)
+
+#define VERBOSE_READ_TABLE(verbosity, expr)	\
+	VERBOSE((MP4_DETAILS_READ | MP4_DETAILS_TABLE), verbosity, expr)
+
+#define VERBOSE_READ_SAMPLE(verbosity, expr)	\
+	VERBOSE((MP4_DETAILS_READ | MP4_DETAILS_SAMPLE), verbosity, expr)
+
+#define VERBOSE_READ_HINT(verbosity, expr)	\
+	VERBOSE((MP4_DETAILS_READ | MP4_DETAILS_HINT), verbosity, expr)
+
+#define VERBOSE_WRITE(verbosity, expr)		\
+	VERBOSE(MP4_DETAILS_WRITE, verbosity, expr)
+
+#define VERBOSE_WRITE_TABLE(verbosity, expr)	\
+	VERBOSE((MP4_DETAILS_WRITE | MP4_DETAILS_TABLE), verbosity, expr)
+
+#define VERBOSE_WRITE_SAMPLE(verbosity, expr)	\
+	VERBOSE((MP4_DETAILS_WRITE | MP4_DETAILS_SAMPLE), verbosity, expr)
+
+#define VERBOSE_WRITE_HINT(verbosity, expr)	\
+	VERBOSE((MP4_DETAILS_WRITE | MP4_DETAILS_HINT), verbosity, expr)
+
+#define VERBOSE_FIND(verbosity, expr)		\
+	VERBOSE(MP4_DETAILS_FIND, verbosity, expr)
+
+#define VERBOSE_ISMA(verbosity, expr)		\
+	VERBOSE(MP4_DETAILS_ISMA, verbosity, expr)
+
+#define VERBOSE_EDIT(verbosity, expr)		\
+	VERBOSE(MP4_DETAILS_EDIT, verbosity, expr)
+
+inline void Indent(FILE* pFile, u_int8_t depth) {
+	fprintf(pFile, "%*c", depth, ' ');
+}
+
+inline void MP4Printf(const char* fmt, ...) {
+	va_list ap;
+	va_start(ap, fmt);
+	// TBD API call to set error_msg_func instead of just printf
+	fprintf(stdout, fmt, ap);
+	va_end(ap);
+}
+
+class MP4Error {
+public:
+	MP4Error() {
+		m_errno = 0;
+		m_errstring = NULL;
+		m_where = NULL;
+		m_free = 0;
+	}
+	~MP4Error() {
+	  if (m_free != 0) {
+	    free((void *)m_errstring);
+	  }
+	}
+	MP4Error(int err, const char* where = NULL) {
+		m_errno = err;
+		m_errstring = NULL;
+		m_where = where;
+		m_free = 0;
+	}
+	MP4Error(const char *format, const char *where, ...) {
+	  char *string;
+	  m_errno = 0;
+	  string = (char *)malloc(512);
+	  m_where = where;
+	  if (string) {
+	    va_list ap;
+	    va_start(ap, where);
+	    vsnprintf(string, 512, format, ap);
+	    va_end(ap);
+	    m_errstring = string;
+	    m_free = 1;
+	  } else {
+	    m_errstring = format;
+	    m_free = 0;
+	  }
+	}
+	MP4Error(int err, const char* format, const char* where, ...) {
+	  char *string;
+	  m_errno = err;
+	  string = (char *)malloc(512);
+	  m_where = where;
+	  if (string) {
+	    va_list ap;
+	    va_start(ap, where);
+	    vsnprintf(string, 512, format, ap);
+	    va_end(ap);
+	    m_errstring = string;
+	    m_free = 1;
+	  } else {
+	    m_errstring = format;
+	    m_free = 0;
+	  }
+	}
+
+	void Print(FILE* pFile = stderr);
+	int m_free;
+	int m_errno;
+	const char* m_errstring;
+	const char* m_where;
+};
+
+void MP4HexDump(
+	u_int8_t* pBytes, u_int32_t numBytes,
+	FILE* pFile = stdout, u_int8_t indent = 0);
+
+inline void* MP4Malloc(size_t size) {
+	void* p = malloc(size);
+	if (p == NULL && size > 0) {
+		throw new MP4Error(errno);
+	}
+	return p;
+}
+
+inline void* MP4Calloc(size_t size) {
+	return memset(MP4Malloc(size), 0, size);
+}
+
+inline char* MP4Stralloc(const char* s1) {
+	char* s2 = (char*)MP4Malloc(strlen(s1) + 1);
+	strcpy(s2, s1);
+	return s2;
+}
+
+inline void* MP4Realloc(void* p, u_int32_t newSize) {
+	// workaround library bug
+	if (p == NULL && newSize == 0) {
+		return NULL;
+	}
+	p = realloc(p, newSize);
+	if (p == NULL && newSize > 0) {
+		throw new MP4Error(errno);
+	}
+	return p;
+}
+
+inline void MP4Free(void* p) {
+	free(p);
+}
+
+inline u_int32_t STRTOINT32(const char* s) {
+	return (s[0] << 24) | (s[1] << 16) | (s[2] << 8) | s[3];
+}
+
+inline void INT32TOSTR(u_int32_t i, char* s) {
+	s[0] = ((i >> 24) & 0xFF); s[1] = ((i >> 16) & 0xFF); 
+	s[2] = ((i >> 8) & 0xFF); s[3] = (i & 0xFF); s[4] = 0;
+}
+
+inline MP4Timestamp MP4GetAbsTimestamp() {
+	struct timeval tv;
+	gettimeofday(&tv, NULL);
+	return tv.tv_sec + 209606400;	// MP4 start date is 1/1/1904
+}
+
+u_int64_t MP4ConvertTime(u_int64_t t, 
+	u_int32_t oldTimeScale, u_int32_t newTimeScale);
+
+bool MP4NameFirstMatches(const char* s1, const char* s2);
+
+bool MP4NameFirstIndex(const char* s, u_int32_t* pIndex);
+
+char* MP4NameFirst(const char *s);
+
+const char* MP4NameAfterFirst(const char *s);
+
+char* MP4ToBase16(const u_int8_t* pData, u_int32_t dataSize);
+
+char* MP4ToBase64(const u_int8_t* pData, u_int32_t dataSize);
+
+#endif /* __MP4_UTIL_INCLUDED__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/ocidescriptors.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,307 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4ContentClassDescriptor::MP4ContentClassDescriptor()
+	: MP4Descriptor()
+{
+	AddProperty( /* 0 */
+		new MP4Integer32Property("classificationEntity"));
+	AddProperty( /* 1 */
+		new MP4Integer16Property("classificationTable"));
+	AddProperty( /* 2 */
+		new MP4BytesProperty("contentClassificationData"));
+}
+
+void MP4ContentClassDescriptor::Read(MP4File* pFile)
+{
+	ReadHeader(pFile);
+
+	/* byte properties need to know how long they are before reading */
+	((MP4BytesProperty*)m_pProperties[2])->SetValueSize(m_size - 6);
+
+	ReadProperties(pFile);
+}
+
+MP4KeywordDescriptor::MP4KeywordDescriptor()
+	: MP4Descriptor()
+{
+	AddProperty( /* 0 */
+		new MP4BytesProperty("languageCode", 3));
+	AddProperty( /* 1 */
+		new MP4BitfieldProperty("isUTF8String", 1));
+	AddProperty( /* 2 */
+		new MP4BitfieldProperty("reserved", 7));
+	MP4Integer8Property* pCount = 
+		new MP4Integer8Property("keywordCount");
+	AddProperty(pCount); /* 3 */
+
+	MP4TableProperty* pTable = new MP4TableProperty("keywords", pCount);
+	AddProperty(pTable); /* 4 */
+
+	pTable->AddProperty( /* 4, 0 */
+		new MP4StringProperty("string", Counted));
+
+	SetReadMutate(2);
+}
+
+void MP4KeywordDescriptor::Mutate()
+{
+	bool utf8Flag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue();
+	MP4Property* pProperty =
+		((MP4TableProperty*)m_pProperties[4])->GetProperty(0);
+	ASSERT(pProperty);
+	((MP4StringProperty*)pProperty)->SetUnicode(!utf8Flag);
+}
+
+MP4RatingDescriptor::MP4RatingDescriptor()
+	: MP4Descriptor()
+{
+	AddProperty( /* 0 */
+		new MP4Integer32Property("ratingEntity"));
+	AddProperty( /* 1 */
+		new MP4Integer16Property("ratingCriteria"));
+	AddProperty( /* 2 */
+		new MP4BytesProperty("ratingInfo"));
+}
+
+void MP4RatingDescriptor::Read(MP4File* pFile)
+{
+	ReadHeader(pFile);
+
+	/* byte properties need to know how long they are before reading */
+	((MP4BytesProperty*)m_pProperties[2])->SetValueSize(m_size - 6);
+
+	ReadProperties(pFile);
+}
+
+MP4LanguageDescriptor::MP4LanguageDescriptor()
+	: MP4Descriptor()
+{
+	AddProperty( /* 0 */
+		new MP4BytesProperty("languageCode", 3));
+}
+
+MP4ShortTextDescriptor::MP4ShortTextDescriptor()
+	: MP4Descriptor()
+{
+	AddProperty( /* 0 */
+		new MP4BytesProperty("languageCode", 3));
+	AddProperty( /* 1 */
+		new MP4BitfieldProperty("isUTF8String", 1));
+	AddProperty( /* 2 */
+		new MP4BitfieldProperty("reserved", 7));
+	AddProperty( /* 3 */
+		new MP4StringProperty("eventName", Counted));
+	AddProperty( /* 4 */
+		new MP4StringProperty("eventText", Counted));
+
+	SetReadMutate(2);
+}
+
+void MP4ShortTextDescriptor::Mutate()
+{
+	bool utf8Flag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue();
+	((MP4StringProperty*)m_pProperties[3])->SetUnicode(!utf8Flag);
+	((MP4StringProperty*)m_pProperties[4])->SetUnicode(!utf8Flag);
+}
+
+MP4ExpandedTextDescriptor::MP4ExpandedTextDescriptor()
+	: MP4Descriptor()
+{
+	AddProperty( /* 0 */
+		new MP4BytesProperty("languageCode", 3));
+	AddProperty( /* 1 */
+		new MP4BitfieldProperty("isUTF8String", 1));
+	AddProperty( /* 2 */
+		new MP4BitfieldProperty("reserved", 7));
+	MP4Integer8Property* pCount = 
+		new MP4Integer8Property("itemCount");
+	AddProperty(pCount); /* 3 */
+
+	MP4TableProperty* pTable = new MP4TableProperty("items", pCount);
+	AddProperty(pTable); /* 4 */
+
+	pTable->AddProperty( /* Table 0 */
+		new MP4StringProperty("itemDescription", Counted));
+	pTable->AddProperty( /* Table 1 */
+		new MP4StringProperty("itemText", Counted));
+
+	AddProperty( /* 5 */
+		new MP4StringProperty("nonItemText"));
+	((MP4StringProperty*)m_pProperties[5])->SetExpandedCountedFormat(true);
+
+	SetReadMutate(2);
+}
+
+void MP4ExpandedTextDescriptor::Mutate()
+{
+	bool utf8Flag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue();
+
+	MP4Property* pProperty =
+		((MP4TableProperty*)m_pProperties[4])->GetProperty(0);
+	ASSERT(pProperty);
+	((MP4StringProperty*)pProperty)->SetUnicode(!utf8Flag);
+
+	pProperty = ((MP4TableProperty*)m_pProperties[4])->GetProperty(1);
+	ASSERT(pProperty);
+	((MP4StringProperty*)pProperty)->SetUnicode(!utf8Flag);
+
+	((MP4StringProperty*)m_pProperties[5])->SetUnicode(!utf8Flag);
+}
+
+class MP4CreatorTableProperty : public MP4TableProperty {
+public:
+	MP4CreatorTableProperty(char* name, MP4Integer8Property* pCountProperty) :
+		MP4TableProperty(name, pCountProperty) {
+	};
+protected:
+	void ReadEntry(MP4File* pFile, u_int32_t index);
+	void WriteEntry(MP4File* pFile, u_int32_t index);
+};
+
+MP4CreatorDescriptor::MP4CreatorDescriptor(u_int8_t tag)
+	: MP4Descriptor(tag)
+{
+	MP4Integer8Property* pCount = 
+		new MP4Integer8Property("creatorCount");
+	AddProperty(pCount); /* 0 */
+
+	MP4TableProperty* pTable = new MP4CreatorTableProperty("creators", pCount);
+	AddProperty(pTable); /* 1 */
+
+	pTable->AddProperty( /* Table 0 */
+		new MP4BytesProperty("languageCode", 3));
+	pTable->AddProperty( /* Table 1 */
+		new MP4BitfieldProperty("isUTF8String", 1));
+	pTable->AddProperty( /* Table 2 */
+		new MP4BitfieldProperty("reserved", 7));
+	pTable->AddProperty( /* Table 3 */
+		new MP4StringProperty("name", Counted));
+}
+
+void MP4CreatorTableProperty::ReadEntry(MP4File* pFile, u_int32_t index)
+{
+	m_pProperties[0]->Read(pFile, index);
+	m_pProperties[1]->Read(pFile, index);
+
+	bool utf8Flag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue(index);
+	((MP4StringProperty*)m_pProperties[3])->SetUnicode(!utf8Flag);
+
+	m_pProperties[2]->Read(pFile, index);
+	m_pProperties[3]->Read(pFile, index);
+}
+
+void MP4CreatorTableProperty::WriteEntry(MP4File* pFile, u_int32_t index)
+{
+	bool utf8Flag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue(index);
+	((MP4StringProperty*)m_pProperties[3])->SetUnicode(!utf8Flag);
+
+	MP4TableProperty::WriteEntry(pFile, index);
+}
+
+MP4CreationDescriptor::MP4CreationDescriptor(u_int8_t tag)
+	: MP4Descriptor(tag)
+{
+	AddProperty( /* 0 */
+		new MP4BitfieldProperty("contentCreationDate", 40));
+}
+
+MP4SmpteCameraDescriptor::MP4SmpteCameraDescriptor()
+	: MP4Descriptor()
+{
+	MP4Integer8Property* pCount = 
+		new MP4Integer8Property("parameterCount"); 
+	AddProperty(pCount);
+
+	MP4TableProperty* pTable = new MP4TableProperty("parameters", pCount);
+	AddProperty(pTable);
+
+	pTable->AddProperty(
+		new MP4Integer8Property("id"));
+	pTable->AddProperty(
+		new MP4Integer32Property("value"));
+}
+
+MP4UnknownOCIDescriptor::MP4UnknownOCIDescriptor()
+	: MP4Descriptor()
+{
+	AddProperty( /* 0 */
+		new MP4BytesProperty("data"));
+}
+
+void MP4UnknownOCIDescriptor::Read(MP4File* pFile)
+{
+	ReadHeader(pFile);
+
+	/* byte properties need to know how long they are before reading */
+	((MP4BytesProperty*)m_pProperties[0])->SetValueSize(m_size);
+
+	ReadProperties(pFile);
+}
+
+MP4Descriptor* CreateOCIDescriptor(u_int8_t tag) 
+{
+	MP4Descriptor* pDescriptor = NULL;
+
+	switch (tag) {
+	case MP4ContentClassDescrTag:
+		pDescriptor = new MP4ContentClassDescriptor();
+		break;
+	case MP4KeywordDescrTag:
+		pDescriptor = new MP4KeywordDescriptor();
+		break;
+	case MP4RatingDescrTag:
+		pDescriptor = new MP4RatingDescriptor();
+		break;
+	case MP4LanguageDescrTag:
+		pDescriptor = new MP4LanguageDescriptor();
+		break;
+	case MP4ShortTextDescrTag:
+		pDescriptor = new MP4ShortTextDescriptor();
+		break;
+	case MP4ExpandedTextDescrTag:
+		pDescriptor = new MP4ExpandedTextDescriptor();
+		break;
+	case MP4ContentCreatorDescrTag:
+	case MP4OCICreatorDescrTag:
+		pDescriptor = new MP4CreatorDescriptor(tag);
+		break;
+	case MP4ContentCreationDescrTag:
+	case MP4OCICreationDescrTag:
+		pDescriptor = new MP4CreationDescriptor(tag);
+		break;
+	case MP4SmpteCameraDescrTag:
+		pDescriptor = new MP4SmpteCameraDescriptor();
+		break;
+	}
+
+	if (pDescriptor == NULL) {
+		if (tag >= MP4OCIDescrTagsStart && tag <= MP4OCIDescrTagsEnd) {
+			pDescriptor = new MP4UnknownOCIDescriptor();
+			pDescriptor->SetTag(tag);
+		}
+	}
+
+	return pDescriptor;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/ocidescriptors.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,101 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#ifndef __OCIDESCRIPTORS_INCLUDED__
+#define __OCIDESCRIPTORS_INCLUDED__
+
+const u_int8_t MP4OCIDescrTagsStart	 		= 0x40; 
+const u_int8_t MP4ContentClassDescrTag 		= 0x40; 
+const u_int8_t MP4KeywordDescrTag 			= 0x41; 
+const u_int8_t MP4RatingDescrTag 			= 0x42; 
+const u_int8_t MP4LanguageDescrTag	 		= 0x43;
+const u_int8_t MP4ShortTextDescrTag	 		= 0x44;
+const u_int8_t MP4ExpandedTextDescrTag 		= 0x45;
+const u_int8_t MP4ContentCreatorDescrTag	= 0x46;
+const u_int8_t MP4ContentCreationDescrTag	= 0x47;
+const u_int8_t MP4OCICreatorDescrTag		= 0x48;
+const u_int8_t MP4OCICreationDescrTag		= 0x49;
+const u_int8_t MP4SmpteCameraDescrTag		= 0x4A;
+const u_int8_t MP4OCIDescrTagsEnd			= 0x5F; 
+
+class MP4ContentClassDescriptor : public MP4Descriptor {
+public:
+	MP4ContentClassDescriptor();
+	void Read(MP4File* pFile);
+};
+
+class MP4KeywordDescriptor : public MP4Descriptor {
+public:
+	MP4KeywordDescriptor();
+protected:
+	void Mutate();
+};
+
+class MP4RatingDescriptor : public MP4Descriptor {
+public:
+	MP4RatingDescriptor();
+	void Read(MP4File* pFile);
+};
+
+class MP4LanguageDescriptor : public MP4Descriptor {
+public:
+	MP4LanguageDescriptor();
+};
+
+class MP4ShortTextDescriptor : public MP4Descriptor {
+public:
+	MP4ShortTextDescriptor();
+protected:
+	void Mutate();
+};
+
+class MP4ExpandedTextDescriptor : public MP4Descriptor {
+public:
+	MP4ExpandedTextDescriptor();
+protected:
+	void Mutate();
+};
+
+class MP4CreatorDescriptor : public MP4Descriptor {
+public:
+	MP4CreatorDescriptor(u_int8_t tag);
+};
+
+class MP4CreationDescriptor : public MP4Descriptor {
+public:
+	MP4CreationDescriptor(u_int8_t tag);
+};
+
+class MP4SmpteCameraDescriptor : public MP4Descriptor {
+public:
+	MP4SmpteCameraDescriptor();
+};
+
+class MP4UnknownOCIDescriptor : public MP4Descriptor {
+public:
+	MP4UnknownOCIDescriptor();
+	void Read(MP4File* pFile);
+};
+
+
+extern MP4Descriptor *CreateOCIDescriptor(u_int8_t tag);
+
+#endif /* __OCIDESCRIPTORS_INCLUDED__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/odcommands.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,104 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4ODUpdateDescriptor::MP4ODUpdateDescriptor()
+	: MP4Descriptor(MP4ODUpdateODCommandTag)
+{
+	// just a container for ObjectDescriptors
+	AddProperty( /* 0 */
+		new MP4DescriptorProperty(NULL,
+			MP4FileODescrTag, 0, Required, Many));
+}
+
+MP4ODRemoveDescriptor::MP4ODRemoveDescriptor()
+	: MP4Descriptor(MP4ODRemoveODCommandTag)
+{
+	MP4Integer32Property* pCount = 
+		new MP4Integer32Property("entryCount"); 
+	pCount->SetImplicit();
+	AddProperty(pCount); /* 0 */
+
+	MP4TableProperty* pTable = 
+		new MP4TableProperty("entries", pCount);
+	AddProperty(pTable); /* 1 */
+
+	pTable->AddProperty( /* 1, 0 */
+		new MP4BitfieldProperty("objectDescriptorId", 10));
+}
+
+void MP4ODRemoveDescriptor::Read(MP4File* pFile)
+{
+	// table entry count computed from descriptor size
+	((MP4Integer32Property*)m_pProperties[0])->SetReadOnly(false);
+	((MP4Integer32Property*)m_pProperties[0])->SetValue((m_size * 8) / 10);
+	((MP4Integer32Property*)m_pProperties[0])->SetReadOnly(true);
+
+	MP4Descriptor::Read(pFile);
+}
+
+MP4ESUpdateDescriptor::MP4ESUpdateDescriptor()
+	: MP4Descriptor(MP4ESUpdateODCommandTag)
+{
+	AddProperty( /* 0 */
+		new MP4BitfieldProperty("objectDescriptorId", 10));
+	AddProperty( /* 1 */
+		new MP4BitfieldProperty("pad", 6));
+	AddProperty( /* 2 */
+		new MP4DescriptorProperty("esIdRefs",
+			MP4ESIDRefDescrTag, 0, Required, Many));
+}
+
+// LATER might be able to combine with ESUpdateDescriptor
+MP4ESRemoveDescriptor::MP4ESRemoveDescriptor()
+	: MP4Descriptor(MP4ESRemoveODCommandTag)
+{
+	AddProperty( /* 0 */
+		new MP4BitfieldProperty("objectDescriptorId", 10));
+	AddProperty( /* 1 */
+		new MP4BitfieldProperty("pad", 6));
+	AddProperty( /* 2 */
+		new MP4DescriptorProperty("esIdRefs",
+			MP4ESIDRefDescrTag, 0, Required, Many));
+}
+
+MP4Descriptor* CreateODCommand(u_int8_t tag) 
+{
+	MP4Descriptor* pDescriptor = NULL;
+
+	switch (tag) {
+	case MP4ODUpdateODCommandTag:
+		pDescriptor = new MP4ODUpdateDescriptor();
+		break;
+	case MP4ODRemoveODCommandTag:
+		pDescriptor = new MP4ODRemoveDescriptor();
+		break;
+	case MP4ESUpdateODCommandTag:
+		pDescriptor = new MP4ESUpdateDescriptor();
+		break;
+	case MP4ESRemoveODCommandTag:
+		pDescriptor = new MP4ESRemoveDescriptor();
+		break;
+	}
+	return pDescriptor;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/odcommands.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,58 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#ifndef __ODCOMMANDS_INCLUDED__
+#define __ODCOMMANDS_INCLUDED__
+
+// OD stream command descriptors
+const u_int8_t MP4ODUpdateODCommandTag			= 0x01; 
+const u_int8_t MP4ODRemoveODCommandTag			= 0x02; 
+const u_int8_t MP4ESUpdateODCommandTag			= 0x03; 
+const u_int8_t MP4ESRemoveODCommandTag			= 0x04; 
+const u_int8_t MP4IPMPUpdateODCommandTag		= 0x05; 
+const u_int8_t MP4IPMPRemoveODCommandTag		= 0x06; 
+const u_int8_t MP4ESRemoveRefODCommandTag		= 0x07; 
+
+class MP4ODUpdateDescriptor : public MP4Descriptor {
+public:
+	MP4ODUpdateDescriptor();
+};
+
+class MP4ODRemoveDescriptor : public MP4Descriptor {
+public:
+	MP4ODRemoveDescriptor();
+	void Read(MP4File* pFile);
+};
+
+class MP4ESUpdateDescriptor : public MP4Descriptor {
+public:
+	MP4ESUpdateDescriptor();
+};
+
+class MP4ESRemoveDescriptor : public MP4Descriptor {
+public:
+	MP4ESRemoveDescriptor();
+};
+
+MP4Descriptor* CreateODCommand(u_int8_t tag);
+
+#endif /* __ODCOMMANDS_INCLUDED__ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/qosqualifiers.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,133 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+MP4QosDescriptor::MP4QosDescriptor()
+	: MP4Descriptor(MP4QosDescrTag)
+{
+	AddProperty( /* 0 */
+		new MP4Integer8Property("predefined"));
+	AddProperty( /* 1 */
+		new MP4QosQualifierProperty("qualifiers",
+			MP4QosTagsStart, MP4QosTagsEnd, Optional, Many));
+}
+
+MP4MaxDelayQosQualifier::MP4MaxDelayQosQualifier()
+	: MP4QosQualifier(MP4MaxDelayQosTag)
+{
+	AddProperty( /* 0 */
+		new MP4Integer32Property("maxDelay"));
+}
+
+MP4PrefMaxDelayQosQualifier::MP4PrefMaxDelayQosQualifier()
+	: MP4QosQualifier(MP4PrefMaxDelayQosTag)
+{
+	AddProperty( /* 0 */
+		new MP4Integer32Property("prefMaxDelay"));
+}
+
+MP4LossProbQosQualifier::MP4LossProbQosQualifier()
+	: MP4QosQualifier(MP4LossProbQosTag)
+{
+	AddProperty( /* 0 */
+		new MP4Float32Property("lossProb"));
+}
+
+MP4MaxGapLossQosQualifier::MP4MaxGapLossQosQualifier()
+	: MP4QosQualifier(MP4MaxGapLossQosTag)
+{
+	AddProperty( /* 0 */
+		new MP4Integer32Property("maxGapLoss"));
+}
+
+MP4MaxAUSizeQosQualifier::MP4MaxAUSizeQosQualifier()
+	: MP4QosQualifier(MP4MaxAUSizeQosTag)
+{
+	AddProperty( /* 0 */
+		new MP4Integer32Property("maxAUSize"));
+}
+
+MP4AvgAUSizeQosQualifier::MP4AvgAUSizeQosQualifier()
+	: MP4QosQualifier(MP4AvgAUSizeQosTag)
+{
+	AddProperty( /* 0 */
+		new MP4Integer32Property("avgAUSize"));
+}
+
+MP4MaxAURateQosQualifier::MP4MaxAURateQosQualifier()
+	: MP4QosQualifier(MP4MaxAURateQosTag)
+{
+	AddProperty( /* 0 */
+		new MP4Integer32Property("maxAURate"));
+}
+
+MP4UnknownQosQualifier::MP4UnknownQosQualifier()
+	: MP4QosQualifier()
+{
+	AddProperty( /* 0 */
+		new MP4BytesProperty("data"));
+}
+
+void MP4UnknownQosQualifier::Read(MP4File* pFile)
+{
+	ReadHeader(pFile);
+
+	/* byte properties need to know how long they are before reading */
+	((MP4BytesProperty*)m_pProperties[0])->SetValueSize(m_size);
+
+	ReadProperties(pFile);
+}
+
+MP4Descriptor* MP4QosQualifierProperty::CreateDescriptor(u_int8_t tag) 
+{
+	MP4Descriptor* pDescriptor = NULL;
+
+	switch (tag) {
+	case MP4MaxDelayQosTag:
+		pDescriptor = new MP4MaxDelayQosQualifier();
+		break;
+	case MP4PrefMaxDelayQosTag:
+		pDescriptor = new MP4PrefMaxDelayQosQualifier();
+		break;
+	case MP4LossProbQosTag:
+		pDescriptor = new MP4LossProbQosQualifier();
+		break;
+	case MP4MaxGapLossQosTag:
+		pDescriptor = new MP4MaxGapLossQosQualifier();
+		break;
+	case MP4MaxAUSizeQosTag:
+		pDescriptor = new MP4MaxAUSizeQosQualifier();
+		break;
+	case MP4AvgAUSizeQosTag:
+		pDescriptor = new MP4AvgAUSizeQosQualifier();
+		break;
+	case MP4MaxAURateQosTag:
+		pDescriptor = new MP4MaxAURateQosQualifier();
+		break;
+	default:
+		pDescriptor = new MP4UnknownQosQualifier();
+		pDescriptor->SetTag(tag);
+	}
+	
+	return pDescriptor;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/qosqualifiers.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,85 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#ifndef __QOSQUALIFIERS_INCLUDED__
+#define __QOSQUALIFIERS_INCLUDED__
+
+const u_int8_t MP4QosDescrTag			 	= 0x0C; 
+
+class MP4QosDescriptor : public MP4Descriptor {
+public:
+	MP4QosDescriptor();
+};
+
+typedef MP4Descriptor MP4QosQualifier;
+
+const u_int8_t MP4QosTagsStart				= 0x01; 
+const u_int8_t MP4MaxDelayQosTag			= 0x01; 
+const u_int8_t MP4PrefMaxDelayQosTag		= 0x02; 
+const u_int8_t MP4LossProbQosTag			= 0x03; 
+const u_int8_t MP4MaxGapLossQosTag			= 0x04; 
+const u_int8_t MP4MaxAUSizeQosTag			= 0x41; 
+const u_int8_t MP4AvgAUSizeQosTag			= 0x42; 
+const u_int8_t MP4MaxAURateQosTag			= 0x43; 
+const u_int8_t MP4QosTagsEnd				= 0xFF; 
+
+class MP4MaxDelayQosQualifier : public MP4QosQualifier {
+public:
+	MP4MaxDelayQosQualifier();
+};
+
+class MP4PrefMaxDelayQosQualifier : public MP4QosQualifier {
+public:
+	MP4PrefMaxDelayQosQualifier();
+};
+
+class MP4LossProbQosQualifier : public MP4QosQualifier {
+public:
+	MP4LossProbQosQualifier();
+};
+
+class MP4MaxGapLossQosQualifier : public MP4QosQualifier {
+public:
+	MP4MaxGapLossQosQualifier();
+};
+
+class MP4MaxAUSizeQosQualifier : public MP4QosQualifier {
+public:
+	MP4MaxAUSizeQosQualifier();
+};
+
+class MP4AvgAUSizeQosQualifier : public MP4QosQualifier {
+public:
+	MP4AvgAUSizeQosQualifier();
+};
+
+class MP4MaxAURateQosQualifier : public MP4QosQualifier {
+public:
+	MP4MaxAURateQosQualifier();
+};
+
+class MP4UnknownQosQualifier : public MP4QosQualifier {
+public:
+	MP4UnknownQosQualifier();
+	void Read(MP4File* pFile);
+};
+
+#endif /* __QOSQUALIFIERS_INCLUDED__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/rtphint.cpp	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,1348 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#include "mp4common.h"
+
+/* rtp hint track operations */
+
+MP4RtpHintTrack::MP4RtpHintTrack(MP4File* pFile, MP4Atom* pTrakAtom)
+	: MP4Track(pFile, pTrakAtom)
+{
+	m_pRefTrack = NULL;
+
+	m_pRtpMapProperty = NULL;
+	m_pPayloadNumberProperty = NULL;
+	m_pMaxPacketSizeProperty = NULL;
+	m_pSnroProperty = NULL;
+	m_pTsroProperty = NULL;
+
+	m_pReadHint = NULL;
+	m_pReadHintSample = NULL;
+	m_readHintSampleSize = 0;
+
+	m_pWriteHint = NULL;
+	m_writeHintId = MP4_INVALID_SAMPLE_ID;
+	m_writePacketId = 0;
+
+	m_pTrpy = NULL;
+	m_pNump = NULL;
+	m_pTpyl = NULL;
+	m_pMaxr = NULL;
+	m_pDmed = NULL;
+	m_pDimm = NULL;
+	m_pPmax = NULL;
+	m_pDmax = NULL;
+
+	m_pMaxPdu = NULL;
+	m_pAvgPdu = NULL;
+	m_pMaxBitRate = NULL;
+	m_pAvgBitRate = NULL;
+
+	m_thisSec = 0;
+	m_bytesThisSec = 0;
+	m_bytesThisHint = 0;
+	m_bytesThisPacket = 0;
+}
+
+MP4RtpHintTrack::~MP4RtpHintTrack()
+{
+	delete m_pReadHint;
+	delete m_pReadHintSample;
+	delete m_pWriteHint;
+}
+
+void MP4RtpHintTrack::InitRefTrack()
+{
+	if (m_pRefTrack == NULL) {
+		MP4Integer32Property* pRefTrackIdProperty = NULL;
+		m_pTrakAtom->FindProperty(
+			"trak.tref.hint.entries[0].trackId",
+			(MP4Property**)&pRefTrackIdProperty);
+		ASSERT(pRefTrackIdProperty);
+
+		m_pRefTrack = m_pFile->GetTrack(pRefTrackIdProperty->GetValue());
+	}
+}
+
+void MP4RtpHintTrack::InitRtpStart() 
+{
+	struct timeval tv;
+	gettimeofday(&tv, NULL);
+	srandom((tv.tv_usec << 12) | (tv.tv_sec & 0xFFF));
+
+	ASSERT(m_pTrakAtom);
+
+	m_pTrakAtom->FindProperty(
+		"trak.udta.hnti.rtp .snro.offset",
+		(MP4Property**)&m_pSnroProperty);
+
+	if (m_pSnroProperty) {
+		m_rtpSequenceStart = m_pSnroProperty->GetValue();
+	} else {
+		m_rtpSequenceStart = random();
+	}
+
+	m_pTrakAtom->FindProperty(
+		"trak.udta.hnti.rtp .tsro.offset",
+		(MP4Property**)&m_pTsroProperty);
+
+	if (m_pTsroProperty) {
+		m_rtpTimestampStart = m_pTsroProperty->GetValue();
+	} else {
+		m_rtpTimestampStart = random();
+	}
+}
+
+void MP4RtpHintTrack::ReadHint(
+	MP4SampleId hintSampleId,
+	u_int16_t* pNumPackets)
+{
+	if (m_pRefTrack == NULL) {
+		InitRefTrack();
+		InitRtpStart();
+	}
+
+	// dispose of any old hint
+	delete m_pReadHint;
+	m_pReadHint = NULL;
+	delete m_pReadHintSample;
+	m_pReadHintSample = NULL;
+	m_readHintSampleSize = 0;
+
+	// read the desired hint sample into memory
+	ReadSample(
+		hintSampleId, 
+		&m_pReadHintSample, 
+		&m_readHintSampleSize,
+		&m_readHintTimestamp);
+
+	m_pFile->EnableMemoryBuffer(m_pReadHintSample, m_readHintSampleSize);
+
+	m_pReadHint = new MP4RtpHint(this);
+	m_pReadHint->Read(m_pFile);
+
+	m_pFile->DisableMemoryBuffer();
+
+	if (pNumPackets) {
+		*pNumPackets = GetHintNumberOfPackets();
+	}
+}
+
+u_int16_t MP4RtpHintTrack::GetHintNumberOfPackets()
+{
+	if (m_pReadHint == NULL) {
+		throw new MP4Error("no hint has been read",
+			"MP4GetRtpHintNumberOfPackets");
+	}
+	return m_pReadHint->GetNumberOfPackets();
+}
+
+bool MP4RtpHintTrack::GetPacketBFrame(u_int16_t packetIndex)
+{
+	if (m_pReadHint == NULL) {
+		throw new MP4Error("no hint has been read",
+			"MP4GetRtpPacketBFrame");
+	}
+	MP4RtpPacket* pPacket =
+		m_pReadHint->GetPacket(packetIndex);
+
+	return pPacket->IsBFrame();
+}
+
+u_int16_t MP4RtpHintTrack::GetPacketTransmitOffset(u_int16_t packetIndex)
+{
+	if (m_pReadHint == NULL) {
+		throw new MP4Error("no hint has been read",
+			"MP4GetRtpPacketTransmitOffset");
+	}
+
+	MP4RtpPacket* pPacket =
+		m_pReadHint->GetPacket(packetIndex);
+
+	return pPacket->GetTransmitOffset();
+}
+
+void MP4RtpHintTrack::ReadPacket(
+	u_int16_t packetIndex,
+	u_int8_t** ppBytes, 
+	u_int32_t* pNumBytes,
+	u_int32_t ssrc,
+	bool addHeader,
+	bool addPayload)
+{
+	if (m_pReadHint == NULL) {
+		throw new MP4Error("no hint has been read",
+			"MP4ReadRtpPacket");
+	}
+	if (!addHeader && !addPayload) {
+		throw new MP4Error("no data requested",
+			"MP4ReadRtpPacket");
+	}
+
+	MP4RtpPacket* pPacket =
+		m_pReadHint->GetPacket(packetIndex);
+
+	*pNumBytes = 0;
+	if (addHeader) {
+		*pNumBytes += 12;
+	}
+	if (addPayload) {
+		*pNumBytes += pPacket->GetDataSize();
+	}
+
+	// if needed, allocate the packet memory
+	bool buffer_malloc = false;
+
+	if (*ppBytes == NULL) {
+		*ppBytes = (u_int8_t*)MP4Malloc(*pNumBytes);
+		buffer_malloc = true;
+	}
+
+	try {
+		u_int8_t* pDest = *ppBytes;
+
+		if (addHeader) {
+			*pDest++ =
+				0x80 | (pPacket->GetPBit() << 5) | (pPacket->GetXBit() << 4);
+
+			*pDest++ =
+				(pPacket->GetMBit() << 7) | pPacket->GetPayload();
+
+			*((u_int16_t*)pDest) = 
+				htons(m_rtpSequenceStart + pPacket->GetSequenceNumber());
+			pDest += 2; 
+
+			*((u_int32_t*)pDest) = 
+				htonl(m_rtpTimestampStart + (u_int32_t)m_readHintTimestamp);
+			pDest += 4; 
+
+			*((u_int32_t*)pDest) = 
+				htonl(ssrc);
+			pDest += 4;
+		}
+
+		if (addPayload) {
+			pPacket->GetData(pDest);
+		}
+	}
+	catch (MP4Error* e) {
+		if (buffer_malloc) {
+			MP4Free(*ppBytes);
+			*ppBytes = NULL;
+		}
+		throw e;
+	}
+
+	VERBOSE_READ_HINT(m_pFile->GetVerbosity(),
+		printf("ReadPacket: %u ", packetIndex);
+		MP4HexDump(*ppBytes, *pNumBytes););
+}
+
+MP4Timestamp MP4RtpHintTrack::GetRtpTimestampStart()
+{
+	if (m_pRefTrack == NULL) {
+		InitRefTrack();
+		InitRtpStart();
+	}
+
+	return m_rtpTimestampStart;
+}
+
+void MP4RtpHintTrack::SetRtpTimestampStart(MP4Timestamp start)
+{
+	if (!m_pTsroProperty) {
+		MP4Atom* pTsroAtom =
+			m_pFile->AddDescendantAtoms(m_pTrakAtom, "udta.hnti.rtp .tsro");
+
+		ASSERT(pTsroAtom);
+
+		pTsroAtom->FindProperty("offset",
+			(MP4Property**)&m_pTsroProperty);
+
+		ASSERT(m_pTsroProperty);
+	}
+
+	m_pTsroProperty->SetValue(start);
+	m_rtpTimestampStart = start;
+}
+
+void MP4RtpHintTrack::InitPayload()
+{
+	ASSERT(m_pTrakAtom);
+
+	if (m_pRtpMapProperty == NULL) {
+		m_pTrakAtom->FindProperty(
+			"trak.udta.hinf.payt.rtpMap",
+			(MP4Property**)&m_pRtpMapProperty);
+	}
+
+	if (m_pPayloadNumberProperty == NULL) {
+		m_pTrakAtom->FindProperty(
+			"trak.udta.hinf.payt.payloadNumber",
+			(MP4Property**)&m_pPayloadNumberProperty);
+	}
+
+	if (m_pMaxPacketSizeProperty == NULL) {
+		m_pTrakAtom->FindProperty(
+			"trak.mdia.minf.stbl.stsd.rtp .maxPacketSize",
+			(MP4Property**)&m_pMaxPacketSizeProperty);
+	}
+}
+
+void MP4RtpHintTrack::GetPayload(
+	char** ppPayloadName,
+	u_int8_t* pPayloadNumber,
+	u_int16_t* pMaxPayloadSize,
+	char **ppEncodingParams)
+{
+	InitPayload();
+
+	if (ppPayloadName || ppEncodingParams) {
+	  if (ppPayloadName) 
+	    *ppPayloadName = NULL;
+	  if (ppEncodingParams)
+	    *ppEncodingParams = NULL;
+		if (m_pRtpMapProperty) {
+			const char* pRtpMap = m_pRtpMapProperty->GetValue();
+			char* pSlash = strchr(pRtpMap, '/');
+
+			u_int32_t length;
+			if (pSlash) {
+				length = pSlash - pRtpMap;
+			} else {
+				length = strlen(pRtpMap);
+			}
+
+			if (ppPayloadName) {
+			  *ppPayloadName = (char*)MP4Calloc(length + 1);
+			  strncpy(*ppPayloadName, pRtpMap, length); 
+			}
+			if (pSlash && ppEncodingParams) {
+			  pSlash = strchr(pSlash, '/');
+			  if (pSlash != NULL) {
+			    pSlash++;
+			    if (pSlash != '\0') {
+			      length = strlen(pRtpMap) - (pSlash - pRtpMap);
+			      *ppEncodingParams = (char *)MP4Calloc(length + 1);
+			      strncpy(*ppEncodingParams, pSlash, length);
+			    }
+			  }
+			}
+		} 
+	}
+
+	if (pPayloadNumber) {
+		if (m_pPayloadNumberProperty) {
+			*pPayloadNumber = m_pPayloadNumberProperty->GetValue();
+		} else {
+			*pPayloadNumber = 0;
+		}
+	}
+
+	if (pMaxPayloadSize) {
+		if (m_pMaxPacketSizeProperty) {
+			*pMaxPayloadSize = m_pMaxPacketSizeProperty->GetValue();
+		} else {
+			*pMaxPayloadSize = 0;
+		}
+	}
+}
+
+void MP4RtpHintTrack::SetPayload(
+	const char* payloadName,
+	u_int8_t payloadNumber,
+	u_int16_t maxPayloadSize, 
+	const char *encoding_parms)
+{
+	InitRefTrack();
+	InitPayload();
+
+	ASSERT(m_pRtpMapProperty);
+	ASSERT(m_pPayloadNumberProperty);
+	ASSERT(m_pMaxPacketSizeProperty);
+	
+	size_t len = strlen(payloadName) + 16;
+	if (encoding_parms != NULL) {
+	  size_t temp = strlen(encoding_parms);
+	  if (temp == 0) {
+	    encoding_parms = NULL;
+	  } else {
+	    len += temp;
+	  }
+	}
+
+	char* rtpMapBuf = (char*)MP4Malloc(len);
+	sprintf(rtpMapBuf, "%s/%u%c%s", 
+		payloadName, 
+		GetTimeScale(),
+		encoding_parms != NULL ? '/' : '\0',
+		encoding_parms == NULL ? "" : encoding_parms);
+	m_pRtpMapProperty->SetValue(rtpMapBuf);
+	
+	m_pPayloadNumberProperty->SetValue(payloadNumber);
+
+	if (maxPayloadSize == 0) {
+		maxPayloadSize = 1460;
+	} 
+	m_pMaxPacketSizeProperty->SetValue(maxPayloadSize);
+
+	// set sdp media type
+	const char* sdpMediaType;
+	if (!strcmp(m_pRefTrack->GetType(), MP4_AUDIO_TRACK_TYPE)) {
+		sdpMediaType = "audio";
+	} else if (!strcmp(m_pRefTrack->GetType(), MP4_VIDEO_TRACK_TYPE)) {
+		sdpMediaType = "video";
+	} else {
+		sdpMediaType = "application";
+	}
+
+	char* sdpBuf = (char*)MP4Malloc(
+		strlen(sdpMediaType) + strlen(rtpMapBuf) + 256);
+	sprintf(sdpBuf, 
+		"m=%s 0 RTP/AVP %u\015\012"
+		"a=rtpmap:%u %s\015\012"
+		"a=control:trackID=%u\015\012" 
+		"a=mpeg4-esid:%u\015\012",
+		sdpMediaType, payloadNumber,
+		payloadNumber, rtpMapBuf,
+		m_trackId,
+		m_pRefTrack->GetId());
+
+	MP4StringProperty* pSdpProperty = NULL;
+	m_pTrakAtom->FindProperty("trak.udta.hnti.sdp .sdpText",
+		(MP4Property**)&pSdpProperty);
+	ASSERT(pSdpProperty);
+	pSdpProperty->SetValue(sdpBuf);
+
+	// cleanup
+	MP4Free(rtpMapBuf);
+	MP4Free(sdpBuf);
+}
+
+void MP4RtpHintTrack::AddHint(bool isBFrame, u_int32_t timestampOffset)
+{
+	// on first hint, need to lookup the reference track
+	if (m_writeHintId == MP4_INVALID_SAMPLE_ID) {
+		InitRefTrack();
+		InitStats();
+	}
+
+	if (m_pWriteHint) {
+		throw new MP4Error("unwritten hint is still pending", "MP4AddRtpHint");
+	}
+
+	m_pWriteHint = new MP4RtpHint(this);
+	m_pWriteHint->SetBFrame(isBFrame);
+	m_pWriteHint->SetTimestampOffset(timestampOffset);
+
+	m_bytesThisHint = 0;
+	m_writeHintId++;
+}
+
+void MP4RtpHintTrack::AddPacket(bool setMbit, int32_t transmitOffset)
+{
+	if (m_pWriteHint == NULL) {
+		throw new MP4Error("no hint pending", "MP4RtpAddPacket");
+	}
+
+	MP4RtpPacket* pPacket = m_pWriteHint->AddPacket();
+
+	ASSERT(m_pPayloadNumberProperty);
+
+	pPacket->Set(
+		m_pPayloadNumberProperty->GetValue(), 
+		m_writePacketId++, 
+		setMbit);
+	pPacket->SetTransmitOffset(transmitOffset);
+
+	m_bytesThisHint += 12;
+	if (m_bytesThisPacket > m_pPmax->GetValue()) {
+		m_pPmax->SetValue(m_bytesThisPacket);
+	}
+	m_bytesThisPacket = 12;
+	m_pNump->IncrementValue();
+	m_pTrpy->IncrementValue(12); // RTP packet header size
+}
+
+void MP4RtpHintTrack::AddImmediateData(
+	const u_int8_t* pBytes,
+	u_int32_t numBytes)
+{
+	if (m_pWriteHint == NULL) {
+		throw new MP4Error("no hint pending", "MP4RtpAddImmediateData");
+	}
+
+	MP4RtpPacket* pPacket = m_pWriteHint->GetCurrentPacket();
+	if (pPacket == NULL) {
+		throw new MP4Error("no packet pending", "MP4RtpAddImmediateData");
+	}
+
+	if (pBytes == NULL || numBytes == 0) {
+		throw new MP4Error("no data",
+			"AddImmediateData");
+	}
+	if (numBytes > 14) {
+		throw new MP4Error("data size is larger than 14 bytes",
+			"AddImmediateData");
+	}
+
+	MP4RtpImmediateData* pData = new MP4RtpImmediateData(pPacket);
+	pData->Set(pBytes, numBytes);
+
+	pPacket->AddData(pData);
+
+	m_bytesThisHint += numBytes;
+	m_bytesThisPacket += numBytes;
+	m_pDimm->IncrementValue(numBytes);
+	m_pTpyl->IncrementValue(numBytes);
+	m_pTrpy->IncrementValue(numBytes);
+}
+
+void MP4RtpHintTrack::AddSampleData(
+	MP4SampleId sampleId,
+	u_int32_t dataOffset,
+	u_int32_t dataLength)
+{
+	if (m_pWriteHint == NULL) {
+		throw new MP4Error("no hint pending", "MP4RtpAddSampleData");
+	}
+
+	MP4RtpPacket* pPacket = m_pWriteHint->GetCurrentPacket();
+	if (pPacket == NULL) {
+		throw new MP4Error("no packet pending", "MP4RtpAddSampleData");
+	}
+
+	MP4RtpSampleData* pData = new MP4RtpSampleData(pPacket);
+
+	pData->SetReferenceSample(sampleId, dataOffset, dataLength);
+
+	pPacket->AddData(pData);
+
+	m_bytesThisHint += dataLength;
+	m_bytesThisPacket += dataLength;
+	m_pDmed->IncrementValue(dataLength);
+	m_pTpyl->IncrementValue(dataLength);
+	m_pTrpy->IncrementValue(dataLength);
+}
+
+void MP4RtpHintTrack::AddESConfigurationPacket()
+{
+	if (m_pWriteHint == NULL) {
+		throw new MP4Error("no hint pending", 
+			"MP4RtpAddESConfigurationPacket");
+	}
+
+	u_int8_t* pConfig = NULL;
+	u_int32_t configSize = 0;
+
+	m_pFile->GetTrackESConfiguration(m_pRefTrack->GetId(),
+		&pConfig, &configSize);
+
+	if (pConfig == NULL) {
+		return;
+	}
+
+	ASSERT(m_pMaxPacketSizeProperty);
+
+	if (configSize > m_pMaxPacketSizeProperty->GetValue()) {
+		throw new MP4Error("ES configuration is too large for RTP payload",
+			"MP4RtpAddESConfigurationPacket");
+	}
+
+	AddPacket(false);
+
+	MP4RtpPacket* pPacket = m_pWriteHint->GetCurrentPacket();
+	ASSERT(pPacket);
+	
+	// This is ugly!
+	// To get the ES configuration data somewhere known
+	// we create a sample data reference that points to 
+	// this hint track (not the media track)
+	// and this sample of the hint track 
+	// the offset into this sample is filled in during the write process
+	MP4RtpSampleData* pData = new MP4RtpSampleData(pPacket);
+
+	pData->SetEmbeddedImmediate(m_writeSampleId, pConfig, configSize);
+
+	pPacket->AddData(pData);
+
+	m_bytesThisHint += configSize;
+	m_bytesThisPacket += configSize;
+	m_pTpyl->IncrementValue(configSize);
+	m_pTrpy->IncrementValue(configSize);
+}
+
+void MP4RtpHintTrack::WriteHint(MP4Duration duration, bool isSyncSample)
+{
+	if (m_pWriteHint == NULL) {
+		throw new MP4Error("no hint pending", "MP4WriteRtpHint");
+	}
+
+	u_int8_t* pBytes;
+	u_int64_t numBytes;
+
+	m_pFile->EnableMemoryBuffer();
+
+	m_pWriteHint->Write(m_pFile);
+
+	m_pFile->DisableMemoryBuffer(&pBytes, &numBytes);
+
+	WriteSample(pBytes, numBytes, duration, 0, isSyncSample);
+
+	MP4Free(pBytes);
+
+	// update statistics
+	if (m_bytesThisPacket > m_pPmax->GetValue()) {
+		m_pPmax->SetValue(m_bytesThisPacket);
+	}
+
+	if (duration > m_pDmax->GetValue()) {
+		m_pDmax->SetValue(duration);
+	}
+
+	MP4Timestamp startTime;
+
+	GetSampleTimes(m_writeHintId, &startTime, NULL);
+
+	if (startTime < m_thisSec + GetTimeScale()) {
+		m_bytesThisSec += m_bytesThisHint;
+	} else {
+		if (m_bytesThisSec > m_pMaxr->GetValue()) {
+			m_pMaxr->SetValue(m_bytesThisSec);
+		}
+		m_thisSec = startTime - (startTime % GetTimeScale());
+		m_bytesThisSec = m_bytesThisHint;
+	}
+
+	// cleanup
+	delete m_pWriteHint;
+	m_pWriteHint = NULL;
+}
+
+void MP4RtpHintTrack::FinishWrite()
+{
+	if (m_writeHintId != MP4_INVALID_SAMPLE_ID) {
+		m_pMaxPdu->SetValue(m_pPmax->GetValue());
+		if (m_pNump->GetValue()) {
+			m_pAvgPdu->SetValue(m_pTrpy->GetValue() / m_pNump->GetValue());
+		}
+
+		m_pMaxBitRate->SetValue(m_pMaxr->GetValue() * 8);
+		if (GetDuration()) {
+			m_pAvgBitRate->SetValue(
+				m_pTrpy->GetValue() * 8 * GetTimeScale() / GetDuration());
+		}
+	}
+
+	MP4Track::FinishWrite();
+}
+
+void MP4RtpHintTrack::InitStats()
+{
+	MP4Atom* pHinfAtom = m_pTrakAtom->FindAtom("trak.udta.hinf");
+
+	ASSERT(pHinfAtom);
+
+	pHinfAtom->FindProperty("hinf.trpy.bytes", (MP4Property**)&m_pTrpy); 
+	pHinfAtom->FindProperty("hinf.nump.packets", (MP4Property**)&m_pNump); 
+	pHinfAtom->FindProperty("hinf.tpyl.bytes", (MP4Property**)&m_pTpyl); 
+	pHinfAtom->FindProperty("hinf.maxr.bytes", (MP4Property**)&m_pMaxr); 
+	pHinfAtom->FindProperty("hinf.dmed.bytes", (MP4Property**)&m_pDmed); 
+	pHinfAtom->FindProperty("hinf.dimm.bytes", (MP4Property**)&m_pDimm); 
+	pHinfAtom->FindProperty("hinf.pmax.bytes", (MP4Property**)&m_pPmax); 
+	pHinfAtom->FindProperty("hinf.dmax.milliSecs", (MP4Property**)&m_pDmax); 
+
+	MP4Atom* pHmhdAtom = m_pTrakAtom->FindAtom("trak.mdia.minf.hmhd");
+
+	ASSERT(pHmhdAtom);
+
+	pHmhdAtom->FindProperty("hmhd.maxPduSize", (MP4Property**)&m_pMaxPdu); 
+	pHmhdAtom->FindProperty("hmhd.avgPduSize", (MP4Property**)&m_pAvgPdu); 
+	pHmhdAtom->FindProperty("hmhd.maxBitRate", (MP4Property**)&m_pMaxBitRate); 
+	pHmhdAtom->FindProperty("hmhd.avgBitRate", (MP4Property**)&m_pAvgBitRate); 
+
+	MP4Integer32Property* pMaxrPeriod = NULL;
+	pHinfAtom->FindProperty("hinf.maxr.granularity",
+		 (MP4Property**)&pMaxrPeriod); 
+	if (pMaxrPeriod) {
+		pMaxrPeriod->SetValue(1000);	// 1 second
+	}
+}
+
+
+MP4RtpHint::MP4RtpHint(MP4RtpHintTrack* pTrack)
+{
+	m_pTrack = pTrack;
+
+	AddProperty( /* 0 */
+		new MP4Integer16Property("packetCount"));
+	AddProperty( /* 1 */
+		new MP4Integer16Property("reserved"));
+}
+
+MP4RtpHint::~MP4RtpHint()
+{
+	for (u_int32_t i = 0; i < m_rtpPackets.Size(); i++) {
+		delete m_rtpPackets[i];
+	}
+}
+
+MP4RtpPacket* MP4RtpHint::AddPacket() 
+{
+	MP4RtpPacket* pPacket = new MP4RtpPacket(this);
+	m_rtpPackets.Add(pPacket);
+
+	// packetCount property
+	((MP4Integer16Property*)m_pProperties[0])->IncrementValue();
+
+	pPacket->SetBFrame(m_isBFrame);
+	pPacket->SetTimestampOffset(m_timestampOffset);
+
+	return pPacket;
+}
+
+void MP4RtpHint::Read(MP4File* pFile)
+{
+	// call base class Read for required properties
+	MP4Container::Read(pFile);
+
+	u_int16_t numPackets =
+		((MP4Integer16Property*)m_pProperties[0])->GetValue();
+
+	for (u_int16_t i = 0; i < numPackets; i++) {
+		MP4RtpPacket* pPacket = new MP4RtpPacket(this);
+
+		m_rtpPackets.Add(pPacket);
+
+		pPacket->Read(pFile);
+	}
+
+	VERBOSE_READ_HINT(pFile->GetVerbosity(),
+		printf("ReadHint:\n"); Dump(stdout, 10, false););
+}
+
+void MP4RtpHint::Write(MP4File* pFile)
+{
+	u_int64_t hintStartPos = pFile->GetPosition();
+
+	MP4Container::Write(pFile);
+
+	u_int64_t packetStartPos = pFile->GetPosition();
+
+	u_int32_t i;
+
+	// first write out packet (and data) entries
+	for (i = 0; i < m_rtpPackets.Size(); i++) {
+		m_rtpPackets[i]->Write(pFile);
+	}
+
+	// now let packets write their extra data into the hint sample
+	for (i = 0; i < m_rtpPackets.Size(); i++) {
+		m_rtpPackets[i]->WriteEmbeddedData(pFile, hintStartPos);
+	}
+
+	u_int64_t endPos = pFile->GetPosition();
+
+	pFile->SetPosition(packetStartPos);
+
+	// finally rewrite the packet and data entries
+	// which now contain the correct offsets for the embedded data
+	for (i = 0; i < m_rtpPackets.Size(); i++) {
+		m_rtpPackets[i]->Write(pFile);
+	}
+
+	pFile->SetPosition(endPos);
+
+	VERBOSE_WRITE_HINT(pFile->GetVerbosity(),
+		printf("WriteRtpHint:\n"); Dump(stdout, 14, false));
+}
+
+void MP4RtpHint::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits)
+{
+	MP4Container::Dump(pFile, indent, dumpImplicits);
+
+	for (u_int32_t i = 0; i < m_rtpPackets.Size(); i++) {
+		Indent(pFile, indent);
+		fprintf(pFile, "RtpPacket: %u\n", i);
+		m_rtpPackets[i]->Dump(pFile, indent + 1, dumpImplicits);
+	}
+}
+
+MP4RtpPacket::MP4RtpPacket(MP4RtpHint* pHint)
+{
+	m_pHint = pHint;
+
+	AddProperty( /* 0 */
+		new MP4Integer32Property("relativeXmitTime"));
+	AddProperty( /* 1 */
+		new MP4BitfieldProperty("reserved1", 2));
+	AddProperty( /* 2 */
+		new MP4BitfieldProperty("Pbit", 1));
+	AddProperty( /* 3 */
+		new MP4BitfieldProperty("Xbit", 1));
+	AddProperty( /* 4 */
+		new MP4BitfieldProperty("reserved2", 4));
+	AddProperty( /* 5 */
+		new MP4BitfieldProperty("Mbit", 1));
+	AddProperty( /* 6 */
+		new MP4BitfieldProperty("payloadType", 7));
+	AddProperty( /* 7  */
+		new MP4Integer16Property("sequenceNumber"));
+	AddProperty( /* 8 */
+		new MP4BitfieldProperty("reserved3", 13));
+	AddProperty( /* 9 */
+		new MP4BitfieldProperty("extraFlag", 1));
+	AddProperty( /* 10 */
+		new MP4BitfieldProperty("bFrameFlag", 1));
+	AddProperty( /* 11 */
+		new MP4BitfieldProperty("repeatFlag", 1));
+	AddProperty( /* 12 */
+		new MP4Integer16Property("entryCount"));
+}
+ 
+MP4RtpPacket::~MP4RtpPacket()
+{
+	for (u_int32_t i = 0; i < m_rtpData.Size(); i++) {
+		delete m_rtpData[i];
+	}
+}
+
+void MP4RtpPacket::AddExtraProperties()
+{
+	AddProperty( /* 13 */
+		new MP4Integer32Property("extraInformationLength"));
+
+	// This is a bit of a hack, since the tlv entries are really defined 
+	// as atoms but there is only one type defined now, rtpo, and getting 
+	// our atom code hooked up here would be a major pain with little gain
+
+	AddProperty( /* 14 */
+		new MP4Integer32Property("tlvLength"));
+	AddProperty( /* 15 */
+		new MP4StringProperty("tlvType"));
+	AddProperty( /* 16 */
+		new MP4Integer32Property("timestampOffset"));
+
+	((MP4Integer32Property*)m_pProperties[13])->SetValue(16);
+	((MP4Integer32Property*)m_pProperties[14])->SetValue(12);
+	((MP4StringProperty*)m_pProperties[15])->SetFixedLength(4);
+	((MP4StringProperty*)m_pProperties[15])->SetValue("rtpo");
+}
+
+void MP4RtpPacket::Read(MP4File* pFile)
+{
+	// call base class Read for required properties
+	MP4Container::Read(pFile);
+
+	// read extra info if present
+	// we only support the rtpo field!
+	if (((MP4BitfieldProperty*)m_pProperties[9])->GetValue() == 1) {
+		ReadExtra(pFile);
+	}
+
+	u_int16_t numDataEntries =
+		((MP4Integer16Property*)m_pProperties[12])->GetValue();
+
+	// read data entries
+	for (u_int16_t i = 0; i < numDataEntries; i++) {
+		u_int8_t dataType;
+		pFile->PeekBytes(&dataType, 1);
+
+		MP4RtpData* pData;
+
+		switch (dataType) {
+		case 0:
+			pData = new MP4RtpNullData(this);
+			break;
+		case 1:
+			pData = new MP4RtpImmediateData(this);
+			break;
+		case 2:
+			pData = new MP4RtpSampleData(this);
+			break;
+		case 3:
+			pData = new MP4RtpSampleDescriptionData(this);
+			break;
+		default:
+			throw new MP4Error("unknown packet data entry type",
+				"MP4ReadHint");
+		}
+
+		m_rtpData.Add(pData);
+
+		// read data entry's properties
+		pData->Read(pFile);
+	}
+}
+
+void MP4RtpPacket::ReadExtra(MP4File* pFile)
+{
+	AddExtraProperties();
+
+	int32_t extraLength = (int32_t)pFile->ReadUInt32();
+
+	if (extraLength < 4) {
+		throw new MP4Error("bad packet extra info length",
+			"MP4RtpPacket::ReadExtra");
+	}
+	extraLength -= 4;
+
+	while (extraLength > 0) {
+		u_int32_t entryLength = pFile->ReadUInt32();
+		u_int32_t entryTag = pFile->ReadUInt32();
+
+		if (entryLength < 8) {
+			throw new MP4Error("bad packet extra info entry length",
+				"MP4RtpPacket::ReadExtra");
+		}
+
+		if (entryTag == STRTOINT32("rtpo") && entryLength == 12) {
+			// read the rtp timestamp offset
+			m_pProperties[16]->Read(pFile);
+		} else {
+			// ignore it, LATER carry it along
+			pFile->SetPosition(pFile->GetPosition() + entryLength - 8);
+		}
+
+		extraLength -= entryLength;
+	}
+
+	if (extraLength < 0) {
+		throw new MP4Error("invalid packet extra info length",
+			"MP4RtpPacket::ReadExtra");
+	}
+}
+
+void MP4RtpPacket::Set(u_int8_t payloadNumber, 
+	u_int32_t packetId, bool setMbit)
+{
+	((MP4BitfieldProperty*)m_pProperties[5])->SetValue(setMbit);
+	((MP4BitfieldProperty*)m_pProperties[6])->SetValue(payloadNumber);
+	((MP4Integer16Property*)m_pProperties[7])->SetValue(packetId);
+}
+
+int32_t MP4RtpPacket::GetTransmitOffset()
+{
+	return ((MP4Integer32Property*)m_pProperties[0])->GetValue();
+}
+
+void MP4RtpPacket::SetTransmitOffset(int32_t transmitOffset)
+{
+	((MP4Integer32Property*)m_pProperties[0])->SetValue(transmitOffset);
+}
+
+bool MP4RtpPacket::GetPBit()
+{
+	return ((MP4BitfieldProperty*)m_pProperties[2])->GetValue();
+}
+
+bool MP4RtpPacket::GetXBit()
+{
+	return ((MP4BitfieldProperty*)m_pProperties[3])->GetValue();
+}
+
+bool MP4RtpPacket::GetMBit()
+{
+	return ((MP4BitfieldProperty*)m_pProperties[5])->GetValue();
+}
+
+u_int8_t MP4RtpPacket::GetPayload()
+{
+	return ((MP4BitfieldProperty*)m_pProperties[6])->GetValue();
+}
+
+u_int16_t MP4RtpPacket::GetSequenceNumber()
+{
+	return ((MP4Integer16Property*)m_pProperties[7])->GetValue();
+}
+
+bool MP4RtpPacket::IsBFrame()
+{
+	return ((MP4BitfieldProperty*)m_pProperties[10])->GetValue();
+}
+
+void MP4RtpPacket::SetBFrame(bool isBFrame)
+{
+	((MP4BitfieldProperty*)m_pProperties[10])->SetValue(isBFrame);
+}
+
+void MP4RtpPacket::SetTimestampOffset(u_int32_t timestampOffset)
+{
+	if (timestampOffset == 0) {
+		return;
+	}
+
+	ASSERT(((MP4BitfieldProperty*)m_pProperties[9])->GetValue() == 0);
+
+	// set X bit
+	((MP4BitfieldProperty*)m_pProperties[9])->SetValue(1);
+
+	AddExtraProperties();
+
+	((MP4Integer32Property*)m_pProperties[16])->SetValue(timestampOffset);
+}
+
+void MP4RtpPacket::AddData(MP4RtpData* pData)
+{
+	m_rtpData.Add(pData);
+
+	// increment entry count property
+	((MP4Integer16Property*)m_pProperties[12])->IncrementValue();
+}
+
+u_int32_t MP4RtpPacket::GetDataSize()
+{
+	u_int32_t totalDataSize = 0;
+
+	for (u_int32_t i = 0; i < m_rtpData.Size(); i++) {
+		totalDataSize += m_rtpData[i]->GetDataSize();
+	}
+
+	return totalDataSize;
+}
+
+void MP4RtpPacket::GetData(u_int8_t* pDest)
+{
+	for (u_int32_t i = 0; i < m_rtpData.Size(); i++) {
+		m_rtpData[i]->GetData(pDest);
+		pDest += m_rtpData[i]->GetDataSize();
+	}
+}
+
+void MP4RtpPacket::Write(MP4File* pFile)
+{
+	MP4Container::Write(pFile);
+
+	for (u_int32_t i = 0; i < m_rtpData.Size(); i++) {
+		m_rtpData[i]->Write(pFile);
+	}
+}
+
+void MP4RtpPacket::WriteEmbeddedData(MP4File* pFile, u_int64_t startPos)
+{
+	for (u_int32_t i = 0; i < m_rtpData.Size(); i++) {
+		m_rtpData[i]->WriteEmbeddedData(pFile, startPos);
+	}
+}
+
+void MP4RtpPacket::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits)
+{
+	MP4Container::Dump(pFile, indent, dumpImplicits);
+
+	for (u_int32_t i = 0; i < m_rtpData.Size(); i++) {
+		Indent(pFile, indent);
+		fprintf(pFile, "RtpData: %u\n", i);
+		m_rtpData[i]->Dump(pFile, indent + 1, dumpImplicits);
+	}
+}
+
+MP4RtpData::MP4RtpData(MP4RtpPacket* pPacket)
+{
+	m_pPacket = pPacket;
+
+	AddProperty( /* 0 */
+		new MP4Integer8Property("type"));
+}
+
+MP4Track* MP4RtpData::FindTrackFromRefIndex(u_int8_t refIndex)
+{
+	MP4Track* pTrack;
+
+	if (refIndex == (u_int8_t)-1) {
+		// ourselves
+		pTrack = GetPacket()->GetHint()->GetTrack();
+	} else if (refIndex == 0) {
+		// our reference track
+		pTrack = GetPacket()->GetHint()->GetTrack()->GetRefTrack();
+	} else {
+		// some other track
+		MP4RtpHintTrack* pHintTrack =
+			GetPacket()->GetHint()->GetTrack();
+
+		MP4Atom* pTrakAtom = pHintTrack->GetTrakAtom();
+		ASSERT(pTrakAtom);
+
+		MP4Integer32Property* pTrackIdProperty = NULL;
+		pTrakAtom->FindProperty(
+			"trak.tref.hint.entries",
+			(MP4Property**)&pTrackIdProperty);
+		ASSERT(pTrackIdProperty);
+
+		u_int32_t refTrackId = 
+			pTrackIdProperty->GetValue(refIndex - 1);
+
+		pTrack = pHintTrack->GetFile()->GetTrack(refTrackId); 
+	}
+
+	return pTrack;
+}
+
+MP4RtpNullData::MP4RtpNullData(MP4RtpPacket* pPacket)
+	: MP4RtpData(pPacket)
+{
+	((MP4Integer8Property*)m_pProperties[0])->SetValue(0);
+
+	AddProperty( /* 1 */
+		new MP4BytesProperty("pad", 15));
+
+	((MP4BytesProperty*)m_pProperties[1])->SetFixedSize(15);
+}
+
+MP4RtpImmediateData::MP4RtpImmediateData(MP4RtpPacket* pPacket)
+	: MP4RtpData(pPacket)
+{
+	((MP4Integer8Property*)m_pProperties[0])->SetValue(1);
+
+	AddProperty( /* 1 */
+		new MP4Integer8Property("count"));
+	AddProperty( /* 2 */
+		new MP4BytesProperty("data", 14));
+
+	((MP4BytesProperty*)m_pProperties[2])->SetFixedSize(14);
+}
+
+void MP4RtpImmediateData::Set(const u_int8_t* pBytes, u_int8_t numBytes)
+{
+	((MP4Integer8Property*)m_pProperties[1])->SetValue(numBytes);
+	((MP4BytesProperty*)m_pProperties[2])->SetValue(pBytes, numBytes);
+}
+
+u_int16_t MP4RtpImmediateData::GetDataSize()
+{
+	return ((MP4Integer8Property*)m_pProperties[1])->GetValue();
+}
+
+void MP4RtpImmediateData::GetData(u_int8_t* pDest)
+{
+	u_int8_t* pValue;
+	u_int32_t valueSize;
+	((MP4BytesProperty*)m_pProperties[2])->GetValue(&pValue, &valueSize);
+
+	memcpy(pDest, pValue, GetDataSize());
+	MP4Free(pValue);
+}
+
+MP4RtpSampleData::MP4RtpSampleData(MP4RtpPacket* pPacket)
+	: MP4RtpData(pPacket)
+{
+	((MP4Integer8Property*)m_pProperties[0])->SetValue(2);
+
+	AddProperty( /* 1 */
+		new MP4Integer8Property("trackRefIndex"));
+	AddProperty( /* 2 */
+		new MP4Integer16Property("length"));
+	AddProperty( /* 3 */
+		new MP4Integer32Property("sampleNumber"));
+	AddProperty( /* 4 */
+		new MP4Integer32Property("sampleOffset"));
+	AddProperty( /* 5 */
+		new MP4Integer16Property("bytesPerBlock"));
+	AddProperty( /* 6 */
+		new MP4Integer16Property("samplesPerBlock"));
+
+	((MP4Integer16Property*)m_pProperties[5])->SetValue(1);
+	((MP4Integer16Property*)m_pProperties[6])->SetValue(1);
+
+	m_pRefData = NULL;
+	m_pRefTrack = NULL;
+	m_refSampleId = MP4_INVALID_SAMPLE_ID;
+	m_refSampleOffset = 0;
+}
+
+void MP4RtpSampleData::SetEmbeddedImmediate(MP4SampleId sampleId, 
+	u_int8_t* pData, u_int16_t dataLength)
+{
+	((MP4Integer8Property*)m_pProperties[1])->SetValue((u_int8_t)-1);
+	((MP4Integer16Property*)m_pProperties[2])->SetValue(dataLength);
+	((MP4Integer32Property*)m_pProperties[3])->SetValue(sampleId);
+	((MP4Integer32Property*)m_pProperties[4])->SetValue(0); 
+	m_pRefData = pData;
+}
+
+void MP4RtpSampleData::SetReferenceSample(
+	MP4SampleId refSampleId, u_int32_t refSampleOffset, 
+	u_int16_t sampleLength)
+{
+	((MP4Integer8Property*)m_pProperties[1])->SetValue(0);
+	((MP4Integer16Property*)m_pProperties[2])->SetValue(sampleLength);
+	((MP4Integer32Property*)m_pProperties[3])->SetValue(refSampleId);
+	((MP4Integer32Property*)m_pProperties[4])->SetValue(refSampleOffset);
+}
+
+void MP4RtpSampleData::SetEmbeddedSample(
+	MP4SampleId sampleId, MP4Track* pRefTrack,
+	MP4SampleId refSampleId, u_int32_t refSampleOffset, 
+	u_int16_t sampleLength)
+{
+	((MP4Integer8Property*)m_pProperties[1])->SetValue((u_int8_t)-1);
+	((MP4Integer16Property*)m_pProperties[2])->SetValue(sampleLength);
+	((MP4Integer32Property*)m_pProperties[3])->SetValue(sampleId);
+	((MP4Integer32Property*)m_pProperties[4])->SetValue(0);
+	m_pRefTrack = pRefTrack;
+	m_refSampleId = refSampleId;
+	m_refSampleOffset = refSampleOffset;
+}
+
+u_int16_t MP4RtpSampleData::GetDataSize()
+{
+	return ((MP4Integer16Property*)m_pProperties[2])->GetValue();
+}
+
+void MP4RtpSampleData::GetData(u_int8_t* pDest)
+{
+	u_int8_t trackRefIndex = 
+		((MP4Integer8Property*)m_pProperties[1])->GetValue();
+
+	MP4Track* pSampleTrack =
+		FindTrackFromRefIndex(trackRefIndex);
+
+	pSampleTrack->ReadSampleFragment(
+		((MP4Integer32Property*)m_pProperties[3])->GetValue(),	// sampleId 
+		((MP4Integer32Property*)m_pProperties[4])->GetValue(),	// sampleOffset
+		((MP4Integer16Property*)m_pProperties[2])->GetValue(),	// sampleLength
+		pDest);
+}
+
+void MP4RtpSampleData::WriteEmbeddedData(MP4File* pFile, u_int64_t startPos)
+{
+	// if not using embedded data, nothing to do
+	if (((MP4Integer8Property*)m_pProperties[1])->GetValue() != (u_int8_t)-1) {
+		return;
+	}
+
+	// figure out the offset within this hint sample for this embedded data
+	u_int64_t offset = pFile->GetPosition() - startPos;
+	ASSERT(offset <= 0xFFFFFFFF);	
+	((MP4Integer32Property*)m_pProperties[4])->SetValue((u_int32_t)offset);
+
+	u_int16_t length = ((MP4Integer16Property*)m_pProperties[2])->GetValue();
+
+	if (m_pRefData) {
+		pFile->WriteBytes(m_pRefData, length);
+		return;
+	} 
+
+	if (m_refSampleId != MP4_INVALID_SAMPLE_ID) {
+		u_int8_t* pSample = NULL;
+		u_int32_t sampleSize = 0;
+
+		ASSERT(m_pRefTrack);
+		m_pRefTrack->ReadSample(m_refSampleId, &pSample, &sampleSize);
+
+		ASSERT(m_refSampleOffset + length <= sampleSize);
+
+		pFile->WriteBytes(&pSample[m_refSampleOffset], length);
+
+		MP4Free(pSample);
+		return;
+	}
+}
+
+MP4RtpSampleDescriptionData::MP4RtpSampleDescriptionData(MP4RtpPacket* pPacket)
+	: MP4RtpData(pPacket)
+{
+	((MP4Integer8Property*)m_pProperties[0])->SetValue(3);
+
+	AddProperty( /* 1 */
+		new MP4Integer8Property("trackRefIndex"));
+	AddProperty( /* 2 */
+		new MP4Integer16Property("length"));
+	AddProperty( /* 3 */
+		new MP4Integer32Property("sampleDescriptionIndex"));
+	AddProperty( /* 4 */
+		new MP4Integer32Property("sampleDescriptionOffset"));
+	AddProperty( /* 5 */
+		new MP4Integer32Property("reserved"));
+}
+
+void MP4RtpSampleDescriptionData::Set(u_int32_t sampleDescrIndex,
+	u_int32_t offset, u_int16_t length)
+{
+	((MP4Integer16Property*)m_pProperties[2])->SetValue(length);
+	((MP4Integer32Property*)m_pProperties[3])->SetValue(sampleDescrIndex);
+	((MP4Integer32Property*)m_pProperties[4])->SetValue(offset);
+}
+
+u_int16_t MP4RtpSampleDescriptionData::GetDataSize()
+{
+	return ((MP4Integer16Property*)m_pProperties[2])->GetValue();
+}
+
+void MP4RtpSampleDescriptionData::GetData(u_int8_t* pDest)
+{
+	// we start with the index into our track references
+	u_int8_t trackRefIndex = 
+		((MP4Integer8Property*)m_pProperties[1])->GetValue();
+
+	// from which we can find the track structure
+	MP4Track* pSampleTrack =
+		FindTrackFromRefIndex(trackRefIndex);
+
+	// next find the desired atom in the track's sample description table
+	u_int32_t sampleDescrIndex =
+		((MP4Integer32Property*)m_pProperties[3])->GetValue();
+
+	MP4Atom* pTrakAtom =
+		pSampleTrack->GetTrakAtom();
+
+	char sdName[64];
+	sprintf(sdName, "trak.mdia.minf.stbl.stsd.*[%u]", sampleDescrIndex);
+
+	MP4Atom* pSdAtom =
+		pTrakAtom->FindAtom(sdName);
+
+	// bad reference
+	if (pSdAtom == NULL) {
+		throw new MP4Error("invalid sample description index",
+			"MP4RtpSampleDescriptionData::GetData");
+	}
+
+	// check validity of the upcoming copy
+	u_int16_t length = 
+		((MP4Integer16Property*)m_pProperties[2])->GetValue();
+	u_int32_t offset =
+		((MP4Integer32Property*)m_pProperties[4])->GetValue();
+
+	if (offset + length > pSdAtom->GetSize()) {
+		throw new MP4Error("offset and/or length are too large", 
+			"MP4RtpSampleDescriptionData::GetData");
+	}
+
+	// now we use the raw file to get the desired bytes
+
+	MP4File* pFile = GetPacket()->GetHint()->GetTrack()->GetFile();
+
+	u_int64_t orgPos = pFile->GetPosition();
+
+	// It's not entirely clear from the spec whether the offset is from 
+	// the start of the sample descirption atom, or the start of the atom's
+	// data. I believe it is the former, but the commented out code will 
+	// realize the latter interpretation if I turn out to be wrong.
+	u_int64_t dataPos = pSdAtom->GetStart();
+	//u_int64_t dataPos = pSdAtom->GetEnd() - pSdAtom->GetSize();
+
+	pFile->SetPosition(dataPos + offset);
+
+	pFile->ReadBytes(pDest, length);
+
+	pFile->SetPosition(orgPos);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/rtphint.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,346 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is MPEG4IP.
+ * 
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ * 
+ * Contributor(s): 
+ *		Dave Mackie		dmackie@cisco.com
+ */
+
+#ifndef __RTPHINT_INCLUDED__
+#define __RTPHINT_INCLUDED__
+
+// forward declarations
+class MP4RtpHintTrack;
+class MP4RtpHint;
+class MP4RtpPacket;
+
+class MP4RtpData : public MP4Container {
+public:
+	MP4RtpData(MP4RtpPacket* pPacket);
+
+	MP4RtpPacket* GetPacket() {
+		return m_pPacket;
+	}
+
+	virtual u_int16_t GetDataSize() = NULL;
+	virtual void GetData(u_int8_t* pDest) = NULL;
+
+	MP4Track* FindTrackFromRefIndex(u_int8_t refIndex);
+
+	virtual void WriteEmbeddedData(MP4File* pFile, u_int64_t startPos) {
+		// default is no-op
+	}
+
+protected:
+	MP4RtpPacket* m_pPacket;
+};
+
+MP4ARRAY_DECL(MP4RtpData, MP4RtpData*)
+
+class MP4RtpNullData : public MP4RtpData {
+public:
+	MP4RtpNullData(MP4RtpPacket* pPacket);
+
+	u_int16_t GetDataSize() {
+		return 0;
+	}
+
+	void GetData(u_int8_t* pDest) {
+		// no-op
+	}
+};
+
+class MP4RtpImmediateData : public MP4RtpData {
+public:
+	MP4RtpImmediateData(MP4RtpPacket* pPacket);
+
+	void Set(const u_int8_t* pBytes, u_int8_t numBytes);
+
+	u_int16_t GetDataSize();
+
+	void GetData(u_int8_t* pDest);
+};
+
+class MP4RtpSampleData : public MP4RtpData {
+public:
+	MP4RtpSampleData(MP4RtpPacket* pPacket);
+
+	void SetEmbeddedImmediate(
+		MP4SampleId sampleId, 
+		u_int8_t* pData, u_int16_t dataLength);
+
+	void SetReferenceSample(
+		MP4SampleId refSampleId, u_int32_t refSampleOffset, 
+		u_int16_t sampleLength);
+
+	void SetEmbeddedSample(
+		MP4SampleId sampleId, MP4Track* pRefTrack, 
+		MP4SampleId refSampleId, u_int32_t refSampleOffset, 
+		u_int16_t sampleLength);
+
+	u_int16_t GetDataSize();
+
+	void GetData(u_int8_t* pDest);
+
+	void WriteEmbeddedData(MP4File* pFile, u_int64_t startPos);
+
+protected:
+	u_int8_t*		m_pRefData;
+
+	MP4Track*		m_pRefTrack;
+	MP4SampleId		m_refSampleId;
+	u_int32_t		m_refSampleOffset;
+};
+
+class MP4RtpSampleDescriptionData : public MP4RtpData {
+public:
+	MP4RtpSampleDescriptionData(MP4RtpPacket* pPacket);
+
+	void Set(u_int32_t sampleDescrIndex,
+		u_int32_t offset, u_int16_t length);
+
+	u_int16_t GetDataSize();
+
+	void GetData(u_int8_t* pDest);
+};
+
+class MP4RtpPacket : public MP4Container {
+public:
+	MP4RtpPacket(MP4RtpHint* pHint);
+
+	~MP4RtpPacket();
+
+	void AddExtraProperties();
+
+	MP4RtpHint* GetHint() {
+		return m_pHint;
+	}
+
+	void Set(u_int8_t payloadNumber, u_int32_t packetId, bool setMbit);
+
+	int32_t GetTransmitOffset();
+
+	bool GetPBit();
+
+	bool GetXBit();
+
+	bool GetMBit();
+
+	u_int8_t GetPayload();
+
+	u_int16_t GetSequenceNumber();
+
+	void SetTransmitOffset(int32_t transmitOffset);
+
+	bool IsBFrame();
+
+	void SetBFrame(bool isBFrame);
+
+	void SetTimestampOffset(u_int32_t timestampOffset);
+
+	void AddData(MP4RtpData* pData);
+
+	u_int32_t GetDataSize();
+
+	void GetData(u_int8_t* pDest);
+
+	void Read(MP4File* pFile);
+
+	void ReadExtra(MP4File* pFile);
+
+	void Write(MP4File* pFile);
+
+	void WriteEmbeddedData(MP4File* pFile, u_int64_t startPos);
+
+	void Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits);
+
+protected:
+	MP4RtpHint*			m_pHint;
+	MP4RtpDataArray		m_rtpData;
+};
+
+MP4ARRAY_DECL(MP4RtpPacket, MP4RtpPacket*)
+
+class MP4RtpHint : public MP4Container {
+public:
+	MP4RtpHint(MP4RtpHintTrack* pTrack);
+
+	~MP4RtpHint();
+
+	MP4RtpHintTrack* GetTrack() {
+		return m_pTrack;
+	}
+
+	u_int16_t GetNumberOfPackets() {
+		return m_rtpPackets.Size();
+	}
+
+	bool IsBFrame() {
+		return m_isBFrame;
+	}
+	void SetBFrame(bool isBFrame) {
+		m_isBFrame = isBFrame;
+	}
+
+	u_int32_t GetTimestampOffset() {
+		return m_timestampOffset;
+	}
+	void SetTimestampOffset(u_int32_t timestampOffset) {
+		m_timestampOffset = timestampOffset;
+	}
+
+	MP4RtpPacket* AddPacket();
+
+	MP4RtpPacket* GetPacket(u_int16_t index) {
+		return m_rtpPackets[index];
+	}
+
+	MP4RtpPacket* GetCurrentPacket() {
+		if (m_rtpPackets.Size() == 0) {
+			return NULL;
+		}
+		return m_rtpPackets[m_rtpPackets.Size() - 1];
+	}
+
+	void Read(MP4File* pFile);
+
+	void Write(MP4File* pFile);
+
+	void Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits);
+
+protected:
+	MP4RtpHintTrack*	m_pTrack;
+	MP4RtpPacketArray	m_rtpPackets;
+
+	// values when adding packets to a hint (write mode)
+	bool 				m_isBFrame;
+	u_int32_t 			m_timestampOffset;
+};
+
+class MP4RtpHintTrack : public MP4Track {
+public:
+	MP4RtpHintTrack(MP4File* pFile, MP4Atom* pTrakAtom);
+
+	~MP4RtpHintTrack();
+
+	void InitRefTrack();
+
+	void InitPayload();
+
+	void InitRtpStart();
+
+	void InitStats();
+
+	MP4Track* GetRefTrack() {
+		InitRefTrack();
+		return m_pRefTrack;
+	}
+
+	void GetPayload(
+		char** ppPayloadName = NULL,
+		u_int8_t* pPayloadNumber = NULL,
+		u_int16_t* pMaxPayloadSize = NULL,
+		char **ppEncodingParams = NULL);
+
+	void SetPayload(
+		const char* payloadName,
+		u_int8_t payloadNumber,
+		u_int16_t maxPayloadSize,
+		const char *encoding_parms);
+
+	void ReadHint(
+		MP4SampleId hintSampleId,
+		u_int16_t* pNumPackets = NULL);
+
+	u_int16_t GetHintNumberOfPackets();
+
+	bool GetPacketBFrame(u_int16_t packetIndex);
+
+	u_int16_t GetPacketTransmitOffset(u_int16_t packetIndex);
+
+	void ReadPacket(
+		u_int16_t packetIndex,
+		u_int8_t** ppBytes, 
+		u_int32_t* pNumBytes,
+		u_int32_t ssrc,
+		bool includeHeader = true,
+		bool includePayload = true);
+
+	MP4Timestamp GetRtpTimestampStart();
+
+	void SetRtpTimestampStart(MP4Timestamp start);
+
+	void AddHint(bool isBFrame, u_int32_t timestampOffset);
+
+	void AddPacket(bool setMbit, int32_t transmitOffset = 0);
+
+	void AddImmediateData(const u_int8_t* pBytes, u_int32_t numBytes);
+
+	void AddSampleData(MP4SampleId sampleId,
+		 u_int32_t dataOffset, u_int32_t dataLength);
+
+	void AddESConfigurationPacket();
+
+	void WriteHint(MP4Duration duration, bool isSyncSample);
+
+	void FinishWrite();
+
+protected:
+	MP4Track*	m_pRefTrack;
+
+	MP4StringProperty*		m_pRtpMapProperty;
+	MP4Integer32Property*	m_pPayloadNumberProperty;
+	MP4Integer32Property*	m_pMaxPacketSizeProperty;
+	MP4Integer32Property*	m_pSnroProperty;
+	MP4Integer32Property*	m_pTsroProperty;
+	u_int32_t				m_rtpSequenceStart;
+	u_int32_t				m_rtpTimestampStart;
+
+	// reading
+	MP4RtpHint*	m_pReadHint;
+	u_int8_t*	m_pReadHintSample;
+	u_int32_t	m_readHintSampleSize;
+	MP4Timestamp m_readHintTimestamp;
+
+	// writing
+	MP4RtpHint*	m_pWriteHint;
+	MP4SampleId	m_writeHintId;
+	u_int32_t	m_writePacketId;
+
+	// statistics
+	// in trak.udta.hinf
+	MP4Integer64Property*	m_pTrpy;
+	MP4Integer64Property*	m_pNump;
+	MP4Integer64Property*	m_pTpyl;
+	MP4Integer32Property*	m_pMaxr;
+	MP4Integer64Property*	m_pDmed;
+	MP4Integer64Property*	m_pDimm;
+	MP4Integer32Property*	m_pPmax;
+	MP4Integer32Property*	m_pDmax;
+
+	// in trak.mdia.minf.hmhd
+	MP4Integer16Property*	m_pMaxPdu;
+	MP4Integer16Property*	m_pAvgPdu;
+	MP4Integer32Property*	m_pMaxBitRate;
+	MP4Integer32Property*	m_pAvgBitRate;
+
+	MP4Timestamp			m_thisSec;
+	u_int32_t				m_bytesThisSec;
+	u_int32_t				m_bytesThisHint;
+	u_int32_t				m_bytesThisPacket;
+};
+
+#endif /* __RTPHINT_INCLUDED__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/libmp4v2/win32_ver.h	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,2 @@
+#define PACKAGE "mpeg4ip"
+#define VERSION "0.9.5"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/src/Makefile.am	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,6 @@
+libdir = `xmms-config --input-plugin-dir`
+lib_LTLIBRARIES = libmp4.la
+libmp4_la_CFLAGS = -I$(top_srcdir)/libmp4v2 -I$(top_srcdir)/include `xmms-config --cflags` -DHAVE_GLIB_H=1
+libmp4_la_LDFLAGS = -module -avoid-version `xmms-config --libs` -lpthread -lstdc++
+libmp4_la_LIBADD = $(top_builddir)/libfaad2/libfaad.la $(top_builddir)/libmp4v2/libmp4v2.la
+libmp4_la_SOURCES = libmp4.c mp4_utils.c aac_utils.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/src/aac_utils.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,103 @@
+/*
+ *
+ * utils for AAC informations
+*/
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+#define ADTS_HEADER_SIZE        8
+#define SEEK_TABLE_CHUNK        60
+#define MPEG4_TYPE              0
+#define MPEG2_TYPE              1
+
+// Read ADTS header, the file descriptor must be at
+// the begining of the aac frame not at the id3tag
+
+int	getAacInfo(FILE *fd)
+{
+  unsigned char	header[ADTS_HEADER_SIZE];
+  unsigned int	id;
+  unsigned long	originPosition;
+  
+  originPosition = ftell(fd);
+  if(fread(header, 1, ADTS_HEADER_SIZE, fd) != ADTS_HEADER_SIZE){
+    fseek(fd, originPosition, SEEK_SET);
+    return(-1);
+  }
+  if(!((header[0]==0xFF)&&((header[1]& 0xF6)==0xF0))){
+    printf("Bad header\n");
+    return(-1);
+  }
+  id = header[1]&0x08;
+  if(id==0){//MPEG-4 AAC
+    fseek(fd, originPosition, SEEK_SET);
+    return(MPEG4_TYPE);
+  }else{
+    fseek(fd, originPosition, SEEK_SET);
+    return(MPEG2_TYPE);
+  }
+  fseek(fd, originPosition, SEEK_SET);
+  return(-1);
+}
+
+// as AAC is VBR we need to check all ADTS header
+// to enable seeking...
+// there is no other solution
+void	checkADTSForSeeking(FILE *fd,
+			    unsigned long **seekTable,
+			    unsigned long *seekTableLength)
+{
+  unsigned long	originPosition;
+  unsigned long	position;
+  unsigned char	header[ADTS_HEADER_SIZE];
+  unsigned int	frameCount, frameLength, frameInsec;
+  unsigned int	id=0, seconds=0;
+
+  originPosition = ftell(fd);
+
+  for(frameCount=0,frameInsec=0;; frameCount++,frameInsec++){
+    position = ftell(fd);
+    if(fread(header, 1, ADTS_HEADER_SIZE, fd)!=ADTS_HEADER_SIZE){
+      break;
+    }
+    if(!strncmp(header, "ID3", 3)){
+      break;
+    }
+    if(!((header[0]==0xFF)&&((header[1]& 0xF6)==0xF0))){
+      printf("error : Bad 1st header, file may be corrupt !\n");
+      break;
+    }
+    if(!frameCount){
+      id=header[1]&0x08;
+      if(((*seekTable) = malloc(SEEK_TABLE_CHUNK * sizeof(unsigned long)))==0){
+	printf("malloc error\n");
+	return;
+      }
+      (*seekTableLength) = SEEK_TABLE_CHUNK;
+    }
+
+    //if(id==0){//MPEG-4
+    //frameLength = ((unsigned int)header[4]<<5)|((unsigned int)header[5]>>3);
+    //}else{//MPEG-2
+      frameLength = (((unsigned int)header[3]&0x3)<<11)|((unsigned int)header[4]<<3)|(header[5]>>5);
+      //}
+    if(frameInsec==43){//???
+      frameInsec=0;
+    }
+    if(frameInsec==0){
+      if(seconds == (*seekTableLength)){
+	(*seekTable) = realloc((*seekTable), (seconds+SEEK_TABLE_CHUNK)*sizeof(unsigned long));
+	(*seekTableLength) = seconds+SEEK_TABLE_CHUNK;
+      }
+      (*seekTable)[seconds] = position;
+      seconds++;
+    }
+    if(fseek(fd, frameLength-ADTS_HEADER_SIZE, SEEK_CUR)==-1){
+      break;
+    } 
+  }
+  (*seekTableLength) = seconds;
+  fseek(fd, originPosition, SEEK_SET);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/src/libmp4.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,506 @@
+/*
+ * MP4/AAC decoder for xmms
+ *
+ * This decoding source code is completly independent of the faad2
+ * package.
+ * This package exist for people who don't want to install
+ * faad2 and mpeg4ip project files.
+ *
+ * OPTIONNAL need
+ * --------------
+ * libid3 (3.8.x - www.id3.org)
+*/
+
+#include <pthread.h>
+#include <gtk/gtk.h>
+#include "faad.h"
+#include "mp4.h"
+
+#include <xmms/plugin.h>
+#include <xmms/util.h>
+#include <xmms/configfile.h>
+#include <xmms/titlestring.h>
+
+#define MP4_DESCRIPTION	"MP4 & MPEG2/4-AAC audio player - 1.2.x"
+#define MP4_VERSION	"ver. 0.4 - 24 November 2003"
+#define LIBMP4V2_VERSION "0.9.7"
+#define MP4_ABOUT	"Written by ciberfred"
+#define BUFFER_SIZE	FAAD_MIN_STREAMSIZE*64
+
+static void	mp4_init(void);
+static void	mp4_about(void);
+static void	mp4_play(char *);
+static void	mp4_stop(void);
+static void	mp4_pause(short);
+static void	mp4_seek(int);
+static int	mp4_getTime(void);
+static void	mp4_cleanup(void);
+static void	mp4_getSongInfo(char *);
+static int	mp4_isFile(char *);
+static void*	mp4Decode(void *);
+
+InputPlugin mp4_ip =
+  {
+    0,	// handle
+    0,	// filename
+    MP4_DESCRIPTION,
+    mp4_init,
+    mp4_about,
+    0,	// configuration
+    mp4_isFile,
+    0,	//scandir
+    mp4_play,
+    mp4_stop,
+    mp4_pause,
+    mp4_seek,
+    0,	// set equalizer
+    mp4_getTime,
+    0,	// get volume
+    0,
+    mp4_cleanup,
+    0,	// obsolete
+    0,	// send visualisation data
+    0,	// set player window info
+    0,	// set song title text
+    0,	// get song title text
+    mp4_getSongInfo, // info box
+    0,	// to output plugin
+  };
+
+typedef struct  _mp4cfg{
+  gshort        file_type;
+#define FILE_UNKNOW     0
+#define FILE_MP4        1
+#define FILE_AAC        2
+}               Mp4Config;
+
+static Mp4Config	mp4cfg;
+static gboolean		bPlaying = FALSE;
+static pthread_t	decodeThread;
+static pthread_mutex_t	mutex = PTHREAD_MUTEX_INITIALIZER;
+static int		seekPosition = -1;
+
+
+InputPlugin *get_iplugin_info(void)
+{
+  return(&mp4_ip);
+}
+
+static void mp4_init(void)
+{
+  memset(&decodeThread, 0, sizeof(pthread_t));
+  mp4cfg.file_type = FILE_UNKNOW;
+  seekPosition = -1;
+  return;
+}
+
+static void mp4_play(char *filename)
+{
+  bPlaying = TRUE;
+  pthread_create(&decodeThread, 0, mp4Decode, g_strdup(filename));
+  return;
+}
+
+static void mp4_stop(void)
+{
+  if(bPlaying){
+    bPlaying = FALSE;
+    pthread_join(decodeThread, NULL);
+    memset(&decodeThread, 0, sizeof(pthread_t));
+    mp4_ip.output->close_audio();
+  }
+}
+
+static int	mp4_isFile(char *filename)
+{
+  if(filename){
+    gchar*	extention;
+
+    extention = strrchr(filename, '.');
+    if (extention &&
+	!strcasecmp(extention, ".mp4") ||	// official extention
+	!strcasecmp(extention, ".m4a") ||	// Apple mp4 extention
+	!strcasecmp(extention, ".aac")		// old MPEG2/4-AAC extention
+	){
+      return (1);
+    }
+  }
+  return(0);
+}
+
+static void	mp4_about(void)
+{
+  static GtkWidget *aboutbox;
+
+  if(aboutbox!=NULL)
+    return;
+  aboutbox = xmms_show_message("About MP4 AAC player plugin",
+			       "libfaad2-" FAAD2_VERSION "\n"
+			       "libmp4v2-" LIBMP4V2_VERSION "\n"
+			       "plugin version: " MP4_VERSION "\n"
+			       MP4_ABOUT,
+			       "Ok", FALSE, NULL, NULL);
+  gtk_signal_connect(GTK_OBJECT(aboutbox), "destroy",
+                     GTK_SIGNAL_FUNC(gtk_widget_destroyed),
+                     &aboutbox);
+}
+
+static void	mp4_pause(short flag)
+{
+  mp4_ip.output->pause(flag);
+}
+
+static void	mp4_seek(int time)
+{
+  seekPosition = time;
+  while(bPlaying && seekPosition!=-1)
+    xmms_usleep(10000);
+}
+
+static int	mp4_getTime(void)
+{
+  if(!bPlaying)
+    return (-1);
+  else
+    return (mp4_ip.output->output_time());
+}
+
+static void	mp4_cleanup(void)
+{
+}
+
+static void	mp4_getSongInfo(char *filename)
+{
+  if(mp4cfg.file_type == FILE_MP4)
+    getMP4info(filename);
+  else if(mp4cfg.file_type == FILE_AAC)
+    ;
+}
+
+static void *mp4Decode(void *args)
+{
+  MP4FileHandle mp4file;
+
+  pthread_mutex_lock(&mutex);
+  seekPosition = -1;
+  bPlaying = TRUE;
+  if(!(mp4file = MP4Read(args, 0))){
+    mp4cfg.file_type = FILE_AAC;
+    MP4Close(mp4file);
+  }else{
+    mp4cfg.file_type = FILE_MP4;
+  }
+
+  if(mp4cfg.file_type == FILE_MP4){
+    // We are reading a MP4 file
+    gint		mp4track;
+
+    if((mp4track = getAACTrack(mp4file)) < 0){
+      //TODO: check here for others Audio format.....
+      g_print("Unsupported Audio track type\n");
+      g_free(args);
+      MP4Close(mp4file);
+      bPlaying = FALSE;
+      pthread_mutex_unlock(&mutex);
+      pthread_exit(NULL);
+    }else{
+      faacDecHandle	decoder;
+      unsigned char	*buffer	= NULL;
+      guint		bufferSize = 0;
+      gulong		samplerate;
+      guchar		channels;
+      guint		avgBitrate;
+      MP4Duration	duration;
+      gulong		msDuration;
+      MP4SampleId	numSamples;
+      MP4SampleId	sampleID = 1;
+
+      decoder = faacDecOpen();
+      MP4GetTrackESConfiguration(mp4file, mp4track, &buffer, &bufferSize);
+      if(!buffer){
+	g_free(args);
+	faacDecClose(decoder);
+	MP4Close(mp4file);
+	bPlaying = FALSE;
+	pthread_mutex_unlock(&mutex);
+	pthread_exit(NULL);
+      }
+      if(faacDecInit2(decoder, buffer, bufferSize, &samplerate, &channels)<0){
+	g_free(args);
+	faacDecClose(decoder);
+	MP4Close(mp4file);
+	bPlaying = FALSE;
+	pthread_mutex_unlock(&mutex);
+	pthread_exit(NULL);
+      }
+      g_free(buffer);
+      if(channels == 0){
+	g_print("Number of Channels not supported\n");
+	g_free(args);
+	faacDecClose(decoder);
+	MP4Close(mp4file);
+	bPlaying = FALSE;
+	pthread_mutex_unlock(&mutex);
+	pthread_exit(NULL);
+      }
+      duration = MP4GetTrackDuration(mp4file, mp4track);
+      msDuration = MP4ConvertFromTrackDuration(mp4file, mp4track, duration,
+					       MP4_MSECS_TIME_SCALE);
+      numSamples = MP4GetTrackNumberOfSamples(mp4file, mp4track);
+      mp4_ip.output->open_audio(FMT_S16_NE, samplerate, channels);
+      mp4_ip.output->flush(0);
+      mp4_ip.set_info(args, msDuration, -1, samplerate/1000, channels);
+      g_print("MP4 - %d channels @ %d Hz\n", channels, samplerate);
+
+      while(bPlaying){
+	void*			sampleBuffer;
+	faacDecFrameInfo	frameInfo;    
+	gint			rc;
+
+	if(seekPosition!=-1){
+	  duration = MP4ConvertToTrackDuration(mp4file,
+					       mp4track,
+					       seekPosition*1000,
+					       MP4_MSECS_TIME_SCALE);
+	  sampleID = MP4GetSampleIdFromTime(mp4file, mp4track, duration, 0);
+	  mp4_ip.output->flush(seekPosition*1000);
+	  seekPosition = -1;
+	}
+	buffer=NULL;
+	bufferSize=0;
+	if(sampleID > numSamples){
+	  mp4_ip.output->close_audio();
+	  g_free(args);
+	  faacDecClose(decoder);
+	  MP4Close(mp4file);
+	  bPlaying = FALSE;
+	  pthread_mutex_unlock(&mutex);
+	  pthread_exit(NULL);
+	}
+	rc = MP4ReadSample(mp4file, mp4track, sampleID++, &buffer, &bufferSize,
+			   NULL, NULL, NULL, NULL);
+	//g_print("%d/%d\n", sampleID-1, numSamples);
+	if((rc==0) || (buffer== NULL)){
+	  g_print("MP4: read error\n");
+	  sampleBuffer = NULL;
+	  sampleID=0;
+	  mp4_ip.output->buffer_free();
+	  mp4_ip.output->close_audio();
+	  g_free(args);
+	  faacDecClose(decoder);
+	  MP4Close(mp4file);
+	  bPlaying = FALSE;
+	  pthread_mutex_unlock(&mutex);
+	  pthread_exit(NULL);
+	}else{
+	  sampleBuffer = faacDecDecode(decoder, &frameInfo, buffer, bufferSize);
+	  if(frameInfo.error > 0){
+	    g_print("MP4: %s\n",
+		    faacDecGetErrorMessage(frameInfo.error));
+	    mp4_ip.output->close_audio();
+	    g_free(args);
+	    faacDecClose(decoder);
+	    MP4Close(mp4file);
+	    bPlaying = FALSE;
+	    pthread_mutex_unlock(&mutex);
+	    pthread_exit(NULL);
+	  }
+	  if(buffer){
+	    g_free(buffer); buffer=NULL; bufferSize=0;
+	  }
+	  while(bPlaying && mp4_ip.output->buffer_free()<frameInfo.samples<<1)
+	    xmms_usleep(30000);
+	}
+	mp4_ip.add_vis_pcm(mp4_ip.output->written_time(),
+			   FMT_S16_NE,
+			   channels,
+			   frameInfo.samples<<1,
+			   sampleBuffer);
+	mp4_ip.output->write_audio(sampleBuffer, frameInfo.samples<<1);
+      }
+      while(bPlaying && mp4_ip.output->buffer_free()){
+	xmms_usleep(10000);
+      }
+      mp4_ip.output->close_audio();
+      g_free(args);
+      faacDecClose(decoder);
+      MP4Close(mp4file);
+      bPlaying = FALSE;
+      pthread_mutex_unlock(&mutex);
+      pthread_exit(NULL);
+    }
+  } else{
+    // WE ARE READING AN AAC FILE
+    FILE		*file = NULL;
+    faacDecHandle	decoder = 0;
+    guchar		*buffer = 0;
+    gulong		bufferconsumed = 0;
+    gulong		samplerate = 0;
+    guchar		channels;
+    gulong		buffervalid = 0;
+    TitleInput*		input;
+    gchar		*temp = g_strdup(args);
+    gchar		*ext  = strrchr(temp, '.');
+    gchar		*xmmstitle = NULL;
+    faacDecConfigurationPtr config;
+
+    if((file = fopen(args, "rb")) == 0){
+      g_print("AAC: can't find file %s\n", args);
+      bPlaying = FALSE;
+      pthread_mutex_unlock(&mutex);
+      pthread_exit(NULL);
+    }
+    if((decoder = faacDecOpen()) == NULL){
+      g_print("AAC: Open Decoder Error\n");
+      fclose(file);
+      bPlaying = FALSE;
+      pthread_mutex_unlock(&mutex);
+      pthread_exit(NULL);
+    }
+    config = faacDecGetCurrentConfiguration(decoder);
+    config->useOldADTSFormat = 0;
+    faacDecSetConfiguration(decoder, config);
+    if((buffer = g_malloc(BUFFER_SIZE)) == NULL){
+      g_print("AAC: error g_malloc\n");
+      fclose(file);
+      bPlaying = FALSE;
+      faacDecClose(decoder);
+      pthread_mutex_unlock(&mutex);
+      pthread_exit(NULL);
+    }
+    if((buffervalid = fread(buffer, 1, BUFFER_SIZE, file))==0){
+      g_print("AAC: Error reading file\n");
+      g_free(buffer);
+      fclose(file);
+      bPlaying = FALSE;
+      faacDecClose(decoder);
+      pthread_mutex_unlock(&mutex);
+      pthread_exit(NULL);
+    }
+    XMMS_NEW_TITLEINPUT(input);
+    input->file_name = g_basename(temp);
+    input->file_ext = ext ? ext+1 : NULL;
+    input->file_path = temp;
+    if(!strncmp(buffer, "ID3", 3)){
+      gint size = 0;
+
+      fseek(file, 0, SEEK_SET);
+      size = (buffer[6]<<21) | (buffer[7]<<14) | (buffer[8]<<7) | buffer[9];
+      size+=10;
+      fread(buffer, 1, size, file);
+      buffervalid = fread(buffer, 1, BUFFER_SIZE, file);
+    }
+    xmmstitle = xmms_get_titlestring(xmms_get_gentitle_format(), input);
+    if(xmmstitle == NULL)
+      xmmstitle = g_strdup(input->file_name);
+    if(temp) g_free(temp);
+    if(input->performer) g_free(input->performer);
+    if(input->album_name) g_free(input->album_name);
+    if(input->track_name) g_free(input->track_name);
+    if(input->genre) g_free(input->genre);
+    g_free(input);
+    bufferconsumed = faacDecInit(decoder,
+				 buffer,
+				 buffervalid,
+				 &samplerate,
+				 &channels);
+    if(mp4_ip.output->open_audio(FMT_S16_NE,samplerate,channels) == FALSE){
+      g_print("AAC: Output Error\n");
+      g_free(buffer); buffer=0;
+      faacDecClose(decoder);
+      fclose(file);
+      mp4_ip.output->close_audio();
+      /*
+      if(positionTable){
+	g_free(positionTable); positionTable=0;
+      }
+      */
+      g_free(xmmstitle);
+      bPlaying = FALSE;
+      pthread_mutex_unlock(&mutex);
+      pthread_exit(NULL);
+    }
+    //if(bSeek){
+    //mp4_ip.set_info(xmmstitle, lenght*1000, -1, samplerate, channels);
+      //}else{
+    mp4_ip.set_info(xmmstitle, -1, -1, samplerate, channels);
+      //}
+    mp4_ip.output->flush(0);
+
+    while(bPlaying && buffervalid > 0){
+      faacDecFrameInfo	finfo;
+      unsigned long	samplesdecoded;
+      char*		sample_buffer = NULL;
+      /*
+	if(bSeek && seekPosition!=-1){
+	fseek(file, positionTable[seekPosition], SEEK_SET);
+	bufferconsumed=0;
+	buffervalid = fread(buffer, 1, BUFFER_SIZE, file);
+	aac_ip.output->flush(seekPosition*1000);
+	seekPosition=-1;
+	}
+      */
+      if(bufferconsumed > 0){
+	memmove(buffer, &buffer[bufferconsumed], buffervalid-bufferconsumed);
+	buffervalid -= bufferconsumed;
+	buffervalid += fread(&buffer[buffervalid], 1,
+			     BUFFER_SIZE-buffervalid, file);
+	bufferconsumed = 0;
+      }
+      sample_buffer = faacDecDecode(decoder, &finfo, buffer, buffervalid);
+      if(finfo.error){
+	config = faacDecGetCurrentConfiguration(decoder);
+	if(config->useOldADTSFormat != 1){
+	  faacDecClose(decoder);
+	  decoder = faacDecOpen();
+	  config = faacDecGetCurrentConfiguration(decoder);
+	  config->useOldADTSFormat = 1;
+	  faacDecSetConfiguration(decoder, config);
+	  finfo.bytesconsumed=0;
+	  finfo.samples = 0;
+	  faacDecInit(decoder,
+		      buffer,
+		      buffervalid,
+		      &samplerate,
+		      &channels);
+	}else{
+	  g_print("FAAD2 Warning %s\n", faacDecGetErrorMessage(finfo.error));
+	  buffervalid = 0;
+	}
+      }
+      bufferconsumed += finfo.bytesconsumed;
+      samplesdecoded = finfo.samples;
+      if((samplesdecoded<=0) && !sample_buffer){
+	g_print("AAC: error sample decoding\n");
+	continue;
+      }
+      while(bPlaying && mp4_ip.output->buffer_free() < (samplesdecoded<<1)){
+	xmms_usleep(10000);
+      }
+      mp4_ip.add_vis_pcm(mp4_ip.output->written_time(),
+			 FMT_S16_LE, channels,
+			 samplesdecoded<<1, sample_buffer);
+      mp4_ip.output->write_audio(sample_buffer, samplesdecoded<<1);
+    }
+    while(bPlaying && mp4_ip.output->buffer_playing()){
+      xmms_usleep(10000);
+    }
+    mp4_ip.output->buffer_free();
+    mp4_ip.output->close_audio();
+    bPlaying = FALSE;
+    g_free(buffer);
+    faacDecClose(decoder);
+    g_free(xmmstitle);
+    fclose(file);
+    seekPosition = -1;
+    /*
+    if(positionTable){
+      g_free(positionTable); positionTable=0;
+    }
+    */
+    bPlaying = FALSE;
+    pthread_mutex_unlock(&mutex);
+    pthread_exit(NULL);
+    
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/aac/src/mp4_utils.c	Mon Oct 24 10:44:27 2005 -0700
@@ -0,0 +1,151 @@
+/*
+** some function for MP4 file based on libmp4v2 from mpeg4ip project
+*/
+#include <mp4.h>
+#include <faad.h>
+
+const char *mp4AudioNames[]=
+  {
+    "MPEG-1 Audio Layers 1,2 or 3",
+    "MPEG-2 low biterate (MPEG-1 extension) - MP3",
+    "MPEG-2 AAC Main Profile",
+    "MPEG-2 AAC Low Complexity profile",
+    "MPEG-2 AAC SSR profile",
+    "MPEG-4 audio (MPEG-4 AAC)",
+    0
+  };
+
+const u_int8_t mp4AudioTypes[] =
+  {
+    MP4_MPEG1_AUDIO_TYPE,		// 0x6B
+    MP4_MPEG2_AUDIO_TYPE,		// 0x69
+    MP4_MPEG2_AAC_MAIN_AUDIO_TYPE,	// 0x66
+    MP4_MPEG2_AAC_LC_AUDIO_TYPE,	// 0x67
+    MP4_MPEG2_AAC_SSR_AUDIO_TYPE,	// 0x68
+    MP4_MPEG4_AUDIO_TYPE,		// 0x40
+    0
+  };
+
+/* MPEG-4 Audio types from 14496-3 Table 1.5.1 (from mp4.h)*/
+const char *mpeg4AudioNames[]=
+  {
+    "!!!!MPEG-4 Audio track Invalid !!!!!!!",
+    "MPEG-4 AAC Main profile",
+    "MPEG-4 AAC Low Complexity profile",
+    "MPEG-4 AAC SSR profile",
+    "MPEG-4 AAC Long Term Prediction profile",
+    "MPEG-4 AAC Scalable",
+    "MPEG-4 CELP",
+    "MPEG-4 HVXC",
+    "MPEG-4 Text To Speech",
+    "MPEG-4 Main Synthetic profile",
+    "MPEG-4 Wavetable Synthesis profile",
+    "MPEG-4 MIDI Profile",
+    "MPEG-4 Algorithmic Synthesis and Audio FX profile"
+  };
+
+int getAACTrack(MP4FileHandle file)
+{
+  int numTracks = MP4GetNumberOfTracks(file, NULL, 0);
+  int i=0;
+
+  for(i=0;i<numTracks;i++){
+    MP4TrackId trackID = MP4FindTrackId(file, i, NULL, 0);
+    const char *trackType = MP4GetTrackType(file, trackID);
+    if(!strcmp(trackType, MP4_AUDIO_TRACK_TYPE)){//we found audio track !
+      int j=0;
+      u_int8_t audiotype = MP4GetTrackAudioType(file, trackID);
+      while(mp4AudioTypes[j]){ // what kind of audio is ?
+	if(mp4AudioTypes[j] == audiotype){
+	  if(mp4AudioTypes[j] == MP4_MPEG4_AUDIO_TYPE){//MPEG4 audio ok
+	    audiotype = MP4GetTrackAudioMpeg4Type(file, trackID);
+	    printf("%d-%s\n", audiotype, mpeg4AudioNames[audiotype]);
+	    return (trackID);
+	  }
+	  else{
+	    printf("%s\n", mp4AudioNames[j]);
+	    if (mp4AudioTypes[j]== MP4_MPEG2_AAC_LC_AUDIO_TYPE ||
+		mp4AudioTypes[j]== MP4_MPEG2_AAC_MAIN_AUDIO_TYPE ||
+		mp4AudioTypes[j]== MP4_MPEG2_AAC_SSR_AUDIO_TYPE)
+	      return(trackID);
+	    return(-1);
+	  }
+	}
+	j++;
+      }
+    }
+  }
+    return(-1);
+}
+
+int getAudioTrack(MP4FileHandle file)
+{
+  int numTracks = MP4GetNumberOfTracks(file, NULL,0);
+  int i=0;
+
+  for(i=0;i<numTracks;i++){
+    MP4TrackId trackID = MP4FindTrackId(file, i, NULL, 0);
+    const char *trackType = MP4GetTrackType(file, trackID);
+    if(!strcmp(trackType, MP4_AUDIO_TRACK_TYPE)){
+      return(trackID);
+    }
+  }
+  return(-1);
+}
+
+int getVideoTrack(MP4FileHandle file)
+{
+  int numTracks = MP4GetNumberOfTracks(file, NULL, 0);
+  int i=0;
+
+  for(i=0;i<numTracks; i++){
+    MP4TrackId trackID = MP4FindTrackId(file, i, NULL, 0);
+    const char *trackType = MP4GetTrackType(file, trackID);
+    if(!strcmp(trackType, MP4_VIDEO_TRACK_TYPE)){
+      return (trackID);
+    }
+  }
+  return(-1);
+}
+
+void getMP4info(char* file)
+{
+  MP4FileHandle	mp4file;
+  MP4Duration	trackDuration;
+  int numTracks;
+  int i=0;
+
+  if(!(mp4file = MP4Read(file,0)))
+    return;
+  //MP4Dump(mp4file, 0, 0);
+  numTracks = MP4GetNumberOfTracks(mp4file, NULL, 0);
+  g_print("there are %d track(s)\n", numTracks);
+  for(i=0;i<numTracks;i++){
+    MP4TrackId trackID = MP4FindTrackId(mp4file, i, NULL, 0);
+    const char *trackType = MP4GetTrackType(mp4file, trackID);
+    printf("Track %d, %s", trackID, trackType);
+    if(!strcmp(trackType, MP4_AUDIO_TRACK_TYPE)){//we found audio track !
+      int j=0;
+      u_int8_t audiotype = MP4GetTrackAudioType(mp4file, trackID);
+      while(mp4AudioTypes[j]){ // what kind of audio is ?
+	if(mp4AudioTypes[j] == audiotype){
+	  if(mp4AudioTypes[j] == MP4_MPEG4_AUDIO_TYPE){
+	    audiotype = MP4GetTrackAudioMpeg4Type(mp4file, trackID);
+	    g_print(" %s", mpeg4AudioNames[audiotype]);
+	  }
+	  else{
+	    printf(" %s", mp4AudioNames[j]);
+	  }
+	  g_print(" duration :%d",
+		 MP4ConvertFromTrackDuration(mp4file, trackID,
+					     MP4GetTrackDuration(mp4file,
+								 trackID),
+					     MP4_MSECS_TIME_SCALE));
+	}
+	j++;
+      }
+    }
+    printf("\n");
+  }
+  MP4Close(mp4file);
+}
--- a/Input/cdaudio/Makefile.in	Mon Oct 24 03:12:26 2005 -0700
+++ b/Input/cdaudio/Makefile.in	Mon Oct 24 10:44:27 2005 -0700
@@ -116,7 +116,10 @@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
 CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
 DEFS = @DEFS@
@@ -128,6 +131,8 @@
 EFFECT_PLUGINS = @EFFECT_PLUGINS@
 EFFECT_PLUGIN_DIR = @EFFECT_PLUGIN_DIR@
 EGREP = @EGREP@
+ENABLE_AAC_FALSE = @ENABLE_AAC_FALSE@
+ENABLE_AAC_TRUE = @ENABLE_AAC_TRUE@
 ENABLE_MPG123_FALSE = @ENABLE_MPG123_FALSE@
 ENABLE_MPG123_TRUE = @ENABLE_MPG123_TRUE@
 ESD_CFLAGS = @ESD_CFLAGS@
@@ -231,10 +236,13 @@
 X_PRE_LIBS = @X_PRE_LIBS@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
 ac_ct_RANLIB = @ac_ct_RANLIB@
 ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
--- a/Input/mpg123/Makefile.in	Mon Oct 24 03:12:26 2005 -0700
+++ b/Input/mpg123/Makefile.in	Mon Oct 24 10:44:27 2005 -0700
@@ -148,7 +148,10 @@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
 CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
 DEFS = @DEFS@
@@ -160,6 +163,8 @@
 EFFECT_PLUGINS = @EFFECT_PLUGINS@
 EFFECT_PLUGIN_DIR = @EFFECT_PLUGIN_DIR@
 EGREP = @EGREP@
+ENABLE_AAC_FALSE = @ENABLE_AAC_FALSE@
+ENABLE_AAC_TRUE = @ENABLE_AAC_TRUE@
 ENABLE_MPG123_FALSE = @ENABLE_MPG123_FALSE@
 ENABLE_MPG123_TRUE = @ENABLE_MPG123_TRUE@
 ESD_CFLAGS = @ESD_CFLAGS@
@@ -263,10 +268,13 @@
 X_PRE_LIBS = @X_PRE_LIBS@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
 ac_ct_RANLIB = @ac_ct_RANLIB@
 ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
--- a/Input/vorbis/Makefile.in	Mon Oct 24 03:12:26 2005 -0700
+++ b/Input/vorbis/Makefile.in	Mon Oct 24 10:44:27 2005 -0700
@@ -115,7 +115,10 @@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
 CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
 DEFS = @DEFS@
@@ -127,6 +130,8 @@
 EFFECT_PLUGINS = @EFFECT_PLUGINS@
 EFFECT_PLUGIN_DIR = @EFFECT_PLUGIN_DIR@
 EGREP = @EGREP@
+ENABLE_AAC_FALSE = @ENABLE_AAC_FALSE@
+ENABLE_AAC_TRUE = @ENABLE_AAC_TRUE@
 ENABLE_MPG123_FALSE = @ENABLE_MPG123_FALSE@
 ENABLE_MPG123_TRUE = @ENABLE_MPG123_TRUE@
 ESD_CFLAGS = @ESD_CFLAGS@
@@ -230,10 +235,13 @@
 X_PRE_LIBS = @X_PRE_LIBS@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
 ac_ct_RANLIB = @ac_ct_RANLIB@
 ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
--- a/Input/wav/Makefile.in	Mon Oct 24 03:12:26 2005 -0700
+++ b/Input/wav/Makefile.in	Mon Oct 24 10:44:27 2005 -0700
@@ -111,7 +111,10 @@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
 CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
 DEFS = @DEFS@
@@ -123,6 +126,8 @@
 EFFECT_PLUGINS = @EFFECT_PLUGINS@
 EFFECT_PLUGIN_DIR = @EFFECT_PLUGIN_DIR@
 EGREP = @EGREP@
+ENABLE_AAC_FALSE = @ENABLE_AAC_FALSE@
+ENABLE_AAC_TRUE = @ENABLE_AAC_TRUE@
 ENABLE_MPG123_FALSE = @ENABLE_MPG123_FALSE@
 ENABLE_MPG123_TRUE = @ENABLE_MPG123_TRUE@
 ESD_CFLAGS = @ESD_CFLAGS@
@@ -226,10 +231,13 @@
 X_PRE_LIBS = @X_PRE_LIBS@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
 ac_ct_RANLIB = @ac_ct_RANLIB@
 ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
--- a/Makefile.in	Mon Oct 24 03:12:26 2005 -0700
+++ b/Makefile.in	Mon Oct 24 10:44:27 2005 -0700
@@ -127,7 +127,10 @@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
 CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
 DEFS = @DEFS@
@@ -139,6 +142,8 @@
 EFFECT_PLUGINS = @EFFECT_PLUGINS@
 EFFECT_PLUGIN_DIR = @EFFECT_PLUGIN_DIR@
 EGREP = @EGREP@
+ENABLE_AAC_FALSE = @ENABLE_AAC_FALSE@
+ENABLE_AAC_TRUE = @ENABLE_AAC_TRUE@
 ENABLE_MPG123_FALSE = @ENABLE_MPG123_FALSE@
 ENABLE_MPG123_TRUE = @ENABLE_MPG123_TRUE@
 ESD_CFLAGS = @ESD_CFLAGS@
@@ -242,10 +247,13 @@
 X_PRE_LIBS = @X_PRE_LIBS@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
 ac_ct_RANLIB = @ac_ct_RANLIB@
 ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
--- a/Output/Makefile.in	Mon Oct 24 03:12:26 2005 -0700
+++ b/Output/Makefile.in	Mon Oct 24 10:44:27 2005 -0700
@@ -94,7 +94,10 @@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
 CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
 DEFS = @DEFS@
@@ -106,6 +109,8 @@
 EFFECT_PLUGINS = @EFFECT_PLUGINS@
 EFFECT_PLUGIN_DIR = @EFFECT_PLUGIN_DIR@
 EGREP = @EGREP@
+ENABLE_AAC_FALSE = @ENABLE_AAC_FALSE@
+ENABLE_AAC_TRUE = @ENABLE_AAC_TRUE@
 ENABLE_MPG123_FALSE = @ENABLE_MPG123_FALSE@
 ENABLE_MPG123_TRUE = @ENABLE_MPG123_TRUE@
 ESD_CFLAGS = @ESD_CFLAGS@
@@ -209,10 +214,13 @@
 X_PRE_LIBS = @X_PRE_LIBS@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
 ac_ct_RANLIB = @ac_ct_RANLIB@
 ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
--- a/Output/OSS/Makefile.in	Mon Oct 24 03:12:26 2005 -0700
+++ b/Output/OSS/Makefile.in	Mon Oct 24 10:44:27 2005 -0700
@@ -117,7 +117,10 @@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
 CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
 DEFS = @DEFS@
@@ -129,6 +132,8 @@
 EFFECT_PLUGINS = @EFFECT_PLUGINS@
 EFFECT_PLUGIN_DIR = @EFFECT_PLUGIN_DIR@
 EGREP = @EGREP@
+ENABLE_AAC_FALSE = @ENABLE_AAC_FALSE@
+ENABLE_AAC_TRUE = @ENABLE_AAC_TRUE@
 ENABLE_MPG123_FALSE = @ENABLE_MPG123_FALSE@
 ENABLE_MPG123_TRUE = @ENABLE_MPG123_TRUE@
 ESD_CFLAGS = @ESD_CFLAGS@
@@ -232,10 +237,13 @@
 X_PRE_LIBS = @X_PRE_LIBS@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
 ac_ct_RANLIB = @ac_ct_RANLIB@
 ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
--- a/Output/alsa/Makefile.in	Mon Oct 24 03:12:26 2005 -0700
+++ b/Output/alsa/Makefile.in	Mon Oct 24 10:44:27 2005 -0700
@@ -116,7 +116,10 @@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
 CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
 DEFS = @DEFS@
@@ -128,6 +131,8 @@
 EFFECT_PLUGINS = @EFFECT_PLUGINS@
 EFFECT_PLUGIN_DIR = @EFFECT_PLUGIN_DIR@
 EGREP = @EGREP@
+ENABLE_AAC_FALSE = @ENABLE_AAC_FALSE@
+ENABLE_AAC_TRUE = @ENABLE_AAC_TRUE@
 ENABLE_MPG123_FALSE = @ENABLE_MPG123_FALSE@
 ENABLE_MPG123_TRUE = @ENABLE_MPG123_TRUE@
 ESD_CFLAGS = @ESD_CFLAGS@
@@ -231,10 +236,13 @@
 X_PRE_LIBS = @X_PRE_LIBS@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
 ac_ct_RANLIB = @ac_ct_RANLIB@
 ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
--- a/Output/esd/Makefile.in	Mon Oct 24 03:12:26 2005 -0700
+++ b/Output/esd/Makefile.in	Mon Oct 24 10:44:27 2005 -0700
@@ -118,7 +118,10 @@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
 CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
 DEFS = @DEFS@
@@ -130,6 +133,8 @@
 EFFECT_PLUGINS = @EFFECT_PLUGINS@
 EFFECT_PLUGIN_DIR = @EFFECT_PLUGIN_DIR@
 EGREP = @EGREP@
+ENABLE_AAC_FALSE = @ENABLE_AAC_FALSE@
+ENABLE_AAC_TRUE = @ENABLE_AAC_TRUE@
 ENABLE_MPG123_FALSE = @ENABLE_MPG123_FALSE@
 ENABLE_MPG123_TRUE = @ENABLE_MPG123_TRUE@
 ESD_CFLAGS = @ESD_CFLAGS@
@@ -233,10 +238,13 @@
 X_PRE_LIBS = @X_PRE_LIBS@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
 ac_ct_RANLIB = @ac_ct_RANLIB@
 ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
--- a/Visualization/Makefile.in	Mon Oct 24 03:12:26 2005 -0700
+++ b/Visualization/Makefile.in	Mon Oct 24 10:44:27 2005 -0700
@@ -94,7 +94,10 @@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
 CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
 DEFS = @DEFS@
@@ -106,6 +109,8 @@
 EFFECT_PLUGINS = @EFFECT_PLUGINS@
 EFFECT_PLUGIN_DIR = @EFFECT_PLUGIN_DIR@
 EGREP = @EGREP@
+ENABLE_AAC_FALSE = @ENABLE_AAC_FALSE@
+ENABLE_AAC_TRUE = @ENABLE_AAC_TRUE@
 ENABLE_MPG123_FALSE = @ENABLE_MPG123_FALSE@
 ENABLE_MPG123_TRUE = @ENABLE_MPG123_TRUE@
 ESD_CFLAGS = @ESD_CFLAGS@
@@ -209,10 +214,13 @@
 X_PRE_LIBS = @X_PRE_LIBS@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
 ac_ct_RANLIB = @ac_ct_RANLIB@
 ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
--- a/Visualization/blur_scope/Makefile.in	Mon Oct 24 03:12:26 2005 -0700
+++ b/Visualization/blur_scope/Makefile.in	Mon Oct 24 10:44:27 2005 -0700
@@ -119,7 +119,10 @@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
 CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
 DEFS = @DEFS@
@@ -131,6 +134,8 @@
 EFFECT_PLUGINS = @EFFECT_PLUGINS@
 EFFECT_PLUGIN_DIR = @EFFECT_PLUGIN_DIR@
 EGREP = @EGREP@
+ENABLE_AAC_FALSE = @ENABLE_AAC_FALSE@
+ENABLE_AAC_TRUE = @ENABLE_AAC_TRUE@
 ENABLE_MPG123_FALSE = @ENABLE_MPG123_FALSE@
 ENABLE_MPG123_TRUE = @ENABLE_MPG123_TRUE@
 ESD_CFLAGS = @ESD_CFLAGS@
@@ -234,10 +239,13 @@
 X_PRE_LIBS = @X_PRE_LIBS@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
 ac_ct_RANLIB = @ac_ct_RANLIB@
 ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
--- a/audacious/Makefile.in	Mon Oct 24 03:12:26 2005 -0700
+++ b/audacious/Makefile.in	Mon Oct 24 10:44:27 2005 -0700
@@ -157,7 +157,10 @@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
 CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
 DEFS = @DEFS@
@@ -169,6 +172,8 @@
 EFFECT_PLUGINS = @EFFECT_PLUGINS@
 EFFECT_PLUGIN_DIR = @EFFECT_PLUGIN_DIR@
 EGREP = @EGREP@
+ENABLE_AAC_FALSE = @ENABLE_AAC_FALSE@
+ENABLE_AAC_TRUE = @ENABLE_AAC_TRUE@
 ENABLE_MPG123_FALSE = @ENABLE_MPG123_FALSE@
 ENABLE_MPG123_TRUE = @ENABLE_MPG123_TRUE@
 ESD_CFLAGS = @ESD_CFLAGS@
@@ -272,10 +277,13 @@
 X_PRE_LIBS = @X_PRE_LIBS@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
 ac_ct_RANLIB = @ac_ct_RANLIB@
 ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
@@ -318,7 +326,7 @@
 target_os = @target_os@
 target_vendor = @target_vendor@
 SUBDIRS = glade images
-beepincludedir = $(includedir)/bmp
+beepincludedir = $(includedir)/audacious
 audacious_LDFLAGS = -export-dynamic
 audacious_LDADD = \
 	$(X_LIBS) $(X_PRE_LIBS) -lX11 $(X_EXTRA_LIBS) \
--- a/audacious/glade/Makefile.in	Mon Oct 24 03:12:26 2005 -0700
+++ b/audacious/glade/Makefile.in	Mon Oct 24 10:44:27 2005 -0700
@@ -95,7 +95,10 @@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
 CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
 DEFS = @DEFS@
@@ -107,6 +110,8 @@
 EFFECT_PLUGINS = @EFFECT_PLUGINS@
 EFFECT_PLUGIN_DIR = @EFFECT_PLUGIN_DIR@
 EGREP = @EGREP@
+ENABLE_AAC_FALSE = @ENABLE_AAC_FALSE@
+ENABLE_AAC_TRUE = @ENABLE_AAC_TRUE@
 ENABLE_MPG123_FALSE = @ENABLE_MPG123_FALSE@
 ENABLE_MPG123_TRUE = @ENABLE_MPG123_TRUE@
 ESD_CFLAGS = @ESD_CFLAGS@
@@ -210,10 +215,13 @@
 X_PRE_LIBS = @X_PRE_LIBS@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
 ac_ct_RANLIB = @ac_ct_RANLIB@
 ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
--- a/audacious/images/Makefile.in	Mon Oct 24 03:12:26 2005 -0700
+++ b/audacious/images/Makefile.in	Mon Oct 24 10:44:27 2005 -0700
@@ -95,7 +95,10 @@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
 CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
 DEFS = @DEFS@
@@ -107,6 +110,8 @@
 EFFECT_PLUGINS = @EFFECT_PLUGINS@
 EFFECT_PLUGIN_DIR = @EFFECT_PLUGIN_DIR@
 EGREP = @EGREP@
+ENABLE_AAC_FALSE = @ENABLE_AAC_FALSE@
+ENABLE_AAC_TRUE = @ENABLE_AAC_TRUE@
 ENABLE_MPG123_FALSE = @ENABLE_MPG123_FALSE@
 ENABLE_MPG123_TRUE = @ENABLE_MPG123_TRUE@
 ESD_CFLAGS = @ESD_CFLAGS@
@@ -210,10 +215,13 @@
 X_PRE_LIBS = @X_PRE_LIBS@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
 ac_ct_RANLIB = @ac_ct_RANLIB@
 ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
--- a/configure	Mon Oct 24 03:12:26 2005 -0700
+++ b/configure	Mon Oct 24 10:44:27 2005 -0700
@@ -462,7 +462,7 @@
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar LIBBEEP_MAJOR_VERSION LIBBEEP_MINOR_VERSION LIBBEEP_MICRO_VERSION MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE RANLIB ac_ct_RANLIB CPP EGREP ALLOCA GLIBC21 LIBICONV LTLIBICONV INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT DATADIRNAME INSTOBJEXT GENCAT INTLOBJS INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB CCAS CCASFLAGS LN_S ECHO AR ac_ct_AR CXXCPP LIBTOOL BEEP_PATH BMP_RCPATH EFFECT_PLUGINS GENERAL_PLUGINS INPUT_PLUGINS OUTPUT_PLUGINS VISUALIZATION_PLUGINS X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS PKG_CONFIG GTK_CFLAGS GTK_LIBS PC_REQUIRES LIBGLADE_CFLAGS LIBGLADE_LIBS USE_SIMD_TRUE USE_SIMD_FALSE GCONF_CFLAGS GCONF_LIBS HAVE_GCONF_TRUE HAVE_GCONF_FALSE GNOMEVFS_CFLAGS GNOMEVFS_LIBS HAVE_GNOME_VFS_TRUE HAVE_GNOME_VFS_FALSE ESD_CFLAGS ESD_LIBS HAVE_ESD_TRUE HAVE_ESD_FALSE ENABLE_MPG123_TRUE ENABLE_MPG123_FALSE ID3LIBS OGG_VORBIS_CFLAGS OGG_VORBIS_LIBS HAVE_OGGVORBIS_TRUE HAVE_OGGVORBIS_FALSE HAVE_OSS_TRUE HAVE_OSS_FALSE ALSA_CFLAGS ALSA_LIBS HAVE_ALSA_TRUE HAVE_ALSA_FALSE HAVE_CDROM_TRUE HAVE_CDROM_FALSE HAVE_LINUX_JOYSTICK_TRUE HAVE_LINUX_JOYSTICK_FALSE ARCH_DEFINES ARCH_X86_TRUE ARCH_X86_FALSE USE_X86ASM_TRUE USE_X86ASM_FALSE HAVE_SOLARIS_TRUE HAVE_SOLARIS_FALSE HAVE_SUN_TRUE HAVE_SUN_FALSE plugindir INPUT_PLUGIN_DIR OUTPUT_PLUGIN_DIR EFFECT_PLUGIN_DIR GENERAL_PLUGIN_DIR VISUALIZATION_PLUGIN_DIR pluginsubs localedir BEEP_DEFINES PLUGIN_LDFLAGS beepdir LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar LIBBEEP_MAJOR_VERSION LIBBEEP_MINOR_VERSION LIBBEEP_MICRO_VERSION MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE RANLIB ac_ct_RANLIB CPP EGREP ALLOCA GLIBC21 LIBICONV LTLIBICONV INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT DATADIRNAME INSTOBJEXT GENCAT INTLOBJS INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CCAS CCASFLAGS LN_S ECHO AR ac_ct_AR CXXCPP LIBTOOL BEEP_PATH BMP_RCPATH EFFECT_PLUGINS GENERAL_PLUGINS INPUT_PLUGINS OUTPUT_PLUGINS VISUALIZATION_PLUGINS X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS PKG_CONFIG GTK_CFLAGS GTK_LIBS PC_REQUIRES LIBGLADE_CFLAGS LIBGLADE_LIBS USE_SIMD_TRUE USE_SIMD_FALSE GCONF_CFLAGS GCONF_LIBS HAVE_GCONF_TRUE HAVE_GCONF_FALSE GNOMEVFS_CFLAGS GNOMEVFS_LIBS HAVE_GNOME_VFS_TRUE HAVE_GNOME_VFS_FALSE ESD_CFLAGS ESD_LIBS HAVE_ESD_TRUE HAVE_ESD_FALSE ENABLE_MPG123_TRUE ENABLE_MPG123_FALSE ID3LIBS OGG_VORBIS_CFLAGS OGG_VORBIS_LIBS HAVE_OGGVORBIS_TRUE HAVE_OGGVORBIS_FALSE ENABLE_AAC_TRUE ENABLE_AAC_FALSE HAVE_OSS_TRUE HAVE_OSS_FALSE ALSA_CFLAGS ALSA_LIBS HAVE_ALSA_TRUE HAVE_ALSA_FALSE HAVE_CDROM_TRUE HAVE_CDROM_FALSE HAVE_LINUX_JOYSTICK_TRUE HAVE_LINUX_JOYSTICK_FALSE ARCH_DEFINES ARCH_X86_TRUE ARCH_X86_FALSE USE_X86ASM_TRUE USE_X86ASM_FALSE HAVE_SOLARIS_TRUE HAVE_SOLARIS_FALSE HAVE_SUN_TRUE HAVE_SUN_FALSE plugindir INPUT_PLUGIN_DIR OUTPUT_PLUGIN_DIR EFFECT_PLUGIN_DIR GENERAL_PLUGIN_DIR VISUALIZATION_PLUGIN_DIR pluginsubs localedir BEEP_DEFINES PLUGIN_LDFLAGS beepdir LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -923,6 +923,14 @@
 ac_env_CPP_value=$CPP
 ac_cv_env_CPP_set=${CPP+set}
 ac_cv_env_CPP_value=$CPP
+ac_env_CXX_set=${CXX+set}
+ac_env_CXX_value=$CXX
+ac_cv_env_CXX_set=${CXX+set}
+ac_cv_env_CXX_value=$CXX
+ac_env_CXXFLAGS_set=${CXXFLAGS+set}
+ac_env_CXXFLAGS_value=$CXXFLAGS
+ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set}
+ac_cv_env_CXXFLAGS_value=$CXXFLAGS
 ac_env_CCAS_set=${CCAS+set}
 ac_env_CCAS_value=$CCAS
 ac_cv_env_CCAS_set=${CCAS+set}
@@ -1040,6 +1048,7 @@
   --disable-esd           disable esound output plugin default=enabled
   --disable-mp3           disable mp3 plugin. default=enabled
   --disable-vorbis        disable Ogg Vorbis input plugin (default=enabled)
+  --disable-aac           disable aac plugin. default=enabled
   --disable-oss           disable the OSS output plugin
   --disable-alsa          disable ALSA input plugin (default=enabled)
 
@@ -1073,6 +1082,8 @@
   CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
               headers in a nonstandard directory <include dir>
   CPP         C preprocessor
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
   CCAS        assembler compiler command (defaults to CC)
   CCASFLAGS   assembler compiler flags (defaults to CFLAGS)
   CXXCPP      C++ preprocessor
@@ -7796,6 +7807,477 @@
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  echo "$as_me:$LINENO: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+echo "${ECHO_T}$ac_ct_CXX" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_CXX" && break
+done
+test -n "$ac_ct_CXX" || ac_ct_CXX="g++"
+
+  CXX=$ac_ct_CXX
+fi
+
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+     "checking for C++ compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6
+GXX=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+CXXFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cxx_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cxx_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cxx_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+depcc="$CXX"  am_compiler_list=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CXX_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CXX_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+
+
+if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+  am__fastdepCXX_TRUE=
+  am__fastdepCXX_FALSE='#'
+else
+  am__fastdepCXX_TRUE='#'
+  am__fastdepCXX_FALSE=
+fi
+
+
+
 echo "$as_me:$LINENO: checking for library containing strerror" >&5
 echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6
 if test "${ac_cv_search_strerror+set}" = set; then
@@ -7834,7 +8316,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -7889,7 +8371,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -7957,7 +8439,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -8000,7 +8482,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -8058,7 +8540,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -8289,8 +8771,6 @@
 
 
 
-
-
 # Check whether --enable-static or --disable-static was given.
 if test "${enable_static+set}" = set; then
   enableval="$enable_static"
@@ -8817,7 +9297,7 @@
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 8820 "configure"' > conftest.$ac_ext
+  echo '#line 9300 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -9131,7 +9611,6 @@
 
 
 
-
 if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
     ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
     (test "X$CXX" != "Xg++"))) ; then
@@ -9370,7 +9849,6 @@
 
 
 
-
 # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
 
 # find the maximum length of command line arguments
@@ -10282,11 +10760,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:10285: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:10763: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:10289: \$? = $ac_status" >&5
+   echo "$as_me:10767: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -10525,11 +11003,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:10528: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11006: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:10532: \$? = $ac_status" >&5
+   echo "$as_me:11010: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -10585,11 +11063,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:10588: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11066: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:10592: \$? = $ac_status" >&5
+   echo "$as_me:11070: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -12770,7 +13248,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 12773 "configure"
+#line 13251 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12868,7 +13346,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 12871 "configure"
+#line 13349 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -13481,11 +13959,11 @@
 fi
 
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 CC="$lt_save_CC"
 
@@ -15061,11 +15539,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:15064: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15542: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:15068: \$? = $ac_status" >&5
+   echo "$as_me:15546: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -15121,11 +15599,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:15124: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15602: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:15128: \$? = $ac_status" >&5
+   echo "$as_me:15606: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -16482,7 +16960,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 16485 "configure"
+#line 16963 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -16580,7 +17058,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 16583 "configure"
+#line 17061 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -17083,11 +17561,11 @@
 fi
 
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 CC=$lt_save_CC
 LDCXX=$LD
@@ -17417,11 +17895,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:17420: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:17898: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:17424: \$? = $ac_status" >&5
+   echo "$as_me:17902: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -17477,11 +17955,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:17480: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:17958: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:17484: \$? = $ac_status" >&5
+   echo "$as_me:17962: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -19438,11 +19916,11 @@
 fi
 
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 CC="$lt_save_CC"
 
@@ -19512,11 +19990,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:19515: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:19993: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:19519: \$? = $ac_status" >&5
+   echo "$as_me:19997: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -19755,11 +20233,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:19758: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:20236: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:19762: \$? = $ac_status" >&5
+   echo "$as_me:20240: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -19815,11 +20293,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:19818: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:20296: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:19822: \$? = $ac_status" >&5
+   echo "$as_me:20300: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -20206,7 +20684,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -20267,7 +20745,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -21460,7 +21938,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -21564,7 +22042,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -21630,7 +22108,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -21724,7 +22202,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -21790,7 +22268,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -21857,7 +22335,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -21924,7 +22402,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -22000,7 +22478,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 22003 "configure"
+#line 22481 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -22098,7 +22576,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 22101 "configure"
+#line 22579 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -22601,11 +23079,11 @@
 fi
 
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 CC="$lt_save_CC"
 
@@ -23046,11 +23524,11 @@
 fi
 
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 CC="$lt_save_CC"
 
@@ -23285,6 +23763,7 @@
 
 
 
+
 echo "$as_me:$LINENO: checking for X" >&5
 echo $ECHO_N "checking for X... $ECHO_C" >&6
 
@@ -23399,8 +23878,8 @@
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
   else
     ac_cpp_err=
   fi
@@ -23454,7 +23933,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -23566,7 +24045,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -23618,7 +24097,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -23695,7 +24174,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -23751,7 +24230,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -23820,7 +24299,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -23929,7 +24408,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -23994,7 +24473,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -24063,7 +24542,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -24168,7 +24647,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -24233,7 +24712,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -24331,7 +24810,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -24396,7 +24875,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -24494,7 +24973,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -24559,7 +25038,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -24639,7 +25118,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -24949,7 +25428,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -25442,7 +25921,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -25486,8 +25965,8 @@
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
   else
     ac_cpp_err=
   fi
@@ -25507,7 +25986,7 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
   yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
@@ -25592,7 +26071,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -25662,7 +26141,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -25835,6 +26314,26 @@
 
 
 
+# Check whether --enable-aac or --disable-aac was given.
+if test "${enable_aac+set}" = set; then
+  enableval="$enable_aac"
+  enable_aac=$enableval
+else
+  enable_aac=yes
+
+fi;
+
+
+
+if test "$enable_aac" = "yes"; then
+  ENABLE_AAC_TRUE=
+  ENABLE_AAC_FALSE='#'
+else
+  ENABLE_AAC_TRUE='#'
+  ENABLE_AAC_FALSE=
+fi
+
+
 
 # Check whether --enable-oss or --disable-oss was given.
 if test "${enable_oss+set}" = set; then
@@ -25902,7 +26401,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -25946,8 +26445,8 @@
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
   else
     ac_cpp_err=
   fi
@@ -25967,7 +26466,7 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
   yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
@@ -26052,7 +26551,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -26096,8 +26595,8 @@
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
   else
     ac_cpp_err=
   fi
@@ -26117,7 +26616,7 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
   yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
@@ -26387,7 +26886,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -26431,8 +26930,8 @@
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
   else
     ac_cpp_err=
   fi
@@ -26452,7 +26951,7 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
   yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
@@ -26537,7 +27036,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -26581,8 +27080,8 @@
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
   else
     ac_cpp_err=
   fi
@@ -26602,7 +27101,7 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
   yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
@@ -26687,7 +27186,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -26731,8 +27230,8 @@
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
   else
     ac_cpp_err=
   fi
@@ -26752,7 +27251,7 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
   yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
@@ -26837,7 +27336,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -26881,8 +27380,8 @@
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
   else
     ac_cpp_err=
   fi
@@ -26902,7 +27401,7 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
   yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
@@ -26987,7 +27486,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -27031,8 +27530,8 @@
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
   else
     ac_cpp_err=
   fi
@@ -27052,7 +27551,7 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
   yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
@@ -27137,7 +27636,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -27181,8 +27680,8 @@
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
   else
     ac_cpp_err=
   fi
@@ -27202,7 +27701,7 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
   yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
@@ -27287,7 +27786,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -27331,8 +27830,8 @@
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
   else
     ac_cpp_err=
   fi
@@ -27352,7 +27851,7 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
   yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
@@ -27437,7 +27936,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -27481,8 +27980,8 @@
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
   else
     ac_cpp_err=
   fi
@@ -27502,7 +28001,7 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
   yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
@@ -27587,7 +28086,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -27631,8 +28130,8 @@
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
   else
     ac_cpp_err=
   fi
@@ -27652,7 +28151,7 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
   yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
@@ -27737,7 +28236,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -27781,8 +28280,8 @@
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
   else
     ac_cpp_err=
   fi
@@ -27802,7 +28301,7 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
   yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
@@ -27923,7 +28422,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -28025,7 +28524,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -28127,7 +28626,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
+	 { ac_try='test -z "$ac_cxx_werror_flag"
 			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -28408,7 +28907,7 @@
 
 
 
-                                                                                                                                                                                                                                                ac_config_files="$ac_config_files Makefile audacious.1 audacious.spec audacious.pc audacious/audacious.desktop audacious/Makefile audacious/glade/Makefile audacious/images/Makefile libaudacious/Makefile Output/Makefile Output/OSS/Makefile Output/esd/Makefile Output/alsa/Makefile Input/Makefile Input/mpg123/Makefile Input/vorbis/Makefile Input/cdaudio/Makefile Input/wav/Makefile Visualization/Makefile Visualization/blur_scope/Makefile po/Makefile.in intl/Makefile icons/Makefile skin/Makefile"
+                                                                                                                                                                                                                                                                              ac_config_files="$ac_config_files Makefile audacious.1 audacious.spec audacious.pc audacious/audacious.desktop audacious/Makefile audacious/glade/Makefile audacious/images/Makefile libaudacious/Makefile Output/Makefile Output/OSS/Makefile Output/esd/Makefile Output/alsa/Makefile Input/Makefile Input/mpg123/Makefile Input/aac/Makefile Input/aac/libmp4v2/Makefile Input/aac/libfaad2/Makefile Input/vorbis/Makefile Input/cdaudio/Makefile Input/wav/Makefile Visualization/Makefile Visualization/blur_scope/Makefile po/Makefile.in intl/Makefile icons/Makefile skin/Makefile"
 
 
 cat >confcache <<\_ACEOF
@@ -28516,6 +29015,13 @@
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
 if test -z "${USE_SIMD_TRUE}" && test -z "${USE_SIMD_FALSE}"; then
   { { echo "$as_me:$LINENO: error: conditional \"USE_SIMD\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
@@ -28558,6 +29064,13 @@
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
+if test -z "${ENABLE_AAC_TRUE}" && test -z "${ENABLE_AAC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"ENABLE_AAC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"ENABLE_AAC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
 if test -z "${HAVE_OSS_TRUE}" && test -z "${HAVE_OSS_FALSE}"; then
   { { echo "$as_me:$LINENO: error: conditional \"HAVE_OSS\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
@@ -29080,6 +29593,9 @@
   "Output/alsa/Makefile" ) CONFIG_FILES="$CONFIG_FILES Output/alsa/Makefile" ;;
   "Input/Makefile" ) CONFIG_FILES="$CONFIG_FILES Input/Makefile" ;;
   "Input/mpg123/Makefile" ) CONFIG_FILES="$CONFIG_FILES Input/mpg123/Makefile" ;;
+  "Input/aac/Makefile" ) CONFIG_FILES="$CONFIG_FILES Input/aac/Makefile" ;;
+  "Input/aac/libmp4v2/Makefile" ) CONFIG_FILES="$CONFIG_FILES Input/aac/libmp4v2/Makefile" ;;
+  "Input/aac/libfaad2/Makefile" ) CONFIG_FILES="$CONFIG_FILES Input/aac/libfaad2/Makefile" ;;
   "Input/vorbis/Makefile" ) CONFIG_FILES="$CONFIG_FILES Input/vorbis/Makefile" ;;
   "Input/cdaudio/Makefile" ) CONFIG_FILES="$CONFIG_FILES Input/cdaudio/Makefile" ;;
   "Input/wav/Makefile" ) CONFIG_FILES="$CONFIG_FILES Input/wav/Makefile" ;;
@@ -29257,6 +29773,12 @@
 s,@LIBINTL@,$LIBINTL,;t t
 s,@LTLIBINTL@,$LTLIBINTL,;t t
 s,@POSUB@,$POSUB,;t t
+s,@CXX@,$CXX,;t t
+s,@CXXFLAGS@,$CXXFLAGS,;t t
+s,@ac_ct_CXX@,$ac_ct_CXX,;t t
+s,@CXXDEPMODE@,$CXXDEPMODE,;t t
+s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t
+s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t
 s,@CCAS@,$CCAS,;t t
 s,@CCASFLAGS@,$CCASFLAGS,;t t
 s,@LN_S@,$LN_S,;t t
@@ -29303,6 +29825,8 @@
 s,@OGG_VORBIS_LIBS@,$OGG_VORBIS_LIBS,;t t
 s,@HAVE_OGGVORBIS_TRUE@,$HAVE_OGGVORBIS_TRUE,;t t
 s,@HAVE_OGGVORBIS_FALSE@,$HAVE_OGGVORBIS_FALSE,;t t
+s,@ENABLE_AAC_TRUE@,$ENABLE_AAC_TRUE,;t t
+s,@ENABLE_AAC_FALSE@,$ENABLE_AAC_FALSE,;t t
 s,@HAVE_OSS_TRUE@,$HAVE_OSS_TRUE,;t t
 s,@HAVE_OSS_FALSE@,$HAVE_OSS_FALSE,;t t
 s,@ALSA_CFLAGS@,$ALSA_CFLAGS,;t t
@@ -30186,6 +30710,7 @@
 echo "  -------------"
 echo "  MPEG 1/2/3 (mpg123):                    $enable_mp3"
 echo "    + id3v2 editing:                      $have_id3lib"
+echo "  MPEG 4 Audio (AAC):                     $enable_aac"
 echo "  CD Digital Audio (cdda):                yes"
 echo "  Microsoft WAV (wav):                    yes"
 echo "  Ogg Vorbis (vorbis):                    $have_oggvorbis"
--- a/configure.ac	Mon Oct 24 03:12:26 2005 -0700
+++ b/configure.ac	Mon Oct 24 10:44:27 2005 -0700
@@ -29,6 +29,7 @@
 dnl Check for C compiler
 
 AC_LANG([C])
+AC_LANG([C++])
 AC_ISC_POSIX
 AC_C_BIGENDIAN
 
@@ -49,8 +50,6 @@
 dnl without building static plugins
 
 dnl Next four lines is a hack to prevent libtool checking for C++/F77
-m4_undefine([AC_PROG_CXX])
-m4_defun([AC_PROG_CXX],[])
 m4_undefine([AC_PROG_F77])
 m4_defun([AC_PROG_F77],[])
 
@@ -328,6 +327,15 @@
 
 AM_CONDITIONAL(HAVE_OGGVORBIS, [test "$have_oggvorbis" = "yes"])
 
+dnl *** AAC
+
+AC_ARG_ENABLE(aac,
+    [  --disable-aac           disable aac plugin. [default=enabled] ],
+    [enable_aac=$enableval],
+    [enable_aac=yes]
+)
+
+AM_CONDITIONAL(ENABLE_AAC, test "$enable_aac" = "yes")
 
 dnl *** OSS output
 
@@ -590,6 +598,9 @@
         Output/alsa/Makefile
         Input/Makefile
         Input/mpg123/Makefile
+	Input/aac/Makefile
+	Input/aac/libmp4v2/Makefile
+	Input/aac/libfaad2/Makefile
         Input/vorbis/Makefile
         Input/cdaudio/Makefile
         Input/wav/Makefile
@@ -637,6 +648,7 @@
 echo "  -------------"
 echo "  MPEG 1/2/3 (mpg123):                    $enable_mp3"
 echo "    + id3v2 editing:                      $have_id3lib"
+echo "  MPEG 4 Audio (AAC):                     $enable_aac"
 echo "  CD Digital Audio (cdda):                yes"
 echo "  Microsoft WAV (wav):                    yes"
 echo "  Ogg Vorbis (vorbis):                    $have_oggvorbis"
--- a/icons/Makefile.in	Mon Oct 24 03:12:26 2005 -0700
+++ b/icons/Makefile.in	Mon Oct 24 10:44:27 2005 -0700
@@ -88,7 +88,10 @@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
 CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
 DEFS = @DEFS@
@@ -100,6 +103,8 @@
 EFFECT_PLUGINS = @EFFECT_PLUGINS@
 EFFECT_PLUGIN_DIR = @EFFECT_PLUGIN_DIR@
 EGREP = @EGREP@
+ENABLE_AAC_FALSE = @ENABLE_AAC_FALSE@
+ENABLE_AAC_TRUE = @ENABLE_AAC_TRUE@
 ENABLE_MPG123_FALSE = @ENABLE_MPG123_FALSE@
 ENABLE_MPG123_TRUE = @ENABLE_MPG123_TRUE@
 ESD_CFLAGS = @ESD_CFLAGS@
@@ -203,10 +208,13 @@
 X_PRE_LIBS = @X_PRE_LIBS@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
 ac_ct_RANLIB = @ac_ct_RANLIB@
 ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
--- a/libaudacious/Makefile.in	Mon Oct 24 03:12:26 2005 -0700
+++ b/libaudacious/Makefile.in	Mon Oct 24 10:44:27 2005 -0700
@@ -128,7 +128,10 @@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
 CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
 DEFS = @DEFS@
@@ -140,6 +143,8 @@
 EFFECT_PLUGINS = @EFFECT_PLUGINS@
 EFFECT_PLUGIN_DIR = @EFFECT_PLUGIN_DIR@
 EGREP = @EGREP@
+ENABLE_AAC_FALSE = @ENABLE_AAC_FALSE@
+ENABLE_AAC_TRUE = @ENABLE_AAC_TRUE@
 ENABLE_MPG123_FALSE = @ENABLE_MPG123_FALSE@
 ENABLE_MPG123_TRUE = @ENABLE_MPG123_TRUE@
 ESD_CFLAGS = @ESD_CFLAGS@
@@ -243,10 +248,13 @@
 X_PRE_LIBS = @X_PRE_LIBS@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
 ac_ct_RANLIB = @ac_ct_RANLIB@
 ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
@@ -290,7 +298,7 @@
 target_vendor = @target_vendor@
 ACLOCAL_AMFLAGS = -I ../m4
 AUTOMAKE_OPTIONS = foreign
-beepincludedir = $(includedir)/bmp
+beepincludedir = $(includedir)/audacious
 lib_LTLIBRARIES = libaudacious.la
 libaudacious_la_LDFLAGS = -export-dynamic -version-info $(LIBBEEP_MAJOR_VERSION):$(LIBBEEP_MINOR_VERSION):$(LIBBEEP_MICRO_VERSION)
 libaudacious_la_LIBADD = \
--- a/skin/Makefile.in	Mon Oct 24 03:12:26 2005 -0700
+++ b/skin/Makefile.in	Mon Oct 24 10:44:27 2005 -0700
@@ -95,7 +95,10 @@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
 CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
 DEFS = @DEFS@
@@ -107,6 +110,8 @@
 EFFECT_PLUGINS = @EFFECT_PLUGINS@
 EFFECT_PLUGIN_DIR = @EFFECT_PLUGIN_DIR@
 EGREP = @EGREP@
+ENABLE_AAC_FALSE = @ENABLE_AAC_FALSE@
+ENABLE_AAC_TRUE = @ENABLE_AAC_TRUE@
 ENABLE_MPG123_FALSE = @ENABLE_MPG123_FALSE@
 ENABLE_MPG123_TRUE = @ENABLE_MPG123_TRUE@
 ESD_CFLAGS = @ESD_CFLAGS@
@@ -210,10 +215,13 @@
 X_PRE_LIBS = @X_PRE_LIBS@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
 ac_ct_RANLIB = @ac_ct_RANLIB@
 ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@