changeset 199:0a2ad94e8607 trunk

[svn] Synced with bmp-mp4. Build system is fragile, but should work now.
author chainsaw
date Wed, 16 Nov 2005 16:21:11 -0800
parents 5a338b31e393
children 094ef8a0a9fd
files Plugins/Input/aac/include/faad.h Plugins/Input/aac/include/mpeg4ip.h Plugins/Input/aac/libfaad2/Makefile.am Plugins/Input/aac/libfaad2/analysis.h Plugins/Input/aac/libfaad2/bits.c Plugins/Input/aac/libfaad2/bits.h Plugins/Input/aac/libfaad2/cfft.c Plugins/Input/aac/libfaad2/cfft.h Plugins/Input/aac/libfaad2/cfft_tab.h Plugins/Input/aac/libfaad2/codebook/hcb_sf.h Plugins/Input/aac/libfaad2/common.c Plugins/Input/aac/libfaad2/common.h Plugins/Input/aac/libfaad2/decoder.c Plugins/Input/aac/libfaad2/decoder.h Plugins/Input/aac/libfaad2/drc.c Plugins/Input/aac/libfaad2/drc.h Plugins/Input/aac/libfaad2/error.c Plugins/Input/aac/libfaad2/error.h Plugins/Input/aac/libfaad2/filtbank.c Plugins/Input/aac/libfaad2/filtbank.h Plugins/Input/aac/libfaad2/fixed.h Plugins/Input/aac/libfaad2/hcr.c Plugins/Input/aac/libfaad2/huffman.c Plugins/Input/aac/libfaad2/huffman.h Plugins/Input/aac/libfaad2/ic_predict.c Plugins/Input/aac/libfaad2/ic_predict.h Plugins/Input/aac/libfaad2/iq_table.h Plugins/Input/aac/libfaad2/is.c Plugins/Input/aac/libfaad2/is.h Plugins/Input/aac/libfaad2/kbd_win.h Plugins/Input/aac/libfaad2/libfaad.dsp Plugins/Input/aac/libfaad2/libfaad.sln Plugins/Input/aac/libfaad2/libfaad.vcproj Plugins/Input/aac/libfaad2/lt_predict.c Plugins/Input/aac/libfaad2/lt_predict.h Plugins/Input/aac/libfaad2/mdct.c Plugins/Input/aac/libfaad2/mdct.h Plugins/Input/aac/libfaad2/mp4.c Plugins/Input/aac/libfaad2/mp4.h Plugins/Input/aac/libfaad2/ms.c Plugins/Input/aac/libfaad2/ms.h Plugins/Input/aac/libfaad2/output.c Plugins/Input/aac/libfaad2/output.h Plugins/Input/aac/libfaad2/pns.c Plugins/Input/aac/libfaad2/pns.h Plugins/Input/aac/libfaad2/pulse.c Plugins/Input/aac/libfaad2/pulse.h Plugins/Input/aac/libfaad2/rvlc.c Plugins/Input/aac/libfaad2/rvlc.h Plugins/Input/aac/libfaad2/sbr_dct.c Plugins/Input/aac/libfaad2/sbr_dct.h Plugins/Input/aac/libfaad2/sbr_dec.c Plugins/Input/aac/libfaad2/sbr_dec.h Plugins/Input/aac/libfaad2/sbr_e_nf.c Plugins/Input/aac/libfaad2/sbr_e_nf.h Plugins/Input/aac/libfaad2/sbr_fbt.c Plugins/Input/aac/libfaad2/sbr_fbt.h Plugins/Input/aac/libfaad2/sbr_hfadj.c Plugins/Input/aac/libfaad2/sbr_hfadj.h Plugins/Input/aac/libfaad2/sbr_hfgen.c Plugins/Input/aac/libfaad2/sbr_hfgen.h Plugins/Input/aac/libfaad2/sbr_huff.c Plugins/Input/aac/libfaad2/sbr_huff.h Plugins/Input/aac/libfaad2/sbr_noise.h Plugins/Input/aac/libfaad2/sbr_qmf.c Plugins/Input/aac/libfaad2/sbr_qmf.h Plugins/Input/aac/libfaad2/sbr_qmf_c.h Plugins/Input/aac/libfaad2/sbr_syntax.c Plugins/Input/aac/libfaad2/sbr_syntax.h Plugins/Input/aac/libfaad2/sbr_tf_grid.c Plugins/Input/aac/libfaad2/sbr_tf_grid.h Plugins/Input/aac/libfaad2/sine_win.h Plugins/Input/aac/libfaad2/specrec.c Plugins/Input/aac/libfaad2/specrec.h Plugins/Input/aac/libfaad2/ssr.c Plugins/Input/aac/libfaad2/ssr.h Plugins/Input/aac/libfaad2/ssr_fb.c Plugins/Input/aac/libfaad2/ssr_fb.h Plugins/Input/aac/libfaad2/ssr_ipqf.c Plugins/Input/aac/libfaad2/ssr_ipqf.h Plugins/Input/aac/libfaad2/ssr_win.h Plugins/Input/aac/libfaad2/structs.h Plugins/Input/aac/libfaad2/syntax.c Plugins/Input/aac/libfaad2/syntax.h Plugins/Input/aac/libfaad2/tns.c Plugins/Input/aac/libfaad2/tns.h Plugins/Input/aac/libmp4v2/INTERNALS Plugins/Input/aac/libmp4v2/Makefile.am Plugins/Input/aac/libmp4v2/README Plugins/Input/aac/libmp4v2/atom_free.cpp Plugins/Input/aac/libmp4v2/atom_meta.cpp Plugins/Input/aac/libmp4v2/atoms.h Plugins/Input/aac/libmp4v2/isma.cpp Plugins/Input/aac/libmp4v2/libmp4v260.dsp Plugins/Input/aac/libmp4v2/libmp4v2_st60.dsp Plugins/Input/aac/libmp4v2/mp4.cpp Plugins/Input/aac/libmp4v2/mp4.h Plugins/Input/aac/libmp4v2/mp4atom.cpp Plugins/Input/aac/libmp4v2/mp4atom.h Plugins/Input/aac/libmp4v2/mp4descriptor.cpp Plugins/Input/aac/libmp4v2/mp4file.cpp Plugins/Input/aac/libmp4v2/mp4file.h Plugins/Input/aac/libmp4v2/mp4info.cpp Plugins/Input/aac/libmp4v2/mp4meta.cpp Plugins/Input/aac/libmp4v2/mp4property.cpp Plugins/Input/aac/libmp4v2/mp4property.h Plugins/Input/aac/libmp4v2/mp4track.cpp Plugins/Input/aac/libmp4v2/mp4util.cpp Plugins/Input/aac/libmp4v2/mp4util.h Plugins/Input/aac/libmp4v2/rtphint.cpp Plugins/Input/aac/src/Makefile.am Plugins/Input/aac/src/aac_utils.c Plugins/Input/aac/src/libmp4.c Plugins/Input/aac/src/mp4_utils.c
diffstat 114 files changed, 26895 insertions(+), 7310 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Input/aac/include/faad.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/include/faad.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,195 +22,11 @@
 ** 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 $
+** $Id: faad.h,v 1.47 2004/04/03 19:08:37 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;
+/* warn people for update */
+#pragma message("please update faad2 include filename and function names!")
 
-    /* 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
+/* Backwards compatible link */
+#include "neaacdec.h"
--- a/Plugins/Input/aac/include/mpeg4ip.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/include/mpeg4ip.h	Wed Nov 16 16:21:11 2005 -0800
@@ -24,26 +24,336 @@
 
 /* project wide applicable stuff here */
 
-#include <systems.h>
+
+#ifdef WIN32
+#define HAVE_IN_PORT_T
+#define HAVE_SOCKLEN_T
+#define NEED_SDL_VIDEO_IN_MAIN_THREAD
+#else
+#undef PACKAGE
+#undef VERSION
+//#include <mpeg4ip_config.h> // patched for the mp4/aac plugin (ciberfred)
+#include <config.h>
+#undef PACKAGE
+#undef VERSION
+// so these don't propogate
+#endif
+
+// the mpeg4ip_package and mpeg4ip_version are always in this
+// file 
+#include "mpeg4ip_version.h"
+
+
+
+
+#ifdef WIN32
+
+#define _WIN32_WINNT 0x0400
+#define _WINSOCKAPI_
+#include <windows.h>
+#include <winsock2.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 int socklen_t;
+typedef int ssize_t;
+typedef unsigned int uint;
+#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 D64F "I64d"
+#define U64F  "I64u"
+#define X64F "I64x"
+
+#define TO_D64(a) (a##I64)
+#define TO_U64(a) (a##UI64)
+
+#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"
+
+#define UINT64_TO_DOUBLE(a) ((double)((int64_t)(a)))
+#ifdef __cplusplus
+extern "C" {
+#endif
+char *strcasestr(const char *haystack, const char *needle);
+#ifdef __cplusplus
+}
+#endif
+
+
+#define SIZEOF_BOOL 1
+
+#else /* UNIX */
+/*****************************************************************************
+ *   UNIX LIKE DEFINES BELOW THIS POINT
+ *****************************************************************************/
+#ifdef sun
+#include <sys/feature_tests.h>
+#endif
+
+#ifndef _FILE_OFFSET_BITS
+#define _FILE_OFFSET_BITS 64
+#else
+#ifndef sun
+#if _FILE_OFFSET_BITS < 64
+ #error File offset bits is already set to non-64 value
+#endif
+#endif
+#endif
+
+#ifndef _LARGEFILE_SOURCE
+#define _LARGEFILE_SOURCE
+#endif
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#if !defined(HAVE_INTTYPES_H) && !defined(HAVE_STDINT_H)
+#error "Don't have stdint.h or inttypes.h - no way to get uint8_t"
+#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>
+#ifdef TIME_WITH_SYS_TIME
+#include <sys/time.h>
+#include <time.h>
+#else
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#else
+#include <time.h>
+#endif
+#endif
+#include <sys/param.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+char *strcasestr(const char *haystack, const char *needle);
+#ifdef __cplusplus
+}
+#endif
+
+#define OPEN_RDWR O_RDWR
+#define OPEN_CREAT O_CREAT 
+#define OPEN_RDONLY O_RDONLY
+
+#define closesocket close
+#define IOSBINARY ios::bin
+
+#if SIZEOF_LONG == 8
+#define MAX_UINT64 -1LU
+#define D64F "ld"
+#define U64F  "lu"
+#define X64F "lx"
+
+#define TO_D64(a) (a##L)
+#define TO_U64(a) (a##LU)
+#else
+#define MAX_UINT64 -1LLU
+#define D64F "lld"
+#define U64F  "llu"
+#define X64F "llx"
+
+#define TO_D64(a) (a##LL)
+#define TO_U64(a) (a##LLU)
+#endif
+
+#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"
+#define UINT64_TO_DOUBLE(a) ((double)(a))
+#endif /* define unix */
+
+/*****************************************************************************
+ *             Generic type includes used in the whole package               *
+ *****************************************************************************/
+#define D64  "%"D64F
+#define U64  "%"U64F
+#define X64 "%"X64F
+
+#define M_LLU TO_U64(1000)
+#define M_64 TO_U64(1000)
+#define LLU  U64
+
+#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((void *)(a)); (a) = NULL;}
+
+#define NUM_ELEMENTS_IN_ARRAY(name) ((sizeof((name))) / (sizeof(*(name))))
+
+#define ADV_SPACE(a) {while (isspace(*(a)) && (*(a) != '\0'))(a)++;}
 
 #ifndef FALSE
 #define FALSE 0
 #endif
+
 #ifndef TRUE
 #define TRUE 1
 #endif
 
 #ifndef __cplusplus
+
 #ifndef bool
-typedef unsigned char bool;
-#endif
+ #if SIZEOF_BOOL == 8
+  typedef uint64_t bool;
+ #else
+   #if SIZEOF_BOOL == 4
+    typedef uint32_t bool;
+   #else
+     #if SIZEOF_BOOL == 2
+      typedef uint16_t bool;
+     #else
+      typedef unsigned char bool;
+     #endif
+   #endif
+ #endif
+ #ifndef false
+ #define false FALSE
+ #endif
+ #ifndef true
+ #define true TRUE
+ #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
@@ -54,5 +364,33 @@
 # endif
 #endif
 
+#ifndef INT16_MAX
+# define INT16_MAX (32767)
+#endif
+#ifndef INT16_MIN 
+# define INT16_MIN (-32767-1)
+#endif 
+
+#ifndef UINT32_MAX
+# define UINT32_MAX             (4294967295U)
+#endif
+
+#ifndef UINT64_MAX
+# define UINT64_MAX TO_U64(0xffffffffffffffff)
+#endif
+
+typedef enum audio_format_t {
+  AUDIO_FMT_U8 = 0,
+  AUDIO_FMT_S8,
+  AUDIO_FMT_U16LSB,
+  AUDIO_FMT_S16LSB,
+  AUDIO_FMT_U16MSB,
+  AUDIO_FMT_S16MSB,
+  AUDIO_FMT_U16,
+  AUDIO_FMT_S16,
+  AUDIO_FMT_FLOAT,
+  AUDIO_FMT_HW_AC3,
+} audio_format_t;
+
 #endif /* __MPEG4IP_INCLUDED__ */
 
--- a/Plugins/Input/aac/libfaad2/Makefile.am	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/Makefile.am	Wed Nov 16 16:21:11 2005 -0800
@@ -1,14 +1,19 @@
 noinst_LTLIBRARIES = libfaad.la
 
+INCLUDE = $(top_srcdir)/include
+
+libfaad_la_LDFLAGS = -lm
+
 libfaad_la_SOURCES = bits.c cfft.c decoder.c drc.c \
-error.c filtbank.c \
+drm_dec.c error.c filtbank.c \
 ic_predict.c is.c lt_predict.c mdct.c mp4.c ms.c output.c pns.c \
+ps_dec.c ps_syntax.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 \
+decoder.h drc.h drm_dec.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 \
@@ -17,4 +22,4 @@
 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
+codebook/hcb_9.h codebook/hcb_10.h codebook/hcb_11.h codebook/hcb_sf.h
\ No newline at end of file
--- a/Plugins/Input/aac/libfaad2/analysis.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/analysis.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: analysis.h,v 1.9 2003/11/12 20:47:56 menno Exp $
+** $Id: analysis.h,v 1.14 2004/09/04 14:56:27 menno Exp $
 **/
 
 #ifndef __ANALYSIS_H__
--- a/Plugins/Input/aac/libfaad2/bits.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/bits.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: bits.c,v 1.28 2003/11/12 20:47:57 menno Exp $
+** $Id: bits.c,v 1.39 2004/09/04 14:56:27 menno Exp $
 **/
 
 #include "common.h"
@@ -49,7 +49,7 @@
         return;
     }
 
-    ld->buffer = malloc((buffer_size+12)*sizeof(uint8_t));
+    ld->buffer = faad_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));
 
@@ -74,7 +74,13 @@
 void faad_endbits(bitfile *ld)
 {
     if (ld)
-        if (ld->buffer) free(ld->buffer);
+    {
+        if (ld->buffer)
+        {
+            faad_free(ld->buffer);
+            ld->buffer = NULL;
+        }
+    }
 }
 
 uint32_t faad_get_processed_bits(bitfile *ld)
@@ -99,8 +105,13 @@
     uint32_t tmp;
 
     ld->bufa = ld->bufb;
-    tmp = getdword(ld->tail);
-    ld->tail++;
+    if (ld->no_more_reading == 0)
+    {
+        tmp = getdword(ld->tail);
+        ld->tail++;
+    } else {
+        tmp = 0;
+    }
     ld->bufb = tmp;
     ld->bits_left += (32 - bits);
     ld->bytes_used += 4;
@@ -140,7 +151,7 @@
     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));
+    uint8_t *buffer = (uint8_t*)faad_malloc((bytes+1)*sizeof(uint8_t));
 
     for (i = 0; i < bytes; i++)
     {
@@ -157,6 +168,20 @@
     return buffer;
 }
 
+#ifdef DRM
+/* return the original data buffer */
+void *faad_origbitbuffer(bitfile *ld)
+{
+    return (void*)ld->start;
+}
+
+/* return the original data buffer size */
+uint32_t faad_origbitbuffer_size(bitfile *ld)
+{
+    return ld->buffer_size;
+}
+#endif
+
 /* reversed bit reading routines, used for RVLC and HCR */
 void faad_initbits_rev(bitfile *ld, void *buffer,
                        uint32_t bits_in_buffer)
--- a/Plugins/Input/aac/libfaad2/bits.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/bits.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,19 +1,19 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
-**  
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
+**
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
 ** the Free Software Foundation; either version 2 of the License, or
 ** (at your option) any later version.
-** 
+**
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ** GNU General Public License for more details.
-** 
+**
 ** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software 
+** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
 ** Any non-GPL usage of this software or parts of this software is strictly
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: bits.h,v 1.27 2003/11/12 20:47:57 menno Exp $
+** $Id: bits.h,v 1.40 2004/09/04 14:56:27 menno Exp $
 **/
 
 #ifndef __BITS_H__
@@ -56,9 +56,9 @@
 } bitfile;
 
 
-#if defined (_WIN32) && !defined(_WIN32_WCE)
+#if defined (_WIN32) && !defined(_WIN32_WCE) && !defined(__MINGW32__)
 #define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax
-#elif defined(LINUX) || defined(DJGPP)
+#elif defined(LINUX) || defined(DJGPP) || defined(__MINGW32__)
 #define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) )
 #else
 #define BSWAP(a) \
@@ -71,6 +71,8 @@
     0x1FFFF, 0x3FFFF, 0x7FFFF, 0xFFFFF, 0x1FFFFF, 0x3FFFFF,
     0x7FFFFF, 0xFFFFFF, 0x1FFFFFF, 0x3FFFFFF, 0x7FFFFFF,
     0xFFFFFFF, 0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF
+    /* added bitmask 32, correct?!?!?! */
+    , 0xFFFFFFFF
 };
 
 void faad_initbits(bitfile *ld, const void *buffer, const uint32_t buffer_size);
@@ -83,6 +85,10 @@
 void faad_rewindbits(bitfile *ld);
 uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits
                        DEBUGDEC);
+#ifdef DRM
+void *faad_origbitbuffer(bitfile *ld);
+uint32_t faad_origbitbuffer_size(bitfile *ld);
+#endif
 
 /* circumvent memory alignment errors on ARM */
 static INLINE uint32_t getdword(void *mem)
@@ -160,12 +166,20 @@
 {
     uint8_t r;
 
-    if (ld->bits_left == 0)
-        return (uint8_t)faad_getbits(ld, 1 DEBUGVAR(print,var,dbg));
+    if (ld->bits_left > 0)
+    {
+        ld->bits_left--;
+        r = (uint8_t)((ld->bufa >> ld->bits_left) & 1);
+        return r;
+    }
 
-    ld->bits_left--;
-    r = (uint8_t)((ld->bufa >> ld->bits_left) & 1);
-
+    /* bits_left == 0 */
+#if 0
+    r = (uint8_t)(ld->bufb >> 31);
+    faad_flushbits_ex(ld, 1);
+#else
+    r = (uint8_t)faad_getbits(ld, 1);
+#endif
     return r;
 }
 
@@ -257,7 +271,7 @@
 
     faad_rewindbits(ld);
 
-    CRC = ~faad_getbits(ld, 8
+    CRC = (uint8_t) ~faad_getbits(ld, 8
         DEBUGVAR(1,999,"faad_check_CRC(): CRC"));          /* CRC is stored inverted */
 
     for (; len>0; len--)
@@ -303,7 +317,7 @@
     /* bit input */
     uint32_t bufa;
     uint32_t bufb;
-    int8_t len; 
+    int8_t len;
 } bits_t;
 
 
@@ -317,7 +331,7 @@
         if (ld->len >= bits)
             return ((ld->bufa >> (ld->len - bits)) & (0xFFFFFFFF >> (32 - bits)));
         else
-            return ((ld->bufa << (bits - ld->len)) & (0xFFFFFFFF >> (32 - bits)));        
+            return ((ld->bufa << (bits - ld->len)) & (0xFFFFFFFF >> (32 - bits)));
     } else {
         if ((ld->len - bits) < 32)
         {
--- a/Plugins/Input/aac/libfaad2/cfft.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/cfft.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: cfft.c,v 1.19 2003/11/12 20:47:57 menno Exp $
+** $Id: cfft.c,v 1.30 2004/09/08 09:43:11 gcp Exp $
 **/
 
 /*
@@ -43,12 +43,31 @@
 #include "cfft_tab.h"
 
 
+/* static function declarations */
+static void passf2pos(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+                      complex_t *ch, const complex_t *wa);
+static void passf2neg(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+                      complex_t *ch, const complex_t *wa);
+static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+                   complex_t *ch, const complex_t *wa1, const complex_t *wa2, const int8_t isign);
+static void passf4pos(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch,
+                      const complex_t *wa1, const complex_t *wa2, const complex_t *wa3);
+static void passf4neg(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch,
+                      const complex_t *wa1, const complex_t *wa2, const complex_t *wa3);
+static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch,
+                   const complex_t *wa1, const complex_t *wa2, const complex_t *wa3,
+                   const complex_t *wa4, const int8_t isign);
+INLINE void cfftf1(uint16_t n, complex_t *c, complex_t *ch,
+                   const uint16_t *ifac, const complex_t *wa, const int8_t isign);
+static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac);
+
+
 /*----------------------------------------------------------------------
    passf2, passf3, passf4, passf5. Complex FFT passes fwd and bwd.
   ----------------------------------------------------------------------*/
 
-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 passf2pos(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+                      complex_t *ch, const complex_t *wa)
 {
     uint16_t i, k, ah, ac;
 
@@ -65,46 +84,73 @@
             IM(ch[ah+l1]) = IM(cc[ac]) - IM(cc[ac+1]);
         }
     } else {
-        if (isign == 1)
+        for (k = 0; k < l1; k++)
         {
-            for (k = 0; k < l1; k++)
+            ah = k*ido;
+            ac = 2*k*ido;
+
+            for (i = 0; i < ido; i++)
             {
-                ah = k*ido;
-                ac = 2*k*ido;
+                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]);
 
-                for (i = 0; i < ido; i++)
-                {
-                    complex_t t2;
+#if 1
+                ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]),
+                    IM(t2), RE(t2), RE(wa[i]), IM(wa[i]));
+#else
+                ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]),
+                    RE(t2), IM(t2), RE(wa[i]), IM(wa[i]));
+#endif
+            }
+        }
+    }
+}
 
-                    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]);
+static void passf2neg(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+                      complex_t *ch, const complex_t *wa)
+{
+    uint16_t i, k, ah, ac;
 
-                    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;
+    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 {
+        for (k = 0; k < l1; k++)
+        {
+            ah = k*ido;
+            ac = 2*k*ido;
 
-                for (i = 0; i < ido; i++)
-                {
-                    complex_t t2;
+            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]);
+                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]);
+                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]));
-                }
+#if 1
+                ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]),
+                    RE(t2), IM(t2), RE(wa[i]), IM(wa[i]));
+#else
+                ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]),
+                    IM(t2), RE(t2), RE(wa[i]), IM(wa[i]));
+#endif
             }
         }
     }
@@ -194,10 +240,17 @@
                     RE(d3) = RE(c2) + IM(c3);
                     IM(d2) = IM(c2) + RE(c3);
 
+#if 1
                     ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]),
                         IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
                     ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]),
                         IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
+#else
+                    ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]),
+                        RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
+                    ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]),
+                        RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
+#endif
                 }
             }
         } else {
@@ -224,163 +277,193 @@
                     RE(d3) = RE(c2) - IM(c3);
                     IM(d2) = IM(c2) - RE(c3);
 
+#if 1
                     ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]),
                         RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
                     ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]),
                         RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
+#else
+                    ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]),
+                        IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
+                    ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]),
+                        IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
+#endif
                 }
             }
         }
     }
 }
 
-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 passf4pos(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+                      complex_t *ch, const complex_t *wa1, const complex_t *wa2,
+                      const complex_t *wa3)
 {
     uint16_t i, k, ac, ah;
 
     if (ido == 1)
     {
-        if (isign == 1)
+        for (k = 0; k < l1; k++)
         {
-            for (k = 0; k < l1; k++)
-            {
-                complex_t t1, t2, t3, t4;
-
-                ac = 4*k;
-                ah = k;
+            complex_t t1, t2, t3, t4;
 
-                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);
+            ac = 4*k;
+            ah = k;
 
-                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(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])      = 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);
 
-                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);
-            }
+            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++)
         {
-            for (k = 0; k < l1; k++)
+            ac = 4*k*ido;
+            ah = k*ido;
+
+            for (i = 0; i < ido; i++)
             {
-                ac = 4*k*ido;
-                ah = k*ido;
+                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]);
 
-                for (i = 0; i < ido; i++)
-                {
-                    complex_t c2, c3, c4, t1, t2, t3, t4;
+                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);
 
-                    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]);
+#if 1
+                ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]),
+                    IM(c2), RE(c2), RE(wa1[i]), IM(wa1[i]));
+                ComplexMult(&IM(ch[ah+i+2*l1*ido]), &RE(ch[ah+i+2*l1*ido]),
+                    IM(c3), RE(c3), RE(wa2[i]), IM(wa2[i]));
+                ComplexMult(&IM(ch[ah+i+3*l1*ido]), &RE(ch[ah+i+3*l1*ido]),
+                    IM(c4), RE(c4), RE(wa3[i]), IM(wa3[i]));
+#else
+                ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]),
+                    RE(c2), IM(c2), RE(wa1[i]), IM(wa1[i]));
+                ComplexMult(&RE(ch[ah+i+2*l1*ido]), &IM(ch[ah+i+2*l1*ido]),
+                    RE(c3), IM(c3), RE(wa2[i]), IM(wa2[i]));
+                ComplexMult(&RE(ch[ah+i+3*l1*ido]), &IM(ch[ah+i+3*l1*ido]),
+                    RE(c4), IM(c4), RE(wa3[i]), IM(wa3[i]));
+#endif
+            }
+        }
+    }
+}
 
-                    RE(c2) = RE(t1) + RE(t4);
-                    RE(c4) = RE(t1) - RE(t4);
-
-                    IM(c2) = IM(t1) + IM(t4);
-                    IM(c4) = IM(t1) - IM(t4);
+static void passf4neg(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+                      complex_t *ch, const complex_t *wa1, const complex_t *wa2,
+                      const complex_t *wa3)
+{
+    uint16_t i, k, ac, ah;
 
-                    RE(ch[ah+i]) = RE(t2) + RE(t3);
-                    RE(c3)       = RE(t2) - RE(t3);
+    if (ido == 1)
+    {
+        for (k = 0; k < l1; k++)
+        {
+            complex_t t1, t2, t3, t4;
 
-                    IM(ch[ah+i]) = IM(t2) + IM(t3);
-                    IM(c3)       = IM(t2) - IM(t3);
+            ac = 4*k;
+            ah = k;
 
-                    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++)
+            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++)
+        {
+            ac = 4*k*ido;
+            ah = k*ido;
+
+            for (i = 0; i < ido; i++)
             {
-                ac = 4*k*ido;
-                ah = k*ido;
-
-                for (i = 0; i < ido; i++)
-                {
-                    complex_t c2, c3, c4, t1, t2, t3, t4;
+                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(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);
+                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(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);
 
-                    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]));
-                }
+#if 1
+                ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]),
+                    RE(c2), IM(c2), RE(wa1[i]), IM(wa1[i]));
+                ComplexMult(&RE(ch[ah+i+2*l1*ido]), &IM(ch[ah+i+2*l1*ido]),
+                    RE(c3), IM(c3), RE(wa2[i]), IM(wa2[i]));
+                ComplexMult(&RE(ch[ah+i+3*l1*ido]), &IM(ch[ah+i+3*l1*ido]),
+                    RE(c4), IM(c4), RE(wa3[i]), IM(wa3[i]));
+#else
+                ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]),
+                    IM(c2), RE(c2), RE(wa1[i]), IM(wa1[i]));
+                ComplexMult(&IM(ch[ah+i+2*l1*ido]), &RE(ch[ah+i+2*l1*ido]),
+                    IM(c3), RE(c3), RE(wa2[i]), IM(wa2[i]));
+                ComplexMult(&IM(ch[ah+i+3*l1*ido]), &RE(ch[ah+i+3*l1*ido]),
+                    IM(c4), RE(c4), RE(wa3[i]), IM(wa3[i]));
+#endif
             }
         }
     }
@@ -516,6 +599,7 @@
                     RE(d3) = RE(c3) - IM(c4);
                     IM(d4) = IM(c3) - RE(c4);
 
+#if 1
                     ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]),
                         IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
                     ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]),
@@ -524,6 +608,16 @@
                         IM(d4), RE(d4), RE(wa3[i]), IM(wa3[i]));
                     ComplexMult(&IM(ch[ah+4*l1*ido]), &RE(ch[ah+4*l1*ido]),
                         IM(d5), RE(d5), RE(wa4[i]), IM(wa4[i]));
+#else
+                    ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]),
+                        RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
+                    ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]),
+                        RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
+                    ComplexMult(&RE(ch[ah+3*l1*ido]), &IM(ch[ah+3*l1*ido]),
+                        RE(d4), IM(d4), RE(wa3[i]), IM(wa3[i]));
+                    ComplexMult(&RE(ch[ah+4*l1*ido]), &IM(ch[ah+4*l1*ido]),
+                        RE(d5), IM(d5), RE(wa4[i]), IM(wa4[i]));
+#endif
                 }
             }
         } else {
@@ -565,6 +659,7 @@
                     RE(d3) = RE(c3) + IM(c4);
                     IM(d4) = IM(c3) + RE(c4);
 
+#if 1
                     ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]),
                         RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
                     ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]),
@@ -573,6 +668,16 @@
                         RE(d4), IM(d4), RE(wa3[i]), IM(wa3[i]));
                     ComplexMult(&RE(ch[ah+4*l1*ido]), &IM(ch[ah+4*l1*ido]),
                         RE(d5), IM(d5), RE(wa4[i]), IM(wa4[i]));
+#else
+                    ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]),
+                        IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
+                    ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]),
+                        IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
+                    ComplexMult(&IM(ch[ah+3*l1*ido]), &RE(ch[ah+3*l1*ido]),
+                        IM(d4), RE(d4), RE(wa3[i]), IM(wa3[i]));
+                    ComplexMult(&IM(ch[ah+4*l1*ido]), &RE(ch[ah+4*l1*ido]),
+                        IM(d5), RE(d5), RE(wa4[i]), IM(wa4[i]));
+#endif
                 }
             }
         }
@@ -584,8 +689,9 @@
    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)
+static INLINE void cfftf1pos(uint16_t n, complex_t *c, complex_t *ch,
+                             const uint16_t *ifac, const complex_t *wa,
+                             const int8_t isign)
 {
     uint16_t i;
     uint16_t k1, l1, l2;
@@ -610,17 +716,17 @@
             ix3 = ix2 + ido;
 
             if (na == 0)
-                passf4(ido, l1, c, ch, &wa[iw], &wa[ix2], &wa[ix3], isign);
+                passf4pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3]);
             else
-                passf4(ido, l1, ch, c, &wa[iw], &wa[ix2], &wa[ix3], isign);
+                passf4pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3]);
 
             na = 1 - na;
             break;
         case 2:
             if (na == 0)
-                passf2(ido, l1, c, ch, &wa[iw], isign);
+                passf2pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw]);
             else
-                passf2(ido, l1, ch, c, &wa[iw], isign);
+                passf2pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw]);
 
             na = 1 - na;
             break;
@@ -628,9 +734,9 @@
             ix2 = iw + ido;
 
             if (na == 0)
-                passf3(ido, l1, c, ch, &wa[iw], &wa[ix2], isign);
+                passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], isign);
             else
-                passf3(ido, l1, ch, c, &wa[iw], &wa[ix2], isign);
+                passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], isign);
 
             na = 1 - na;
             break;
@@ -640,9 +746,88 @@
             ix4 = ix3 + ido;
 
             if (na == 0)
-                passf5(ido, l1, c, ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
+                passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
             else
-                passf5(ido, l1, ch, c, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
+                passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
+
+            na = 1 - na;
+            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]);
+    }
+}
+
+static INLINE void cfftf1neg(uint16_t n, complex_t *c, complex_t *ch,
+                             const uint16_t *ifac, const complex_t *wa,
+                             const int8_t isign)
+{
+    uint16_t i;
+    uint16_t k1, l1, l2;
+    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)
+                passf4neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3]);
+            else
+                passf4neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3]);
+
+            na = 1 - na;
+            break;
+        case 2:
+            if (na == 0)
+                passf2neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw]);
+            else
+                passf2neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw]);
+
+            na = 1 - na;
+            break;
+        case 3:
+            ix2 = iw + ido;
+
+            if (na == 0)
+                passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], isign);
+            else
+                passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], isign);
+
+            na = 1 - na;
+            break;
+        case 5:
+            ix2 = iw + ido;
+            ix3 = ix2 + ido;
+            ix4 = ix3 + ido;
+
+            if (na == 0)
+                passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
+            else
+                passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
 
             na = 1 - na;
             break;
@@ -664,12 +849,12 @@
 
 void cfftf(cfft_info *cfft, complex_t *c)
 {
-    cfftf1(cfft->n, c, cfft->work, cfft->ifac, cfft->tab, -1);
+    cfftf1neg(cfft->n, c, cfft->work, (const uint16_t*)cfft->ifac, (const complex_t*)cfft->tab, -1);
 }
 
 void cfftb(cfft_info *cfft, complex_t *c)
 {
-    cfftf1(cfft->n, c, cfft->work, cfft->ifac, cfft->tab, +1);
+    cfftf1pos(cfft->n, c, cfft->work, (const uint16_t*)cfft->ifac, (const complex_t*)cfft->tab, +1);
 }
 
 static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac)
@@ -681,7 +866,7 @@
     uint16_t i1, k1, l1, l2;
     uint16_t ld, ii, ip;
 #endif
-    uint16_t ntry, i, j;
+    uint16_t ntry = 0, i, j;
     uint16_t ib;
     uint16_t nf, nl, nq, nr;
 
@@ -724,7 +909,7 @@
     ifac[1] = nf;
 
 #ifndef FIXED_POINT
-    argh = (real_t)2.0*M_PI / (real_t)n;
+    argh = (real_t)2.0*(real_t)M_PI / (real_t)n;
     i = 0;
     l1 = 1;
 
@@ -751,7 +936,11 @@
                 fi++;
                 arg = fi * argld;
                 RE(wa[i]) = (real_t)cos(arg);
+#if 1
                 IM(wa[i]) = (real_t)sin(arg);
+#else
+                IM(wa[i]) = (real_t)-sin(arg);
+#endif
             }
 
             if (ip > 5)
@@ -767,13 +956,13 @@
 
 cfft_info *cffti(uint16_t n)
 {
-    cfft_info *cfft = (cfft_info*)malloc(sizeof(cfft_info));
+    cfft_info *cfft = (cfft_info*)faad_malloc(sizeof(cfft_info));
 
     cfft->n = n;
-    cfft->work = (complex_t*)malloc(n*sizeof(complex_t));
+    cfft->work = (complex_t*)faad_malloc(n*sizeof(complex_t));
 
 #ifndef FIXED_POINT
-    cfft->tab = (complex_t*)malloc(n*sizeof(complex_t));
+    cfft->tab = (complex_t*)faad_malloc(n*sizeof(complex_t));
 
     cffti1(n, cfft->tab, cfft->ifac);
 #else
@@ -781,19 +970,20 @@
 
     switch (n)
     {
-    case 64: cfft->tab = cfft_tab_64; break;
-    case 512: cfft->tab = cfft_tab_512; break;
+    case 64: cfft->tab = (complex_t*)cfft_tab_64; break;
+    case 512: cfft->tab = (complex_t*)cfft_tab_512; break;
 #ifdef LD_DEC
-    case 256: cfft->tab = cfft_tab_256; break;
+    case 256: cfft->tab = (complex_t*)cfft_tab_256; break;
 #endif
 
 #ifdef ALLOW_SMALL_FRAMELENGTH
-    case 60: cfft->tab = cfft_tab_60; break;
-    case 480: cfft->tab = cfft_tab_480; break;
+    case 60: cfft->tab = (complex_t*)cfft_tab_60; break;
+    case 480: cfft->tab = (complex_t*)cfft_tab_480; break;
 #ifdef LD_DEC
-    case 240: cfft->tab = cfft_tab_240; break;
+    case 240: cfft->tab = (complex_t*)cfft_tab_240; break;
 #endif
 #endif
+    case 128: cfft->tab = (complex_t*)cfft_tab_128; break;
     }
 #endif
 
@@ -802,10 +992,11 @@
 
 void cfftu(cfft_info *cfft)
 {
-    if (cfft->work) free(cfft->work);
+    if (cfft->work) faad_free(cfft->work);
 #ifndef FIXED_POINT
-    if (cfft->tab) free(cfft->tab);
+    if (cfft->tab) faad_free(cfft->tab);
 #endif
 
-    if (cfft) free(cfft);
-}
\ No newline at end of file
+    if (cfft) faad_free(cfft);
+}
+
--- a/Plugins/Input/aac/libfaad2/cfft.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/cfft.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: cfft.h,v 1.12 2003/11/12 20:47:57 menno Exp $
+** $Id: cfft.h,v 1.20 2004/09/08 09:43:11 gcp Exp $
 **/
 
 #ifndef __CFFT_H__
@@ -47,21 +47,6 @@
 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
--- a/Plugins/Input/aac/libfaad2/cfft_tab.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/cfft_tab.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,19 +1,19 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
-**  
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
+**
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
 ** the Free Software Foundation; either version 2 of the License, or
 ** (at your option) any later version.
-** 
+**
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ** GNU General Public License for more details.
-** 
+**
 ** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software 
+** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
 ** Any non-GPL usage of this software or parts of this software is strictly
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: cfft_tab.h,v 1.10 2003/11/12 20:47:57 menno Exp $
+** $Id: cfft_tab.h,v 1.17 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __CFFT_TAB_H__
@@ -34,7 +34,7 @@
 
 #ifdef FIXED_POINT
 
-complex_t cfft_tab_512[] =
+ALIGN static const complex_t cfft_tab_512[] =
 {
     { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
     { FRAC_CONST(0.999924719333649), FRAC_CONST(0.012271538376808) },
@@ -551,7 +551,7 @@
 };
 
 #ifdef ALLOW_SMALL_FRAMELENGTH
-complex_t cfft_tab_480[] =
+ALIGN static const complex_t cfft_tab_480[] =
 {
     { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
     { FRAC_CONST(0.999914348125458), FRAC_CONST(0.013089596293867) },
@@ -1036,7 +1036,7 @@
 };
 #endif
 
-complex_t cfft_tab_64[] =
+ALIGN static const complex_t cfft_tab_64[] =
 {
     { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
     { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
@@ -1105,7 +1105,7 @@
 };
 
 #ifdef ALLOW_SMALL_FRAMELENGTH
-complex_t cfft_tab_60[] =
+ALIGN static const complex_t cfft_tab_60[] =
 {
     { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
     { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
@@ -1172,7 +1172,7 @@
 
 #ifdef LD_DEC
 
-complex_t cfft_tab_256[] =
+ALIGN static const complex_t cfft_tab_256[] =
 {
     { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
     { FRAC_CONST(0.999698817729950), FRAC_CONST(0.024541229009628) },
@@ -1433,7 +1433,7 @@
 };
 
 #ifdef ALLOW_SMALL_FRAMELENGTH
-complex_t cfft_tab_240[] =
+ALIGN static const complex_t cfft_tab_240[] =
 {
     { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
     { FRAC_CONST(0.999657332897186), FRAC_CONST(0.026176949962974) },
@@ -1680,6 +1680,138 @@
 
 #endif
 
+ALIGN static const complex_t cfft_tab_128[] =
+{
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
+    { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+    { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+    { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+    { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
+    { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+    { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+    { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+    { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
+    { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+    { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
+    { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+    { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
+    { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+    { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+    { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+    { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
+    { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+    { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
+    { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+    { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
+    { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
+    { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) },
+    { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+    { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) },
+    { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) },
+    { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) },
+    { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) },
+    { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+    { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) },
+    { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+    { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
+    { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) },
+    { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) },
+    { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) },
+    { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) },
+    { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+    { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) },
+    { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) },
+    { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) },
+    { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+    { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
+    { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) },
+    { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) },
+    { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+    { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) },
+    { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) },
+    { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+    { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+    { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+    { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+    { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+    { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+    { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+    { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+    { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+    { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+    { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+    { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+    { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+    { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
+    { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+    { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
+    { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+    { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
+    { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
+    { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+    { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+    { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+    { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) }
+};
+
 #endif
 
 #ifdef __cplusplus
--- a/Plugins/Input/aac/libfaad2/codebook/hcb_sf.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/codebook/hcb_sf.h	Wed Nov 16 16:21:11 2005 -0800
@@ -22,7 +22,7 @@
 ** 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 $
+** $Id: hcb_sf.h,v 1.5 2004/02/04 19:55:02 menno Exp $
 **/
 
 /* Binary search huffman table HCB_SF */
--- a/Plugins/Input/aac/libfaad2/common.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/common.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,19 +1,19 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
-**  
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
+**
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
 ** the Free Software Foundation; either version 2 of the License, or
 ** (at your option) any later version.
-** 
+**
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ** GNU General Public License for more details.
-** 
+**
 ** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software 
+** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
 ** Any non-GPL usage of this software or parts of this software is strictly
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: common.c,v 1.12 2003/11/12 20:47:57 menno Exp $
+** $Id: common.c,v 1.22 2004/09/08 09:43:11 gcp Exp $
 **/
 
 /* just some common functions that could be used anywhere */
@@ -30,10 +30,12 @@
 #include "common.h"
 #include "structs.h"
 
+#include <stdlib.h>
 #include "syntax.h"
 
+
 /* Returns the sample rate index based on the samplerate */
-uint8_t get_sr_index(uint32_t samplerate)
+uint8_t get_sr_index(const uint32_t samplerate)
 {
     if (92017 <= samplerate) return 0;
     if (75132 <= samplerate) return 1;
@@ -52,7 +54,7 @@
 }
 
 /* Returns the sample rate based on the sample rate index */
-uint32_t get_sample_rate(uint8_t sr_index)
+uint32_t get_sample_rate(const uint8_t sr_index)
 {
     static const uint32_t sample_rates[] =
     {
@@ -66,7 +68,7 @@
     return 0;
 }
 
-uint8_t max_pred_sfb(uint8_t sr_index)
+uint8_t max_pred_sfb(const uint8_t sr_index)
 {
     static const uint8_t pred_sfb_max[] =
     {
@@ -80,9 +82,10 @@
     return 0;
 }
 
-uint8_t max_tns_sfb(uint8_t sr_index, uint8_t object_type, uint8_t is_short)
+uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type,
+                    const uint8_t is_short)
 {
-    /* entry for each sampling rate	
+    /* entry for each sampling rate
      * 1    Main/LC long window
      * 2    Main/LC short window
      * 3    SSR long window
@@ -116,7 +119,7 @@
 }
 
 /* Returns 0 if an object type is decodable, otherwise returns -1 */
-int8_t can_decode_ot(uint8_t object_type)
+int8_t can_decode_ot(const uint8_t object_type)
 {
     switch (object_type)
     {
@@ -166,16 +169,34 @@
     return -1;
 }
 
+void *faad_malloc(size_t size)
+{
+#if 0 // defined(_WIN32) && !defined(_WIN32_WCE)
+    return _aligned_malloc(size, 16);
+#else   // #ifdef 0
+    return malloc(size);
+#endif  // #ifdef 0
+}
+
+/* common free function */
+void faad_free(void *b)
+{
+#if 0 // defined(_WIN32) && !defined(_WIN32_WCE)
+    _aligned_free(b);
+#else
+    free(b);
+}
+#endif
 
 static const  uint8_t    Parity [256] = {  // parity
-	0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
-	1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
-	1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
-	0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
-	1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
-	0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
-	0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
-	1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0
+    0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
+    1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
+    1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
+    0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
+    1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
+    0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
+    0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
+    1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0
 };
 
 static uint32_t  __r1 = 1;
@@ -210,21 +231,289 @@
  */
 uint32_t random_int(void)
 {
-    static const uint32_t rnd_seed = 16428320;
-	uint32_t  t1, t2, t3, t4;
+    uint32_t  t1, t2, t3, t4;
+
+    t3   = t1 = __r1;   t4   = t2 = __r2;       // Parity calculation is done via table lookup, this is also available
+    t1  &= 0xF5;        t2 >>= 25;              // on CPUs without parity, can be implemented in C and avoid unpredictable
+    t1   = Parity [t1]; t2  &= 0x63;            // jumps and slow rotate through the carry flag operations.
+    t1 <<= 31;          t2   = Parity [t2];
+
+    return (__r1 = (t3 >> 1) | t1 ) ^ (__r2 = (t4 + t4) | t2 );
+}
+
+uint32_t ones32(uint32_t x)
+{
+    x -= ((x >> 1) & 0x55555555);
+    x = (((x >> 2) & 0x33333333) + (x & 0x33333333));
+    x = (((x >> 4) + x) & 0x0f0f0f0f);
+    x += (x >> 8);
+    x += (x >> 16);
+
+    return (x & 0x0000003f);
+}
+
+uint32_t floor_log2(uint32_t x)
+{
+#if 1
+    x |= (x >> 1);
+    x |= (x >> 2);
+    x |= (x >> 4);
+    x |= (x >> 8);
+    x |= (x >> 16);
 
-	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 (ones32(x) - 1);
+#else
+    uint32_t count = 0;
+
+    while (x >>= 1)
+        count++;
+
+    return count;
+#endif
+}
 
-	return (__r1 = (t3 >> 1) | t1 ) ^ (__r2 = (t4 + t4) | t2 );
+/* returns position of first bit that is not 0 from msb,
+ * starting count at lsb */
+uint32_t wl_min_lzc(uint32_t x)
+{
+#if 1
+    x |= (x >> 1);
+    x |= (x >> 2);
+    x |= (x >> 4);
+    x |= (x >> 8);
+    x |= (x >> 16);
+
+    return (ones32(x));
+#else
+    uint32_t count = 0;
+
+    while (x >>= 1)
+        count++;
+
+    return (count + 1);
+#endif
 }
 
-#define LOG2 0.30102999566398
+#ifdef FIXED_POINT
+
+#define TABLE_BITS 6
+/* just take the maximum number of bits for interpolation */
+#define INTERP_BITS (REAL_BITS-TABLE_BITS)
+
+static const real_t pow2_tab[] = {
+    REAL_CONST(1.000000000000000), REAL_CONST(1.010889286051701), REAL_CONST(1.021897148654117),
+    REAL_CONST(1.033024879021228), REAL_CONST(1.044273782427414), REAL_CONST(1.055645178360557),
+    REAL_CONST(1.067140400676824), REAL_CONST(1.078760797757120), REAL_CONST(1.090507732665258),
+    REAL_CONST(1.102382583307841), REAL_CONST(1.114386742595892), REAL_CONST(1.126521618608242),
+    REAL_CONST(1.138788634756692), REAL_CONST(1.151189229952983), REAL_CONST(1.163724858777578),
+    REAL_CONST(1.176396991650281), REAL_CONST(1.189207115002721), REAL_CONST(1.202156731452703),
+    REAL_CONST(1.215247359980469), REAL_CONST(1.228480536106870), REAL_CONST(1.241857812073484),
+    REAL_CONST(1.255380757024691), REAL_CONST(1.269050957191733), REAL_CONST(1.282870016078778),
+    REAL_CONST(1.296839554651010), REAL_CONST(1.310961211524764), REAL_CONST(1.325236643159741),
+    REAL_CONST(1.339667524053303), REAL_CONST(1.354255546936893), REAL_CONST(1.369002422974591),
+    REAL_CONST(1.383909881963832), REAL_CONST(1.398979672538311), REAL_CONST(1.414213562373095),
+    REAL_CONST(1.429613338391970), REAL_CONST(1.445180806977047), REAL_CONST(1.460917794180647),
+    REAL_CONST(1.476826145939499), REAL_CONST(1.492907728291265), REAL_CONST(1.509164427593423),
+    REAL_CONST(1.525598150744538), REAL_CONST(1.542210825407941), REAL_CONST(1.559004400237837),
+    REAL_CONST(1.575980845107887), REAL_CONST(1.593142151342267), REAL_CONST(1.610490331949254),
+    REAL_CONST(1.628027421857348), REAL_CONST(1.645755478153965), REAL_CONST(1.663676580326736),
+    REAL_CONST(1.681792830507429), REAL_CONST(1.700106353718524), REAL_CONST(1.718619298122478),
+    REAL_CONST(1.737333835273706), REAL_CONST(1.756252160373300), REAL_CONST(1.775376492526521),
+    REAL_CONST(1.794709075003107), REAL_CONST(1.814252175500399), REAL_CONST(1.834008086409342),
+    REAL_CONST(1.853979125083386), REAL_CONST(1.874167634110300), REAL_CONST(1.894575981586966),
+    REAL_CONST(1.915206561397147), REAL_CONST(1.936061793492294), REAL_CONST(1.957144124175400),
+    REAL_CONST(1.978456026387951), REAL_CONST(2.000000000000000)
+};
 
-int32_t int_log2(int32_t val)
+static const real_t log2_tab[] = {
+    REAL_CONST(0.000000000000000), REAL_CONST(0.022367813028455), REAL_CONST(0.044394119358453),
+    REAL_CONST(0.066089190457772), REAL_CONST(0.087462841250339), REAL_CONST(0.108524456778169),
+    REAL_CONST(0.129283016944966), REAL_CONST(0.149747119504682), REAL_CONST(0.169925001442312),
+    REAL_CONST(0.189824558880017), REAL_CONST(0.209453365628950), REAL_CONST(0.228818690495881),
+    REAL_CONST(0.247927513443585), REAL_CONST(0.266786540694901), REAL_CONST(0.285402218862248),
+    REAL_CONST(0.303780748177103), REAL_CONST(0.321928094887362), REAL_CONST(0.339850002884625),
+    REAL_CONST(0.357552004618084), REAL_CONST(0.375039431346925), REAL_CONST(0.392317422778760),
+    REAL_CONST(0.409390936137702), REAL_CONST(0.426264754702098), REAL_CONST(0.442943495848728),
+    REAL_CONST(0.459431618637297), REAL_CONST(0.475733430966398), REAL_CONST(0.491853096329675),
+    REAL_CONST(0.507794640198696), REAL_CONST(0.523561956057013), REAL_CONST(0.539158811108031),
+    REAL_CONST(0.554588851677637), REAL_CONST(0.569855608330948), REAL_CONST(0.584962500721156),
+    REAL_CONST(0.599912842187128), REAL_CONST(0.614709844115208), REAL_CONST(0.629356620079610),
+    REAL_CONST(0.643856189774725), REAL_CONST(0.658211482751795), REAL_CONST(0.672425341971496),
+    REAL_CONST(0.686500527183218), REAL_CONST(0.700439718141092), REAL_CONST(0.714245517666123),
+    REAL_CONST(0.727920454563199), REAL_CONST(0.741466986401147), REAL_CONST(0.754887502163469),
+    REAL_CONST(0.768184324776926), REAL_CONST(0.781359713524660), REAL_CONST(0.794415866350106),
+    REAL_CONST(0.807354922057604), REAL_CONST(0.820178962415188), REAL_CONST(0.832890014164742),
+    REAL_CONST(0.845490050944375), REAL_CONST(0.857980995127572), REAL_CONST(0.870364719583405),
+    REAL_CONST(0.882643049361841), REAL_CONST(0.894817763307943), REAL_CONST(0.906890595608519),
+    REAL_CONST(0.918863237274595), REAL_CONST(0.930737337562886), REAL_CONST(0.942514505339240),
+    REAL_CONST(0.954196310386875), REAL_CONST(0.965784284662087), REAL_CONST(0.977279923499917),
+    REAL_CONST(0.988684686772166), REAL_CONST(1.000000000000000)
+};
+
+real_t pow2_fix(real_t val)
 {
-    return (int32_t)ceil(log(val)/log(2));
+    uint32_t x1, x2;
+    uint32_t errcorr;
+    uint32_t index_frac;
+    real_t retval;
+    int32_t whole = (val >> REAL_BITS);
+
+    /* rest = [0..1] */
+    int32_t rest = val - (whole << REAL_BITS);
+
+    /* index into pow2_tab */
+    int32_t index = rest >> (REAL_BITS-TABLE_BITS);
+
+
+    if (val == 0)
+        return (1<<REAL_BITS);
+
+    /* leave INTERP_BITS bits */
+    index_frac = rest >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
+    index_frac = index_frac & ((1<<INTERP_BITS)-1);
+
+    if (whole > 0)
+    {
+        retval = 1 << whole;
+    } else {
+        retval = REAL_CONST(1) >> -whole;
+    }
+
+    x1 = pow2_tab[index & ((1<<TABLE_BITS)-1)];
+    x2 = pow2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
+    errcorr = ( (index_frac*(x2-x1))) >> INTERP_BITS;
+
+    if (whole > 0)
+    {
+        retval = retval * (errcorr + x1);
+    } else {
+        retval = MUL_R(retval, (errcorr + x1));
+    }
+
+    return retval;
 }
 
+int32_t pow2_int(real_t val)
+{
+    uint32_t x1, x2;
+    uint32_t errcorr;
+    uint32_t index_frac;
+    real_t retval;
+    int32_t whole = (val >> REAL_BITS);
+
+    /* rest = [0..1] */
+    int32_t rest = val - (whole << REAL_BITS);
+
+    /* index into pow2_tab */
+    int32_t index = rest >> (REAL_BITS-TABLE_BITS);
+
+
+    if (val == 0)
+        return 1;
+
+    /* leave INTERP_BITS bits */
+    index_frac = rest >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
+    index_frac = index_frac & ((1<<INTERP_BITS)-1);
+
+    if (whole > 0)
+        retval = 1 << whole;
+    else
+        retval = 0;
+
+    x1 = pow2_tab[index & ((1<<TABLE_BITS)-1)];
+    x2 = pow2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
+    errcorr = ( (index_frac*(x2-x1))) >> INTERP_BITS;
+
+    retval = MUL_R(retval, (errcorr + x1));
+
+    return retval;
+}
+
+/* ld(x) = ld(x*y/y) = ld(x/y) + ld(y), with y=2^N and [1 <= (x/y) < 2] */
+int32_t log2_int(uint32_t val)
+{
+    uint32_t frac;
+    uint32_t whole = (val);
+    int32_t exp = 0;
+    uint32_t index;
+    uint32_t index_frac;
+    uint32_t x1, x2;
+    uint32_t errcorr;
+
+    /* error */
+    if (val == 0)
+        return -10000;
+
+    exp = floor_log2(val);
+    exp -= REAL_BITS;
+
+    /* frac = [1..2] */
+    if (exp >= 0)
+        frac = val >> exp;
+    else
+        frac = val << -exp;
+
+    /* index in the log2 table */
+    index = frac >> (REAL_BITS-TABLE_BITS);
+
+    /* leftover part for linear interpolation */
+    index_frac = frac & ((1<<(REAL_BITS-TABLE_BITS))-1);
+
+    /* leave INTERP_BITS bits */
+    index_frac = index_frac >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
+
+    x1 = log2_tab[index & ((1<<TABLE_BITS)-1)];
+    x2 = log2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
+
+    /* linear interpolation */
+    /* retval = exp + ((index_frac)*x2 + (1-index_frac)*x1) */
+
+    errcorr = (index_frac * (x2-x1)) >> INTERP_BITS;
+
+    return ((exp+REAL_BITS) << REAL_BITS) + errcorr + x1;
+}
+
+/* ld(x) = ld(x*y/y) = ld(x/y) + ld(y), with y=2^N and [1 <= (x/y) < 2] */
+real_t log2_fix(uint32_t val)
+{
+    uint32_t frac;
+    uint32_t whole = (val >> REAL_BITS);
+    int8_t exp = 0;
+    uint32_t index;
+    uint32_t index_frac;
+    uint32_t x1, x2;
+    uint32_t errcorr;
+
+    /* error */
+    if (val == 0)
+        return -100000;
+
+    exp = floor_log2(val);
+    exp -= REAL_BITS;
+
+    /* frac = [1..2] */
+    if (exp >= 0)
+        frac = val >> exp;
+    else
+        frac = val << -exp;
+
+    /* index in the log2 table */
+    index = frac >> (REAL_BITS-TABLE_BITS);
+
+    /* leftover part for linear interpolation */
+    index_frac = frac & ((1<<(REAL_BITS-TABLE_BITS))-1);
+
+    /* leave INTERP_BITS bits */
+    index_frac = index_frac >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
+
+    x1 = log2_tab[index & ((1<<TABLE_BITS)-1)];
+    x2 = log2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
+
+    /* linear interpolation */
+    /* retval = exp + ((index_frac)*x2 + (1-index_frac)*x1) */
+
+    errcorr = (index_frac * (x2-x1)) >> INTERP_BITS;
+
+    return (exp << REAL_BITS) + errcorr + x1;
+}
+#endif
--- a/Plugins/Input/aac/libfaad2/common.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/common.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,19 +1,19 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
-**  
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
+**
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
 ** the Free Software Foundation; either version 2 of the License, or
 ** (at your option) any later version.
-** 
+**
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ** GNU General Public License for more details.
-** 
+**
 ** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software 
+** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
 ** Any non-GPL usage of this software or parts of this software is strictly
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: common.h,v 1.38 2003/11/12 20:47:57 menno Exp $
+** $Id: common.h,v 1.65 2004/09/08 09:43:11 gcp Exp $
 **/
 
 #ifndef __COMMON_H__
@@ -32,7 +32,16 @@
 extern "C" {
 #endif
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #define INLINE __inline
+#if 0 //defined(_WIN32) && !defined(_WIN32_WCE)
+#define ALIGN __declspec(align(16))
+#else
+#define ALIGN
+#endif
 
 #ifndef max
 #define max(a, b) (((a) > (b)) ? (a) : (b))
@@ -47,6 +56,10 @@
 /* #define USE_DOUBLE_PRECISION */
 /* use fixed point reals */
 //#define FIXED_POINT
+//#define BIG_IQ_TABLE
+
+/* Use if target platform has address generators with autoincrement */
+//#define PREFER_POINTERS
 
 #ifdef _WIN32_WCE
 #define FIXED_POINT
@@ -64,8 +77,11 @@
 #define LTP_DEC
 /* Allow decoding of LD profile AAC */
 #define LD_DEC
+/* Allow decoding of scalable profiles */
+//#define SCALABLE_DEC
 /* Allow decoding of Digital Radio Mondiale (DRM) */
 //#define DRM
+//#define DRM_PS
 
 /* LD can't do without LTP */
 #ifdef LD_DEC
@@ -80,9 +96,10 @@
 #define ALLOW_SMALL_FRAMELENGTH
 
 
-// Define LC_ONLY_DECODER if you want a pure AAC LC decoder (independant of SBR_DEC)
+// Define LC_ONLY_DECODER if you want a pure AAC LC decoder (independant of SBR_DEC and PS_DEC)
 //#define LC_ONLY_DECODER
 #ifdef LC_ONLY_DECODER
+  #undef LD_DEC
   #undef LTP_DEC
   #undef MAIN_DEC
   #undef SSR_DEC
@@ -93,21 +110,28 @@
 
 #define SBR_DEC
 //#define SBR_LOW_POWER
+#define PS_DEC
 
-/* FIXED POINT: No MAIN decoding, forced SBR Low Power decoder */
+/* FIXED POINT: No MAIN decoding */
 #ifdef FIXED_POINT
 # ifdef MAIN_DEC
 #  undef MAIN_DEC
 # endif
-# ifndef SBR_LOW_POWER
-#  define SBR_LOW_POWER
-# endif
 #endif // FIXED_POINT
 
+#ifdef DRM
+# ifndef SCALABLE_DEC
+#  define SCALABLE_DEC
+# endif
+#endif
+
+
 #ifdef FIXED_POINT
-#define SBR_DIV(A, B) (((int64_t)A << REAL_BITS)/B)
+#define DIV_R(A, B) (((int64_t)A << REAL_BITS)/B)
+#define DIV_C(A, B) (((int64_t)A << COEF_BITS)/B)
 #else
-#define SBR_DIV(A, B) ((A)/(B))
+#define DIV_R(A, B) ((A)/(B))
+#define DIV_C(A, B) ((A)/(B))
 #endif
 
 #ifndef SBR_LOW_POWER
@@ -123,13 +147,9 @@
 
 /* END COMPILE TIME DEFINITIONS */
 
-#ifndef FIXED_POINT
-#define POW_TABLE_SIZE 200
-#endif
+#if defined(_WIN32) && !defined(__MINGW32__)
 
-
-#if defined(_WIN32)
-
+#include <stdlib.h>
 
 typedef unsigned __int64 uint64_t;
 typedef unsigned __int32 uint32_t;
@@ -144,10 +164,6 @@
 
 #else
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
-
 #include <stdio.h>
 #if HAVE_SYS_TYPES_H
 # include <sys/types.h>
@@ -226,12 +242,6 @@
 
 #if defined(FIXED_POINT)
 
-  #ifdef HAS_MATHF_H
-    #include <mathf.h>
-  #else
-    #include <math.h>
-  #endif
-
   #include "fixed.h"
 
 #elif defined(USE_DOUBLE_PRECISION)
@@ -254,6 +264,7 @@
 
   #define REAL_CONST(A) ((real_t)(A))
   #define COEF_CONST(A) ((real_t)(A))
+  #define Q2_CONST(A) ((real_t)(A))
   #define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */
 
 #else /* Normal floating point operation */
@@ -266,6 +277,7 @@
 
   #define REAL_CONST(A) ((real_t)(A))
   #define COEF_CONST(A) ((real_t)(A))
+  #define Q2_CONST(A) ((real_t)(A))
   #define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */
 
   /* Complex multiplication */
@@ -277,7 +289,7 @@
   }
 
 
-  #ifdef _WIN32
+  #if defined(_WIN32) && !defined(__MINGW32__)
     #define HAS_LRINTF
     static INLINE int lrintf(float f)
     {
@@ -289,6 +301,19 @@
         }
         return i;
     }
+  #elif (defined(__i386__) && defined(__GNUC__))
+    #define HAS_LRINTF
+    // from http://www.stereopsis.com/FPU.html
+    static INLINE int lrintf(float f)
+    {
+        int i;
+        __asm__ __volatile__ (
+            "flds %1        \n\t"
+            "fistpl %0      \n\t"
+            : "=m" (i)
+            : "m" (f));
+        return i;
+    }
   #endif
 
 
@@ -353,16 +378,41 @@
 
 
 /* common functions */
-int32_t int_log2(int32_t val);
+uint8_t cpu_has_sse(void);
 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);
+uint32_t ones32(uint32_t x);
+uint32_t floor_log2(uint32_t x);
+uint32_t wl_min_lzc(uint32_t x);
+#ifdef FIXED_POINT
+#define LOG2_MIN_INF REAL_CONST(-10000)
+int32_t log2_int(uint32_t val);
+int32_t log2_fix(uint32_t val);
+int32_t pow2_int(real_t val);
+real_t pow2_fix(real_t val);
+#endif
+uint8_t get_sr_index(const uint32_t samplerate);
+uint8_t max_pred_sfb(const uint8_t sr_index);
+uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type,
+                    const uint8_t is_short);
+uint32_t get_sample_rate(const uint8_t sr_index);
+int8_t can_decode_ot(const uint8_t object_type);
+
+void *faad_malloc(size_t size);
+void faad_free(void *b);
+
+//#define PROFILE
+#ifdef PROFILE
+static int64_t faad_get_ts()
+{
+    __asm
+    {
+        rdtsc
+    }
+}
+#endif
 
 #ifndef M_PI
-#define M_PI 3.14159265358979323846f
+#define M_PI 3.14159265358979323846
 #endif
 #ifndef M_PI_2 /* PI/2 */
 #define M_PI_2 1.57079632679489661923
--- a/Plugins/Input/aac/libfaad2/decoder.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/decoder.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: decoder.c,v 1.82 2003/11/12 20:47:57 menno Exp $
+** $Id: decoder.c,v 1.107 2004/09/08 09:43:11 gcp Exp $
 **/
 
 #include "common.h"
@@ -36,8 +36,11 @@
 #include "syntax.h"
 #include "error.h"
 #include "output.h"
+#include "filtbank.h"
+#include "drc.h"
 #ifdef SBR_DEC
 #include "sbr_dec.h"
+#include "sbr_syntax.h"
 #endif
 #ifdef SSR_DEC
 #include "ssr.h"
@@ -47,14 +50,21 @@
 uint16_t dbg_count;
 #endif
 
-int8_t* FAADAPI faacDecGetErrorMessage(uint8_t errcode)
+/* static function declarations */
+static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
+                              uint8_t *buffer, uint32_t buffer_size,
+                              void **sample_buffer, uint32_t sample_buffer_size);
+static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo);
+
+
+char* NEAACDECAPI NeAACDecGetErrorMessage(uint8_t errcode)
 {
     if (errcode >= NUM_ERROR_MESSAGES)
         return NULL;
     return err_msg[errcode];
 }
 
-uint32_t FAADAPI faacDecGetCapabilities()
+uint32_t NEAACDECAPI NeAACDecGetCapabilities(void)
 {
     uint32_t cap = 0;
 
@@ -80,15 +90,15 @@
     return cap;
 }
 
-faacDecHandle FAADAPI faacDecOpen()
+NeAACDecHandle NEAACDECAPI NeAACDecOpen(void)
 {
     uint8_t i;
-    faacDecHandle hDecoder = NULL;
+    NeAACDecHandle hDecoder = NULL;
 
-    if ((hDecoder = (faacDecHandle)malloc(sizeof(faacDecStruct))) == NULL)
+    if ((hDecoder = (NeAACDecHandle)faad_malloc(sizeof(NeAACDecStruct))) == NULL)
         return NULL;
 
-    memset(hDecoder, 0, sizeof(faacDecStruct));
+    memset(hDecoder, 0, sizeof(NeAACDecStruct));
 
     hDecoder->config.outputFormat  = FAAD_FMT_16BIT;
     hDecoder->config.defObjectType = MAIN;
@@ -110,9 +120,7 @@
     {
         hDecoder->window_shape_prev[i] = 0;
         hDecoder->time_out[i] = NULL;
-#ifdef SBR_DEC
-        hDecoder->time_out2[i] = NULL;
-#endif
+        hDecoder->fb_intermed[i] = NULL;
 #ifdef SSR_DEC
         hDecoder->ssr_overlap[i] = NULL;
         hDecoder->prev_fmd[i] = NULL;
@@ -127,7 +135,7 @@
     }
 
 #ifdef SBR_DEC
-    for (i = 0; i < 32; i++)
+    for (i = 0; i < MAX_SYNTAX_ELEMENTS; i++)
     {
         hDecoder->sbr[i] = NULL;
     }
@@ -135,25 +143,14 @@
 
     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)
+NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder)
 {
     if (hDecoder)
     {
-        faacDecConfigurationPtr config = &(hDecoder->config);
+        NeAACDecConfigurationPtr config = &(hDecoder->config);
 
         return config;
     }
@@ -161,8 +158,8 @@
     return NULL;
 }
 
-uint8_t FAADAPI faacDecSetConfiguration(faacDecHandle hDecoder,
-                                    faacDecConfigurationPtr config)
+uint8_t NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
+                                             NeAACDecConfigurationPtr config)
 {
     if (hDecoder && config)
     {
@@ -177,12 +174,18 @@
         hDecoder->config.defSampleRate = config->defSampleRate;
 
         /* check output format */
-        if ((config->outputFormat < 1) || (config->outputFormat > 9))
+#ifdef FIXED_POINT
+        if ((config->outputFormat < 1) || (config->outputFormat > 4))
             return 0;
+#else
+        if ((config->outputFormat < 1) || (config->outputFormat > 5))
+            return 0;
+#endif
         hDecoder->config.outputFormat = config->outputFormat;
 
         if (config->downMatrix > 1)
-            hDecoder->config.downMatrix = config->downMatrix;
+            return 0;
+        hDecoder->config.downMatrix = config->downMatrix;
 
         /* OK */
         return 1;
@@ -191,9 +194,9 @@
     return 0;
 }
 
-int32_t FAADAPI faacDecInit(faacDecHandle hDecoder, uint8_t *buffer,
-                            uint32_t buffer_size,
-                            uint32_t *samplerate, uint8_t *channels)
+int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder, uint8_t *buffer,
+                                 uint32_t buffer_size,
+                                 uint32_t *samplerate, uint8_t *channels)
 {
     uint32_t bits = 0;
     bitfile ld;
@@ -256,12 +259,23 @@
     }
     hDecoder->channelConfiguration = *channels;
 
+#if (defined(PS_DEC) || defined(DRM_PS))
+    /* check if we have a mono file */
+    if (*channels == 1)
+    {
+        /* upMatrix to 2 channels for implicit signalling of PS */
+        *channels = 2;
+    }
+#endif
+
 #ifdef SBR_DEC
     /* implicit signalling */
-    if (*samplerate <= 24000)
+    if (*samplerate <= 24000 && !(hDecoder->config.dontUpSampleImplicitSBR))
     {
         *samplerate *= 2;
         hDecoder->forceUpSampling = 1;
+    } else if (*samplerate > 24000 && !(hDecoder->config.dontUpSampleImplicitSBR)) {
+        hDecoder->downSampledSBR = 1;
     }
 #endif
 
@@ -285,9 +299,9 @@
 }
 
 /* Init the library using a DecoderSpecificInfo */
-int8_t FAADAPI faacDecInit2(faacDecHandle hDecoder, uint8_t *pBuffer,
-                            uint32_t SizeOfDecoderSpecificInfo,
-                            uint32_t *samplerate, uint8_t *channels)
+int8_t NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, uint8_t *pBuffer,
+                                 uint32_t SizeOfDecoderSpecificInfo,
+                                 uint32_t *samplerate, uint8_t *channels)
 {
     int8_t rc;
     mp4AudioSpecificConfig mp4ASC;
@@ -317,6 +331,14 @@
         *channels = hDecoder->pce.channels;
         hDecoder->pce_set = 1;
     }
+#if (defined(PS_DEC) || defined(DRM_PS))
+    /* check if we have a mono file */
+    if (*channels == 1)
+    {
+        /* upMatrix to 2 channels for implicit signalling of PS */
+        *channels = 2;
+    }
+#endif
     hDecoder->sf_index = mp4ASC.samplingFrequencyIndex;
     hDecoder->object_type = mp4ASC.objectTypeIndex;
 #ifdef ERROR_RESILIENCE
@@ -326,10 +348,14 @@
 #endif
 #ifdef SBR_DEC
     hDecoder->sbr_present_flag = mp4ASC.sbr_present_flag;
-    hDecoder->forceUpSampling = mp4ASC.forceUpSampling;
+    hDecoder->downSampledSBR = mp4ASC.downSampledSBR;
+    if (hDecoder->config.dontUpSampleImplicitSBR == 0)
+        hDecoder->forceUpSampling = mp4ASC.forceUpSampling;
+    else
+        hDecoder->forceUpSampling = 0;
 
     /* AAC core decoder samplerate is 2 times as low */
-    if (hDecoder->sbr_present_flag == 1 || hDecoder->forceUpSampling == 1)
+    if (((hDecoder->sbr_present_flag == 1)&&(!hDecoder->downSampledSBR)) || hDecoder->forceUpSampling == 1)
     {
         hDecoder->sf_index = get_sr_index(mp4ASC.samplingFrequency / 2);
     }
@@ -364,105 +390,75 @@
 }
 
 #ifdef DRM
-int8_t FAADAPI faacDecInitDRM(faacDecHandle hDecoder, uint32_t samplerate,
-                              uint8_t channels)
+int8_t NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, uint32_t samplerate,
+                                   uint8_t channels)
 {
-    uint8_t i;
+    if (hDecoder == NULL)
+        return 1; /* error */
+
+    NeAACDecClose(*hDecoder);
+
+    *hDecoder = NeAACDecOpen();
 
     /* Special object type defined for DRM */
-    hDecoder->config.defObjectType = DRM_ER_LC;
+    (*hDecoder)->config.defObjectType = DRM_ER_LC;
 
-    hDecoder->config.defSampleRate = samplerate;
+    (*hDecoder)->config.defSampleRate = samplerate;
 #ifdef ERROR_RESILIENCE // This shoudl always be defined for DRM
-    hDecoder->aacSectionDataResilienceFlag = 1; /* VCB11 */
-    hDecoder->aacScalefactorDataResilienceFlag = 0; /* no RVLC */
-    hDecoder->aacSpectralDataResilienceFlag = 1; /* HCR */
+    (*hDecoder)->aacSectionDataResilienceFlag = 1; /* VCB11 */
+    (*hDecoder)->aacScalefactorDataResilienceFlag = 0; /* no RVLC */
+    (*hDecoder)->aacSpectralDataResilienceFlag = 1; /* HCR */
 #endif
-    hDecoder->frameLength = 960;
-    hDecoder->sf_index = get_sr_index(hDecoder->config.defSampleRate);
-    hDecoder->object_type = hDecoder->config.defObjectType;
+    (*hDecoder)->frameLength = 960;
+    (*hDecoder)->sf_index = get_sr_index((*hDecoder)->config.defSampleRate);
+    (*hDecoder)->object_type = (*hDecoder)->config.defObjectType;
 
     if ((channels == DRMCH_STEREO) || (channels == DRMCH_SBR_STEREO))
-        hDecoder->channelConfiguration = 2;
+        (*hDecoder)->channelConfiguration = 2;
     else
-        hDecoder->channelConfiguration = 1;
+        (*hDecoder)->channelConfiguration = 1;
 
 #ifdef SBR_DEC
-    if (channels == DRMCH_SBR_LC_STEREO)
-        hDecoder->lcstereo_flag = 1;
-    else
-        hDecoder->lcstereo_flag = 0;
-
     if ((channels == DRMCH_MONO) || (channels == DRMCH_STEREO))
-        hDecoder->sbr_present_flag = 0;
+        (*hDecoder)->sbr_present_flag = 0;
     else
-        hDecoder->sbr_present_flag = 1;
-
-    /* Reset sbr for new initialization */
-    sbrDecodeEnd(hDecoder->sbr[0]);
-    hDecoder->sbr[0] = NULL;
-#endif
-
-    /* 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;
+        (*hDecoder)->sbr_present_flag = 1;    
+#endif        
 
-    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
-    }
+    (*hDecoder)->fb = filter_bank_init((*hDecoder)->frameLength);
 
     return 0;
 }
 #endif
 
-void FAADAPI faacDecClose(faacDecHandle hDecoder)
+void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder)
 {
     uint8_t i;
 
     if (hDecoder == NULL)
         return;
 
+#ifdef PROFILE
+    printf("AAC decoder total:  %I64d cycles\n", hDecoder->cycles);
+    printf("requant:            %I64d cycles\n", hDecoder->requant_cycles);
+    printf("spectral_data:      %I64d cycles\n", hDecoder->spectral_cycles);
+    printf("scalefactors:       %I64d cycles\n", hDecoder->scalefac_cycles);
+    printf("output:             %I64d cycles\n", hDecoder->output_cycles);
+#endif
+
     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
+        if (hDecoder->time_out[i]) faad_free(hDecoder->time_out[i]);
+        if (hDecoder->fb_intermed[i]) faad_free(hDecoder->fb_intermed[i]);
 #ifdef SSR_DEC
-        if (hDecoder->ssr_overlap[i]) free(hDecoder->ssr_overlap[i]);
-        if (hDecoder->prev_fmd[i]) free(hDecoder->prev_fmd[i]);
+        if (hDecoder->ssr_overlap[i]) faad_free(hDecoder->ssr_overlap[i]);
+        if (hDecoder->prev_fmd[i]) faad_free(hDecoder->prev_fmd[i]);
 #endif
 #ifdef MAIN_DEC
-        if (hDecoder->pred_stat[i]) free(hDecoder->pred_stat[i]);
+        if (hDecoder->pred_stat[i]) faad_free(hDecoder->pred_stat[i]);
 #endif
 #ifdef LTP_DEC
-        if (hDecoder->lt_pred_stat[i]) free(hDecoder->lt_pred_stat[i]);
+        if (hDecoder->lt_pred_stat[i]) faad_free(hDecoder->lt_pred_stat[i]);
 #endif
     }
 
@@ -475,26 +471,20 @@
 
     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);
+    if (hDecoder->sample_buffer) faad_free(hDecoder->sample_buffer);
 
 #ifdef SBR_DEC
-    for (i = 0; i < 32; i++)
+    for (i = 0; i < MAX_SYNTAX_ELEMENTS; i++)
     {
         if (hDecoder->sbr[i])
             sbrDecodeEnd(hDecoder->sbr[i]);
     }
 #endif
 
-    if (hDecoder) free(hDecoder);
+    if (hDecoder) faad_free(hDecoder);
 }
 
-void FAADAPI faacDecPostSeekReset(faacDecHandle hDecoder, int32_t frame)
+void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, int32_t frame)
 {
     if (hDecoder)
     {
@@ -505,7 +495,7 @@
     }
 }
 
-static void create_channel_config(faacDecHandle hDecoder, faacDecFrameInfo *hInfo)
+static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo)
 {
     hInfo->num_front_channels = 0;
     hInfo->num_side_channels = 0;
@@ -710,40 +700,42 @@
     }
 }
 
-void* FAADAPI faacDecDecode(faacDecHandle hDecoder,
-                            faacDecFrameInfo *hInfo,
-                            uint8_t *buffer, uint32_t buffer_size)
+void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
+                                 NeAACDecFrameInfo *hInfo,
+                                 uint8_t *buffer, uint32_t buffer_size)
+{
+    return aac_frame_decode(hDecoder, hInfo, buffer, buffer_size, NULL, 0);
+}
+
+void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
+                                  NeAACDecFrameInfo *hInfo,
+                                  uint8_t *buffer, uint32_t buffer_size,
+                                  void **sample_buffer, uint32_t sample_buffer_size)
 {
-    adts_header adts;
-    uint8_t channels = 0, ch_ele = 0;
+    if ((sample_buffer == NULL) || (sample_buffer_size == 0))
+    {
+        hInfo->error = 27;
+        return NULL;
+    }
+
+    return aac_frame_decode(hDecoder, hInfo, buffer, buffer_size,
+        sample_buffer, sample_buffer_size);
+}
+
+static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
+                              uint8_t *buffer, uint32_t buffer_size,
+                              void **sample_buffer2, uint32_t sample_buffer_size)
+{
+    uint8_t channels = 0;
     uint8_t output_channels = 0;
     bitfile ld;
     uint32_t bitsconsumed;
-#ifdef DRM
-    uint8_t *revbuffer;
-    uint8_t *prevbufstart;
-    uint8_t *pbufend;
-#endif
+    uint16_t frame_len;
+    void *sample_buffer;
 
-    /* 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;
+#ifdef PROFILE
+    int64_t count = faad_get_ts();
 #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))
@@ -751,44 +743,56 @@
         return NULL;
     }
 
-    sf_index = hDecoder->sf_index;
-    object_type = hDecoder->object_type;
-    channelConfiguration = hDecoder->channelConfiguration;
-#ifdef MAIN_DEC
-    pred_stat = hDecoder->pred_stat;
+#if 0
+    printf("%d\n", buffer_size*8);
 #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(hInfo, 0, sizeof(NeAACDecFrameInfo));
     memset(hDecoder->internal_channel, 0, MAX_CHANNELS*sizeof(hDecoder->internal_channel[0]));
 
     /* initialize the bitstream */
     faad_initbits(&ld, buffer, buffer_size);
 
-#ifdef DRM
-    if (object_type == DRM_ER_LC)
+#if 0
     {
+        int i;
+        for (i = 0; i < ((buffer_size+3)>>2); i++)
+        {
+            uint8_t *buf;
+            uint32_t temp = 0;
+            buf = faad_getbitbuffer(&ld, 32);
+            //temp = getdword((void*)buf);
+            temp = *((uint32_t*)buf);
+            printf("0x%.8X\n", temp);
+            free(buf);
+        }
+        faad_endbits(&ld);
+        faad_initbits(&ld, buffer, buffer_size);
+    }
+#endif
+
+#ifdef DRM
+    if (hDecoder->object_type == DRM_ER_LC)
+    {
+        /* We do not support stereo right now */
+        if (0) //(hDecoder->channelConfiguration == 2)
+        {
+            hInfo->error = 8; // Throw CRC error
+            goto error;
+        }
+
         faad_getbits(&ld, 8
-            DEBUGVAR(1,1,"faacDecDecode(): skip CRC"));
+            DEBUGVAR(1,1,"NeAACDecDecode(): skip CRC"));
     }
 #endif
 
     if (hDecoder->adts_header_present)
     {
+        adts_header adts;
+
         adts.old_format = hDecoder->config.useOldADTSFormat;
         if ((hInfo->error = adts_frame(&adts, &ld)) > 0)
             goto error;
@@ -804,14 +808,29 @@
 #endif
 
     /* decode the complete bitstream */
-    raw_data_block(hDecoder, hInfo, &ld, pce, drc);
+#ifdef SCALABLE_DEC
+    if ((hDecoder->object_type == 6) || (hDecoder->object_type == DRM_ER_LC))
+    {
+        aac_scalable_main_element(hDecoder, hInfo, &ld, &hDecoder->pce, hDecoder->drc);
+    } else {
+#endif
+        raw_data_block(hDecoder, hInfo, &ld, &hDecoder->pce, hDecoder->drc);
+#ifdef SCALABLE_DEC
+    }
+#endif
 
-    ch_ele = hDecoder->fr_ch_ele;
     channels = hDecoder->fr_channels;
 
     if (hInfo->error > 0)
         goto error;
 
+    /* safety check */
+    if (channels == 0 || channels > MAX_CHANNELS)
+    {
+        /* invalid number of channels */
+        hInfo->error = 12;
+        goto error;
+    }
 
     /* no more bit reading after this */
     bitsconsumed = faad_get_processed_bits(&ld);
@@ -823,50 +842,10 @@
     }
     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)
+        if (hDecoder->channelConfiguration == 0)
             hDecoder->channelConfiguration = channels;
 
         if (channels == 8) /* 7.1 */
@@ -883,6 +862,17 @@
         output_channels = channels;
     }
 
+#if (defined(PS_DEC) || defined(DRM_PS))
+    hDecoder->upMatrix = 0;
+    /* check if we have a mono file */
+    if (output_channels == 1)
+    {
+        /* upMatrix to 2 channels for implicit signalling of PS */
+        hDecoder->upMatrix = 1;
+        output_channels = 2;
+    }
+#endif
+
     /* Make a channel configuration based on either a PCE or a channelConfiguration */
     create_channel_config(hDecoder, hInfo);
 
@@ -902,6 +892,9 @@
         hInfo->header_type = ADIF;
     if (hDecoder->adts_header_present)
         hInfo->header_type = ADTS;
+#if (defined(PS_DEC) || defined(DRM_PS))
+    hInfo->ps = hDecoder->ps_used_global;
+#endif
 
     /* check if frame has channel elements */
     if (channels == 0)
@@ -911,77 +904,65 @@
     }
 
     /* allocate the buffer for the final samples */
-    if (hDecoder->sample_buffer == NULL)
+    if ((hDecoder->sample_buffer == NULL) ||
+        (hDecoder->alloced_channels != output_channels))
     {
         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];
+        uint8_t stride = str[hDecoder->config.outputFormat-1];
 #ifdef SBR_DEC
-        if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+        if (((hDecoder->sbr_present_flag == 1)&&(!hDecoder->downSampledSBR)) || (hDecoder->forceUpSampling == 1))
+        {
             stride = 2 * stride;
+        }
 #endif
-        hDecoder->sample_buffer = malloc(frame_len*channels*stride);
+        /* check if we want to use internal sample_buffer */
+        if (sample_buffer_size == 0)
+        {
+            if (hDecoder->sample_buffer)
+                faad_free(hDecoder->sample_buffer);
+            hDecoder->sample_buffer = NULL;
+            hDecoder->sample_buffer = faad_malloc(frame_len*output_channels*stride);
+        } else if (sample_buffer_size < frame_len*output_channels*stride) {
+            /* provided sample buffer is not big enough */
+            hInfo->error = 27;
+            return NULL;
+        }
+        hDecoder->alloced_channels = output_channels;
     }
 
-    sample_buffer = hDecoder->sample_buffer;
+    if (sample_buffer_size == 0)
+    {
+        sample_buffer = hDecoder->sample_buffer;
+    } else {
+        sample_buffer = *sample_buffer2;
+    }
 
 #ifdef SBR_DEC
     if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
     {
-        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));
-            }
+        uint8_t ele;
 
-            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));
-                }
+        /* this data is different when SBR is used or when the data is upsampled */
+        if (!hDecoder->downSampledSBR)
+        {
+            frame_len *= 2;
+            hInfo->samples *= 2;
+            hInfo->samplerate *= 2;
+        }
 
-                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++;
+        /* check if every element was provided with SBR data */
+        for (ele = 0; ele < hDecoder->fr_ch_ele; ele++)
+        {
+            if (hDecoder->sbr[ele] == NULL)
+            {
+                hInfo->error = 25;
+                goto error;
             }
         }
-        frame_len *= 2;
-        hInfo->samples *= 2;
-        hInfo->samplerate *= 2;
+
         /* sbr */
         if (hDecoder->sbr_present_flag == 1)
         {
@@ -990,22 +971,22 @@
         } 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
+        if (hDecoder->downSampledSBR)
+        {
+            hInfo->sbr = SBR_DOWNSAMPLED;
+        }
     }
 #endif
 
+    sample_buffer = output_to_PCM(hDecoder, hDecoder->time_out, sample_buffer,
+        output_channels, frame_len, hDecoder->config.outputFormat);
+
+
     hDecoder->postSeekResetFlag = 0;
 
     hDecoder->frame++;
 #ifdef LD_DEC
-    if (object_type != LD)
+    if (hDecoder->object_type != LD)
     {
 #endif
         if (hDecoder->frame <= 1)
@@ -1023,9 +1004,17 @@
     fflush(stdout);
 #endif
 
+#ifdef PROFILE
+    count = faad_get_ts() - count;
+    hDecoder->cycles += count;
+#endif
+
     return sample_buffer;
 
 error:
+
+    faad_endbits(&ld);
+
     /* cleanup */
 #ifdef ANALYSIS
     fflush(stdout);
--- a/Plugins/Input/aac/libfaad2/decoder.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/decoder.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: decoder.h,v 1.33 2003/11/12 20:47:57 menno Exp $
+** $Id: decoder.h,v 1.44 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __DECODER_H__
@@ -34,28 +34,22 @@
 
 #ifdef _WIN32
   #pragma pack(push, 8)
-  #ifndef FAADAPI
-    #define FAADAPI __cdecl
+  #ifndef NEAACDECAPI
+    #define NEAACDECAPI __cdecl
   #endif
 #else
-  #ifndef FAADAPI
-    #define FAADAPI
+  #ifndef NEAACDECAPI
+    #define NEAACDECAPI
   #endif
 #endif
 
-#include "bits.h"
-#include "syntax.h"
-#include "drc.h"
-#include "specrec.h"
-#include "filtbank.h"
-#include "ic_predict.h"
-
 
 /* library output formats */
 #define FAAD_FMT_16BIT  1
 #define FAAD_FMT_24BIT  2
 #define FAAD_FMT_32BIT  3
 #define FAAD_FMT_FLOAT  4
+#define FAAD_FMT_FIXED  FAAD_FMT_FLOAT
 #define FAAD_FMT_DOUBLE 5
 
 #define LC_DEC_CAP            (1<<0)
@@ -76,41 +70,46 @@
 #define LFE_CHANNEL          (9)
 #define UNKNOWN_CHANNEL      (0)
 
-int8_t* FAADAPI faacDecGetErrorMessage(uint8_t errcode);
+char* NEAACDECAPI NeAACDecGetErrorMessage(uint8_t errcode);
 
-uint32_t FAADAPI faacDecGetCapabilities();
+uint32_t NEAACDECAPI NeAACDecGetCapabilities(void);
 
-faacDecHandle FAADAPI faacDecOpen();
+NeAACDecHandle NEAACDECAPI NeAACDecOpen(void);
 
-faacDecConfigurationPtr FAADAPI faacDecGetCurrentConfiguration(faacDecHandle hDecoder);
+NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder);
 
-uint8_t FAADAPI faacDecSetConfiguration(faacDecHandle hDecoder,
-                                    faacDecConfigurationPtr config);
+uint8_t NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
+                                             NeAACDecConfigurationPtr config);
 
 /* Init the library based on info from the AAC file (ADTS/ADIF) */
-int32_t FAADAPI faacDecInit(faacDecHandle hDecoder,
-                            uint8_t *buffer,
-                            uint32_t buffer_size,
-                            uint32_t *samplerate,
-                            uint8_t *channels);
+int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder,
+                                 uint8_t *buffer,
+                                 uint32_t buffer_size,
+                                 uint32_t *samplerate,
+                                 uint8_t *channels);
 
 /* Init the library using a DecoderSpecificInfo */
-int8_t FAADAPI faacDecInit2(faacDecHandle hDecoder, uint8_t *pBuffer,
-                         uint32_t SizeOfDecoderSpecificInfo,
-                         uint32_t *samplerate, uint8_t *channels);
+int8_t NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, uint8_t *pBuffer,
+                                 uint32_t SizeOfDecoderSpecificInfo,
+                                 uint32_t *samplerate, uint8_t *channels);
 
 /* Init the library for DRM */
-int8_t FAADAPI faacDecInitDRM(faacDecHandle hDecoder, uint32_t samplerate,
-                              uint8_t channels);
+int8_t NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, uint32_t samplerate,
+                                   uint8_t channels);
 
-void FAADAPI faacDecClose(faacDecHandle hDecoder);
+void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder);
+
+void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, int32_t frame);
 
-void FAADAPI faacDecPostSeekReset(faacDecHandle hDecoder, int32_t frame);
+void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
+                                 NeAACDecFrameInfo *hInfo,
+                                 uint8_t *buffer,
+                                 uint32_t buffer_size);
 
-void* FAADAPI faacDecDecode(faacDecHandle hDecoder,
-                            faacDecFrameInfo *hInfo,
-                            uint8_t *buffer,
-                            uint32_t buffer_size);
+void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
+                                  NeAACDecFrameInfo *hInfo,
+                                  uint8_t *buffer, uint32_t buffer_size,
+                                  void **sample_buffer, uint32_t sample_buffer_size);
 
 #ifdef _WIN32
   #pragma pack(pop)
--- a/Plugins/Input/aac/libfaad2/drc.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/drc.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: drc.c,v 1.19 2003/11/12 20:47:57 menno Exp $
+** $Id: drc.c,v 1.24 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -35,7 +35,7 @@
 
 drc_info *drc_init(real_t cut, real_t boost)
 {
-    drc_info *drc = (drc_info*)malloc(sizeof(drc_info));
+    drc_info *drc = (drc_info*)faad_malloc(sizeof(drc_info));
     memset(drc, 0, sizeof(drc_info));
 
     drc->ctrl1 = cut;
@@ -51,7 +51,7 @@
 
 void drc_end(drc_info *drc)
 {
-    if (drc) free(drc);
+    if (drc) faad_free(drc);
 }
 
 #ifdef FIXED_POINT
--- a/Plugins/Input/aac/libfaad2/drc.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/drc.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: drc.h,v 1.13 2003/11/12 20:47:57 menno Exp $
+** $Id: drc.h,v 1.18 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __DRC_H__
--- a/Plugins/Input/aac/libfaad2/error.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/error.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,18 +22,18 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: error.c,v 1.16 2003/11/12 20:47:57 menno Exp $
+** $Id: error.c,v 1.28 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
 #include "error.h"
 
-extern int8_t *err_msg[] = {
+char *err_msg[] = {
     "No error",
     "Gain control not yet implemented",
     "Pulse coding not allowed in short blocks",
     "Invalid huffman codebook",
-    "Negative scalefactor found, should be impossible",
+    "Scalefactor out of range",
     "Unable to find ADTS syncword",
     "Channel coupling not yet implemented",
     "Channel configuration not allowed in error resilient frame",
@@ -41,9 +41,21 @@
     "Error decoding huffman scalefactor (bitstream error)",
     "Error decoding huffman codeword (bitstream error)",
     "Non existent huffman codebook number found",
-    "Maximum number of channels exceeded",
+    "Invalid number of channels",
     "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
+    "Maximum number of scalefactor bands exceeded",
+    "Quantised value out of range",
+    "LTP lag out of range",
+    "Invalid SBR parameter decoded",
+    "SBR called without being initialised",
+    "Unexpected channel configuration change",
+    "Error in program_config_element",
+    "First SBR frame is not the same as first AAC frame",
+    "Unexpected fill element with SBR data",
+    "Not all elements were provided with SBR data",
+    "LTP decoding not available",
+    "Output data buffer too small"
+};
+
--- a/Plugins/Input/aac/libfaad2/error.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/error.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: error.h,v 1.11 2003/11/12 20:47:57 menno Exp $
+** $Id: error.h,v 1.22 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __ERROR_H__
@@ -32,8 +32,8 @@
 extern "C" {
 #endif
 
-#define NUM_ERROR_MESSAGES 17
-extern int8_t *err_msg[];
+#define NUM_ERROR_MESSAGES 28
+extern char *err_msg[];
 
 #ifdef __cplusplus
 }
--- a/Plugins/Input/aac/libfaad2/filtbank.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/filtbank.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: filtbank.c,v 1.32 2003/11/12 20:47:57 menno Exp $
+** $Id: filtbank.c,v 1.41 2004/09/08 09:43:11 gcp Exp $
 **/
 
 #include "common.h"
@@ -51,7 +51,7 @@
     uint16_t frame_len_ld = frame_len/2;
 #endif
 
-    fb_info *fb = (fb_info*)malloc(sizeof(fb_info));
+    fb_info *fb = (fb_info*)faad_malloc(sizeof(fb_info));
     memset(fb, 0, sizeof(fb_info));
 
     /* normal */
@@ -94,19 +94,24 @@
 {
     if (fb != NULL)
     {
+#ifdef PROFILE
+        printf("FB:                 %I64d cycles\n", fb->cycles);
+#endif
+
         faad_mdct_end(fb->mdct256);
         faad_mdct_end(fb->mdct2048);
 #ifdef LD_DEC
         faad_mdct_end(fb->mdct1024);
 #endif
 
-        free(fb);
+        faad_free(fb);
     }
 }
 
-static INLINE void imdct(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len)
+static INLINE void imdct_long(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len)
 {
-    mdct_info *mdct;
+#ifdef LD_DEC
+    mdct_info *mdct = NULL;
 
     switch (len)
     {
@@ -114,25 +119,23 @@
     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);
+#else
+    faad_imdct(fb->mdct2048, in_data, out_data);
+#endif
 }
 
+
 #ifdef LTP_DEC
 static INLINE void mdct(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len)
 {
-    mdct_info *mdct;
+    mdct_info *mdct = NULL;
 
     switch (len)
     {
@@ -158,15 +161,16 @@
 
 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)
+                  real_t *time_out, real_t *overlap,
+                  uint8_t object_type, uint16_t frame_len)
 {
     int16_t i;
-    real_t transf_buf[2*1024] = {0};
+    ALIGN 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;
+    const real_t *window_long = NULL;
+    const real_t *window_long_prev = NULL;
+    const real_t *window_short = NULL;
+    const real_t *window_short_prev = NULL;
 
     uint16_t nlong = frame_len;
     uint16_t nshort = frame_len/8;
@@ -174,6 +178,11 @@
 
     uint16_t nflat_ls = (nlong-nshort)/2;
 
+#ifdef PROFILE
+    int64_t count = faad_get_ts();
+#endif
+
+    /* select windows of current frame and previous frame (Sine or KBD) */
 #ifdef LD_DEC
     if (object_type == LD)
     {
@@ -189,87 +198,138 @@
     }
 #endif
 
+#if 0
+    for (i = 0; i < 1024; i++)
+    {
+        printf("%d\n", freq_in[i]);
+    }
+#endif
+
+#if 0
+    printf("%d %d\n", window_sequence, window_shape);
+#endif
+
     switch (window_sequence)
     {
     case ONLY_LONG_SEQUENCE:
-        imdct(fb, freq_in, transf_buf, 2*nlong);
+        /* perform iMDCT */
+        imdct_long(fb, freq_in, transf_buf, 2*nlong);
+
+        /* add second half output of previous frame to windowed output of current frame */
         for (i = 0; i < nlong; i+=4)
         {
-            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]);
+            time_out[i]   = overlap[i]   + MUL_F(transf_buf[i],window_long_prev[i]);
+            time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]);
+            time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]);
+            time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]);
         }
+
+        /* window the second half and save as overlap for next frame */
         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]);
+            overlap[i]   = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]);
+            overlap[i+1] = MUL_F(transf_buf[nlong+i+1],window_long[nlong-2-i]);
+            overlap[i+2] = MUL_F(transf_buf[nlong+i+2],window_long[nlong-3-i]);
+            overlap[i+3] = MUL_F(transf_buf[nlong+i+3],window_long[nlong-4-i]);
         }
         break;
 
     case LONG_START_SEQUENCE:
-        imdct(fb, freq_in, transf_buf, 2*nlong);
+        /* perform iMDCT */
+        imdct_long(fb, freq_in, transf_buf, 2*nlong);
+
+        /* add second half output of previous frame to windowed output of current frame */
         for (i = 0; i < nlong; i+=4)
         {
-            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]);
+            time_out[i]   = overlap[i]   + MUL_F(transf_buf[i],window_long_prev[i]);
+            time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]);
+            time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]);
+            time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]);
         }
+
+        /* window the second half and save as overlap for next frame */
+        /* construct second half window using padding with 1's and 0's */
         for (i = 0; i < nflat_ls; i++)
-            time_out[nlong+i] = transf_buf[nlong+i];
+            overlap[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]);
+            overlap[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;
+            overlap[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);
+        /* perform iMDCT for each short block */
+        faad_imdct(fb->mdct256, freq_in+0*nshort, transf_buf+2*nshort*0);
+        faad_imdct(fb->mdct256, freq_in+1*nshort, transf_buf+2*nshort*1);
+        faad_imdct(fb->mdct256, freq_in+2*nshort, transf_buf+2*nshort*2);
+        faad_imdct(fb->mdct256, freq_in+3*nshort, transf_buf+2*nshort*3);
+        faad_imdct(fb->mdct256, freq_in+4*nshort, transf_buf+2*nshort*4);
+        faad_imdct(fb->mdct256, freq_in+5*nshort, transf_buf+2*nshort*5);
+        faad_imdct(fb->mdct256, freq_in+6*nshort, transf_buf+2*nshort*6);
+        faad_imdct(fb->mdct256, freq_in+7*nshort, transf_buf+2*nshort*7);
+
+        /* add second half output of previous frame to windowed output of current frame */
         for (i = 0; i < nflat_ls; i++)
-            time_out[i] = time_out[nlong+i];
-        for(i = nshort-1; i >= 0; i--)
+            time_out[i] = overlap[i];
+        for(i = 0; i < nshort; 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]);
+            time_out[nflat_ls+         i] = overlap[nflat_ls+         i] + MUL_F(transf_buf[nshort*0+i],window_short_prev[i]);
+            time_out[nflat_ls+1*nshort+i] = overlap[nflat_ls+nshort*1+i] + MUL_F(transf_buf[nshort*1+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*2+i],window_short[i]);
+            time_out[nflat_ls+2*nshort+i] = overlap[nflat_ls+nshort*2+i] + MUL_F(transf_buf[nshort*3+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*4+i],window_short[i]);
+            time_out[nflat_ls+3*nshort+i] = overlap[nflat_ls+nshort*3+i] + MUL_F(transf_buf[nshort*5+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*6+i],window_short[i]);
             if (i < trans)
-                time_out[nflat_ls+4*nshort+i] = 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]);
+                time_out[nflat_ls+4*nshort+i] = overlap[nflat_ls+nshort*4+i] + MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]);
+        }
+
+        /* window the second half and save as overlap for next frame */
+        for(i = 0; i < nshort; i++)
+        {
+            if (i >= trans)
+                overlap[nflat_ls+4*nshort+i-nlong] = MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]);
+            overlap[nflat_ls+5*nshort+i-nlong] = MUL_F(transf_buf[nshort*9+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*10+i],window_short[i]);
+            overlap[nflat_ls+6*nshort+i-nlong] = MUL_F(transf_buf[nshort*11+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*12+i],window_short[i]);
+            overlap[nflat_ls+7*nshort+i-nlong] = MUL_F(transf_buf[nshort*13+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*14+i],window_short[i]);
+            overlap[nflat_ls+8*nshort+i-nlong] = MUL_F(transf_buf[nshort*15+i],window_short[nshort-1-i]);
         }
         for (i = 0; i < nflat_ls; i++)
-            time_out[nlong+nflat_ls+nshort+i] = 0;
+            overlap[nflat_ls+nshort+i] = 0;
         break;
 
     case LONG_STOP_SEQUENCE:
-        imdct(fb, freq_in, transf_buf, 2*nlong);
+        /* perform iMDCT */
+        imdct_long(fb, freq_in, transf_buf, 2*nlong);
+
+        /* add second half output of previous frame to windowed output of current frame */
+        /* construct first half window using padding with 1's and 0's */
         for (i = 0; i < nflat_ls; i++)
-            time_out[i] = time_out[nlong+i];
+            time_out[i] = overlap[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]);
+            time_out[nflat_ls+i] = overlap[nflat_ls+i] + MUL_F(transf_buf[nflat_ls+i],window_short_prev[i]);
         for (i = 0; i < nflat_ls; i++)
-            time_out[nflat_ls+nshort+i] = time_out[nlong+nflat_ls+nshort+i] + transf_buf[nflat_ls+nshort+i];
+            time_out[nflat_ls+nshort+i] = overlap[nflat_ls+nshort+i] + transf_buf[nflat_ls+nshort+i];
+
+        /* window the second half and save as overlap for next frame */
         for (i = 0; i < nlong; i++)
-            time_out[nlong+i] = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]);
+            overlap[i] = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]);
 		break;
     }
+
+#if 0
+    for (i = 0; i < 1024; i++)
+    {
+        printf("%d\n", time_out[i]);
+        //printf("0x%.8X\n", time_out[i]);
+    }
+#endif
+
+
+#ifdef PROFILE
+    count = faad_get_ts() - count;
+    fb->cycles += count;
+#endif
 }
 
+
 #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,
@@ -277,12 +337,12 @@
                      uint8_t object_type, uint16_t frame_len)
 {
     int16_t i;
-    real_t windowed_buf[2*1024] = {0};
+    ALIGN 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;
+    const real_t *window_long = NULL;
+    const real_t *window_long_prev = NULL;
+    const real_t *window_short = NULL;
+    const real_t *window_short_prev = NULL;
 
     uint16_t nlong = frame_len;
     uint16_t nshort = frame_len/8;
--- a/Plugins/Input/aac/libfaad2/filtbank.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/filtbank.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: filtbank.h,v 1.17 2003/11/12 20:47:57 menno Exp $
+** $Id: filtbank.h,v 1.23 2004/09/08 09:43:11 gcp Exp $
 **/
 
 #ifndef __FILTBANK_H__
@@ -47,14 +47,10 @@
                      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);
+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, real_t *overlap,
+                  uint8_t object_type, uint16_t frame_len);
 
 #ifdef __cplusplus
 }
--- a/Plugins/Input/aac/libfaad2/fixed.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/fixed.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: fixed.h,v 1.15 2003/11/12 20:47:57 menno Exp $
+** $Id: fixed.h,v 1.26 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __FIXED_H__
@@ -32,6 +32,9 @@
 extern "C" {
 #endif
 
+#if defined(_WIN32_WCE) && defined(_ARM_)
+#include <cmnintrin.h>
+#endif
 
 #define COEF_BITS 28
 #define COEF_PRECISION (1 << COEF_BITS)
@@ -50,6 +53,11 @@
 #define REAL_CONST(A) (((A) >= 0) ? ((real_t)((A)*(REAL_PRECISION)+0.5)) : ((real_t)((A)*(REAL_PRECISION)-0.5)))
 #define COEF_CONST(A) (((A) >= 0) ? ((real_t)((A)*(COEF_PRECISION)+0.5)) : ((real_t)((A)*(COEF_PRECISION)-0.5)))
 #define FRAC_CONST(A) (((A) == 1.00) ? ((real_t)FRAC_MAX) : (((A) >= 0) ? ((real_t)((A)*(FRAC_PRECISION)+0.5)) : ((real_t)((A)*(FRAC_PRECISION)-0.5))))
+//#define FRAC_CONST(A) (((A) >= 0) ? ((real_t)((A)*(FRAC_PRECISION)+0.5)) : ((real_t)((A)*(FRAC_PRECISION)-0.5)))
+
+#define Q2_BITS 22
+#define Q2_PRECISION (1 << Q2_BITS)
+#define Q2_CONST(A) (((A) >= 0) ? ((real_t)((A)*(Q2_PRECISION)+0.5)) : ((real_t)((A)*(Q2_PRECISION)-0.5)))
 
 #if defined(_WIN32) && !defined(_WIN32_WCE)
 
@@ -73,6 +81,34 @@
     }
 }
 
+static INLINE real_t MUL_Q2(real_t A, real_t B)
+{
+    _asm {
+        mov eax,A
+        imul B
+        shrd eax,edx,Q2_BITS
+    }
+}
+
+static INLINE real_t MUL_SHIFT6(real_t A, real_t B)
+{
+    _asm {
+        mov eax,A
+        imul B
+        shrd eax,edx,6
+    }
+}
+
+static INLINE real_t MUL_SHIFT23(real_t A, real_t B)
+{
+    _asm {
+        mov eax,A
+        imul B
+        shrd eax,edx,23
+    }
+}
+
+#if 1
 static INLINE real_t _MulHigh(real_t A, real_t B)
 {
     _asm {
@@ -95,6 +131,24 @@
     *y1 = (_MulHigh(x1, c1) + _MulHigh(x2, c2))<<(FRAC_SIZE-FRAC_BITS);
     *y2 = (_MulHigh(x2, c1) - _MulHigh(x1, c2))<<(FRAC_SIZE-FRAC_BITS);
 }
+#else
+static INLINE real_t MUL_F(real_t A, real_t B)
+{
+    _asm {
+        mov eax,A
+        imul B
+        shrd eax,edx,FRAC_BITS
+    }
+}
+
+/* Complex multiplication */
+static INLINE void ComplexMult(real_t *y1, real_t *y2,
+    real_t x1, real_t x2, real_t c1, real_t c2)
+{
+    *y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
+    *y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
+}
+#endif
 
 #elif defined(__GNUC__) && defined (__arm__)
 
@@ -124,6 +178,21 @@
     return arm_mul(A, B, COEF_BITS);
 }
 
+static INLINE real_t MUL_Q2(real_t A, real_t B)
+{
+    return arm_mul(A, B, Q2_BITS);
+}
+
+static INLINE real_t MUL_SHIFT6(real_t A, real_t B)
+{
+    return arm_mul(A, B, 6);
+}
+
+static INLINE real_t MUL_SHIFT23(real_t A, real_t B)
+{
+    return arm_mul(A, B, 23);
+}
+
 static INLINE real_t _MulHigh(real_t x, real_t y)
 {
     uint32_t __lo;
@@ -164,17 +233,19 @@
   /* multiply with coef shift */
   #define MUL_C(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (COEF_BITS-1))) >> COEF_BITS)
   /* multiply with fractional shift */
-#ifndef _WIN32_WCE
-  #define _MulHigh(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_SIZE-1))) >> FRAC_SIZE)
-  #define MUL_F(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_BITS-1))) >> FRAC_BITS)
-#else
+#if defined(_WIN32_WCE) && defined(_ARM_)
   /* eVC for PocketPC has an intrinsic function that returns only the high 32 bits of a 32x32 bit multiply */
-  #include <cmnintrin.h>
   static INLINE real_t MUL_F(real_t A, real_t B)
   {
       return _MulHigh(A,B) << (32-FRAC_BITS);
   }
+#else
+  #define _MulHigh(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_SIZE-1))) >> FRAC_SIZE)
+  #define MUL_F(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_BITS-1))) >> FRAC_BITS)
 #endif
+  #define MUL_Q2(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (Q2_BITS-1))) >> Q2_BITS)
+  #define MUL_SHIFT6(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (6-1))) >> 6)
+  #define MUL_SHIFT23(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (23-1))) >> 23)
 
 /* Complex multiplication */
 static INLINE void ComplexMult(real_t *y1, real_t *y2,
--- a/Plugins/Input/aac/libfaad2/hcr.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/hcr.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2002 A. Kurpiers
+** Copyright (C) 2004 G.C. Pascutto, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: hcr.c,v 1.11 2003/11/12 20:47:57 menno Exp $
+** $Id: hcr.c,v 1.18 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -31,296 +31,337 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "syntax.h"
 #include "specrec.h"
-#include "bits.h"
-#include "pulse.h"
-#include "analysis.h"
-#include "bits.h"
 #include "huffman.h"
 
-/* Implements the HCR11 tool as described in ISO/IEC 14496-3/Amd.1, 8.5.3.3 */
+/* ISO/IEC 14496-3/Amd.1 
+ * 8.5.3.3: Huffman Codeword Reordering for AAC spectral data (HCR) 
+ *
+ * HCR devides the spectral data in known fixed size segments, and 
+ * sorts it by the importance of the data. The importance is firstly 
+ * the (lower) position in the spectrum, and secondly the largest 
+ * value in the used codebook. 
+ * The most important data is written at the start of each segment
+ * (at known positions), the remaining data is interleaved inbetween, 
+ * with the writing direction alternating.
+ * Data length is not increased.
+*/
 
 #ifdef ERROR_RESILIENCE
 
-/* rewind len (max. 32) bits so that the MSB becomes LSB */
+/* 8.5.3.3.1 Pre-sorting */
+
+#define NUM_CB      6
+#define NUM_CB_ER   22
+#define MAX_CB      32
+#define VCB11_FIRST 16
+#define VCB11_LAST  31
 
-static uint32_t rewind_word( uint32_t W, uint8_t len)
-{
-    uint8_t i;
-    uint32_t tmp_W=0;
+static const uint8_t PreSortCB_STD[NUM_CB] = 
+    { 11, 9, 7, 5, 3, 1};
+
+static const uint8_t PreSortCB_ER[NUM_CB_ER] = 
+    { 11, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 9, 7, 5, 3, 1};
+
+/* 8.5.3.3.2 Derivation of segment width */
+
+static const uint8_t maxCwLen[MAX_CB] = {0, 11, 9, 20, 16, 13, 11, 14, 12, 17, 14, 49,
+    0, 0, 0, 0, 14, 17, 21, 21, 25, 25, 29, 29, 29, 29, 33, 33, 33, 37, 37, 41};
+
+#define segmentWidth(cb)    min(maxCwLen[cb], ics->length_of_longest_codeword)
 
-    for ( i=0; i<len; i++ )
-    {
-        tmp_W<<=1;
-        if (W & (1<<i)) tmp_W |= 1;
-    }
-    return tmp_W;
+/* bit-twiddling helpers */
+static const uint8_t  S[] = {1, 2, 4, 8, 16};    
+static const uint32_t B[] = {0x55555555, 0x33333333, 0x0F0F0F0F, 0x00FF00FF, 0x0000FFFF};
+
+typedef struct
+{
+    uint8_t     cb;
+    uint8_t     decoded;
+    uint16_t	sp_offset;
+    bits_t      bits;
+} codeword_t;
+
+/* rewind and reverse */
+/* 32 bit version */
+static uint32_t rewrev_word(uint32_t v, const uint8_t len)
+{  
+    /* 32 bit reverse */
+    v = ((v >> S[0]) & B[0]) | ((v << S[0]) & ~B[0]); 
+    v = ((v >> S[1]) & B[1]) | ((v << S[1]) & ~B[1]); 
+    v = ((v >> S[2]) & B[2]) | ((v << S[2]) & ~B[2]); 
+    v = ((v >> S[3]) & B[3]) | ((v << S[3]) & ~B[3]);
+    v = ((v >> S[4]) & B[4]) | ((v << S[4]) & ~B[4]);
+
+    /* shift off low bits */
+    v >>= (32 - len);
+
+    return v;
 }
 
-static void rewind_lword( uint32_t *highW, uint32_t *lowW, uint8_t len)
-{
-    uint32_t tmp_lW=0;
-
-    if (len > 32)
+/* 64 bit version */
+static void rewrev_lword(uint32_t *hi, uint32_t *lo, const uint8_t len)
+{   
+    if (len <= 32) {
+        *hi = 0;
+        *lo = rewrev_word(*lo, len);
+    } else
     {
-        tmp_lW = rewind_word( (*highW << (64-len)) | (*lowW >> (len-32)), 32);
-        *highW = rewind_word( *lowW << (64-len) , 32);
-        *lowW = tmp_lW;
-    } else {
-        *highW = 0;
-        *lowW = rewind_word( *lowW, len);
-    }
-}    
+        uint32_t t = *hi, v = *lo;
 
-/* Takes a codeword as stored in r, rewinds the remaining bits and stores it back */
-static void rewind_bits(bits_t * r)
-{
-    uint32_t hw, lw;
-
-    if (r->len == 0) return;
+        /* double 32 bit reverse */
+        v = ((v >> S[0]) & B[0]) | ((v << S[0]) & ~B[0]); 
+        t = ((t >> S[0]) & B[0]) | ((t << S[0]) & ~B[0]); 
+        v = ((v >> S[1]) & B[1]) | ((v << S[1]) & ~B[1]); 
+        t = ((t >> S[1]) & B[1]) | ((t << S[1]) & ~B[1]); 
+        v = ((v >> S[2]) & B[2]) | ((v << S[2]) & ~B[2]); 
+        t = ((t >> S[2]) & B[2]) | ((t << S[2]) & ~B[2]); 
+        v = ((v >> S[3]) & B[3]) | ((v << S[3]) & ~B[3]);
+        t = ((t >> S[3]) & B[3]) | ((t << S[3]) & ~B[3]);
+        v = ((v >> S[4]) & B[4]) | ((v << S[4]) & ~B[4]);                
+        t = ((t >> S[4]) & B[4]) | ((t << S[4]) & ~B[4]);
 
-    if (r->len >32)
-    {
-        lw = r->bufa;
-        hw = r->bufb & (0xFFFFFFFF >> (64 - r->len));
-        rewind_lword( &hw, &lw, r->len );
-        r->bufa = lw;
-        r->bufb = hw;
-
-    } else {
-        lw = showbits_hcr(r, r->len );
-        r->bufa = rewind_word( lw, r->len);
-        r->bufb = 0;
+        /* last 32<>32 bit swap is implicit below */
+        
+        /* shift off low bits (this is really only one 64 bit shift) */
+        *lo = (t >> (64 - len)) | (v << (len - 32));
+        *hi = v >> (64 - len);          
     }
 }
 
-/* takes codewords from a and b, concatenate them and store them in b */
-static void concat_bits( bits_t * a, bits_t * b)
+
+/* bits_t version */
+static void rewrev_bits(bits_t *bits)
 {
-    uint32_t	hwa, lwa, hwb, lwb;
+    if (bits->len == 0) return;
+    rewrev_lword(&bits->bufb, &bits->bufa,  bits->len);
+}
+
+
+/* merge bits of a to b */
+static void concat_bits(bits_t *b, bits_t *a)
+{
+    uint32_t bl, bh, al, ah;
 
     if (a->len == 0) return;
 
-    if (a->len >32)
+    al = a->bufa;
+    ah = a->bufb;
+    
+    if (b->len > 32)
     {
-        lwa = a->bufa;
-        hwa = a->bufb & (0xFFFFFFFF >> (64 - a->len));
+        /* maskoff superfluous high b bits */
+        bl = b->bufa;
+        bh = b->bufb & ((1 << (b->len-32)) - 1);
+        /* left shift a b->len bits */
+        ah = al << (b->len - 32);
+        al = 0;
     } else {
-        lwa = showbits_hcr(a, a->len );
-        hwa = 0;
-    }
-    if (b->len >=32) {
-        lwb = b->bufa;
-        hwb = (b->bufb & (0xFFFFFFFF >> (64 - b->len)) ) | ( lwa << (b->len - 32));
-    } else {
-        lwb = showbits_hcr(b, b->len ) | (lwa << (b->len));
-        hwb = (lwa >> (32 - b->len)) | (hwa << (b->len));
+        bl = b->bufa & ((1 << (b->len)) - 1);
+        bh = 0;   
+        ah = (ah << (b->len)) | (al >> (32 - b->len));
+        al = al << b->len;
     }
 
-    b->bufa = lwb;
-    b->bufb = hwb;
+    /* merge */
+    b->bufa = bl | al;
+    b->bufb = bh | ah;
+
     b->len += a->len;
 }
+     
+uint8_t is_good_cb(uint8_t this_CB, uint8_t this_sec_CB)
+{
+    /* only want spectral data CB's */
+    if ((this_sec_CB > ZERO_HCB && this_sec_CB <= ESC_HCB) || (this_sec_CB >= VCB11_FIRST && this_sec_CB <= VCB11_LAST))
+    {
+        if (this_CB < ESC_HCB)
+        {
+            /* normal codebook pairs */
+            return ((this_sec_CB == this_CB) || (this_sec_CB == this_CB + 1));
+        } else
+        {
+            /* escape codebook */
+            return (this_sec_CB == this_CB);
+        }
+    }
+    return 0;
+}
+                    
+void read_segment(bits_t *segment, uint8_t segwidth, bitfile *ld)
+{
+    segment->len = segwidth;
+
+     if (segwidth > 32)
+     {
+        segment->bufb = faad_getbits(ld, segwidth - 32);        
+        segment->bufa = faad_getbits(ld, 32);        
+
+    } else {
+        segment->bufa = faad_getbits(ld, segwidth);
+        segment->bufb = 0;        
+    }    
+}
 
-/* 8.5.3.3.1 */
-
-static const uint8_t PresortedCodebook_VCB11[] = { 11, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 9, 7, 5, 3, 1};
-static const uint8_t PresortedCodebook[] = { 11, 9, 7, 5, 3, 1};
-
-static const uint8_t maxCwLen[32] = {0, 11, 9, 20, 16, 13, 11, 14, 12, 17, 14, 49,
-    0, 0, 0, 0, 14, 17, 21, 21, 25, 25, 29, 29, 29, 29, 33, 33, 33, 37, 37, 41};
-
-typedef struct
+void fill_in_codeword(codeword_t *codeword, uint16_t index, uint16_t sp, uint8_t cb)
 {
-    bits_t		bits;
-    uint8_t		decoded;
-    uint16_t	sp_offset;
-    uint8_t		cb;
-} codeword_state;
+    codeword[index].sp_offset = sp;
+    codeword[index].cb = cb;
+    codeword[index].decoded = 0;
+    codeword[index].bits.len = 0;
+}
 
+uint8_t reordered_spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, 
+                                bitfile *ld, int16_t *spectral_data)
+{   
+    uint16_t PCWs_done;
+    uint16_t numberOfSegments, numberOfSets, numberOfCodewords;  
 
-#define segmentWidth( codebook )	min( maxCwLen[codebook], ics->length_of_longest_codeword )
-     
-uint8_t reordered_spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld,
-                                int16_t *spectral_data)
-{
+    codeword_t codeword[512];
+    bits_t segment[512];
+
     uint16_t sp_offset[8];
-    uint16_t g,i, presort;
-    uint16_t NrCodeWords=0, numberOfSegments=0, BitsRead=0;
-    uint8_t numberOfSets, set;
-    codeword_state Codewords[ 1024 ];	// FIXME max length? PCWs are not stored, so index is Codewordnr - numberOfSegments!, maybe malloc()?
-    bits_t	Segment[ 512 ];
-
-    uint8_t PCW_decoded=0;
-    uint16_t segment_index=0, codeword_index=0;
-    uint16_t nshort = hDecoder->frameLength/8;
-
-
-    /*memset (spectral_data, 0, hDecoder->frameLength*sizeof(uint16_t));*/
+    uint16_t g, i, sortloop, set, bitsread;
+    uint8_t w_idx, sfb, this_CB, last_CB, this_sec_CB; 
+    
+    const uint16_t nshort = hDecoder->frameLength/8;
+    const uint16_t sp_data_len = ics->length_of_reordered_spectral_data;
+    
+    const uint8_t *PreSortCb;
 
-    if (ics->length_of_reordered_spectral_data == 0)
-        return 0; /* nothing to do */
+    /* no data (e.g. silence) */
+    if (sp_data_len == 0)
+        return 0;
 
-    /* if we have a corrupted bitstream this can happen... */
-    if ((ics->length_of_longest_codeword == 0) ||
-        (ics->length_of_reordered_spectral_data <
-        ics->length_of_longest_codeword) ||
-        (ics->max_sfb == 0))
-    {
-        return 10; /* this is not good... */
-    }
-
-    /* store the offset into the spectral data for all the window groups because we can't do it later */
+    /* since there is spectral data, at least one codeword has nonzero length */
+    if (ics->length_of_longest_codeword == 0)
+        return 10;
+    
+    if (sp_data_len < ics->length_of_longest_codeword)
+        return 10; 
 
     sp_offset[0] = 0;
-    for (g=1; g < ics->num_window_groups; g++)
+    for (g = 1; g < ics->num_window_groups; g++)
     {
         sp_offset[g] = sp_offset[g-1] + nshort*ics->window_group_length[g-1];
     }
 
-    /* All data is sorted according to the codebook used */        
-    for (presort = 0; presort < (hDecoder->aacSectionDataResilienceFlag ? 22 : 6); presort++)
-    {
-        uint8_t sfb;
-
-        /* next codebook that has to be processed according to presorting */
-        uint8_t nextCB = hDecoder->aacSectionDataResilienceFlag ? PresortedCodebook_VCB11[ presort ] : PresortedCodebook[ presort ];
+    PCWs_done = 0;
+    numberOfSegments = 0;
+    numberOfCodewords = 0;
+    bitsread = 0;
 
-        /* Data belonging to the same spectral unit and having the same codebook comes in consecutive codewords.
-           This is done by scanning all sfbs for possible codewords. For sfbs with more than 4 elements this has to be
-           repeated */
-
-        for (sfb=0; sfb<ics->max_sfb; sfb ++)
+    /* VCB11 code books in use */
+    if (hDecoder->aacSectionDataResilienceFlag)
+    {
+        PreSortCb = PreSortCB_ER;
+        last_CB = NUM_CB_ER;
+    } else
+    {
+        PreSortCb = PreSortCB_STD;
+        last_CB = NUM_CB;
+    }
+ 
+    /* step 1: decode PCW's (set 0), and stuff data in easier-to-use format */
+    for (sortloop = 0; sortloop < last_CB; sortloop++)
+    {
+        /* select codebook to process this pass */
+        this_CB = PreSortCb[sortloop];
+        
+        /* loop over sfbs */
+        for (sfb = 0; sfb < ics->max_sfb; sfb++)
         {
-            uint8_t sect_cb, w;
-
-            for (w=0; w< (ics->swb_offset[sfb+1] - ics->swb_offset[sfb]); w+=4)
+            /* loop over all in this sfb, 4 lines per loop */
+            for (w_idx = 0; 4*w_idx < (ics->swb_offset[sfb+1] - ics->swb_offset[sfb]); w_idx++)
             {
                 for(g = 0; g < ics->num_window_groups; g++)
                 {
                     for (i = 0; i < ics->num_sec[g]; i++)
                     {
-                        sect_cb = ics->sect_cb[g][i];
-
-                        if (
-                            /* process only sections that are due now */
-                            (( sect_cb == nextCB ) || (( nextCB < ESC_HCB ) && ( sect_cb == nextCB+1)) ) &&
-
-                            /* process only sfb's that are due now */
-                            ((ics->sect_start[g][i] <= sfb) && (ics->sect_end[g][i] > sfb))
-                            )
-                        {
-                            if ((sect_cb != ZERO_HCB) &&
-                                (sect_cb != NOISE_HCB) &&
-                                (sect_cb != INTENSITY_HCB) &&
-                                (sect_cb != INTENSITY_HCB2))
+                        /* check whether sfb used here is the one we want to process */
+                        if ((ics->sect_start[g][i] <= sfb) && (ics->sect_end[g][i] > sfb))
+                        {                            
+                            /* check whether codebook used here is the one we want to process */
+                            this_sec_CB = ics->sect_cb[g][i];
+                 
+                            if (is_good_cb(this_CB, this_sec_CB))                              
                             {
-                                uint8_t inc = (sect_cb < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN;
-                                uint16_t k;
-
-                                uint32_t	hw, lw;
-
-                                for  (k=0; (k < (4/inc)*ics->window_group_length[g]) &&
-                                    ( (k+w*ics->window_group_length[g]/inc) < (ics->sect_sfb_offset[g][sfb+1] - ics->sect_sfb_offset[g][sfb])); k++)
-                                {
-                                    uint16_t sp = sp_offset[g] + ics->sect_sfb_offset[g][sfb] + inc*(k+w*ics->window_group_length[g]/inc);
+                                /* precalculate some stuff */
+                                uint16_t sect_sfb_size = ics->sect_sfb_offset[g][sfb+1] - ics->sect_sfb_offset[g][sfb];
+                                uint8_t inc = (this_sec_CB < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN;
+                                uint16_t group_cws_count = (4*ics->window_group_length[g])/inc;
+                                uint8_t segwidth = segmentWidth(this_sec_CB);
+                                uint16_t cws;                                
 
-                                    if (!PCW_decoded)
-                                    {
-                                        /* if we haven't yet read until the end of the buffer, we can directly decode the so-called PCWs */
-                                        if ((BitsRead + segmentWidth( sect_cb ))<= ics->length_of_reordered_spectral_data)
-                                        {
-                                            Segment[ numberOfSegments ].len = segmentWidth( sect_cb );
+                                /* read codewords until end of sfb or end of window group (shouldn't only 1 trigger?) */                                 
+                                for (cws = 0; (cws < group_cws_count) && ((cws + w_idx*group_cws_count) < sect_sfb_size); cws++)
+                                {
+                                    uint16_t sp = sp_offset[g] + ics->sect_sfb_offset[g][sfb] + inc * (cws + w_idx*group_cws_count);                                   
 
-                                            if (segmentWidth( sect_cb ) > 32)
-                                            {
-                                                Segment[ numberOfSegments ].bufb = faad_showbits(ld, segmentWidth( sect_cb ) - 32);
-                                                faad_flushbits(ld, segmentWidth( sect_cb) - 32);
-                                                Segment[ numberOfSegments ].bufa = faad_showbits(ld, 32),
-                                                    faad_flushbits(ld, 32 );
+                                    /* read and decode PCW */
+                                    if (!PCWs_done)
+                                    {         
+                                        /* read in normal segments */
+                                        if (bitsread + segwidth <= sp_data_len)
+                                        {                                            
+                                            read_segment(&segment[numberOfSegments], segwidth, ld);                          
+                                            bitsread += segwidth;
+                                            
+                                            huffman_spectral_data_2(this_sec_CB, &segment[numberOfSegments], &spectral_data[sp]);                                            
 
-                                            } else {
-                                                Segment[ numberOfSegments ].bufa = faad_showbits(ld,  segmentWidth( sect_cb ));
-                                                Segment[ numberOfSegments ].bufb = 0;
-                                                faad_flushbits(ld, segmentWidth( sect_cb) );
-                                            }
-
-                                            huffman_spectral_data_2(sect_cb, &Segment[ numberOfSegments ], &spectral_data[sp]);
-
-                                            BitsRead += segmentWidth( sect_cb );
-
-                                            /* skip to next segment, but store left bits in new buffer */
-                                            rewind_bits( &Segment[ numberOfSegments ]);
+                                            /* keep leftover bits */
+                                            rewrev_bits(&segment[numberOfSegments]);
 
                                             numberOfSegments++;
                                         } else {
-
-                                            /* the last segment is extended until length_of_reordered_spectral_data */
-
-                                            if (BitsRead < ics->length_of_reordered_spectral_data)
-                                            {
-
-                                                uint8_t additional_bits = (ics->length_of_reordered_spectral_data - BitsRead);
+                                            /* remaining stuff after last segment, we unfortunately couldn't read
+                                               this in earlier because it might not fit in 64 bits. since we already
+                                               decoded (and removed) the PCW it is now guaranteed to fit */
+                                            if (bitsread < sp_data_len)
+                                            {                                                
+                                                const uint8_t additional_bits = sp_data_len - bitsread;                                               
 
-                                                if ( additional_bits > 32)
-                                                {
-                                                    hw = faad_showbits(ld, additional_bits - 32);
-                                                    faad_flushbits(ld, additional_bits - 32);
-                                                    lw = faad_showbits(ld, 32);
-                                                    faad_flushbits(ld, 32 );
-                                                } else {
-                                                    lw = faad_showbits(ld, additional_bits);
-                                                    hw = 0;
-                                                    faad_flushbits(ld, additional_bits );
-                                                }
-                                                rewind_lword( &hw, &lw, additional_bits + Segment[ numberOfSegments-1 ].len );
-                                                if (Segment[ numberOfSegments-1 ].len > 32)
+                                                read_segment(&segment[numberOfSegments], additional_bits, ld);                                                
+                                                segment[numberOfSegments].len += segment[numberOfSegments-1].len;
+                                                rewrev_bits(&segment[numberOfSegments]);                                               
+
+                                                if (segment[numberOfSegments-1].len > 32)
                                                 {
-                                                    Segment[ numberOfSegments-1 ].bufb = hw + 
-                                                        showbits_hcr(&Segment[ numberOfSegments-1 ], Segment[ numberOfSegments-1 ].len - 32);
-                                                    Segment[ numberOfSegments-1 ].bufa = lw + 
-                                                        showbits_hcr(&Segment[ numberOfSegments-1 ], 32);
+                                                    segment[numberOfSegments-1].bufb = segment[numberOfSegments].bufb + 
+                                                        showbits_hcr(&segment[numberOfSegments-1], segment[numberOfSegments-1].len - 32);
+                                                    segment[numberOfSegments-1].bufa = segment[numberOfSegments].bufa + 
+                                                        showbits_hcr(&segment[numberOfSegments-1], 32);
                                                 } else {
-                                                    Segment[ numberOfSegments-1 ].bufa = lw + 
-                                                        showbits_hcr(&Segment[ numberOfSegments-1 ], Segment[ numberOfSegments-1 ].len);
-                                                    Segment[ numberOfSegments-1 ].bufb = hw;
-                                                }
-                                                Segment[ numberOfSegments-1 ].len += additional_bits;
+                                                    segment[numberOfSegments-1].bufa = segment[numberOfSegments].bufa + 
+                                                        showbits_hcr(&segment[numberOfSegments-1], segment[numberOfSegments-1].len);
+                                                    segment[numberOfSegments-1].bufb = segment[numberOfSegments].bufb;
+                                                }                                                
+                                                segment[numberOfSegments-1].len += additional_bits;
                                             }
-                                            BitsRead = ics->length_of_reordered_spectral_data;
-                                            PCW_decoded = 1;
+                                            bitsread = sp_data_len;
+                                            PCWs_done = 1;
 
-                                            Codewords[ 0 ].sp_offset = sp;
-                                            Codewords[ 0 ].cb = sect_cb;
-                                            Codewords[ 0 ].decoded = 0;
-                                            Codewords[ 0 ].bits.len = 0;
+                                            fill_in_codeword(codeword, 0, sp, this_sec_CB);                                            
                                         }
-                                    } else {
-                                        Codewords[ NrCodeWords - numberOfSegments ].sp_offset = sp;
-                                        Codewords[ NrCodeWords - numberOfSegments ].cb = sect_cb;
-                                        Codewords[ NrCodeWords - numberOfSegments ].decoded = 0;
-                                        Codewords[ NrCodeWords - numberOfSegments ].bits.len = 0;
-
-                                    } /* PCW decoded */
-                                    NrCodeWords++;
-                                } /* of k */
+                                    } else {    
+                                        fill_in_codeword(codeword, numberOfCodewords - numberOfSegments, sp, this_sec_CB);                                         
+                                    }
+                                    numberOfCodewords++;
+                                }                             
                             }
                         }
-                    } /* of i */
-                 } /* of g */
-             } /* of w */
-         } /* of sfb */
-    } /* of presort */
+                    } 
+                 } 
+             }
+         }
+    }
 
-    /* Avoid divide by zero */
     if (numberOfSegments == 0)
-        return 10; /* this is not good... */
+        return 10; 
 
-    numberOfSets = NrCodeWords / numberOfSegments;     
+    numberOfSets = numberOfCodewords / numberOfSegments;     
 
-    /* second step: decode nonPCWs */
-
+    /* step 2: decode nonPCWs */
     for (set = 1; set <= numberOfSets; set++)
     {
         uint16_t trial;
@@ -328,85 +369,40 @@
         for (trial = 0; trial < numberOfSegments; trial++)
         {
             uint16_t codewordBase;
-            uint16_t set_decoded=numberOfSegments;
-
-            if (set == numberOfSets)
-                set_decoded = NrCodeWords - set*numberOfSegments;	/* last set is shorter than the rest */
 
             for (codewordBase = 0; codewordBase < numberOfSegments; codewordBase++)
             {
-                uint16_t segment_index = (trial + codewordBase) % numberOfSegments;
-                uint16_t codeword_index = codewordBase + set*numberOfSegments - numberOfSegments;
-
-                if ((codeword_index + numberOfSegments) >= NrCodeWords)
-                    break;
-                if (!Codewords[ codeword_index ].decoded)
-                {
-                    if ( Segment[ segment_index ].len > 0)
-                    {
-                        uint8_t tmplen;
+                const uint16_t segment_idx = (trial + codewordBase) % numberOfSegments;
+                const uint16_t codeword_idx = codewordBase + set*numberOfSegments - numberOfSegments;
 
-                        if (Codewords[ codeword_index ].bits.len != 0)
-                        {
-                            /* on the first trial the data is only stored in Segment[], not in Codewords[]. 
-                               On next trials first collect the data stored for this codeword and
-                               concatenate the new data from Segment[] */
+                /* data up */
+                if (codeword_idx >= numberOfCodewords - numberOfSegments) break;
 
-                            concat_bits( &Codewords[ codeword_index ].bits, &Segment[ segment_index ]);                            
-                            /* Now everthing is stored in Segment[] */
-                        }
-                        tmplen = Segment[ segment_index ].len;
-                        if ( huffman_spectral_data_2(Codewords[ codeword_index ].cb, &Segment[ segment_index ],
-                            &spectral_data[ Codewords[ codeword_index ].sp_offset ]) >=0)
-                        {
-                            /* CW did fit into segment */
-
-                            Codewords[ codeword_index ].decoded = 1;
-                            set_decoded--;
-                        } else {
-
-                            /* CW did not fit, so store for later use */
+                if (!codeword[codeword_idx].decoded && segment[segment_idx].len > 0)
+                {
+                    uint8_t tmplen;
 
-                            Codewords[ codeword_index ].bits.len = tmplen;
-                            Codewords[ codeword_index ].bits.bufa = Segment[ segment_index ].bufa;
-                            Codewords[ codeword_index ].bits.bufb = Segment[ segment_index ].bufb;
-                        }
-                    }                        
-                }
-            } /* of codewordBase */
-
-            if (set_decoded == 0) break;	/* no undecoded codewords left in this set */
-
-        } /* of trial */
+                    if (codeword[codeword_idx].bits.len != 0)                   
+                        concat_bits(&segment[segment_idx], &codeword[codeword_idx].bits);                            
+                    
+                    tmplen = segment[segment_idx].len;
 
-        /* rewind all bits in remaining segments with len>0 */
-        for (i=0; i < numberOfSegments; i++)
-            rewind_bits( &Segment[ i ] );
-    }
-
-#if 0
-    {
-        int i, r=0, c=0;
-        for (i=0; i< numberOfSegments; i++)
-            r += Segment[ i ].len;
-        if (r != 0)
-        {
-            printf("reordered_spectral_data: %d bits remaining!\n", r);
-        }
-        for (i=0; i< NrCodeWords - numberOfSegments; i++)
-        {
-            if (Codewords[ i ].decoded == 0)
-            {
-                c++;
+                    if (huffman_spectral_data_2(codeword[codeword_idx].cb, &segment[segment_idx],
+                                               &spectral_data[codeword[codeword_idx].sp_offset]) >= 0)
+                    {
+                        codeword[codeword_idx].decoded = 1;
+                    } else 
+                    {   
+                        codeword[codeword_idx].bits = segment[segment_idx];
+                        codeword[codeword_idx].bits.len = tmplen;                        
+                    }
+                                            
+                }
             }
         }
-        if (c != 0)
-        {
-            printf("reordered_spectral_data: %d Undecoded Codewords remaining!\n",c );
-        }
-        if ((r !=0) || (c!=0))	return 10;
+        for (i = 0; i < numberOfSegments; i++)
+            rewrev_bits(&segment[i]);
     }
-#endif
 
     return 0;
 }
--- a/Plugins/Input/aac/libfaad2/huffman.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/huffman.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: huffman.c,v 1.9 2003/11/12 20:47:57 menno Exp $
+** $Id: huffman.c,v 1.22 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -38,6 +38,20 @@
 #include "codebook/hcb.h"
 
 
+/* static function declarations */
+static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len);
+static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp);
+static uint8_t huffman_2step_quad(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp);
+static int16_t huffman_codebook(uint8_t i);
+static void vcb11_check_LAV(uint8_t cb, int16_t *sp);
+
 int8_t huffman_scale_factor(bitfile *ld)
 {
     uint16_t offset = 0;
@@ -108,7 +122,7 @@
 {
     uint8_t neg, i;
     int16_t j;
-	int32_t off;
+	int16_t off;
 
     if (sp < 0)
     {
@@ -116,7 +130,7 @@
             return sp;
         neg = 1;
     } else {
-        if(sp != 16)
+        if (sp != 16)
             return sp;
         neg = 0;
     }
@@ -130,10 +144,10 @@
         }
     }
 
-    off = faad_getbits(ld, i
+    off = (int16_t)faad_getbits(ld, i
         DEBUGVAR(1,9,"huffman_getescape(): escape"));
 
-    j = off + (1<<i);
+    j = off | (1<<i);
     if (neg)
         j = -j;
 
@@ -216,7 +230,7 @@
     return 0;
 }
 
-static huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp)
+static uint8_t huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp)
 {
     uint8_t err = huffman_2step_pair(cb, ld, sp);
     huffman_sign_bits(ld, sp, PAIR_LEN);
@@ -297,6 +311,26 @@
     else        return (int16_t)data & 0xFFFF;
 }
 
+static void vcb11_check_LAV(uint8_t cb, int16_t *sp)
+{
+    static const uint16_t vcb11_LAV_tab[] = {
+        16, 31, 47, 63, 95, 127, 159, 191, 223,
+        255, 319, 383, 511, 767, 1023, 2047
+    };
+    uint16_t max = 0;
+
+    if (cb < 16 || cb > 31)
+        return;
+
+    max = vcb11_LAV_tab[cb - 16];
+
+    if ((abs(sp[0]) > max) || (abs(sp[1]) > max))
+    {
+        sp[0] = 0;
+        sp[1] = 0;
+    }
+}
+
 uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp)
 {
     switch (cb)
@@ -319,22 +353,32 @@
     case 10:
         return huffman_2step_pair_sign(cb, ld, sp);
     case 12: {
-        uint8_t err = huffman_2step_quad(1, ld, sp);
+        uint8_t err = huffman_2step_pair(11, 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;
     }
+#ifdef ERROR_RESILIENCE
+    /* VCB11 uses codebook 11 */
+    case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23:
+    case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31:
+    {
+        uint8_t err = huffman_2step_pair_sign(11, ld, sp);
+        sp[0] = huffman_getescape(ld, sp[0]);
+        sp[1] = huffman_getescape(ld, sp[1]);
+
+        /* check LAV (Largest Absolute Value) */
+        /* this finds errors in the ESCAPE signal */
+        vcb11_check_LAV(cb, sp);
+
+        return err;
+    }
+#endif
     default:
         /* Non existent codebook number, something went wrong */
         return 11;
@@ -356,8 +400,7 @@
     uint32_t cw;
     uint16_t offset = 0;
     uint8_t extra_bits;
-    uint8_t i;
-    uint8_t save_cb = cb;
+    uint8_t i, vcb11 = 0;
 
 
     switch (cb)
@@ -394,9 +437,12 @@
     case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23:
     case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31:
 
-        /* TODO: If ER is used, some extra error checking should be done */
         if (cb >= 16)
+        {
+            /* store the virtual codebook */
+            vcb11 = cb;
             cb = 11;
+        }
             
         cw = showbits_hcr(ld, hcbN[cb]);
         offset = hcb_table[cb][cw].offset;
@@ -451,8 +497,8 @@
     }
 
 	/* decode sign bits */
-    if (unsigned_cb[cb]) {
-
+    if (unsigned_cb[cb])
+    {
         for(i = 0; i < ((cb < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN); i++)
         {
             if(sp[i])
@@ -488,13 +534,20 @@
                     if (b == 0)
                         break;
                 }
-// TODO: here we would need to test "off" if VCB11 is used!
+
                 if (getbits_hcr(ld, i, &off))
                     return -1;
                 j = off + (1<<i);
                 sp[k] = (int16_t)((neg) ? -j : j);
             }
         }
+
+        if (vcb11 != 0)
+        {
+            /* check LAV (Largest Absolute Value) */
+            /* this finds errors in the ESCAPE signal */
+            vcb11_check_LAV(vcb11, sp);
+        }
     }    
     return ld->len;
 }
--- a/Plugins/Input/aac/libfaad2/huffman.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/huffman.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: huffman.h,v 1.19 2003/11/12 20:47:57 menno Exp $
+** $Id: huffman.h,v 1.24 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __HUFFMAN_H__
@@ -32,19 +32,6 @@
 extern "C" {
 #endif
 
-
-static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len);
-static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp);
-static uint8_t huffman_2step_quad(uint8_t cb, bitfile *ld, int16_t *sp);
-static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp);
-static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp);
-static huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp);
-static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp);
-static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp);
-static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp);
-static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp);
-static int16_t huffman_codebook(uint8_t i);
-
 int8_t huffman_scale_factor(bitfile *ld);
 uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp);
 #ifdef ERROR_RESILIENCE
--- a/Plugins/Input/aac/libfaad2/ic_predict.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/ic_predict.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: ic_predict.c,v 1.18 2003/11/12 20:47:57 menno Exp $
+** $Id: ic_predict.c,v 1.23 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -79,7 +79,7 @@
 
 static void ic_predict(pred_state *state, real_t input, real_t *output, uint8_t pred)
 {
-    uint32_t tmp;
+    uint16_t tmp;
     int16_t i, j;
     real_t dr1, predictedvalue;
     real_t e0, e1;
--- a/Plugins/Input/aac/libfaad2/ic_predict.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/ic_predict.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: ic_predict.h,v 1.14 2003/11/12 20:47:57 menno Exp $
+** $Id: ic_predict.h,v 1.19 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifdef MAIN_DEC
@@ -43,7 +43,7 @@
 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] = {
+ALIGN 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),
@@ -110,7 +110,7 @@
     COEF_CONST(0.4804687500), COEF_CONST(0.4785156250)
 };
 
-static const real_t exp_table[128] = {
+ALIGN static const real_t exp_table[128] = {
     COEF_CONST(0.50000000000000000000000000000000000000000000000000),
     COEF_CONST(0.25000000000000000000000000000000000000000000000000),
     COEF_CONST(0.12500000000000000000000000000000000000000000000000),
@@ -237,7 +237,7 @@
     COEF_CONST(0.00000000000000000000000000000000000004701977403289),
     COEF_CONST(0.00000000000000000000000000000000000002350988701645),
     COEF_CONST(0.00000000000000000000000000000000000001175494350822),
-    COEF_CONST(0.00000000000000000000000000000000000000587747175411),
+    COEF_CONST(0.0 /* 0000000000000000000000000000000000000587747175411 "floating point underflow" */),
     COEF_CONST(0.0)
 };
 
--- a/Plugins/Input/aac/libfaad2/iq_table.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/iq_table.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: iq_table.h,v 1.10 2003/11/12 20:47:57 menno Exp $
+** $Id: iq_table.h,v 1.16 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef IQ_TABLE_H__
@@ -38,17 +38,17 @@
 
 #ifndef FIXED_POINT
 
-#define IQ_TABLE_SIZE 256
+#define IQ_TABLE_SIZE 8192
 
 #ifdef _MSC_VER
 #pragma warning(disable:4305)
 #pragma warning(disable:4244)
 #endif
 
-static real_t iq_table[IQ_TABLE_SIZE] =
+ALIGN static const real_t iq_table[IQ_TABLE_SIZE] =
 {
-    0.0,
-    1.0,
+    0,
+    1,
     2.5198420997897464,
     4.3267487109222245,
     6.3496042078727974,
@@ -302,14 +302,7954 @@
     1591.7226186094069,
     1600.1499964845941,
     1608.58848496618,
-    1617.0380548731737
+    1617.0380548731737,
+    1625.4986772154357,
+    1633.9703231916887,
+    1642.4529641875577,
+    1650.9465717736346,
+    1659.4511177035752,
+    1667.9665739122186,
+    1676.4929125137353,
+    1685.030105799801,
+    1693.5781262377957,
+    1702.136946469027,
+    1710.7065393069795,
+    1719.2868777355877,
+    1727.8779349075323,
+    1736.4796841425596,
+    1745.092098925825,
+    1753.7151529062583,
+    1762.3488198949503,
+    1770.9930738635628,
+    1779.6478889427597,
+    1788.3132394206564,
+    1796.9890997412947,
+    1805.6754445031333,
+    1814.3722484575621,
+    1823.0794865074322,
+    1831.7971337056094,
+    1840.5251652535437,
+    1849.2635564998579,
+    1858.0122829389563,
+    1866.7713202096493,
+    1875.5406440937966,
+    1884.3202305149687,
+    1893.110055537124,
+    1901.9100953633042,
+    1910.7203263343454,
+    1919.5407249276057,
+    1928.3712677557098,
+    1937.2119315653083,
+    1946.0626932358525,
+    1954.923529778386,
+    1963.79441833435,
+    1972.6753361744036,
+    1981.5662606972594,
+    1990.467169428533,
+    1999.3780400196069,
+    2008.2988502465078,
+    2017.2295780087982,
+    2026.1702013284819,
+    2035.1206983489212,
+    2044.0810473337688,
+    2053.0512266659125,
+    2062.0312148464309,
+    2071.0209904935646,
+    2080.0205323416958,
+    2089.0298192403443,
+    2098.0488301531714,
+    2107.0775441569995,
+    2116.115940440839,
+    2125.1639983049317,
+    2134.2216971597995,
+    2143.2890165253098,
+    2152.3659360297484,
+    2161.4524354089031,
+    2170.5484945051617,
+    2179.6540932666144,
+    2188.7692117461711,
+    2197.8938301006888,
+    2207.0279285901042,
+    2216.1714875765838,
+    2225.324487523676,
+    2234.4869089954782,
+    2243.6587326558101,
+    2252.8399392673982,
+    2262.0305096910702,
+    2271.2304248849537,
+    2280.4396659036897,
+    2289.6582138976523,
+    2298.8860501121762,
+    2308.1231558867926,
+    2317.3695126544767,
+    2326.6251019409005,
+    2335.8899053636933,
+    2345.1639046317132,
+    2354.4470815443233,
+    2363.7394179906792,
+    2373.0408959490205,
+    2382.3514974859731,
+    2391.6712047558558,
+    2400.9999999999991,
+    2410.3378655460651,
+    2419.6847838073813,
+    2429.0407372822747,
+    2438.4057085534191,
+    2447.7796802871858,
+    2457.1626352330004,
+    2466.5545562227112,
+    2475.9554261699564,
+    2485.3652280695474,
+    2494.7839449968492,
+    2504.2115601071737,
+    2513.6480566351788,
+    2523.0934178942675,
+    2532.5476272760025,
+    2542.0106682495189,
+    2551.482524360948,
+    2560.9631792328441,
+    2570.4526165636184,
+    2579.9508201269791,
+    2589.4577737713744,
+    2598.9734614194458,
+    2608.4978670674823,
+    2618.0309747848837,
+    2627.5727687136259,
+    2637.1232330677353,
+    2646.6823521327647,
+    2656.2501102652768,
+    2665.8264918923328,
+    2675.4114815109842,
+    2685.0050636877722,
+    2694.6072230582295,
+    2704.2179443263894,
+    2713.8372122642972,
+    2723.4650117115279,
+    2733.1013275747096,
+    2742.7461448270483,
+    2752.3994485078601,
+    2762.0612237221085,
+    2771.7314556399419,
+    2781.4101294962406,
+    2791.0972305901655,
+    2800.7927442847094,
+    2810.4966560062589,
+    2820.2089512441521,
+    2829.9296155502466,
+    2839.6586345384894,
+    2849.3959938844923,
+    2859.1416793251065,
+    2868.8956766580086,
+    2878.6579717412847,
+    2888.4285504930212,
+    2898.2073988908974,
+    2907.9945029717837,
+    2917.789848831344,
+    2927.5934226236377,
+    2937.4052105607311,
+    2947.2251989123079,
+    2957.0533740052865,
+    2966.8897222234368,
+    2976.734230007005,
+    2986.5868838523397,
+    2996.4476703115197,
+    3006.3165759919889,
+    3016.1935875561908,
+    3026.0786917212095,
+    3035.9718752584108,
+    3045.8731249930906,
+    3055.7824278041207,
+    3065.6997706236039,
+    3075.625140436528,
+    3085.5585242804245,
+    3095.4999092450298,
+    3105.4492824719491,
+    3115.4066311543256,
+    3125.3719425365089,
+    3135.3452039137287,
+    3145.3264026317715,
+    3155.3155260866592,
+    3165.3125617243295,
+    3175.3174970403229,
+    3185.3303195794679,
+    3195.35101693557,
+    3205.3795767511078,
+    3215.4159867169251,
+    3225.460234571929,
+    3235.5123081027928,
+    3245.5721951436558,
+    3255.63988357583,
+    3265.7153613275095,
+    3275.7986163734795,
+    3285.8896367348289,
+    3295.9884104786665,
+    3306.0949257178395,
+    3316.2091706106517,
+    3326.331133360588,
+    3336.4608022160378,
+    3346.5981654700231,
+    3356.7432114599264,
+    3366.8959285672249,
+    3377.0563052172211,
+    3387.2243298787821,
+    3397.3999910640764,
+    3407.5832773283128,
+    3417.7741772694862,
+    3427.9726795281199,
+    3438.1787727870123,
+    3448.3924457709873,
+    3458.6136872466445,
+    3468.8424860221107,
+    3479.0788309467976,
+    3489.3227109111554,
+    3499.5741148464344,
+    3509.8330317244445,
+    3520.0994505573185,
+    3530.3733603972751,
+    3540.6547503363886,
+    3550.9436095063534,
+    3561.239927078258,
+    3571.5436922623535,
+    3581.8548943078308,
+    3592.1735225025936,
+    3602.4995661730372,
+    3612.8330146838275,
+    3623.1738574376814,
+    3633.5220838751502,
+    3643.8776834744031,
+    3654.2406457510142,
+    3664.6109602577494,
+    3674.9886165843564,
+    3685.3736043573545,
+    3695.7659132398294,
+    3706.1655329312248,
+    3716.5724531671399,
+    3726.9866637191262,
+    3737.4081543944876,
+    3747.8369150360782,
+    3758.2729355221072,
+    3768.7162057659411,
+    3779.1667157159077,
+    3789.6244553551055,
+    3800.0894147012082,
+    3810.5615838062768,
+    3821.0409527565694,
+    3831.5275116723533,
+    3842.0212507077194,
+    3852.522160050396,
+    3863.0302299215673,
+    3873.5454505756893,
+    3884.0678123003108,
+    3894.5973054158922,
+    3905.1339202756285,
+    3915.6776472652732,
+    3926.2284768029604,
+    3936.7863993390338,
+    3947.3514053558706,
+    3957.9234853677135,
+    3968.5026299204969,
+    3979.0888295916798,
+    3989.6820749900776,
+    4000.2823567556948,
+    4010.8896655595613,
+    4021.5039921035655,
+    4032.1253271202945,
+    4042.7536613728694,
+    4053.3889856547858,
+    4064.0312907897551,
+    4074.6805676315448,
+    4085.3368070638221,
+    4095.9999999999982,
+    4106.6701373830711,
+    4117.347210185475,
+    4128.0312094089259,
+    4138.722126084268,
+    4149.4199512713267,
+    4160.1246760587583,
+    4170.8362915638982,
+    4181.5547889326181,
+    4192.2801593391769,
+    4203.0123939860741,
+    4213.7514841039101,
+    4224.4974209512384,
+    4235.2501958144258,
+    4246.0098000075095,
+    4256.7762248720574,
+    4267.549461777031,
+    4278.3295021186423,
+    4289.1163373202198,
+    4299.9099588320714,
+    4310.7103581313495,
+    4321.5175267219138,
+    4332.3314561342004,
+    4343.152137925088,
+    4353.9795636777671,
+    4364.8137250016052,
+    4375.6546135320223,
+    4386.5022209303588,
+    4397.3565388837469,
+    4408.2175591049827,
+    4419.0852733324018,
+    4429.9596733297531,
+    4440.8407508860728,
+    4451.7284978155603,
+    4462.6229059574571,
+    4473.5239671759227,
+    4484.4316733599126,
+    4495.3460164230582,
+    4506.2669883035496,
+    4517.1945809640119,
+    4528.1287863913894,
+    4539.069596596828,
+    4550.0170036155587,
+    4560.9709995067806,
+    4571.931576353546,
+    4582.898726262647,
+    4593.8724413645004,
+    4604.8527138130348,
+    4615.8395357855816,
+    4626.8328994827571,
+    4637.8327971283588,
+    4648.8392209692511,
+    4659.8521632752563,
+    4670.8716163390473,
+    4681.8975724760394,
+    4692.9300240242837,
+    4703.9689633443595,
+    4715.0143828192668,
+    4726.0662748543255,
+    4737.1246318770682,
+    4748.1894463371373,
+    4759.2607107061804,
+    4770.3384174777493,
+    4781.4225591671993,
+    4792.5131283115852,
+    4803.6101174695614,
+    4814.7135192212854,
+    4825.8233261683154,
+    4836.9395309335096,
+    4848.0621261609349,
+    4859.1911045157631,
+    4870.3264586841779,
+    4881.4681813732768,
+    4892.6162653109768,
+    4903.7707032459193,
+    4914.931487947375,
+    4926.0986122051509,
+    4937.2720688294967,
+    4948.4518506510112,
+    4959.637950520555,
+    4970.8303613091521,
+    4982.0290759079044,
+    4993.2340872278974,
+    5004.4453882001153,
+    5015.6629717753467,
+    5026.8868309241007,
+    5038.1169586365131,
+    5049.353347922266,
+    5060.5959918104927,
+    5071.8448833496996,
+    5083.1000156076734,
+    5094.3613816713996,
+    5105.6289746469747,
+    5116.9027876595246,
+    5128.18281385312,
+    5139.4690463906918,
+    5150.7614784539473,
+    5162.0601032432933,
+    5173.3649139777472,
+    5184.6759038948594,
+    5195.9930662506322,
+    5207.3163943194386,
+    5218.6458813939435,
+    5229.9815207850224,
+    5241.3233058216847,
+    5252.6712298509919,
+    5264.025286237983,
+    5275.3854683655954,
+    5286.7517696345885,
+    5298.1241834634639,
+    5309.5027032883945,
+    5320.887322563146,
+    5332.2780347589978,
+    5343.6748333646756,
+    5355.0777118862716,
+    5366.4866638471722,
+    5377.901682787985,
+    5389.3227622664635,
+    5400.749895857437,
+    5412.1830771527357,
+    5423.622299761123,
+    5435.067557308219,
+    5446.5188434364318,
+    5457.9761518048872,
+    5469.4394760893592,
+    5480.9088099821975,
+    5492.3841471922606,
+    5503.8654814448455,
+    5515.3528064816201,
+    5526.846116060552,
+    5538.3454039558474,
+    5549.8506639578736,
+    5561.3618898731029,
+    5572.8790755240361,
+    5584.4022147491451,
+    5595.9313014027975,
+    5607.4663293552012,
+    5619.0072924923297,
+    5630.5541847158656,
+    5642.1069999431284,
+    5653.665732107017,
+    5665.230375155943,
+    5676.8009230537655,
+    5688.3773697797333,
+    5699.9597093284156,
+    5711.5479357096474,
+    5723.1420429484588,
+    5734.7420250850209,
+    5746.347876174581,
+    5757.9595902874016,
+    5769.5771615087006,
+    5781.2005839385911,
+    5792.8298516920213,
+    5804.4649588987149,
+    5816.1058997031105,
+    5827.7526682643065,
+    5839.4052587559972,
+    5851.0636653664196,
+    5862.7278822982908,
+    5874.3979037687541,
+    5886.0737240093204,
+    5897.7553372658094,
+    5909.4427377982956,
+    5921.1359198810505,
+    5932.8348778024874,
+    5944.5396058651031,
+    5956.2500983854261,
+    5967.9663496939575,
+    5979.6883541351208,
+    5991.4161060672022,
+    6003.1495998623004,
+    6014.8888299062692,
+    6026.6337905986684,
+    6038.3844763527022,
+    6050.1408815951781,
+    6061.9030007664414,
+    6073.6708283203316,
+    6085.4443587241267,
+    6097.2235864584891,
+    6109.0085060174197,
+    6120.7991119081998,
+    6132.595398651345,
+    6144.3973607805519,
+    6156.2049928426459,
+    6168.0182893975361,
+    6179.8372450181578,
+    6191.6618542904307,
+    6203.4921118132024,
+    6215.3280121982016,
+    6227.1695500699925,
+    6239.0167200659189,
+    6250.8695168360628,
+    6262.7279350431891,
+    6274.5919693627056,
+    6286.4616144826068,
+    6298.3368651034316,
+    6310.2177159382172,
+    6322.1041617124456,
+    6333.9961971640032,
+    6345.8938170431311,
+    6357.7970161123785,
+    6369.7057891465583,
+    6381.6201309327007,
+    6393.5400362700075,
+    6405.4654999698032,
+    6417.3965168554978,
+    6429.3330817625329,
+    6441.2751895383453,
+    6453.2228350423138,
+    6465.176013145724,
+    6477.134718731716,
+    6489.0989466952469,
+    6501.0686919430445,
+    6513.0439493935628,
+    6525.0247139769417,
+    6537.010980634961,
+    6549.002744321001,
+    6560.9999999999973,
+    6573.0027426483985,
+    6585.0109672541284,
+    6597.0246688165371,
+    6609.0438423463656,
+    6621.0684828657004,
+    6633.0985854079354,
+    6645.134145017727,
+    6657.1751567509573,
+    6669.2216156746908,
+    6681.2735168671343,
+    6693.3308554176001,
+    6705.3936264264594,
+    6717.461825005108,
+    6729.535446275926,
+    6741.6144853722335,
+    6753.6989374382601,
+    6765.7887976290967,
+    6777.8840611106634,
+    6789.9847230596661,
+    6802.0907786635626,
+    6814.2022231205201,
+    6826.3190516393797,
+    6838.4412594396181,
+    6850.5688417513074,
+    6862.701793815083,
+    6874.840110882099,
+    6886.9837882139991,
+    6899.1328210828724,
+    6911.2872047712199,
+    6923.4469345719199,
+    6935.6120057881863,
+    6947.7824137335365,
+    6959.9581537317536,
+    6972.1392211168532,
+    6984.3256112330409,
+    6996.5173194346862,
+    7008.7143410862773,
+    7020.9166715623942,
+    7033.1243062476678,
+    7045.3372405367481,
+    7057.5554698342685,
+    7069.7789895548103,
+    7082.0077951228714,
+    7094.2418819728273,
+    7106.4812455489018,
+    7118.7258813051285,
+    7130.9757847053224,
+    7143.2309512230404,
+    7155.4913763415516,
+    7167.7570555538041,
+    7180.0279843623894,
+    7192.3041582795131,
+    7204.5855728269571,
+    7216.8722235360519,
+    7229.1641059476406,
+    7241.4612156120484,
+    7253.7635480890503,
+    7266.0710989478375,
+    7278.3838637669869,
+    7290.7018381344296,
+    7303.0250176474174,
+    7315.3533979124932,
+    7327.6869745454596,
+    7340.0257431713462,
+    7352.3696994243801,
+    7364.7188389479543,
+    7377.0731573945968,
+    7389.4326504259407,
+    7401.7973137126937,
+    7414.1671429346061,
+    7426.5421337804428,
+    7438.922281947951,
+    7451.3075831438346,
+    7463.6980330837177,
+    7476.0936274921214,
+    7488.4943621024304,
+    7500.9002326568652,
+    7513.3112349064522,
+    7525.7273646109943,
+    7538.1486175390446,
+    7550.5749894678729,
+    7563.0064761834419,
+    7575.4430734803736,
+    7587.8847771619248,
+    7600.3315830399597,
+    7612.7834869349153,
+    7625.24048467578,
+    7637.7025721000637,
+    7650.1697450537677,
+    7662.6419993913596,
+    7675.1193309757446,
+    7687.6017356782404,
+    7700.0892093785433,
+    7712.5817479647112,
+    7725.079347333125,
+    7737.5820033884729,
+    7750.0897120437139,
+    7762.6024692200581,
+    7775.1202708469355,
+    7787.6431128619733,
+    7800.1709912109645,
+    7812.7039018478481,
+    7825.2418407346768,
+    7837.7848038415968,
+    7850.3327871468155,
+    7862.8857866365806,
+    7875.4437983051539,
+    7888.006818154784,
+    7900.5748421956796,
+    7913.1478664459901,
+    7925.725886931772,
+    7938.3088996869719,
+    7950.8969007533951,
+    7963.4898861806851,
+    7976.0878520262959,
+    7988.6907943554688,
+    8001.2987092412086,
+    8013.911592764257,
+    8026.5294410130691,
+    8039.1522500837891,
+    8051.7800160802271,
+    8064.412735113835,
+    8077.0504033036796,
+    8089.6930167764222,
+    8102.3405716662946,
+    8114.9930641150731,
+    8127.6504902720571,
+    8140.3128462940449,
+    8152.9801283453098,
+    8165.6523325975786,
+    8178.3294552300049,
+    8191.0114924291529,
+    8203.6984403889655,
+    8216.3902953107463,
+    8229.0870534031419,
+    8241.7887108821069,
+    8254.4952639708936,
+    8267.2067089000211,
+    8279.9230419072574,
+    8292.6442592375952,
+    8305.3703571432306,
+    8318.101331883543,
+    8330.8371797250657,
+    8343.577896941475,
+    8356.3234798135582,
+    8369.0739246291978,
+    8381.8292276833508,
+    8394.5893852780209,
+    8407.3543937222421,
+    8420.1242493320569,
+    8432.8989484304948,
+    8445.6784873475499,
+    8458.4628624201578,
+    8471.2520699921806,
+    8484.0461064143838,
+    8496.8449680444082,
+    8509.6486512467636,
+    8522.4571523927953,
+    8535.270467860666,
+    8548.0885940353437,
+    8560.9115273085663,
+    8573.7392640788403,
+    8586.5718007514006,
+    8599.4091337382069,
+    8612.2512594579148,
+    8625.0981743358552,
+    8637.9498748040205,
+    8650.8063573010386,
+    8663.6676182721567,
+    8676.533654169225,
+    8689.4044614506638,
+    8702.2800365814601,
+    8715.1603760331418,
+    8728.0454762837508,
+    8740.9353338178389,
+    8753.8299451264356,
+    8766.7293067070332,
+    8779.6334150635721,
+    8792.5422667064158,
+    8805.4558581523324,
+    8818.3741859244819,
+    8831.2972465523908,
+    8844.2250365719356,
+    8857.1575525253265,
+    8870.0947909610859,
+    8883.0367484340295,
+    8895.9834215052524,
+    8908.934806742107,
+    8921.8909007181846,
+    8934.8517000132997,
+    8947.817201213471,
+    8960.7874009109,
+    8973.7622957039603,
+    8986.7418821971733,
+    8999.7261570011924,
+    9012.7151167327884,
+    9025.7087580148236,
+    9038.7070774762469,
+    9051.7100717520643,
+    9064.7177374833282,
+    9077.7300713171153,
+    9090.7470699065179,
+    9103.7687299106146,
+    9116.7950479944648,
+    9129.8260208290812,
+    9142.8616450914233,
+    9155.9019174643727,
+    9168.9468346367157,
+    9181.9963933031358,
+    9195.0505901641845,
+    9208.1094219262741,
+    9221.1728853016557,
+    9234.240977008405,
+    9247.3136937704076,
+    9260.3910323173386,
+    9273.472989384647,
+    9286.5595617135423,
+    9299.6507460509747,
+    9312.7465391496207,
+    9325.8469377678684,
+    9338.9519386698012,
+    9352.0615386251757,
+    9365.1757344094131,
+    9378.2945228035842,
+    9391.4179005943843,
+    9404.5458645741273,
+    9417.6784115407263,
+    9430.8155382976747,
+    9443.9572416540359,
+    9457.1035184244265,
+    9470.2543654290002,
+    9483.4097794934296,
+    9496.5697574488931,
+    9509.7342961320664,
+    9522.9033923850911,
+    9536.0770430555804,
+    9549.2552449965824,
+    9562.4379950665825,
+    9575.6252901294793,
+    9588.8171270545736,
+    9602.0135027165488,
+    9615.2144139954635,
+    9628.4198577767274,
+    9641.629830951093,
+    9654.844330414644,
+    9668.0633530687719,
+    9681.286895820167,
+    9694.5149555808002,
+    9707.7475292679192,
+    9720.9846138040157,
+    9734.2262061168276,
+    9747.4723031393187,
+    9760.7229018096641,
+    9773.9779990712323,
+    9787.2375918725811,
+    9800.5016771674327,
+    9813.7702519146696,
+    9827.0433130783094,
+    9840.3208576275028,
+    9853.602882536512,
+    9866.8893847846994,
+    9880.1803613565116,
+    9893.4758092414686,
+    9906.7757254341523,
+    9920.0801069341851,
+    9933.3889507462245,
+    9946.7022538799429,
+    9960.0200133500221,
+    9973.3422261761298,
+    9986.6688893829159,
+    9999.9999999999945,
+    10013.335555061929,
+    10026.675551608221,
+    10040.019986683301,
+    10053.368857336509,
+    10066.722160622081,
+    10080.079893599144,
+    10093.442053331697,
+    10106.808636888598,
+    10120.179641343551,
+    10133.555063775095,
+    10146.934901266595,
+    10160.31915090622,
+    10173.707809786936,
+    10187.100875006496,
+    10200.498343667417,
+    10213.900212876984,
+    10227.306479747222,
+    10240.717141394889,
+    10254.132194941467,
+    10267.551637513146,
+    10280.975466240814,
+    10294.40367826004,
+    10307.836270711066,
+    10321.273240738796,
+    10334.71458549278,
+    10348.160302127204,
+    10361.610387800878,
+    10375.064839677221,
+    10388.523654924258,
+    10401.986830714593,
+    10415.454364225412,
+    10428.926252638465,
+    10442.402493140049,
+    10455.883082921007,
+    10469.368019176709,
+    10482.85729910704,
+    10496.350919916393,
+    10509.848878813653,
+    10523.351173012188,
+    10536.857799729838,
+    10550.3687561889,
+    10563.884039616123,
+    10577.403647242685,
+    10590.927576304197,
+    10604.455824040679,
+    10617.988387696556,
+    10631.525264520642,
+    10645.066451766135,
+    10658.611946690598,
+    10672.161746555956,
+    10685.715848628475,
+    10699.274250178762,
+    10712.836948481747,
+    10726.403940816675,
+    10739.975224467091,
+    10753.550796720834,
+    10767.130654870027,
+    10780.714796211059,
+    10794.303218044579,
+    10807.895917675487,
+    10821.492892412922,
+    10835.094139570248,
+    10848.699656465047,
+    10862.309440419107,
+    10875.923488758415,
+    10889.541798813138,
+    10903.16436791762,
+    10916.791193410372,
+    10930.422272634056,
+    10944.05760293548,
+    10957.697181665582,
+    10971.341006179427,
+    10984.98907383619,
+    10998.641381999149,
+    11012.297928035676,
+    11025.958709317223,
+    11039.623723219316,
+    11053.292967121541,
+    11066.966438407539,
+    11080.64413446499,
+    11094.326052685608,
+    11108.012190465128,
+    11121.702545203296,
+    11135.397114303863,
+    11149.095895174571,
+    11162.798885227143,
+    11176.506081877278,
+    11190.217482544635,
+    11203.933084652828,
+    11217.652885629415,
+    11231.376882905886,
+    11245.105073917659,
+    11258.837456104062,
+    11272.574026908333,
+    11286.314783777601,
+    11300.059724162888,
+    11313.808845519083,
+    11327.562145304952,
+    11341.319620983111,
+    11355.081270020033,
+    11368.847089886023,
+    11382.617078055218,
+    11396.391232005579,
+    11410.169549218874,
+    11423.952027180676,
+    11437.738663380349,
+    11451.529455311042,
+    11465.324400469679,
+    11479.123496356951,
+    11492.926740477304,
+    11506.734130338931,
+    11520.545663453764,
+    11534.361337337466,
+    11548.181149509423,
+    11562.005097492724,
+    11575.83317881417,
+    11589.665391004253,
+    11603.501731597149,
+    11617.342198130715,
+    11631.186788146468,
+    11645.035499189589,
+    11658.888328808911,
+    11672.745274556904,
+    11686.606333989675,
+    11700.471504666955,
+    11714.340784152086,
+    11728.214170012021,
+    11742.091659817312,
+    11755.973251142101,
+    11769.858941564111,
+    11783.748728664636,
+    11797.642610028539,
+    11811.540583244237,
+    11825.442645903697,
+    11839.34879560242,
+    11853.259029939445,
+    11867.173346517333,
+    11881.091742942155,
+    11895.014216823492,
+    11908.940765774427,
+    11922.871387411526,
+    11936.806079354839,
+    11950.744839227897,
+    11964.687664657684,
+    11978.634553274653,
+    11992.585502712702,
+    12006.540510609168,
+    12020.499574604828,
+    12034.462692343877,
+    12048.429861473938,
+    12062.401079646032,
+    12076.376344514589,
+    12090.355653737433,
+    12104.339004975769,
+    12118.326395894188,
+    12132.317824160644,
+    12146.313287446457,
+    12160.312783426305,
+    12174.316309778205,
+    12188.323864183525,
+    12202.335444326955,
+    12216.351047896511,
+    12230.370672583531,
+    12244.394316082657,
+    12258.421976091831,
+    12272.453650312296,
+    12286.489336448574,
+    12300.529032208471,
+    12314.572735303058,
+    12328.620443446678,
+    12342.672154356922,
+    12356.727865754638,
+    12370.787575363909,
+    12384.851280912055,
+    12398.918980129623,
+    12412.990670750381,
+    12427.066350511306,
+    12441.146017152583,
+    12455.229668417589,
+    12469.317302052901,
+    12483.40891580827,
+    12497.50450743663,
+    12511.604074694078,
+    12525.707615339878,
+    12539.815127136444,
+    12553.926607849342,
+    12568.042055247275,
+    12582.161467102082,
+    12596.284841188726,
+    12610.41217528529,
+    12624.543467172971,
+    12638.678714636069,
+    12652.817915461985,
+    12666.961067441209,
+    12681.108168367316,
+    12695.259216036962,
+    12709.414208249869,
+    12723.573142808827,
+    12737.736017519681,
+    12751.902830191326,
+    12766.073578635704,
+    12780.248260667788,
+    12794.426874105588,
+    12808.609416770132,
+    12822.795886485468,
+    12836.986281078653,
+    12851.180598379744,
+    12865.378836221802,
+    12879.580992440871,
+    12893.787064875984,
+    12907.997051369144,
+    12922.210949765335,
+    12936.428757912496,
+    12950.650473661524,
+    12964.876094866273,
+    12979.105619383534,
+    12993.339045073039,
+    13007.576369797454,
+    13021.817591422368,
+    13036.062707816285,
+    13050.311716850629,
+    13064.564616399723,
+    13078.821404340792,
+    13093.082078553954,
+    13107.346636922217,
+    13121.615077331464,
+    13135.887397670458,
+    13150.163595830827,
+    13164.44366970706,
+    13178.727617196502,
+    13193.015436199352,
+    13207.307124618648,
+    13221.602680360265,
+    13235.902101332911,
+    13250.205385448118,
+    13264.512530620239,
+    13278.823534766434,
+    13293.138395806676,
+    13307.457111663734,
+    13321.779680263176,
+    13336.106099533356,
+    13350.436367405409,
+    13364.77048181325,
+    13379.108440693562,
+    13393.450241985796,
+    13407.795883632158,
+    13422.145363577607,
+    13436.498679769853,
+    13450.855830159346,
+    13465.216812699266,
+    13479.581625345529,
+    13493.950266056772,
+    13508.32273279435,
+    13522.699023522329,
+    13537.079136207483,
+    13551.463068819286,
+    13565.850819329906,
+    13580.2423857142,
+    13594.63776594971,
+    13609.036958016657,
+    13623.439959897927,
+    13637.846769579081,
+    13652.257385048335,
+    13666.67180429656,
+    13681.090025317284,
+    13695.512046106669,
+    13709.937864663521,
+    13724.367478989278,
+    13738.800887088004,
+    13753.238086966385,
+    13767.679076633727,
+    13782.123854101939,
+    13796.572417385545,
+    13811.024764501659,
+    13825.480893469998,
+    13839.94080231286,
+    13854.404489055134,
+    13868.871951724283,
+    13883.34318835034,
+    13897.818196965914,
+    13912.296975606168,
+    13926.779522308825,
+    13941.26583511416,
+    13955.755912064991,
+    13970.249751206682,
+    13984.747350587126,
+    13999.248708256751,
+    14013.753822268511,
+    14028.262690677873,
+    14042.775311542828,
+    14057.291682923867,
+    14071.811802883994,
+    14086.335669488704,
+    14100.863280805994,
+    14115.394634906341,
+    14129.92972986271,
+    14144.468563750548,
+    14159.01113464777,
+    14173.55744063476,
+    14188.107479794369,
+    14202.661250211901,
+    14217.218749975118,
+    14231.779977174227,
+    14246.344929901879,
+    14260.913606253163,
+    14275.486004325601,
+    14290.062122219146,
+    14304.641958036171,
+    14319.225509881464,
+    14333.812775862236,
+    14348.403754088098,
+    14362.998442671067,
+    14377.59683972556,
+    14392.198943368388,
+    14406.804751718748,
+    14421.414262898223,
+    14436.027475030774,
+    14450.64438624274,
+    14465.264994662828,
+    14479.889298422106,
+    14494.517295654005,
+    14509.148984494313,
+    14523.784363081166,
+    14538.423429555049,
+    14553.066182058781,
+    14567.712618737527,
+    14582.362737738777,
+    14597.016537212348,
+    14611.674015310382,
+    14626.33517018734,
+    14640.999999999993,
+    14655.668502907418,
+    14670.340677071003,
+    14685.016520654426,
+    14699.696031823671,
+    14714.379208746999,
+    14729.066049594967,
+    14743.756552540408,
+    14758.45071575843,
+    14773.148537426418,
+    14787.850015724018,
+    14802.555148833142,
+    14817.263934937961,
+    14831.976372224897,
+    14846.692458882624,
+    14861.41219310206,
+    14876.135573076363,
+    14890.862597000923,
+    14905.593263073371,
+    14920.327569493558,
+    14935.065514463557,
+    14949.807096187662,
+    14964.552312872382,
+    14979.301162726431,
+    14994.053643960735,
+    15008.809754788414,
+    15023.569493424788,
+    15038.332858087369,
+    15053.099846995858,
+    15067.870458372134,
+    15082.644690440264,
+    15097.422541426484,
+    15112.204009559202,
+    15126.989093068994,
+    15141.777790188597,
+    15156.570099152905,
+    15171.366018198967,
+    15186.165545565986,
+    15200.968679495301,
+    15215.775418230402,
+    15230.585760016909,
+    15245.399703102579,
+    15260.217245737298,
+    15275.038386173073,
+    15289.863122664035,
+    15304.691453466432,
+    15319.523376838621,
+    15334.358891041069,
+    15349.197994336346,
+    15364.040684989128,
+    15378.886961266177,
+    15393.736821436356,
+    15408.590263770609,
+    15423.447286541972,
+    15438.307888025554,
+    15453.172066498542,
+    15468.039820240196,
+    15482.91114753184,
+    15497.786046656869,
+    15512.664515900733,
+    15527.546553550939,
+    15542.432157897045,
+    15557.32132723066,
+    15572.214059845435,
+    15587.110354037064,
+    15602.010208103273,
+    15616.913620343823,
+    15631.820589060506,
+    15646.731112557136,
+    15661.645189139546,
+    15676.562817115593,
+    15691.483994795139,
+    15706.408720490062,
+    15721.336992514242,
+    15736.268809183561,
+    15751.204168815901,
+    15766.143069731135,
+    15781.085510251132,
+    15796.03148869974,
+    15810.981003402798,
+    15825.934052688119,
+    15840.890634885489,
+    15855.850748326673,
+    15870.814391345401,
+    15885.781562277361,
+    15900.752259460214,
+    15915.726481233565,
+    15930.704225938984,
+    15945.685491919978,
+    15960.670277522009,
+    15975.658581092481,
+    15990.65040098073,
+    16005.645735538035,
+    16020.644583117599,
+    16035.646942074556,
+    16050.652810765967,
+    16065.662187550806,
+    16080.675070789974,
+    16095.691458846273,
+    16110.711350084424,
+    16125.734742871053,
+    16140.761635574685,
+    16155.792026565747,
+    16170.825914216561,
+    16185.863296901338,
+    16200.904172996183,
+    16215.948540879079,
+    16230.996398929899,
+    16246.047745530386,
+    16261.102579064163,
+    16276.160897916721,
+    16291.22270047542,
+    16306.287985129484,
+    16321.356750269995,
+    16336.428994289896,
+    16351.504715583982,
+    16366.5839125489,
+    16381.666583583141,
+    16396.752727087041,
+    16411.842341462776,
+    16426.935425114363,
+    16442.031976447644,
+    16457.131993870298,
+    16472.235475791829,
+    16487.342420623561,
+    16502.452826778641,
+    16517.566692672033,
+    16532.684016720516,
+    16547.804797342676,
+    16562.929032958902,
+    16578.056721991394,
+    16593.18786286415,
+    16608.322454002962,
+    16623.460493835417,
+    16638.601980790896,
+    16653.746913300558,
+    16668.895289797354,
+    16684.047108716015,
+    16699.202368493046,
+    16714.361067566726,
+    16729.523204377107,
+    16744.688777366009,
+    16759.857784977012,
+    16775.030225655464,
+    16790.206097848466,
+    16805.385400004874,
+    16820.568130575302,
+    16835.754288012104,
+    16850.943870769381,
+    16866.136877302983,
+    16881.333306070494,
+    16896.53315553123,
+    16911.736424146249,
+    16926.943110378332,
+    16942.153212691992,
+    16957.366729553454,
+    16972.583659430682,
+    16987.804000793338,
+    17003.027752112816,
+    17018.254911862205,
+    17033.485478516312,
+    17048.719450551645,
+    17063.956826446421,
+    17079.197604680547,
+    17094.44178373563,
+    17109.689362094967,
+    17124.940338243552,
+    17140.194710668064,
+    17155.452477856852,
+    17170.713638299967,
+    17185.978190489128,
+    17201.246132917724,
+    17216.517464080825,
+    17231.792182475165,
+    17247.070286599141,
+    17262.351774952826,
+    17277.636646037936,
+    17292.924898357855,
+    17308.216530417623,
+    17323.511540723921,
+    17338.809927785089,
+    17354.111690111105,
+    17369.416826213594,
+    17384.725334605821,
+    17400.037213802683,
+    17415.352462320716,
+    17430.67107867809,
+    17445.993061394587,
+    17461.318408991636,
+    17476.647119992274,
+    17491.979192921168,
+    17507.314626304586,
+    17522.653418670423,
+    17537.995568548187,
+    17553.341074468986,
+    17568.689934965536,
+    17584.042148572156,
+    17599.397713824768,
+    17614.75662926089,
+    17630.118893419625,
+    17645.484504841683,
+    17660.853462069354,
+    17676.225763646511,
+    17691.601408118619,
+    17706.980394032718,
+    17722.362719937424,
+    17737.748384382936,
+    17753.137385921014,
+    17768.529723104999,
+    17783.92539448979,
+    17799.324398631856,
+    17814.726734089225,
+    17830.13239942148,
+    17845.541393189767,
+    17860.95371395678,
+    17876.369360286772,
+    17891.788330745527,
+    17907.210623900395,
+    17922.636238320254,
+    17938.065172575527,
+    17953.497425238176,
+    17968.932994881692,
+    17984.371880081104,
+    17999.814079412972,
+    18015.259591455371,
+    18030.708414787914,
+    18046.160547991731,
+    18061.615989649465,
+    18077.074738345284,
+    18092.536792664861,
+    18108.002151195393,
+    18123.470812525571,
+    18138.942775245599,
+    18154.418037947191,
+    18169.896599223546,
+    18185.37845766938,
+    18200.863611880886,
+    18216.352060455767,
+    18231.843801993204,
+    18247.338835093873,
+    18262.837158359936,
+    18278.338770395032,
+    18293.84366980429,
+    18309.351855194309,
+    18324.863325173166,
+    18340.378078350412,
+    18355.896113337069,
+    18371.417428745623,
+    18386.942023190033,
+    18402.469895285718,
+    18418.00104364955,
+    18433.53546689987,
+    18449.073163656474,
+    18464.614132540602,
+    18480.158372174956,
+    18495.705881183676,
+    18511.256658192357,
+    18526.810701828035,
+    18542.368010719183,
+    18557.928583495715,
+    18573.492418788985,
+    18589.059515231773,
+    18604.629871458303,
+    18620.203486104212,
+    18635.78035780658,
+    18651.360485203899,
+    18666.943866936086,
+    18682.53050164448,
+    18698.120387971841,
+    18713.713524562332,
+    18729.30991006154,
+    18744.909543116457,
+    18760.512422375479,
+    18776.118546488418,
+    18791.727914106479,
+    18807.340523882274,
+    18822.95637446981,
+    18838.575464524489,
+    18854.197792703111,
+    18869.823357663863,
+    18885.452158066328,
+    18901.08419257147,
+    18916.719459841639,
+    18932.357958540564,
+    18947.999687333362,
+    18963.644644886521,
+    18979.292829867907,
+    18994.944240946759,
+    19010.598876793687,
+    19026.256736080668,
+    19041.917817481048,
+    19057.582119669532,
+    19073.2496413222,
+    19088.920381116473,
+    19104.594337731145,
+    19120.271509846356,
+    19135.951896143604,
+    19151.635495305738,
+    19167.322306016948,
+    19183.012326962784,
+    19198.705556830122,
+    19214.401994307198,
+    19230.101638083579,
+    19245.804486850167,
+    19261.510539299208,
+    19277.219794124274,
+    19292.932250020265,
+    19308.647905683421,
+    19324.366759811302,
+    19340.088811102793,
+    19355.8140582581,
+    19371.542499978754,
+    19387.2741349676,
+    19403.008961928797,
+    19418.746979567823,
+    19434.488186591469,
+    19450.232581707827,
+    19465.980163626304,
+    19481.730931057613,
+    19497.484882713761,
+    19513.242017308068,
+    19529.002333555141,
+    19544.765830170898,
+    19560.532505872539,
+    19576.302359378566,
+    19592.075389408761,
+    19607.851594684209,
+    19623.630973927269,
+    19639.41352586159,
+    19655.199249212103,
+    19670.988142705017,
+    19686.780205067826,
+    19702.575435029288,
+    19718.373831319448,
+    19734.175392669615,
+    19749.980117812371,
+    19765.788005481569,
+    19781.599054412323,
+    19797.413263341008,
+    19813.230631005274,
+    19829.051156144014,
+    19844.874837497395,
+    19860.701673806827,
+    19876.531663814985,
+    19892.364806265789,
+    19908.201099904403,
+    19924.040543477258,
+    19939.883135732012,
+    19955.728875417579,
+    19971.577761284105,
+    19987.429792082985,
+    20003.284966566847,
+    20019.14328348956,
+    20035.004741606219,
+    20050.869339673161,
+    20066.737076447946,
+    20082.607950689362,
+    20098.481961157428,
+    20114.359106613385,
+    20130.239385819699,
+    20146.122797540058,
+    20162.009340539353,
+    20177.899013583716,
+    20193.791815440476,
+    20209.687744878182,
+    20225.586800666591,
+    20241.488981576669,
+    20257.394286380597,
+    20273.302713851754,
+    20289.214262764715,
+    20305.128931895277,
+    20321.046720020415,
+    20336.967625918318,
+    20352.891648368361,
+    20368.818786151114,
+    20384.749038048347,
+    20400.682402843009,
+    20416.618879319249,
+    20432.558466262391,
+    20448.501162458953,
+    20464.446966696629,
+    20480.395877764302,
+    20496.347894452025,
+    20512.303015551031,
+    20528.261239853735,
+    20544.22256615372,
+    20560.186993245738,
+    20576.15451992572,
+    20592.125144990758,
+    20608.098867239107,
+    20624.075685470198,
+    20640.055598484618,
+    20656.038605084115,
+    20672.024704071595,
+    20688.013894251126,
+    20704.006174427926,
+    20720.001543408373,
+    20735.999999999989,
+    20752.001543011454,
+    20768.006171252597,
+    20784.013883534382,
+    20800.024678668931,
+    20816.038555469506,
+    20832.055512750507,
+    20848.075549327474,
+    20864.098664017085,
+    20880.124855637161,
+    20896.154123006647,
+    20912.186464945626,
+    20928.221880275312,
+    20944.260367818049,
+    20960.301926397311,
+    20976.346554837684,
+    20992.394251964895,
+    21008.445016605787,
+    21024.498847588318,
+    21040.555743741574,
+    21056.615703895754,
+    21072.678726882168,
+    21088.744811533252,
+    21104.813956682538,
+    21120.886161164683,
+    21136.961423815443,
+    21153.039743471683,
+    21169.121118971379,
+    21185.205549153605,
+    21201.293032858535,
+    21217.383568927453,
+    21233.477156202731,
+    21249.573793527841,
+    21265.673479747358,
+    21281.776213706937,
+    21297.881994253334,
+    21313.990820234398,
+    21330.102690499054,
+    21346.21760389733,
+    21362.335559280327,
+    21378.456555500241,
+    21394.580591410333,
+    21410.707665864964,
+    21426.83777771956,
+    21442.970925830628,
+    21459.107109055756,
+    21475.246326253604,
+    21491.388576283895,
+    21507.533858007431,
+    21523.682170286087,
+    21539.833511982797,
+    21555.987881961566,
+    21572.145279087465,
+    21588.305702226615,
+    21604.469150246216,
+    21620.635622014521,
+    21636.805116400832,
+    21652.977632275521,
+    21669.153168510009,
+    21685.331723976764,
+    21701.513297549318,
+    21717.697888102244,
+    21733.885494511167,
+    21750.076115652759,
+    21766.269750404736,
+    21782.466397645861,
+    21798.666056255934,
+    21814.868725115801,
+    21831.074403107345,
+    21847.283089113484,
+    21863.494782018177,
+    21879.709480706417,
+    21895.927184064229,
+    21912.147890978667,
+    21928.371600337818,
+    21944.598311030797,
+    21960.828021947746,
+    21977.060731979829,
+    21993.296440019243,
+    22009.535144959198,
+    22025.77684569393,
+    22042.021541118691,
+    22058.269230129757,
+    22074.519911624411,
+    22090.773584500959,
+    22107.030247658717,
+    22123.289899998013,
+    22139.552540420187,
+    22155.818167827587,
+    22172.086781123569,
+    22188.358379212495,
+    22204.632960999726,
+    22220.910525391639,
+    22237.191071295601,
+    22253.474597619981,
+    22269.761103274148,
+    22286.050587168469,
+    22302.343048214312,
+    22318.638485324027,
+    22334.936897410968,
+    22351.23828338947,
+    22367.542642174871,
+    22383.849972683485,
+    22400.160273832618,
+    22416.473544540564,
+    22432.789783726603,
+    22449.108990310986,
+    22465.431163214958,
+    22481.75630136074,
+    22498.084403671528,
+    22514.415469071497,
+    22530.749496485802,
+    22547.086484840562,
+    22563.426433062879,
+    22579.769340080824,
+    22596.115204823436,
+    22612.464026220721,
+    22628.815803203655,
+    22645.170534704179,
+    22661.5282196552,
+    22677.888856990587,
+    22694.252445645168,
+    22710.618984554734,
+    22726.988472656034,
+    22743.360908886778,
+    22759.736292185622,
+    22776.114621492186,
+    22792.495895747044,
+    22808.880113891719,
+    22825.267274868678,
+    22841.657377621348,
+    22858.050421094096,
+    22874.446404232243,
+    22890.845325982053,
+    22907.247185290722,
+    22923.651981106406,
+    22940.059712378195,
+    22956.470378056114,
+    22972.883977091129,
+    22989.300508435153,
+    23005.719971041017,
+    23022.142363862498,
+    23038.567685854305,
+    23054.995935972078,
+    23071.427113172387,
+    23087.86121641273,
+    23104.298244651531,
+    23120.738196848146,
+    23137.181071962848,
+    23153.626868956846,
+    23170.075586792263,
+    23186.527224432142,
+    23202.981780840448,
+    23219.439254982066,
+    23235.899645822796,
+    23252.362952329357,
+    23268.829173469378,
+    23285.298308211408,
+    23301.770355524899,
+    23318.245314380223,
+    23334.723183748658,
+    23351.203962602387,
+    23367.687649914504,
+    23384.174244659007,
+    23400.663745810798,
+    23417.15615234568,
+    23433.651463240367,
+    23450.149677472462,
+    23466.650794020472,
+    23483.154811863806,
+    23499.661729982763,
+    23516.171547358543,
+    23532.684262973235,
+    23549.199875809823,
+    23565.718384852185,
+    23582.239789085092,
+    23598.764087494197,
+    23615.291279066041,
+    23631.821362788058,
+    23648.354337648565,
+    23664.890202636761,
+    23681.428956742733,
+    23697.970598957443,
+    23714.515128272738,
+    23731.062543681343,
+    23747.612844176863,
+    23764.166028753778,
+    23780.72209640744,
+    23797.281046134085,
+    23813.842876930816,
+    23830.407587795606,
+    23846.975177727301,
+    23863.545645725622,
+    23880.11899079115,
+    23896.695211925336,
+    23913.274308130498,
+    23929.856278409821,
+    23946.441121767348,
+    23963.028837207989,
+    23979.619423737513,
+    23996.212880362549,
+    24012.809206090584,
+    24029.408399929966,
+    24046.010460889898,
+    24062.615387980433,
+    24079.223180212492,
+    24095.833836597827,
+    24112.447356149063,
+    24129.063737879667,
+    24145.682980803951,
+    24162.305083937081,
+    24178.930046295067,
+    24195.557866894767,
+    24212.188544753884,
+    24228.822078890964,
+    24245.458468325389,
+    24262.097712077397,
+    24278.739809168052,
+    24295.384758619261,
+    24312.032559453768,
+    24328.683210695162,
+    24345.336711367858,
+    24361.993060497109,
+    24378.652257108995,
+    24395.314300230442,
+    24411.979188889192,
+    24428.646922113825,
+    24445.317498933746,
+    24461.990918379193,
+    24478.667179481225,
+    24495.346281271726,
+    24512.028222783407,
+    24528.713003049801,
+    24545.400621105266,
+    24562.091075984976,
+    24578.784366724925,
+    24595.480492361927,
+    24612.179451933614,
+    24628.881244478438,
+    24645.585869035654,
+    24662.293324645343,
+    24679.003610348394,
+    24695.716725186514,
+    24712.432668202211,
+    24729.151438438807,
+    24745.873034940436,
+    24762.597456752032,
+    24779.324702919344,
+    24796.054772488926,
+    24812.787664508123,
+    24829.5233780251,
+    24846.261912088819,
+    24863.003265749034,
+    24879.747438056307,
+    24896.494428062004,
+    24913.244234818278,
+    24929.996857378079,
+    24946.752294795166,
+    24963.510546124078,
+    24980.271610420157,
+    24997.035486739525,
+    25013.802174139113,
+    25030.571671676629,
+    25047.343978410572,
+    25064.119093400237,
+    25080.897015705697,
+    25097.677744387816,
+    25114.461278508239,
+    25131.2476171294,
+    25148.036759314517,
+    25164.828704127583,
+    25181.623450633375,
+    25198.42099789745,
+    25215.221344986145,
+    25232.024490966574,
+    25248.830434906627,
+    25265.639175874974,
+    25282.450712941049,
+    25299.265045175071,
+    25316.082171648024,
+    25332.902091431668,
+    25349.724803598532,
+    25366.550307221914,
+    25383.378601375884,
+    25400.209685135269,
+    25417.043557575678,
+    25433.880217773472,
+    25450.719664805783,
+    25467.561897750507,
+    25484.406915686297,
+    25501.254717692573,
+    25518.105302849512,
+    25534.958670238051,
+    25551.814818939893,
+    25568.67374803748,
+    25585.535456614027,
+    25602.399943753502,
+    25619.267208540619,
+    25636.137250060852,
+    25653.010067400432,
+    25669.885659646327,
+    25686.76402588627,
+    25703.645165208734,
+    25720.529076702944,
+    25737.415759458876,
+    25754.305212567244,
+    25771.197435119517,
+    25788.092426207899,
+    25804.990184925344,
+    25821.890710365547,
+    25838.794001622944,
+    25855.700057792714,
+    25872.608877970775,
+    25889.520461253778,
+    25906.434806739118,
+    25923.351913524923,
+    25940.271780710063,
+    25957.194407394138,
+    25974.11979267748,
+    25991.047935661154,
+    26007.978835446964,
+    26024.912491137442,
+    26041.848901835841,
+    26058.788066646157,
+    26075.729984673108,
+    26092.674655022136,
+    26109.622076799409,
+    26126.572249111829,
+    26143.525171067016,
+    26160.480841773315,
+    26177.43926033979,
+    26194.400425876229,
+    26211.364337493149,
+    26228.330994301767,
+    26245.30039541404,
+    26262.272539942627,
+    26279.247427000919,
+    26296.225055703002,
+    26313.205425163702,
+    26330.188534498539,
+    26347.174382823756,
+    26364.162969256304,
+    26381.154292913852,
+    26398.148352914774,
+    26415.145148378149,
+    26432.144678423778,
+    26449.146942172156,
+    26466.151938744493,
+    26483.159667262702,
+    26500.170126849403,
+    26517.183316627921,
+    26534.199235722277,
+    26551.217883257199,
+    26568.239258358124,
+    26585.263360151173,
+    26602.290187763181,
+    26619.319740321676,
+    26636.352016954883,
+    26653.387016791727,
+    26670.424738961825,
+    26687.465182595493,
+    26704.508346823739,
+    26721.554230778267,
+    26738.602833591467,
+    26755.65415439643,
+    26772.708192326929,
+    26789.764946517433,
+    26806.824416103096,
+    26823.886600219761,
+    26840.95149800396,
+    26858.019108592915,
+    26875.089431124517,
+    26892.162464737365,
+    26909.238208570721,
+    26926.316661764544,
+    26943.397823459472,
+    26960.481692796813,
+    26977.568268918571,
+    26994.657550967422,
+    27011.749538086722,
+    27028.844229420498,
+    27045.941624113464,
+    27063.041721311005,
+    27080.144520159181,
+    27097.250019804727,
+    27114.35821939505,
+    27131.469118078236,
+    27148.582715003027,
+    27165.699009318858,
+    27182.818000175819,
+    27199.939686724665,
+    27217.064068116837,
+    27234.191143504428,
+    27251.320912040203,
+    27268.453372877593,
+    27285.588525170693,
+    27302.726368074269,
+    27319.866900743735,
+    27337.010122335181,
+    27354.156032005358,
+    27371.304628911668,
+    27388.455912212183,
+    27405.609881065626,
+    27422.766534631384,
+    27439.925872069507,
+    27457.087892540683,
+    27474.252595206275,
+    27491.419979228293,
+    27508.5900437694,
+    27525.762787992917,
+    27542.93821106281,
+    27560.116312143706,
+    27577.297090400876,
+    27594.480545000242,
+    27611.666675108383,
+    27628.855479892518,
+    27646.046958520514,
+    27663.241110160889,
+    27680.437933982801,
+    27697.637429156068,
+    27714.839594851132,
+    27732.04443023909,
+    27749.251934491687,
+    27766.462106781299,
+    27783.674946280949,
+    27800.890452164302,
+    27818.108623605654,
+    27835.329459779954,
+    27852.55295986278,
+    27869.779123030345,
+    27887.007948459504,
+    27904.239435327745,
+    27921.473582813196,
+    27938.710390094613,
+    27955.949856351392,
+    27973.19198076355,
+    27990.436762511745,
+    28007.684200777272,
+    28024.934294742041,
+    28042.187043588601,
+    28059.442446500128,
+    28076.700502660427,
+    28093.961211253929,
+    28111.224571465693,
+    28128.490582481401,
+    28145.759243487362,
+    28163.030553670509,
+    28180.304512218394,
+    28197.581118319198,
+    28214.860371161725,
+    28232.14226993539,
+    28249.42681383024,
+    28266.71400203693,
+    28284.003833746745,
+    28301.296308151585,
+    28318.591424443959,
+    28335.889181817001,
+    28353.189579464462,
+    28370.492616580705,
+    28387.798292360701,
+    28405.106606000048,
+    28422.417556694945,
+    28439.731143642206,
+    28457.047366039264,
+    28474.366223084147,
+    28491.687713975512,
+    28509.011837912611,
+    28526.338594095305,
+    28543.667981724069,
+    28560.999999999982,
+    28578.334648124732,
+    28595.671925300605,
+    28613.011830730498,
+    28630.354363617909,
+    28647.699523166943,
+    28665.0473085823,
+    28682.397719069289,
+    28699.750753833818,
+    28717.10641208239,
+    28734.464693022121,
+    28751.825595860708,
+    28769.189119806462,
+    28786.55526406828,
+    28803.924027855664,
+    28821.295410378701,
+    28838.669410848088,
+    28856.046028475103,
+    28873.425262471628,
+    28890.80711205013,
+    28908.191576423673,
+    28925.578654805915,
+    28942.968346411097,
+    28960.360650454055,
+    28977.755566150216,
+    28995.153092715591,
+    29012.553229366786,
+    29029.955975320987,
+    29047.361329795975,
+    29064.769292010107,
+    29082.179861182336,
+    29099.593036532187,
+    29117.00881727978,
+    29134.427202645813,
+    29151.848191851568,
+    29169.271784118911,
+    29186.697978670283,
+    29204.126774728706,
+    29221.55817151779,
+    29238.992168261717,
+    29256.42876418525,
+    29273.867958513725,
+    29291.309750473058,
+    29308.754139289747,
+    29326.201124190855,
+    29343.65070440403,
+    29361.102879157483,
+    29378.557647680012,
+    29396.015009200975,
+    29413.474962950309,
+    29430.937508158524,
+    29448.402644056692,
+    29465.870369876469,
+    29483.340684850071,
+    29500.81358821028,
+    29518.289079190454,
+    29535.767157024511,
+    29553.247820946945,
+    29570.731070192807,
+    29588.216903997723,
+    29605.70532159787,
+    29623.19632223,
+    29640.689905131429,
+    29658.186069540028,
+    29675.684814694236,
+    29693.186139833047,
+    29710.690044196028,
+    29728.196527023298,
+    29745.705587555527,
+    29763.217225033964,
+    29780.731438700397,
+    29798.248227797183,
+    29815.76759156723,
+    29833.289529254005,
+    29850.81404010153,
+    29868.341123354381,
+    29885.870778257693,
+    29903.403004057145,
+    29920.937799998974,
+    29938.475165329975,
+    29956.015099297485,
+    29973.557601149394,
+    29991.102670134147,
+    30008.650305500738,
+    30026.200506498706,
+    30043.753272378144,
+    30061.308602389683,
+    30078.866495784507,
+    30096.426951814352,
+    30113.989969731494,
+    30131.55554878875,
+    30149.123688239491,
+    30166.694387337629,
+    30184.267645337608,
+    30201.843461494434,
+    30219.42183506364,
+    30237.002765301309,
+    30254.586251464058,
+    30272.172292809046,
+    30289.760888593977,
+    30307.35203807709,
+    30324.94574051716,
+    30342.541995173502,
+    30360.140801305966,
+    30377.742158174944,
+    30395.346065041358,
+    30412.952521166666,
+    30430.561525812864,
+    30448.173078242475,
+    30465.787177718561,
+    30483.403823504719,
+    30501.02301486507,
+    30518.644751064272,
+    30536.269031367516,
+    30553.895855040515,
+    30571.525221349519,
+    30589.157129561307,
+    30606.791578943175,
+    30624.428568762964,
+    30642.06809828903,
+    30659.710166790261,
+    30677.35477353607,
+    30695.001917796391,
+    30712.651598841687,
+    30730.303815942945,
+    30747.958568371676,
+    30765.615855399912,
+    30783.275676300211,
+    30800.938030345646,
+    30818.602916809814,
+    30836.270334966837,
+    30853.940284091354,
+    30871.612763458521,
+    30889.287772344011,
+    30906.965310024025,
+    30924.645375775272,
+    30942.327968874983,
+    30960.013088600903,
+    30977.700734231294,
+    30995.390905044929,
+    31013.083600321101,
+    31030.778819339619,
+    31048.476561380798,
+    31066.17682572547,
+    31083.879611654978,
+    31101.584918451179,
+    31119.29274539644,
+    31137.003091773637,
+    31154.715956866155,
+    31172.431339957893,
+    31190.14924033326,
+    31207.869657277162,
+    31225.592590075023,
+    31243.318038012771,
+    31261.046000376838,
+    31278.776476454172,
+    31296.50946553221,
+    31314.24496689891,
+    31331.98297984272,
+    31349.7235036526,
+    31367.466537618013,
+    31385.212081028923,
+    31402.960133175795,
+    31420.710693349596,
+    31438.463760841791,
+    31456.219334944351,
+    31473.977414949743,
+    31491.738000150934,
+    31509.501089841389,
+    31527.266683315069,
+    31545.034779866437,
+    31562.80537879045,
+    31580.578479382562,
+    31598.35408093872,
+    31616.132182755369,
+    31633.91278412945,
+    31651.695884358396,
+    31669.481482740131,
+    31687.269578573076,
+    31705.060171156143,
+    31722.853259788735,
+    31740.648843770748,
+    31758.446922402567,
+    31776.247494985066,
+    31794.050560819614,
+    31811.85611920806,
+    31829.664169452753,
+    31847.474710856521,
+    31865.287742722685,
+    31883.103264355046,
+    31900.921275057899,
+    31918.741774136019,
+    31936.564760894671,
+    31954.390234639599,
+    31972.21819467704,
+    31990.048640313704,
+    32007.881570856793,
+    32025.716985613984,
+    32043.554883893445,
+    32061.395265003815,
+    32079.238128254223,
+    32097.083472954269,
+    32114.931298414049,
+    32132.781603944117,
+    32150.634388855524,
+    32168.48965245979,
+    32186.347394068915,
+    32204.207612995371,
+    32222.07030855212,
+    32239.935480052583,
+    32257.803126810672,
+    32275.673248140767,
+    32293.545843357719,
+    32311.420911776862,
+    32329.298452713996,
+    32347.178465485395,
+    32365.060949407813,
+    32382.945903798463,
+    32400.83332797504,
+    32418.723221255706,
+    32436.615582959093,
+    32454.510412404306,
+    32472.407708910916,
+    32490.307471798966,
+    32508.209700388961,
+    32526.114394001877,
+    32544.021551959166,
+    32561.931173582732,
+    32579.843258194956,
+    32597.757805118679,
+    32615.674813677211,
+    32633.594283194328,
+    32651.516212994258,
+    32669.440602401712,
+    32687.367450741847,
+    32705.296757340297,
+    32723.228521523146,
+    32741.162742616943,
+    32759.099419948703,
+    32777.038552845901,
+    32794.980140636464,
+    32812.924182648792,
+    32830.87067821173,
+    32848.819626654593,
+    32866.77102730715,
+    32884.724879499619,
+    32902.681182562686,
+    32920.639935827494,
+    32938.601138625643,
+    32956.56479028918,
+    32974.530890150607,
+    32992.499437542894,
+    33010.470431799447,
+    33028.443872254145,
+    33046.419758241311,
+    33064.39808909571,
+    33082.378864152583,
+    33100.36208274759,
+    33118.347744216881,
+    33136.335847897026,
+    33154.326393125062,
+    33172.31937923847,
+    33190.314805575174,
+    33208.312671473555,
+    33226.312976272442,
+    33244.315719311111,
+    33262.320899929284,
+    33280.328517467125,
+    33298.33857126526,
+    33316.351060664747,
+    33334.365985007091,
+    33352.383343634239,
+    33370.403135888591,
+    33388.42536111299,
+    33406.450018650721,
+    33424.477107845501,
+    33442.506628041512,
+    33460.53857858335,
+    33478.572958816083,
+    33496.609768085189,
+    33514.649005736617,
+    33532.690671116739,
+    33550.734763572356,
+    33568.781282450735,
+    33586.830227099563,
+    33604.881596866973,
+    33622.935391101528,
+    33640.991609152239,
+    33659.050250368542,
+    33677.111314100322,
+    33695.174799697881,
+    33713.240706511984,
+    33731.309033893805,
+    33749.37978119497,
+    33767.452947767531,
+    33785.528532963974,
+    33803.606536137209,
+    33821.686956640602,
+    33839.769793827938,
+    33857.855047053425,
+    33875.942715671707,
+    33894.032799037872,
+    33912.125296507431,
+    33930.220207436316,
+    33948.317531180888,
+    33966.417267097961,
+    33984.519414544746,
+    34002.623972878901,
+    34020.730941458511,
+    34038.840319642077,
+    34056.952106788536,
+    34075.066302257255,
+    34093.182905408015,
+    34111.301915601027,
+    34129.42333219693,
+    34147.547154556785,
+    34165.673382042078,
+    34183.80201401472,
+    34201.933049837033,
+    34220.06648887178,
+    34238.202330482141,
+    34256.340574031703,
+    34274.481218884495,
+    34292.624264404949,
+    34310.769709957938,
+    34328.91755490873,
+    34347.067798623029,
+    34365.220440466954,
+    34383.375479807051,
+    34401.532916010263,
+    34419.692748443973,
+    34437.854976475966,
+    34456.01959947445,
+    34474.18661680806,
+    34492.356027845817,
+    34510.527831957188,
+    34528.702028512052,
+    34546.878616880676,
+    34565.05759643377,
+    34583.238966542449,
+    34601.422726578232,
+    34619.608875913065,
+    34637.797413919296,
+    34655.988339969692,
+    34674.181653437423,
+    34692.37735369608,
+    34710.575440119668,
+    34728.775912082579,
+    34746.978768959649,
+    34765.184010126082,
+    34783.391634957537,
+    34801.60164283005,
+    34819.814033120063,
+    34838.028805204456,
+    34856.24595846048,
+    34874.465492265823,
+    34892.687405998557,
+    34910.911699037177,
+    34929.138370760564,
+    34947.367420548027,
+    34965.598847779271,
+    34983.832651834389,
+    35002.068832093908,
+    35020.307387938738,
+    35038.548318750189,
+    35056.79162390998,
+    35075.03730280025,
+    35093.285354803513,
+    35111.535779302685,
+    35129.788575681116,
+    35148.043743322516,
+    35166.301281611013,
+    35184.561189931141,
+    35202.823467667826,
+    35221.088114206388,
+    35239.355128932555,
+    35257.624511232447,
+    35275.896260492584,
+    35294.170376099886,
+    35312.446857441668,
+    35330.725703905628,
+    35349.006914879887,
+    35367.290489752944,
+    35385.576427913686,
+    35403.864728751418,
+    35422.155391655811,
+    35440.448416016967,
+    35458.743801225341,
+    35477.041546671804,
+    35495.341651747622,
+    35513.644115844436,
+    35531.948938354304,
+    35550.256118669655,
+    35568.565656183309,
+    35586.877550288496,
+    35605.191800378816,
+    35623.508405848268,
+    35641.827366091238,
+    35660.148680502505,
+    35678.472348477233,
+    35696.798369410979,
+    35715.126742699678,
+    35733.457467739659,
+    35751.790543927644,
+    35770.125970660738,
+    35788.46374733642,
+    35806.803873352568,
+    35825.146348107453,
+    35843.49117099971,
+    35861.838341428367,
+    35880.187858792851,
+    35898.539722492955,
+    35916.893931928862,
+    35935.250486501129,
+    35953.609385610718,
+    35971.970628658957,
+    35990.334215047558,
+    36008.700144178612,
+    36027.068415454596,
+    36045.439028278372,
+    36063.811982053165,
+    36082.187276182609,
+    36100.564910070694,
+    36118.944883121789,
+    36137.327194740654,
+    36155.711844332429,
+    36174.098831302617,
+    36192.488155057115,
+    36210.87981500219,
+    36229.273810544473,
+    36247.670141091003,
+    36266.068806049167,
+    36284.469804826738,
+    36302.873136831862,
+    36321.278801473069,
+    36339.686798159251,
+    36358.097126299683,
+    36376.509785304013,
+    36394.924774582258,
+    36413.342093544816,
+    36431.761741602444,
+    36450.183718166292,
+    36468.608022647859,
+    36487.034654459028,
+    36505.463613012063,
+    36523.894897719583,
+    36542.328507994578,
+    36560.764443250409,
+    36579.202702900831,
+    36597.643286359926,
+    36616.086193042182,
+    36634.531422362437,
+    36652.978973735895,
+    36671.428846578143,
+    36689.881040305125,
+    36708.335554333149,
+    36726.792388078902,
+    36745.251540959427,
+    36763.713012392138,
+    36782.176801794812,
+    36800.642908585593,
+    36819.111332182983,
+    36837.582072005869,
+    36856.055127473483,
+    36874.530498005421,
+    36893.008183021651,
+    36911.488181942506,
+    36929.970494188674,
+    36948.455119181206,
+    36966.942056341519,
+    36985.431305091392,
+    37003.922864852961,
+    37022.416735048733,
+    37040.912915101559,
+    37059.411404434657,
+    37077.91220247162,
+    37096.415308636388,
+    37114.920722353243,
+    37133.428443046862,
+    37151.938470142253,
+    37170.450803064785,
+    37188.965441240209,
+    37207.482384094597,
+    37226.001631054402,
+    37244.523181546429,
+    37263.047034997842,
+    37281.573190836149,
+    37300.101648489224,
+    37318.632407385296,
+    37337.165466952945,
+    37355.700826621112,
+    37374.238485819085,
+    37392.778443976509,
+    37411.320700523385,
+    37429.865254890057,
+    37448.412106507232,
+    37466.961254805974,
+    37485.512699217681,
+    37504.066439174116,
+    37522.622474107404,
+    37541.180803449992,
+    37559.741426634704,
+    37578.304343094693,
+    37596.869552263488,
+    37615.43705357494,
+    37634.006846463279,
+    37652.578930363044,
+    37671.153304709165,
+    37689.729968936896,
+    37708.308922481847,
+    37726.890164779965,
+    37745.473695267559,
+    37764.059513381275,
+    37782.647618558112,
+    37801.238010235415,
+    37819.830687850859,
+    37838.425650842495,
+    37857.022898648691,
+    37875.622430708172,
+    37894.224246460013,
+    37912.828345343616,
+    37931.434726798747,
+    37950.043390265506,
+    37968.654335184328,
+    37987.267560995999,
+    38005.883067141665,
+    38024.500853062775,
+    38043.120918201159,
+    38061.743261998963,
+    38080.367883898682,
+    38098.994783343158,
+    38117.623959775563,
+    38136.255412639417,
+    38154.889141378575,
+    38173.525145437234,
+    38192.163424259939,
+    38210.803977291551,
+    38229.446803977284,
+    38248.091903762703,
+    38266.739276093685,
+    38285.388920416466,
+    38304.040836177606,
+    38322.695022824002,
+    38341.351479802899,
+    38360.010206561863,
+    38378.671202548816,
+    38397.334467211993,
+    38415.999999999978,
+    38434.667800361683,
+    38453.33786774637,
+    38472.010201603611,
+    38490.684801383337,
+    38509.361666535784,
+    38528.040796511552,
+    38546.722190761553,
+    38565.405848737035,
+    38584.091769889594,
+    38602.779953671132,
+    38621.470399533908,
+    38640.163106930493,
+    38658.858075313794,
+    38677.555304137059,
+    38696.254792853862,
+    38714.956540918094,
+    38733.660547783991,
+    38752.366812906112,
+    38771.075335739348,
+    38789.78611573892,
+    38808.499152360368,
+    38827.214445059573,
+    38845.931993292739,
+    38864.651796516388,
+    38883.373854187383,
+    38902.098165762916,
+    38920.824730700486,
+    38939.553548457938,
+    38958.284618493431,
+    38977.017940265461,
+    38995.753513232834,
+    39014.491336854699,
+    39033.231410590517,
+    39051.973733900079,
+    39070.718306243485,
+    39089.465127081188,
+    39108.214195873945,
+    39126.965512082832,
+    39145.719075169261,
+    39164.474884594965,
+    39183.232939821988,
+    39201.99324031271,
+    39220.755785529815,
+    39239.52057493633,
+    39258.287607995589,
+    39277.056884171245,
+    39295.828402927284,
+    39314.602163728006,
+    39333.378166038019,
+    39352.15640932227,
+    39370.936893046004,
+    39389.719616674811,
+    39408.504579674584,
+    39427.291781511522,
+    39446.081221652174,
+    39464.872899563372,
+    39483.666814712291,
+    39502.462966566411,
+    39521.261354593538,
+    39540.06197826178,
+    39558.864837039568,
+    39577.669930395656,
+    39596.47725779911,
+    39615.286818719302,
+    39634.098612625923,
+    39652.912638988993,
+    39671.728897278823,
+    39690.547386966064,
+    39709.368107521652,
+    39728.191058416858,
+    39747.016239123259,
+    39765.84364911275,
+    39784.673287857528,
+    39803.505154830105,
+    39822.339249503319,
+    39841.175571350293,
+    39860.014119844491,
+    39878.854894459677,
+    39897.697894669909,
+    39916.54311994958,
+    39935.390569773372,
+    39954.240243616303,
+    39973.092140953675,
+    39991.946261261117,
+    40010.802604014549,
+    40029.661168690225,
+    40048.521954764678,
+    40067.384961714779,
+    40086.250189017679,
+    40105.117636150855,
+    40123.98730259209,
+    40142.859187819471,
+    40161.733291311379,
+    40180.609612546526,
+    40199.488151003912,
+    40218.368906162854,
+    40237.25187750296,
+    40256.137064504153,
+    40275.024466646668,
+    40293.914083411029,
+    40312.805914278084,
+    40331.699958728961,
+    40350.596216245103,
+    40369.494686308273,
+    40388.39536840051,
+    40407.298262004173,
+    40426.20336660192,
+    40445.110681676706,
+    40464.020206711793,
+    40482.931941190756,
+    40501.845884597446,
+    40520.762036416032,
+    40539.680396130985,
+    40558.600963227072,
+    40577.523737189367,
+    40596.448717503234,
+    40615.375903654342,
+    40634.305295128659,
+    40653.236891412453,
+    40672.170691992294,
+    40691.106696355047,
+    40710.044903987873,
+    40728.985314378238,
+    40747.927927013901,
+    40766.872741382918,
+    40785.819756973651,
+    40804.768973274746,
+    40823.720389775161,
+    40842.674005964131,
+    40861.629821331211,
+    40880.587835366234,
+    40899.548047559321,
+    40918.510457400931,
+    40937.475064381761,
+    40956.441867992849,
+    40975.410867725499,
+    40994.382063071331,
+    41013.355453522236,
+    41032.331038570417,
+    41051.308817708363,
+    41070.288790428858,
+    41089.270956224987,
+    41108.255314590111,
+    41127.241865017888,
+    41146.23060700229,
+    41165.221540037543,
+    41184.214663618193,
+    41203.209977239079,
+    41222.207480395307,
+    41241.207172582297,
+    41260.209053295752,
+    41279.213122031659,
+    41298.219378286303,
+    41317.227821556255,
+    41336.23845133838,
+    41355.251267129832,
+    41374.266268428037,
+    41393.283454730743,
+    41412.302825535953,
+    41431.324380341983,
+    41450.348118647416,
+    41469.374039951144,
+    41488.402143752326,
+    41507.432429550427,
+    41526.464896845187,
+    41545.499545136627,
+    41564.536373925075,
+    41583.575382711126,
+    41602.616570995662,
+    41621.659938279874,
+    41640.705484065205,
+    41659.753207853406,
+    41678.803109146495,
+    41697.855187446803,
+    41716.909442256911,
+    41735.965873079709,
+    41755.02447941836,
+    41774.085260776315,
+    41793.148216657297,
+    41812.213346565331,
+    41831.280650004708,
+    41850.350126480014,
+    41869.421775496106,
+    41888.495596558132,
+    41907.571589171515,
+    41926.649752841957,
+    41945.730087075463,
+    41964.812591378286,
+    41983.897265256979,
+    42002.984108218378,
+    42022.073119769593,
+    42041.164299418015,
+    42060.257646671307,
+    42079.353161037419,
+    42098.450842024591,
+    42117.550689141324,
+    42136.652701896404,
+    42155.756879798893,
+    42174.863222358137,
+    42193.971729083758,
+    42213.082399485655,
+    42232.195233074002,
+    42251.310229359246,
+    42270.427387852127,
+    42289.546708063644,
+    42308.668189505079,
+    42327.791831687995,
+    42346.917634124227,
+    42366.045596325886,
+    42385.175717805352,
+    42404.307998075295,
+    42423.442436648642,
+    42442.579033038608,
+    42461.717786758672,
+    42480.858697322597,
+    42500.001764244422,
+    42519.146987038446,
+    42538.294365219248,
+    42557.443898301688,
+    42576.595585800882,
+    42595.749427232236,
+    42614.90542211142,
+    42634.063569954378,
+    42653.223870277317,
+    42672.386322596729,
+    42691.55092642938,
+    42710.717681292292,
+    42729.886586702756,
+    42749.057642178363,
+    42768.23084723694,
+    42787.406201396603,
+    42806.58370417574,
+    42825.76335509299,
+    42844.945153667286,
+    42864.129099417805,
+    42883.315191864014,
+    42902.503430525649,
+    42921.693814922692,
+    42940.88634457541,
+    42960.081019004348,
+    42979.277837730297,
+    42998.476800274322,
+    43017.677906157769,
+    43036.881154902228,
+    43056.086546029583,
+    43075.294079061961,
+    43094.503753521763,
+    43113.715568931671,
+    43132.929524814601,
+    43152.145620693766,
+    43171.363856092619,
+    43190.584230534907,
+    43209.806743544621,
+    43229.031394646016,
+    43248.258183363621,
+    43267.487109222224,
+    43286.718171746885,
+    43305.951370462906,
+    43325.186704895881,
+    43344.42417457165,
+    43363.663779016322,
+    43382.905517756262,
+    43402.149390318104,
+    43421.395396228749,
+    43440.643535015348,
+    43459.89380620532,
+    43479.146209326354,
+    43498.400743906379,
+    43517.657409473606,
+    43536.916205556496,
+    43556.177131683784,
+    43575.44018738444,
+    43594.705372187724,
+    43613.972685623135,
+    43633.242127220445,
+    43652.513696509668,
+    43671.787393021099,
+    43691.063216285271,
+    43710.341165833001,
+    43729.621241195346,
+    43748.903441903625,
+    43768.187767489413,
+    43787.474217484552,
+    43806.762791421126,
+    43826.053488831501,
+    43845.346309248278,
+    43864.641252204325,
+    43883.938317232765,
+    43903.237503866971,
+    43922.538811640596,
+    43941.842240087513,
+    43961.147788741881,
+    43980.455457138101,
+    43999.765244810835,
+    44019.077151295001,
+    44038.391176125755,
+    44057.70731883854,
+    44077.02557896902,
+    44096.345956053141,
+    44115.668449627083,
+    44134.993059227287,
+    44154.319784390456,
+    44173.648624653535,
+    44192.979579553728,
+    44212.312648628489,
+    44231.647831415532,
+    44250.985127452805,
+    44270.324536278538,
+    44289.666057431183,
+    44309.009690449464,
+    44328.355434872348,
+    44347.703290239064,
+    44367.053256089079,
+    44386.405331962109,
+    44405.759517398139,
+    44425.115811937387,
+    44444.474215120332,
+    44463.834726487694,
+    44483.197345580462,
+    44502.562071939843,
+    44521.928905107328,
+    44541.297844624634,
+    44560.668890033732,
+    44580.042040876848,
+    44599.417296696454,
+    44618.794657035272,
+    44638.174121436256,
+    44657.555689442641,
+    44676.939360597877,
+    44696.325134445673,
+    44715.713010530002,
+    44735.102988395054,
+    44754.495067585296,
+    44773.88924764542,
+    44793.285528120374,
+    44812.683908555344,
+    44832.084388495779,
+    44851.486967487363,
+    44870.891645076015,
+    44890.298420807922,
+    44909.707294229491,
+    44929.118264887409,
+    44948.531332328566,
+    44967.946496100136,
+    44987.363755749502,
+    45006.783110824319,
+    45026.204560872473,
+    45045.628105442098,
+    45065.053744081561,
+    45084.48147633949,
+    45103.911301764747,
+    45123.343219906426,
+    45142.777230313885,
+    45162.21333253671,
+    45181.651526124733,
+    45201.091810628037,
+    45220.534185596924,
+    45239.978650581965,
+    45259.425205133957,
+    45278.873848803938,
+    45298.324581143192,
+    45317.777401703235,
+    45337.232310035848,
+    45356.68930569302,
+    45376.148388226997,
+    45395.60955719027,
+    45415.072812135557,
+    45434.538152615823,
+    45454.005578184282,
+    45473.475088394356,
+    45492.946682799746,
+    45512.420360954362,
+    45531.896122412363,
+    45551.373966728155,
+    45570.853893456362,
+    45590.33590215187,
+    45609.819992369776,
+    45629.306163665438,
+    45648.794415594442,
+    45668.284747712612,
+    45687.777159576006,
+    45707.27165074092,
+    45726.768220763894,
+    45746.266869201696,
+    45765.767595611323,
+    45785.270399550034,
+    45804.775280575297,
+    45824.282238244828,
+    45843.79127211657,
+    45863.302381748719,
+    45882.815566699683,
+    45902.33082652813,
+    45921.848160792935,
+    45941.367569053225,
+    45960.889050868354,
+    45980.41260579793,
+    45999.938233401757,
+    46019.465933239902,
+    46038.995704872657,
+    46058.527547860547,
+    46078.06146176433,
+    46097.597446144995,
+    46117.135500563774,
+    46136.675624582109,
+    46156.217817761702,
+    46175.762079664462,
+    46195.308409852543,
+    46214.856807888333,
+    46234.407273334444,
+    46253.959805753715,
+    46273.51440470924,
+    46293.071069764315,
+    46312.629800482478,
+    46332.190596427499,
+    46351.753457163381,
+    46371.318382254351,
+    46390.885371264863,
+    46410.45442375962,
+    46430.025539303526,
+    46449.598717461733,
+    46469.17395779962,
+    46488.751259882782,
+    46508.33062327707,
+    46527.912047548532,
+    46547.495532263471,
+    46567.081076988397,
+    46586.668681290059,
+    46606.258344735434,
+    46625.850066891719,
+    46645.443847326351,
+    46665.039685606986,
+    46684.637581301497,
+    46704.237533978005,
+    46723.839543204842,
+    46743.443608550573,
+    46763.049729583989,
+    46782.657905874104,
+    46802.268136990162,
+    46821.880422501628,
+    46841.494761978196,
+    46861.111154989776,
+    46880.729601106526,
+    46900.350099898795,
+    46919.97265093719,
+    46939.597253792526,
+    46959.223908035841,
+    46978.852613238392,
+    46998.483368971691,
+    47018.11617480743,
+    47037.751030317551,
+    47057.387935074221,
+    47077.026888649809,
+    47096.66789061694,
+    47116.310940548428,
+    47135.956038017328,
+    47155.603182596918,
+    47175.252373860698,
+    47194.903611382375,
+    47214.556894735892,
+    47234.212223495422,
+    47253.869597235338,
+    47273.52901553025,
+    47293.19047795498,
+    47312.853984084577,
+    47332.519533494306,
+    47352.187125759658,
+    47371.856760456343,
+    47391.528437160297,
+    47411.202155447652,
+    47430.877914894787,
+    47450.555715078299,
+    47470.235555574982,
+    47489.917435961863,
+    47509.601355816201,
+    47529.287314715453,
+    47548.975312237308,
+    47568.665347959672,
+    47588.357421460656,
+    47608.051532318605,
+    47627.747680112072,
+    47647.445864419846,
+    47667.14608482091,
+    47686.848340894474,
+    47706.552632219973,
+    47726.258958377046,
+    47745.967318945557,
+    47765.677713505589,
+    47785.390141637428,
+    47805.104602921601,
+    47824.821096938824,
+    47844.539623270044,
+    47864.260181496429,
+    47883.982771199349,
+    47903.707391960394,
+    47923.434043361369,
+    47943.162724984308,
+    47962.893436411439,
+    47982.626177225218,
+    48002.36094700831,
+    48022.097745343599,
+    48041.836571814172,
+    48061.57742600335,
+    48081.32030749465,
+    48101.065215871815,
+    48120.81215071879,
+    48140.56111161974,
+    48160.312098159047,
+    48180.065109921306,
+    48199.820146491307,
+    48219.577207454073,
+    48239.336292394844,
+    48259.097400899045,
+    48278.860532552339,
+    48298.625686940592,
+    48318.392863649875,
+    48338.162062266485,
+    48357.933282376915,
+    48377.706523567889,
+    48397.481785426316,
+    48417.259067539344,
+    48437.038369494308,
+    48456.819690878765,
+    48476.603031280487,
+    48496.388390287451,
+    48516.175767487839,
+    48535.965162470042,
+    48555.756574822684,
+    48575.550004134566,
+    48595.345449994718,
+    48615.142911992378,
+    48634.942389716991,
+    48654.743882758201,
+    48674.547390705877,
+    48694.352913150084,
+    48714.160449681112,
+    48733.969999889443,
+    48753.781563365759,
+    48773.595139700978,
+    48793.410728486211,
+    48813.228329312769,
+    48833.047941772187,
+    48852.869565456189,
+    48872.693199956717,
+    48892.518844865925,
+    48912.346499776155,
+    48932.176164279976,
+    48952.007837970152,
+    48971.841520439666,
+    48991.677211281676,
+    49011.514910089587,
+    49031.354616456978,
+    49051.196329977654,
+    49071.04005024561,
+    49090.885776855059,
+    49110.733509400408,
+    49130.583247476279,
+    49150.434990677488,
+    49170.288738599062,
+    49190.144490836232,
+    49210.002246984441,
+    49229.86200663932,
+    49249.723769396718,
+    49269.587534852675,
+    49289.453302603448,
+    49309.32107224549,
+    49329.190843375451,
+    49349.062615590192,
+    49368.936388486785,
+    49388.812161662492,
+    49408.689934714785,
+    49428.569707241324,
+    49448.45147883999,
+    49468.335249108866,
+    49488.22101764621,
+    49508.108784050521,
+    49527.99854792047,
+    49547.890308854934,
+    49567.784066453009,
+    49587.679820313977,
+    49607.57757003732,
+    49627.477315222721,
+    49647.379055470075,
+    49667.28279037946,
+    49687.188519551179,
+    49707.096242585707,
+    49727.005959083741,
+    49746.917668646165,
+    49766.831370874068,
+    49786.747065368734,
+    49806.66475173166,
+    49826.584429564515,
+    49846.506098469203,
+    49866.429758047794,
+    49886.355407902578,
+    49906.283047636032,
+    49926.212676850846,
+    49946.144295149883,
+    49966.077902136225,
+    49986.013497413151,
+    50005.951080584135,
+    50025.890651252834,
+    50045.832209023123,
+    50065.775753499074,
+    50085.721284284933,
+    50105.668800985164,
+    50125.618303204428,
+    50145.569790547575,
+    50165.523262619652,
+    50185.478719025901,
+    50205.436159371769,
+    50225.395583262893,
+    50245.356990305103,
+    50265.320380104429,
+    50285.285752267104,
+    50305.253106399534,
+    50325.222442108337,
+    50345.193759000336,
+    50365.16705668252,
+    50385.142334762102,
+    50405.119592846473,
+    50425.098830543218,
+    50445.080047460127,
+    50465.063243205179,
+    50485.048417386541,
+    50505.035569612577,
+    50525.024699491856,
+    50545.015806633128,
+    50565.008890645338,
+    50585.003951137631,
+    50605.00098771933,
+    50624.999999999971,
+    50645.000987589265,
+    50665.003950097132,
+    50685.008887133677,
+    50705.015798309192,
+    50725.024683234165,
+    50745.035541519283,
+    50765.048372775411,
+    50785.063176613621,
+    50805.079952645159,
+    50825.098700481489,
+    50845.119419734241,
+    50865.142110015244,
+    50885.166770936521,
+    50905.193402110279,
+    50925.222003148934,
+    50945.252573665071,
+    50965.285113271471,
+    50985.319621581119,
+    51005.356098207172,
+    51025.394542762981,
+    51045.434954862096,
+    51065.477334118244,
+    51085.521680145357,
+    51105.567992557546,
+    51125.616270969113,
+    51145.66651499454,
+    51165.718724248516,
+    51185.772898345916,
+    51205.829036901778,
+    51225.887139531362,
+    51245.947205850105,
+    51266.009235473619,
+    51286.073228017718,
+    51306.139183098399,
+    51326.207100331856,
+    51346.276979334456,
+    51366.348819722756,
+    51386.42262111351,
+    51406.498383123653,
+    51426.57610537031,
+    51446.655787470787,
+    51466.737429042587,
+    51486.82102970338,
+    51506.906589071048,
+    51526.994106763632,
+    51547.083582399391,
+    51567.175015596738,
+    51587.268405974297,
+    51607.363753150858,
+    51627.461056745415,
+    51647.56031637713,
+    51667.661531665362,
+    51687.764702229651,
+    51707.869827689727,
+    51727.976907665499,
+    51748.085941777055,
+    51768.196929644677,
+    51788.309870888836,
+    51808.42476513017,
+    51828.541611989524,
+    51848.660411087905,
+    51868.781162046515,
+    51888.90386448674,
+    51909.028518030143,
+    51929.155122298485,
+    51949.283676913685,
+    51969.414181497872,
+    51989.546635673345,
+    52009.681039062583,
+    52029.817391288263,
+    52049.955691973213,
+    52070.095940740481,
+    52090.238137213273,
+    52110.382281014987,
+    52130.5283717692,
+    52150.676409099666,
+    52170.826392630333,
+    52190.97832198532,
+    52211.132196788931,
+    52231.288016665654,
+    52251.445781240145,
+    52271.60549013727,
+    52291.76714298204,
+    52311.930739399664,
+    52332.096279015546,
+    52352.263761455244,
+    52372.433186344519,
+    52392.604553309284,
+    52412.777861975665,
+    52432.953111969946,
+    52453.130302918595,
+    52473.309434448267,
+    52493.490506185793,
+    52513.67351775818,
+    52533.858468792605,
+    52554.045358916446,
+    52574.234187757254,
+    52594.42495494274,
+    52614.617660100812,
+    52634.812302859558,
+    52655.008882847229,
+    52675.20739969227,
+    52695.407853023295,
+    52715.610242469098,
+    52735.814567658657,
+    52756.02082822111,
+    52776.229023785803,
+    52796.439153982225,
+    52816.651218440056,
+    52836.865216789171,
+    52857.081148659599,
+    52877.29901368155,
+    52897.518811485425,
+    52917.740541701773,
+    52937.964203961354,
+    52958.18979789508,
+    52978.417323134046,
+    52998.646779309529,
+    53018.878166052978,
+    53039.111482996006,
+    53059.346729770419,
+    53079.583906008193,
+    53099.823011341483,
+    53120.0640454026,
+    53140.307007824063,
+    53160.551898238533,
+    53180.79871627887,
+    53201.047461578091,
+    53221.2981337694,
+    53241.550732486176,
+    53261.805257361964,
+    53282.061708030487,
+    53302.32008412564,
+    53322.580385281493,
+    53342.842611132299,
+    53363.106761312469,
+    53383.372835456597,
+    53403.640833199453,
+    53423.910754175973,
+    53444.18259802126,
+    53464.456364370613,
+    53484.732052859479,
+    53505.009663123499,
+    53525.289194798468,
+    53545.570647520362,
+    53565.854020925333,
+    53586.139314649699,
+    53606.426528329954,
+    53626.715661602764,
+    53647.006714104959,
+    53667.299685473547,
+    53687.59457534572,
+    53707.891383358816,
+    53728.190109150361,
+    53748.490752358055,
+    53768.793312619753,
+    53789.09778957349,
+    53809.404182857485,
+    53829.712492110106,
+    53850.022716969899,
+    53870.334857075584,
+    53890.648912066055,
+    53910.964881580367,
+    53931.28276525774,
+    53951.602562737586,
+    53971.924273659461,
+    53992.24789766311,
+    54012.57343438844,
+    54032.90088347553,
+    54053.23024456462,
+    54073.561517296133,
+    54093.894701310644,
+    54114.22979624891,
+    54134.566801751855,
+    54154.90571746057,
+    54175.246543016314,
+    54195.589278060506,
+    54215.933922234755,
+    54236.280475180814,
+    54256.628936540626,
+    54276.97930595628,
+    54297.331583070045,
+    54317.685767524359,
+    54338.041858961828,
+    54358.399857025215,
+    54378.759761357462,
+    54399.121571601667,
+    54419.485287401105,
+    54439.850908399218,
+    54460.218434239614,
+    54480.587864566056,
+    54500.95919902248,
+    54521.332437252997,
+    54541.707578901878,
+    54562.084623613555,
+    54582.46357103264,
+    54602.844420803893,
+    54623.227172572246,
+    54643.611825982807,
+    54663.998380680838,
+    54684.386836311773,
+    54704.777192521207,
+    54725.169448954897,
+    54745.563605258772,
+    54765.959661078923,
+    54786.357616061614,
+    54806.757469853255,
+    54827.159222100439,
+    54847.562872449904,
+    54867.968420548583,
+    54888.375866043534,
+    54908.785208582012,
+    54929.196447811417,
+    54949.609583379322,
+    54970.024614933463,
+    54990.441542121727,
+    55010.86036459219,
+    55031.28108199306,
+    55051.703693972733,
+    55072.128200179759,
+    55092.554600262847,
+    55112.982893870874,
+    55133.413080652877,
+    55153.845160258061,
+    55174.279132335789,
+    55194.714996535586,
+    55215.152752507143,
+    55235.592399900306,
+    55256.033938365079,
+    55276.477367551655,
+    55296.92268711036,
+    55317.369896691685,
+    55337.818995946305,
+    55358.269984525024,
+    55378.72286207883,
+    55399.177628258869,
+    55419.634282716441,
+    55440.092825103013,
+    55460.553255070205,
+    55481.015572269804,
+    55501.479776353764,
+    55521.945866974187,
+    55542.413843783339,
+    55562.883706433655,
+    55583.355454577715,
+    55603.82908786826,
+    55624.304605958219,
+    55644.782008500639,
+    55665.261295148754,
+    55685.742465555952,
+    55706.225519375774,
+    55726.710456261928,
+    55747.197275868275,
+    55767.685977848843,
+    55788.176561857814,
+    55808.669027549528,
+    55829.163374578478,
+    55849.659602599328,
+    55870.157711266889,
+    55890.657700236145,
+    55911.159569162221,
+    55931.663317700411,
+    55952.168945506164,
+    55972.676452235086,
+    55993.185837542944,
+    56013.697101085651,
+    56034.210242519301,
+    56054.72526150012,
+    56075.242157684508,
+    56095.760930729011,
+    56116.281580290342,
+    56136.804106025367,
+    56157.328507591104,
+    56177.85478464474,
+    56198.382936843598,
+    56218.912963845185,
+    56239.444865307138,
+    56259.978640887268,
+    56280.514290243525,
+    56301.051813034042,
+    56321.591208917082,
+    56342.13247755108,
+    56362.675618594607,
+    56383.220631706419,
+    56403.767516545398,
+    56424.316272770608,
+    56444.866900041241,
+    56465.419398016667,
+    56485.973766356394,
+    56506.530004720102,
+    56527.088112767611,
+    56547.648090158902,
+    56568.209936554107,
+    56588.773651613519,
+    56609.339234997584,
+    56629.9066863669,
+    56650.47600538221,
+    56671.04719170442,
+    56691.620244994599,
+    56712.195164913959,
+    56732.771951123868,
+    56753.350603285835,
+    56773.931121061541,
+    56794.513504112823,
+    56815.097752101647,
+    56835.683864690152,
+    56856.271841540627,
+    56876.86168231551,
+    56897.453386677393,
+    56918.046954289028,
+    56938.642384813298,
+    56959.239677913261,
+    56979.838833252121,
+    57000.439850493225,
+    57021.04272930009,
+    57041.647469336371,
+    57062.254070265873,
+    57082.862531752558,
+    57103.472853460553,
+    57124.085035054108,
+    57144.699076197649,
+    57165.314976555739,
+    57185.932735793103,
+    57206.552353574611,
+    57227.173829565276,
+    57247.797163430281,
+    57268.42235483494,
+    57289.049403444733,
+    57309.678308925286,
+    57330.30907094237,
+    57350.941689161911,
+    57371.576163249985,
+    57392.212492872815,
+    57412.850677696784,
+    57433.490717388406,
+    57454.132611614368,
+    57474.776360041491,
+    57495.421962336746,
+    57516.069418167266,
+    57536.718727200314,
+    57557.36988910332,
+    57578.022903543861,
+    57598.677770189643,
+    57619.334488708548,
+    57639.993058768589,
+    57660.653480037938,
+    57681.315752184906,
+    57701.979874877965,
+    57722.64584778573,
+    57743.31367057695,
+    57763.983342920546,
+    57784.654864485572,
+    57805.328234941233,
+    57826.003453956881,
+    57846.680521202026,
+    57867.359436346305,
+    57888.040199059527,
+    57908.722809011633,
+    57929.407265872709,
+    57950.093569313001,
+    57970.781719002895,
+    57991.471714612911,
+    58012.16355581375,
+    58032.857242276223,
+    58053.552773671312,
+    58074.25014967013,
+    58094.949369943948,
+    58115.650434164185,
+    58136.353342002389,
+    58157.058093130276,
+    58177.764687219693,
+    58198.47312394264,
+    58219.183402971255,
+    58239.895523977837,
+    58260.609486634821,
+    58281.325290614775,
+    58302.042935590434,
+    58322.762421234678,
+    58343.483747220511,
+    58364.206913221096,
+    58384.931918909751,
+    58405.658763959924,
+    58426.3874480452,
+    58447.117970839339,
+    58467.85033201622,
+    58488.584531249864,
+    58509.320568214462,
+    58530.058442584334,
+    58550.798154033931,
+    58571.539702237875,
+    58592.283086870906,
+    58613.028307607929,
+    58633.775364123983,
+    58654.52425609425,
+    58675.274983194053,
+    58696.027545098877,
+    58716.781941484325,
+    58737.538172026158,
+    58758.296236400274,
+    58779.056134282728,
+    58799.817865349694,
+    58820.581429277503,
+    58841.346825742643,
+    58862.114054421712,
+    58882.883114991484,
+    58903.654007128847,
+    58924.426730510851,
+    58945.201284814684,
+    58965.977669717664,
+    58986.755884897269,
+    59007.535930031117,
+    59028.317804796949,
+    59049.101508872664,
+    59069.887041936301,
+    59090.674403666046,
+    59111.463593740213,
+    59132.254611837263,
+    59153.047457635803,
+    59173.84213081457,
+    59194.638631052461,
+    59215.436958028506,
+    59236.237111421855,
+    59257.039090911829,
+    59277.842896177877,
+    59298.648526899589,
+    59319.455982756685,
+    59340.26526342905,
+    59361.076368596696,
+    59381.889297939757,
+    59402.704051138542,
+    59423.520627873484,
+    59444.339027825139,
+    59465.159250674224,
+    59485.9812961016,
+    59506.805163788253,
+    59527.630853415307,
+    59548.458364664046,
+    59569.287697215863,
+    59590.118850752311,
+    59610.951824955089,
+    59631.786619506012,
+    59652.623234087048,
+    59673.461668380311,
+    59694.301922068029,
+    59715.143994832593,
+    59735.987886356525,
+    59756.833596322482,
+    59777.681124413255,
+    59798.530470311794,
+    59819.381633701159,
+    59840.234614264569,
+    59861.089411685381,
+    59881.94602564707,
+    59902.804455833269,
+    59923.664701927737,
+    59944.526763614384,
+    59965.390640577243,
+    59986.256332500488,
+    60007.123839068438,
+    60027.993159965539,
+    60048.864294876381,
+    60069.737243485688,
+    60090.612005478324,
+    60111.488580539284,
+    60132.366968353708,
+    60153.247168606867,
+    60174.129180984164,
+    60195.013005171153,
+    60215.898640853513,
+    60236.786087717061,
+    60257.675345447751,
+    60278.566413731671,
+    60299.459292255044,
+    60320.353980704247,
+    60341.25047876576,
+    60362.148786126229,
+    60383.048902472423,
+    60403.950827491237,
+    60424.854560869717,
+    60445.76010229504,
+    60466.667451454516,
+    60487.57660803559,
+    60508.487571725847,
+    60529.400342212997,
+    60550.314919184893,
+    60571.231302329521,
+    60592.149491335003,
+    60613.069485889588,
+    60633.991285681674,
+    60654.914890399785,
+    60675.840299732568,
+    60696.767513368832,
+    60717.696530997484,
+    60738.627352307602,
+    60759.55997698837,
+    60780.494404729128,
+    60801.430635219323,
+    60822.368668148556,
+    60843.308503206565,
+    60864.250140083204,
+    60885.193578468468,
+    60906.138818052495,
+    60927.085858525541,
+    60948.034699578006,
+    60968.985340900421,
+    60989.937782183442,
+    61010.892023117864,
+    61031.848063394616,
+    61052.805902704764,
+    61073.765540739492,
+    61094.726977190134,
+    61115.690211748137,
+    61136.655244105103,
+    61157.622073952742,
+    61178.590700982917,
+    61199.561124887616,
+    61220.533345358948,
+    61241.507362089171,
+    61262.483174770663,
+    61283.460783095943,
+    61304.440186757645,
+    61325.421385448557,
+    61346.404378861582,
+    61367.389166689762,
+    61388.375748626262,
+    61409.364124364387,
+    61430.354293597571,
+    61451.346256019373,
+    61472.340011323497,
+    61493.335559203762,
+    61514.332899354122,
+    61535.332031468672,
+    61556.332955241618,
+    61577.335670367313,
+    61598.340176540238,
+    61619.346473454993,
+    61640.354560806329,
+    61661.3644382891,
+    61682.376105598312,
+    61703.389562429089,
+    61724.404808476691,
+    61745.42184343651,
+    61766.440667004063,
+    61787.461278874987,
+    61808.483678745069,
+    61829.507866310203,
+    61850.533841266435,
+    61871.561603309929,
+    61892.591152136971,
+    61913.622487443987,
+    61934.655608927525,
+    61955.690516284267,
+    61976.727209211022,
+    61997.765687404724,
+    62018.805950562448,
+    62039.847998381381,
+    62060.891830558845,
+    62081.93744679229,
+    62102.984846779298,
+    62124.034030217575,
+    62145.084996804966,
+    62166.137746239416,
+    62187.19227821903,
+    62208.248592442025,
+    62229.306688606739,
+    62250.366566411656,
+    62271.428225555377,
+    62292.491665736627,
+    62313.556886654267,
+    62334.623888007271,
+    62355.692669494762,
+    62376.763230815974,
+    62397.835571670272,
+    62418.909691757144,
+    62439.98559077621,
+    62461.063268427228,
+    62482.142724410049,
+    62503.223958424685,
+    62524.306970171267,
+    62545.39175935003,
+    62566.478325661366,
+    62587.566668805768,
+    62608.656788483881,
+    62629.748684396451,
+    62650.842356244357,
+    62671.937803728622,
+    62693.035026550366,
+    62714.134024410858,
+    62735.234797011479,
+    62756.337344053733,
+    62777.441665239276,
+    62798.547760269852,
+    62819.655628847358,
+    62840.765270673801,
+    62861.876685451323,
+    62882.989872882186,
+    62904.104832668774,
+    62925.221564513602,
+    62946.340068119309,
+    62967.460343188657,
+    62988.582389424526,
+    63009.70620652994,
+    63030.831794208025,
+    63051.959152162039,
+    63073.08828009537,
+    63094.219177711529,
+    63115.351844714154,
+    63136.486280806988,
+    63157.622485693922,
+    63178.760459078956,
+    63199.900200666219,
+    63221.041710159967,
+    63242.184987264569,
+    63263.330031684534,
+    63284.476843124474,
+    63305.625421289144,
+    63326.775765883409,
+    63347.927876612259,
+    63369.081753180813,
+    63390.237395294316,
+    63411.39480265812,
+    63432.553974977716,
+    63453.714911958712,
+    63474.877613306839,
+    63496.042078727944,
+    63517.208307927998,
+    63538.376300613119,
+    63559.546056489504,
+    63580.717575263516,
+    63601.890856641607,
+    63623.065900330374,
+    63644.242706036515,
+    63665.421273466869,
+    63686.601602328381,
+    63707.783692328136,
+    63728.967543173334,
+    63750.153154571279,
+    63771.340526229418,
+    63792.529657855317,
+    63813.720549156649,
+    63834.913199841227,
+    63856.107609616978,
+    63877.303778191941,
+    63898.501705274284,
+    63919.7013905723,
+    63940.902833794404,
+    63962.106034649114,
+    63983.310992845094,
+    64004.517708091109,
+    64025.726180096048,
+    64046.936408568938,
+    64068.1483932189,
+    64089.362133755196,
+    64110.577629887193,
+    64131.794881324393,
+    64153.013887776404,
+    64174.234648952966,
+    64195.457164563937,
+    64216.681434319289,
+    64237.907457929112,
+    64259.135235103626,
+    64280.36476555316,
+    64301.596048988169,
+    64322.829085119236,
+    64344.06387365704,
+    64365.300414312398,
+    64386.538706796251,
+    64407.778750819634,
+    64429.020546093721,
+    64450.26409232981,
+    64471.509389239291,
+    64492.756436533709,
+    64514.005233924705,
+    64535.255781124033,
+    64556.50807784358,
+    64577.762123795357,
+    64599.017918691468,
+    64620.275462244172,
+    64641.534754165805,
+    64662.795794168844,
+    64684.058581965895,
+    64705.323117269661,
+    64726.589399792974,
+    64747.857429248776,
+    64769.127205350138,
+    64790.398727810236,
+    64811.671996342375,
+    64832.947010659969,
+    64854.223770476558,
+    64875.502275505794,
+    64896.782525461451,
+    64918.064520057414,
+    64939.348259007682,
+    64960.633742026388,
+    64981.920968827762,
+    65003.209939126165,
+    65024.500652636067,
+    65045.793109072067,
+    65067.087308148861,
+    65088.383249581282,
+    65109.680933084259,
+    65130.980358372864,
+    65152.28152516226,
+    65173.584433167736,
+    65194.889082104703,
+    65216.195471688683,
+    65237.503601635319,
+    65258.813471660353,
+    65280.125081479666,
+    65301.438430809241,
+    65322.753519365178,
+    65344.070346863708,
+    65365.388913021146,
+    65386.709217553958,
+    65408.031260178701,
+    65429.355040612056,
+    65450.680558570821,
+    65472.00781377191,
+    65493.336805932355,
+    65514.66753476928,
+    65535.999999999956,
+    65557.334201341757,
+    65578.670138512171,
+    65600.007811228788,
+    65621.347219209332,
+    65642.688362171626,
+    65664.031239833639,
+    65685.375851913413,
+    65706.722198129137,
+    65728.070278199084,
+    65749.420091841661,
+    65770.771638775404,
+    65792.124918718939,
+    65813.479931391004,
+    65834.836676510458,
+    65856.195153796303,
+    65877.5553629676,
+    65898.917303743554,
+    65920.280975843489,
+    65941.646378986843,
+    65963.013512893158,
+    65984.382377282076,
+    66005.752971873386,
+    66027.125296386963,
+    66048.499350542799,
+    66069.875134061018,
+    66091.252646661844,
+    66112.631888065618,
+    66134.01285799277,
+    66155.395556163887,
+    66176.779982299631,
+    66198.166136120795,
+    66219.554017348273,
+    66240.943625703105,
+    66262.334960906388,
+    66283.728022679396,
+    66305.122810743444,
+    66326.519324820023,
+    66347.917564630698,
+    66369.317529897162,
+    66390.719220341227,
+    66412.122635684791,
+    66433.527775649884,
+    66454.934639958636,
+    66476.343228333324,
+    66497.753540496284,
+    66519.165576169995,
+    66540.57933507704,
+    66561.994816940118,
+    66583.412021482043,
+    66604.830948425733,
+    66626.251597494222,
+    66647.673968410629,
+    66669.098060898235,
+    66690.523874680381,
+    66711.951409480564,
+    66733.380665022371,
+    66754.811641029475,
+    66776.244337225711,
+    66797.678753334985,
+    66819.11488908132,
+    66840.552744188884,
+    66861.992318381905,
+    66883.433611384738,
+    66904.876622921889,
+    66926.321352717903,
+    66947.767800497502,
+    66969.215965985466,
+    66990.665848906734,
+    67012.117448986304,
+    67033.570765949335,
+    67055.025799521056,
+    67076.482549426815,
+    67097.941015392076,
+    67119.401197142433,
+    67140.863094403554,
+    67162.326706901222,
+    67183.792034361351,
+    67205.259076509959,
+    67226.72783307315,
+    67248.198303777172,
+    67269.670488348347,
+    67291.144386513144,
+    67312.619997998088,
+    67334.09732252988,
+    67355.576359835293,
+    67377.057109641188,
+    67398.53957167457,
+    67420.023745662547,
+    67441.50963133233,
+    67462.99722841123,
+    67484.486536626689,
+    67505.977555706224,
+    67527.470285377494,
+    67548.964725368263,
+    67570.460875406367,
+    67591.9587352198,
+    67613.458304536631,
+    67634.95958308503,
+    67656.462570593329,
+    67677.967266789899,
+    67699.473671403248,
+    67720.981784162024,
+    67742.491604794923,
+    67764.003133030797,
+    67785.516368598575,
+    67807.031311227314,
+    67828.547960646174,
+    67850.066316584402,
+    67871.58637877139,
+    67893.108146936589,
+    67914.63162080961,
+    67936.156800120138,
+    67957.683684597971,
+    67979.212273973011,
+    68000.742567975263,
+    68022.274566334876,
+    68043.808268782057,
+    68065.343675047145,
+    68086.880784860579,
+    68108.419597952918,
+    68129.960114054789,
+    68151.502332896969,
+    68173.04625421032,
+    68194.591877725834,
+    68216.139203174564,
+    68237.688230287706,
+    68259.238958796544,
+    68280.791388432481,
+    68302.345518927032,
+    68323.901350011787,
+    68345.458881418483,
+    68367.018112878912,
+    68388.579044125028,
+    68410.141674888844,
+    68431.706004902502,
+    68453.272033898262,
+    68474.839761608455,
+    68496.409187765545,
+    68517.980312102081,
+    68539.553134350732,
+    68561.127654244279,
+    68582.70387151558,
+    68604.281785897634,
+    68625.861397123503,
+    68647.44270492639,
+    68669.025709039604,
+    68690.610409196524,
+    68712.196805130661,
+    68733.784896575627,
+    68755.374683265123,
+    68776.966164932994,
+    68798.559341313128,
+    68820.154212139591,
+    68841.750777146473,
+    68863.349036068044,
+    68884.948988638629,
+    68906.550634592684,
+    68928.153973664739,
+    68949.75900558944,
+    68971.365730101577,
+    68992.974146935987,
+    69014.584255827634,
+    69036.196056511588,
+    69057.809548723017,
+    69079.424732197207,
+    69101.041606669532,
+    69122.660171875468,
+    69144.280427550606,
+    69165.902373430625,
+    69187.526009251334,
+    69209.151334748618,
+    69230.778349658474,
+    69252.40705371699,
+    69274.037446660412,
+    69295.669528225,
+    69317.303298147192,
+    69338.938756163494,
+    69360.575902010532,
+    69382.214735425005,
+    69403.855256143754,
+    69425.497463903681,
+    69447.141358441833,
+    69468.78693949533,
+    69490.434206801394,
+    69512.083160097391,
+    69533.733799120717,
+    69555.386123608929,
+    69577.04013329967,
+    69598.695827930685,
+    69620.353207239794,
+    69642.012270964973,
+    69663.67301884426,
+    69685.335450615792,
+    69706.999566017839,
+    69728.665364788743,
+    69750.332846666963,
+    69772.002011391058,
+    69793.672858699691,
+    69815.345388331611,
+    69837.019600025669,
+    69858.695493520849,
+    69880.373068556204,
+    69902.052324870907,
+    69923.733262204216,
+    69945.415880295492,
+    69967.100178884211,
+    69988.786157709939,
+    70010.473816512356,
+    70032.163155031216,
+    70053.854173006403,
+    70075.546870177874,
+    70097.241246285717,
+    70118.937301070109,
+    70140.635034271298,
+    70162.334445629691,
+    70184.035534885741,
+    70205.738301780017,
+    70227.442746053217,
+    70249.1488674461,
+    70270.856665699539,
+    70292.566140554511,
+    70314.277291752107,
+    70335.990119033493,
+    70357.704622139936,
+    70379.420800812819,
+    70401.138654793613,
+    70422.85818382389,
+    70444.579387645339,
+    70466.302265999722,
+    70488.026818628918,
+    70509.753045274876,
+    70531.480945679708,
+    70553.210519585555,
+    70574.941766734701,
+    70596.674686869505,
+    70618.409279732456,
+    70640.145545066101,
+    70661.883482613106,
+    70683.623092116264,
+    70705.364373318414,
+    70727.107325962526,
+    70748.851949791671,
+    70770.598244549008,
+    70792.346209977783,
+    70814.095845821372,
+    70835.847151823225,
+    70857.600127726895,
+    70879.354773276034,
+    70901.111088214413,
+    70922.869072285859,
+    70944.628725234332,
+    70966.390046803877,
+    70988.153036738629,
+    71009.917694782853,
+    71031.684020680885,
+    71053.45201417715,
+    71075.221675016204,
+    71096.993002942661,
+    71118.765997701266,
+    71140.540659036851,
+    71162.316986694335,
+    71184.09498041874,
+    71205.874639955218,
+    71227.655965048951,
+    71249.438955445294,
+    71271.223610889632,
+    71293.009931127483,
+    71314.797915904477,
+    71336.587564966307,
+    71358.378878058764,
+    71380.171854927772,
+    71401.966495319313,
+    71423.762798979486,
+    71445.560765654489,
+    71467.360395090596,
+    71489.161687034211,
+    71510.964641231811,
+    71532.769257429973,
+    71554.575535375348,
+    71576.383474814749,
+    71598.19307549503,
+    71620.004337163133,
+    71641.817259566145,
+    71663.631842451214,
+    71685.4480855656,
+    71707.26598865664,
+    71729.085551471784,
+    71750.906773758586,
+    71772.729655264673,
+    71794.554195737772,
+    71816.380394925713,
+    71838.208252576442,
+    71860.037768437964,
+    71881.868942258385,
+    71903.701773785942,
+    71925.536262768932,
+    71947.372408955751,
+    71969.210212094898,
+    71991.049671934976,
+    72012.890788224686,
+    72034.73356071279,
+    72056.577989148165,
+    72078.424073279821,
+    72100.271812856794,
+    72122.121207628254,
+    72143.97225734347,
+    72165.824961751801,
+    72187.679320602692,
+    72209.53533364569,
+    72231.393000630429,
+    72253.252321306645,
+    72275.113295424177,
+    72296.975922732949,
+    72318.840202982959,
+    72340.706135924338,
+    72362.573721307272,
+    72384.442958882093,
+    72406.313848399179,
+    72428.186389609036,
+    72450.060582262216,
+    72471.936426109431,
+    72493.813920901433,
+    72515.693066389096,
+    72537.573862323392,
+    72559.456308455352,
+    72581.340404536139,
+    72603.226150316987,
+    72625.113545549248,
+    72647.002589984331,
+    72668.893283373764,
+    72690.785625469172,
+    72712.679616022273,
+    72734.575254784853,
+    72756.472541508803,
+    72778.371475946144,
+    72800.272057848939,
+    72822.174286969355,
+    72844.07816305969,
+    72865.983685872285,
+    72887.890855159596,
+    72909.799670674183,
+    72931.710132168693,
+    72953.622239395845,
+    72975.535992108475,
+    72997.451390059519,
+    73019.368433001961,
+    73041.287120688925,
+    73063.207452873612,
+    73085.129429309294,
+    73107.053049749389,
+    73128.978313947344,
+    73150.905221656736,
+    73172.833772631217,
+    73194.763966624567,
+    73216.695803390612,
+    73238.62928268328,
+    73260.564404256627,
+    73282.501167864757,
+    73304.439573261901,
+    73326.379620202337,
+    73348.321308440485,
+    73370.264637730841,
+    73392.209607827957,
+    73414.156218486532,
+    73436.104469461323,
+    73458.054360507173,
+    73480.005891379056,
+    73501.959061831993,
+    73523.913871621116,
+    73545.870320501665,
+    73567.828408228932,
+    73589.78813455833,
+    73611.749499245358,
+    73633.712502045615,
+    73655.677142714747,
+    73677.643421008557,
+    73699.611336682879,
+    73721.580889493693,
+    73743.552079197019,
+    73765.524905548999,
+    73787.499368305856,
+    73809.475467223907,
+    73831.453202059551,
+    73853.432572569291,
+    73875.413578509717,
+    73897.396219637507,
+    73919.380495709411,
+    73941.36640648231,
+    73963.353951713143,
+    73985.343131158952,
+    74007.333944576865,
+    74029.326391724098,
+    74051.320472357969,
+    74073.316186235883,
+    74095.313533115303,
+    74117.312512753837,
+    74139.313124909138,
+    74161.315369338976,
+    74183.319245801191,
+    74205.324754053727,
+    74227.331893854629,
+    74249.340664961986,
+    74271.351067134034,
+    74293.363100129049,
+    74315.376763705441,
+    74337.392057621662,
+    74359.408981636298,
+    74381.427535508003,
+    74403.447718995507,
+    74425.469531857671,
+    74447.492973853383,
+    74469.518044741693,
+    74491.54474428168,
+    74513.573072232539,
+    74535.603028353551,
+    74557.634612404087,
+    74579.667824143602,
+    74601.702663331642,
+    74623.739129727837,
+    74645.777223091936,
+    74667.816943183716,
+    74689.858289763113,
+    74711.901262590094,
+    74733.945861424741,
+    74755.992086027225,
+    74778.039936157802,
+    74800.089411576817,
+    74822.140512044702,
+    74844.193237321961,
+    74866.24758716923,
+    74888.303561347187,
+    74910.36115961663,
+    74932.420381738411,
+    74954.481227473516,
+    74976.543696582972,
+    74998.607788827925,
+    75020.673503969607,
+    75042.740841769322,
+    75064.809801988464,
+    75086.88038438854,
+    75108.952588731103,
+    75131.026414777836,
+    75153.101862290467,
+    75175.178931030852,
+    75197.257620760924,
+    75219.33793124267,
+    75241.419862238225,
+    75263.503413509738,
+    75285.588584819503,
+    75307.675375929874,
+    75329.763786603318,
+    75351.853816602365,
+    75373.945465689612,
+    75396.038733627807,
+    75418.133620179724,
+    75440.230125108254,
+    75462.32824817636,
+    75484.427989147109,
+    75506.529347783653,
+    75528.63232384919,
+    75550.736917107075,
+    75572.843127320695,
+    75594.950954253538,
+    75617.060397669193,
+    75639.171457331307,
+    75661.284133003646,
+    75683.398424450032,
+    75705.514331434402,
+    75727.631853720741,
+    75749.750991073175,
+    75771.871743255862,
+    75793.994110033076,
+    75816.118091169177,
+    75838.243686428585,
+    75860.370895575848,
+    75882.499718375562,
+    75904.630154592422,
+    75926.762203991224,
+    75948.895866336825,
+    75971.031141394182,
+    75993.168028928325,
+    76015.306528704401,
+    76037.4466404876,
+    76059.588364043215,
+    76081.731699136653,
+    76103.876645533353,
+    76126.023202998884,
+    76148.171371298871,
+    76170.321150199044,
+    76192.472539465205,
+    76214.625538863256,
+    76236.780148159174,
+    76258.936367119008,
+    76281.094195508922,
+    76303.253633095141,
+    76325.414679643975,
+    76347.577334921851,
+    76369.741598695226,
+    76391.907470730686,
+    76414.074950794879,
+    76436.244038654564,
+    76458.414734076548,
+    76480.587036827754,
+    76502.760946675175,
+    76524.936463385893,
+    76547.11358672705,
+    76569.292316465915,
+    76591.472652369819,
+    76613.654594206164,
+    76635.838141742468,
+    76658.023294746308,
+    76680.210052985349,
+    76702.398416227341,
+    76724.588384240138,
+    76746.779956791637,
+    76768.973133649866,
+    76791.167914582897,
+    76813.364299358902,
+    76835.562287746157,
+    76857.761879512967,
+    76879.963074427797,
+    76902.165872259109,
+    76924.37027277553,
+    76946.576275745727,
+    76968.783880938441,
+    76990.993088122515,
+    77013.203897066895,
+    77035.416307540567,
+    77057.630319312622,
+    77079.845932152239,
+    77102.063145828695,
+    77124.281960111301,
+    77146.50237476948,
+    77168.724389572759,
+    77190.948004290723,
+    77213.173218693031,
+    77235.400032549442,
+    77257.628445629802,
+    77279.858457704031,
+    77302.090068542122,
+    77324.323277914169,
+    77346.558085590339,
+    77368.794491340886,
+    77391.032494936138,
+    77413.272096146524,
+    77435.51329474253,
+    77457.756090494731,
+    77480.000483173804,
+    77502.246472550498,
+    77524.494058395634,
+    77546.743240480107,
+    77568.994018574944,
+    77591.246392451198,
+    77613.500361880026,
+    77635.755926632657,
+    77658.013086480438,
+    77680.271841194757,
+    77702.532190547092,
+    77724.794134309021,
+    77747.057672252195,
+    77769.322804148323,
+    77791.589529769248,
+    77813.857848886837,
+    77836.127761273063,
+    77858.399266699998,
+    77880.67236493979,
+    77902.947055764627,
+    77925.223338946831,
+    77947.50121425878,
+    77969.780681472927,
+    77992.061740361838,
+    78014.344390698127,
+    78036.628632254491,
+    78058.914464803747,
+    78081.201888118725,
+    78103.490901972415,
+    78125.781506137821,
+    78148.073700388064,
+    78170.367484496339,
+    78192.662858235926,
+    78214.959821380166,
+    78237.258373702498,
+    78259.558514976452,
+    78281.860244975614,
+    78304.163563473659,
+    78326.468470244363,
+    78348.77496506153,
+    78371.083047699125,
+    78393.392717931114,
+    78415.703975531578,
+    78438.016820274701,
+    78460.331251934695,
+    78482.647270285903,
+    78504.964875102727,
+    78527.284066159627,
+    78549.604843231195,
+    78571.927206092048,
+    78594.251154516911,
+    78616.576688280606,
+    78638.903807157985,
+    78661.232510924034,
+    78683.562799353778,
+    78705.894672222363,
+    78728.228129304945,
+    78750.563170376859,
+    78772.899795213423,
+    78795.238003590101,
+    78817.577795282399,
+    78839.919170065928,
+    78862.262127716356,
+    78884.606668009452,
+    78906.952790721043,
+    78929.300495627045,
+    78951.64978250346,
+    78974.000651126378,
+    78996.353101271932,
+    79018.707132716358,
+    79041.062745235977,
+    79063.41993860717,
+    79085.778712606436,
+    79108.139067010285,
+    79130.501001595389,
+    79152.864516138419,
+    79175.22961041618,
+    79197.596284205531,
+    79219.96453728342,
+    79242.33436942687,
+    79264.705780412987,
+    79287.078770018954,
+    79309.453338022009,
+    79331.829484199508,
+    79354.207208328866,
+    79376.586510187582,
+    79398.967389553218,
+    79421.349846203433,
+    79443.733879915948,
+    79466.119490468584,
+    79488.50667763922,
+    79510.895441205823,
+    79533.285780946433,
+    79555.677696639163,
+    79578.071188062226,
+    79600.466254993895,
+    79622.862897212515,
+    79645.261114496549,
+    79667.660906624471,
+    79690.062273374875,
+    79712.465214526455,
+    79734.869729857935,
+    79757.275819148126,
+    79779.683482175955,
+    79802.092718720378,
+    79824.503528560454,
+    79846.915911475327,
+    79869.329867244203,
+    79891.745395646343,
+    79914.162496461155,
+    79936.581169468045,
+    79959.001414446553,
+    79981.423231176261,
+    80003.846619436852,
+    80026.271579008084,
+    80048.698109669771,
+    80071.12621120183,
+    80093.555883384237,
+    80115.987125997053,
+    80138.419938820414,
+    80160.854321634528,
+    80183.290274219689,
+    80205.727796356281,
+    80228.166887824715,
+    80250.607548405547,
+    80273.049777879336,
+    80295.493576026798,
+    80317.938942628651,
+    80340.385877465727,
+    80362.834380318949,
+    80385.28445096928,
+    80407.736089197788,
+    80430.189294785596,
+    80452.644067513917,
+    80475.100407164035,
+    80497.558313517322,
+    80520.017786355209,
+    80542.478825459213,
+    80564.941430610925,
+    80587.405601592007,
+    80609.871338184195,
+    80632.338640169342,
+    80654.8075073293,
+    80677.277939446067,
+    80699.749936301683,
+    80722.223497678278,
+    80744.698623358039,
+    80767.17531312324,
+    80789.653566756242,
+    80812.133384039465,
+    80834.614764755403,
+    80857.097708686648,
+    80879.582215615854,
+    80902.068285325731,
+    80924.555917599093,
+    80947.045112218824,
+    80969.535868967869,
+    80992.028187629272,
+    81014.522067986123,
+    81037.017509821613,
+    81059.514512919006,
+    81082.013077061609,
+    81104.513202032831,
+    81127.014887616184,
+    81149.518133595193,
+    81172.022939753486,
+    81194.529305874807,
+    81217.037231742899,
+    81239.546717141639,
+    81262.057761854958,
+    81284.570365666848,
+    81307.084528361403,
+    81329.600249722775,
+    81352.117529535186,
+    81374.636367582949,
+    81397.156763650448,
+    81419.678717522125,
+    81442.202228982511,
+    81464.727297816222,
+    81487.253923807933,
+    81509.782106742379,
+    81532.311846404409,
+    81554.843142578902,
+    81577.375995050839,
+    81599.910403605274,
+    81622.446368027333,
+    81644.983888102215,
+    81667.522963615178,
+    81690.063594351581,
+    81712.605780096841,
+    81735.149520636449,
+    81757.694815755967,
+    81780.241665241047,
+    81802.79006887741,
+    81825.340026450824,
+    81847.891537747171,
+    81870.444602552379,
+    81892.999220652477,
+    81915.555391833506,
+    81938.113115881672,
+    81960.672392583176,
+    81983.233221724338,
+    82005.795603091537,
+    82028.359536471224,
+    82050.925021649906,
+    82073.492058414209,
+    82096.060646550788,
+    82118.630785846399,
+    82141.202476087841,
+    82163.775717062032,
+    82186.35050855593,
+    82208.926850356569,
+    82231.504742251054,
+    82254.084184026578,
+    82276.665175470393,
+    82299.24771636985,
+    82321.831806512317,
+    82344.417445685307,
+    82367.004633676348,
+    82389.593370273054,
+    82412.183655263143,
+    82434.775488434374,
+    82457.368869574595,
+    82479.963798471697,
+    82502.560274913689,
+    82525.158298688606,
+    82547.757869584602,
+    82570.35898738986,
+    82592.961651892678,
+    82615.565862881398,
+    82638.171620144421,
+    82660.778923470265,
+    82683.387772647475,
+    82705.998167464713,
+    82728.610107710658,
+    82751.223593174116,
+    82773.83862364394,
+    82796.45519890904,
+    82819.073318758441,
+    82841.692982981185,
+    82864.314191366429,
+    82886.936943703375,
+    82909.561239781324,
+    82932.187079389638,
+    82954.814462317736,
+    82977.443388355125,
+    83000.073857291369,
+    83022.70586891612,
+    83045.339423019104,
+    83067.974519390089,
+    83090.611157818959,
+    83113.249338095629,
+    83135.8890600101,
+    83158.530323352461,
+    83181.173127912858,
+    83203.817473481497,
+    83226.463359848669,
+    83249.11078680474,
+    83271.759754140134,
+    83294.410261645375,
+    83317.062309111003,
+    83339.715896327703,
+    83362.371023086147,
+    83385.027689177165,
+    83407.685894391587,
+    83430.345638520361,
+    83453.006921354478,
+    83475.669742685001,
+    83498.334102303095,
+    83520.999999999942,
+    83543.667435566866,
+    83566.336408795192,
+    83589.006919476349,
+    83611.678967401851,
+    83634.352552363242,
+    83657.027674152167,
+    83679.704332560359,
+    83702.382527379552,
+    83725.062258401638,
+    83747.743525418511,
+    83770.42632822218,
+    83793.110666604684,
+    83815.796540358162,
+    83838.483949274829,
+    83861.172893146941,
+    83883.863371766842,
+    83906.555384926964,
+    83929.248932419752,
+    83951.944014037799,
+    83974.640629573696,
+    83997.338778820151,
+    84020.038461569929,
+    84042.739677615857,
+    84065.442426750829,
+    84088.146708767847,
+    84110.852523459922,
+    84133.559870620171,
+    84156.268750041796,
+    84178.979161518029,
+    84201.691104842204,
+    84224.404579807713,
+    84247.119586208006,
+    84269.83612383662,
+    84292.55419248715,
+    84315.273791953281,
+    84337.994922028738,
+    84360.717582507335,
+    84383.441773182945,
+    84406.167493849513,
+    84428.894744301069,
+    84451.623524331691,
+    84474.353833735542,
+    84497.085672306828,
+    84519.819039839858,
+    84542.553936128999,
+    84565.290360968676,
+    84588.028314153402,
+    84610.767795477717,
+    84633.508804736295,
+    84656.251341723822,
+    84678.995406235073,
+    84701.740998064924,
+    84724.488117008252,
+    84747.236762860062,
+    84769.986935415407,
+    84792.73863446941,
+    84815.491859817252,
+    84838.246611254188,
+    84861.002888575575,
+    84883.760691576768,
+    84906.520020053256,
+    84929.28087380057,
+    84952.043252614312,
+    84974.807156290146,
+    84997.572584623806,
+    85020.339537411113,
+    85043.108014447949,
+    85065.878015530237,
+    85088.649540453989,
+    85111.422589015303,
+    85134.197161010321,
+    85156.973256235244,
+    85179.750874486374,
+    85202.530015560071,
+    85225.310679252725,
+    85248.092865360857,
+    85270.876573681016,
+    85293.661804009811,
+    85316.448556143951,
+    85339.236829880188,
+    85362.026625015351,
+    85384.817941346351,
+    85407.610778670132,
+    85430.405136783724,
+    85453.201015484257,
+    85475.998414568865,
+    85498.797333834795,
+    85521.597773079353,
+    85544.399732099904,
+    85567.203210693886,
+    85590.008208658808,
+    85612.814725792239,
+    85635.62276189182,
+    85658.432316755265,
+    85681.243390180331,
+    85704.055981964877,
+    85726.870091906807,
+    85749.685719804082,
+    85772.502865454764,
+    85795.321528656961,
+    85818.141709208852,
+    85840.963406908675,
+    85863.78662155474,
+    85886.611352945445,
+    85909.437600879217,
+    85932.26536515457,
+    85955.094645570091,
+    85977.92544192441,
+    86000.757754016275,
+    86023.591581644432,
+    86046.426924607746,
+    86069.263782705122,
+    86092.102155735556,
+    86114.942043498071,
+    86137.783445791807,
+    86160.626362415918,
+    86183.470793169676,
+    86206.316737852379,
+    86229.164196263402,
+    86252.013168202204,
+    86274.863653468303,
+    86297.715651861261,
+    86320.569163180728,
+    86343.424187226425,
+    86366.280723798132,
+    86389.138772695675,
+    86411.998333718977,
+    86434.859406668009,
+    86457.721991342827,
+    86480.586087543532,
+    86503.451695070296,
+    86526.318813723352,
+    86549.187443303032,
+    86572.057583609683,
+    86594.929234443756,
+    86617.802395605773,
+    86640.677066896271,
+    86663.553248115903,
+    86686.43093906538,
+    86709.310139545443,
+    86732.190849356964,
+    86755.073068300815,
+    86777.956796177954,
+    86800.842032789442,
+    86823.728777936354,
+    86846.617031419853,
+    86869.506793041175,
+    86892.398062601613,
+    86915.290839902518,
+    86938.185124745316,
+    86961.080916931489,
+    86983.978216262592,
+    87006.87702254027,
+    87029.777335566177,
+    87052.67915514209,
+    87075.582481069796,
+    87098.487313151185,
+    87121.39365118822,
+    87144.301494982894,
+    87167.210844337285,
+    87190.121699053532,
+    87213.034058933845,
+    87235.947923780506,
+    87258.863293395829,
+    87281.780167582241,
+    87304.698546142172,
+    87327.618428878181,
+    87350.539815592856,
+    87373.462706088845,
+    87396.387100168897,
+    87419.312997635774,
+    87442.240398292357,
+    87465.16930194154,
+    87488.099708386319,
+    87511.031617429733,
+    87533.965028874911,
+    87556.899942525008,
+    87579.836358183282,
+    87602.774275653021,
+    87625.713694737613,
+    87648.654615240492,
+    87671.597036965148,
+    87694.540959715145,
+    87717.486383294105,
+    87740.433307505737,
+    87763.381732153779,
+    87786.331657042057,
+    87809.283081974456,
+    87832.236006754916,
+    87855.190431187453,
+    87878.146355076155,
+    87901.103778225151,
+    87924.062700438633,
+    87947.023121520891,
+    87969.985041276246,
+    87992.948459509105,
+    88015.913376023906,
+    88038.879790625171,
+    88061.847703117513,
+    88084.817113305573,
+    88107.788020994049,
+    88130.760425987726,
+    88153.734328091465,
+    88176.709727110137,
+    88199.686622848749,
+    88222.665015112303,
+    88245.644903705906,
+    88268.626288434709,
+    88291.609169103947,
+    88314.593545518903,
+    88337.579417484914,
+    88360.566784807408,
+    88383.555647291854,
+    88406.546004743795,
+    88429.537856968818,
+    88452.531203772611,
+    88475.52604496089,
+    88498.522380339447,
+    88521.52020971413,
+    88544.519532890874,
+    88567.520349675644,
+    88590.522659874507,
+    88613.526463293543,
+    88636.531759738922,
+    88659.538549016899,
+    88682.546830933745,
+    88705.556605295846,
+    88728.567871909589,
+    88751.580630581491,
+    88774.594881118086,
+    88797.610623325963,
+    88820.62785701183,
+    88843.646581982393,
+    88866.666798044462,
+    88889.688505004888,
+    88912.711702670611,
+    88935.7363908486,
+    88958.762569345898,
+    88981.790237969632,
+    89004.81939652696,
+    89027.850044825114,
+    89050.882182671412,
+    89073.9158098732,
+    89096.950926237885,
+    89119.987531572973,
+    89143.025625686001,
+    89166.065208384563,
+    89189.106279476357,
+    89212.148838769106,
+    89235.192886070581,
+    89258.238421188667,
+    89281.285443931265,
+    89304.333954106376,
+    89327.383951522017,
+    89350.435435986306,
+    89373.488407307406,
+    89396.542865293537,
+    89419.598809753006,
+    89442.656240494165,
+    89465.715157325409,
+    89488.775560055219,
+    89511.837448492137,
+    89534.900822444746,
+    89557.965681721733,
+    89581.032026131812,
+    89604.099855483742,
+    89627.169169586399,
+    89650.239968248672,
+    89673.312251279538,
+    89696.386018488018,
+    89719.461269683205,
+    89742.53800467425,
+    89765.616223270365,
+    89788.69592528083,
+    89811.777110514988,
+    89834.859778782207,
+    89857.943929891975,
+    89881.029563653807,
+    89904.116679877261,
+    89927.205278372014,
+    89950.29535894774,
+    89973.386921414218,
+    89996.479965581268,
+    90019.574491258769,
+    90042.670498256688,
+    90065.767986385021,
+    90088.866955453836,
+    90111.967405273259,
+    90135.069335653476,
+    90158.172746404758,
+    90181.277637337407,
+    90204.384008261797,
+    90227.49185898836,
+    90250.601189327586,
+    90273.711999090039,
+    90296.824288086325,
+    90319.938056127125,
+    90343.053303023189,
+    90366.170028585286,
+    90389.288232624298,
+    90412.407914951138,
+    90435.529075376777,
+    90458.651713712257,
+    90481.775829768681,
+    90504.901423357209,
+    90528.028494289058,
+    90551.157042375504,
+    90574.287067427911,
+    90597.418569257643,
+    90620.551547676194,
+    90643.686002495073,
+    90666.821933525847,
+    90689.959340580186,
+    90713.098223469773,
+    90736.238582006365,
+    90759.380416001804,
+    90782.523725267951,
+    90805.668509616764,
+    90828.814768860233,
+    90851.962502810435,
+    90875.11171127946,
+    90898.262394079517,
+    90921.414551022855,
+    90944.568181921743,
+    90967.72328658856,
+    90990.879864835719,
+    91014.037916475718,
+    91037.19744132107,
+    91060.358439184391,
+    91083.520909878338,
+    91106.684853215629,
+    91129.850269009039,
+    91153.017157071401,
+    91176.185517215621,
+    91199.355349254649,
+    91222.526653001492,
+    91245.699428269247,
+    91268.873674871036,
+    91292.049392620058,
+    91315.226581329553,
+    91338.405240812834,
+    91361.585370883287,
+    91384.766971354344,
+    91407.950042039476,
+    91431.134582752245,
+    91454.320593306256,
+    91477.508073515171,
+    91500.697023192712,
+    91523.887442152685,
+    91547.07933020893,
+    91570.272687175326,
+    91593.467512865856,
+    91616.663807094534,
+    91639.861569675442,
+    91663.060800422725,
+    91686.261499150554,
+    91709.463665673218,
+    91732.66729980502,
+    91755.872401360321,
+    91779.078970153569,
+    91802.287005999257,
+    91825.49650871192,
+    91848.707478106167,
+    91871.91991399668,
+    91895.133816198169,
+    91918.349184525418,
+    91941.566018793281,
+    91964.784318816659,
+    91988.004084410495,
+    92011.22531538982,
+    92034.448011569708,
+    92057.672172765277,
+    92080.897798791746,
+    92104.124889464365,
+    92127.353444598411,
+    92150.58346400928,
+    92173.814947512379,
+    92197.04789492322,
+    92220.282306057314,
+    92243.518180730272,
+    92266.755518757753,
+    92289.994319955469,
+    92313.234584139194,
+    92336.476311124774,
+    92359.719500728082,
+    92382.964152765067,
+    92406.210267051734,
+    92429.457843404161,
+    92452.706881638471,
+    92475.957381570814,
+    92499.209343017443,
+    92522.462765794655,
+    92545.717649718805,
+    92568.973994606305,
+    92592.231800273614,
+    92615.491066537259,
+    92638.751793213814,
+    92662.01398011994,
+    92685.277627072326,
+    92708.54273388772,
+    92731.809300382942,
+    92755.077326374871,
+    92778.346811680414,
+    92801.617756116568,
+    92824.890159500384,
+    92848.164021648947,
+    92871.439342379424,
+    92894.716121509016,
+    92917.994358855023,
+    92941.274054234746,
+    92964.555207465572,
+    92987.837818364962,
+    93011.121886750407,
+    93034.407412439468,
+    93057.694395249753,
+    93080.982834998955,
+    93104.272731504767,
+    93127.564084584999,
+    93150.856894057491,
+    93174.15115974014,
+    93197.446881450916,
+    93220.744059007804,
+    93244.04269222889,
+    93267.342780932304,
+    93290.644324936235,
+    93313.947324058914,
+    93337.251778118633,
+    93360.557686933767,
+    93383.865050322696,
+    93407.173868103928,
+    93430.484140095941,
+    93453.795866117362,
+    93477.109045986799,
+    93500.423679522952,
+    93523.739766544561,
+    93547.057306870454,
+    93570.376300319491,
+    93593.696746710571,
+    93617.018645862699,
+    93640.341997594893,
+    93663.666801726242,
+    93686.993058075881,
+    93710.320766463032,
+    93733.64992670693,
+    93756.980538626914,
+    93780.312602042337,
+    93803.646116772637,
+    93826.981082637285,
+    93850.317499455836,
+    93873.655367047861,
+    93896.994685233032,
+    93920.335453831038,
+    93943.677672661666,
+    93967.021341544707,
+    93990.366460300051,
+    94013.713028747632,
+    94037.061046707429,
+    94060.410513999494,
+    94083.761430443905,
+    94107.113795860845,
+    94130.467610070496,
+    94153.822872893157,
+    94177.179584149111,
+    94200.537743658759,
+    94223.897351242529,
+    94247.25840672091,
+    94270.620909914433,
+    94293.98486064373,
+    94317.350258729421,
+    94340.71710399224,
+    94364.085396252936,
+    94387.455135332348,
+    94410.82632105134,
+    94434.198953230851,
+    94457.573031691878,
+    94480.948556255447,
+    94504.325526742658,
+    94527.70394297468,
+    94551.083804772716,
+    94574.465111958023,
+    94597.847864351934,
+    94621.232061775823,
+    94644.617704051096,
+    94668.004790999272,
+    94691.393322441872,
+    94714.783298200506,
+    94738.174718096794,
+    94761.567581952477,
+    94784.961889589307,
+    94808.357640829097,
+    94831.754835493703,
+    94855.153473405066,
+    94878.553554385173,
+    94901.955078256055,
+    94925.358044839784,
+    94948.762453958523,
+    94972.168305434476,
+    94995.575599089891,
+    95018.984334747074,
+    95042.394512228391,
+    95065.806131356265,
+    95089.219191953176,
+    95112.633693841635,
+    95136.04963684424,
+    95159.467020783617,
+    95182.885845482466,
+    95206.306110763529,
+    95229.727816449609,
+    95253.150962363579,
+    95276.575548328314,
+    95300.001574166803,
+    95323.429039702052,
+    95346.857944757154,
+    95370.288289155214,
+    95393.720072719429,
+    95417.153295273019,
+    95440.587956639298,
+    95464.024056641589,
+    95487.461595103305,
+    95510.900571847902,
+    95534.340986698866,
+    95557.782839479783,
+    95581.226130014256,
+    95604.670858125959,
+    95628.117023638595,
+    95651.564626375985,
+    95675.013666161918,
+    95698.464142820303,
+    95721.916056175076,
+    95745.369406050231,
+    95768.824192269807,
+    95792.280414657915,
+    95815.738073038709,
+    95839.197167236387,
+    95862.657697075221,
+    95886.11966237954,
+    95909.583062973688,
+    95933.047898682111,
+    95956.514169329268,
+    95979.981874739708,
+    96003.451014738006,
+    96026.921589148798,
+    96050.393597796792,
+    96073.867040506724,
+    96097.341917103375,
+    96120.818227411626,
+    96144.295971256375,
+    96167.775148462577,
+    96191.255758855244,
+    96214.737802259449,
+    96238.221278500292,
+    96261.70618740299,
+    96285.192528792715,
+    96308.680302494788,
+    96332.169508334526,
+    96355.660146137321,
+    96379.152215728609,
+    96402.645716933868,
+    96426.14064957868,
+    96449.637013488609,
+    96473.134808489311,
+    96496.63403440651,
+    96520.134691065963,
+    96543.636778293469,
+    96567.140295914898,
+    96590.645243756153,
+    96614.151621643221,
+    96637.659429402134,
+    96661.168666858954,
+    96684.679333839798,
+    96708.191430170875,
+    96731.70495567839,
+    96755.219910188665,
+    96778.736293528011,
+    96802.254105522836,
+    96825.77334599958,
+    96849.29401478474,
+    96872.816111704873,
+    96896.339636586577,
+    96919.864589256511,
+    96943.390969541389,
+    96966.918777267958,
+    96990.448012263048,
+    97013.978674353522,
+    97037.510763366285,
+    97061.044279128328,
+    97084.579221466673,
+    97108.115590208385,
+    97131.653385180587,
+    97155.19260621049,
+    97178.733253125291,
+    97202.2753257523,
+    97225.81882391886,
+    97249.363747452342,
+    97272.910096180189,
+    97296.457869929916,
+    97320.007068529041,
+    97343.557691805196,
+    97367.109739586012,
+    97390.663211699197,
+    97414.218107972498,
+    97437.774428233737,
+    97461.332172310766,
+    97484.891340031507,
+    97508.451931223899,
+    97532.013945715982,
+    97555.577383335811,
+    97579.142243911512,
+    97602.708527271257,
+    97626.276233243261,
+    97649.845361655811,
+    97673.415912337223,
+    97696.987885115886,
+    97720.561279820206,
+    97744.1360962787,
+    97767.712334319876,
+    97791.289993772341,
+    97814.869074464703,
+    97838.449576225685,
+    97862.031498883996,
+    97885.614842268449,
+    97909.199606207883,
+    97932.785790531183,
+    97956.37339506732,
+    97979.962419645264,
+    98003.552864094076,
+    98027.144728242856,
+    98050.738011920766,
+    98074.332714956996,
+    98097.928837180807,
+    98121.526378421506,
+    98145.125338508456,
+    98168.725717271067,
+    98192.327514538789,
+    98215.930730141132,
+    98239.535363907664,
+    98263.141415668011,
+    98286.748885251814,
+    98310.357772488816,
+    98333.968077208759,
+    98357.579799241488,
+    98381.192938416847,
+    98404.807494564782,
+    98428.42346751524,
+    98452.040857098269,
+    98475.659663143917,
+    98499.27988548232,
+    98522.901523943656,
+    98546.524578358163,
+    98570.149048556093,
+    98593.774934367786,
+    98617.402235623624,
+    98641.030952154048,
+    98664.661083789513,
+    98688.292630360564,
+    98711.925591697771,
+    98735.559967631794,
+    98759.195757993293,
+    98782.832962613014,
+    98806.471581321734,
+    98830.111613950285,
+    98853.753060329575,
+    98877.39592029051,
+    98901.040193664099,
+    98924.68588028138,
+    98948.33297997342,
+    98971.981492571387,
+    98995.63141790645,
+    99019.282755809851,
+    99042.935506112874,
+    99066.589668646877,
+    99090.245243243233,
+    99113.902229733401,
+    99137.560627948857,
+    99161.220437721131,
+    99184.881658881859,
+    99208.544291262631,
+    99232.208334695169,
+    99255.87378901121,
+    99279.540654042547,
+    99303.208929621018,
+    99326.878615578535,
+    99350.549711746993,
+    99374.222217958435,
+    99397.896134044888,
+    99421.571459838422,
+    99445.248195171211,
+    99468.926339875441,
+    99492.605893783344,
+    99516.286856727209,
+    99539.969228539398,
+    99563.653009052287,
+    99587.338198098325,
+    99611.024795510006,
+    99634.712801119866,
+    99658.402214760499,
+    99682.093036264545,
+    99705.785265464699,
+    99729.478902193689,
+    99753.173946284325,
+    99776.870397569437,
+    99800.56825588191,
+    99824.267521054688,
+    99847.968192920773,
+    99871.670271313182,
+    99895.373756065004,
+    99919.078647009388,
+    99942.78494397951,
+    99966.492646808634,
+    99990.20175533001,
+    100013.91226937699,
+    100037.62418878295,
+    100061.33751338134,
+    100085.05224300563,
+    100108.76837748935,
+    100132.4859166661,
+    100156.2048603695,
+    100179.92520843323,
+    100203.64696069101,
+    100227.37011697664,
+    100251.09467712394,
+    100274.82064096678,
+    100298.54800833909,
+    100322.27677907483,
+    100346.00695300807,
+    100369.73852997283,
+    100393.47150980328,
+    100417.20589233354,
+    100440.94167739789,
+    100464.67886483055,
+    100488.41745446586,
+    100512.1574461382,
+    100535.89883968196,
+    100559.64163493161,
+    100583.38583172169,
+    100607.13142988674,
+    100630.87842926137,
+    100654.62682968024,
+    100678.37663097809,
+    100702.12783298964,
+    100725.88043554971,
+    100749.63443849317,
+    100773.38984165489,
+    100797.14664486986,
+    100820.90484797307,
+    100844.66445079957,
+    100868.42545318443,
+    100892.18785496285,
+    100915.95165596998,
+    100939.71685604109,
+    100963.48345501146,
+    100987.25145271645,
+    101011.02084899142,
+    101034.79164367182,
+    101058.56383659317,
+    101082.33742759094,
+    101106.11241650078,
+    101129.88880315828,
+    101153.66658739912,
+    101177.44576905905,
+    101201.22634797383,
+    101225.00832397929,
+    101248.7916969113,
+    101272.57646660579,
+    101296.36263289873,
+    101320.15019562612,
+    101343.93915462404,
+    101367.7295097286,
+    101391.52126077596,
+    101415.31440760233,
+    101439.10895004397,
+    101462.9048879372,
+    101486.70222111834,
+    101510.50094942382,
+    101534.30107269008,
+    101558.10259075361,
+    101581.90550345098,
+    101605.70981061876,
+    101629.5155120936,
+    101653.32260771218,
+    101677.13109731126,
+    101700.9409807276,
+    101724.75225779804,
+    101748.56492835947,
+    101772.37899224881,
+    101796.19444930303,
+    101820.01129935916,
+    101843.82954225427,
+    101867.64917782549,
+    101891.47020590997,
+    101915.29262634492,
+    101939.11643896763,
+    101962.94164361537,
+    101986.76824012553,
+    102010.59622833549,
+    102034.42560808272,
+    102058.25637920471,
+    102082.08854153901,
+    102105.9220949232,
+    102129.75703919494,
+    102153.59337419191,
+    102177.43109975185,
+    102201.27021571253,
+    102225.1107219118,
+    102248.95261818753,
+    102272.79590437764,
+    102296.64058032009,
+    102320.48664585294,
+    102344.33410081422,
+    102368.18294504205,
+    102392.03317837461,
+    102415.88480065008,
+    102439.73781170673,
+    102463.59221138287,
+    102487.44799951684,
+    102511.30517594704,
+    102535.1637405119,
+    102559.02369304992,
+    102582.88503339965,
+    102606.74776139967,
+    102630.61187688859,
+    102654.4773797051,
+    102678.34426968795,
+    102702.21254667587,
+    102726.08221050771,
+    102749.95326102231,
+    102773.8256980586,
+    102797.69952145554,
+    102821.57473105213,
+    102845.45132668741,
+    102869.32930820051,
+    102893.20867543056,
+    102917.08942821674,
+    102940.97156639832,
+    102964.85508981455,
+    102988.73999830478,
+    103012.6262917084,
+    103036.51396986481,
+    103060.40303261351,
+    103084.293479794,
+    103108.18531124585,
+    103132.07852680866,
+    103155.97312632212,
+    103179.8691096259,
+    103203.76647655977,
+    103227.66522696352,
+    103251.56536067701,
+    103275.46687754011,
+    103299.36977739276,
+    103323.27406007495,
+    103347.1797254267,
+    103371.0867732881,
+    103394.99520349925,
+    103418.90501590034,
+    103442.81621033157,
+    103466.72878663319,
+    103490.64274464553,
+    103514.55808420894,
+    103538.4748051638,
+    103562.39290735057,
+    103586.31239060973,
+    103610.23325478184,
+    103634.15549970744,
+    103658.07912522719,
+    103682.00413118176,
+    103705.93051741188,
+    103729.85828375829,
+    103753.78743006183,
+    103777.71795616332,
+    103801.64986190372,
+    103825.58314712394,
+    103849.51781166498,
+    103873.4538553679,
+    103897.39127807376,
+    103921.33007962372,
+    103945.27025985894,
+    103969.21181862066,
+    103993.15475575015,
+    104017.0990710887,
+    104041.0447644777,
+    104064.99183575854,
+    104088.94028477269,
+    104112.89011136163,
+    104136.84131536692,
+    104160.79389663014,
+    104184.74785499295,
+    104208.70319029699,
+    104232.65990238401,
+    104256.61799109577,
+    104280.57745627411,
+    104304.53829776087,
+    104328.50051539797,
+    104352.46410902737,
+    104376.42907849104,
+    104400.39542363105,
+    104424.36314428948,
+    104448.33224030846,
+    104472.3027115302,
+    104496.27455779689,
+    104520.24777895081,
+    104544.22237483428,
+    104568.19834528965,
+    104592.17569015936,
+    104616.15440928582,
+    104640.13450251156,
+    104664.1159696791,
+    104688.09881063103,
+    104712.08302520998,
+    104736.06861325864,
+    104760.05557461972,
+    104784.043909136,
+    104808.03361665027,
+    104832.0246970054,
+    104856.01715004431,
+    104880.01097560991,
+    104904.00617354522,
+    104928.00274369326,
+    104952.00068589712,
+    104975.99999999993,
+    105000.00068584486,
+    105024.00274327511,
+    105048.00617213396,
+    105072.0109722647,
+    105096.0171435107,
+    105120.02468571534,
+    105144.03359872208,
+    105168.04388237436,
+    105192.05553651576,
+    105216.06856098982,
+    105240.08295564017,
+    105264.09872031047,
+    105288.11585484444,
+    105312.13435908582,
+    105336.1542328784,
+    105360.17547606604,
+    105384.19808849262,
+    105408.22207000206,
+    105432.24742043833,
+    105456.27413964548,
+    105480.30222746753,
+    105504.33168374863,
+    105528.36250833291,
+    105552.39470106458,
+    105576.42826178786,
+    105600.46319034706,
+    105624.49948658649,
+    105648.53715035053,
+    105672.5761814836,
+    105696.61657983017,
+    105720.65834523473,
+    105744.70147754184,
+    105768.7459765961,
+    105792.79184224214,
+    105816.83907432464,
+    105840.88767268835,
+    105864.93763717801,
+    105888.98896763846,
+    105913.04166391456,
+    105937.09572585119,
+    105961.15115329332,
+    105985.20794608595,
+    106009.26610407409,
+    106033.32562710284,
+    106057.38651501729,
+    106081.44876766266,
+    106105.51238488412,
+    106129.57736652695,
+    106153.64371243643,
+    106177.71142245791,
+    106201.78049643678,
+    106225.85093421848,
+    106249.92273564848,
+    106273.99590057228,
+    106298.07042883546,
+    106322.14632028362,
+    106346.22357476239,
+    106370.30219211751,
+    106394.38217219469,
+    106418.46351483969,
+    106442.54621989837,
+    106466.63028721658,
+    106490.71571664025,
+    106514.80250801529,
+    106538.89066118775,
+    106562.98017600364,
+    106587.07105230905,
+    106611.16328995011,
+    106635.25688877302,
+    106659.35184862395,
+    106683.44816934918,
+    106707.54585079502,
+    106731.64489280782,
+    106755.74529523395,
+    106779.84705791986,
+    106803.95018071201,
+    106828.05466345693,
+    106852.16050600118,
+    106876.26770819137,
+    106900.37626987413,
+    106924.48619089619,
+    106948.59747110425,
+    106972.71011034511,
+    106996.82410846559,
+    107020.93946531253,
+    107045.05618073288,
+    107069.17425457356,
+    107093.29368668159,
+    107117.41447690397,
+    107141.53662508781,
+    107165.66013108024,
+    107189.7849947284,
+    107213.91121587952,
+    107238.03879438085,
+    107262.16773007967,
+    107286.29802282334,
+    107310.42967245923,
+    107334.56267883476,
+    107358.69704179741,
+    107382.83276119467,
+    107406.96983687414,
+    107431.10826868335,
+    107455.24805646999,
+    107479.38920008171,
+    107503.53169936626,
+    107527.67555417139,
+    107551.82076434491,
+    107575.96732973469,
+    107600.11525018861,
+    107624.26452555459,
+    107648.41515568066,
+    107672.56714041479,
+    107696.72047960508,
+    107720.87517309963,
+    107745.03122074658,
+    107769.18862239413,
+    107793.34737789053,
+    107817.50748708403,
+    107841.66894982298,
+    107865.83176595572,
+    107889.99593533068,
+    107914.16145779629,
+    107938.32833320105,
+    107962.49656139348,
+    107986.66614222217,
+    108010.83707553572,
+    108035.00936118282,
+    108059.18299901215,
+    108083.35798887245,
+    108107.53433061253,
+    108131.71202408121,
+    108155.89106912735,
+    108180.07146559987,
+    108204.25321334775,
+    108228.43631221994,
+    108252.62076206553,
+    108276.80656273357,
+    108300.99371407321,
+    108325.18221593359,
+    108349.37206816394,
+    108373.56327061349,
+    108397.75582313156,
+    108421.94972556747,
+    108446.1449777706,
+    108470.34157959036,
+    108494.53953087622,
+    108518.73883147769,
+    108542.93948124432,
+    108567.14148002568,
+    108591.34482767139,
+    108615.54952403114,
+    108639.75556895464,
+    108663.96296229165,
+    108688.17170389196,
+    108712.38179360541,
+    108736.59323128188,
+    108760.80601677128,
+    108785.02014992358,
+    108809.23563058881,
+    108833.45245861699,
+    108857.67063385822,
+    108881.89015616261,
+    108906.11102538036,
+    108930.33324136167,
+    108954.55680395682,
+    108978.78171301607,
+    109003.00796838976,
+    109027.23556992831,
+    109051.46451748211,
+    109075.69481090162,
+    109099.92645003737,
+    109124.15943473989,
+    109148.39376485976,
+    109172.62944024763,
+    109196.86646075416,
+    109221.10482623006,
+    109245.34453652608,
+    109269.58559149304,
+    109293.82799098175,
+    109318.07173484311,
+    109342.31682292801,
+    109366.56325508743,
+    109390.81103117237,
+    109415.06015103387,
+    109439.31061452301,
+    109463.56242149093,
+    109487.8155717888,
+    109512.07006526781,
+    109536.3259017792,
+    109560.58308117429,
+    109584.8416033044,
+    109609.1014680209,
+    109633.36267517522,
+    109657.62522461878,
+    109681.88911620311,
+    109706.15434977971,
+    109730.4209252002,
+    109754.68884231619,
+    109778.95810097932,
+    109803.22870104131,
+    109827.50064235389,
+    109851.77392476884,
+    109876.04854813802,
+    109900.32451231324,
+    109924.60181714644,
+    109948.88046248957,
+    109973.1604481946,
+    109997.44177411357,
+    110021.72444009855,
+    110046.00844600165,
+    110070.29379167501,
+    110094.58047697082,
+    110118.86850174134,
+    110143.15786583882,
+    110167.44856911557,
+    110191.74061142397,
+    110216.03399261639,
+    110240.32871254528,
+    110264.62477106311,
+    110288.9221680224,
+    110313.22090327571,
+    110337.52097667565,
+    110361.82238807483,
+    110386.12513732594,
+    110410.42922428172,
+    110434.73464879491,
+    110459.04141071832,
+    110483.34950990479,
+    110507.6589462072,
+    110531.96971947847,
+    110556.28182957157,
+    110580.5952763395,
+    110604.91005963532,
+    110629.22617931209,
+    110653.54363522294,
+    110677.86242722106,
+    110702.18255515963,
+    110726.50401889188,
+    110750.82681827113,
+    110775.1509531507,
+    110799.47642338395,
+    110823.80322882428,
+    110848.13136932514,
+    110872.46084474004,
+    110896.79165492248,
+    110921.12379972603,
+    110945.4572790043,
+    110969.79209261097,
+    110994.12824039967,
+    111018.46572222417,
+    111042.80453793822,
+    111067.14468739564,
+    111091.48617045028,
+    111115.82898695602,
+    111140.1731367668,
+    111164.51861973655,
+    111188.86543571933,
+    111213.21358456917,
+    111237.56306614014,
+    111261.91388028639,
+    111286.26602686207,
+    111310.61950572141,
+    111334.97431671864,
+    111359.33045970804,
+    111383.68793454397,
+    111408.04674108078,
+    111432.40687917286,
+    111456.76834867468,
+    111481.13114944073,
+    111505.49528132551,
+    111529.86074418361,
+    111554.22753786964,
+    111578.59566223821,
+    111602.96511714405,
+    111627.33590244185,
+    111651.7080179864,
+    111676.08146363248,
+    111700.45623923496,
+    111724.8323446487,
+    111749.20977972864,
+    111773.58854432974,
+    111797.96863830699,
+    111822.35006151545,
+    111846.73281381019,
+    111871.11689504632,
+    111895.50230507903,
+    111919.8890437635,
+    111944.27711095495,
+    111968.6665065087,
+    111993.05723028004,
+    112017.44928212435,
+    112041.842661897,
+    112066.23736945343,
+    112090.63340464912,
+    112115.03076733962,
+    112139.42945738042,
+    112163.82947462716,
+    112188.23081893545,
+    112212.63349016097,
+    112237.03748815943,
+    112261.44281278658,
+    112285.84946389822,
+    112310.25744135017,
+    112334.66674499828,
+    112359.07737469849,
+    112383.48933030672,
+    112407.90261167898,
+    112432.31721867126,
+    112456.73315113965,
+    112481.15040894024,
+    112505.56899192919,
+    112529.98889996267,
+    112554.41013289688,
+    112578.8326905881,
+    112603.25657289263,
+    112627.68177966679,
+    112652.10831076698,
+    112676.53616604958,
+    112700.96534537108,
+    112725.39584858794,
+    112749.82767555672,
+    112774.26082613398,
+    112798.6953001763,
+    112823.13109754038,
+    112847.56821808286,
+    112872.00666166049,
+    112896.44642813003,
+    112920.88751734827,
+    112945.32992917208,
+    112969.77366345831,
+    112994.21872006389,
+    113018.66509884578,
+    113043.11279966099,
+    113067.56182236652,
+    113092.01216681948,
+    113116.46383287695,
+    113140.9168203961,
+    113165.37112923413,
+    113189.82675924824,
+    113214.28371029573,
+    113238.74198223387,
+    113263.20157492002,
+    113287.66248821157,
+    113312.12472196593,
+    113336.58827604055,
+    113361.05315029295,
+    113385.51934458067,
+    113409.98685876124,
+    113434.45569269233,
+    113458.92584623155,
+    113483.39731923661,
+    113507.87011156522,
+    113532.34422307517,
+    113556.81965362425,
+    113581.2964030703,
+    113605.77447127122,
+    113630.25385808491,
+    113654.73456336933,
+    113679.2165869825,
+    113703.69992878241,
+    113728.18458862718,
+    113752.67056637487,
+    113777.15786188368,
+    113801.64647501177,
+    113826.13640561736,
+    113850.62765355874,
+    113875.12021869418,
+    113899.61410088204,
+    113924.1092999807,
+    113948.60581584855,
+    113973.10364834407,
+    113997.60279732574,
+    114022.1032626521,
+    114046.60504418171,
+    114071.10814177318,
+    114095.61255528514,
+    114120.11828457628,
+    114144.62532950533,
+    114169.13368993104,
+    114193.6433657122,
+    114218.15435670764,
+    114242.66666277625,
+    114267.18028377694,
+    114291.69521956862,
+    114316.21147001031,
+    114340.72903496103,
+    114365.24791427983,
+    114389.7681078258,
+    114414.2896154581,
+    114438.81243703589,
+    114463.33657241837,
+    114487.8620214648,
+    114512.38878403447,
+    114536.91685998671,
+    114561.44624918087,
+    114585.97695147636,
+    114610.5089667326,
+    114635.04229480909,
+    114659.57693556532,
+    114684.11288886084,
+    114708.65015455526,
+    114733.18873250818,
+    114757.72862257928,
+    114782.26982462825,
+    114806.81233851484,
+    114831.35616409882,
+    114855.90130123998,
+    114880.44774979822,
+    114904.99550963337,
+    114929.5445806054,
+    114954.09496257425,
+    114978.64665539992,
+    115003.19965894247,
+    115027.75397306195,
+    115052.30959761847,
+    115076.86653247218,
+    115101.42477748329,
+    115125.984332512,
+    115150.54519741859,
+    115175.10737206334,
+    115199.67085630659,
+    115224.23565000873,
+    115248.80175303014,
+    115273.3691652313,
+    115297.93788647266,
+    115322.50791661476,
+    115347.07925551817,
+    115371.65190304347,
+    115396.22585905129,
+    115420.80112340231,
+    115445.37769595724,
+    115469.95557657682,
+    115494.53476512182,
+    115519.11526145306,
+    115543.69706543141,
+    115568.28017691776,
+    115592.86459577303,
+    115617.4503218582,
+    115642.03735503425,
+    115666.62569516223,
+    115691.21534210323,
+    115715.80629571836,
+    115740.39855586876,
+    115764.99212241563,
+    115789.58699522018,
+    115814.18317414368,
+    115838.78065904744,
+    115863.37944979276,
+    115887.97954624105,
+    115912.5809482537,
+    115937.18365569216,
+    115961.78766841792,
+    115986.39298629249,
+    116010.99960917742,
+    116035.60753693432,
+    116060.21676942479,
+    116084.82730651053,
+    116109.43914805322,
+    116134.0522939146,
+    116158.66674395646,
+    116183.2824980406,
+    116207.89955602887,
+    116232.51791778316,
+    116257.13758316539,
+    116281.75855203751,
+    116306.38082426153,
+    116331.00439969949,
+    116355.62927821343,
+    116380.25545966547,
+    116404.88294391775,
+    116429.51173083246,
+    116454.14182027178,
+    116478.77321209799,
+    116503.40590617337,
+    116528.03990236025,
+    116552.67520052097,
+    116577.31180051794,
+    116601.94970221359,
+    116626.5889054704,
+    116651.22941015086,
+    116675.87121611751,
+    116700.51432323294,
+    116725.15873135976,
+    116749.8044403606,
+    116774.45145009817,
+    116799.0997604352,
+    116823.74937123443,
+    116848.40028235866,
+    116873.05249367072,
+    116897.70600503348,
+    116922.36081630984,
+    116947.01692736275,
+    116971.67433805518,
+    116996.33304825013,
+    117020.99305781067,
+    117045.65436659988,
+    117070.31697448085,
+    117094.98088131678,
+    117119.64608697082,
+    117144.31259130624,
+    117168.98039418629,
+    117193.64949547425,
+    117218.31989503348,
+    117242.99159272734,
+    117267.66458841923,
+    117292.33888197262,
+    117317.01447325097,
+    117341.6913621178,
+    117366.36954843666,
+    117391.04903207115,
+    117415.72981288488,
+    117440.41189074152,
+    117465.09526550474,
+    117489.77993703831,
+    117514.46590520597,
+    117539.15316987153,
+    117563.84173089883,
+    117588.53158815173,
+    117613.22274149416,
+    117637.91519079007,
+    117662.60893590341,
+    117687.30397669821,
+    117712.00031303853,
+    117736.69794478847,
+    117761.39687181212,
+    117786.09709397367,
+    117810.7986111373,
+    117835.50142316725,
+    117860.20552992777,
+    117884.91093128319,
+    117909.6176270978,
+    117934.32561723603,
+    117959.03490156225,
+    117983.74547994092,
+    118008.45735223651,
+    118033.17051831353,
+    118057.88497803656,
+    118082.60073127014,
+    118107.31777787894,
+    118132.03611772758,
+    118156.75575068076,
+    118181.47667660323,
+    118206.19889535972,
+    118230.92240681504,
+    118255.64721083404,
+    118280.37330728157,
+    118305.10069602253,
+    118329.82937692189,
+    118354.55934984458,
+    118379.29061465565,
+    118404.02317122012,
+    118428.75701940308,
+    118453.49215906965,
+    118478.22859008498,
+    118502.96631231424,
+    118527.70532562268,
+    118552.44562987552,
+    118577.18722493808,
+    118601.93011067568,
+    118626.67428695368,
+    118651.41975363747,
+    118676.16651059251,
+    118700.91455768423,
+    118725.66389477813,
+    118750.41452173979,
+    118775.16643843475,
+    118799.91964472862,
+    118824.67414048707,
+    118849.42992557574,
+    118874.18699986035,
+    118898.94536320666,
+    118923.70501548045,
+    118948.46595654752,
+    118973.22818627374,
+    118997.99170452499,
+    119022.7565111672,
+    119047.52260606633,
+    119072.28998908834,
+    119097.0586600993,
+    119121.82861896523,
+    119146.59986555226,
+    119171.3723997265,
+    119196.14622135412,
+    119220.92133030134,
+    119245.69772643436,
+    119270.47540961947,
+    119295.25437972297,
+    119320.03463661121,
+    119344.81618015055,
+    119369.5990102074,
+    119394.38312664822,
+    119419.16852933947,
+    119443.95521814766,
+    119468.74319293935,
+    119493.53245358112,
+    119518.32299993958,
+    119543.11483188139,
+    119567.90794927324,
+    119592.70235198183,
+    119617.49803987393,
+    119642.29501281632,
+    119667.09327067583,
+    119691.89281331931,
+    119716.69364061367,
+    119741.49575242582,
+    119766.29914862274,
+    119791.10382907141,
+    119815.90979363887,
+    119840.71704219218,
+    119865.52557459843,
+    119890.33539072477,
+    119915.14649043836,
+    119939.95887360642,
+    119964.77254009615,
+    119989.58748977486,
+    120014.40372250983,
+    120039.22123816841,
+    120064.04003661797,
+    120088.86011772591,
+    120113.6814813597,
+    120138.5041273868,
+    120163.3280556747,
+    120188.15326609099,
+    120212.97975850321,
+    120237.807532779,
+    120262.63658878599,
+    120287.46692639188,
+    120312.29854546436,
+    120337.13144587121,
+    120361.9656274802,
+    120386.80109015915,
+    120411.63783377589,
+    120436.47585819835,
+    120461.31516329442,
+    120486.15574893207,
+    120510.99761497928,
+    120535.84076130406,
+    120560.68518777451,
+    120585.53089425867,
+    120610.3778806247,
+    120635.22614674074,
+    120660.07569247499,
+    120684.92651769568,
+    120709.77862227106,
+    120734.63200606944,
+    120759.48666895913,
+    120784.3426108085,
+    120809.19983148595,
+    120834.05833085992,
+    120858.91810879884,
+    120883.77916517125,
+    120908.64149984565,
+    120933.5051126906,
+    120958.37000357473,
+    120983.23617236665,
+    121008.10361893504,
+    121032.97234314861,
+    121057.84234487606,
+    121082.71362398617,
+    121107.58618034775,
+    121132.46001382964,
+    121157.33512430069,
+    121182.21151162982,
+    121207.08917568595,
+    121231.96811633807,
+    121256.84833345517,
+    121281.72982690629,
+    121306.61259656049,
+    121331.49664228689,
+    121356.38196395461,
+    121381.26856143285,
+    121406.15643459078,
+    121431.04558329767,
+    121455.93600742276,
+    121480.82770683538,
+    121505.72068140487,
+    121530.61493100057,
+    121555.51045549192,
+    121580.40725474835,
+    121605.30532863933,
+    121630.20467703436,
+    121655.10529980299,
+    121680.00719681478,
+    121704.91036793934,
+    121729.81481304632,
+    121754.72053200539,
+    121779.62752468624,
+    121804.53579095862,
+    121829.44533069231,
+    121854.3561437571,
+    121879.26823002285,
+    121904.1815893594,
+    121929.09622163669,
+    121954.01212672464,
+    121978.92930449323,
+    122003.84775481246,
+    122028.76747755238,
+    122053.68847258303,
+    122078.61073977455,
+    122103.53427899707,
+    122128.45909012076,
+    122153.38517301581,
+    122178.31252755247,
+    122203.24115360099,
+    122228.17105103172,
+    122253.10221971494,
+    122278.03465952107,
+    122302.96837032049,
+    122327.90335198362,
+    122352.83960438096,
+    122377.777127383,
+    122402.71592086025,
+    122427.65598468333,
+    122452.59731872278,
+    122477.53992284928,
+    122502.48379693348,
+    122527.42894084606,
+    122552.37535445779,
+    122577.32303763942,
+    122602.27199026172,
+    122627.22221219557,
+    122652.17370331181,
+    122677.12646348133,
+    122702.08049257506,
+    122727.03579046397,
+    122751.99235701906,
+    122776.95019211136,
+    122801.9092956119,
+    122826.8696673918,
+    122851.83130732219,
+    122876.79421527422,
+    122901.75839111909,
+    122926.72383472799,
+    122951.69054597223,
+    122976.65852472307,
+    123001.62777085182,
+    123026.59828422987,
+    123051.57006472857,
+    123076.54311221937,
+    123101.5174265737,
+    123126.49300766307,
+    123151.46985535898,
+    123176.44796953299,
+    123201.42735005668,
+    123226.40799680166,
+    123251.38990963959,
+    123276.37308844214,
+    123301.35753308103,
+    123326.343243428,
+    123351.33021935483,
+    123376.31846073334,
+    123401.30796743535,
+    123426.29873933276,
+    123451.29077629748,
+    123476.28407820144,
+    123501.2786449166,
+    123526.27447631498,
+    123551.27157226863,
+    123576.26993264959,
+    123601.26955732999,
+    123626.27044618195,
+    123651.27259907764,
+    123676.27601588926,
+    123701.28069648903,
+    123726.28664074924,
+    123751.29384854218,
+    123776.30231974016,
+    123801.31205421555,
+    123826.32305184075,
+    123851.33531248817,
+    123876.34883603029,
+    123901.36362233957,
+    123926.37967128855,
+    123951.39698274979,
+    123976.41555659588,
+    124001.43539269941,
+    124026.45649093305,
+    124051.47885116948,
+    124076.50247328142,
+    124101.5273571416,
+    124126.55350262282,
+    124151.58090959788,
+    124176.60957793961,
+    124201.63950752091,
+    124226.67069821467,
+    124251.70314989384,
+    124276.73686243138,
+    124301.7718357003,
+    124326.80806957364,
+    124351.84556392446,
+    124376.88431862585,
+    124401.92433355095,
+    124426.96560857294,
+    124452.00814356498,
+    124477.05193840031,
+    124502.0969929522,
+    124527.14330709392,
+    124552.19088069882,
+    124577.23971364023,
+    124602.28980579154,
+    124627.34115702618,
+    124652.3937672176,
+    124677.44763623926,
+    124702.50276396469,
+    124727.55915026742,
+    124752.61679502104,
+    124777.67569809916,
+    124802.73585937542,
+    124827.79727872348,
+    124852.85995601704,
+    124877.92389112986,
+    124902.98908393568,
+    124928.05553430831,
+    124953.1232421216,
+    124978.19220724938,
+    125003.26242956554,
+    125028.33390894404,
+    125053.40664525882,
+    125078.48063838384,
+    125103.55588819318,
+    125128.63239456083,
+    125153.71015736091,
+    125178.78917646752,
+    125203.86945175481,
+    125228.95098309696,
+    125254.03377036817,
+    125279.1178134427,
+    125304.20311219479,
+    125329.28966649878,
+    125354.37747622898,
+    125379.46654125977,
+    125404.55686146552,
+    125429.6484367207,
+    125454.74126689974,
+    125479.83535187715,
+    125504.93069152744,
+    125530.02728572517,
+    125555.12513434493,
+    125580.22423726133,
+    125605.32459434902,
+    125630.4262054827,
+    125655.52907053704,
+    125680.63318938682,
+    125705.73856190679,
+    125730.84518797178,
+    125755.9530674566,
+    125781.06220023613,
+    125806.17258618528,
+    125831.28422517896,
+    125856.39711709213,
+    125881.51126179981,
+    125906.62665917698,
+    125931.74330909875,
+    125956.86121144016,
+    125981.98036607634,
+    126007.10077288245,
+    126032.22243173365,
+    126057.34534250517,
+    126082.46950507225,
+    126107.59491931014,
+    126132.72158509417,
+    126157.84950229966,
+    126182.97867080198,
+    126208.10909047653,
+    126233.24076119871,
+    126258.37368284403,
+    126283.50785528794,
+    126308.64327840599,
+    126333.77995207369,
+    126358.91787616667,
+    126384.0570505605,
+    126409.19747513086,
+    126434.3391497534,
+    126459.48207430386,
+    126484.62624865794,
+    126509.77167269142,
+    126534.9183462801,
+    126560.06626929982,
+    126585.21544162642,
+    126610.36586313581,
+    126635.51753370393,
+    126660.67045320668,
+    126685.82462152008,
+    126710.98003852014,
+    126736.13670408291,
+    126761.29461808444,
+    126786.45378040087,
+    126811.61419090834,
+    126836.77584948298,
+    126861.93875600102,
+    126887.10291033868,
+    126912.26831237224,
+    126937.43496197795,
+    126962.60285903217,
+    126987.77200341123,
+    127012.94239499152,
+    127038.11403364947,
+    127063.2869192615,
+    127088.46105170409,
+    127113.63643085376,
+    127138.81305658702,
+    127163.99092878048,
+    127189.17004731069,
+    127214.35041205429,
+    127239.53202288797,
+    127264.71487968838,
+    127289.89898233226,
+    127315.08433069635,
+    127340.27092465744,
+    127365.45876409234,
+    127390.64784887788,
+    127415.83817889093,
+    127441.02975400841,
+    127466.22257410725,
+    127491.41663906439,
+    127516.61194875685,
+    127541.80850306165,
+    127567.00630185583,
+    127592.20534501647,
+    127617.4056324207,
+    127642.60716394568,
+    127667.80993946856,
+    127693.01395886653,
+    127718.21922201688,
+    127743.42572879682,
+    127768.63347908368,
+    127793.84247275478,
+    127819.05270968749,
+    127844.26418975917,
+    127869.47691284724,
+    127894.69087882918,
+    127919.90608758242,
+    127945.12253898452,
+    127970.34023291297,
+    127995.55916924537,
+    128020.77934785932,
+    128046.00076863244,
+    128071.22343144237,
+    128096.44733616684,
+    128121.67248268353,
+    128146.89887087021,
+    128172.12650060465,
+    128197.35537176467,
+    128222.5854842281,
+    128247.81683787282,
+    128273.04943257671,
+    128298.28326821771,
+    128323.51834467379,
+    128348.75466182294,
+    128373.99221954317,
+    128399.23101771252,
+    128424.47105620909,
+    128449.71233491098,
+    128474.95485369631,
+    128500.19861244329,
+    128525.44361103009,
+    128550.68984933494,
+    128575.93732723613,
+    128601.18604461191,
+    128626.43600134061,
+    128651.68719730059,
+    128676.93963237021,
+    128702.1933064279,
+    128727.44821935208,
+    128752.70437102125,
+    128777.96176131385,
+    128803.22039010846,
+    128828.48025728362,
+    128853.74136271792,
+    128879.00370628996,
+    128904.26728787841,
+    128929.53210736193,
+    128954.79816461923,
+    128980.06545952905,
+    129005.33399197015,
+    129030.60376182134,
+    129055.87476896142,
+    129081.14701326926,
+    129106.42049462376,
+    129131.6952129038,
+    129156.97116798835,
+    129182.24835975636,
+    129207.52678808685,
+    129232.80645285884,
+    129258.08735395141,
+    129283.36949124365,
+    129308.65286461466,
+    129333.9374739436,
+    129359.22331910966,
+    129384.51039999202,
+    129409.79871646997,
+    129435.08826842274,
+    129460.37905572963,
+    129485.67107826998,
+    129510.96433592314,
+    129536.25882856851,
+    129561.55455608548,
+    129586.85151835352,
+    129612.14971525209,
+    129637.4491466607,
+    129662.74981245887,
+    129688.0517125262,
+    129713.35484674224,
+    129738.65921498663,
+    129763.96481713903,
+    129789.27165307909,
+    129814.57972268655,
+    129839.88902584116,
+    129865.19956242264,
+    129890.51133231082,
+    129915.82433538554,
+    129941.13857152662,
+    129966.45404061397,
+    129991.7707425275,
+    130017.08867714716,
+    130042.4078443529,
+    130067.72824402474,
+    130093.04987604271,
+    130118.37274028687,
+    130143.69683663732,
+    130169.02216497416,
+    130194.34872517755,
+    130219.67651712766,
+    130245.0055407047,
+    130270.33579578891,
+    130295.66728226055,
+    130320.99999999991,
+    130346.33394888733,
+    130371.66912880314,
+    130397.00553962773,
+    130422.34318124152,
+    130447.68205352494,
+    130473.02215635845,
+    130498.36348962256,
+    130523.70605319779,
+    130549.0498469647,
+    130574.39487080388,
+    130599.74112459592,
+    130625.08860822149,
+    130650.43732156123,
+    130675.78726449587,
+    130701.13843690613,
+    130726.49083867275,
+    130751.84446967654,
+    130777.19932979831,
+    130802.5554189189,
+    130827.91273691918,
+    130853.27128368006,
+    130878.63105908247,
+    130903.99206300738,
+    130929.35429533575,
+    130954.71775594862,
+    130980.08244472703,
+    131005.44836155206,
+    131030.81550630482,
+    131056.18387886642,
+    131081.55347911804,
+    131106.92430694087,
+    131132.29636221612,
+    131157.66964482504,
+    131183.0441546489,
+    131208.41989156904,
+    131233.79685546676,
+    131259.17504622342,
+    131284.55446372041,
+    131309.93510783918,
+    131335.31697846117,
+    131360.70007546784,
+    131386.0843987407,
+    131411.46994816128,
+    131436.85672361116,
+    131462.24472497194,
+    131487.63395212521,
+    131513.02440495262,
+    131538.41608333588,
+    131563.80898715663,
+    131589.2031162967,
+    131614.59847063778,
+    131639.9950500617,
+    131665.39285445024,
+    131690.79188368531,
+    131716.19213764873,
+    131741.59361622241,
+    131766.99631928833,
+    131792.40024672839,
+    131817.80539842462,
+    131843.21177425905,
+    131868.61937411371,
+    131894.02819787065,
+    131919.43824541202,
+    131944.84951661993,
+    131970.26201137656,
+    131995.67572956407,
+    132021.09067106468,
+    132046.50683576067,
+    132071.9242235343,
+    132097.34283426782,
+    132122.76266784366,
+    132148.1837241441,
+    132173.60600305157,
+    132199.02950444847,
+    132224.45422821722,
+    132249.88017424036,
+    132275.30734240031,
+    132300.73573257966,
+    132326.16534466096,
+    132351.59617852676,
+    132377.02823405969,
+    132402.46151114244,
+    132427.89600965759,
+    132453.33172948789,
+    132478.76867051609,
+    132504.20683262491,
+    132529.64621569714,
+    132555.08681961559,
+    132580.5286442631,
+    132605.97168952253,
+    132631.41595527678,
+    132656.86144140881,
+    132682.30814780149,
+    132707.75607433787,
+    132733.20522090094,
+    132758.65558737374,
+    132784.10717363929,
+    132809.55997958075,
+    132835.01400508118,
+    132860.46925002377,
+    132885.92571429166,
+    132911.38339776811,
+    132936.84230033628,
+    132962.30242187946,
+    132987.76376228096,
+    133013.22632142407,
+    133038.69009919214,
+    133064.15509546854,
+    133089.62131013666,
+    133115.08874307995,
+    133140.55739418184,
+    133166.02726332581,
+    133191.49835039541,
+    133216.97065527414,
+    133242.44417784561,
+    133267.91891799335,
+    133293.39487560102,
+    133318.87205055228,
+    133344.35044273079,
+    133369.83005202023,
+    133395.31087830439,
+    133420.79292146701,
+    133446.27618139185,
+    133471.76065796276,
+    133497.24635106357,
+    133522.73326057816,
+    133548.22138639039,
+    133573.71072838426,
+    133599.20128644365,
+    133624.69306045261,
+    133650.1860502951,
+    133675.68025585517,
+    133701.1756770169,
+    133726.67231366437,
+    133752.17016568172,
+    133777.66923295305,
+    133803.16951536259,
+    133828.67101279454,
+    133854.17372513309,
+    133879.67765226253,
+    133905.18279406714,
+    133930.68915043125,
+    133956.19672123916,
+    133981.70550637526,
+    134007.21550572399,
+    134032.7267191697,
+    134058.23914659687,
+    134083.75278789,
+    134109.26764293358,
+    134134.78371161217,
+    134160.30099381026,
+    134185.8194894125,
+    134211.33919830353,
+    134236.8601203679,
+    134262.38225549037,
+    134287.90560355558,
+    134313.43016444831,
+    134338.95593805326,
+    134364.48292425525,
+    134390.01112293909,
+    134415.54053398955,
+    134441.07115729159,
+    134466.60299273001,
+    134492.1360401898,
+    134517.67029955584,
+    134543.20577071316,
+    134568.74245354676,
+    134594.28034794159,
+    134619.81945378278,
+    134645.35977095537,
+    134670.90129934452,
+    134696.4440388353,
+    134721.98798931291,
+    134747.53315066252,
+    134773.07952276937,
+    134798.62710551871,
+    134824.17589879577,
+    134849.72590248589,
+    134875.27711647438,
+    134900.82954064661,
+    134926.38317488792,
+    134951.93801908373,
+    134977.49407311951,
+    135003.05133688069,
+    135028.60981025276,
+    135054.16949312127,
+    135079.73038537172,
+    135105.29248688967,
+    135130.85579756077,
+    135156.42031727062,
+    135181.98604590484,
+    135207.55298334916,
+    135233.12112948924,
+    135258.69048421088,
+    135284.26104739975,
+    135309.83281894168,
+    135335.4057987225,
+    135360.97998662802,
+    135386.55538254412,
+    135412.13198635669,
+    135437.70979795168,
+    135463.28881721498,
+    135488.86904403262,
+    135514.45047829056,
+    135540.03311987486,
+    135565.61696867159,
+    135591.20202456677,
+    135616.78828744654,
+    135642.37575719706,
+    135667.96443370447,
+    135693.55431685498,
+    135719.14540653475,
+    135744.73770263011,
+    135770.33120502727,
+    135795.92591361253,
+    135821.52182827223,
+    135847.11894889272,
+    135872.7172753604,
+    135898.31680756161,
+    135923.91754538284,
+    135949.51948871053,
+    135975.12263743114,
+    136000.72699143123,
+    136026.33255059729,
+    136051.93931481591,
+    136077.54728397369,
+    136103.15645795723,
+    136128.76683665317,
+    136154.37841994822,
+    136179.99120772901,
+    136205.60519988232,
+    136231.2203962949,
+    136256.83679685349,
+    136282.45440144493,
+    136308.07320995603,
+    136333.69322227367,
+    136359.31443828469,
+    136384.93685787608,
+    136410.56048093468,
+    136436.18530734754,
+    136461.81133700156,
+    136487.43856978384,
+    136513.06700558143,
+    136538.6966442813,
+    136564.32748577066,
+    136589.95952993655,
+    136615.59277666616,
+    136641.22722584667,
+    136666.86287736523,
+    136692.49973110916,
+    136718.13778696564,
+    136743.77704482197,
+    136769.41750456547,
+    136795.05916608346,
+    136820.70202926331,
+    136846.34609399244,
+    136871.99136015819,
+    136897.63782764805,
+    136923.28549634948,
+    136948.93436614997,
+    136974.58443693706,
+    137000.23570859825,
+    137025.88818102115,
+    137051.54185409332,
+    137077.19672770242,
+    137102.85280173609,
+    137128.51007608202,
+    137154.16855062786,
+    137179.82822526142,
+    137205.48909987041,
+    137231.15117434258,
+    137256.8144485658,
+    137282.47892242789,
+    137308.14459581667,
+    137333.81146862009,
+    137359.47954072602,
+    137385.14881202241,
+    137410.81928239719,
+    137436.49095173844,
+    137462.16381993407,
+    137487.83788687221,
+    137513.51315244089,
+    137539.18961652822,
+    137564.86727902229,
+    137590.54613981131,
+    137616.22619878338,
+    137641.90745582676,
+    137667.58991082967,
+    137693.27356368033,
+    137718.95841426702,
+    137744.64446247809,
+    137770.33170820182,
+    137796.02015132661,
+    137821.70979174081,
+    137847.40062933284,
+    137873.09266399115,
+    137898.78589560417,
+    137924.48032406042,
+    137950.17594924837,
+    137975.8727710566,
+    138001.57078937365,
+    138027.27000408815,
+    138052.97041508864,
+    138078.67202226384,
+    138104.3748255024,
+    138130.07882469296,
+    138155.78401972432,
+    138181.49041048516,
+    138207.1979968643,
+    138232.9067787505,
+    138258.61675603263,
+    138284.32792859949,
+    138310.04029633995,
+    138335.75385914298,
+    138361.46861689744,
+    138387.18456949232,
+    138412.90171681659,
+    138438.62005875923,
+    138464.33959520931,
+    138490.06032605586,
+    138515.78225118798,
+    138541.50537049473,
+    138567.2296838653,
+    138592.95519118884,
+    138618.68189235451,
+    138644.40978725153,
+    138670.13887576913,
+    138695.86915779658,
+    138721.60063322316,
+    138747.33330193823,
+    138773.06716383106,
+    138798.80221879104,
+    138824.53846670757,
+    138850.27590747006,
+    138876.01454096794,
+    138901.7543670907,
+    138927.49538572782,
+    138953.2375967688,
+    138978.9810001032,
+    139004.72559562061,
+    139030.47138321059,
+    139056.2183627628,
+    139081.96653416683,
+    139107.71589731239,
+    139133.46645208917,
+    139159.21819838689,
+    139184.97113609532,
+    139210.72526510421,
+    139236.48058530336,
+    139262.23709658257,
+    139287.99479883176,
+    139313.75369194071,
+    139339.51377579942,
+    139365.27505029776,
+    139391.03751532568,
+    139416.80117077316,
+    139442.56601653024,
+    139468.33205248689,
+    139494.09927853322,
+    139519.86769455927,
+    139545.63730045516,
+    139571.408096111,
+    139597.18008141697,
+    139622.95325626322,
+    139648.72762054001,
+    139674.5031741375,
+    139700.27991694602,
+    139726.05784885579,
+    139751.83696975713,
+    139777.61727954043,
+    139803.39877809596,
+    139829.18146531415,
+    139854.96534108539,
+    139880.75040530015,
+    139906.53665784886,
+    139932.32409862199,
+    139958.11272751007,
+    139983.90254440365,
+    140009.69354919327,
+    140035.48574176949,
+    140061.27912202294,
+    140087.07368984428,
+    140112.86944512415,
+    140138.66638775321,
+    140164.4645176222,
+    140190.26383462184,
+    140216.06433864293,
+    140241.86602957622,
+    140267.66890731253,
+    140293.47297174268,
+    140319.27822275754,
+    140345.08466024802,
+    140370.89228410498,
+    140396.70109421943,
+    140422.51109048226,
+    140448.32227278448,
+    140474.13464101712,
+    140499.94819507122,
+    140525.76293483781,
+    140551.57886020801,
+    140577.3959710729,
+    140603.21426732364,
+    140629.03374885136,
+    140654.85441554731,
+    140680.67626730262,
+    140706.49930400858,
+    140732.32352555645,
+    140758.1489318375,
+    140783.97552274304,
+    140809.80329816442,
+    140835.63225799298,
+    140861.46240212015,
+    140887.29373043729,
+    140913.12624283586,
+    140938.95993920733,
+    140964.79481944317,
+    140990.63088343487,
+    141016.46813107401,
+    141042.30656225214,
+    141068.14617686081,
+    141093.98697479168,
+    141119.82895593636,
+    141145.6721201865,
+    141171.51646743377,
+    141197.36199756994,
+    141223.20871048668,
+    141249.05660607578,
+    141274.90568422904,
+    141300.75594483822,
+    141326.6073877952,
+    141352.4600129918,
+    141378.31382031992,
+    141404.16880967148,
+    141430.02498093838,
+    141455.8823340126,
+    141481.74086878612,
+    141507.60058515094,
+    141533.46148299909,
+    141559.32356222265,
+    141585.18682271364,
+    141611.05126436421,
+    141636.9168870665,
+    141662.78369071262,
+    141688.65167519479,
+    141714.5208404052,
+    141740.39118623605,
+    141766.26271257963,
+    141792.1354193282,
+    141818.00930637406,
+    141843.88437360956,
+    141869.760620927,
+    141895.6380482188,
+    141921.51665537735,
+    141947.39644229505,
+    141973.27740886438,
+    141999.15955497778,
+    142025.04288052776,
+    142050.92738540689,
+    142076.81306950765,
+    142102.69993272264,
+    142128.58797494444,
+    142154.47719606571,
+    142180.36759597904,
+    142206.25917457714,
+    142232.15193175265,
+    142258.04586739838,
+    142283.94098140698,
+    142309.83727367126,
+    142335.73474408401,
+    142361.63339253806,
+    142387.5332189262,
+    142413.43422314132,
+    142439.33640507635,
+    142465.23976462413,
+    142491.14430167765,
+    142517.05001612983,
+    142542.95690787368,
+    142568.86497680223,
+    142594.77422280848,
+    142620.68464578551,
+    142646.5962456264,
+    142672.50902222423,
+    142698.42297547215,
+    142724.33810526333,
+    142750.25441149093,
+    142776.17189404817,
+    142802.09055282827,
+    142828.01038772447,
+    142853.93139863008,
+    142879.85358543837,
+    142905.77694804268,
+    142931.70148633636,
+    142957.62720021277,
+    142983.55408956532,
+    143009.48215428743,
+    143035.41139427255,
+    143061.34180941415,
+    143087.27339960571,
+    143113.20616474075,
+    143139.14010471283,
+    143165.07521941551,
+    143191.01150874238,
+    143216.94897258704,
+    143242.88761084314,
+    143268.82742340435,
+    143294.76841016437,
+    143320.71057101688,
+    143346.65390585564,
+    143372.59841457437,
+    143398.54409706692,
+    143424.49095322701,
+    143450.43898294857,
+    143476.38818612538,
+    143502.33856265133,
+    143528.29011242036,
+    143554.24283532638,
+    143580.19673126334,
+    143606.1518001252,
+    143632.10804180597,
+    143658.06545619969,
+    143684.02404320039,
+    143709.98380270213,
+    143735.944734599,
+    143761.90683878519,
+    143787.87011515474,
+    143813.83456360188,
+    143839.8001840208,
+    143865.76697630569,
+    143891.73494035081,
+    143917.7040760504,
+    143943.67438329876,
+    143969.6458619902,
+    143995.61851201905,
+    144021.59233327967,
+    144047.56732566646,
+    144073.54348907378,
+    144099.52082339607,
+    144125.49932852783,
+    144151.4790043635,
+    144177.45985079758,
+    144203.44186772458,
+    144229.42505503909,
+    144255.40941263564,
+    144281.39494040885,
+    144307.38163825331,
+    144333.36950606373,
+    144359.35854373468,
+    144385.34875116093,
+    144411.34012823718,
+    144437.33267485813,
+    144463.32639091855,
+    144489.32127631325,
+    144515.31733093705,
+    144541.31455468474,
+    144567.3129474512,
+    144593.3125091313,
+    144619.31323961995,
+    144645.31513881206,
+    144671.31820660262,
+    144697.32244288657,
+    144723.32784755889,
+    144749.33442051467,
+    144775.34216164888,
+    144801.35107085665,
+    144827.36114803303,
+    144853.37239307314,
+    144879.38480587213,
+    144905.39838632516,
+    144931.41313432742,
+    144957.4290497741,
+    144983.44613256046,
+    145009.46438258173,
+    145035.48379973322,
+    145061.50438391021,
+    145087.52613500805,
+    145113.54905292206,
+    145139.57313754765,
+    145165.59838878017,
+    145191.62480651509,
+    145217.65239064783,
+    145243.68114107384,
+    145269.71105768863,
+    145295.74214038774,
+    145321.77438906668,
+    145347.80780362099,
+    145373.84238394629,
+    145399.87812993818,
+    145425.91504149229,
+    145451.95311850426,
+    145477.9923608698,
+    145504.03276848458,
+    145530.07434124436,
+    145556.11707904484,
+    145582.16098178181,
+    145608.20604935108,
+    145634.25228164849,
+    145660.29967856981,
+    145686.34824001096,
+    145712.39796586783,
+    145738.4488560363,
+    145764.50091041232,
+    145790.55412889185,
+    145816.60851137087,
+    145842.66405774537,
+    145868.72076791141,
+    145894.77864176501,
+    145920.83767920226,
+    145946.89788011924,
+    145972.95924441208,
+    145999.02177197693,
+    146025.08546270995,
+    146051.15031650732,
+    146077.21633326527,
+    146103.28351288004,
+    146129.35185524789,
+    146155.42136026506,
+    146181.49202782792,
+    146207.56385783272,
+    146233.63685017588,
+    146259.71100475377,
+    146285.78632146274,
+    146311.86280019928,
+    146337.94044085976,
+    146364.01924334071,
+    146390.09920753856,
+    146416.18033334985,
+    146442.26262067116,
+    146468.34606939898,
+    146494.43067942993,
+    146520.51645066062,
+    146546.60338298764,
+    146572.69147630769,
+    146598.78073051744,
+    146624.87114551352,
+    146650.96272119274,
+    146677.05545745179,
+    146703.14935418745,
+    146729.2444112965,
+    146755.34062867577,
+    146781.43800622207,
+    146807.53654383228,
+    146833.63624140329,
+    146859.73709883197,
+    146885.83911601527,
+    146911.94229285014,
+    146938.04662923355,
+    146964.15212506248,
+    146990.25878023397,
+    147016.36659464505,
+    147042.47556819281,
+    147068.58570077427,
+    147094.6969922866,
+    147120.80944262692,
+    147146.92305169237,
+    147173.03781938017,
+    147199.15374558745,
+    147225.27083021149,
+    147251.38907314953,
+    147277.50847429881,
+    147303.62903355664,
+    147329.75075082036,
+    147355.87362598727,
+    147381.99765895473,
+    147408.12284962015,
+    147434.24919788091,
+    147460.37670363448,
+    147486.50536677826,
+    147512.63518720976,
+    147538.76616482646,
+    147564.89829952587,
+    147591.03159120557,
+    147617.16603976308,
+    147643.30164509601,
+    147669.43840710199,
+    147695.57632567859,
+    147721.71540072354,
+    147747.85563213445,
+    147773.99701980909,
+    147800.13956364512,
+    147826.28326354033,
+    147852.42811939248,
+    147878.57413109933,
+    147904.72129855872,
+    147930.86962166851,
+    147957.01910032652,
+    147983.16973443062,
+    148009.32152387875,
+    148035.47446856883,
+    148061.62856839882,
+    148087.78382326665,
+    148113.94023307035,
+    148140.09779770792,
+    148166.25651707739,
+    148192.41639107687,
+    148218.57741960438,
+    148244.73960255808,
+    148270.90293983606,
+    148297.0674313365,
+    148323.23307695755,
+    148349.39987659742,
+    148375.56783015432,
+    148401.73693752653,
+    148427.90719861226,
+    148454.07861330983,
+    148480.25118151752,
+    148506.42490313368,
+    148532.59977805667,
+    148558.77580618486,
+    148584.95298741665,
+    148611.13132165043,
+    148637.31080878471,
+    148663.49144871789,
+    148689.6732413485,
+    148715.85618657502,
+    148742.040284296,
+    148768.22553440998,
+    148794.41193681557,
+    148820.59949141133,
+    148846.78819809589,
+    148872.97805676793,
+    148899.16906732606,
+    148925.36122966901,
+    148951.55454369547,
+    148977.74900930419,
+    149003.9446263939,
+    149030.1413948634,
+    149056.33931461151,
+    149082.53838553699,
+    149108.73860753875,
+    149134.9399805156,
+    149161.14250436646,
+    149187.34617899026,
+    149213.5510042859,
+    149239.75698015234,
+    149265.96410648854,
+    149292.17238319354,
+    149318.38181016635,
+    149344.59238730598,
+    149370.80411451156,
+    149397.01699168212,
+    149423.23101871679,
+    149449.44619551473,
+    149475.66252197503,
+    149501.87999799693,
+    149528.0986234796,
+    149554.31839832227,
+    149580.53932242419,
+    149606.76139568459,
+    149632.98461800278,
+    149659.20898927809,
+    149685.43450940982,
+    149711.66117829733,
+    149737.88899584001,
+    149764.11796193724,
+    149790.34807648844,
+    149816.57933939309,
+    149842.81175055061,
+    149869.04530986046,
+    149895.28001722222,
+    149921.51587253538,
+    149947.75287569952,
+    149973.99102661415,
+    150000.23032517891,
+    150026.47077129342,
+    150052.71236485732,
+    150078.95510577026,
+    150105.1989939319,
+    150131.444029242,
+    150157.69021160025,
+    150183.93754090639,
+    150210.18601706024,
+    150236.43563996154,
+    150262.68640951012,
+    150288.93832560582,
+    150315.19138814852,
+    150341.44559703805,
+    150367.70095217437,
+    150393.95745345735,
+    150420.21510078697,
+    150446.47389406321,
+    150472.73383318601,
+    150498.99491805542,
+    150525.25714857146,
+    150551.52052463419,
+    150577.78504614369,
+    150604.05071300003,
+    150630.31752510337,
+    150656.58548235384,
+    150682.85458465159,
+    150709.1248318968,
+    150735.39622398972,
+    150761.66876083051,
+    150787.9424423195,
+    150814.21726835691,
+    150840.49323884305,
+    150866.77035367821,
+    150893.04861276277,
+    150919.32801599705,
+    150945.60856328148,
+    150971.89025451642,
+    150998.17308960229,
+    151024.45706843957,
+    151050.74219092872,
+    151077.02845697021,
+    151103.31586646455,
+    151129.60441931229,
+    151155.894115414,
+    151182.1849546702,
+    151208.47693698155,
+    151234.77006224863,
+    151261.06433037209,
+    151287.35974125259,
+    151313.65629479082,
+    151339.95399088747,
+    151366.25282944329,
+    151392.55281035902,
+    151418.85393353543,
+    151445.1561988733,
+    151471.45960627345,
+    151497.76415563675,
+    151524.06984686397,
+    151550.37667985607,
+    151576.68465451393,
+    151602.99377073845,
+    151629.30402843058,
+    151655.61542749128,
+    151681.92796782157,
+    151708.24164932242,
+    151734.55647189484,
+    151760.87243543993,
+    151787.18953985872,
+    151813.50778505235,
+    151839.82717092187,
+    151866.14769736846,
+    151892.46936429327,
+    151918.79217159748,
+    151945.11611918229,
+    151971.44120694889,
+    151997.76743479856,
+    152024.09480263255,
+    152050.42331035214,
+    152076.75295785864,
+    152103.08374505339,
+    152129.41567183775,
+    152155.74873811303,
+    152182.08294378067,
+    152208.41828874208,
+    152234.75477289871,
+    152261.09239615197,
+    152287.43115840337,
+    152313.77105955439,
+    152340.11209950657,
+    152366.45427816146,
+    152392.79759542056,
+    152419.14205118554,
+    152445.48764535793,
+    152471.8343778394,
+    152498.18224853161,
+    152524.53125733617,
+    152550.88140415482,
+    152577.23268888926,
+    152603.58511144121,
+    152629.93867171241,
+    152656.29336960468,
+    152682.64920501978,
+    152709.00617785956,
+    152735.36428802583,
+    152761.72353542043,
+    152788.08391994529,
+    152814.44544150229,
+    152840.80809999333,
+    152867.17189532038,
+    152893.53682738543,
+    152919.90289609041,
+    152946.27010133737,
+    152972.63844302832,
+    152999.00792106529,
+    153025.37853535041,
+    153051.7502857857,
+    153078.12317227334,
+    153104.4971947154,
+    153130.8723530141,
+    153157.24864707157,
+    153183.62607679001,
+    153210.00464207167,
+    153236.38434281875,
+    153262.76517893354,
+    153289.14715031831,
+    153315.53025687535,
+    153341.91449850702,
+    153368.2998751156,
+    153394.68638660354,
+    153421.07403287315,
+    153447.46281382689,
+    153473.85272936718,
+    153500.24377939643,
+    153526.63596381716,
+    153553.02928253182,
+    153579.42373544298,
+    153605.81932245308,
+    153632.21604346478,
+    153658.61389838057,
+    153685.0128871031,
+    153711.41300953497,
+    153737.81426557881,
+    153764.21665513728,
+    153790.62017811305,
+    153817.02483440886,
+    153843.43062392739,
+    153869.83754657139,
+    153896.24560224367,
+    153922.65479084692,
+    153949.06511228404,
+    153975.4765664578,
+    154001.88915327107,
+    154028.30287262669,
+    154054.71772442761,
+    154081.13370857667,
+    154107.55082497682,
+    154133.96907353101,
+    154160.38845414223,
+    154186.80896671346,
+    154213.23061114774,
+    154239.65338734805,
+    154266.07729521746,
+    154292.50233465908,
+    154318.92850557598,
+    154345.35580787127,
+    154371.7842414481,
+    154398.21380620965,
+    154424.64450205903,
+    154451.07632889951,
+    154477.50928663427,
+    154503.94337516659,
+    154530.37859439969,
+    154556.81494423689,
+    154583.25242458144,
+    154609.69103533673,
+    154636.13077640603,
+    154662.57164769279,
+    154689.01364910032,
+    154715.45678053208,
+    154741.90104189145,
+    154768.34643308193,
+    154794.79295400696,
+    154821.24060457002,
+    154847.68938467462,
+    154874.13929422433,
+    154900.59033312264,
+    154927.04250127316,
+    154953.49579857948,
+    154979.95022494521,
+    155006.40578027396,
+    155032.86246446942,
+    155059.32027743524,
+    155085.77921907514,
+    155112.2392892928,
+    155138.70048799197,
+    155165.16281507642,
+    155191.62627044989,
+    155218.09085401625,
+    155244.55656567923,
+    155271.02340534274,
+    155297.49137291059,
+    155323.96046828668,
+    155350.4306913749,
+    155376.90204207919,
+    155403.37452030348,
+    155429.84812595171,
+    155456.32285892789,
+    155482.79871913602,
+    155509.27570648011,
+    155535.75382086422,
+    155562.23306219239,
+    155588.71343036872,
+    155615.19492529731,
+    155641.67754688227,
+    155668.16129502779,
+    155694.64616963797,
+    155721.13217061706,
+    155747.61929786921,
+    155774.10755129869,
+    155800.59693080973,
+    155827.08743630661,
+    155853.57906769359,
+    155880.07182487496,
+    155906.56570775513,
+    155933.06071623837,
+    155959.55685022907,
+    155986.05410963166,
+    156012.5524943505,
+    156039.05200429002,
+    156065.55263935472,
+    156092.054399449,
+    156118.5572844774,
+    156145.06129434443,
+    156171.5664289546,
+    156198.07268821247,
+    156224.5800720226,
+    156251.08858028959,
+    156277.59821291809,
+    156304.10896981266,
+    156330.62085087801,
+    156357.1338560188,
+    156383.64798513969,
+    156410.16323814544,
+    156436.67961494075,
+    156463.1971154304,
+    156489.71573951913,
+    156516.23548711176,
+    156542.75635811311,
+    156569.27835242799,
+    156595.80146996127,
+    156622.32571061782,
+    156648.85107430254,
+    156675.37756092031,
+    156701.90517037612,
+    156728.43390257491,
+    156754.96375742162,
+    156781.49473482129,
+    156808.02683467892,
+    156834.5600568995,
+    156861.09440138817,
+    156887.62986804993,
+    156914.16645678994,
+    156940.70416751326,
+    156967.24300012505,
+    156993.78295453047,
+    157020.32403063469,
+    157046.8662283429,
+    157073.40954756032,
+    157099.9539881922,
+    157126.49955014378,
+    157153.04623332032,
+    157179.59403762716,
+    157206.14296296958,
+    157232.69300925292,
+    157259.24417638258,
+    157285.79646426387,
+    157312.34987280221,
+    157338.90440190304,
+    157365.46005147175,
+    157392.01682141385,
+    157418.57471163478,
+    157445.13372204005,
+    157471.69385253513,
+    157498.25510302564,
+    157524.81747341706,
+    157551.38096361503,
+    157577.9455735251,
+    157604.51130305286,
+    157631.07815210402,
+    157657.64612058419,
+    157684.21520839902,
+    157710.78541545427,
+    157737.35674165559,
+    157763.92918690876,
+    157790.50275111952,
+    157817.07743419363,
+    157843.65323603692,
+    157870.23015655516,
+    157896.80819565422,
+    157923.3873532399,
+    157949.96762921812,
+    157976.54902349479,
+    158003.13153597576,
+    158029.71516656701,
+    158056.29991517449,
+    158082.88578170416,
+    158109.47276606198,
+    158136.06086815402,
+    158162.65008788629,
+    158189.24042516484,
+    158215.83187989573,
+    158242.42445198505,
+    158269.01814133892,
+    158295.61294786347,
+    158322.20887146486,
+    158348.80591204923,
+    158375.4040695228,
+    158402.00334379176,
+    158428.60373476235,
+    158455.2052423408,
+    158481.80786643337,
+    158508.41160694641,
+    158535.01646378616,
+    158561.62243685898,
+    158588.2295260712,
+    158614.8377313292,
+    158641.44705253936,
+    158668.05748960807,
+    158694.66904244179,
+    158721.28171094693,
+    158747.89549502998,
+    158774.5103945974,
+    158801.12640955573,
+    158827.74353981143,
+    158854.36178527112,
+    158880.9811458413,
+    158907.60162142856,
+    158934.22321193956,
+    158960.84591728085,
+    158987.46973735912,
+    159014.09467208097,
+    159040.72072135314,
+    159067.3478850823,
+    159093.97616317519,
+    159120.60555553852,
+    159147.23606207906,
+    159173.8676827036,
+    159200.50041731889,
+    159227.13426583182,
+    159253.76922814918,
+    159280.40530417781,
+    159307.04249382461,
+    159333.68079699649,
+    159360.32021360032,
+    159386.96074354305,
+    159413.60238673165,
+    159440.24514307309,
+    159466.88901247433,
+    159493.53399484244,
+    159520.18009008438,
+    159546.82729810724,
+    159573.47561881805,
+    159600.12505212394,
+    159626.77559793202,
+    159653.42725614941,
+    159680.08002668325,
+    159706.73390944069,
+    159733.38890432892,
+    159760.04501125516,
+    159786.70223012666,
+    159813.36056085059,
+    159840.02000333427,
+    159866.68055748497,
+    159893.34222320997,
+    159920.00500041663,
+    159946.66888901225,
+    159973.33388890422,
+    159999.99999999988,
+    160026.66722220668,
+    160053.33555543202,
+    160080.0049995833,
+    160106.67555456801,
+    160133.3472202936,
+    160160.0199966676,
+    160186.6938835975,
+    160213.36888099083,
+    160240.04498875517,
+    160266.72220679806,
+    160293.40053502709,
+    160320.07997334987,
+    160346.76052167406,
+    160373.44217990729,
+    160400.1249479572,
+    160426.80882573154,
+    160453.49381313793,
+    160480.17991008417,
+    160506.86711647795,
+    160533.55543222709,
+    160560.24485723933,
+    160586.93539142248,
+    160613.62703468435,
+    160640.31978693281,
+    160667.01364807569,
+    160693.70861802087,
+    160720.40469667627,
+    160747.1018839498,
+    160773.80017974938,
+    160800.49958398298,
+    160827.20009655855,
+    160853.90171738411,
+    160880.60444636765,
+    160907.30828341722,
+    160934.01322844089,
+    160960.71928134665,
+    160987.42644204266,
+    161014.13471043704,
+    161040.84408643784,
+    161067.55456995327,
+    161094.26616089148,
+    161120.97885916062,
+    161147.69266466892,
+    161174.40757732463,
+    161201.12359703594,
+    161227.84072371112,
+    161254.55895725847,
+    161281.27829758628,
+    161307.99874460287,
+    161334.72029821656,
+    161361.44295833571,
+    161388.1667248687,
+    161414.89159772391,
+    161441.61757680977,
+    161468.34466203468,
+    161495.07285330712,
+    161521.80215053557,
+    161548.53255362847,
+    161575.26406249436,
+    161601.99667704175,
+    161628.7303971792,
+    161655.46522281526,
+    161682.20115385848,
+    161708.93819021754,
+    161735.67633180099,
+    161762.41557851751,
+    161789.15593027571,
+    161815.89738698432,
+    161842.63994855201,
+    161869.38361488748,
+    161896.1283858995,
+    161922.87426149679,
+    161949.62124158812,
+    161976.36932608229,
+    162003.1185148881,
+    162029.8688079144,
+    162056.62020507001,
+    162083.37270626382,
+    162110.12631140469,
+    162136.88102040152,
+    162163.63683316324,
+    162190.39374959879,
+    162217.15176961714,
+    162243.91089312723,
+    162270.67112003808,
+    162297.43245025873,
+    162324.19488369819,
+    162350.9584202655,
+    162377.72305986975,
+    162404.48880242003,
+    162431.25564782543,
+    162458.02359599507,
+    162484.79264683815,
+    162511.56280026378,
+    162538.33405618116,
+    162565.10641449949,
+    162591.87987512801,
+    162618.65443797593,
+    162645.43010295252,
+    162672.20686996708,
+    162698.98473892888,
+    162725.76370974723,
+    162752.54378233149,
+    162779.32495659095,
+    162806.10723243505,
+    162832.89060977317,
+    162859.67508851466,
+    162886.46066856899,
+    162913.24734984562,
+    162940.03513225398,
+    162966.82401570358,
+    162993.6140001039,
+    163020.40508536444,
+    163047.19727139481,
+    163073.99055810447,
+    163100.78494540305,
+    163127.58043320014,
+    163154.37702140535,
+    163181.17470992831,
+    163207.97349867865,
+    163234.77338756606,
+    163261.57437650024,
+    163288.37646539087,
+    163315.17965414765,
+    163341.98394268038,
+    163368.78933089875,
+    163395.59581871261,
+    163422.40340603172,
+    163449.2120927659,
+    163476.02187882498,
+    163502.83276411882,
+    163529.6447485573,
+    163556.45783205028,
+    163583.2720145077,
+    163610.08729583945,
+    163636.90367595552,
+    163663.72115476584,
+    163690.53973218042,
+    163717.35940810922,
+    163744.18018246227,
+    163771.00205514964,
+    163797.82502608138,
+    163824.64909516752,
+    163851.4742623182,
+    163878.3005274435,
+    163905.12789045356,
+    163931.95635125853,
+    163958.78590976857,
+    163985.61656589387,
+    164012.44831954464,
+    164039.28117063109,
+    164066.11511906344,
+    164092.95016475199,
+    164119.78630760699,
+    164146.62354753874,
+    164173.46188445756,
+    164200.30131827376,
+    164227.14184889771,
+    164253.98347623978,
+    164280.82620021031,
+    164307.67002071979,
+    164334.51493767856,
+    164361.3609509971,
+    164388.20806058586,
+    164415.05626635533,
+    164441.905568216,
+    164468.75596607837,
+    164495.607459853,
+    164522.4600494504,
+    164549.31373478117,
+    164576.16851575591,
+    164603.02439228518,
+    164629.88136427966,
+    164656.73943164994,
+    164683.59859430668,
+    164710.45885216061,
+    164737.32020512238,
+    164764.1826531027,
+    164791.04619601235,
+    164817.91083376206,
+    164844.77656626256,
+    164871.64339342469,
+    164898.51131515924,
+    164925.38033137703,
+    164952.25044198887,
+    164979.1216469057,
+    165005.9939460383,
+    165032.86733929763,
+    165059.7418265946,
+    165086.61740784015,
+    165113.4940829452
 };
 
 #else
 
+#ifdef BIG_IQ_TABLE
+#define IQ_TABLE_SIZE  8192
+#else
 #define IQ_TABLE_SIZE  1026
+#endif
 
-static real_t iq_table[IQ_TABLE_SIZE] =
+ALIGN static const real_t iq_table[IQ_TABLE_SIZE] =
 {
     REAL_CONST(0.0),
     REAL_CONST(1.0/8.0),
@@ -1337,6 +9277,7174 @@
     REAL_CONST(10307.836270711066/8.0),
     REAL_CONST(10321.273240738796/8.0),
     REAL_CONST(10334.71458549278/8.0)
+#ifdef BIG_IQ_TABLE
+   ,REAL_CONST(10348.160302127204/8.0),
+    REAL_CONST(10361.610387800878/8.0),
+    REAL_CONST(10375.064839677221/8.0),
+    REAL_CONST(10388.523654924258/8.0),
+    REAL_CONST(10401.986830714593/8.0),
+    REAL_CONST(10415.454364225412/8.0),
+    REAL_CONST(10428.926252638465/8.0),
+    REAL_CONST(10442.402493140049/8.0),
+    REAL_CONST(10455.883082921007/8.0),
+    REAL_CONST(10469.368019176709/8.0),
+    REAL_CONST(10482.85729910704/8.0),
+    REAL_CONST(10496.350919916393/8.0),
+    REAL_CONST(10509.848878813653/8.0),
+    REAL_CONST(10523.351173012188/8.0),
+    REAL_CONST(10536.857799729838/8.0),
+    REAL_CONST(10550.3687561889/8.0),
+    REAL_CONST(10563.884039616123/8.0),
+    REAL_CONST(10577.403647242685/8.0),
+    REAL_CONST(10590.927576304197/8.0),
+    REAL_CONST(10604.455824040679/8.0),
+    REAL_CONST(10617.988387696556/8.0),
+    REAL_CONST(10631.525264520642/8.0),
+    REAL_CONST(10645.066451766135/8.0),
+    REAL_CONST(10658.611946690598/8.0),
+    REAL_CONST(10672.161746555956/8.0),
+    REAL_CONST(10685.715848628475/8.0),
+    REAL_CONST(10699.274250178762/8.0),
+    REAL_CONST(10712.836948481747/8.0),
+    REAL_CONST(10726.403940816675/8.0),
+    REAL_CONST(10739.975224467091/8.0),
+    REAL_CONST(10753.550796720834/8.0),
+    REAL_CONST(10767.130654870027/8.0),
+    REAL_CONST(10780.714796211059/8.0),
+    REAL_CONST(10794.303218044579/8.0),
+    REAL_CONST(10807.895917675487/8.0),
+    REAL_CONST(10821.492892412922/8.0),
+    REAL_CONST(10835.094139570248/8.0),
+    REAL_CONST(10848.699656465047/8.0),
+    REAL_CONST(10862.309440419107/8.0),
+    REAL_CONST(10875.923488758415/8.0),
+    REAL_CONST(10889.541798813138/8.0),
+    REAL_CONST(10903.16436791762/8.0),
+    REAL_CONST(10916.791193410372/8.0),
+    REAL_CONST(10930.422272634056/8.0),
+    REAL_CONST(10944.05760293548/8.0),
+    REAL_CONST(10957.697181665582/8.0),
+    REAL_CONST(10971.341006179427/8.0),
+    REAL_CONST(10984.98907383619/8.0),
+    REAL_CONST(10998.641381999149/8.0),
+    REAL_CONST(11012.297928035676/8.0),
+    REAL_CONST(11025.958709317223/8.0),
+    REAL_CONST(11039.623723219316/8.0),
+    REAL_CONST(11053.292967121541/8.0),
+    REAL_CONST(11066.966438407539/8.0),
+    REAL_CONST(11080.64413446499/8.0),
+    REAL_CONST(11094.326052685608/8.0),
+    REAL_CONST(11108.012190465128/8.0),
+    REAL_CONST(11121.702545203296/8.0),
+    REAL_CONST(11135.397114303863/8.0),
+    REAL_CONST(11149.095895174571/8.0),
+    REAL_CONST(11162.798885227143/8.0),
+    REAL_CONST(11176.506081877278/8.0),
+    REAL_CONST(11190.217482544635/8.0),
+    REAL_CONST(11203.933084652828/8.0),
+    REAL_CONST(11217.652885629415/8.0),
+    REAL_CONST(11231.376882905886/8.0),
+    REAL_CONST(11245.105073917659/8.0),
+    REAL_CONST(11258.837456104062/8.0),
+    REAL_CONST(11272.574026908333/8.0),
+    REAL_CONST(11286.314783777601/8.0),
+    REAL_CONST(11300.059724162888/8.0),
+    REAL_CONST(11313.808845519083/8.0),
+    REAL_CONST(11327.562145304952/8.0),
+    REAL_CONST(11341.319620983111/8.0),
+    REAL_CONST(11355.081270020033/8.0),
+    REAL_CONST(11368.847089886023/8.0),
+    REAL_CONST(11382.617078055218/8.0),
+    REAL_CONST(11396.391232005579/8.0),
+    REAL_CONST(11410.169549218874/8.0),
+    REAL_CONST(11423.952027180676/8.0),
+    REAL_CONST(11437.738663380349/8.0),
+    REAL_CONST(11451.529455311042/8.0),
+    REAL_CONST(11465.324400469679/8.0),
+    REAL_CONST(11479.123496356951/8.0),
+    REAL_CONST(11492.926740477304/8.0),
+    REAL_CONST(11506.734130338931/8.0),
+    REAL_CONST(11520.545663453764/8.0),
+    REAL_CONST(11534.361337337466/8.0),
+    REAL_CONST(11548.181149509423/8.0),
+    REAL_CONST(11562.005097492724/8.0),
+    REAL_CONST(11575.83317881417/8.0),
+    REAL_CONST(11589.665391004253/8.0),
+    REAL_CONST(11603.501731597149/8.0),
+    REAL_CONST(11617.342198130715/8.0),
+    REAL_CONST(11631.186788146468/8.0),
+    REAL_CONST(11645.035499189589/8.0),
+    REAL_CONST(11658.888328808911/8.0),
+    REAL_CONST(11672.745274556904/8.0),
+    REAL_CONST(11686.606333989675/8.0),
+    REAL_CONST(11700.471504666955/8.0),
+    REAL_CONST(11714.340784152086/8.0),
+    REAL_CONST(11728.214170012021/8.0),
+    REAL_CONST(11742.091659817312/8.0),
+    REAL_CONST(11755.973251142101/8.0),
+    REAL_CONST(11769.858941564111/8.0),
+    REAL_CONST(11783.748728664636/8.0),
+    REAL_CONST(11797.642610028539/8.0),
+    REAL_CONST(11811.540583244237/8.0),
+    REAL_CONST(11825.442645903697/8.0),
+    REAL_CONST(11839.34879560242/8.0),
+    REAL_CONST(11853.259029939445/8.0),
+    REAL_CONST(11867.173346517333/8.0),
+    REAL_CONST(11881.091742942155/8.0),
+    REAL_CONST(11895.014216823492/8.0),
+    REAL_CONST(11908.940765774427/8.0),
+    REAL_CONST(11922.871387411526/8.0),
+    REAL_CONST(11936.806079354839/8.0),
+    REAL_CONST(11950.744839227897/8.0),
+    REAL_CONST(11964.687664657684/8.0),
+    REAL_CONST(11978.634553274653/8.0),
+    REAL_CONST(11992.585502712702/8.0),
+    REAL_CONST(12006.540510609168/8.0),
+    REAL_CONST(12020.499574604828/8.0),
+    REAL_CONST(12034.462692343877/8.0),
+    REAL_CONST(12048.429861473938/8.0),
+    REAL_CONST(12062.401079646032/8.0),
+    REAL_CONST(12076.376344514589/8.0),
+    REAL_CONST(12090.355653737433/8.0),
+    REAL_CONST(12104.339004975769/8.0),
+    REAL_CONST(12118.326395894188/8.0),
+    REAL_CONST(12132.317824160644/8.0),
+    REAL_CONST(12146.313287446457/8.0),
+    REAL_CONST(12160.312783426305/8.0),
+    REAL_CONST(12174.316309778205/8.0),
+    REAL_CONST(12188.323864183525/8.0),
+    REAL_CONST(12202.335444326955/8.0),
+    REAL_CONST(12216.351047896511/8.0),
+    REAL_CONST(12230.370672583531/8.0),
+    REAL_CONST(12244.394316082657/8.0),
+    REAL_CONST(12258.421976091831/8.0),
+    REAL_CONST(12272.453650312296/8.0),
+    REAL_CONST(12286.489336448574/8.0),
+    REAL_CONST(12300.529032208471/8.0),
+    REAL_CONST(12314.572735303058/8.0),
+    REAL_CONST(12328.620443446678/8.0),
+    REAL_CONST(12342.672154356922/8.0),
+    REAL_CONST(12356.727865754638/8.0),
+    REAL_CONST(12370.787575363909/8.0),
+    REAL_CONST(12384.851280912055/8.0),
+    REAL_CONST(12398.918980129623/8.0),
+    REAL_CONST(12412.990670750381/8.0),
+    REAL_CONST(12427.066350511306/8.0),
+    REAL_CONST(12441.146017152583/8.0),
+    REAL_CONST(12455.229668417589/8.0),
+    REAL_CONST(12469.317302052901/8.0),
+    REAL_CONST(12483.40891580827/8.0),
+    REAL_CONST(12497.50450743663/8.0),
+    REAL_CONST(12511.604074694078/8.0),
+    REAL_CONST(12525.707615339878/8.0),
+    REAL_CONST(12539.815127136444/8.0),
+    REAL_CONST(12553.926607849342/8.0),
+    REAL_CONST(12568.042055247275/8.0),
+    REAL_CONST(12582.161467102082/8.0),
+    REAL_CONST(12596.284841188726/8.0),
+    REAL_CONST(12610.41217528529/8.0),
+    REAL_CONST(12624.543467172971/8.0),
+    REAL_CONST(12638.678714636069/8.0),
+    REAL_CONST(12652.817915461985/8.0),
+    REAL_CONST(12666.961067441209/8.0),
+    REAL_CONST(12681.108168367316/8.0),
+    REAL_CONST(12695.259216036962/8.0),
+    REAL_CONST(12709.414208249869/8.0),
+    REAL_CONST(12723.573142808827/8.0),
+    REAL_CONST(12737.736017519681/8.0),
+    REAL_CONST(12751.902830191326/8.0),
+    REAL_CONST(12766.073578635704/8.0),
+    REAL_CONST(12780.248260667788/8.0),
+    REAL_CONST(12794.426874105588/8.0),
+    REAL_CONST(12808.609416770132/8.0),
+    REAL_CONST(12822.795886485468/8.0),
+    REAL_CONST(12836.986281078653/8.0),
+    REAL_CONST(12851.180598379744/8.0),
+    REAL_CONST(12865.378836221802/8.0),
+    REAL_CONST(12879.580992440871/8.0),
+    REAL_CONST(12893.787064875984/8.0),
+    REAL_CONST(12907.997051369144/8.0),
+    REAL_CONST(12922.210949765335/8.0),
+    REAL_CONST(12936.428757912496/8.0),
+    REAL_CONST(12950.650473661524/8.0),
+    REAL_CONST(12964.876094866273/8.0),
+    REAL_CONST(12979.105619383534/8.0),
+    REAL_CONST(12993.339045073039/8.0),
+    REAL_CONST(13007.576369797454/8.0),
+    REAL_CONST(13021.817591422368/8.0),
+    REAL_CONST(13036.062707816285/8.0),
+    REAL_CONST(13050.311716850629/8.0),
+    REAL_CONST(13064.564616399723/8.0),
+    REAL_CONST(13078.821404340792/8.0),
+    REAL_CONST(13093.082078553954/8.0),
+    REAL_CONST(13107.346636922217/8.0),
+    REAL_CONST(13121.615077331464/8.0),
+    REAL_CONST(13135.887397670458/8.0),
+    REAL_CONST(13150.163595830827/8.0),
+    REAL_CONST(13164.44366970706/8.0),
+    REAL_CONST(13178.727617196502/8.0),
+    REAL_CONST(13193.015436199352/8.0),
+    REAL_CONST(13207.307124618648/8.0),
+    REAL_CONST(13221.602680360265/8.0),
+    REAL_CONST(13235.902101332911/8.0),
+    REAL_CONST(13250.205385448118/8.0),
+    REAL_CONST(13264.512530620239/8.0),
+    REAL_CONST(13278.823534766434/8.0),
+    REAL_CONST(13293.138395806676/8.0),
+    REAL_CONST(13307.457111663734/8.0),
+    REAL_CONST(13321.779680263176/8.0),
+    REAL_CONST(13336.106099533356/8.0),
+    REAL_CONST(13350.436367405409/8.0),
+    REAL_CONST(13364.77048181325/8.0),
+    REAL_CONST(13379.108440693562/8.0),
+    REAL_CONST(13393.450241985796/8.0),
+    REAL_CONST(13407.795883632158/8.0),
+    REAL_CONST(13422.145363577607/8.0),
+    REAL_CONST(13436.498679769853/8.0),
+    REAL_CONST(13450.855830159346/8.0),
+    REAL_CONST(13465.216812699266/8.0),
+    REAL_CONST(13479.581625345529/8.0),
+    REAL_CONST(13493.950266056772/8.0),
+    REAL_CONST(13508.32273279435/8.0),
+    REAL_CONST(13522.699023522329/8.0),
+    REAL_CONST(13537.079136207483/8.0),
+    REAL_CONST(13551.463068819286/8.0),
+    REAL_CONST(13565.850819329906/8.0),
+    REAL_CONST(13580.2423857142/8.0),
+    REAL_CONST(13594.63776594971/8.0),
+    REAL_CONST(13609.036958016657/8.0),
+    REAL_CONST(13623.439959897927/8.0),
+    REAL_CONST(13637.846769579081/8.0),
+    REAL_CONST(13652.257385048335/8.0),
+    REAL_CONST(13666.67180429656/8.0),
+    REAL_CONST(13681.090025317284/8.0),
+    REAL_CONST(13695.512046106669/8.0),
+    REAL_CONST(13709.937864663521/8.0),
+    REAL_CONST(13724.367478989278/8.0),
+    REAL_CONST(13738.800887088004/8.0),
+    REAL_CONST(13753.238086966385/8.0),
+    REAL_CONST(13767.679076633727/8.0),
+    REAL_CONST(13782.123854101939/8.0),
+    REAL_CONST(13796.572417385545/8.0),
+    REAL_CONST(13811.024764501659/8.0),
+    REAL_CONST(13825.480893469998/8.0),
+    REAL_CONST(13839.94080231286/8.0),
+    REAL_CONST(13854.404489055134/8.0),
+    REAL_CONST(13868.871951724283/8.0),
+    REAL_CONST(13883.34318835034/8.0),
+    REAL_CONST(13897.818196965914/8.0),
+    REAL_CONST(13912.296975606168/8.0),
+    REAL_CONST(13926.779522308825/8.0),
+    REAL_CONST(13941.26583511416/8.0),
+    REAL_CONST(13955.755912064991/8.0),
+    REAL_CONST(13970.249751206682/8.0),
+    REAL_CONST(13984.747350587126/8.0),
+    REAL_CONST(13999.248708256751/8.0),
+    REAL_CONST(14013.753822268511/8.0),
+    REAL_CONST(14028.262690677873/8.0),
+    REAL_CONST(14042.775311542828/8.0),
+    REAL_CONST(14057.291682923867/8.0),
+    REAL_CONST(14071.811802883994/8.0),
+    REAL_CONST(14086.335669488704/8.0),
+    REAL_CONST(14100.863280805994/8.0),
+    REAL_CONST(14115.394634906341/8.0),
+    REAL_CONST(14129.92972986271/8.0),
+    REAL_CONST(14144.468563750548/8.0),
+    REAL_CONST(14159.01113464777/8.0),
+    REAL_CONST(14173.55744063476/8.0),
+    REAL_CONST(14188.107479794369/8.0),
+    REAL_CONST(14202.661250211901/8.0),
+    REAL_CONST(14217.218749975118/8.0),
+    REAL_CONST(14231.779977174227/8.0),
+    REAL_CONST(14246.344929901879/8.0),
+    REAL_CONST(14260.913606253163/8.0),
+    REAL_CONST(14275.486004325601/8.0),
+    REAL_CONST(14290.062122219146/8.0),
+    REAL_CONST(14304.641958036171/8.0),
+    REAL_CONST(14319.225509881464/8.0),
+    REAL_CONST(14333.812775862236/8.0),
+    REAL_CONST(14348.403754088098/8.0),
+    REAL_CONST(14362.998442671067/8.0),
+    REAL_CONST(14377.59683972556/8.0),
+    REAL_CONST(14392.198943368388/8.0),
+    REAL_CONST(14406.804751718748/8.0),
+    REAL_CONST(14421.414262898223/8.0),
+    REAL_CONST(14436.027475030774/8.0),
+    REAL_CONST(14450.64438624274/8.0),
+    REAL_CONST(14465.264994662828/8.0),
+    REAL_CONST(14479.889298422106/8.0),
+    REAL_CONST(14494.517295654005/8.0),
+    REAL_CONST(14509.148984494313/8.0),
+    REAL_CONST(14523.784363081166/8.0),
+    REAL_CONST(14538.423429555049/8.0),
+    REAL_CONST(14553.066182058781/8.0),
+    REAL_CONST(14567.712618737527/8.0),
+    REAL_CONST(14582.362737738777/8.0),
+    REAL_CONST(14597.016537212348/8.0),
+    REAL_CONST(14611.674015310382/8.0),
+    REAL_CONST(14626.33517018734/8.0),
+    REAL_CONST(14640.999999999993/8.0),
+    REAL_CONST(14655.668502907418/8.0),
+    REAL_CONST(14670.340677071003/8.0),
+    REAL_CONST(14685.016520654426/8.0),
+    REAL_CONST(14699.696031823671/8.0),
+    REAL_CONST(14714.379208746999/8.0),
+    REAL_CONST(14729.066049594967/8.0),
+    REAL_CONST(14743.756552540408/8.0),
+    REAL_CONST(14758.45071575843/8.0),
+    REAL_CONST(14773.148537426418/8.0),
+    REAL_CONST(14787.850015724018/8.0),
+    REAL_CONST(14802.555148833142/8.0),
+    REAL_CONST(14817.263934937961/8.0),
+    REAL_CONST(14831.976372224897/8.0),
+    REAL_CONST(14846.692458882624/8.0),
+    REAL_CONST(14861.41219310206/8.0),
+    REAL_CONST(14876.135573076363/8.0),
+    REAL_CONST(14890.862597000923/8.0),
+    REAL_CONST(14905.593263073371/8.0),
+    REAL_CONST(14920.327569493558/8.0),
+    REAL_CONST(14935.065514463557/8.0),
+    REAL_CONST(14949.807096187662/8.0),
+    REAL_CONST(14964.552312872382/8.0),
+    REAL_CONST(14979.301162726431/8.0),
+    REAL_CONST(14994.053643960735/8.0),
+    REAL_CONST(15008.809754788414/8.0),
+    REAL_CONST(15023.569493424788/8.0),
+    REAL_CONST(15038.332858087369/8.0),
+    REAL_CONST(15053.099846995858/8.0),
+    REAL_CONST(15067.870458372134/8.0),
+    REAL_CONST(15082.644690440264/8.0),
+    REAL_CONST(15097.422541426484/8.0),
+    REAL_CONST(15112.204009559202/8.0),
+    REAL_CONST(15126.989093068994/8.0),
+    REAL_CONST(15141.777790188597/8.0),
+    REAL_CONST(15156.570099152905/8.0),
+    REAL_CONST(15171.366018198967/8.0),
+    REAL_CONST(15186.165545565986/8.0),
+    REAL_CONST(15200.968679495301/8.0),
+    REAL_CONST(15215.775418230402/8.0),
+    REAL_CONST(15230.585760016909/8.0),
+    REAL_CONST(15245.399703102579/8.0),
+    REAL_CONST(15260.217245737298/8.0),
+    REAL_CONST(15275.038386173073/8.0),
+    REAL_CONST(15289.863122664035/8.0),
+    REAL_CONST(15304.691453466432/8.0),
+    REAL_CONST(15319.523376838621/8.0),
+    REAL_CONST(15334.358891041069/8.0),
+    REAL_CONST(15349.197994336346/8.0),
+    REAL_CONST(15364.040684989128/8.0),
+    REAL_CONST(15378.886961266177/8.0),
+    REAL_CONST(15393.736821436356/8.0),
+    REAL_CONST(15408.590263770609/8.0),
+    REAL_CONST(15423.447286541972/8.0),
+    REAL_CONST(15438.307888025554/8.0),
+    REAL_CONST(15453.172066498542/8.0),
+    REAL_CONST(15468.039820240196/8.0),
+    REAL_CONST(15482.91114753184/8.0),
+    REAL_CONST(15497.786046656869/8.0),
+    REAL_CONST(15512.664515900733/8.0),
+    REAL_CONST(15527.546553550939/8.0),
+    REAL_CONST(15542.432157897045/8.0),
+    REAL_CONST(15557.32132723066/8.0),
+    REAL_CONST(15572.214059845435/8.0),
+    REAL_CONST(15587.110354037064/8.0),
+    REAL_CONST(15602.010208103273/8.0),
+    REAL_CONST(15616.913620343823/8.0),
+    REAL_CONST(15631.820589060506/8.0),
+    REAL_CONST(15646.731112557136/8.0),
+    REAL_CONST(15661.645189139546/8.0),
+    REAL_CONST(15676.562817115593/8.0),
+    REAL_CONST(15691.483994795139/8.0),
+    REAL_CONST(15706.408720490062/8.0),
+    REAL_CONST(15721.336992514242/8.0),
+    REAL_CONST(15736.268809183561/8.0),
+    REAL_CONST(15751.204168815901/8.0),
+    REAL_CONST(15766.143069731135/8.0),
+    REAL_CONST(15781.085510251132/8.0),
+    REAL_CONST(15796.03148869974/8.0),
+    REAL_CONST(15810.981003402798/8.0),
+    REAL_CONST(15825.934052688119/8.0),
+    REAL_CONST(15840.890634885489/8.0),
+    REAL_CONST(15855.850748326673/8.0),
+    REAL_CONST(15870.814391345401/8.0),
+    REAL_CONST(15885.781562277361/8.0),
+    REAL_CONST(15900.752259460214/8.0),
+    REAL_CONST(15915.726481233565/8.0),
+    REAL_CONST(15930.704225938984/8.0),
+    REAL_CONST(15945.685491919978/8.0),
+    REAL_CONST(15960.670277522009/8.0),
+    REAL_CONST(15975.658581092481/8.0),
+    REAL_CONST(15990.65040098073/8.0),
+    REAL_CONST(16005.645735538035/8.0),
+    REAL_CONST(16020.644583117599/8.0),
+    REAL_CONST(16035.646942074556/8.0),
+    REAL_CONST(16050.652810765967/8.0),
+    REAL_CONST(16065.662187550806/8.0),
+    REAL_CONST(16080.675070789974/8.0),
+    REAL_CONST(16095.691458846273/8.0),
+    REAL_CONST(16110.711350084424/8.0),
+    REAL_CONST(16125.734742871053/8.0),
+    REAL_CONST(16140.761635574685/8.0),
+    REAL_CONST(16155.792026565747/8.0),
+    REAL_CONST(16170.825914216561/8.0),
+    REAL_CONST(16185.863296901338/8.0),
+    REAL_CONST(16200.904172996183/8.0),
+    REAL_CONST(16215.948540879079/8.0),
+    REAL_CONST(16230.996398929899/8.0),
+    REAL_CONST(16246.047745530386/8.0),
+    REAL_CONST(16261.102579064163/8.0),
+    REAL_CONST(16276.160897916721/8.0),
+    REAL_CONST(16291.22270047542/8.0),
+    REAL_CONST(16306.287985129484/8.0),
+    REAL_CONST(16321.356750269995/8.0),
+    REAL_CONST(16336.428994289896/8.0),
+    REAL_CONST(16351.504715583982/8.0),
+    REAL_CONST(16366.5839125489/8.0),
+    REAL_CONST(16381.666583583141/8.0),
+    REAL_CONST(16396.752727087041/8.0),
+    REAL_CONST(16411.842341462776/8.0),
+    REAL_CONST(16426.935425114363/8.0),
+    REAL_CONST(16442.031976447644/8.0),
+    REAL_CONST(16457.131993870298/8.0),
+    REAL_CONST(16472.235475791829/8.0),
+    REAL_CONST(16487.342420623561/8.0),
+    REAL_CONST(16502.452826778641/8.0),
+    REAL_CONST(16517.566692672033/8.0),
+    REAL_CONST(16532.684016720516/8.0),
+    REAL_CONST(16547.804797342676/8.0),
+    REAL_CONST(16562.929032958902/8.0),
+    REAL_CONST(16578.056721991394/8.0),
+    REAL_CONST(16593.18786286415/8.0),
+    REAL_CONST(16608.322454002962/8.0),
+    REAL_CONST(16623.460493835417/8.0),
+    REAL_CONST(16638.601980790896/8.0),
+    REAL_CONST(16653.746913300558/8.0),
+    REAL_CONST(16668.895289797354/8.0),
+    REAL_CONST(16684.047108716015/8.0),
+    REAL_CONST(16699.202368493046/8.0),
+    REAL_CONST(16714.361067566726/8.0),
+    REAL_CONST(16729.523204377107/8.0),
+    REAL_CONST(16744.688777366009/8.0),
+    REAL_CONST(16759.857784977012/8.0),
+    REAL_CONST(16775.030225655464/8.0),
+    REAL_CONST(16790.206097848466/8.0),
+    REAL_CONST(16805.385400004874/8.0),
+    REAL_CONST(16820.568130575302/8.0),
+    REAL_CONST(16835.754288012104/8.0),
+    REAL_CONST(16850.943870769381/8.0),
+    REAL_CONST(16866.136877302983/8.0),
+    REAL_CONST(16881.333306070494/8.0),
+    REAL_CONST(16896.53315553123/8.0),
+    REAL_CONST(16911.736424146249/8.0),
+    REAL_CONST(16926.943110378332/8.0),
+    REAL_CONST(16942.153212691992/8.0),
+    REAL_CONST(16957.366729553454/8.0),
+    REAL_CONST(16972.583659430682/8.0),
+    REAL_CONST(16987.804000793338/8.0),
+    REAL_CONST(17003.027752112816/8.0),
+    REAL_CONST(17018.254911862205/8.0),
+    REAL_CONST(17033.485478516312/8.0),
+    REAL_CONST(17048.719450551645/8.0),
+    REAL_CONST(17063.956826446421/8.0),
+    REAL_CONST(17079.197604680547/8.0),
+    REAL_CONST(17094.44178373563/8.0),
+    REAL_CONST(17109.689362094967/8.0),
+    REAL_CONST(17124.940338243552/8.0),
+    REAL_CONST(17140.194710668064/8.0),
+    REAL_CONST(17155.452477856852/8.0),
+    REAL_CONST(17170.713638299967/8.0),
+    REAL_CONST(17185.978190489128/8.0),
+    REAL_CONST(17201.246132917724/8.0),
+    REAL_CONST(17216.517464080825/8.0),
+    REAL_CONST(17231.792182475165/8.0),
+    REAL_CONST(17247.070286599141/8.0),
+    REAL_CONST(17262.351774952826/8.0),
+    REAL_CONST(17277.636646037936/8.0),
+    REAL_CONST(17292.924898357855/8.0),
+    REAL_CONST(17308.216530417623/8.0),
+    REAL_CONST(17323.511540723921/8.0),
+    REAL_CONST(17338.809927785089/8.0),
+    REAL_CONST(17354.111690111105/8.0),
+    REAL_CONST(17369.416826213594/8.0),
+    REAL_CONST(17384.725334605821/8.0),
+    REAL_CONST(17400.037213802683/8.0),
+    REAL_CONST(17415.352462320716/8.0),
+    REAL_CONST(17430.67107867809/8.0),
+    REAL_CONST(17445.993061394587/8.0),
+    REAL_CONST(17461.318408991636/8.0),
+    REAL_CONST(17476.647119992274/8.0),
+    REAL_CONST(17491.979192921168/8.0),
+    REAL_CONST(17507.314626304586/8.0),
+    REAL_CONST(17522.653418670423/8.0),
+    REAL_CONST(17537.995568548187/8.0),
+    REAL_CONST(17553.341074468986/8.0),
+    REAL_CONST(17568.689934965536/8.0),
+    REAL_CONST(17584.042148572156/8.0),
+    REAL_CONST(17599.397713824768/8.0),
+    REAL_CONST(17614.75662926089/8.0),
+    REAL_CONST(17630.118893419625/8.0),
+    REAL_CONST(17645.484504841683/8.0),
+    REAL_CONST(17660.853462069354/8.0),
+    REAL_CONST(17676.225763646511/8.0),
+    REAL_CONST(17691.601408118619/8.0),
+    REAL_CONST(17706.980394032718/8.0),
+    REAL_CONST(17722.362719937424/8.0),
+    REAL_CONST(17737.748384382936/8.0),
+    REAL_CONST(17753.137385921014/8.0),
+    REAL_CONST(17768.529723104999/8.0),
+    REAL_CONST(17783.92539448979/8.0),
+    REAL_CONST(17799.324398631856/8.0),
+    REAL_CONST(17814.726734089225/8.0),
+    REAL_CONST(17830.13239942148/8.0),
+    REAL_CONST(17845.541393189767/8.0),
+    REAL_CONST(17860.95371395678/8.0),
+    REAL_CONST(17876.369360286772/8.0),
+    REAL_CONST(17891.788330745527/8.0),
+    REAL_CONST(17907.210623900395/8.0),
+    REAL_CONST(17922.636238320254/8.0),
+    REAL_CONST(17938.065172575527/8.0),
+    REAL_CONST(17953.497425238176/8.0),
+    REAL_CONST(17968.932994881692/8.0),
+    REAL_CONST(17984.371880081104/8.0),
+    REAL_CONST(17999.814079412972/8.0),
+    REAL_CONST(18015.259591455371/8.0),
+    REAL_CONST(18030.708414787914/8.0),
+    REAL_CONST(18046.160547991731/8.0),
+    REAL_CONST(18061.615989649465/8.0),
+    REAL_CONST(18077.074738345284/8.0),
+    REAL_CONST(18092.536792664861/8.0),
+    REAL_CONST(18108.002151195393/8.0),
+    REAL_CONST(18123.470812525571/8.0),
+    REAL_CONST(18138.942775245599/8.0),
+    REAL_CONST(18154.418037947191/8.0),
+    REAL_CONST(18169.896599223546/8.0),
+    REAL_CONST(18185.37845766938/8.0),
+    REAL_CONST(18200.863611880886/8.0),
+    REAL_CONST(18216.352060455767/8.0),
+    REAL_CONST(18231.843801993204/8.0),
+    REAL_CONST(18247.338835093873/8.0),
+    REAL_CONST(18262.837158359936/8.0),
+    REAL_CONST(18278.338770395032/8.0),
+    REAL_CONST(18293.84366980429/8.0),
+    REAL_CONST(18309.351855194309/8.0),
+    REAL_CONST(18324.863325173166/8.0),
+    REAL_CONST(18340.378078350412/8.0),
+    REAL_CONST(18355.896113337069/8.0),
+    REAL_CONST(18371.417428745623/8.0),
+    REAL_CONST(18386.942023190033/8.0),
+    REAL_CONST(18402.469895285718/8.0),
+    REAL_CONST(18418.00104364955/8.0),
+    REAL_CONST(18433.53546689987/8.0),
+    REAL_CONST(18449.073163656474/8.0),
+    REAL_CONST(18464.614132540602/8.0),
+    REAL_CONST(18480.158372174956/8.0),
+    REAL_CONST(18495.705881183676/8.0),
+    REAL_CONST(18511.256658192357/8.0),
+    REAL_CONST(18526.810701828035/8.0),
+    REAL_CONST(18542.368010719183/8.0),
+    REAL_CONST(18557.928583495715/8.0),
+    REAL_CONST(18573.492418788985/8.0),
+    REAL_CONST(18589.059515231773/8.0),
+    REAL_CONST(18604.629871458303/8.0),
+    REAL_CONST(18620.203486104212/8.0),
+    REAL_CONST(18635.78035780658/8.0),
+    REAL_CONST(18651.360485203899/8.0),
+    REAL_CONST(18666.943866936086/8.0),
+    REAL_CONST(18682.53050164448/8.0),
+    REAL_CONST(18698.120387971841/8.0),
+    REAL_CONST(18713.713524562332/8.0),
+    REAL_CONST(18729.30991006154/8.0),
+    REAL_CONST(18744.909543116457/8.0),
+    REAL_CONST(18760.512422375479/8.0),
+    REAL_CONST(18776.118546488418/8.0),
+    REAL_CONST(18791.727914106479/8.0),
+    REAL_CONST(18807.340523882274/8.0),
+    REAL_CONST(18822.95637446981/8.0),
+    REAL_CONST(18838.575464524489/8.0),
+    REAL_CONST(18854.197792703111/8.0),
+    REAL_CONST(18869.823357663863/8.0),
+    REAL_CONST(18885.452158066328/8.0),
+    REAL_CONST(18901.08419257147/8.0),
+    REAL_CONST(18916.719459841639/8.0),
+    REAL_CONST(18932.357958540564/8.0),
+    REAL_CONST(18947.999687333362/8.0),
+    REAL_CONST(18963.644644886521/8.0),
+    REAL_CONST(18979.292829867907/8.0),
+    REAL_CONST(18994.944240946759/8.0),
+    REAL_CONST(19010.598876793687/8.0),
+    REAL_CONST(19026.256736080668/8.0),
+    REAL_CONST(19041.917817481048/8.0),
+    REAL_CONST(19057.582119669532/8.0),
+    REAL_CONST(19073.2496413222/8.0),
+    REAL_CONST(19088.920381116473/8.0),
+    REAL_CONST(19104.594337731145/8.0),
+    REAL_CONST(19120.271509846356/8.0),
+    REAL_CONST(19135.951896143604/8.0),
+    REAL_CONST(19151.635495305738/8.0),
+    REAL_CONST(19167.322306016948/8.0),
+    REAL_CONST(19183.012326962784/8.0),
+    REAL_CONST(19198.705556830122/8.0),
+    REAL_CONST(19214.401994307198/8.0),
+    REAL_CONST(19230.101638083579/8.0),
+    REAL_CONST(19245.804486850167/8.0),
+    REAL_CONST(19261.510539299208/8.0),
+    REAL_CONST(19277.219794124274/8.0),
+    REAL_CONST(19292.932250020265/8.0),
+    REAL_CONST(19308.647905683421/8.0),
+    REAL_CONST(19324.366759811302/8.0),
+    REAL_CONST(19340.088811102793/8.0),
+    REAL_CONST(19355.8140582581/8.0),
+    REAL_CONST(19371.542499978754/8.0),
+    REAL_CONST(19387.2741349676/8.0),
+    REAL_CONST(19403.008961928797/8.0),
+    REAL_CONST(19418.746979567823/8.0),
+    REAL_CONST(19434.488186591469/8.0),
+    REAL_CONST(19450.232581707827/8.0),
+    REAL_CONST(19465.980163626304/8.0),
+    REAL_CONST(19481.730931057613/8.0),
+    REAL_CONST(19497.484882713761/8.0),
+    REAL_CONST(19513.242017308068/8.0),
+    REAL_CONST(19529.002333555141/8.0),
+    REAL_CONST(19544.765830170898/8.0),
+    REAL_CONST(19560.532505872539/8.0),
+    REAL_CONST(19576.302359378566/8.0),
+    REAL_CONST(19592.075389408761/8.0),
+    REAL_CONST(19607.851594684209/8.0),
+    REAL_CONST(19623.630973927269/8.0),
+    REAL_CONST(19639.41352586159/8.0),
+    REAL_CONST(19655.199249212103/8.0),
+    REAL_CONST(19670.988142705017/8.0),
+    REAL_CONST(19686.780205067826/8.0),
+    REAL_CONST(19702.575435029288/8.0),
+    REAL_CONST(19718.373831319448/8.0),
+    REAL_CONST(19734.175392669615/8.0),
+    REAL_CONST(19749.980117812371/8.0),
+    REAL_CONST(19765.788005481569/8.0),
+    REAL_CONST(19781.599054412323/8.0),
+    REAL_CONST(19797.413263341008/8.0),
+    REAL_CONST(19813.230631005274/8.0),
+    REAL_CONST(19829.051156144014/8.0),
+    REAL_CONST(19844.874837497395/8.0),
+    REAL_CONST(19860.701673806827/8.0),
+    REAL_CONST(19876.531663814985/8.0),
+    REAL_CONST(19892.364806265789/8.0),
+    REAL_CONST(19908.201099904403/8.0),
+    REAL_CONST(19924.040543477258/8.0),
+    REAL_CONST(19939.883135732012/8.0),
+    REAL_CONST(19955.728875417579/8.0),
+    REAL_CONST(19971.577761284105/8.0),
+    REAL_CONST(19987.429792082985/8.0),
+    REAL_CONST(20003.284966566847/8.0),
+    REAL_CONST(20019.14328348956/8.0),
+    REAL_CONST(20035.004741606219/8.0),
+    REAL_CONST(20050.869339673161/8.0),
+    REAL_CONST(20066.737076447946/8.0),
+    REAL_CONST(20082.607950689362/8.0),
+    REAL_CONST(20098.481961157428/8.0),
+    REAL_CONST(20114.359106613385/8.0),
+    REAL_CONST(20130.239385819699/8.0),
+    REAL_CONST(20146.122797540058/8.0),
+    REAL_CONST(20162.009340539353/8.0),
+    REAL_CONST(20177.899013583716/8.0),
+    REAL_CONST(20193.791815440476/8.0),
+    REAL_CONST(20209.687744878182/8.0),
+    REAL_CONST(20225.586800666591/8.0),
+    REAL_CONST(20241.488981576669/8.0),
+    REAL_CONST(20257.394286380597/8.0),
+    REAL_CONST(20273.302713851754/8.0),
+    REAL_CONST(20289.214262764715/8.0),
+    REAL_CONST(20305.128931895277/8.0),
+    REAL_CONST(20321.046720020415/8.0),
+    REAL_CONST(20336.967625918318/8.0),
+    REAL_CONST(20352.891648368361/8.0),
+    REAL_CONST(20368.818786151114/8.0),
+    REAL_CONST(20384.749038048347/8.0),
+    REAL_CONST(20400.682402843009/8.0),
+    REAL_CONST(20416.618879319249/8.0),
+    REAL_CONST(20432.558466262391/8.0),
+    REAL_CONST(20448.501162458953/8.0),
+    REAL_CONST(20464.446966696629/8.0),
+    REAL_CONST(20480.395877764302/8.0),
+    REAL_CONST(20496.347894452025/8.0),
+    REAL_CONST(20512.303015551031/8.0),
+    REAL_CONST(20528.261239853735/8.0),
+    REAL_CONST(20544.22256615372/8.0),
+    REAL_CONST(20560.186993245738/8.0),
+    REAL_CONST(20576.15451992572/8.0),
+    REAL_CONST(20592.125144990758/8.0),
+    REAL_CONST(20608.098867239107/8.0),
+    REAL_CONST(20624.075685470198/8.0),
+    REAL_CONST(20640.055598484618/8.0),
+    REAL_CONST(20656.038605084115/8.0),
+    REAL_CONST(20672.024704071595/8.0),
+    REAL_CONST(20688.013894251126/8.0),
+    REAL_CONST(20704.006174427926/8.0),
+    REAL_CONST(20720.001543408373/8.0),
+    REAL_CONST(20735.999999999989/8.0),
+    REAL_CONST(20752.001543011454/8.0),
+    REAL_CONST(20768.006171252597/8.0),
+    REAL_CONST(20784.013883534382/8.0),
+    REAL_CONST(20800.024678668931/8.0),
+    REAL_CONST(20816.038555469506/8.0),
+    REAL_CONST(20832.055512750507/8.0),
+    REAL_CONST(20848.075549327474/8.0),
+    REAL_CONST(20864.098664017085/8.0),
+    REAL_CONST(20880.124855637161/8.0),
+    REAL_CONST(20896.154123006647/8.0),
+    REAL_CONST(20912.186464945626/8.0),
+    REAL_CONST(20928.221880275312/8.0),
+    REAL_CONST(20944.260367818049/8.0),
+    REAL_CONST(20960.301926397311/8.0),
+    REAL_CONST(20976.346554837684/8.0),
+    REAL_CONST(20992.394251964895/8.0),
+    REAL_CONST(21008.445016605787/8.0),
+    REAL_CONST(21024.498847588318/8.0),
+    REAL_CONST(21040.555743741574/8.0),
+    REAL_CONST(21056.615703895754/8.0),
+    REAL_CONST(21072.678726882168/8.0),
+    REAL_CONST(21088.744811533252/8.0),
+    REAL_CONST(21104.813956682538/8.0),
+    REAL_CONST(21120.886161164683/8.0),
+    REAL_CONST(21136.961423815443/8.0),
+    REAL_CONST(21153.039743471683/8.0),
+    REAL_CONST(21169.121118971379/8.0),
+    REAL_CONST(21185.205549153605/8.0),
+    REAL_CONST(21201.293032858535/8.0),
+    REAL_CONST(21217.383568927453/8.0),
+    REAL_CONST(21233.477156202731/8.0),
+    REAL_CONST(21249.573793527841/8.0),
+    REAL_CONST(21265.673479747358/8.0),
+    REAL_CONST(21281.776213706937/8.0),
+    REAL_CONST(21297.881994253334/8.0),
+    REAL_CONST(21313.990820234398/8.0),
+    REAL_CONST(21330.102690499054/8.0),
+    REAL_CONST(21346.21760389733/8.0),
+    REAL_CONST(21362.335559280327/8.0),
+    REAL_CONST(21378.456555500241/8.0),
+    REAL_CONST(21394.580591410333/8.0),
+    REAL_CONST(21410.707665864964/8.0),
+    REAL_CONST(21426.83777771956/8.0),
+    REAL_CONST(21442.970925830628/8.0),
+    REAL_CONST(21459.107109055756/8.0),
+    REAL_CONST(21475.246326253604/8.0),
+    REAL_CONST(21491.388576283895/8.0),
+    REAL_CONST(21507.533858007431/8.0),
+    REAL_CONST(21523.682170286087/8.0),
+    REAL_CONST(21539.833511982797/8.0),
+    REAL_CONST(21555.987881961566/8.0),
+    REAL_CONST(21572.145279087465/8.0),
+    REAL_CONST(21588.305702226615/8.0),
+    REAL_CONST(21604.469150246216/8.0),
+    REAL_CONST(21620.635622014521/8.0),
+    REAL_CONST(21636.805116400832/8.0),
+    REAL_CONST(21652.977632275521/8.0),
+    REAL_CONST(21669.153168510009/8.0),
+    REAL_CONST(21685.331723976764/8.0),
+    REAL_CONST(21701.513297549318/8.0),
+    REAL_CONST(21717.697888102244/8.0),
+    REAL_CONST(21733.885494511167/8.0),
+    REAL_CONST(21750.076115652759/8.0),
+    REAL_CONST(21766.269750404736/8.0),
+    REAL_CONST(21782.466397645861/8.0),
+    REAL_CONST(21798.666056255934/8.0),
+    REAL_CONST(21814.868725115801/8.0),
+    REAL_CONST(21831.074403107345/8.0),
+    REAL_CONST(21847.283089113484/8.0),
+    REAL_CONST(21863.494782018177/8.0),
+    REAL_CONST(21879.709480706417/8.0),
+    REAL_CONST(21895.927184064229/8.0),
+    REAL_CONST(21912.147890978667/8.0),
+    REAL_CONST(21928.371600337818/8.0),
+    REAL_CONST(21944.598311030797/8.0),
+    REAL_CONST(21960.828021947746/8.0),
+    REAL_CONST(21977.060731979829/8.0),
+    REAL_CONST(21993.296440019243/8.0),
+    REAL_CONST(22009.535144959198/8.0),
+    REAL_CONST(22025.77684569393/8.0),
+    REAL_CONST(22042.021541118691/8.0),
+    REAL_CONST(22058.269230129757/8.0),
+    REAL_CONST(22074.519911624411/8.0),
+    REAL_CONST(22090.773584500959/8.0),
+    REAL_CONST(22107.030247658717/8.0),
+    REAL_CONST(22123.289899998013/8.0),
+    REAL_CONST(22139.552540420187/8.0),
+    REAL_CONST(22155.818167827587/8.0),
+    REAL_CONST(22172.086781123569/8.0),
+    REAL_CONST(22188.358379212495/8.0),
+    REAL_CONST(22204.632960999726/8.0),
+    REAL_CONST(22220.910525391639/8.0),
+    REAL_CONST(22237.191071295601/8.0),
+    REAL_CONST(22253.474597619981/8.0),
+    REAL_CONST(22269.761103274148/8.0),
+    REAL_CONST(22286.050587168469/8.0),
+    REAL_CONST(22302.343048214312/8.0),
+    REAL_CONST(22318.638485324027/8.0),
+    REAL_CONST(22334.936897410968/8.0),
+    REAL_CONST(22351.23828338947/8.0),
+    REAL_CONST(22367.542642174871/8.0),
+    REAL_CONST(22383.849972683485/8.0),
+    REAL_CONST(22400.160273832618/8.0),
+    REAL_CONST(22416.473544540564/8.0),
+    REAL_CONST(22432.789783726603/8.0),
+    REAL_CONST(22449.108990310986/8.0),
+    REAL_CONST(22465.431163214958/8.0),
+    REAL_CONST(22481.75630136074/8.0),
+    REAL_CONST(22498.084403671528/8.0),
+    REAL_CONST(22514.415469071497/8.0),
+    REAL_CONST(22530.749496485802/8.0),
+    REAL_CONST(22547.086484840562/8.0),
+    REAL_CONST(22563.426433062879/8.0),
+    REAL_CONST(22579.769340080824/8.0),
+    REAL_CONST(22596.115204823436/8.0),
+    REAL_CONST(22612.464026220721/8.0),
+    REAL_CONST(22628.815803203655/8.0),
+    REAL_CONST(22645.170534704179/8.0),
+    REAL_CONST(22661.5282196552/8.0),
+    REAL_CONST(22677.888856990587/8.0),
+    REAL_CONST(22694.252445645168/8.0),
+    REAL_CONST(22710.618984554734/8.0),
+    REAL_CONST(22726.988472656034/8.0),
+    REAL_CONST(22743.360908886778/8.0),
+    REAL_CONST(22759.736292185622/8.0),
+    REAL_CONST(22776.114621492186/8.0),
+    REAL_CONST(22792.495895747044/8.0),
+    REAL_CONST(22808.880113891719/8.0),
+    REAL_CONST(22825.267274868678/8.0),
+    REAL_CONST(22841.657377621348/8.0),
+    REAL_CONST(22858.050421094096/8.0),
+    REAL_CONST(22874.446404232243/8.0),
+    REAL_CONST(22890.845325982053/8.0),
+    REAL_CONST(22907.247185290722/8.0),
+    REAL_CONST(22923.651981106406/8.0),
+    REAL_CONST(22940.059712378195/8.0),
+    REAL_CONST(22956.470378056114/8.0),
+    REAL_CONST(22972.883977091129/8.0),
+    REAL_CONST(22989.300508435153/8.0),
+    REAL_CONST(23005.719971041017/8.0),
+    REAL_CONST(23022.142363862498/8.0),
+    REAL_CONST(23038.567685854305/8.0),
+    REAL_CONST(23054.995935972078/8.0),
+    REAL_CONST(23071.427113172387/8.0),
+    REAL_CONST(23087.86121641273/8.0),
+    REAL_CONST(23104.298244651531/8.0),
+    REAL_CONST(23120.738196848146/8.0),
+    REAL_CONST(23137.181071962848/8.0),
+    REAL_CONST(23153.626868956846/8.0),
+    REAL_CONST(23170.075586792263/8.0),
+    REAL_CONST(23186.527224432142/8.0),
+    REAL_CONST(23202.981780840448/8.0),
+    REAL_CONST(23219.439254982066/8.0),
+    REAL_CONST(23235.899645822796/8.0),
+    REAL_CONST(23252.362952329357/8.0),
+    REAL_CONST(23268.829173469378/8.0),
+    REAL_CONST(23285.298308211408/8.0),
+    REAL_CONST(23301.770355524899/8.0),
+    REAL_CONST(23318.245314380223/8.0),
+    REAL_CONST(23334.723183748658/8.0),
+    REAL_CONST(23351.203962602387/8.0),
+    REAL_CONST(23367.687649914504/8.0),
+    REAL_CONST(23384.174244659007/8.0),
+    REAL_CONST(23400.663745810798/8.0),
+    REAL_CONST(23417.15615234568/8.0),
+    REAL_CONST(23433.651463240367/8.0),
+    REAL_CONST(23450.149677472462/8.0),
+    REAL_CONST(23466.650794020472/8.0),
+    REAL_CONST(23483.154811863806/8.0),
+    REAL_CONST(23499.661729982763/8.0),
+    REAL_CONST(23516.171547358543/8.0),
+    REAL_CONST(23532.684262973235/8.0),
+    REAL_CONST(23549.199875809823/8.0),
+    REAL_CONST(23565.718384852185/8.0),
+    REAL_CONST(23582.239789085092/8.0),
+    REAL_CONST(23598.764087494197/8.0),
+    REAL_CONST(23615.291279066041/8.0),
+    REAL_CONST(23631.821362788058/8.0),
+    REAL_CONST(23648.354337648565/8.0),
+    REAL_CONST(23664.890202636761/8.0),
+    REAL_CONST(23681.428956742733/8.0),
+    REAL_CONST(23697.970598957443/8.0),
+    REAL_CONST(23714.515128272738/8.0),
+    REAL_CONST(23731.062543681343/8.0),
+    REAL_CONST(23747.612844176863/8.0),
+    REAL_CONST(23764.166028753778/8.0),
+    REAL_CONST(23780.72209640744/8.0),
+    REAL_CONST(23797.281046134085/8.0),
+    REAL_CONST(23813.842876930816/8.0),
+    REAL_CONST(23830.407587795606/8.0),
+    REAL_CONST(23846.975177727301/8.0),
+    REAL_CONST(23863.545645725622/8.0),
+    REAL_CONST(23880.11899079115/8.0),
+    REAL_CONST(23896.695211925336/8.0),
+    REAL_CONST(23913.274308130498/8.0),
+    REAL_CONST(23929.856278409821/8.0),
+    REAL_CONST(23946.441121767348/8.0),
+    REAL_CONST(23963.028837207989/8.0),
+    REAL_CONST(23979.619423737513/8.0),
+    REAL_CONST(23996.212880362549/8.0),
+    REAL_CONST(24012.809206090584/8.0),
+    REAL_CONST(24029.408399929966/8.0),
+    REAL_CONST(24046.010460889898/8.0),
+    REAL_CONST(24062.615387980433/8.0),
+    REAL_CONST(24079.223180212492/8.0),
+    REAL_CONST(24095.833836597827/8.0),
+    REAL_CONST(24112.447356149063/8.0),
+    REAL_CONST(24129.063737879667/8.0),
+    REAL_CONST(24145.682980803951/8.0),
+    REAL_CONST(24162.305083937081/8.0),
+    REAL_CONST(24178.930046295067/8.0),
+    REAL_CONST(24195.557866894767/8.0),
+    REAL_CONST(24212.188544753884/8.0),
+    REAL_CONST(24228.822078890964/8.0),
+    REAL_CONST(24245.458468325389/8.0),
+    REAL_CONST(24262.097712077397/8.0),
+    REAL_CONST(24278.739809168052/8.0),
+    REAL_CONST(24295.384758619261/8.0),
+    REAL_CONST(24312.032559453768/8.0),
+    REAL_CONST(24328.683210695162/8.0),
+    REAL_CONST(24345.336711367858/8.0),
+    REAL_CONST(24361.993060497109/8.0),
+    REAL_CONST(24378.652257108995/8.0),
+    REAL_CONST(24395.314300230442/8.0),
+    REAL_CONST(24411.979188889192/8.0),
+    REAL_CONST(24428.646922113825/8.0),
+    REAL_CONST(24445.317498933746/8.0),
+    REAL_CONST(24461.990918379193/8.0),
+    REAL_CONST(24478.667179481225/8.0),
+    REAL_CONST(24495.346281271726/8.0),
+    REAL_CONST(24512.028222783407/8.0),
+    REAL_CONST(24528.713003049801/8.0),
+    REAL_CONST(24545.400621105266/8.0),
+    REAL_CONST(24562.091075984976/8.0),
+    REAL_CONST(24578.784366724925/8.0),
+    REAL_CONST(24595.480492361927/8.0),
+    REAL_CONST(24612.179451933614/8.0),
+    REAL_CONST(24628.881244478438/8.0),
+    REAL_CONST(24645.585869035654/8.0),
+    REAL_CONST(24662.293324645343/8.0),
+    REAL_CONST(24679.003610348394/8.0),
+    REAL_CONST(24695.716725186514/8.0),
+    REAL_CONST(24712.432668202211/8.0),
+    REAL_CONST(24729.151438438807/8.0),
+    REAL_CONST(24745.873034940436/8.0),
+    REAL_CONST(24762.597456752032/8.0),
+    REAL_CONST(24779.324702919344/8.0),
+    REAL_CONST(24796.054772488926/8.0),
+    REAL_CONST(24812.787664508123/8.0),
+    REAL_CONST(24829.5233780251/8.0),
+    REAL_CONST(24846.261912088819/8.0),
+    REAL_CONST(24863.003265749034/8.0),
+    REAL_CONST(24879.747438056307/8.0),
+    REAL_CONST(24896.494428062004/8.0),
+    REAL_CONST(24913.244234818278/8.0),
+    REAL_CONST(24929.996857378079/8.0),
+    REAL_CONST(24946.752294795166/8.0),
+    REAL_CONST(24963.510546124078/8.0),
+    REAL_CONST(24980.271610420157/8.0),
+    REAL_CONST(24997.035486739525/8.0),
+    REAL_CONST(25013.802174139113/8.0),
+    REAL_CONST(25030.571671676629/8.0),
+    REAL_CONST(25047.343978410572/8.0),
+    REAL_CONST(25064.119093400237/8.0),
+    REAL_CONST(25080.897015705697/8.0),
+    REAL_CONST(25097.677744387816/8.0),
+    REAL_CONST(25114.461278508239/8.0),
+    REAL_CONST(25131.2476171294/8.0),
+    REAL_CONST(25148.036759314517/8.0),
+    REAL_CONST(25164.828704127583/8.0),
+    REAL_CONST(25181.623450633375/8.0),
+    REAL_CONST(25198.42099789745/8.0),
+    REAL_CONST(25215.221344986145/8.0),
+    REAL_CONST(25232.024490966574/8.0),
+    REAL_CONST(25248.830434906627/8.0),
+    REAL_CONST(25265.639175874974/8.0),
+    REAL_CONST(25282.450712941049/8.0),
+    REAL_CONST(25299.265045175071/8.0),
+    REAL_CONST(25316.082171648024/8.0),
+    REAL_CONST(25332.902091431668/8.0),
+    REAL_CONST(25349.724803598532/8.0),
+    REAL_CONST(25366.550307221914/8.0),
+    REAL_CONST(25383.378601375884/8.0),
+    REAL_CONST(25400.209685135269/8.0),
+    REAL_CONST(25417.043557575678/8.0),
+    REAL_CONST(25433.880217773472/8.0),
+    REAL_CONST(25450.719664805783/8.0),
+    REAL_CONST(25467.561897750507/8.0),
+    REAL_CONST(25484.406915686297/8.0),
+    REAL_CONST(25501.254717692573/8.0),
+    REAL_CONST(25518.105302849512/8.0),
+    REAL_CONST(25534.958670238051/8.0),
+    REAL_CONST(25551.814818939893/8.0),
+    REAL_CONST(25568.67374803748/8.0),
+    REAL_CONST(25585.535456614027/8.0),
+    REAL_CONST(25602.399943753502/8.0),
+    REAL_CONST(25619.267208540619/8.0),
+    REAL_CONST(25636.137250060852/8.0),
+    REAL_CONST(25653.010067400432/8.0),
+    REAL_CONST(25669.885659646327/8.0),
+    REAL_CONST(25686.76402588627/8.0),
+    REAL_CONST(25703.645165208734/8.0),
+    REAL_CONST(25720.529076702944/8.0),
+    REAL_CONST(25737.415759458876/8.0),
+    REAL_CONST(25754.305212567244/8.0),
+    REAL_CONST(25771.197435119517/8.0),
+    REAL_CONST(25788.092426207899/8.0),
+    REAL_CONST(25804.990184925344/8.0),
+    REAL_CONST(25821.890710365547/8.0),
+    REAL_CONST(25838.794001622944/8.0),
+    REAL_CONST(25855.700057792714/8.0),
+    REAL_CONST(25872.608877970775/8.0),
+    REAL_CONST(25889.520461253778/8.0),
+    REAL_CONST(25906.434806739118/8.0),
+    REAL_CONST(25923.351913524923/8.0),
+    REAL_CONST(25940.271780710063/8.0),
+    REAL_CONST(25957.194407394138/8.0),
+    REAL_CONST(25974.11979267748/8.0),
+    REAL_CONST(25991.047935661154/8.0),
+    REAL_CONST(26007.978835446964/8.0),
+    REAL_CONST(26024.912491137442/8.0),
+    REAL_CONST(26041.848901835841/8.0),
+    REAL_CONST(26058.788066646157/8.0),
+    REAL_CONST(26075.729984673108/8.0),
+    REAL_CONST(26092.674655022136/8.0),
+    REAL_CONST(26109.622076799409/8.0),
+    REAL_CONST(26126.572249111829/8.0),
+    REAL_CONST(26143.525171067016/8.0),
+    REAL_CONST(26160.480841773315/8.0),
+    REAL_CONST(26177.43926033979/8.0),
+    REAL_CONST(26194.400425876229/8.0),
+    REAL_CONST(26211.364337493149/8.0),
+    REAL_CONST(26228.330994301767/8.0),
+    REAL_CONST(26245.30039541404/8.0),
+    REAL_CONST(26262.272539942627/8.0),
+    REAL_CONST(26279.247427000919/8.0),
+    REAL_CONST(26296.225055703002/8.0),
+    REAL_CONST(26313.205425163702/8.0),
+    REAL_CONST(26330.188534498539/8.0),
+    REAL_CONST(26347.174382823756/8.0),
+    REAL_CONST(26364.162969256304/8.0),
+    REAL_CONST(26381.154292913852/8.0),
+    REAL_CONST(26398.148352914774/8.0),
+    REAL_CONST(26415.145148378149/8.0),
+    REAL_CONST(26432.144678423778/8.0),
+    REAL_CONST(26449.146942172156/8.0),
+    REAL_CONST(26466.151938744493/8.0),
+    REAL_CONST(26483.159667262702/8.0),
+    REAL_CONST(26500.170126849403/8.0),
+    REAL_CONST(26517.183316627921/8.0),
+    REAL_CONST(26534.199235722277/8.0),
+    REAL_CONST(26551.217883257199/8.0),
+    REAL_CONST(26568.239258358124/8.0),
+    REAL_CONST(26585.263360151173/8.0),
+    REAL_CONST(26602.290187763181/8.0),
+    REAL_CONST(26619.319740321676/8.0),
+    REAL_CONST(26636.352016954883/8.0),
+    REAL_CONST(26653.387016791727/8.0),
+    REAL_CONST(26670.424738961825/8.0),
+    REAL_CONST(26687.465182595493/8.0),
+    REAL_CONST(26704.508346823739/8.0),
+    REAL_CONST(26721.554230778267/8.0),
+    REAL_CONST(26738.602833591467/8.0),
+    REAL_CONST(26755.65415439643/8.0),
+    REAL_CONST(26772.708192326929/8.0),
+    REAL_CONST(26789.764946517433/8.0),
+    REAL_CONST(26806.824416103096/8.0),
+    REAL_CONST(26823.886600219761/8.0),
+    REAL_CONST(26840.95149800396/8.0),
+    REAL_CONST(26858.019108592915/8.0),
+    REAL_CONST(26875.089431124517/8.0),
+    REAL_CONST(26892.162464737365/8.0),
+    REAL_CONST(26909.238208570721/8.0),
+    REAL_CONST(26926.316661764544/8.0),
+    REAL_CONST(26943.397823459472/8.0),
+    REAL_CONST(26960.481692796813/8.0),
+    REAL_CONST(26977.568268918571/8.0),
+    REAL_CONST(26994.657550967422/8.0),
+    REAL_CONST(27011.749538086722/8.0),
+    REAL_CONST(27028.844229420498/8.0),
+    REAL_CONST(27045.941624113464/8.0),
+    REAL_CONST(27063.041721311005/8.0),
+    REAL_CONST(27080.144520159181/8.0),
+    REAL_CONST(27097.250019804727/8.0),
+    REAL_CONST(27114.35821939505/8.0),
+    REAL_CONST(27131.469118078236/8.0),
+    REAL_CONST(27148.582715003027/8.0),
+    REAL_CONST(27165.699009318858/8.0),
+    REAL_CONST(27182.818000175819/8.0),
+    REAL_CONST(27199.939686724665/8.0),
+    REAL_CONST(27217.064068116837/8.0),
+    REAL_CONST(27234.191143504428/8.0),
+    REAL_CONST(27251.320912040203/8.0),
+    REAL_CONST(27268.453372877593/8.0),
+    REAL_CONST(27285.588525170693/8.0),
+    REAL_CONST(27302.726368074269/8.0),
+    REAL_CONST(27319.866900743735/8.0),
+    REAL_CONST(27337.010122335181/8.0),
+    REAL_CONST(27354.156032005358/8.0),
+    REAL_CONST(27371.304628911668/8.0),
+    REAL_CONST(27388.455912212183/8.0),
+    REAL_CONST(27405.609881065626/8.0),
+    REAL_CONST(27422.766534631384/8.0),
+    REAL_CONST(27439.925872069507/8.0),
+    REAL_CONST(27457.087892540683/8.0),
+    REAL_CONST(27474.252595206275/8.0),
+    REAL_CONST(27491.419979228293/8.0),
+    REAL_CONST(27508.5900437694/8.0),
+    REAL_CONST(27525.762787992917/8.0),
+    REAL_CONST(27542.93821106281/8.0),
+    REAL_CONST(27560.116312143706/8.0),
+    REAL_CONST(27577.297090400876/8.0),
+    REAL_CONST(27594.480545000242/8.0),
+    REAL_CONST(27611.666675108383/8.0),
+    REAL_CONST(27628.855479892518/8.0),
+    REAL_CONST(27646.046958520514/8.0),
+    REAL_CONST(27663.241110160889/8.0),
+    REAL_CONST(27680.437933982801/8.0),
+    REAL_CONST(27697.637429156068/8.0),
+    REAL_CONST(27714.839594851132/8.0),
+    REAL_CONST(27732.04443023909/8.0),
+    REAL_CONST(27749.251934491687/8.0),
+    REAL_CONST(27766.462106781299/8.0),
+    REAL_CONST(27783.674946280949/8.0),
+    REAL_CONST(27800.890452164302/8.0),
+    REAL_CONST(27818.108623605654/8.0),
+    REAL_CONST(27835.329459779954/8.0),
+    REAL_CONST(27852.55295986278/8.0),
+    REAL_CONST(27869.779123030345/8.0),
+    REAL_CONST(27887.007948459504/8.0),
+    REAL_CONST(27904.239435327745/8.0),
+    REAL_CONST(27921.473582813196/8.0),
+    REAL_CONST(27938.710390094613/8.0),
+    REAL_CONST(27955.949856351392/8.0),
+    REAL_CONST(27973.19198076355/8.0),
+    REAL_CONST(27990.436762511745/8.0),
+    REAL_CONST(28007.684200777272/8.0),
+    REAL_CONST(28024.934294742041/8.0),
+    REAL_CONST(28042.187043588601/8.0),
+    REAL_CONST(28059.442446500128/8.0),
+    REAL_CONST(28076.700502660427/8.0),
+    REAL_CONST(28093.961211253929/8.0),
+    REAL_CONST(28111.224571465693/8.0),
+    REAL_CONST(28128.490582481401/8.0),
+    REAL_CONST(28145.759243487362/8.0),
+    REAL_CONST(28163.030553670509/8.0),
+    REAL_CONST(28180.304512218394/8.0),
+    REAL_CONST(28197.581118319198/8.0),
+    REAL_CONST(28214.860371161725/8.0),
+    REAL_CONST(28232.14226993539/8.0),
+    REAL_CONST(28249.42681383024/8.0),
+    REAL_CONST(28266.71400203693/8.0),
+    REAL_CONST(28284.003833746745/8.0),
+    REAL_CONST(28301.296308151585/8.0),
+    REAL_CONST(28318.591424443959/8.0),
+    REAL_CONST(28335.889181817001/8.0),
+    REAL_CONST(28353.189579464462/8.0),
+    REAL_CONST(28370.492616580705/8.0),
+    REAL_CONST(28387.798292360701/8.0),
+    REAL_CONST(28405.106606000048/8.0),
+    REAL_CONST(28422.417556694945/8.0),
+    REAL_CONST(28439.731143642206/8.0),
+    REAL_CONST(28457.047366039264/8.0),
+    REAL_CONST(28474.366223084147/8.0),
+    REAL_CONST(28491.687713975512/8.0),
+    REAL_CONST(28509.011837912611/8.0),
+    REAL_CONST(28526.338594095305/8.0),
+    REAL_CONST(28543.667981724069/8.0),
+    REAL_CONST(28560.999999999982/8.0),
+    REAL_CONST(28578.334648124732/8.0),
+    REAL_CONST(28595.671925300605/8.0),
+    REAL_CONST(28613.011830730498/8.0),
+    REAL_CONST(28630.354363617909/8.0),
+    REAL_CONST(28647.699523166943/8.0),
+    REAL_CONST(28665.0473085823/8.0),
+    REAL_CONST(28682.397719069289/8.0),
+    REAL_CONST(28699.750753833818/8.0),
+    REAL_CONST(28717.10641208239/8.0),
+    REAL_CONST(28734.464693022121/8.0),
+    REAL_CONST(28751.825595860708/8.0),
+    REAL_CONST(28769.189119806462/8.0),
+    REAL_CONST(28786.55526406828/8.0),
+    REAL_CONST(28803.924027855664/8.0),
+    REAL_CONST(28821.295410378701/8.0),
+    REAL_CONST(28838.669410848088/8.0),
+    REAL_CONST(28856.046028475103/8.0),
+    REAL_CONST(28873.425262471628/8.0),
+    REAL_CONST(28890.80711205013/8.0),
+    REAL_CONST(28908.191576423673/8.0),
+    REAL_CONST(28925.578654805915/8.0),
+    REAL_CONST(28942.968346411097/8.0),
+    REAL_CONST(28960.360650454055/8.0),
+    REAL_CONST(28977.755566150216/8.0),
+    REAL_CONST(28995.153092715591/8.0),
+    REAL_CONST(29012.553229366786/8.0),
+    REAL_CONST(29029.955975320987/8.0),
+    REAL_CONST(29047.361329795975/8.0),
+    REAL_CONST(29064.769292010107/8.0),
+    REAL_CONST(29082.179861182336/8.0),
+    REAL_CONST(29099.593036532187/8.0),
+    REAL_CONST(29117.00881727978/8.0),
+    REAL_CONST(29134.427202645813/8.0),
+    REAL_CONST(29151.848191851568/8.0),
+    REAL_CONST(29169.271784118911/8.0),
+    REAL_CONST(29186.697978670283/8.0),
+    REAL_CONST(29204.126774728706/8.0),
+    REAL_CONST(29221.55817151779/8.0),
+    REAL_CONST(29238.992168261717/8.0),
+    REAL_CONST(29256.42876418525/8.0),
+    REAL_CONST(29273.867958513725/8.0),
+    REAL_CONST(29291.309750473058/8.0),
+    REAL_CONST(29308.754139289747/8.0),
+    REAL_CONST(29326.201124190855/8.0),
+    REAL_CONST(29343.65070440403/8.0),
+    REAL_CONST(29361.102879157483/8.0),
+    REAL_CONST(29378.557647680012/8.0),
+    REAL_CONST(29396.015009200975/8.0),
+    REAL_CONST(29413.474962950309/8.0),
+    REAL_CONST(29430.937508158524/8.0),
+    REAL_CONST(29448.402644056692/8.0),
+    REAL_CONST(29465.870369876469/8.0),
+    REAL_CONST(29483.340684850071/8.0),
+    REAL_CONST(29500.81358821028/8.0),
+    REAL_CONST(29518.289079190454/8.0),
+    REAL_CONST(29535.767157024511/8.0),
+    REAL_CONST(29553.247820946945/8.0),
+    REAL_CONST(29570.731070192807/8.0),
+    REAL_CONST(29588.216903997723/8.0),
+    REAL_CONST(29605.70532159787/8.0),
+    REAL_CONST(29623.19632223/8.0),
+    REAL_CONST(29640.689905131429/8.0),
+    REAL_CONST(29658.186069540028/8.0),
+    REAL_CONST(29675.684814694236/8.0),
+    REAL_CONST(29693.186139833047/8.0),
+    REAL_CONST(29710.690044196028/8.0),
+    REAL_CONST(29728.196527023298/8.0),
+    REAL_CONST(29745.705587555527/8.0),
+    REAL_CONST(29763.217225033964/8.0),
+    REAL_CONST(29780.731438700397/8.0),
+    REAL_CONST(29798.248227797183/8.0),
+    REAL_CONST(29815.76759156723/8.0),
+    REAL_CONST(29833.289529254005/8.0),
+    REAL_CONST(29850.81404010153/8.0),
+    REAL_CONST(29868.341123354381/8.0),
+    REAL_CONST(29885.870778257693/8.0),
+    REAL_CONST(29903.403004057145/8.0),
+    REAL_CONST(29920.937799998974/8.0),
+    REAL_CONST(29938.475165329975/8.0),
+    REAL_CONST(29956.015099297485/8.0),
+    REAL_CONST(29973.557601149394/8.0),
+    REAL_CONST(29991.102670134147/8.0),
+    REAL_CONST(30008.650305500738/8.0),
+    REAL_CONST(30026.200506498706/8.0),
+    REAL_CONST(30043.753272378144/8.0),
+    REAL_CONST(30061.308602389683/8.0),
+    REAL_CONST(30078.866495784507/8.0),
+    REAL_CONST(30096.426951814352/8.0),
+    REAL_CONST(30113.989969731494/8.0),
+    REAL_CONST(30131.55554878875/8.0),
+    REAL_CONST(30149.123688239491/8.0),
+    REAL_CONST(30166.694387337629/8.0),
+    REAL_CONST(30184.267645337608/8.0),
+    REAL_CONST(30201.843461494434/8.0),
+    REAL_CONST(30219.42183506364/8.0),
+    REAL_CONST(30237.002765301309/8.0),
+    REAL_CONST(30254.586251464058/8.0),
+    REAL_CONST(30272.172292809046/8.0),
+    REAL_CONST(30289.760888593977/8.0),
+    REAL_CONST(30307.35203807709/8.0),
+    REAL_CONST(30324.94574051716/8.0),
+    REAL_CONST(30342.541995173502/8.0),
+    REAL_CONST(30360.140801305966/8.0),
+    REAL_CONST(30377.742158174944/8.0),
+    REAL_CONST(30395.346065041358/8.0),
+    REAL_CONST(30412.952521166666/8.0),
+    REAL_CONST(30430.561525812864/8.0),
+    REAL_CONST(30448.173078242475/8.0),
+    REAL_CONST(30465.787177718561/8.0),
+    REAL_CONST(30483.403823504719/8.0),
+    REAL_CONST(30501.02301486507/8.0),
+    REAL_CONST(30518.644751064272/8.0),
+    REAL_CONST(30536.269031367516/8.0),
+    REAL_CONST(30553.895855040515/8.0),
+    REAL_CONST(30571.525221349519/8.0),
+    REAL_CONST(30589.157129561307/8.0),
+    REAL_CONST(30606.791578943175/8.0),
+    REAL_CONST(30624.428568762964/8.0),
+    REAL_CONST(30642.06809828903/8.0),
+    REAL_CONST(30659.710166790261/8.0),
+    REAL_CONST(30677.35477353607/8.0),
+    REAL_CONST(30695.001917796391/8.0),
+    REAL_CONST(30712.651598841687/8.0),
+    REAL_CONST(30730.303815942945/8.0),
+    REAL_CONST(30747.958568371676/8.0),
+    REAL_CONST(30765.615855399912/8.0),
+    REAL_CONST(30783.275676300211/8.0),
+    REAL_CONST(30800.938030345646/8.0),
+    REAL_CONST(30818.602916809814/8.0),
+    REAL_CONST(30836.270334966837/8.0),
+    REAL_CONST(30853.940284091354/8.0),
+    REAL_CONST(30871.612763458521/8.0),
+    REAL_CONST(30889.287772344011/8.0),
+    REAL_CONST(30906.965310024025/8.0),
+    REAL_CONST(30924.645375775272/8.0),
+    REAL_CONST(30942.327968874983/8.0),
+    REAL_CONST(30960.013088600903/8.0),
+    REAL_CONST(30977.700734231294/8.0),
+    REAL_CONST(30995.390905044929/8.0),
+    REAL_CONST(31013.083600321101/8.0),
+    REAL_CONST(31030.778819339619/8.0),
+    REAL_CONST(31048.476561380798/8.0),
+    REAL_CONST(31066.17682572547/8.0),
+    REAL_CONST(31083.879611654978/8.0),
+    REAL_CONST(31101.584918451179/8.0),
+    REAL_CONST(31119.29274539644/8.0),
+    REAL_CONST(31137.003091773637/8.0),
+    REAL_CONST(31154.715956866155/8.0),
+    REAL_CONST(31172.431339957893/8.0),
+    REAL_CONST(31190.14924033326/8.0),
+    REAL_CONST(31207.869657277162/8.0),
+    REAL_CONST(31225.592590075023/8.0),
+    REAL_CONST(31243.318038012771/8.0),
+    REAL_CONST(31261.046000376838/8.0),
+    REAL_CONST(31278.776476454172/8.0),
+    REAL_CONST(31296.50946553221/8.0),
+    REAL_CONST(31314.24496689891/8.0),
+    REAL_CONST(31331.98297984272/8.0),
+    REAL_CONST(31349.7235036526/8.0),
+    REAL_CONST(31367.466537618013/8.0),
+    REAL_CONST(31385.212081028923/8.0),
+    REAL_CONST(31402.960133175795/8.0),
+    REAL_CONST(31420.710693349596/8.0),
+    REAL_CONST(31438.463760841791/8.0),
+    REAL_CONST(31456.219334944351/8.0),
+    REAL_CONST(31473.977414949743/8.0),
+    REAL_CONST(31491.738000150934/8.0),
+    REAL_CONST(31509.501089841389/8.0),
+    REAL_CONST(31527.266683315069/8.0),
+    REAL_CONST(31545.034779866437/8.0),
+    REAL_CONST(31562.80537879045/8.0),
+    REAL_CONST(31580.578479382562/8.0),
+    REAL_CONST(31598.35408093872/8.0),
+    REAL_CONST(31616.132182755369/8.0),
+    REAL_CONST(31633.91278412945/8.0),
+    REAL_CONST(31651.695884358396/8.0),
+    REAL_CONST(31669.481482740131/8.0),
+    REAL_CONST(31687.269578573076/8.0),
+    REAL_CONST(31705.060171156143/8.0),
+    REAL_CONST(31722.853259788735/8.0),
+    REAL_CONST(31740.648843770748/8.0),
+    REAL_CONST(31758.446922402567/8.0),
+    REAL_CONST(31776.247494985066/8.0),
+    REAL_CONST(31794.050560819614/8.0),
+    REAL_CONST(31811.85611920806/8.0),
+    REAL_CONST(31829.664169452753/8.0),
+    REAL_CONST(31847.474710856521/8.0),
+    REAL_CONST(31865.287742722685/8.0),
+    REAL_CONST(31883.103264355046/8.0),
+    REAL_CONST(31900.921275057899/8.0),
+    REAL_CONST(31918.741774136019/8.0),
+    REAL_CONST(31936.564760894671/8.0),
+    REAL_CONST(31954.390234639599/8.0),
+    REAL_CONST(31972.21819467704/8.0),
+    REAL_CONST(31990.048640313704/8.0),
+    REAL_CONST(32007.881570856793/8.0),
+    REAL_CONST(32025.716985613984/8.0),
+    REAL_CONST(32043.554883893445/8.0),
+    REAL_CONST(32061.395265003815/8.0),
+    REAL_CONST(32079.238128254223/8.0),
+    REAL_CONST(32097.083472954269/8.0),
+    REAL_CONST(32114.931298414049/8.0),
+    REAL_CONST(32132.781603944117/8.0),
+    REAL_CONST(32150.634388855524/8.0),
+    REAL_CONST(32168.48965245979/8.0),
+    REAL_CONST(32186.347394068915/8.0),
+    REAL_CONST(32204.207612995371/8.0),
+    REAL_CONST(32222.07030855212/8.0),
+    REAL_CONST(32239.935480052583/8.0),
+    REAL_CONST(32257.803126810672/8.0),
+    REAL_CONST(32275.673248140767/8.0),
+    REAL_CONST(32293.545843357719/8.0),
+    REAL_CONST(32311.420911776862/8.0),
+    REAL_CONST(32329.298452713996/8.0),
+    REAL_CONST(32347.178465485395/8.0),
+    REAL_CONST(32365.060949407813/8.0),
+    REAL_CONST(32382.945903798463/8.0),
+    REAL_CONST(32400.83332797504/8.0),
+    REAL_CONST(32418.723221255706/8.0),
+    REAL_CONST(32436.615582959093/8.0),
+    REAL_CONST(32454.510412404306/8.0),
+    REAL_CONST(32472.407708910916/8.0),
+    REAL_CONST(32490.307471798966/8.0),
+    REAL_CONST(32508.209700388961/8.0),
+    REAL_CONST(32526.114394001877/8.0),
+    REAL_CONST(32544.021551959166/8.0),
+    REAL_CONST(32561.931173582732/8.0),
+    REAL_CONST(32579.843258194956/8.0),
+    REAL_CONST(32597.757805118679/8.0),
+    REAL_CONST(32615.674813677211/8.0),
+    REAL_CONST(32633.594283194328/8.0),
+    REAL_CONST(32651.516212994258/8.0),
+    REAL_CONST(32669.440602401712/8.0),
+    REAL_CONST(32687.367450741847/8.0),
+    REAL_CONST(32705.296757340297/8.0),
+    REAL_CONST(32723.228521523146/8.0),
+    REAL_CONST(32741.162742616943/8.0),
+    REAL_CONST(32759.099419948703/8.0),
+    REAL_CONST(32777.038552845901/8.0),
+    REAL_CONST(32794.980140636464/8.0),
+    REAL_CONST(32812.924182648792/8.0),
+    REAL_CONST(32830.87067821173/8.0),
+    REAL_CONST(32848.819626654593/8.0),
+    REAL_CONST(32866.77102730715/8.0),
+    REAL_CONST(32884.724879499619/8.0),
+    REAL_CONST(32902.681182562686/8.0),
+    REAL_CONST(32920.639935827494/8.0),
+    REAL_CONST(32938.601138625643/8.0),
+    REAL_CONST(32956.56479028918/8.0),
+    REAL_CONST(32974.530890150607/8.0),
+    REAL_CONST(32992.499437542894/8.0),
+    REAL_CONST(33010.470431799447/8.0),
+    REAL_CONST(33028.443872254145/8.0),
+    REAL_CONST(33046.419758241311/8.0),
+    REAL_CONST(33064.39808909571/8.0),
+    REAL_CONST(33082.378864152583/8.0),
+    REAL_CONST(33100.36208274759/8.0),
+    REAL_CONST(33118.347744216881/8.0),
+    REAL_CONST(33136.335847897026/8.0),
+    REAL_CONST(33154.326393125062/8.0),
+    REAL_CONST(33172.31937923847/8.0),
+    REAL_CONST(33190.314805575174/8.0),
+    REAL_CONST(33208.312671473555/8.0),
+    REAL_CONST(33226.312976272442/8.0),
+    REAL_CONST(33244.315719311111/8.0),
+    REAL_CONST(33262.320899929284/8.0),
+    REAL_CONST(33280.328517467125/8.0),
+    REAL_CONST(33298.33857126526/8.0),
+    REAL_CONST(33316.351060664747/8.0),
+    REAL_CONST(33334.365985007091/8.0),
+    REAL_CONST(33352.383343634239/8.0),
+    REAL_CONST(33370.403135888591/8.0),
+    REAL_CONST(33388.42536111299/8.0),
+    REAL_CONST(33406.450018650721/8.0),
+    REAL_CONST(33424.477107845501/8.0),
+    REAL_CONST(33442.506628041512/8.0),
+    REAL_CONST(33460.53857858335/8.0),
+    REAL_CONST(33478.572958816083/8.0),
+    REAL_CONST(33496.609768085189/8.0),
+    REAL_CONST(33514.649005736617/8.0),
+    REAL_CONST(33532.690671116739/8.0),
+    REAL_CONST(33550.734763572356/8.0),
+    REAL_CONST(33568.781282450735/8.0),
+    REAL_CONST(33586.830227099563/8.0),
+    REAL_CONST(33604.881596866973/8.0),
+    REAL_CONST(33622.935391101528/8.0),
+    REAL_CONST(33640.991609152239/8.0),
+    REAL_CONST(33659.050250368542/8.0),
+    REAL_CONST(33677.111314100322/8.0),
+    REAL_CONST(33695.174799697881/8.0),
+    REAL_CONST(33713.240706511984/8.0),
+    REAL_CONST(33731.309033893805/8.0),
+    REAL_CONST(33749.37978119497/8.0),
+    REAL_CONST(33767.452947767531/8.0),
+    REAL_CONST(33785.528532963974/8.0),
+    REAL_CONST(33803.606536137209/8.0),
+    REAL_CONST(33821.686956640602/8.0),
+    REAL_CONST(33839.769793827938/8.0),
+    REAL_CONST(33857.855047053425/8.0),
+    REAL_CONST(33875.942715671707/8.0),
+    REAL_CONST(33894.032799037872/8.0),
+    REAL_CONST(33912.125296507431/8.0),
+    REAL_CONST(33930.220207436316/8.0),
+    REAL_CONST(33948.317531180888/8.0),
+    REAL_CONST(33966.417267097961/8.0),
+    REAL_CONST(33984.519414544746/8.0),
+    REAL_CONST(34002.623972878901/8.0),
+    REAL_CONST(34020.730941458511/8.0),
+    REAL_CONST(34038.840319642077/8.0),
+    REAL_CONST(34056.952106788536/8.0),
+    REAL_CONST(34075.066302257255/8.0),
+    REAL_CONST(34093.182905408015/8.0),
+    REAL_CONST(34111.301915601027/8.0),
+    REAL_CONST(34129.42333219693/8.0),
+    REAL_CONST(34147.547154556785/8.0),
+    REAL_CONST(34165.673382042078/8.0),
+    REAL_CONST(34183.80201401472/8.0),
+    REAL_CONST(34201.933049837033/8.0),
+    REAL_CONST(34220.06648887178/8.0),
+    REAL_CONST(34238.202330482141/8.0),
+    REAL_CONST(34256.340574031703/8.0),
+    REAL_CONST(34274.481218884495/8.0),
+    REAL_CONST(34292.624264404949/8.0),
+    REAL_CONST(34310.769709957938/8.0),
+    REAL_CONST(34328.91755490873/8.0),
+    REAL_CONST(34347.067798623029/8.0),
+    REAL_CONST(34365.220440466954/8.0),
+    REAL_CONST(34383.375479807051/8.0),
+    REAL_CONST(34401.532916010263/8.0),
+    REAL_CONST(34419.692748443973/8.0),
+    REAL_CONST(34437.854976475966/8.0),
+    REAL_CONST(34456.01959947445/8.0),
+    REAL_CONST(34474.18661680806/8.0),
+    REAL_CONST(34492.356027845817/8.0),
+    REAL_CONST(34510.527831957188/8.0),
+    REAL_CONST(34528.702028512052/8.0),
+    REAL_CONST(34546.878616880676/8.0),
+    REAL_CONST(34565.05759643377/8.0),
+    REAL_CONST(34583.238966542449/8.0),
+    REAL_CONST(34601.422726578232/8.0),
+    REAL_CONST(34619.608875913065/8.0),
+    REAL_CONST(34637.797413919296/8.0),
+    REAL_CONST(34655.988339969692/8.0),
+    REAL_CONST(34674.181653437423/8.0),
+    REAL_CONST(34692.37735369608/8.0),
+    REAL_CONST(34710.575440119668/8.0),
+    REAL_CONST(34728.775912082579/8.0),
+    REAL_CONST(34746.978768959649/8.0),
+    REAL_CONST(34765.184010126082/8.0),
+    REAL_CONST(34783.391634957537/8.0),
+    REAL_CONST(34801.60164283005/8.0),
+    REAL_CONST(34819.814033120063/8.0),
+    REAL_CONST(34838.028805204456/8.0),
+    REAL_CONST(34856.24595846048/8.0),
+    REAL_CONST(34874.465492265823/8.0),
+    REAL_CONST(34892.687405998557/8.0),
+    REAL_CONST(34910.911699037177/8.0),
+    REAL_CONST(34929.138370760564/8.0),
+    REAL_CONST(34947.367420548027/8.0),
+    REAL_CONST(34965.598847779271/8.0),
+    REAL_CONST(34983.832651834389/8.0),
+    REAL_CONST(35002.068832093908/8.0),
+    REAL_CONST(35020.307387938738/8.0),
+    REAL_CONST(35038.548318750189/8.0),
+    REAL_CONST(35056.79162390998/8.0),
+    REAL_CONST(35075.03730280025/8.0),
+    REAL_CONST(35093.285354803513/8.0),
+    REAL_CONST(35111.535779302685/8.0),
+    REAL_CONST(35129.788575681116/8.0),
+    REAL_CONST(35148.043743322516/8.0),
+    REAL_CONST(35166.301281611013/8.0),
+    REAL_CONST(35184.561189931141/8.0),
+    REAL_CONST(35202.823467667826/8.0),
+    REAL_CONST(35221.088114206388/8.0),
+    REAL_CONST(35239.355128932555/8.0),
+    REAL_CONST(35257.624511232447/8.0),
+    REAL_CONST(35275.896260492584/8.0),
+    REAL_CONST(35294.170376099886/8.0),
+    REAL_CONST(35312.446857441668/8.0),
+    REAL_CONST(35330.725703905628/8.0),
+    REAL_CONST(35349.006914879887/8.0),
+    REAL_CONST(35367.290489752944/8.0),
+    REAL_CONST(35385.576427913686/8.0),
+    REAL_CONST(35403.864728751418/8.0),
+    REAL_CONST(35422.155391655811/8.0),
+    REAL_CONST(35440.448416016967/8.0),
+    REAL_CONST(35458.743801225341/8.0),
+    REAL_CONST(35477.041546671804/8.0),
+    REAL_CONST(35495.341651747622/8.0),
+    REAL_CONST(35513.644115844436/8.0),
+    REAL_CONST(35531.948938354304/8.0),
+    REAL_CONST(35550.256118669655/8.0),
+    REAL_CONST(35568.565656183309/8.0),
+    REAL_CONST(35586.877550288496/8.0),
+    REAL_CONST(35605.191800378816/8.0),
+    REAL_CONST(35623.508405848268/8.0),
+    REAL_CONST(35641.827366091238/8.0),
+    REAL_CONST(35660.148680502505/8.0),
+    REAL_CONST(35678.472348477233/8.0),
+    REAL_CONST(35696.798369410979/8.0),
+    REAL_CONST(35715.126742699678/8.0),
+    REAL_CONST(35733.457467739659/8.0),
+    REAL_CONST(35751.790543927644/8.0),
+    REAL_CONST(35770.125970660738/8.0),
+    REAL_CONST(35788.46374733642/8.0),
+    REAL_CONST(35806.803873352568/8.0),
+    REAL_CONST(35825.146348107453/8.0),
+    REAL_CONST(35843.49117099971/8.0),
+    REAL_CONST(35861.838341428367/8.0),
+    REAL_CONST(35880.187858792851/8.0),
+    REAL_CONST(35898.539722492955/8.0),
+    REAL_CONST(35916.893931928862/8.0),
+    REAL_CONST(35935.250486501129/8.0),
+    REAL_CONST(35953.609385610718/8.0),
+    REAL_CONST(35971.970628658957/8.0),
+    REAL_CONST(35990.334215047558/8.0),
+    REAL_CONST(36008.700144178612/8.0),
+    REAL_CONST(36027.068415454596/8.0),
+    REAL_CONST(36045.439028278372/8.0),
+    REAL_CONST(36063.811982053165/8.0),
+    REAL_CONST(36082.187276182609/8.0),
+    REAL_CONST(36100.564910070694/8.0),
+    REAL_CONST(36118.944883121789/8.0),
+    REAL_CONST(36137.327194740654/8.0),
+    REAL_CONST(36155.711844332429/8.0),
+    REAL_CONST(36174.098831302617/8.0),
+    REAL_CONST(36192.488155057115/8.0),
+    REAL_CONST(36210.87981500219/8.0),
+    REAL_CONST(36229.273810544473/8.0),
+    REAL_CONST(36247.670141091003/8.0),
+    REAL_CONST(36266.068806049167/8.0),
+    REAL_CONST(36284.469804826738/8.0),
+    REAL_CONST(36302.873136831862/8.0),
+    REAL_CONST(36321.278801473069/8.0),
+    REAL_CONST(36339.686798159251/8.0),
+    REAL_CONST(36358.097126299683/8.0),
+    REAL_CONST(36376.509785304013/8.0),
+    REAL_CONST(36394.924774582258/8.0),
+    REAL_CONST(36413.342093544816/8.0),
+    REAL_CONST(36431.761741602444/8.0),
+    REAL_CONST(36450.183718166292/8.0),
+    REAL_CONST(36468.608022647859/8.0),
+    REAL_CONST(36487.034654459028/8.0),
+    REAL_CONST(36505.463613012063/8.0),
+    REAL_CONST(36523.894897719583/8.0),
+    REAL_CONST(36542.328507994578/8.0),
+    REAL_CONST(36560.764443250409/8.0),
+    REAL_CONST(36579.202702900831/8.0),
+    REAL_CONST(36597.643286359926/8.0),
+    REAL_CONST(36616.086193042182/8.0),
+    REAL_CONST(36634.531422362437/8.0),
+    REAL_CONST(36652.978973735895/8.0),
+    REAL_CONST(36671.428846578143/8.0),
+    REAL_CONST(36689.881040305125/8.0),
+    REAL_CONST(36708.335554333149/8.0),
+    REAL_CONST(36726.792388078902/8.0),
+    REAL_CONST(36745.251540959427/8.0),
+    REAL_CONST(36763.713012392138/8.0),
+    REAL_CONST(36782.176801794812/8.0),
+    REAL_CONST(36800.642908585593/8.0),
+    REAL_CONST(36819.111332182983/8.0),
+    REAL_CONST(36837.582072005869/8.0),
+    REAL_CONST(36856.055127473483/8.0),
+    REAL_CONST(36874.530498005421/8.0),
+    REAL_CONST(36893.008183021651/8.0),
+    REAL_CONST(36911.488181942506/8.0),
+    REAL_CONST(36929.970494188674/8.0),
+    REAL_CONST(36948.455119181206/8.0),
+    REAL_CONST(36966.942056341519/8.0),
+    REAL_CONST(36985.431305091392/8.0),
+    REAL_CONST(37003.922864852961/8.0),
+    REAL_CONST(37022.416735048733/8.0),
+    REAL_CONST(37040.912915101559/8.0),
+    REAL_CONST(37059.411404434657/8.0),
+    REAL_CONST(37077.91220247162/8.0),
+    REAL_CONST(37096.415308636388/8.0),
+    REAL_CONST(37114.920722353243/8.0),
+    REAL_CONST(37133.428443046862/8.0),
+    REAL_CONST(37151.938470142253/8.0),
+    REAL_CONST(37170.450803064785/8.0),
+    REAL_CONST(37188.965441240209/8.0),
+    REAL_CONST(37207.482384094597/8.0),
+    REAL_CONST(37226.001631054402/8.0),
+    REAL_CONST(37244.523181546429/8.0),
+    REAL_CONST(37263.047034997842/8.0),
+    REAL_CONST(37281.573190836149/8.0),
+    REAL_CONST(37300.101648489224/8.0),
+    REAL_CONST(37318.632407385296/8.0),
+    REAL_CONST(37337.165466952945/8.0),
+    REAL_CONST(37355.700826621112/8.0),
+    REAL_CONST(37374.238485819085/8.0),
+    REAL_CONST(37392.778443976509/8.0),
+    REAL_CONST(37411.320700523385/8.0),
+    REAL_CONST(37429.865254890057/8.0),
+    REAL_CONST(37448.412106507232/8.0),
+    REAL_CONST(37466.961254805974/8.0),
+    REAL_CONST(37485.512699217681/8.0),
+    REAL_CONST(37504.066439174116/8.0),
+    REAL_CONST(37522.622474107404/8.0),
+    REAL_CONST(37541.180803449992/8.0),
+    REAL_CONST(37559.741426634704/8.0),
+    REAL_CONST(37578.304343094693/8.0),
+    REAL_CONST(37596.869552263488/8.0),
+    REAL_CONST(37615.43705357494/8.0),
+    REAL_CONST(37634.006846463279/8.0),
+    REAL_CONST(37652.578930363044/8.0),
+    REAL_CONST(37671.153304709165/8.0),
+    REAL_CONST(37689.729968936896/8.0),
+    REAL_CONST(37708.308922481847/8.0),
+    REAL_CONST(37726.890164779965/8.0),
+    REAL_CONST(37745.473695267559/8.0),
+    REAL_CONST(37764.059513381275/8.0),
+    REAL_CONST(37782.647618558112/8.0),
+    REAL_CONST(37801.238010235415/8.0),
+    REAL_CONST(37819.830687850859/8.0),
+    REAL_CONST(37838.425650842495/8.0),
+    REAL_CONST(37857.022898648691/8.0),
+    REAL_CONST(37875.622430708172/8.0),
+    REAL_CONST(37894.224246460013/8.0),
+    REAL_CONST(37912.828345343616/8.0),
+    REAL_CONST(37931.434726798747/8.0),
+    REAL_CONST(37950.043390265506/8.0),
+    REAL_CONST(37968.654335184328/8.0),
+    REAL_CONST(37987.267560995999/8.0),
+    REAL_CONST(38005.883067141665/8.0),
+    REAL_CONST(38024.500853062775/8.0),
+    REAL_CONST(38043.120918201159/8.0),
+    REAL_CONST(38061.743261998963/8.0),
+    REAL_CONST(38080.367883898682/8.0),
+    REAL_CONST(38098.994783343158/8.0),
+    REAL_CONST(38117.623959775563/8.0),
+    REAL_CONST(38136.255412639417/8.0),
+    REAL_CONST(38154.889141378575/8.0),
+    REAL_CONST(38173.525145437234/8.0),
+    REAL_CONST(38192.163424259939/8.0),
+    REAL_CONST(38210.803977291551/8.0),
+    REAL_CONST(38229.446803977284/8.0),
+    REAL_CONST(38248.091903762703/8.0),
+    REAL_CONST(38266.739276093685/8.0),
+    REAL_CONST(38285.388920416466/8.0),
+    REAL_CONST(38304.040836177606/8.0),
+    REAL_CONST(38322.695022824002/8.0),
+    REAL_CONST(38341.351479802899/8.0),
+    REAL_CONST(38360.010206561863/8.0),
+    REAL_CONST(38378.671202548816/8.0),
+    REAL_CONST(38397.334467211993/8.0),
+    REAL_CONST(38415.999999999978/8.0),
+    REAL_CONST(38434.667800361683/8.0),
+    REAL_CONST(38453.33786774637/8.0),
+    REAL_CONST(38472.010201603611/8.0),
+    REAL_CONST(38490.684801383337/8.0),
+    REAL_CONST(38509.361666535784/8.0),
+    REAL_CONST(38528.040796511552/8.0),
+    REAL_CONST(38546.722190761553/8.0),
+    REAL_CONST(38565.405848737035/8.0),
+    REAL_CONST(38584.091769889594/8.0),
+    REAL_CONST(38602.779953671132/8.0),
+    REAL_CONST(38621.470399533908/8.0),
+    REAL_CONST(38640.163106930493/8.0),
+    REAL_CONST(38658.858075313794/8.0),
+    REAL_CONST(38677.555304137059/8.0),
+    REAL_CONST(38696.254792853862/8.0),
+    REAL_CONST(38714.956540918094/8.0),
+    REAL_CONST(38733.660547783991/8.0),
+    REAL_CONST(38752.366812906112/8.0),
+    REAL_CONST(38771.075335739348/8.0),
+    REAL_CONST(38789.78611573892/8.0),
+    REAL_CONST(38808.499152360368/8.0),
+    REAL_CONST(38827.214445059573/8.0),
+    REAL_CONST(38845.931993292739/8.0),
+    REAL_CONST(38864.651796516388/8.0),
+    REAL_CONST(38883.373854187383/8.0),
+    REAL_CONST(38902.098165762916/8.0),
+    REAL_CONST(38920.824730700486/8.0),
+    REAL_CONST(38939.553548457938/8.0),
+    REAL_CONST(38958.284618493431/8.0),
+    REAL_CONST(38977.017940265461/8.0),
+    REAL_CONST(38995.753513232834/8.0),
+    REAL_CONST(39014.491336854699/8.0),
+    REAL_CONST(39033.231410590517/8.0),
+    REAL_CONST(39051.973733900079/8.0),
+    REAL_CONST(39070.718306243485/8.0),
+    REAL_CONST(39089.465127081188/8.0),
+    REAL_CONST(39108.214195873945/8.0),
+    REAL_CONST(39126.965512082832/8.0),
+    REAL_CONST(39145.719075169261/8.0),
+    REAL_CONST(39164.474884594965/8.0),
+    REAL_CONST(39183.232939821988/8.0),
+    REAL_CONST(39201.99324031271/8.0),
+    REAL_CONST(39220.755785529815/8.0),
+    REAL_CONST(39239.52057493633/8.0),
+    REAL_CONST(39258.287607995589/8.0),
+    REAL_CONST(39277.056884171245/8.0),
+    REAL_CONST(39295.828402927284/8.0),
+    REAL_CONST(39314.602163728006/8.0),
+    REAL_CONST(39333.378166038019/8.0),
+    REAL_CONST(39352.15640932227/8.0),
+    REAL_CONST(39370.936893046004/8.0),
+    REAL_CONST(39389.719616674811/8.0),
+    REAL_CONST(39408.504579674584/8.0),
+    REAL_CONST(39427.291781511522/8.0),
+    REAL_CONST(39446.081221652174/8.0),
+    REAL_CONST(39464.872899563372/8.0),
+    REAL_CONST(39483.666814712291/8.0),
+    REAL_CONST(39502.462966566411/8.0),
+    REAL_CONST(39521.261354593538/8.0),
+    REAL_CONST(39540.06197826178/8.0),
+    REAL_CONST(39558.864837039568/8.0),
+    REAL_CONST(39577.669930395656/8.0),
+    REAL_CONST(39596.47725779911/8.0),
+    REAL_CONST(39615.286818719302/8.0),
+    REAL_CONST(39634.098612625923/8.0),
+    REAL_CONST(39652.912638988993/8.0),
+    REAL_CONST(39671.728897278823/8.0),
+    REAL_CONST(39690.547386966064/8.0),
+    REAL_CONST(39709.368107521652/8.0),
+    REAL_CONST(39728.191058416858/8.0),
+    REAL_CONST(39747.016239123259/8.0),
+    REAL_CONST(39765.84364911275/8.0),
+    REAL_CONST(39784.673287857528/8.0),
+    REAL_CONST(39803.505154830105/8.0),
+    REAL_CONST(39822.339249503319/8.0),
+    REAL_CONST(39841.175571350293/8.0),
+    REAL_CONST(39860.014119844491/8.0),
+    REAL_CONST(39878.854894459677/8.0),
+    REAL_CONST(39897.697894669909/8.0),
+    REAL_CONST(39916.54311994958/8.0),
+    REAL_CONST(39935.390569773372/8.0),
+    REAL_CONST(39954.240243616303/8.0),
+    REAL_CONST(39973.092140953675/8.0),
+    REAL_CONST(39991.946261261117/8.0),
+    REAL_CONST(40010.802604014549/8.0),
+    REAL_CONST(40029.661168690225/8.0),
+    REAL_CONST(40048.521954764678/8.0),
+    REAL_CONST(40067.384961714779/8.0),
+    REAL_CONST(40086.250189017679/8.0),
+    REAL_CONST(40105.117636150855/8.0),
+    REAL_CONST(40123.98730259209/8.0),
+    REAL_CONST(40142.859187819471/8.0),
+    REAL_CONST(40161.733291311379/8.0),
+    REAL_CONST(40180.609612546526/8.0),
+    REAL_CONST(40199.488151003912/8.0),
+    REAL_CONST(40218.368906162854/8.0),
+    REAL_CONST(40237.25187750296/8.0),
+    REAL_CONST(40256.137064504153/8.0),
+    REAL_CONST(40275.024466646668/8.0),
+    REAL_CONST(40293.914083411029/8.0),
+    REAL_CONST(40312.805914278084/8.0),
+    REAL_CONST(40331.699958728961/8.0),
+    REAL_CONST(40350.596216245103/8.0),
+    REAL_CONST(40369.494686308273/8.0),
+    REAL_CONST(40388.39536840051/8.0),
+    REAL_CONST(40407.298262004173/8.0),
+    REAL_CONST(40426.20336660192/8.0),
+    REAL_CONST(40445.110681676706/8.0),
+    REAL_CONST(40464.020206711793/8.0),
+    REAL_CONST(40482.931941190756/8.0),
+    REAL_CONST(40501.845884597446/8.0),
+    REAL_CONST(40520.762036416032/8.0),
+    REAL_CONST(40539.680396130985/8.0),
+    REAL_CONST(40558.600963227072/8.0),
+    REAL_CONST(40577.523737189367/8.0),
+    REAL_CONST(40596.448717503234/8.0),
+    REAL_CONST(40615.375903654342/8.0),
+    REAL_CONST(40634.305295128659/8.0),
+    REAL_CONST(40653.236891412453/8.0),
+    REAL_CONST(40672.170691992294/8.0),
+    REAL_CONST(40691.106696355047/8.0),
+    REAL_CONST(40710.044903987873/8.0),
+    REAL_CONST(40728.985314378238/8.0),
+    REAL_CONST(40747.927927013901/8.0),
+    REAL_CONST(40766.872741382918/8.0),
+    REAL_CONST(40785.819756973651/8.0),
+    REAL_CONST(40804.768973274746/8.0),
+    REAL_CONST(40823.720389775161/8.0),
+    REAL_CONST(40842.674005964131/8.0),
+    REAL_CONST(40861.629821331211/8.0),
+    REAL_CONST(40880.587835366234/8.0),
+    REAL_CONST(40899.548047559321/8.0),
+    REAL_CONST(40918.510457400931/8.0),
+    REAL_CONST(40937.475064381761/8.0),
+    REAL_CONST(40956.441867992849/8.0),
+    REAL_CONST(40975.410867725499/8.0),
+    REAL_CONST(40994.382063071331/8.0),
+    REAL_CONST(41013.355453522236/8.0),
+    REAL_CONST(41032.331038570417/8.0),
+    REAL_CONST(41051.308817708363/8.0),
+    REAL_CONST(41070.288790428858/8.0),
+    REAL_CONST(41089.270956224987/8.0),
+    REAL_CONST(41108.255314590111/8.0),
+    REAL_CONST(41127.241865017888/8.0),
+    REAL_CONST(41146.23060700229/8.0),
+    REAL_CONST(41165.221540037543/8.0),
+    REAL_CONST(41184.214663618193/8.0),
+    REAL_CONST(41203.209977239079/8.0),
+    REAL_CONST(41222.207480395307/8.0),
+    REAL_CONST(41241.207172582297/8.0),
+    REAL_CONST(41260.209053295752/8.0),
+    REAL_CONST(41279.213122031659/8.0),
+    REAL_CONST(41298.219378286303/8.0),
+    REAL_CONST(41317.227821556255/8.0),
+    REAL_CONST(41336.23845133838/8.0),
+    REAL_CONST(41355.251267129832/8.0),
+    REAL_CONST(41374.266268428037/8.0),
+    REAL_CONST(41393.283454730743/8.0),
+    REAL_CONST(41412.302825535953/8.0),
+    REAL_CONST(41431.324380341983/8.0),
+    REAL_CONST(41450.348118647416/8.0),
+    REAL_CONST(41469.374039951144/8.0),
+    REAL_CONST(41488.402143752326/8.0),
+    REAL_CONST(41507.432429550427/8.0),
+    REAL_CONST(41526.464896845187/8.0),
+    REAL_CONST(41545.499545136627/8.0),
+    REAL_CONST(41564.536373925075/8.0),
+    REAL_CONST(41583.575382711126/8.0),
+    REAL_CONST(41602.616570995662/8.0),
+    REAL_CONST(41621.659938279874/8.0),
+    REAL_CONST(41640.705484065205/8.0),
+    REAL_CONST(41659.753207853406/8.0),
+    REAL_CONST(41678.803109146495/8.0),
+    REAL_CONST(41697.855187446803/8.0),
+    REAL_CONST(41716.909442256911/8.0),
+    REAL_CONST(41735.965873079709/8.0),
+    REAL_CONST(41755.02447941836/8.0),
+    REAL_CONST(41774.085260776315/8.0),
+    REAL_CONST(41793.148216657297/8.0),
+    REAL_CONST(41812.213346565331/8.0),
+    REAL_CONST(41831.280650004708/8.0),
+    REAL_CONST(41850.350126480014/8.0),
+    REAL_CONST(41869.421775496106/8.0),
+    REAL_CONST(41888.495596558132/8.0),
+    REAL_CONST(41907.571589171515/8.0),
+    REAL_CONST(41926.649752841957/8.0),
+    REAL_CONST(41945.730087075463/8.0),
+    REAL_CONST(41964.812591378286/8.0),
+    REAL_CONST(41983.897265256979/8.0),
+    REAL_CONST(42002.984108218378/8.0),
+    REAL_CONST(42022.073119769593/8.0),
+    REAL_CONST(42041.164299418015/8.0),
+    REAL_CONST(42060.257646671307/8.0),
+    REAL_CONST(42079.353161037419/8.0),
+    REAL_CONST(42098.450842024591/8.0),
+    REAL_CONST(42117.550689141324/8.0),
+    REAL_CONST(42136.652701896404/8.0),
+    REAL_CONST(42155.756879798893/8.0),
+    REAL_CONST(42174.863222358137/8.0),
+    REAL_CONST(42193.971729083758/8.0),
+    REAL_CONST(42213.082399485655/8.0),
+    REAL_CONST(42232.195233074002/8.0),
+    REAL_CONST(42251.310229359246/8.0),
+    REAL_CONST(42270.427387852127/8.0),
+    REAL_CONST(42289.546708063644/8.0),
+    REAL_CONST(42308.668189505079/8.0),
+    REAL_CONST(42327.791831687995/8.0),
+    REAL_CONST(42346.917634124227/8.0),
+    REAL_CONST(42366.045596325886/8.0),
+    REAL_CONST(42385.175717805352/8.0),
+    REAL_CONST(42404.307998075295/8.0),
+    REAL_CONST(42423.442436648642/8.0),
+    REAL_CONST(42442.579033038608/8.0),
+    REAL_CONST(42461.717786758672/8.0),
+    REAL_CONST(42480.858697322597/8.0),
+    REAL_CONST(42500.001764244422/8.0),
+    REAL_CONST(42519.146987038446/8.0),
+    REAL_CONST(42538.294365219248/8.0),
+    REAL_CONST(42557.443898301688/8.0),
+    REAL_CONST(42576.595585800882/8.0),
+    REAL_CONST(42595.749427232236/8.0),
+    REAL_CONST(42614.90542211142/8.0),
+    REAL_CONST(42634.063569954378/8.0),
+    REAL_CONST(42653.223870277317/8.0),
+    REAL_CONST(42672.386322596729/8.0),
+    REAL_CONST(42691.55092642938/8.0),
+    REAL_CONST(42710.717681292292/8.0),
+    REAL_CONST(42729.886586702756/8.0),
+    REAL_CONST(42749.057642178363/8.0),
+    REAL_CONST(42768.23084723694/8.0),
+    REAL_CONST(42787.406201396603/8.0),
+    REAL_CONST(42806.58370417574/8.0),
+    REAL_CONST(42825.76335509299/8.0),
+    REAL_CONST(42844.945153667286/8.0),
+    REAL_CONST(42864.129099417805/8.0),
+    REAL_CONST(42883.315191864014/8.0),
+    REAL_CONST(42902.503430525649/8.0),
+    REAL_CONST(42921.693814922692/8.0),
+    REAL_CONST(42940.88634457541/8.0),
+    REAL_CONST(42960.081019004348/8.0),
+    REAL_CONST(42979.277837730297/8.0),
+    REAL_CONST(42998.476800274322/8.0),
+    REAL_CONST(43017.677906157769/8.0),
+    REAL_CONST(43036.881154902228/8.0),
+    REAL_CONST(43056.086546029583/8.0),
+    REAL_CONST(43075.294079061961/8.0),
+    REAL_CONST(43094.503753521763/8.0),
+    REAL_CONST(43113.715568931671/8.0),
+    REAL_CONST(43132.929524814601/8.0),
+    REAL_CONST(43152.145620693766/8.0),
+    REAL_CONST(43171.363856092619/8.0),
+    REAL_CONST(43190.584230534907/8.0),
+    REAL_CONST(43209.806743544621/8.0),
+    REAL_CONST(43229.031394646016/8.0),
+    REAL_CONST(43248.258183363621/8.0),
+    REAL_CONST(43267.487109222224/8.0),
+    REAL_CONST(43286.718171746885/8.0),
+    REAL_CONST(43305.951370462906/8.0),
+    REAL_CONST(43325.186704895881/8.0),
+    REAL_CONST(43344.42417457165/8.0),
+    REAL_CONST(43363.663779016322/8.0),
+    REAL_CONST(43382.905517756262/8.0),
+    REAL_CONST(43402.149390318104/8.0),
+    REAL_CONST(43421.395396228749/8.0),
+    REAL_CONST(43440.643535015348/8.0),
+    REAL_CONST(43459.89380620532/8.0),
+    REAL_CONST(43479.146209326354/8.0),
+    REAL_CONST(43498.400743906379/8.0),
+    REAL_CONST(43517.657409473606/8.0),
+    REAL_CONST(43536.916205556496/8.0),
+    REAL_CONST(43556.177131683784/8.0),
+    REAL_CONST(43575.44018738444/8.0),
+    REAL_CONST(43594.705372187724/8.0),
+    REAL_CONST(43613.972685623135/8.0),
+    REAL_CONST(43633.242127220445/8.0),
+    REAL_CONST(43652.513696509668/8.0),
+    REAL_CONST(43671.787393021099/8.0),
+    REAL_CONST(43691.063216285271/8.0),
+    REAL_CONST(43710.341165833001/8.0),
+    REAL_CONST(43729.621241195346/8.0),
+    REAL_CONST(43748.903441903625/8.0),
+    REAL_CONST(43768.187767489413/8.0),
+    REAL_CONST(43787.474217484552/8.0),
+    REAL_CONST(43806.762791421126/8.0),
+    REAL_CONST(43826.053488831501/8.0),
+    REAL_CONST(43845.346309248278/8.0),
+    REAL_CONST(43864.641252204325/8.0),
+    REAL_CONST(43883.938317232765/8.0),
+    REAL_CONST(43903.237503866971/8.0),
+    REAL_CONST(43922.538811640596/8.0),
+    REAL_CONST(43941.842240087513/8.0),
+    REAL_CONST(43961.147788741881/8.0),
+    REAL_CONST(43980.455457138101/8.0),
+    REAL_CONST(43999.765244810835/8.0),
+    REAL_CONST(44019.077151295001/8.0),
+    REAL_CONST(44038.391176125755/8.0),
+    REAL_CONST(44057.70731883854/8.0),
+    REAL_CONST(44077.02557896902/8.0),
+    REAL_CONST(44096.345956053141/8.0),
+    REAL_CONST(44115.668449627083/8.0),
+    REAL_CONST(44134.993059227287/8.0),
+    REAL_CONST(44154.319784390456/8.0),
+    REAL_CONST(44173.648624653535/8.0),
+    REAL_CONST(44192.979579553728/8.0),
+    REAL_CONST(44212.312648628489/8.0),
+    REAL_CONST(44231.647831415532/8.0),
+    REAL_CONST(44250.985127452805/8.0),
+    REAL_CONST(44270.324536278538/8.0),
+    REAL_CONST(44289.666057431183/8.0),
+    REAL_CONST(44309.009690449464/8.0),
+    REAL_CONST(44328.355434872348/8.0),
+    REAL_CONST(44347.703290239064/8.0),
+    REAL_CONST(44367.053256089079/8.0),
+    REAL_CONST(44386.405331962109/8.0),
+    REAL_CONST(44405.759517398139/8.0),
+    REAL_CONST(44425.115811937387/8.0),
+    REAL_CONST(44444.474215120332/8.0),
+    REAL_CONST(44463.834726487694/8.0),
+    REAL_CONST(44483.197345580462/8.0),
+    REAL_CONST(44502.562071939843/8.0),
+    REAL_CONST(44521.928905107328/8.0),
+    REAL_CONST(44541.297844624634/8.0),
+    REAL_CONST(44560.668890033732/8.0),
+    REAL_CONST(44580.042040876848/8.0),
+    REAL_CONST(44599.417296696454/8.0),
+    REAL_CONST(44618.794657035272/8.0),
+    REAL_CONST(44638.174121436256/8.0),
+    REAL_CONST(44657.555689442641/8.0),
+    REAL_CONST(44676.939360597877/8.0),
+    REAL_CONST(44696.325134445673/8.0),
+    REAL_CONST(44715.713010530002/8.0),
+    REAL_CONST(44735.102988395054/8.0),
+    REAL_CONST(44754.495067585296/8.0),
+    REAL_CONST(44773.88924764542/8.0),
+    REAL_CONST(44793.285528120374/8.0),
+    REAL_CONST(44812.683908555344/8.0),
+    REAL_CONST(44832.084388495779/8.0),
+    REAL_CONST(44851.486967487363/8.0),
+    REAL_CONST(44870.891645076015/8.0),
+    REAL_CONST(44890.298420807922/8.0),
+    REAL_CONST(44909.707294229491/8.0),
+    REAL_CONST(44929.118264887409/8.0),
+    REAL_CONST(44948.531332328566/8.0),
+    REAL_CONST(44967.946496100136/8.0),
+    REAL_CONST(44987.363755749502/8.0),
+    REAL_CONST(45006.783110824319/8.0),
+    REAL_CONST(45026.204560872473/8.0),
+    REAL_CONST(45045.628105442098/8.0),
+    REAL_CONST(45065.053744081561/8.0),
+    REAL_CONST(45084.48147633949/8.0),
+    REAL_CONST(45103.911301764747/8.0),
+    REAL_CONST(45123.343219906426/8.0),
+    REAL_CONST(45142.777230313885/8.0),
+    REAL_CONST(45162.21333253671/8.0),
+    REAL_CONST(45181.651526124733/8.0),
+    REAL_CONST(45201.091810628037/8.0),
+    REAL_CONST(45220.534185596924/8.0),
+    REAL_CONST(45239.978650581965/8.0),
+    REAL_CONST(45259.425205133957/8.0),
+    REAL_CONST(45278.873848803938/8.0),
+    REAL_CONST(45298.324581143192/8.0),
+    REAL_CONST(45317.777401703235/8.0),
+    REAL_CONST(45337.232310035848/8.0),
+    REAL_CONST(45356.68930569302/8.0),
+    REAL_CONST(45376.148388226997/8.0),
+    REAL_CONST(45395.60955719027/8.0),
+    REAL_CONST(45415.072812135557/8.0),
+    REAL_CONST(45434.538152615823/8.0),
+    REAL_CONST(45454.005578184282/8.0),
+    REAL_CONST(45473.475088394356/8.0),
+    REAL_CONST(45492.946682799746/8.0),
+    REAL_CONST(45512.420360954362/8.0),
+    REAL_CONST(45531.896122412363/8.0),
+    REAL_CONST(45551.373966728155/8.0),
+    REAL_CONST(45570.853893456362/8.0),
+    REAL_CONST(45590.33590215187/8.0),
+    REAL_CONST(45609.819992369776/8.0),
+    REAL_CONST(45629.306163665438/8.0),
+    REAL_CONST(45648.794415594442/8.0),
+    REAL_CONST(45668.284747712612/8.0),
+    REAL_CONST(45687.777159576006/8.0),
+    REAL_CONST(45707.27165074092/8.0),
+    REAL_CONST(45726.768220763894/8.0),
+    REAL_CONST(45746.266869201696/8.0),
+    REAL_CONST(45765.767595611323/8.0),
+    REAL_CONST(45785.270399550034/8.0),
+    REAL_CONST(45804.775280575297/8.0),
+    REAL_CONST(45824.282238244828/8.0),
+    REAL_CONST(45843.79127211657/8.0),
+    REAL_CONST(45863.302381748719/8.0),
+    REAL_CONST(45882.815566699683/8.0),
+    REAL_CONST(45902.33082652813/8.0),
+    REAL_CONST(45921.848160792935/8.0),
+    REAL_CONST(45941.367569053225/8.0),
+    REAL_CONST(45960.889050868354/8.0),
+    REAL_CONST(45980.41260579793/8.0),
+    REAL_CONST(45999.938233401757/8.0),
+    REAL_CONST(46019.465933239902/8.0),
+    REAL_CONST(46038.995704872657/8.0),
+    REAL_CONST(46058.527547860547/8.0),
+    REAL_CONST(46078.06146176433/8.0),
+    REAL_CONST(46097.597446144995/8.0),
+    REAL_CONST(46117.135500563774/8.0),
+    REAL_CONST(46136.675624582109/8.0),
+    REAL_CONST(46156.217817761702/8.0),
+    REAL_CONST(46175.762079664462/8.0),
+    REAL_CONST(46195.308409852543/8.0),
+    REAL_CONST(46214.856807888333/8.0),
+    REAL_CONST(46234.407273334444/8.0),
+    REAL_CONST(46253.959805753715/8.0),
+    REAL_CONST(46273.51440470924/8.0),
+    REAL_CONST(46293.071069764315/8.0),
+    REAL_CONST(46312.629800482478/8.0),
+    REAL_CONST(46332.190596427499/8.0),
+    REAL_CONST(46351.753457163381/8.0),
+    REAL_CONST(46371.318382254351/8.0),
+    REAL_CONST(46390.885371264863/8.0),
+    REAL_CONST(46410.45442375962/8.0),
+    REAL_CONST(46430.025539303526/8.0),
+    REAL_CONST(46449.598717461733/8.0),
+    REAL_CONST(46469.17395779962/8.0),
+    REAL_CONST(46488.751259882782/8.0),
+    REAL_CONST(46508.33062327707/8.0),
+    REAL_CONST(46527.912047548532/8.0),
+    REAL_CONST(46547.495532263471/8.0),
+    REAL_CONST(46567.081076988397/8.0),
+    REAL_CONST(46586.668681290059/8.0),
+    REAL_CONST(46606.258344735434/8.0),
+    REAL_CONST(46625.850066891719/8.0),
+    REAL_CONST(46645.443847326351/8.0),
+    REAL_CONST(46665.039685606986/8.0),
+    REAL_CONST(46684.637581301497/8.0),
+    REAL_CONST(46704.237533978005/8.0),
+    REAL_CONST(46723.839543204842/8.0),
+    REAL_CONST(46743.443608550573/8.0),
+    REAL_CONST(46763.049729583989/8.0),
+    REAL_CONST(46782.657905874104/8.0),
+    REAL_CONST(46802.268136990162/8.0),
+    REAL_CONST(46821.880422501628/8.0),
+    REAL_CONST(46841.494761978196/8.0),
+    REAL_CONST(46861.111154989776/8.0),
+    REAL_CONST(46880.729601106526/8.0),
+    REAL_CONST(46900.350099898795/8.0),
+    REAL_CONST(46919.97265093719/8.0),
+    REAL_CONST(46939.597253792526/8.0),
+    REAL_CONST(46959.223908035841/8.0),
+    REAL_CONST(46978.852613238392/8.0),
+    REAL_CONST(46998.483368971691/8.0),
+    REAL_CONST(47018.11617480743/8.0),
+    REAL_CONST(47037.751030317551/8.0),
+    REAL_CONST(47057.387935074221/8.0),
+    REAL_CONST(47077.026888649809/8.0),
+    REAL_CONST(47096.66789061694/8.0),
+    REAL_CONST(47116.310940548428/8.0),
+    REAL_CONST(47135.956038017328/8.0),
+    REAL_CONST(47155.603182596918/8.0),
+    REAL_CONST(47175.252373860698/8.0),
+    REAL_CONST(47194.903611382375/8.0),
+    REAL_CONST(47214.556894735892/8.0),
+    REAL_CONST(47234.212223495422/8.0),
+    REAL_CONST(47253.869597235338/8.0),
+    REAL_CONST(47273.52901553025/8.0),
+    REAL_CONST(47293.19047795498/8.0),
+    REAL_CONST(47312.853984084577/8.0),
+    REAL_CONST(47332.519533494306/8.0),
+    REAL_CONST(47352.187125759658/8.0),
+    REAL_CONST(47371.856760456343/8.0),
+    REAL_CONST(47391.528437160297/8.0),
+    REAL_CONST(47411.202155447652/8.0),
+    REAL_CONST(47430.877914894787/8.0),
+    REAL_CONST(47450.555715078299/8.0),
+    REAL_CONST(47470.235555574982/8.0),
+    REAL_CONST(47489.917435961863/8.0),
+    REAL_CONST(47509.601355816201/8.0),
+    REAL_CONST(47529.287314715453/8.0),
+    REAL_CONST(47548.975312237308/8.0),
+    REAL_CONST(47568.665347959672/8.0),
+    REAL_CONST(47588.357421460656/8.0),
+    REAL_CONST(47608.051532318605/8.0),
+    REAL_CONST(47627.747680112072/8.0),
+    REAL_CONST(47647.445864419846/8.0),
+    REAL_CONST(47667.14608482091/8.0),
+    REAL_CONST(47686.848340894474/8.0),
+    REAL_CONST(47706.552632219973/8.0),
+    REAL_CONST(47726.258958377046/8.0),
+    REAL_CONST(47745.967318945557/8.0),
+    REAL_CONST(47765.677713505589/8.0),
+    REAL_CONST(47785.390141637428/8.0),
+    REAL_CONST(47805.104602921601/8.0),
+    REAL_CONST(47824.821096938824/8.0),
+    REAL_CONST(47844.539623270044/8.0),
+    REAL_CONST(47864.260181496429/8.0),
+    REAL_CONST(47883.982771199349/8.0),
+    REAL_CONST(47903.707391960394/8.0),
+    REAL_CONST(47923.434043361369/8.0),
+    REAL_CONST(47943.162724984308/8.0),
+    REAL_CONST(47962.893436411439/8.0),
+    REAL_CONST(47982.626177225218/8.0),
+    REAL_CONST(48002.36094700831/8.0),
+    REAL_CONST(48022.097745343599/8.0),
+    REAL_CONST(48041.836571814172/8.0),
+    REAL_CONST(48061.57742600335/8.0),
+    REAL_CONST(48081.32030749465/8.0),
+    REAL_CONST(48101.065215871815/8.0),
+    REAL_CONST(48120.81215071879/8.0),
+    REAL_CONST(48140.56111161974/8.0),
+    REAL_CONST(48160.312098159047/8.0),
+    REAL_CONST(48180.065109921306/8.0),
+    REAL_CONST(48199.820146491307/8.0),
+    REAL_CONST(48219.577207454073/8.0),
+    REAL_CONST(48239.336292394844/8.0),
+    REAL_CONST(48259.097400899045/8.0),
+    REAL_CONST(48278.860532552339/8.0),
+    REAL_CONST(48298.625686940592/8.0),
+    REAL_CONST(48318.392863649875/8.0),
+    REAL_CONST(48338.162062266485/8.0),
+    REAL_CONST(48357.933282376915/8.0),
+    REAL_CONST(48377.706523567889/8.0),
+    REAL_CONST(48397.481785426316/8.0),
+    REAL_CONST(48417.259067539344/8.0),
+    REAL_CONST(48437.038369494308/8.0),
+    REAL_CONST(48456.819690878765/8.0),
+    REAL_CONST(48476.603031280487/8.0),
+    REAL_CONST(48496.388390287451/8.0),
+    REAL_CONST(48516.175767487839/8.0),
+    REAL_CONST(48535.965162470042/8.0),
+    REAL_CONST(48555.756574822684/8.0),
+    REAL_CONST(48575.550004134566/8.0),
+    REAL_CONST(48595.345449994718/8.0),
+    REAL_CONST(48615.142911992378/8.0),
+    REAL_CONST(48634.942389716991/8.0),
+    REAL_CONST(48654.743882758201/8.0),
+    REAL_CONST(48674.547390705877/8.0),
+    REAL_CONST(48694.352913150084/8.0),
+    REAL_CONST(48714.160449681112/8.0),
+    REAL_CONST(48733.969999889443/8.0),
+    REAL_CONST(48753.781563365759/8.0),
+    REAL_CONST(48773.595139700978/8.0),
+    REAL_CONST(48793.410728486211/8.0),
+    REAL_CONST(48813.228329312769/8.0),
+    REAL_CONST(48833.047941772187/8.0),
+    REAL_CONST(48852.869565456189/8.0),
+    REAL_CONST(48872.693199956717/8.0),
+    REAL_CONST(48892.518844865925/8.0),
+    REAL_CONST(48912.346499776155/8.0),
+    REAL_CONST(48932.176164279976/8.0),
+    REAL_CONST(48952.007837970152/8.0),
+    REAL_CONST(48971.841520439666/8.0),
+    REAL_CONST(48991.677211281676/8.0),
+    REAL_CONST(49011.514910089587/8.0),
+    REAL_CONST(49031.354616456978/8.0),
+    REAL_CONST(49051.196329977654/8.0),
+    REAL_CONST(49071.04005024561/8.0),
+    REAL_CONST(49090.885776855059/8.0),
+    REAL_CONST(49110.733509400408/8.0),
+    REAL_CONST(49130.583247476279/8.0),
+    REAL_CONST(49150.434990677488/8.0),
+    REAL_CONST(49170.288738599062/8.0),
+    REAL_CONST(49190.144490836232/8.0),
+    REAL_CONST(49210.002246984441/8.0),
+    REAL_CONST(49229.86200663932/8.0),
+    REAL_CONST(49249.723769396718/8.0),
+    REAL_CONST(49269.587534852675/8.0),
+    REAL_CONST(49289.453302603448/8.0),
+    REAL_CONST(49309.32107224549/8.0),
+    REAL_CONST(49329.190843375451/8.0),
+    REAL_CONST(49349.062615590192/8.0),
+    REAL_CONST(49368.936388486785/8.0),
+    REAL_CONST(49388.812161662492/8.0),
+    REAL_CONST(49408.689934714785/8.0),
+    REAL_CONST(49428.569707241324/8.0),
+    REAL_CONST(49448.45147883999/8.0),
+    REAL_CONST(49468.335249108866/8.0),
+    REAL_CONST(49488.22101764621/8.0),
+    REAL_CONST(49508.108784050521/8.0),
+    REAL_CONST(49527.99854792047/8.0),
+    REAL_CONST(49547.890308854934/8.0),
+    REAL_CONST(49567.784066453009/8.0),
+    REAL_CONST(49587.679820313977/8.0),
+    REAL_CONST(49607.57757003732/8.0),
+    REAL_CONST(49627.477315222721/8.0),
+    REAL_CONST(49647.379055470075/8.0),
+    REAL_CONST(49667.28279037946/8.0),
+    REAL_CONST(49687.188519551179/8.0),
+    REAL_CONST(49707.096242585707/8.0),
+    REAL_CONST(49727.005959083741/8.0),
+    REAL_CONST(49746.917668646165/8.0),
+    REAL_CONST(49766.831370874068/8.0),
+    REAL_CONST(49786.747065368734/8.0),
+    REAL_CONST(49806.66475173166/8.0),
+    REAL_CONST(49826.584429564515/8.0),
+    REAL_CONST(49846.506098469203/8.0),
+    REAL_CONST(49866.429758047794/8.0),
+    REAL_CONST(49886.355407902578/8.0),
+    REAL_CONST(49906.283047636032/8.0),
+    REAL_CONST(49926.212676850846/8.0),
+    REAL_CONST(49946.144295149883/8.0),
+    REAL_CONST(49966.077902136225/8.0),
+    REAL_CONST(49986.013497413151/8.0),
+    REAL_CONST(50005.951080584135/8.0),
+    REAL_CONST(50025.890651252834/8.0),
+    REAL_CONST(50045.832209023123/8.0),
+    REAL_CONST(50065.775753499074/8.0),
+    REAL_CONST(50085.721284284933/8.0),
+    REAL_CONST(50105.668800985164/8.0),
+    REAL_CONST(50125.618303204428/8.0),
+    REAL_CONST(50145.569790547575/8.0),
+    REAL_CONST(50165.523262619652/8.0),
+    REAL_CONST(50185.478719025901/8.0),
+    REAL_CONST(50205.436159371769/8.0),
+    REAL_CONST(50225.395583262893/8.0),
+    REAL_CONST(50245.356990305103/8.0),
+    REAL_CONST(50265.320380104429/8.0),
+    REAL_CONST(50285.285752267104/8.0),
+    REAL_CONST(50305.253106399534/8.0),
+    REAL_CONST(50325.222442108337/8.0),
+    REAL_CONST(50345.193759000336/8.0),
+    REAL_CONST(50365.16705668252/8.0),
+    REAL_CONST(50385.142334762102/8.0),
+    REAL_CONST(50405.119592846473/8.0),
+    REAL_CONST(50425.098830543218/8.0),
+    REAL_CONST(50445.080047460127/8.0),
+    REAL_CONST(50465.063243205179/8.0),
+    REAL_CONST(50485.048417386541/8.0),
+    REAL_CONST(50505.035569612577/8.0),
+    REAL_CONST(50525.024699491856/8.0),
+    REAL_CONST(50545.015806633128/8.0),
+    REAL_CONST(50565.008890645338/8.0),
+    REAL_CONST(50585.003951137631/8.0),
+    REAL_CONST(50605.00098771933/8.0),
+    REAL_CONST(50624.999999999971/8.0),
+    REAL_CONST(50645.000987589265/8.0),
+    REAL_CONST(50665.003950097132/8.0),
+    REAL_CONST(50685.008887133677/8.0),
+    REAL_CONST(50705.015798309192/8.0),
+    REAL_CONST(50725.024683234165/8.0),
+    REAL_CONST(50745.035541519283/8.0),
+    REAL_CONST(50765.048372775411/8.0),
+    REAL_CONST(50785.063176613621/8.0),
+    REAL_CONST(50805.079952645159/8.0),
+    REAL_CONST(50825.098700481489/8.0),
+    REAL_CONST(50845.119419734241/8.0),
+    REAL_CONST(50865.142110015244/8.0),
+    REAL_CONST(50885.166770936521/8.0),
+    REAL_CONST(50905.193402110279/8.0),
+    REAL_CONST(50925.222003148934/8.0),
+    REAL_CONST(50945.252573665071/8.0),
+    REAL_CONST(50965.285113271471/8.0),
+    REAL_CONST(50985.319621581119/8.0),
+    REAL_CONST(51005.356098207172/8.0),
+    REAL_CONST(51025.394542762981/8.0),
+    REAL_CONST(51045.434954862096/8.0),
+    REAL_CONST(51065.477334118244/8.0),
+    REAL_CONST(51085.521680145357/8.0),
+    REAL_CONST(51105.567992557546/8.0),
+    REAL_CONST(51125.616270969113/8.0),
+    REAL_CONST(51145.66651499454/8.0),
+    REAL_CONST(51165.718724248516/8.0),
+    REAL_CONST(51185.772898345916/8.0),
+    REAL_CONST(51205.829036901778/8.0),
+    REAL_CONST(51225.887139531362/8.0),
+    REAL_CONST(51245.947205850105/8.0),
+    REAL_CONST(51266.009235473619/8.0),
+    REAL_CONST(51286.073228017718/8.0),
+    REAL_CONST(51306.139183098399/8.0),
+    REAL_CONST(51326.207100331856/8.0),
+    REAL_CONST(51346.276979334456/8.0),
+    REAL_CONST(51366.348819722756/8.0),
+    REAL_CONST(51386.42262111351/8.0),
+    REAL_CONST(51406.498383123653/8.0),
+    REAL_CONST(51426.57610537031/8.0),
+    REAL_CONST(51446.655787470787/8.0),
+    REAL_CONST(51466.737429042587/8.0),
+    REAL_CONST(51486.82102970338/8.0),
+    REAL_CONST(51506.906589071048/8.0),
+    REAL_CONST(51526.994106763632/8.0),
+    REAL_CONST(51547.083582399391/8.0),
+    REAL_CONST(51567.175015596738/8.0),
+    REAL_CONST(51587.268405974297/8.0),
+    REAL_CONST(51607.363753150858/8.0),
+    REAL_CONST(51627.461056745415/8.0),
+    REAL_CONST(51647.56031637713/8.0),
+    REAL_CONST(51667.661531665362/8.0),
+    REAL_CONST(51687.764702229651/8.0),
+    REAL_CONST(51707.869827689727/8.0),
+    REAL_CONST(51727.976907665499/8.0),
+    REAL_CONST(51748.085941777055/8.0),
+    REAL_CONST(51768.196929644677/8.0),
+    REAL_CONST(51788.309870888836/8.0),
+    REAL_CONST(51808.42476513017/8.0),
+    REAL_CONST(51828.541611989524/8.0),
+    REAL_CONST(51848.660411087905/8.0),
+    REAL_CONST(51868.781162046515/8.0),
+    REAL_CONST(51888.90386448674/8.0),
+    REAL_CONST(51909.028518030143/8.0),
+    REAL_CONST(51929.155122298485/8.0),
+    REAL_CONST(51949.283676913685/8.0),
+    REAL_CONST(51969.414181497872/8.0),
+    REAL_CONST(51989.546635673345/8.0),
+    REAL_CONST(52009.681039062583/8.0),
+    REAL_CONST(52029.817391288263/8.0),
+    REAL_CONST(52049.955691973213/8.0),
+    REAL_CONST(52070.095940740481/8.0),
+    REAL_CONST(52090.238137213273/8.0),
+    REAL_CONST(52110.382281014987/8.0),
+    REAL_CONST(52130.5283717692/8.0),
+    REAL_CONST(52150.676409099666/8.0),
+    REAL_CONST(52170.826392630333/8.0),
+    REAL_CONST(52190.97832198532/8.0),
+    REAL_CONST(52211.132196788931/8.0),
+    REAL_CONST(52231.288016665654/8.0),
+    REAL_CONST(52251.445781240145/8.0),
+    REAL_CONST(52271.60549013727/8.0),
+    REAL_CONST(52291.76714298204/8.0),
+    REAL_CONST(52311.930739399664/8.0),
+    REAL_CONST(52332.096279015546/8.0),
+    REAL_CONST(52352.263761455244/8.0),
+    REAL_CONST(52372.433186344519/8.0),
+    REAL_CONST(52392.604553309284/8.0),
+    REAL_CONST(52412.777861975665/8.0),
+    REAL_CONST(52432.953111969946/8.0),
+    REAL_CONST(52453.130302918595/8.0),
+    REAL_CONST(52473.309434448267/8.0),
+    REAL_CONST(52493.490506185793/8.0),
+    REAL_CONST(52513.67351775818/8.0),
+    REAL_CONST(52533.858468792605/8.0),
+    REAL_CONST(52554.045358916446/8.0),
+    REAL_CONST(52574.234187757254/8.0),
+    REAL_CONST(52594.42495494274/8.0),
+    REAL_CONST(52614.617660100812/8.0),
+    REAL_CONST(52634.812302859558/8.0),
+    REAL_CONST(52655.008882847229/8.0),
+    REAL_CONST(52675.20739969227/8.0),
+    REAL_CONST(52695.407853023295/8.0),
+    REAL_CONST(52715.610242469098/8.0),
+    REAL_CONST(52735.814567658657/8.0),
+    REAL_CONST(52756.02082822111/8.0),
+    REAL_CONST(52776.229023785803/8.0),
+    REAL_CONST(52796.439153982225/8.0),
+    REAL_CONST(52816.651218440056/8.0),
+    REAL_CONST(52836.865216789171/8.0),
+    REAL_CONST(52857.081148659599/8.0),
+    REAL_CONST(52877.29901368155/8.0),
+    REAL_CONST(52897.518811485425/8.0),
+    REAL_CONST(52917.740541701773/8.0),
+    REAL_CONST(52937.964203961354/8.0),
+    REAL_CONST(52958.18979789508/8.0),
+    REAL_CONST(52978.417323134046/8.0),
+    REAL_CONST(52998.646779309529/8.0),
+    REAL_CONST(53018.878166052978/8.0),
+    REAL_CONST(53039.111482996006/8.0),
+    REAL_CONST(53059.346729770419/8.0),
+    REAL_CONST(53079.583906008193/8.0),
+    REAL_CONST(53099.823011341483/8.0),
+    REAL_CONST(53120.0640454026/8.0),
+    REAL_CONST(53140.307007824063/8.0),
+    REAL_CONST(53160.551898238533/8.0),
+    REAL_CONST(53180.79871627887/8.0),
+    REAL_CONST(53201.047461578091/8.0),
+    REAL_CONST(53221.2981337694/8.0),
+    REAL_CONST(53241.550732486176/8.0),
+    REAL_CONST(53261.805257361964/8.0),
+    REAL_CONST(53282.061708030487/8.0),
+    REAL_CONST(53302.32008412564/8.0),
+    REAL_CONST(53322.580385281493/8.0),
+    REAL_CONST(53342.842611132299/8.0),
+    REAL_CONST(53363.106761312469/8.0),
+    REAL_CONST(53383.372835456597/8.0),
+    REAL_CONST(53403.640833199453/8.0),
+    REAL_CONST(53423.910754175973/8.0),
+    REAL_CONST(53444.18259802126/8.0),
+    REAL_CONST(53464.456364370613/8.0),
+    REAL_CONST(53484.732052859479/8.0),
+    REAL_CONST(53505.009663123499/8.0),
+    REAL_CONST(53525.289194798468/8.0),
+    REAL_CONST(53545.570647520362/8.0),
+    REAL_CONST(53565.854020925333/8.0),
+    REAL_CONST(53586.139314649699/8.0),
+    REAL_CONST(53606.426528329954/8.0),
+    REAL_CONST(53626.715661602764/8.0),
+    REAL_CONST(53647.006714104959/8.0),
+    REAL_CONST(53667.299685473547/8.0),
+    REAL_CONST(53687.59457534572/8.0),
+    REAL_CONST(53707.891383358816/8.0),
+    REAL_CONST(53728.190109150361/8.0),
+    REAL_CONST(53748.490752358055/8.0),
+    REAL_CONST(53768.793312619753/8.0),
+    REAL_CONST(53789.09778957349/8.0),
+    REAL_CONST(53809.404182857485/8.0),
+    REAL_CONST(53829.712492110106/8.0),
+    REAL_CONST(53850.022716969899/8.0),
+    REAL_CONST(53870.334857075584/8.0),
+    REAL_CONST(53890.648912066055/8.0),
+    REAL_CONST(53910.964881580367/8.0),
+    REAL_CONST(53931.28276525774/8.0),
+    REAL_CONST(53951.602562737586/8.0),
+    REAL_CONST(53971.924273659461/8.0),
+    REAL_CONST(53992.24789766311/8.0),
+    REAL_CONST(54012.57343438844/8.0),
+    REAL_CONST(54032.90088347553/8.0),
+    REAL_CONST(54053.23024456462/8.0),
+    REAL_CONST(54073.561517296133/8.0),
+    REAL_CONST(54093.894701310644/8.0),
+    REAL_CONST(54114.22979624891/8.0),
+    REAL_CONST(54134.566801751855/8.0),
+    REAL_CONST(54154.90571746057/8.0),
+    REAL_CONST(54175.246543016314/8.0),
+    REAL_CONST(54195.589278060506/8.0),
+    REAL_CONST(54215.933922234755/8.0),
+    REAL_CONST(54236.280475180814/8.0),
+    REAL_CONST(54256.628936540626/8.0),
+    REAL_CONST(54276.97930595628/8.0),
+    REAL_CONST(54297.331583070045/8.0),
+    REAL_CONST(54317.685767524359/8.0),
+    REAL_CONST(54338.041858961828/8.0),
+    REAL_CONST(54358.399857025215/8.0),
+    REAL_CONST(54378.759761357462/8.0),
+    REAL_CONST(54399.121571601667/8.0),
+    REAL_CONST(54419.485287401105/8.0),
+    REAL_CONST(54439.850908399218/8.0),
+    REAL_CONST(54460.218434239614/8.0),
+    REAL_CONST(54480.587864566056/8.0),
+    REAL_CONST(54500.95919902248/8.0),
+    REAL_CONST(54521.332437252997/8.0),
+    REAL_CONST(54541.707578901878/8.0),
+    REAL_CONST(54562.084623613555/8.0),
+    REAL_CONST(54582.46357103264/8.0),
+    REAL_CONST(54602.844420803893/8.0),
+    REAL_CONST(54623.227172572246/8.0),
+    REAL_CONST(54643.611825982807/8.0),
+    REAL_CONST(54663.998380680838/8.0),
+    REAL_CONST(54684.386836311773/8.0),
+    REAL_CONST(54704.777192521207/8.0),
+    REAL_CONST(54725.169448954897/8.0),
+    REAL_CONST(54745.563605258772/8.0),
+    REAL_CONST(54765.959661078923/8.0),
+    REAL_CONST(54786.357616061614/8.0),
+    REAL_CONST(54806.757469853255/8.0),
+    REAL_CONST(54827.159222100439/8.0),
+    REAL_CONST(54847.562872449904/8.0),
+    REAL_CONST(54867.968420548583/8.0),
+    REAL_CONST(54888.375866043534/8.0),
+    REAL_CONST(54908.785208582012/8.0),
+    REAL_CONST(54929.196447811417/8.0),
+    REAL_CONST(54949.609583379322/8.0),
+    REAL_CONST(54970.024614933463/8.0),
+    REAL_CONST(54990.441542121727/8.0),
+    REAL_CONST(55010.86036459219/8.0),
+    REAL_CONST(55031.28108199306/8.0),
+    REAL_CONST(55051.703693972733/8.0),
+    REAL_CONST(55072.128200179759/8.0),
+    REAL_CONST(55092.554600262847/8.0),
+    REAL_CONST(55112.982893870874/8.0),
+    REAL_CONST(55133.413080652877/8.0),
+    REAL_CONST(55153.845160258061/8.0),
+    REAL_CONST(55174.279132335789/8.0),
+    REAL_CONST(55194.714996535586/8.0),
+    REAL_CONST(55215.152752507143/8.0),
+    REAL_CONST(55235.592399900306/8.0),
+    REAL_CONST(55256.033938365079/8.0),
+    REAL_CONST(55276.477367551655/8.0),
+    REAL_CONST(55296.92268711036/8.0),
+    REAL_CONST(55317.369896691685/8.0),
+    REAL_CONST(55337.818995946305/8.0),
+    REAL_CONST(55358.269984525024/8.0),
+    REAL_CONST(55378.72286207883/8.0),
+    REAL_CONST(55399.177628258869/8.0),
+    REAL_CONST(55419.634282716441/8.0),
+    REAL_CONST(55440.092825103013/8.0),
+    REAL_CONST(55460.553255070205/8.0),
+    REAL_CONST(55481.015572269804/8.0),
+    REAL_CONST(55501.479776353764/8.0),
+    REAL_CONST(55521.945866974187/8.0),
+    REAL_CONST(55542.413843783339/8.0),
+    REAL_CONST(55562.883706433655/8.0),
+    REAL_CONST(55583.355454577715/8.0),
+    REAL_CONST(55603.82908786826/8.0),
+    REAL_CONST(55624.304605958219/8.0),
+    REAL_CONST(55644.782008500639/8.0),
+    REAL_CONST(55665.261295148754/8.0),
+    REAL_CONST(55685.742465555952/8.0),
+    REAL_CONST(55706.225519375774/8.0),
+    REAL_CONST(55726.710456261928/8.0),
+    REAL_CONST(55747.197275868275/8.0),
+    REAL_CONST(55767.685977848843/8.0),
+    REAL_CONST(55788.176561857814/8.0),
+    REAL_CONST(55808.669027549528/8.0),
+    REAL_CONST(55829.163374578478/8.0),
+    REAL_CONST(55849.659602599328/8.0),
+    REAL_CONST(55870.157711266889/8.0),
+    REAL_CONST(55890.657700236145/8.0),
+    REAL_CONST(55911.159569162221/8.0),
+    REAL_CONST(55931.663317700411/8.0),
+    REAL_CONST(55952.168945506164/8.0),
+    REAL_CONST(55972.676452235086/8.0),
+    REAL_CONST(55993.185837542944/8.0),
+    REAL_CONST(56013.697101085651/8.0),
+    REAL_CONST(56034.210242519301/8.0),
+    REAL_CONST(56054.72526150012/8.0),
+    REAL_CONST(56075.242157684508/8.0),
+    REAL_CONST(56095.760930729011/8.0),
+    REAL_CONST(56116.281580290342/8.0),
+    REAL_CONST(56136.804106025367/8.0),
+    REAL_CONST(56157.328507591104/8.0),
+    REAL_CONST(56177.85478464474/8.0),
+    REAL_CONST(56198.382936843598/8.0),
+    REAL_CONST(56218.912963845185/8.0),
+    REAL_CONST(56239.444865307138/8.0),
+    REAL_CONST(56259.978640887268/8.0),
+    REAL_CONST(56280.514290243525/8.0),
+    REAL_CONST(56301.051813034042/8.0),
+    REAL_CONST(56321.591208917082/8.0),
+    REAL_CONST(56342.13247755108/8.0),
+    REAL_CONST(56362.675618594607/8.0),
+    REAL_CONST(56383.220631706419/8.0),
+    REAL_CONST(56403.767516545398/8.0),
+    REAL_CONST(56424.316272770608/8.0),
+    REAL_CONST(56444.866900041241/8.0),
+    REAL_CONST(56465.419398016667/8.0),
+    REAL_CONST(56485.973766356394/8.0),
+    REAL_CONST(56506.530004720102/8.0),
+    REAL_CONST(56527.088112767611/8.0),
+    REAL_CONST(56547.648090158902/8.0),
+    REAL_CONST(56568.209936554107/8.0),
+    REAL_CONST(56588.773651613519/8.0),
+    REAL_CONST(56609.339234997584/8.0),
+    REAL_CONST(56629.9066863669/8.0),
+    REAL_CONST(56650.47600538221/8.0),
+    REAL_CONST(56671.04719170442/8.0),
+    REAL_CONST(56691.620244994599/8.0),
+    REAL_CONST(56712.195164913959/8.0),
+    REAL_CONST(56732.771951123868/8.0),
+    REAL_CONST(56753.350603285835/8.0),
+    REAL_CONST(56773.931121061541/8.0),
+    REAL_CONST(56794.513504112823/8.0),
+    REAL_CONST(56815.097752101647/8.0),
+    REAL_CONST(56835.683864690152/8.0),
+    REAL_CONST(56856.271841540627/8.0),
+    REAL_CONST(56876.86168231551/8.0),
+    REAL_CONST(56897.453386677393/8.0),
+    REAL_CONST(56918.046954289028/8.0),
+    REAL_CONST(56938.642384813298/8.0),
+    REAL_CONST(56959.239677913261/8.0),
+    REAL_CONST(56979.838833252121/8.0),
+    REAL_CONST(57000.439850493225/8.0),
+    REAL_CONST(57021.04272930009/8.0),
+    REAL_CONST(57041.647469336371/8.0),
+    REAL_CONST(57062.254070265873/8.0),
+    REAL_CONST(57082.862531752558/8.0),
+    REAL_CONST(57103.472853460553/8.0),
+    REAL_CONST(57124.085035054108/8.0),
+    REAL_CONST(57144.699076197649/8.0),
+    REAL_CONST(57165.314976555739/8.0),
+    REAL_CONST(57185.932735793103/8.0),
+    REAL_CONST(57206.552353574611/8.0),
+    REAL_CONST(57227.173829565276/8.0),
+    REAL_CONST(57247.797163430281/8.0),
+    REAL_CONST(57268.42235483494/8.0),
+    REAL_CONST(57289.049403444733/8.0),
+    REAL_CONST(57309.678308925286/8.0),
+    REAL_CONST(57330.30907094237/8.0),
+    REAL_CONST(57350.941689161911/8.0),
+    REAL_CONST(57371.576163249985/8.0),
+    REAL_CONST(57392.212492872815/8.0),
+    REAL_CONST(57412.850677696784/8.0),
+    REAL_CONST(57433.490717388406/8.0),
+    REAL_CONST(57454.132611614368/8.0),
+    REAL_CONST(57474.776360041491/8.0),
+    REAL_CONST(57495.421962336746/8.0),
+    REAL_CONST(57516.069418167266/8.0),
+    REAL_CONST(57536.718727200314/8.0),
+    REAL_CONST(57557.36988910332/8.0),
+    REAL_CONST(57578.022903543861/8.0),
+    REAL_CONST(57598.677770189643/8.0),
+    REAL_CONST(57619.334488708548/8.0),
+    REAL_CONST(57639.993058768589/8.0),
+    REAL_CONST(57660.653480037938/8.0),
+    REAL_CONST(57681.315752184906/8.0),
+    REAL_CONST(57701.979874877965/8.0),
+    REAL_CONST(57722.64584778573/8.0),
+    REAL_CONST(57743.31367057695/8.0),
+    REAL_CONST(57763.983342920546/8.0),
+    REAL_CONST(57784.654864485572/8.0),
+    REAL_CONST(57805.328234941233/8.0),
+    REAL_CONST(57826.003453956881/8.0),
+    REAL_CONST(57846.680521202026/8.0),
+    REAL_CONST(57867.359436346305/8.0),
+    REAL_CONST(57888.040199059527/8.0),
+    REAL_CONST(57908.722809011633/8.0),
+    REAL_CONST(57929.407265872709/8.0),
+    REAL_CONST(57950.093569313001/8.0),
+    REAL_CONST(57970.781719002895/8.0),
+    REAL_CONST(57991.471714612911/8.0),
+    REAL_CONST(58012.16355581375/8.0),
+    REAL_CONST(58032.857242276223/8.0),
+    REAL_CONST(58053.552773671312/8.0),
+    REAL_CONST(58074.25014967013/8.0),
+    REAL_CONST(58094.949369943948/8.0),
+    REAL_CONST(58115.650434164185/8.0),
+    REAL_CONST(58136.353342002389/8.0),
+    REAL_CONST(58157.058093130276/8.0),
+    REAL_CONST(58177.764687219693/8.0),
+    REAL_CONST(58198.47312394264/8.0),
+    REAL_CONST(58219.183402971255/8.0),
+    REAL_CONST(58239.895523977837/8.0),
+    REAL_CONST(58260.609486634821/8.0),
+    REAL_CONST(58281.325290614775/8.0),
+    REAL_CONST(58302.042935590434/8.0),
+    REAL_CONST(58322.762421234678/8.0),
+    REAL_CONST(58343.483747220511/8.0),
+    REAL_CONST(58364.206913221096/8.0),
+    REAL_CONST(58384.931918909751/8.0),
+    REAL_CONST(58405.658763959924/8.0),
+    REAL_CONST(58426.3874480452/8.0),
+    REAL_CONST(58447.117970839339/8.0),
+    REAL_CONST(58467.85033201622/8.0),
+    REAL_CONST(58488.584531249864/8.0),
+    REAL_CONST(58509.320568214462/8.0),
+    REAL_CONST(58530.058442584334/8.0),
+    REAL_CONST(58550.798154033931/8.0),
+    REAL_CONST(58571.539702237875/8.0),
+    REAL_CONST(58592.283086870906/8.0),
+    REAL_CONST(58613.028307607929/8.0),
+    REAL_CONST(58633.775364123983/8.0),
+    REAL_CONST(58654.52425609425/8.0),
+    REAL_CONST(58675.274983194053/8.0),
+    REAL_CONST(58696.027545098877/8.0),
+    REAL_CONST(58716.781941484325/8.0),
+    REAL_CONST(58737.538172026158/8.0),
+    REAL_CONST(58758.296236400274/8.0),
+    REAL_CONST(58779.056134282728/8.0),
+    REAL_CONST(58799.817865349694/8.0),
+    REAL_CONST(58820.581429277503/8.0),
+    REAL_CONST(58841.346825742643/8.0),
+    REAL_CONST(58862.114054421712/8.0),
+    REAL_CONST(58882.883114991484/8.0),
+    REAL_CONST(58903.654007128847/8.0),
+    REAL_CONST(58924.426730510851/8.0),
+    REAL_CONST(58945.201284814684/8.0),
+    REAL_CONST(58965.977669717664/8.0),
+    REAL_CONST(58986.755884897269/8.0),
+    REAL_CONST(59007.535930031117/8.0),
+    REAL_CONST(59028.317804796949/8.0),
+    REAL_CONST(59049.101508872664/8.0),
+    REAL_CONST(59069.887041936301/8.0),
+    REAL_CONST(59090.674403666046/8.0),
+    REAL_CONST(59111.463593740213/8.0),
+    REAL_CONST(59132.254611837263/8.0),
+    REAL_CONST(59153.047457635803/8.0),
+    REAL_CONST(59173.84213081457/8.0),
+    REAL_CONST(59194.638631052461/8.0),
+    REAL_CONST(59215.436958028506/8.0),
+    REAL_CONST(59236.237111421855/8.0),
+    REAL_CONST(59257.039090911829/8.0),
+    REAL_CONST(59277.842896177877/8.0),
+    REAL_CONST(59298.648526899589/8.0),
+    REAL_CONST(59319.455982756685/8.0),
+    REAL_CONST(59340.26526342905/8.0),
+    REAL_CONST(59361.076368596696/8.0),
+    REAL_CONST(59381.889297939757/8.0),
+    REAL_CONST(59402.704051138542/8.0),
+    REAL_CONST(59423.520627873484/8.0),
+    REAL_CONST(59444.339027825139/8.0),
+    REAL_CONST(59465.159250674224/8.0),
+    REAL_CONST(59485.9812961016/8.0),
+    REAL_CONST(59506.805163788253/8.0),
+    REAL_CONST(59527.630853415307/8.0),
+    REAL_CONST(59548.458364664046/8.0),
+    REAL_CONST(59569.287697215863/8.0),
+    REAL_CONST(59590.118850752311/8.0),
+    REAL_CONST(59610.951824955089/8.0),
+    REAL_CONST(59631.786619506012/8.0),
+    REAL_CONST(59652.623234087048/8.0),
+    REAL_CONST(59673.461668380311/8.0),
+    REAL_CONST(59694.301922068029/8.0),
+    REAL_CONST(59715.143994832593/8.0),
+    REAL_CONST(59735.987886356525/8.0),
+    REAL_CONST(59756.833596322482/8.0),
+    REAL_CONST(59777.681124413255/8.0),
+    REAL_CONST(59798.530470311794/8.0),
+    REAL_CONST(59819.381633701159/8.0),
+    REAL_CONST(59840.234614264569/8.0),
+    REAL_CONST(59861.089411685381/8.0),
+    REAL_CONST(59881.94602564707/8.0),
+    REAL_CONST(59902.804455833269/8.0),
+    REAL_CONST(59923.664701927737/8.0),
+    REAL_CONST(59944.526763614384/8.0),
+    REAL_CONST(59965.390640577243/8.0),
+    REAL_CONST(59986.256332500488/8.0),
+    REAL_CONST(60007.123839068438/8.0),
+    REAL_CONST(60027.993159965539/8.0),
+    REAL_CONST(60048.864294876381/8.0),
+    REAL_CONST(60069.737243485688/8.0),
+    REAL_CONST(60090.612005478324/8.0),
+    REAL_CONST(60111.488580539284/8.0),
+    REAL_CONST(60132.366968353708/8.0),
+    REAL_CONST(60153.247168606867/8.0),
+    REAL_CONST(60174.129180984164/8.0),
+    REAL_CONST(60195.013005171153/8.0),
+    REAL_CONST(60215.898640853513/8.0),
+    REAL_CONST(60236.786087717061/8.0),
+    REAL_CONST(60257.675345447751/8.0),
+    REAL_CONST(60278.566413731671/8.0),
+    REAL_CONST(60299.459292255044/8.0),
+    REAL_CONST(60320.353980704247/8.0),
+    REAL_CONST(60341.25047876576/8.0),
+    REAL_CONST(60362.148786126229/8.0),
+    REAL_CONST(60383.048902472423/8.0),
+    REAL_CONST(60403.950827491237/8.0),
+    REAL_CONST(60424.854560869717/8.0),
+    REAL_CONST(60445.76010229504/8.0),
+    REAL_CONST(60466.667451454516/8.0),
+    REAL_CONST(60487.57660803559/8.0),
+    REAL_CONST(60508.487571725847/8.0),
+    REAL_CONST(60529.400342212997/8.0),
+    REAL_CONST(60550.314919184893/8.0),
+    REAL_CONST(60571.231302329521/8.0),
+    REAL_CONST(60592.149491335003/8.0),
+    REAL_CONST(60613.069485889588/8.0),
+    REAL_CONST(60633.991285681674/8.0),
+    REAL_CONST(60654.914890399785/8.0),
+    REAL_CONST(60675.840299732568/8.0),
+    REAL_CONST(60696.767513368832/8.0),
+    REAL_CONST(60717.696530997484/8.0),
+    REAL_CONST(60738.627352307602/8.0),
+    REAL_CONST(60759.55997698837/8.0),
+    REAL_CONST(60780.494404729128/8.0),
+    REAL_CONST(60801.430635219323/8.0),
+    REAL_CONST(60822.368668148556/8.0),
+    REAL_CONST(60843.308503206565/8.0),
+    REAL_CONST(60864.250140083204/8.0),
+    REAL_CONST(60885.193578468468/8.0),
+    REAL_CONST(60906.138818052495/8.0),
+    REAL_CONST(60927.085858525541/8.0),
+    REAL_CONST(60948.034699578006/8.0),
+    REAL_CONST(60968.985340900421/8.0),
+    REAL_CONST(60989.937782183442/8.0),
+    REAL_CONST(61010.892023117864/8.0),
+    REAL_CONST(61031.848063394616/8.0),
+    REAL_CONST(61052.805902704764/8.0),
+    REAL_CONST(61073.765540739492/8.0),
+    REAL_CONST(61094.726977190134/8.0),
+    REAL_CONST(61115.690211748137/8.0),
+    REAL_CONST(61136.655244105103/8.0),
+    REAL_CONST(61157.622073952742/8.0),
+    REAL_CONST(61178.590700982917/8.0),
+    REAL_CONST(61199.561124887616/8.0),
+    REAL_CONST(61220.533345358948/8.0),
+    REAL_CONST(61241.507362089171/8.0),
+    REAL_CONST(61262.483174770663/8.0),
+    REAL_CONST(61283.460783095943/8.0),
+    REAL_CONST(61304.440186757645/8.0),
+    REAL_CONST(61325.421385448557/8.0),
+    REAL_CONST(61346.404378861582/8.0),
+    REAL_CONST(61367.389166689762/8.0),
+    REAL_CONST(61388.375748626262/8.0),
+    REAL_CONST(61409.364124364387/8.0),
+    REAL_CONST(61430.354293597571/8.0),
+    REAL_CONST(61451.346256019373/8.0),
+    REAL_CONST(61472.340011323497/8.0),
+    REAL_CONST(61493.335559203762/8.0),
+    REAL_CONST(61514.332899354122/8.0),
+    REAL_CONST(61535.332031468672/8.0),
+    REAL_CONST(61556.332955241618/8.0),
+    REAL_CONST(61577.335670367313/8.0),
+    REAL_CONST(61598.340176540238/8.0),
+    REAL_CONST(61619.346473454993/8.0),
+    REAL_CONST(61640.354560806329/8.0),
+    REAL_CONST(61661.3644382891/8.0),
+    REAL_CONST(61682.376105598312/8.0),
+    REAL_CONST(61703.389562429089/8.0),
+    REAL_CONST(61724.404808476691/8.0),
+    REAL_CONST(61745.42184343651/8.0),
+    REAL_CONST(61766.440667004063/8.0),
+    REAL_CONST(61787.461278874987/8.0),
+    REAL_CONST(61808.483678745069/8.0),
+    REAL_CONST(61829.507866310203/8.0),
+    REAL_CONST(61850.533841266435/8.0),
+    REAL_CONST(61871.561603309929/8.0),
+    REAL_CONST(61892.591152136971/8.0),
+    REAL_CONST(61913.622487443987/8.0),
+    REAL_CONST(61934.655608927525/8.0),
+    REAL_CONST(61955.690516284267/8.0),
+    REAL_CONST(61976.727209211022/8.0),
+    REAL_CONST(61997.765687404724/8.0),
+    REAL_CONST(62018.805950562448/8.0),
+    REAL_CONST(62039.847998381381/8.0),
+    REAL_CONST(62060.891830558845/8.0),
+    REAL_CONST(62081.93744679229/8.0),
+    REAL_CONST(62102.984846779298/8.0),
+    REAL_CONST(62124.034030217575/8.0),
+    REAL_CONST(62145.084996804966/8.0),
+    REAL_CONST(62166.137746239416/8.0),
+    REAL_CONST(62187.19227821903/8.0),
+    REAL_CONST(62208.248592442025/8.0),
+    REAL_CONST(62229.306688606739/8.0),
+    REAL_CONST(62250.366566411656/8.0),
+    REAL_CONST(62271.428225555377/8.0),
+    REAL_CONST(62292.491665736627/8.0),
+    REAL_CONST(62313.556886654267/8.0),
+    REAL_CONST(62334.623888007271/8.0),
+    REAL_CONST(62355.692669494762/8.0),
+    REAL_CONST(62376.763230815974/8.0),
+    REAL_CONST(62397.835571670272/8.0),
+    REAL_CONST(62418.909691757144/8.0),
+    REAL_CONST(62439.98559077621/8.0),
+    REAL_CONST(62461.063268427228/8.0),
+    REAL_CONST(62482.142724410049/8.0),
+    REAL_CONST(62503.223958424685/8.0),
+    REAL_CONST(62524.306970171267/8.0),
+    REAL_CONST(62545.39175935003/8.0),
+    REAL_CONST(62566.478325661366/8.0),
+    REAL_CONST(62587.566668805768/8.0),
+    REAL_CONST(62608.656788483881/8.0),
+    REAL_CONST(62629.748684396451/8.0),
+    REAL_CONST(62650.842356244357/8.0),
+    REAL_CONST(62671.937803728622/8.0),
+    REAL_CONST(62693.035026550366/8.0),
+    REAL_CONST(62714.134024410858/8.0),
+    REAL_CONST(62735.234797011479/8.0),
+    REAL_CONST(62756.337344053733/8.0),
+    REAL_CONST(62777.441665239276/8.0),
+    REAL_CONST(62798.547760269852/8.0),
+    REAL_CONST(62819.655628847358/8.0),
+    REAL_CONST(62840.765270673801/8.0),
+    REAL_CONST(62861.876685451323/8.0),
+    REAL_CONST(62882.989872882186/8.0),
+    REAL_CONST(62904.104832668774/8.0),
+    REAL_CONST(62925.221564513602/8.0),
+    REAL_CONST(62946.340068119309/8.0),
+    REAL_CONST(62967.460343188657/8.0),
+    REAL_CONST(62988.582389424526/8.0),
+    REAL_CONST(63009.70620652994/8.0),
+    REAL_CONST(63030.831794208025/8.0),
+    REAL_CONST(63051.959152162039/8.0),
+    REAL_CONST(63073.08828009537/8.0),
+    REAL_CONST(63094.219177711529/8.0),
+    REAL_CONST(63115.351844714154/8.0),
+    REAL_CONST(63136.486280806988/8.0),
+    REAL_CONST(63157.622485693922/8.0),
+    REAL_CONST(63178.760459078956/8.0),
+    REAL_CONST(63199.900200666219/8.0),
+    REAL_CONST(63221.041710159967/8.0),
+    REAL_CONST(63242.184987264569/8.0),
+    REAL_CONST(63263.330031684534/8.0),
+    REAL_CONST(63284.476843124474/8.0),
+    REAL_CONST(63305.625421289144/8.0),
+    REAL_CONST(63326.775765883409/8.0),
+    REAL_CONST(63347.927876612259/8.0),
+    REAL_CONST(63369.081753180813/8.0),
+    REAL_CONST(63390.237395294316/8.0),
+    REAL_CONST(63411.39480265812/8.0),
+    REAL_CONST(63432.553974977716/8.0),
+    REAL_CONST(63453.714911958712/8.0),
+    REAL_CONST(63474.877613306839/8.0),
+    REAL_CONST(63496.042078727944/8.0),
+    REAL_CONST(63517.208307927998/8.0),
+    REAL_CONST(63538.376300613119/8.0),
+    REAL_CONST(63559.546056489504/8.0),
+    REAL_CONST(63580.717575263516/8.0),
+    REAL_CONST(63601.890856641607/8.0),
+    REAL_CONST(63623.065900330374/8.0),
+    REAL_CONST(63644.242706036515/8.0),
+    REAL_CONST(63665.421273466869/8.0),
+    REAL_CONST(63686.601602328381/8.0),
+    REAL_CONST(63707.783692328136/8.0),
+    REAL_CONST(63728.967543173334/8.0),
+    REAL_CONST(63750.153154571279/8.0),
+    REAL_CONST(63771.340526229418/8.0),
+    REAL_CONST(63792.529657855317/8.0),
+    REAL_CONST(63813.720549156649/8.0),
+    REAL_CONST(63834.913199841227/8.0),
+    REAL_CONST(63856.107609616978/8.0),
+    REAL_CONST(63877.303778191941/8.0),
+    REAL_CONST(63898.501705274284/8.0),
+    REAL_CONST(63919.7013905723/8.0),
+    REAL_CONST(63940.902833794404/8.0),
+    REAL_CONST(63962.106034649114/8.0),
+    REAL_CONST(63983.310992845094/8.0),
+    REAL_CONST(64004.517708091109/8.0),
+    REAL_CONST(64025.726180096048/8.0),
+    REAL_CONST(64046.936408568938/8.0),
+    REAL_CONST(64068.1483932189/8.0),
+    REAL_CONST(64089.362133755196/8.0),
+    REAL_CONST(64110.577629887193/8.0),
+    REAL_CONST(64131.794881324393/8.0),
+    REAL_CONST(64153.013887776404/8.0),
+    REAL_CONST(64174.234648952966/8.0),
+    REAL_CONST(64195.457164563937/8.0),
+    REAL_CONST(64216.681434319289/8.0),
+    REAL_CONST(64237.907457929112/8.0),
+    REAL_CONST(64259.135235103626/8.0),
+    REAL_CONST(64280.36476555316/8.0),
+    REAL_CONST(64301.596048988169/8.0),
+    REAL_CONST(64322.829085119236/8.0),
+    REAL_CONST(64344.06387365704/8.0),
+    REAL_CONST(64365.300414312398/8.0),
+    REAL_CONST(64386.538706796251/8.0),
+    REAL_CONST(64407.778750819634/8.0),
+    REAL_CONST(64429.020546093721/8.0),
+    REAL_CONST(64450.26409232981/8.0),
+    REAL_CONST(64471.509389239291/8.0),
+    REAL_CONST(64492.756436533709/8.0),
+    REAL_CONST(64514.005233924705/8.0),
+    REAL_CONST(64535.255781124033/8.0),
+    REAL_CONST(64556.50807784358/8.0),
+    REAL_CONST(64577.762123795357/8.0),
+    REAL_CONST(64599.017918691468/8.0),
+    REAL_CONST(64620.275462244172/8.0),
+    REAL_CONST(64641.534754165805/8.0),
+    REAL_CONST(64662.795794168844/8.0),
+    REAL_CONST(64684.058581965895/8.0),
+    REAL_CONST(64705.323117269661/8.0),
+    REAL_CONST(64726.589399792974/8.0),
+    REAL_CONST(64747.857429248776/8.0),
+    REAL_CONST(64769.127205350138/8.0),
+    REAL_CONST(64790.398727810236/8.0),
+    REAL_CONST(64811.671996342375/8.0),
+    REAL_CONST(64832.947010659969/8.0),
+    REAL_CONST(64854.223770476558/8.0),
+    REAL_CONST(64875.502275505794/8.0),
+    REAL_CONST(64896.782525461451/8.0),
+    REAL_CONST(64918.064520057414/8.0),
+    REAL_CONST(64939.348259007682/8.0),
+    REAL_CONST(64960.633742026388/8.0),
+    REAL_CONST(64981.920968827762/8.0),
+    REAL_CONST(65003.209939126165/8.0),
+    REAL_CONST(65024.500652636067/8.0),
+    REAL_CONST(65045.793109072067/8.0),
+    REAL_CONST(65067.087308148861/8.0),
+    REAL_CONST(65088.383249581282/8.0),
+    REAL_CONST(65109.680933084259/8.0),
+    REAL_CONST(65130.980358372864/8.0),
+    REAL_CONST(65152.28152516226/8.0),
+    REAL_CONST(65173.584433167736/8.0),
+    REAL_CONST(65194.889082104703/8.0),
+    REAL_CONST(65216.195471688683/8.0),
+    REAL_CONST(65237.503601635319/8.0),
+    REAL_CONST(65258.813471660353/8.0),
+    REAL_CONST(65280.125081479666/8.0),
+    REAL_CONST(65301.438430809241/8.0),
+    REAL_CONST(65322.753519365178/8.0),
+    REAL_CONST(65344.070346863708/8.0),
+    REAL_CONST(65365.388913021146/8.0),
+    REAL_CONST(65386.709217553958/8.0),
+    REAL_CONST(65408.031260178701/8.0),
+    REAL_CONST(65429.355040612056/8.0),
+    REAL_CONST(65450.680558570821/8.0),
+    REAL_CONST(65472.00781377191/8.0),
+    REAL_CONST(65493.336805932355/8.0),
+    REAL_CONST(65514.66753476928/8.0),
+    REAL_CONST(65535.999999999956/8.0),
+    REAL_CONST(65557.334201341757/8.0),
+    REAL_CONST(65578.670138512171/8.0),
+    REAL_CONST(65600.007811228788/8.0),
+    REAL_CONST(65621.347219209332/8.0),
+    REAL_CONST(65642.688362171626/8.0),
+    REAL_CONST(65664.031239833639/8.0),
+    REAL_CONST(65685.375851913413/8.0),
+    REAL_CONST(65706.722198129137/8.0),
+    REAL_CONST(65728.070278199084/8.0),
+    REAL_CONST(65749.420091841661/8.0),
+    REAL_CONST(65770.771638775404/8.0),
+    REAL_CONST(65792.124918718939/8.0),
+    REAL_CONST(65813.479931391004/8.0),
+    REAL_CONST(65834.836676510458/8.0),
+    REAL_CONST(65856.195153796303/8.0),
+    REAL_CONST(65877.5553629676/8.0),
+    REAL_CONST(65898.917303743554/8.0),
+    REAL_CONST(65920.280975843489/8.0),
+    REAL_CONST(65941.646378986843/8.0),
+    REAL_CONST(65963.013512893158/8.0),
+    REAL_CONST(65984.382377282076/8.0),
+    REAL_CONST(66005.752971873386/8.0),
+    REAL_CONST(66027.125296386963/8.0),
+    REAL_CONST(66048.499350542799/8.0),
+    REAL_CONST(66069.875134061018/8.0),
+    REAL_CONST(66091.252646661844/8.0),
+    REAL_CONST(66112.631888065618/8.0),
+    REAL_CONST(66134.01285799277/8.0),
+    REAL_CONST(66155.395556163887/8.0),
+    REAL_CONST(66176.779982299631/8.0),
+    REAL_CONST(66198.166136120795/8.0),
+    REAL_CONST(66219.554017348273/8.0),
+    REAL_CONST(66240.943625703105/8.0),
+    REAL_CONST(66262.334960906388/8.0),
+    REAL_CONST(66283.728022679396/8.0),
+    REAL_CONST(66305.122810743444/8.0),
+    REAL_CONST(66326.519324820023/8.0),
+    REAL_CONST(66347.917564630698/8.0),
+    REAL_CONST(66369.317529897162/8.0),
+    REAL_CONST(66390.719220341227/8.0),
+    REAL_CONST(66412.122635684791/8.0),
+    REAL_CONST(66433.527775649884/8.0),
+    REAL_CONST(66454.934639958636/8.0),
+    REAL_CONST(66476.343228333324/8.0),
+    REAL_CONST(66497.753540496284/8.0),
+    REAL_CONST(66519.165576169995/8.0),
+    REAL_CONST(66540.57933507704/8.0),
+    REAL_CONST(66561.994816940118/8.0),
+    REAL_CONST(66583.412021482043/8.0),
+    REAL_CONST(66604.830948425733/8.0),
+    REAL_CONST(66626.251597494222/8.0),
+    REAL_CONST(66647.673968410629/8.0),
+    REAL_CONST(66669.098060898235/8.0),
+    REAL_CONST(66690.523874680381/8.0),
+    REAL_CONST(66711.951409480564/8.0),
+    REAL_CONST(66733.380665022371/8.0),
+    REAL_CONST(66754.811641029475/8.0),
+    REAL_CONST(66776.244337225711/8.0),
+    REAL_CONST(66797.678753334985/8.0),
+    REAL_CONST(66819.11488908132/8.0),
+    REAL_CONST(66840.552744188884/8.0),
+    REAL_CONST(66861.992318381905/8.0),
+    REAL_CONST(66883.433611384738/8.0),
+    REAL_CONST(66904.876622921889/8.0),
+    REAL_CONST(66926.321352717903/8.0),
+    REAL_CONST(66947.767800497502/8.0),
+    REAL_CONST(66969.215965985466/8.0),
+    REAL_CONST(66990.665848906734/8.0),
+    REAL_CONST(67012.117448986304/8.0),
+    REAL_CONST(67033.570765949335/8.0),
+    REAL_CONST(67055.025799521056/8.0),
+    REAL_CONST(67076.482549426815/8.0),
+    REAL_CONST(67097.941015392076/8.0),
+    REAL_CONST(67119.401197142433/8.0),
+    REAL_CONST(67140.863094403554/8.0),
+    REAL_CONST(67162.326706901222/8.0),
+    REAL_CONST(67183.792034361351/8.0),
+    REAL_CONST(67205.259076509959/8.0),
+    REAL_CONST(67226.72783307315/8.0),
+    REAL_CONST(67248.198303777172/8.0),
+    REAL_CONST(67269.670488348347/8.0),
+    REAL_CONST(67291.144386513144/8.0),
+    REAL_CONST(67312.619997998088/8.0),
+    REAL_CONST(67334.09732252988/8.0),
+    REAL_CONST(67355.576359835293/8.0),
+    REAL_CONST(67377.057109641188/8.0),
+    REAL_CONST(67398.53957167457/8.0),
+    REAL_CONST(67420.023745662547/8.0),
+    REAL_CONST(67441.50963133233/8.0),
+    REAL_CONST(67462.99722841123/8.0),
+    REAL_CONST(67484.486536626689/8.0),
+    REAL_CONST(67505.977555706224/8.0),
+    REAL_CONST(67527.470285377494/8.0),
+    REAL_CONST(67548.964725368263/8.0),
+    REAL_CONST(67570.460875406367/8.0),
+    REAL_CONST(67591.9587352198/8.0),
+    REAL_CONST(67613.458304536631/8.0),
+    REAL_CONST(67634.95958308503/8.0),
+    REAL_CONST(67656.462570593329/8.0),
+    REAL_CONST(67677.967266789899/8.0),
+    REAL_CONST(67699.473671403248/8.0),
+    REAL_CONST(67720.981784162024/8.0),
+    REAL_CONST(67742.491604794923/8.0),
+    REAL_CONST(67764.003133030797/8.0),
+    REAL_CONST(67785.516368598575/8.0),
+    REAL_CONST(67807.031311227314/8.0),
+    REAL_CONST(67828.547960646174/8.0),
+    REAL_CONST(67850.066316584402/8.0),
+    REAL_CONST(67871.58637877139/8.0),
+    REAL_CONST(67893.108146936589/8.0),
+    REAL_CONST(67914.63162080961/8.0),
+    REAL_CONST(67936.156800120138/8.0),
+    REAL_CONST(67957.683684597971/8.0),
+    REAL_CONST(67979.212273973011/8.0),
+    REAL_CONST(68000.742567975263/8.0),
+    REAL_CONST(68022.274566334876/8.0),
+    REAL_CONST(68043.808268782057/8.0),
+    REAL_CONST(68065.343675047145/8.0),
+    REAL_CONST(68086.880784860579/8.0),
+    REAL_CONST(68108.419597952918/8.0),
+    REAL_CONST(68129.960114054789/8.0),
+    REAL_CONST(68151.502332896969/8.0),
+    REAL_CONST(68173.04625421032/8.0),
+    REAL_CONST(68194.591877725834/8.0),
+    REAL_CONST(68216.139203174564/8.0),
+    REAL_CONST(68237.688230287706/8.0),
+    REAL_CONST(68259.238958796544/8.0),
+    REAL_CONST(68280.791388432481/8.0),
+    REAL_CONST(68302.345518927032/8.0),
+    REAL_CONST(68323.901350011787/8.0),
+    REAL_CONST(68345.458881418483/8.0),
+    REAL_CONST(68367.018112878912/8.0),
+    REAL_CONST(68388.579044125028/8.0),
+    REAL_CONST(68410.141674888844/8.0),
+    REAL_CONST(68431.706004902502/8.0),
+    REAL_CONST(68453.272033898262/8.0),
+    REAL_CONST(68474.839761608455/8.0),
+    REAL_CONST(68496.409187765545/8.0),
+    REAL_CONST(68517.980312102081/8.0),
+    REAL_CONST(68539.553134350732/8.0),
+    REAL_CONST(68561.127654244279/8.0),
+    REAL_CONST(68582.70387151558/8.0),
+    REAL_CONST(68604.281785897634/8.0),
+    REAL_CONST(68625.861397123503/8.0),
+    REAL_CONST(68647.44270492639/8.0),
+    REAL_CONST(68669.025709039604/8.0),
+    REAL_CONST(68690.610409196524/8.0),
+    REAL_CONST(68712.196805130661/8.0),
+    REAL_CONST(68733.784896575627/8.0),
+    REAL_CONST(68755.374683265123/8.0),
+    REAL_CONST(68776.966164932994/8.0),
+    REAL_CONST(68798.559341313128/8.0),
+    REAL_CONST(68820.154212139591/8.0),
+    REAL_CONST(68841.750777146473/8.0),
+    REAL_CONST(68863.349036068044/8.0),
+    REAL_CONST(68884.948988638629/8.0),
+    REAL_CONST(68906.550634592684/8.0),
+    REAL_CONST(68928.153973664739/8.0),
+    REAL_CONST(68949.75900558944/8.0),
+    REAL_CONST(68971.365730101577/8.0),
+    REAL_CONST(68992.974146935987/8.0),
+    REAL_CONST(69014.584255827634/8.0),
+    REAL_CONST(69036.196056511588/8.0),
+    REAL_CONST(69057.809548723017/8.0),
+    REAL_CONST(69079.424732197207/8.0),
+    REAL_CONST(69101.041606669532/8.0),
+    REAL_CONST(69122.660171875468/8.0),
+    REAL_CONST(69144.280427550606/8.0),
+    REAL_CONST(69165.902373430625/8.0),
+    REAL_CONST(69187.526009251334/8.0),
+    REAL_CONST(69209.151334748618/8.0),
+    REAL_CONST(69230.778349658474/8.0),
+    REAL_CONST(69252.40705371699/8.0),
+    REAL_CONST(69274.037446660412/8.0),
+    REAL_CONST(69295.669528225/8.0),
+    REAL_CONST(69317.303298147192/8.0),
+    REAL_CONST(69338.938756163494/8.0),
+    REAL_CONST(69360.575902010532/8.0),
+    REAL_CONST(69382.214735425005/8.0),
+    REAL_CONST(69403.855256143754/8.0),
+    REAL_CONST(69425.497463903681/8.0),
+    REAL_CONST(69447.141358441833/8.0),
+    REAL_CONST(69468.78693949533/8.0),
+    REAL_CONST(69490.434206801394/8.0),
+    REAL_CONST(69512.083160097391/8.0),
+    REAL_CONST(69533.733799120717/8.0),
+    REAL_CONST(69555.386123608929/8.0),
+    REAL_CONST(69577.04013329967/8.0),
+    REAL_CONST(69598.695827930685/8.0),
+    REAL_CONST(69620.353207239794/8.0),
+    REAL_CONST(69642.012270964973/8.0),
+    REAL_CONST(69663.67301884426/8.0),
+    REAL_CONST(69685.335450615792/8.0),
+    REAL_CONST(69706.999566017839/8.0),
+    REAL_CONST(69728.665364788743/8.0),
+    REAL_CONST(69750.332846666963/8.0),
+    REAL_CONST(69772.002011391058/8.0),
+    REAL_CONST(69793.672858699691/8.0),
+    REAL_CONST(69815.345388331611/8.0),
+    REAL_CONST(69837.019600025669/8.0),
+    REAL_CONST(69858.695493520849/8.0),
+    REAL_CONST(69880.373068556204/8.0),
+    REAL_CONST(69902.052324870907/8.0),
+    REAL_CONST(69923.733262204216/8.0),
+    REAL_CONST(69945.415880295492/8.0),
+    REAL_CONST(69967.100178884211/8.0),
+    REAL_CONST(69988.786157709939/8.0),
+    REAL_CONST(70010.473816512356/8.0),
+    REAL_CONST(70032.163155031216/8.0),
+    REAL_CONST(70053.854173006403/8.0),
+    REAL_CONST(70075.546870177874/8.0),
+    REAL_CONST(70097.241246285717/8.0),
+    REAL_CONST(70118.937301070109/8.0),
+    REAL_CONST(70140.635034271298/8.0),
+    REAL_CONST(70162.334445629691/8.0),
+    REAL_CONST(70184.035534885741/8.0),
+    REAL_CONST(70205.738301780017/8.0),
+    REAL_CONST(70227.442746053217/8.0),
+    REAL_CONST(70249.1488674461/8.0),
+    REAL_CONST(70270.856665699539/8.0),
+    REAL_CONST(70292.566140554511/8.0),
+    REAL_CONST(70314.277291752107/8.0),
+    REAL_CONST(70335.990119033493/8.0),
+    REAL_CONST(70357.704622139936/8.0),
+    REAL_CONST(70379.420800812819/8.0),
+    REAL_CONST(70401.138654793613/8.0),
+    REAL_CONST(70422.85818382389/8.0),
+    REAL_CONST(70444.579387645339/8.0),
+    REAL_CONST(70466.302265999722/8.0),
+    REAL_CONST(70488.026818628918/8.0),
+    REAL_CONST(70509.753045274876/8.0),
+    REAL_CONST(70531.480945679708/8.0),
+    REAL_CONST(70553.210519585555/8.0),
+    REAL_CONST(70574.941766734701/8.0),
+    REAL_CONST(70596.674686869505/8.0),
+    REAL_CONST(70618.409279732456/8.0),
+    REAL_CONST(70640.145545066101/8.0),
+    REAL_CONST(70661.883482613106/8.0),
+    REAL_CONST(70683.623092116264/8.0),
+    REAL_CONST(70705.364373318414/8.0),
+    REAL_CONST(70727.107325962526/8.0),
+    REAL_CONST(70748.851949791671/8.0),
+    REAL_CONST(70770.598244549008/8.0),
+    REAL_CONST(70792.346209977783/8.0),
+    REAL_CONST(70814.095845821372/8.0),
+    REAL_CONST(70835.847151823225/8.0),
+    REAL_CONST(70857.600127726895/8.0),
+    REAL_CONST(70879.354773276034/8.0),
+    REAL_CONST(70901.111088214413/8.0),
+    REAL_CONST(70922.869072285859/8.0),
+    REAL_CONST(70944.628725234332/8.0),
+    REAL_CONST(70966.390046803877/8.0),
+    REAL_CONST(70988.153036738629/8.0),
+    REAL_CONST(71009.917694782853/8.0),
+    REAL_CONST(71031.684020680885/8.0),
+    REAL_CONST(71053.45201417715/8.0),
+    REAL_CONST(71075.221675016204/8.0),
+    REAL_CONST(71096.993002942661/8.0),
+    REAL_CONST(71118.765997701266/8.0),
+    REAL_CONST(71140.540659036851/8.0),
+    REAL_CONST(71162.316986694335/8.0),
+    REAL_CONST(71184.09498041874/8.0),
+    REAL_CONST(71205.874639955218/8.0),
+    REAL_CONST(71227.655965048951/8.0),
+    REAL_CONST(71249.438955445294/8.0),
+    REAL_CONST(71271.223610889632/8.0),
+    REAL_CONST(71293.009931127483/8.0),
+    REAL_CONST(71314.797915904477/8.0),
+    REAL_CONST(71336.587564966307/8.0),
+    REAL_CONST(71358.378878058764/8.0),
+    REAL_CONST(71380.171854927772/8.0),
+    REAL_CONST(71401.966495319313/8.0),
+    REAL_CONST(71423.762798979486/8.0),
+    REAL_CONST(71445.560765654489/8.0),
+    REAL_CONST(71467.360395090596/8.0),
+    REAL_CONST(71489.161687034211/8.0),
+    REAL_CONST(71510.964641231811/8.0),
+    REAL_CONST(71532.769257429973/8.0),
+    REAL_CONST(71554.575535375348/8.0),
+    REAL_CONST(71576.383474814749/8.0),
+    REAL_CONST(71598.19307549503/8.0),
+    REAL_CONST(71620.004337163133/8.0),
+    REAL_CONST(71641.817259566145/8.0),
+    REAL_CONST(71663.631842451214/8.0),
+    REAL_CONST(71685.4480855656/8.0),
+    REAL_CONST(71707.26598865664/8.0),
+    REAL_CONST(71729.085551471784/8.0),
+    REAL_CONST(71750.906773758586/8.0),
+    REAL_CONST(71772.729655264673/8.0),
+    REAL_CONST(71794.554195737772/8.0),
+    REAL_CONST(71816.380394925713/8.0),
+    REAL_CONST(71838.208252576442/8.0),
+    REAL_CONST(71860.037768437964/8.0),
+    REAL_CONST(71881.868942258385/8.0),
+    REAL_CONST(71903.701773785942/8.0),
+    REAL_CONST(71925.536262768932/8.0),
+    REAL_CONST(71947.372408955751/8.0),
+    REAL_CONST(71969.210212094898/8.0),
+    REAL_CONST(71991.049671934976/8.0),
+    REAL_CONST(72012.890788224686/8.0),
+    REAL_CONST(72034.73356071279/8.0),
+    REAL_CONST(72056.577989148165/8.0),
+    REAL_CONST(72078.424073279821/8.0),
+    REAL_CONST(72100.271812856794/8.0),
+    REAL_CONST(72122.121207628254/8.0),
+    REAL_CONST(72143.97225734347/8.0),
+    REAL_CONST(72165.824961751801/8.0),
+    REAL_CONST(72187.679320602692/8.0),
+    REAL_CONST(72209.53533364569/8.0),
+    REAL_CONST(72231.393000630429/8.0),
+    REAL_CONST(72253.252321306645/8.0),
+    REAL_CONST(72275.113295424177/8.0),
+    REAL_CONST(72296.975922732949/8.0),
+    REAL_CONST(72318.840202982959/8.0),
+    REAL_CONST(72340.706135924338/8.0),
+    REAL_CONST(72362.573721307272/8.0),
+    REAL_CONST(72384.442958882093/8.0),
+    REAL_CONST(72406.313848399179/8.0),
+    REAL_CONST(72428.186389609036/8.0),
+    REAL_CONST(72450.060582262216/8.0),
+    REAL_CONST(72471.936426109431/8.0),
+    REAL_CONST(72493.813920901433/8.0),
+    REAL_CONST(72515.693066389096/8.0),
+    REAL_CONST(72537.573862323392/8.0),
+    REAL_CONST(72559.456308455352/8.0),
+    REAL_CONST(72581.340404536139/8.0),
+    REAL_CONST(72603.226150316987/8.0),
+    REAL_CONST(72625.113545549248/8.0),
+    REAL_CONST(72647.002589984331/8.0),
+    REAL_CONST(72668.893283373764/8.0),
+    REAL_CONST(72690.785625469172/8.0),
+    REAL_CONST(72712.679616022273/8.0),
+    REAL_CONST(72734.575254784853/8.0),
+    REAL_CONST(72756.472541508803/8.0),
+    REAL_CONST(72778.371475946144/8.0),
+    REAL_CONST(72800.272057848939/8.0),
+    REAL_CONST(72822.174286969355/8.0),
+    REAL_CONST(72844.07816305969/8.0),
+    REAL_CONST(72865.983685872285/8.0),
+    REAL_CONST(72887.890855159596/8.0),
+    REAL_CONST(72909.799670674183/8.0),
+    REAL_CONST(72931.710132168693/8.0),
+    REAL_CONST(72953.622239395845/8.0),
+    REAL_CONST(72975.535992108475/8.0),
+    REAL_CONST(72997.451390059519/8.0),
+    REAL_CONST(73019.368433001961/8.0),
+    REAL_CONST(73041.287120688925/8.0),
+    REAL_CONST(73063.207452873612/8.0),
+    REAL_CONST(73085.129429309294/8.0),
+    REAL_CONST(73107.053049749389/8.0),
+    REAL_CONST(73128.978313947344/8.0),
+    REAL_CONST(73150.905221656736/8.0),
+    REAL_CONST(73172.833772631217/8.0),
+    REAL_CONST(73194.763966624567/8.0),
+    REAL_CONST(73216.695803390612/8.0),
+    REAL_CONST(73238.62928268328/8.0),
+    REAL_CONST(73260.564404256627/8.0),
+    REAL_CONST(73282.501167864757/8.0),
+    REAL_CONST(73304.439573261901/8.0),
+    REAL_CONST(73326.379620202337/8.0),
+    REAL_CONST(73348.321308440485/8.0),
+    REAL_CONST(73370.264637730841/8.0),
+    REAL_CONST(73392.209607827957/8.0),
+    REAL_CONST(73414.156218486532/8.0),
+    REAL_CONST(73436.104469461323/8.0),
+    REAL_CONST(73458.054360507173/8.0),
+    REAL_CONST(73480.005891379056/8.0),
+    REAL_CONST(73501.959061831993/8.0),
+    REAL_CONST(73523.913871621116/8.0),
+    REAL_CONST(73545.870320501665/8.0),
+    REAL_CONST(73567.828408228932/8.0),
+    REAL_CONST(73589.78813455833/8.0),
+    REAL_CONST(73611.749499245358/8.0),
+    REAL_CONST(73633.712502045615/8.0),
+    REAL_CONST(73655.677142714747/8.0),
+    REAL_CONST(73677.643421008557/8.0),
+    REAL_CONST(73699.611336682879/8.0),
+    REAL_CONST(73721.580889493693/8.0),
+    REAL_CONST(73743.552079197019/8.0),
+    REAL_CONST(73765.524905548999/8.0),
+    REAL_CONST(73787.499368305856/8.0),
+    REAL_CONST(73809.475467223907/8.0),
+    REAL_CONST(73831.453202059551/8.0),
+    REAL_CONST(73853.432572569291/8.0),
+    REAL_CONST(73875.413578509717/8.0),
+    REAL_CONST(73897.396219637507/8.0),
+    REAL_CONST(73919.380495709411/8.0),
+    REAL_CONST(73941.36640648231/8.0),
+    REAL_CONST(73963.353951713143/8.0),
+    REAL_CONST(73985.343131158952/8.0),
+    REAL_CONST(74007.333944576865/8.0),
+    REAL_CONST(74029.326391724098/8.0),
+    REAL_CONST(74051.320472357969/8.0),
+    REAL_CONST(74073.316186235883/8.0),
+    REAL_CONST(74095.313533115303/8.0),
+    REAL_CONST(74117.312512753837/8.0),
+    REAL_CONST(74139.313124909138/8.0),
+    REAL_CONST(74161.315369338976/8.0),
+    REAL_CONST(74183.319245801191/8.0),
+    REAL_CONST(74205.324754053727/8.0),
+    REAL_CONST(74227.331893854629/8.0),
+    REAL_CONST(74249.340664961986/8.0),
+    REAL_CONST(74271.351067134034/8.0),
+    REAL_CONST(74293.363100129049/8.0),
+    REAL_CONST(74315.376763705441/8.0),
+    REAL_CONST(74337.392057621662/8.0),
+    REAL_CONST(74359.408981636298/8.0),
+    REAL_CONST(74381.427535508003/8.0),
+    REAL_CONST(74403.447718995507/8.0),
+    REAL_CONST(74425.469531857671/8.0),
+    REAL_CONST(74447.492973853383/8.0),
+    REAL_CONST(74469.518044741693/8.0),
+    REAL_CONST(74491.54474428168/8.0),
+    REAL_CONST(74513.573072232539/8.0),
+    REAL_CONST(74535.603028353551/8.0),
+    REAL_CONST(74557.634612404087/8.0),
+    REAL_CONST(74579.667824143602/8.0),
+    REAL_CONST(74601.702663331642/8.0),
+    REAL_CONST(74623.739129727837/8.0),
+    REAL_CONST(74645.777223091936/8.0),
+    REAL_CONST(74667.816943183716/8.0),
+    REAL_CONST(74689.858289763113/8.0),
+    REAL_CONST(74711.901262590094/8.0),
+    REAL_CONST(74733.945861424741/8.0),
+    REAL_CONST(74755.992086027225/8.0),
+    REAL_CONST(74778.039936157802/8.0),
+    REAL_CONST(74800.089411576817/8.0),
+    REAL_CONST(74822.140512044702/8.0),
+    REAL_CONST(74844.193237321961/8.0),
+    REAL_CONST(74866.24758716923/8.0),
+    REAL_CONST(74888.303561347187/8.0),
+    REAL_CONST(74910.36115961663/8.0),
+    REAL_CONST(74932.420381738411/8.0),
+    REAL_CONST(74954.481227473516/8.0),
+    REAL_CONST(74976.543696582972/8.0),
+    REAL_CONST(74998.607788827925/8.0),
+    REAL_CONST(75020.673503969607/8.0),
+    REAL_CONST(75042.740841769322/8.0),
+    REAL_CONST(75064.809801988464/8.0),
+    REAL_CONST(75086.88038438854/8.0),
+    REAL_CONST(75108.952588731103/8.0),
+    REAL_CONST(75131.026414777836/8.0),
+    REAL_CONST(75153.101862290467/8.0),
+    REAL_CONST(75175.178931030852/8.0),
+    REAL_CONST(75197.257620760924/8.0),
+    REAL_CONST(75219.33793124267/8.0),
+    REAL_CONST(75241.419862238225/8.0),
+    REAL_CONST(75263.503413509738/8.0),
+    REAL_CONST(75285.588584819503/8.0),
+    REAL_CONST(75307.675375929874/8.0),
+    REAL_CONST(75329.763786603318/8.0),
+    REAL_CONST(75351.853816602365/8.0),
+    REAL_CONST(75373.945465689612/8.0),
+    REAL_CONST(75396.038733627807/8.0),
+    REAL_CONST(75418.133620179724/8.0),
+    REAL_CONST(75440.230125108254/8.0),
+    REAL_CONST(75462.32824817636/8.0),
+    REAL_CONST(75484.427989147109/8.0),
+    REAL_CONST(75506.529347783653/8.0),
+    REAL_CONST(75528.63232384919/8.0),
+    REAL_CONST(75550.736917107075/8.0),
+    REAL_CONST(75572.843127320695/8.0),
+    REAL_CONST(75594.950954253538/8.0),
+    REAL_CONST(75617.060397669193/8.0),
+    REAL_CONST(75639.171457331307/8.0),
+    REAL_CONST(75661.284133003646/8.0),
+    REAL_CONST(75683.398424450032/8.0),
+    REAL_CONST(75705.514331434402/8.0),
+    REAL_CONST(75727.631853720741/8.0),
+    REAL_CONST(75749.750991073175/8.0),
+    REAL_CONST(75771.871743255862/8.0),
+    REAL_CONST(75793.994110033076/8.0),
+    REAL_CONST(75816.118091169177/8.0),
+    REAL_CONST(75838.243686428585/8.0),
+    REAL_CONST(75860.370895575848/8.0),
+    REAL_CONST(75882.499718375562/8.0),
+    REAL_CONST(75904.630154592422/8.0),
+    REAL_CONST(75926.762203991224/8.0),
+    REAL_CONST(75948.895866336825/8.0),
+    REAL_CONST(75971.031141394182/8.0),
+    REAL_CONST(75993.168028928325/8.0),
+    REAL_CONST(76015.306528704401/8.0),
+    REAL_CONST(76037.4466404876/8.0),
+    REAL_CONST(76059.588364043215/8.0),
+    REAL_CONST(76081.731699136653/8.0),
+    REAL_CONST(76103.876645533353/8.0),
+    REAL_CONST(76126.023202998884/8.0),
+    REAL_CONST(76148.171371298871/8.0),
+    REAL_CONST(76170.321150199044/8.0),
+    REAL_CONST(76192.472539465205/8.0),
+    REAL_CONST(76214.625538863256/8.0),
+    REAL_CONST(76236.780148159174/8.0),
+    REAL_CONST(76258.936367119008/8.0),
+    REAL_CONST(76281.094195508922/8.0),
+    REAL_CONST(76303.253633095141/8.0),
+    REAL_CONST(76325.414679643975/8.0),
+    REAL_CONST(76347.577334921851/8.0),
+    REAL_CONST(76369.741598695226/8.0),
+    REAL_CONST(76391.907470730686/8.0),
+    REAL_CONST(76414.074950794879/8.0),
+    REAL_CONST(76436.244038654564/8.0),
+    REAL_CONST(76458.414734076548/8.0),
+    REAL_CONST(76480.587036827754/8.0),
+    REAL_CONST(76502.760946675175/8.0),
+    REAL_CONST(76524.936463385893/8.0),
+    REAL_CONST(76547.11358672705/8.0),
+    REAL_CONST(76569.292316465915/8.0),
+    REAL_CONST(76591.472652369819/8.0),
+    REAL_CONST(76613.654594206164/8.0),
+    REAL_CONST(76635.838141742468/8.0),
+    REAL_CONST(76658.023294746308/8.0),
+    REAL_CONST(76680.210052985349/8.0),
+    REAL_CONST(76702.398416227341/8.0),
+    REAL_CONST(76724.588384240138/8.0),
+    REAL_CONST(76746.779956791637/8.0),
+    REAL_CONST(76768.973133649866/8.0),
+    REAL_CONST(76791.167914582897/8.0),
+    REAL_CONST(76813.364299358902/8.0),
+    REAL_CONST(76835.562287746157/8.0),
+    REAL_CONST(76857.761879512967/8.0),
+    REAL_CONST(76879.963074427797/8.0),
+    REAL_CONST(76902.165872259109/8.0),
+    REAL_CONST(76924.37027277553/8.0),
+    REAL_CONST(76946.576275745727/8.0),
+    REAL_CONST(76968.783880938441/8.0),
+    REAL_CONST(76990.993088122515/8.0),
+    REAL_CONST(77013.203897066895/8.0),
+    REAL_CONST(77035.416307540567/8.0),
+    REAL_CONST(77057.630319312622/8.0),
+    REAL_CONST(77079.845932152239/8.0),
+    REAL_CONST(77102.063145828695/8.0),
+    REAL_CONST(77124.281960111301/8.0),
+    REAL_CONST(77146.50237476948/8.0),
+    REAL_CONST(77168.724389572759/8.0),
+    REAL_CONST(77190.948004290723/8.0),
+    REAL_CONST(77213.173218693031/8.0),
+    REAL_CONST(77235.400032549442/8.0),
+    REAL_CONST(77257.628445629802/8.0),
+    REAL_CONST(77279.858457704031/8.0),
+    REAL_CONST(77302.090068542122/8.0),
+    REAL_CONST(77324.323277914169/8.0),
+    REAL_CONST(77346.558085590339/8.0),
+    REAL_CONST(77368.794491340886/8.0),
+    REAL_CONST(77391.032494936138/8.0),
+    REAL_CONST(77413.272096146524/8.0),
+    REAL_CONST(77435.51329474253/8.0),
+    REAL_CONST(77457.756090494731/8.0),
+    REAL_CONST(77480.000483173804/8.0),
+    REAL_CONST(77502.246472550498/8.0),
+    REAL_CONST(77524.494058395634/8.0),
+    REAL_CONST(77546.743240480107/8.0),
+    REAL_CONST(77568.994018574944/8.0),
+    REAL_CONST(77591.246392451198/8.0),
+    REAL_CONST(77613.500361880026/8.0),
+    REAL_CONST(77635.755926632657/8.0),
+    REAL_CONST(77658.013086480438/8.0),
+    REAL_CONST(77680.271841194757/8.0),
+    REAL_CONST(77702.532190547092/8.0),
+    REAL_CONST(77724.794134309021/8.0),
+    REAL_CONST(77747.057672252195/8.0),
+    REAL_CONST(77769.322804148323/8.0),
+    REAL_CONST(77791.589529769248/8.0),
+    REAL_CONST(77813.857848886837/8.0),
+    REAL_CONST(77836.127761273063/8.0),
+    REAL_CONST(77858.399266699998/8.0),
+    REAL_CONST(77880.67236493979/8.0),
+    REAL_CONST(77902.947055764627/8.0),
+    REAL_CONST(77925.223338946831/8.0),
+    REAL_CONST(77947.50121425878/8.0),
+    REAL_CONST(77969.780681472927/8.0),
+    REAL_CONST(77992.061740361838/8.0),
+    REAL_CONST(78014.344390698127/8.0),
+    REAL_CONST(78036.628632254491/8.0),
+    REAL_CONST(78058.914464803747/8.0),
+    REAL_CONST(78081.201888118725/8.0),
+    REAL_CONST(78103.490901972415/8.0),
+    REAL_CONST(78125.781506137821/8.0),
+    REAL_CONST(78148.073700388064/8.0),
+    REAL_CONST(78170.367484496339/8.0),
+    REAL_CONST(78192.662858235926/8.0),
+    REAL_CONST(78214.959821380166/8.0),
+    REAL_CONST(78237.258373702498/8.0),
+    REAL_CONST(78259.558514976452/8.0),
+    REAL_CONST(78281.860244975614/8.0),
+    REAL_CONST(78304.163563473659/8.0),
+    REAL_CONST(78326.468470244363/8.0),
+    REAL_CONST(78348.77496506153/8.0),
+    REAL_CONST(78371.083047699125/8.0),
+    REAL_CONST(78393.392717931114/8.0),
+    REAL_CONST(78415.703975531578/8.0),
+    REAL_CONST(78438.016820274701/8.0),
+    REAL_CONST(78460.331251934695/8.0),
+    REAL_CONST(78482.647270285903/8.0),
+    REAL_CONST(78504.964875102727/8.0),
+    REAL_CONST(78527.284066159627/8.0),
+    REAL_CONST(78549.604843231195/8.0),
+    REAL_CONST(78571.927206092048/8.0),
+    REAL_CONST(78594.251154516911/8.0),
+    REAL_CONST(78616.576688280606/8.0),
+    REAL_CONST(78638.903807157985/8.0),
+    REAL_CONST(78661.232510924034/8.0),
+    REAL_CONST(78683.562799353778/8.0),
+    REAL_CONST(78705.894672222363/8.0),
+    REAL_CONST(78728.228129304945/8.0),
+    REAL_CONST(78750.563170376859/8.0),
+    REAL_CONST(78772.899795213423/8.0),
+    REAL_CONST(78795.238003590101/8.0),
+    REAL_CONST(78817.577795282399/8.0),
+    REAL_CONST(78839.919170065928/8.0),
+    REAL_CONST(78862.262127716356/8.0),
+    REAL_CONST(78884.606668009452/8.0),
+    REAL_CONST(78906.952790721043/8.0),
+    REAL_CONST(78929.300495627045/8.0),
+    REAL_CONST(78951.64978250346/8.0),
+    REAL_CONST(78974.000651126378/8.0),
+    REAL_CONST(78996.353101271932/8.0),
+    REAL_CONST(79018.707132716358/8.0),
+    REAL_CONST(79041.062745235977/8.0),
+    REAL_CONST(79063.41993860717/8.0),
+    REAL_CONST(79085.778712606436/8.0),
+    REAL_CONST(79108.139067010285/8.0),
+    REAL_CONST(79130.501001595389/8.0),
+    REAL_CONST(79152.864516138419/8.0),
+    REAL_CONST(79175.22961041618/8.0),
+    REAL_CONST(79197.596284205531/8.0),
+    REAL_CONST(79219.96453728342/8.0),
+    REAL_CONST(79242.33436942687/8.0),
+    REAL_CONST(79264.705780412987/8.0),
+    REAL_CONST(79287.078770018954/8.0),
+    REAL_CONST(79309.453338022009/8.0),
+    REAL_CONST(79331.829484199508/8.0),
+    REAL_CONST(79354.207208328866/8.0),
+    REAL_CONST(79376.586510187582/8.0),
+    REAL_CONST(79398.967389553218/8.0),
+    REAL_CONST(79421.349846203433/8.0),
+    REAL_CONST(79443.733879915948/8.0),
+    REAL_CONST(79466.119490468584/8.0),
+    REAL_CONST(79488.50667763922/8.0),
+    REAL_CONST(79510.895441205823/8.0),
+    REAL_CONST(79533.285780946433/8.0),
+    REAL_CONST(79555.677696639163/8.0),
+    REAL_CONST(79578.071188062226/8.0),
+    REAL_CONST(79600.466254993895/8.0),
+    REAL_CONST(79622.862897212515/8.0),
+    REAL_CONST(79645.261114496549/8.0),
+    REAL_CONST(79667.660906624471/8.0),
+    REAL_CONST(79690.062273374875/8.0),
+    REAL_CONST(79712.465214526455/8.0),
+    REAL_CONST(79734.869729857935/8.0),
+    REAL_CONST(79757.275819148126/8.0),
+    REAL_CONST(79779.683482175955/8.0),
+    REAL_CONST(79802.092718720378/8.0),
+    REAL_CONST(79824.503528560454/8.0),
+    REAL_CONST(79846.915911475327/8.0),
+    REAL_CONST(79869.329867244203/8.0),
+    REAL_CONST(79891.745395646343/8.0),
+    REAL_CONST(79914.162496461155/8.0),
+    REAL_CONST(79936.581169468045/8.0),
+    REAL_CONST(79959.001414446553/8.0),
+    REAL_CONST(79981.423231176261/8.0),
+    REAL_CONST(80003.846619436852/8.0),
+    REAL_CONST(80026.271579008084/8.0),
+    REAL_CONST(80048.698109669771/8.0),
+    REAL_CONST(80071.12621120183/8.0),
+    REAL_CONST(80093.555883384237/8.0),
+    REAL_CONST(80115.987125997053/8.0),
+    REAL_CONST(80138.419938820414/8.0),
+    REAL_CONST(80160.854321634528/8.0),
+    REAL_CONST(80183.290274219689/8.0),
+    REAL_CONST(80205.727796356281/8.0),
+    REAL_CONST(80228.166887824715/8.0),
+    REAL_CONST(80250.607548405547/8.0),
+    REAL_CONST(80273.049777879336/8.0),
+    REAL_CONST(80295.493576026798/8.0),
+    REAL_CONST(80317.938942628651/8.0),
+    REAL_CONST(80340.385877465727/8.0),
+    REAL_CONST(80362.834380318949/8.0),
+    REAL_CONST(80385.28445096928/8.0),
+    REAL_CONST(80407.736089197788/8.0),
+    REAL_CONST(80430.189294785596/8.0),
+    REAL_CONST(80452.644067513917/8.0),
+    REAL_CONST(80475.100407164035/8.0),
+    REAL_CONST(80497.558313517322/8.0),
+    REAL_CONST(80520.017786355209/8.0),
+    REAL_CONST(80542.478825459213/8.0),
+    REAL_CONST(80564.941430610925/8.0),
+    REAL_CONST(80587.405601592007/8.0),
+    REAL_CONST(80609.871338184195/8.0),
+    REAL_CONST(80632.338640169342/8.0),
+    REAL_CONST(80654.8075073293/8.0),
+    REAL_CONST(80677.277939446067/8.0),
+    REAL_CONST(80699.749936301683/8.0),
+    REAL_CONST(80722.223497678278/8.0),
+    REAL_CONST(80744.698623358039/8.0),
+    REAL_CONST(80767.17531312324/8.0),
+    REAL_CONST(80789.653566756242/8.0),
+    REAL_CONST(80812.133384039465/8.0),
+    REAL_CONST(80834.614764755403/8.0),
+    REAL_CONST(80857.097708686648/8.0),
+    REAL_CONST(80879.582215615854/8.0),
+    REAL_CONST(80902.068285325731/8.0),
+    REAL_CONST(80924.555917599093/8.0),
+    REAL_CONST(80947.045112218824/8.0),
+    REAL_CONST(80969.535868967869/8.0),
+    REAL_CONST(80992.028187629272/8.0),
+    REAL_CONST(81014.522067986123/8.0),
+    REAL_CONST(81037.017509821613/8.0),
+    REAL_CONST(81059.514512919006/8.0),
+    REAL_CONST(81082.013077061609/8.0),
+    REAL_CONST(81104.513202032831/8.0),
+    REAL_CONST(81127.014887616184/8.0),
+    REAL_CONST(81149.518133595193/8.0),
+    REAL_CONST(81172.022939753486/8.0),
+    REAL_CONST(81194.529305874807/8.0),
+    REAL_CONST(81217.037231742899/8.0),
+    REAL_CONST(81239.546717141639/8.0),
+    REAL_CONST(81262.057761854958/8.0),
+    REAL_CONST(81284.570365666848/8.0),
+    REAL_CONST(81307.084528361403/8.0),
+    REAL_CONST(81329.600249722775/8.0),
+    REAL_CONST(81352.117529535186/8.0),
+    REAL_CONST(81374.636367582949/8.0),
+    REAL_CONST(81397.156763650448/8.0),
+    REAL_CONST(81419.678717522125/8.0),
+    REAL_CONST(81442.202228982511/8.0),
+    REAL_CONST(81464.727297816222/8.0),
+    REAL_CONST(81487.253923807933/8.0),
+    REAL_CONST(81509.782106742379/8.0),
+    REAL_CONST(81532.311846404409/8.0),
+    REAL_CONST(81554.843142578902/8.0),
+    REAL_CONST(81577.375995050839/8.0),
+    REAL_CONST(81599.910403605274/8.0),
+    REAL_CONST(81622.446368027333/8.0),
+    REAL_CONST(81644.983888102215/8.0),
+    REAL_CONST(81667.522963615178/8.0),
+    REAL_CONST(81690.063594351581/8.0),
+    REAL_CONST(81712.605780096841/8.0),
+    REAL_CONST(81735.149520636449/8.0),
+    REAL_CONST(81757.694815755967/8.0),
+    REAL_CONST(81780.241665241047/8.0),
+    REAL_CONST(81802.79006887741/8.0),
+    REAL_CONST(81825.340026450824/8.0),
+    REAL_CONST(81847.891537747171/8.0),
+    REAL_CONST(81870.444602552379/8.0),
+    REAL_CONST(81892.999220652477/8.0),
+    REAL_CONST(81915.555391833506/8.0),
+    REAL_CONST(81938.113115881672/8.0),
+    REAL_CONST(81960.672392583176/8.0),
+    REAL_CONST(81983.233221724338/8.0),
+    REAL_CONST(82005.795603091537/8.0),
+    REAL_CONST(82028.359536471224/8.0),
+    REAL_CONST(82050.925021649906/8.0),
+    REAL_CONST(82073.492058414209/8.0),
+    REAL_CONST(82096.060646550788/8.0),
+    REAL_CONST(82118.630785846399/8.0),
+    REAL_CONST(82141.202476087841/8.0),
+    REAL_CONST(82163.775717062032/8.0),
+    REAL_CONST(82186.35050855593/8.0),
+    REAL_CONST(82208.926850356569/8.0),
+    REAL_CONST(82231.504742251054/8.0),
+    REAL_CONST(82254.084184026578/8.0),
+    REAL_CONST(82276.665175470393/8.0),
+    REAL_CONST(82299.24771636985/8.0),
+    REAL_CONST(82321.831806512317/8.0),
+    REAL_CONST(82344.417445685307/8.0),
+    REAL_CONST(82367.004633676348/8.0),
+    REAL_CONST(82389.593370273054/8.0),
+    REAL_CONST(82412.183655263143/8.0),
+    REAL_CONST(82434.775488434374/8.0),
+    REAL_CONST(82457.368869574595/8.0),
+    REAL_CONST(82479.963798471697/8.0),
+    REAL_CONST(82502.560274913689/8.0),
+    REAL_CONST(82525.158298688606/8.0),
+    REAL_CONST(82547.757869584602/8.0),
+    REAL_CONST(82570.35898738986/8.0),
+    REAL_CONST(82592.961651892678/8.0),
+    REAL_CONST(82615.565862881398/8.0),
+    REAL_CONST(82638.171620144421/8.0),
+    REAL_CONST(82660.778923470265/8.0),
+    REAL_CONST(82683.387772647475/8.0),
+    REAL_CONST(82705.998167464713/8.0),
+    REAL_CONST(82728.610107710658/8.0),
+    REAL_CONST(82751.223593174116/8.0),
+    REAL_CONST(82773.83862364394/8.0),
+    REAL_CONST(82796.45519890904/8.0),
+    REAL_CONST(82819.073318758441/8.0),
+    REAL_CONST(82841.692982981185/8.0),
+    REAL_CONST(82864.314191366429/8.0),
+    REAL_CONST(82886.936943703375/8.0),
+    REAL_CONST(82909.561239781324/8.0),
+    REAL_CONST(82932.187079389638/8.0),
+    REAL_CONST(82954.814462317736/8.0),
+    REAL_CONST(82977.443388355125/8.0),
+    REAL_CONST(83000.073857291369/8.0),
+    REAL_CONST(83022.70586891612/8.0),
+    REAL_CONST(83045.339423019104/8.0),
+    REAL_CONST(83067.974519390089/8.0),
+    REAL_CONST(83090.611157818959/8.0),
+    REAL_CONST(83113.249338095629/8.0),
+    REAL_CONST(83135.8890600101/8.0),
+    REAL_CONST(83158.530323352461/8.0),
+    REAL_CONST(83181.173127912858/8.0),
+    REAL_CONST(83203.817473481497/8.0),
+    REAL_CONST(83226.463359848669/8.0),
+    REAL_CONST(83249.11078680474/8.0),
+    REAL_CONST(83271.759754140134/8.0),
+    REAL_CONST(83294.410261645375/8.0),
+    REAL_CONST(83317.062309111003/8.0),
+    REAL_CONST(83339.715896327703/8.0),
+    REAL_CONST(83362.371023086147/8.0),
+    REAL_CONST(83385.027689177165/8.0),
+    REAL_CONST(83407.685894391587/8.0),
+    REAL_CONST(83430.345638520361/8.0),
+    REAL_CONST(83453.006921354478/8.0),
+    REAL_CONST(83475.669742685001/8.0),
+    REAL_CONST(83498.334102303095/8.0),
+    REAL_CONST(83520.999999999942/8.0),
+    REAL_CONST(83543.667435566866/8.0),
+    REAL_CONST(83566.336408795192/8.0),
+    REAL_CONST(83589.006919476349/8.0),
+    REAL_CONST(83611.678967401851/8.0),
+    REAL_CONST(83634.352552363242/8.0),
+    REAL_CONST(83657.027674152167/8.0),
+    REAL_CONST(83679.704332560359/8.0),
+    REAL_CONST(83702.382527379552/8.0),
+    REAL_CONST(83725.062258401638/8.0),
+    REAL_CONST(83747.743525418511/8.0),
+    REAL_CONST(83770.42632822218/8.0),
+    REAL_CONST(83793.110666604684/8.0),
+    REAL_CONST(83815.796540358162/8.0),
+    REAL_CONST(83838.483949274829/8.0),
+    REAL_CONST(83861.172893146941/8.0),
+    REAL_CONST(83883.863371766842/8.0),
+    REAL_CONST(83906.555384926964/8.0),
+    REAL_CONST(83929.248932419752/8.0),
+    REAL_CONST(83951.944014037799/8.0),
+    REAL_CONST(83974.640629573696/8.0),
+    REAL_CONST(83997.338778820151/8.0),
+    REAL_CONST(84020.038461569929/8.0),
+    REAL_CONST(84042.739677615857/8.0),
+    REAL_CONST(84065.442426750829/8.0),
+    REAL_CONST(84088.146708767847/8.0),
+    REAL_CONST(84110.852523459922/8.0),
+    REAL_CONST(84133.559870620171/8.0),
+    REAL_CONST(84156.268750041796/8.0),
+    REAL_CONST(84178.979161518029/8.0),
+    REAL_CONST(84201.691104842204/8.0),
+    REAL_CONST(84224.404579807713/8.0),
+    REAL_CONST(84247.119586208006/8.0),
+    REAL_CONST(84269.83612383662/8.0),
+    REAL_CONST(84292.55419248715/8.0),
+    REAL_CONST(84315.273791953281/8.0),
+    REAL_CONST(84337.994922028738/8.0),
+    REAL_CONST(84360.717582507335/8.0),
+    REAL_CONST(84383.441773182945/8.0),
+    REAL_CONST(84406.167493849513/8.0),
+    REAL_CONST(84428.894744301069/8.0),
+    REAL_CONST(84451.623524331691/8.0),
+    REAL_CONST(84474.353833735542/8.0),
+    REAL_CONST(84497.085672306828/8.0),
+    REAL_CONST(84519.819039839858/8.0),
+    REAL_CONST(84542.553936128999/8.0),
+    REAL_CONST(84565.290360968676/8.0),
+    REAL_CONST(84588.028314153402/8.0),
+    REAL_CONST(84610.767795477717/8.0),
+    REAL_CONST(84633.508804736295/8.0),
+    REAL_CONST(84656.251341723822/8.0),
+    REAL_CONST(84678.995406235073/8.0),
+    REAL_CONST(84701.740998064924/8.0),
+    REAL_CONST(84724.488117008252/8.0),
+    REAL_CONST(84747.236762860062/8.0),
+    REAL_CONST(84769.986935415407/8.0),
+    REAL_CONST(84792.73863446941/8.0),
+    REAL_CONST(84815.491859817252/8.0),
+    REAL_CONST(84838.246611254188/8.0),
+    REAL_CONST(84861.002888575575/8.0),
+    REAL_CONST(84883.760691576768/8.0),
+    REAL_CONST(84906.520020053256/8.0),
+    REAL_CONST(84929.28087380057/8.0),
+    REAL_CONST(84952.043252614312/8.0),
+    REAL_CONST(84974.807156290146/8.0),
+    REAL_CONST(84997.572584623806/8.0),
+    REAL_CONST(85020.339537411113/8.0),
+    REAL_CONST(85043.108014447949/8.0),
+    REAL_CONST(85065.878015530237/8.0),
+    REAL_CONST(85088.649540453989/8.0),
+    REAL_CONST(85111.422589015303/8.0),
+    REAL_CONST(85134.197161010321/8.0),
+    REAL_CONST(85156.973256235244/8.0),
+    REAL_CONST(85179.750874486374/8.0),
+    REAL_CONST(85202.530015560071/8.0),
+    REAL_CONST(85225.310679252725/8.0),
+    REAL_CONST(85248.092865360857/8.0),
+    REAL_CONST(85270.876573681016/8.0),
+    REAL_CONST(85293.661804009811/8.0),
+    REAL_CONST(85316.448556143951/8.0),
+    REAL_CONST(85339.236829880188/8.0),
+    REAL_CONST(85362.026625015351/8.0),
+    REAL_CONST(85384.817941346351/8.0),
+    REAL_CONST(85407.610778670132/8.0),
+    REAL_CONST(85430.405136783724/8.0),
+    REAL_CONST(85453.201015484257/8.0),
+    REAL_CONST(85475.998414568865/8.0),
+    REAL_CONST(85498.797333834795/8.0),
+    REAL_CONST(85521.597773079353/8.0),
+    REAL_CONST(85544.399732099904/8.0),
+    REAL_CONST(85567.203210693886/8.0),
+    REAL_CONST(85590.008208658808/8.0),
+    REAL_CONST(85612.814725792239/8.0),
+    REAL_CONST(85635.62276189182/8.0),
+    REAL_CONST(85658.432316755265/8.0),
+    REAL_CONST(85681.243390180331/8.0),
+    REAL_CONST(85704.055981964877/8.0),
+    REAL_CONST(85726.870091906807/8.0),
+    REAL_CONST(85749.685719804082/8.0),
+    REAL_CONST(85772.502865454764/8.0),
+    REAL_CONST(85795.321528656961/8.0),
+    REAL_CONST(85818.141709208852/8.0),
+    REAL_CONST(85840.963406908675/8.0),
+    REAL_CONST(85863.78662155474/8.0),
+    REAL_CONST(85886.611352945445/8.0),
+    REAL_CONST(85909.437600879217/8.0),
+    REAL_CONST(85932.26536515457/8.0),
+    REAL_CONST(85955.094645570091/8.0),
+    REAL_CONST(85977.92544192441/8.0),
+    REAL_CONST(86000.757754016275/8.0),
+    REAL_CONST(86023.591581644432/8.0),
+    REAL_CONST(86046.426924607746/8.0),
+    REAL_CONST(86069.263782705122/8.0),
+    REAL_CONST(86092.102155735556/8.0),
+    REAL_CONST(86114.942043498071/8.0),
+    REAL_CONST(86137.783445791807/8.0),
+    REAL_CONST(86160.626362415918/8.0),
+    REAL_CONST(86183.470793169676/8.0),
+    REAL_CONST(86206.316737852379/8.0),
+    REAL_CONST(86229.164196263402/8.0),
+    REAL_CONST(86252.013168202204/8.0),
+    REAL_CONST(86274.863653468303/8.0),
+    REAL_CONST(86297.715651861261/8.0),
+    REAL_CONST(86320.569163180728/8.0),
+    REAL_CONST(86343.424187226425/8.0),
+    REAL_CONST(86366.280723798132/8.0),
+    REAL_CONST(86389.138772695675/8.0),
+    REAL_CONST(86411.998333718977/8.0),
+    REAL_CONST(86434.859406668009/8.0),
+    REAL_CONST(86457.721991342827/8.0),
+    REAL_CONST(86480.586087543532/8.0),
+    REAL_CONST(86503.451695070296/8.0),
+    REAL_CONST(86526.318813723352/8.0),
+    REAL_CONST(86549.187443303032/8.0),
+    REAL_CONST(86572.057583609683/8.0),
+    REAL_CONST(86594.929234443756/8.0),
+    REAL_CONST(86617.802395605773/8.0),
+    REAL_CONST(86640.677066896271/8.0),
+    REAL_CONST(86663.553248115903/8.0),
+    REAL_CONST(86686.43093906538/8.0),
+    REAL_CONST(86709.310139545443/8.0),
+    REAL_CONST(86732.190849356964/8.0),
+    REAL_CONST(86755.073068300815/8.0),
+    REAL_CONST(86777.956796177954/8.0),
+    REAL_CONST(86800.842032789442/8.0),
+    REAL_CONST(86823.728777936354/8.0),
+    REAL_CONST(86846.617031419853/8.0),
+    REAL_CONST(86869.506793041175/8.0),
+    REAL_CONST(86892.398062601613/8.0),
+    REAL_CONST(86915.290839902518/8.0),
+    REAL_CONST(86938.185124745316/8.0),
+    REAL_CONST(86961.080916931489/8.0),
+    REAL_CONST(86983.978216262592/8.0),
+    REAL_CONST(87006.87702254027/8.0),
+    REAL_CONST(87029.777335566177/8.0),
+    REAL_CONST(87052.67915514209/8.0),
+    REAL_CONST(87075.582481069796/8.0),
+    REAL_CONST(87098.487313151185/8.0),
+    REAL_CONST(87121.39365118822/8.0),
+    REAL_CONST(87144.301494982894/8.0),
+    REAL_CONST(87167.210844337285/8.0),
+    REAL_CONST(87190.121699053532/8.0),
+    REAL_CONST(87213.034058933845/8.0),
+    REAL_CONST(87235.947923780506/8.0),
+    REAL_CONST(87258.863293395829/8.0),
+    REAL_CONST(87281.780167582241/8.0),
+    REAL_CONST(87304.698546142172/8.0),
+    REAL_CONST(87327.618428878181/8.0),
+    REAL_CONST(87350.539815592856/8.0),
+    REAL_CONST(87373.462706088845/8.0),
+    REAL_CONST(87396.387100168897/8.0),
+    REAL_CONST(87419.312997635774/8.0),
+    REAL_CONST(87442.240398292357/8.0),
+    REAL_CONST(87465.16930194154/8.0),
+    REAL_CONST(87488.099708386319/8.0),
+    REAL_CONST(87511.031617429733/8.0),
+    REAL_CONST(87533.965028874911/8.0),
+    REAL_CONST(87556.899942525008/8.0),
+    REAL_CONST(87579.836358183282/8.0),
+    REAL_CONST(87602.774275653021/8.0),
+    REAL_CONST(87625.713694737613/8.0),
+    REAL_CONST(87648.654615240492/8.0),
+    REAL_CONST(87671.597036965148/8.0),
+    REAL_CONST(87694.540959715145/8.0),
+    REAL_CONST(87717.486383294105/8.0),
+    REAL_CONST(87740.433307505737/8.0),
+    REAL_CONST(87763.381732153779/8.0),
+    REAL_CONST(87786.331657042057/8.0),
+    REAL_CONST(87809.283081974456/8.0),
+    REAL_CONST(87832.236006754916/8.0),
+    REAL_CONST(87855.190431187453/8.0),
+    REAL_CONST(87878.146355076155/8.0),
+    REAL_CONST(87901.103778225151/8.0),
+    REAL_CONST(87924.062700438633/8.0),
+    REAL_CONST(87947.023121520891/8.0),
+    REAL_CONST(87969.985041276246/8.0),
+    REAL_CONST(87992.948459509105/8.0),
+    REAL_CONST(88015.913376023906/8.0),
+    REAL_CONST(88038.879790625171/8.0),
+    REAL_CONST(88061.847703117513/8.0),
+    REAL_CONST(88084.817113305573/8.0),
+    REAL_CONST(88107.788020994049/8.0),
+    REAL_CONST(88130.760425987726/8.0),
+    REAL_CONST(88153.734328091465/8.0),
+    REAL_CONST(88176.709727110137/8.0),
+    REAL_CONST(88199.686622848749/8.0),
+    REAL_CONST(88222.665015112303/8.0),
+    REAL_CONST(88245.644903705906/8.0),
+    REAL_CONST(88268.626288434709/8.0),
+    REAL_CONST(88291.609169103947/8.0),
+    REAL_CONST(88314.593545518903/8.0),
+    REAL_CONST(88337.579417484914/8.0),
+    REAL_CONST(88360.566784807408/8.0),
+    REAL_CONST(88383.555647291854/8.0),
+    REAL_CONST(88406.546004743795/8.0),
+    REAL_CONST(88429.537856968818/8.0),
+    REAL_CONST(88452.531203772611/8.0),
+    REAL_CONST(88475.52604496089/8.0),
+    REAL_CONST(88498.522380339447/8.0),
+    REAL_CONST(88521.52020971413/8.0),
+    REAL_CONST(88544.519532890874/8.0),
+    REAL_CONST(88567.520349675644/8.0),
+    REAL_CONST(88590.522659874507/8.0),
+    REAL_CONST(88613.526463293543/8.0),
+    REAL_CONST(88636.531759738922/8.0),
+    REAL_CONST(88659.538549016899/8.0),
+    REAL_CONST(88682.546830933745/8.0),
+    REAL_CONST(88705.556605295846/8.0),
+    REAL_CONST(88728.567871909589/8.0),
+    REAL_CONST(88751.580630581491/8.0),
+    REAL_CONST(88774.594881118086/8.0),
+    REAL_CONST(88797.610623325963/8.0),
+    REAL_CONST(88820.62785701183/8.0),
+    REAL_CONST(88843.646581982393/8.0),
+    REAL_CONST(88866.666798044462/8.0),
+    REAL_CONST(88889.688505004888/8.0),
+    REAL_CONST(88912.711702670611/8.0),
+    REAL_CONST(88935.7363908486/8.0),
+    REAL_CONST(88958.762569345898/8.0),
+    REAL_CONST(88981.790237969632/8.0),
+    REAL_CONST(89004.81939652696/8.0),
+    REAL_CONST(89027.850044825114/8.0),
+    REAL_CONST(89050.882182671412/8.0),
+    REAL_CONST(89073.9158098732/8.0),
+    REAL_CONST(89096.950926237885/8.0),
+    REAL_CONST(89119.987531572973/8.0),
+    REAL_CONST(89143.025625686001/8.0),
+    REAL_CONST(89166.065208384563/8.0),
+    REAL_CONST(89189.106279476357/8.0),
+    REAL_CONST(89212.148838769106/8.0),
+    REAL_CONST(89235.192886070581/8.0),
+    REAL_CONST(89258.238421188667/8.0),
+    REAL_CONST(89281.285443931265/8.0),
+    REAL_CONST(89304.333954106376/8.0),
+    REAL_CONST(89327.383951522017/8.0),
+    REAL_CONST(89350.435435986306/8.0),
+    REAL_CONST(89373.488407307406/8.0),
+    REAL_CONST(89396.542865293537/8.0),
+    REAL_CONST(89419.598809753006/8.0),
+    REAL_CONST(89442.656240494165/8.0),
+    REAL_CONST(89465.715157325409/8.0),
+    REAL_CONST(89488.775560055219/8.0),
+    REAL_CONST(89511.837448492137/8.0),
+    REAL_CONST(89534.900822444746/8.0),
+    REAL_CONST(89557.965681721733/8.0),
+    REAL_CONST(89581.032026131812/8.0),
+    REAL_CONST(89604.099855483742/8.0),
+    REAL_CONST(89627.169169586399/8.0),
+    REAL_CONST(89650.239968248672/8.0),
+    REAL_CONST(89673.312251279538/8.0),
+    REAL_CONST(89696.386018488018/8.0),
+    REAL_CONST(89719.461269683205/8.0),
+    REAL_CONST(89742.53800467425/8.0),
+    REAL_CONST(89765.616223270365/8.0),
+    REAL_CONST(89788.69592528083/8.0),
+    REAL_CONST(89811.777110514988/8.0),
+    REAL_CONST(89834.859778782207/8.0),
+    REAL_CONST(89857.943929891975/8.0),
+    REAL_CONST(89881.029563653807/8.0),
+    REAL_CONST(89904.116679877261/8.0),
+    REAL_CONST(89927.205278372014/8.0),
+    REAL_CONST(89950.29535894774/8.0),
+    REAL_CONST(89973.386921414218/8.0),
+    REAL_CONST(89996.479965581268/8.0),
+    REAL_CONST(90019.574491258769/8.0),
+    REAL_CONST(90042.670498256688/8.0),
+    REAL_CONST(90065.767986385021/8.0),
+    REAL_CONST(90088.866955453836/8.0),
+    REAL_CONST(90111.967405273259/8.0),
+    REAL_CONST(90135.069335653476/8.0),
+    REAL_CONST(90158.172746404758/8.0),
+    REAL_CONST(90181.277637337407/8.0),
+    REAL_CONST(90204.384008261797/8.0),
+    REAL_CONST(90227.49185898836/8.0),
+    REAL_CONST(90250.601189327586/8.0),
+    REAL_CONST(90273.711999090039/8.0),
+    REAL_CONST(90296.824288086325/8.0),
+    REAL_CONST(90319.938056127125/8.0),
+    REAL_CONST(90343.053303023189/8.0),
+    REAL_CONST(90366.170028585286/8.0),
+    REAL_CONST(90389.288232624298/8.0),
+    REAL_CONST(90412.407914951138/8.0),
+    REAL_CONST(90435.529075376777/8.0),
+    REAL_CONST(90458.651713712257/8.0),
+    REAL_CONST(90481.775829768681/8.0),
+    REAL_CONST(90504.901423357209/8.0),
+    REAL_CONST(90528.028494289058/8.0),
+    REAL_CONST(90551.157042375504/8.0),
+    REAL_CONST(90574.287067427911/8.0),
+    REAL_CONST(90597.418569257643/8.0),
+    REAL_CONST(90620.551547676194/8.0),
+    REAL_CONST(90643.686002495073/8.0),
+    REAL_CONST(90666.821933525847/8.0),
+    REAL_CONST(90689.959340580186/8.0),
+    REAL_CONST(90713.098223469773/8.0),
+    REAL_CONST(90736.238582006365/8.0),
+    REAL_CONST(90759.380416001804/8.0),
+    REAL_CONST(90782.523725267951/8.0),
+    REAL_CONST(90805.668509616764/8.0),
+    REAL_CONST(90828.814768860233/8.0),
+    REAL_CONST(90851.962502810435/8.0),
+    REAL_CONST(90875.11171127946/8.0),
+    REAL_CONST(90898.262394079517/8.0),
+    REAL_CONST(90921.414551022855/8.0),
+    REAL_CONST(90944.568181921743/8.0),
+    REAL_CONST(90967.72328658856/8.0),
+    REAL_CONST(90990.879864835719/8.0),
+    REAL_CONST(91014.037916475718/8.0),
+    REAL_CONST(91037.19744132107/8.0),
+    REAL_CONST(91060.358439184391/8.0),
+    REAL_CONST(91083.520909878338/8.0),
+    REAL_CONST(91106.684853215629/8.0),
+    REAL_CONST(91129.850269009039/8.0),
+    REAL_CONST(91153.017157071401/8.0),
+    REAL_CONST(91176.185517215621/8.0),
+    REAL_CONST(91199.355349254649/8.0),
+    REAL_CONST(91222.526653001492/8.0),
+    REAL_CONST(91245.699428269247/8.0),
+    REAL_CONST(91268.873674871036/8.0),
+    REAL_CONST(91292.049392620058/8.0),
+    REAL_CONST(91315.226581329553/8.0),
+    REAL_CONST(91338.405240812834/8.0),
+    REAL_CONST(91361.585370883287/8.0),
+    REAL_CONST(91384.766971354344/8.0),
+    REAL_CONST(91407.950042039476/8.0),
+    REAL_CONST(91431.134582752245/8.0),
+    REAL_CONST(91454.320593306256/8.0),
+    REAL_CONST(91477.508073515171/8.0),
+    REAL_CONST(91500.697023192712/8.0),
+    REAL_CONST(91523.887442152685/8.0),
+    REAL_CONST(91547.07933020893/8.0),
+    REAL_CONST(91570.272687175326/8.0),
+    REAL_CONST(91593.467512865856/8.0),
+    REAL_CONST(91616.663807094534/8.0),
+    REAL_CONST(91639.861569675442/8.0),
+    REAL_CONST(91663.060800422725/8.0),
+    REAL_CONST(91686.261499150554/8.0),
+    REAL_CONST(91709.463665673218/8.0),
+    REAL_CONST(91732.66729980502/8.0),
+    REAL_CONST(91755.872401360321/8.0),
+    REAL_CONST(91779.078970153569/8.0),
+    REAL_CONST(91802.287005999257/8.0),
+    REAL_CONST(91825.49650871192/8.0),
+    REAL_CONST(91848.707478106167/8.0),
+    REAL_CONST(91871.91991399668/8.0),
+    REAL_CONST(91895.133816198169/8.0),
+    REAL_CONST(91918.349184525418/8.0),
+    REAL_CONST(91941.566018793281/8.0),
+    REAL_CONST(91964.784318816659/8.0),
+    REAL_CONST(91988.004084410495/8.0),
+    REAL_CONST(92011.22531538982/8.0),
+    REAL_CONST(92034.448011569708/8.0),
+    REAL_CONST(92057.672172765277/8.0),
+    REAL_CONST(92080.897798791746/8.0),
+    REAL_CONST(92104.124889464365/8.0),
+    REAL_CONST(92127.353444598411/8.0),
+    REAL_CONST(92150.58346400928/8.0),
+    REAL_CONST(92173.814947512379/8.0),
+    REAL_CONST(92197.04789492322/8.0),
+    REAL_CONST(92220.282306057314/8.0),
+    REAL_CONST(92243.518180730272/8.0),
+    REAL_CONST(92266.755518757753/8.0),
+    REAL_CONST(92289.994319955469/8.0),
+    REAL_CONST(92313.234584139194/8.0),
+    REAL_CONST(92336.476311124774/8.0),
+    REAL_CONST(92359.719500728082/8.0),
+    REAL_CONST(92382.964152765067/8.0),
+    REAL_CONST(92406.210267051734/8.0),
+    REAL_CONST(92429.457843404161/8.0),
+    REAL_CONST(92452.706881638471/8.0),
+    REAL_CONST(92475.957381570814/8.0),
+    REAL_CONST(92499.209343017443/8.0),
+    REAL_CONST(92522.462765794655/8.0),
+    REAL_CONST(92545.717649718805/8.0),
+    REAL_CONST(92568.973994606305/8.0),
+    REAL_CONST(92592.231800273614/8.0),
+    REAL_CONST(92615.491066537259/8.0),
+    REAL_CONST(92638.751793213814/8.0),
+    REAL_CONST(92662.01398011994/8.0),
+    REAL_CONST(92685.277627072326/8.0),
+    REAL_CONST(92708.54273388772/8.0),
+    REAL_CONST(92731.809300382942/8.0),
+    REAL_CONST(92755.077326374871/8.0),
+    REAL_CONST(92778.346811680414/8.0),
+    REAL_CONST(92801.617756116568/8.0),
+    REAL_CONST(92824.890159500384/8.0),
+    REAL_CONST(92848.164021648947/8.0),
+    REAL_CONST(92871.439342379424/8.0),
+    REAL_CONST(92894.716121509016/8.0),
+    REAL_CONST(92917.994358855023/8.0),
+    REAL_CONST(92941.274054234746/8.0),
+    REAL_CONST(92964.555207465572/8.0),
+    REAL_CONST(92987.837818364962/8.0),
+    REAL_CONST(93011.121886750407/8.0),
+    REAL_CONST(93034.407412439468/8.0),
+    REAL_CONST(93057.694395249753/8.0),
+    REAL_CONST(93080.982834998955/8.0),
+    REAL_CONST(93104.272731504767/8.0),
+    REAL_CONST(93127.564084584999/8.0),
+    REAL_CONST(93150.856894057491/8.0),
+    REAL_CONST(93174.15115974014/8.0),
+    REAL_CONST(93197.446881450916/8.0),
+    REAL_CONST(93220.744059007804/8.0),
+    REAL_CONST(93244.04269222889/8.0),
+    REAL_CONST(93267.342780932304/8.0),
+    REAL_CONST(93290.644324936235/8.0),
+    REAL_CONST(93313.947324058914/8.0),
+    REAL_CONST(93337.251778118633/8.0),
+    REAL_CONST(93360.557686933767/8.0),
+    REAL_CONST(93383.865050322696/8.0),
+    REAL_CONST(93407.173868103928/8.0),
+    REAL_CONST(93430.484140095941/8.0),
+    REAL_CONST(93453.795866117362/8.0),
+    REAL_CONST(93477.109045986799/8.0),
+    REAL_CONST(93500.423679522952/8.0),
+    REAL_CONST(93523.739766544561/8.0),
+    REAL_CONST(93547.057306870454/8.0),
+    REAL_CONST(93570.376300319491/8.0),
+    REAL_CONST(93593.696746710571/8.0),
+    REAL_CONST(93617.018645862699/8.0),
+    REAL_CONST(93640.341997594893/8.0),
+    REAL_CONST(93663.666801726242/8.0),
+    REAL_CONST(93686.993058075881/8.0),
+    REAL_CONST(93710.320766463032/8.0),
+    REAL_CONST(93733.64992670693/8.0),
+    REAL_CONST(93756.980538626914/8.0),
+    REAL_CONST(93780.312602042337/8.0),
+    REAL_CONST(93803.646116772637/8.0),
+    REAL_CONST(93826.981082637285/8.0),
+    REAL_CONST(93850.317499455836/8.0),
+    REAL_CONST(93873.655367047861/8.0),
+    REAL_CONST(93896.994685233032/8.0),
+    REAL_CONST(93920.335453831038/8.0),
+    REAL_CONST(93943.677672661666/8.0),
+    REAL_CONST(93967.021341544707/8.0),
+    REAL_CONST(93990.366460300051/8.0),
+    REAL_CONST(94013.713028747632/8.0),
+    REAL_CONST(94037.061046707429/8.0),
+    REAL_CONST(94060.410513999494/8.0),
+    REAL_CONST(94083.761430443905/8.0),
+    REAL_CONST(94107.113795860845/8.0),
+    REAL_CONST(94130.467610070496/8.0),
+    REAL_CONST(94153.822872893157/8.0),
+    REAL_CONST(94177.179584149111/8.0),
+    REAL_CONST(94200.537743658759/8.0),
+    REAL_CONST(94223.897351242529/8.0),
+    REAL_CONST(94247.25840672091/8.0),
+    REAL_CONST(94270.620909914433/8.0),
+    REAL_CONST(94293.98486064373/8.0),
+    REAL_CONST(94317.350258729421/8.0),
+    REAL_CONST(94340.71710399224/8.0),
+    REAL_CONST(94364.085396252936/8.0),
+    REAL_CONST(94387.455135332348/8.0),
+    REAL_CONST(94410.82632105134/8.0),
+    REAL_CONST(94434.198953230851/8.0),
+    REAL_CONST(94457.573031691878/8.0),
+    REAL_CONST(94480.948556255447/8.0),
+    REAL_CONST(94504.325526742658/8.0),
+    REAL_CONST(94527.70394297468/8.0),
+    REAL_CONST(94551.083804772716/8.0),
+    REAL_CONST(94574.465111958023/8.0),
+    REAL_CONST(94597.847864351934/8.0),
+    REAL_CONST(94621.232061775823/8.0),
+    REAL_CONST(94644.617704051096/8.0),
+    REAL_CONST(94668.004790999272/8.0),
+    REAL_CONST(94691.393322441872/8.0),
+    REAL_CONST(94714.783298200506/8.0),
+    REAL_CONST(94738.174718096794/8.0),
+    REAL_CONST(94761.567581952477/8.0),
+    REAL_CONST(94784.961889589307/8.0),
+    REAL_CONST(94808.357640829097/8.0),
+    REAL_CONST(94831.754835493703/8.0),
+    REAL_CONST(94855.153473405066/8.0),
+    REAL_CONST(94878.553554385173/8.0),
+    REAL_CONST(94901.955078256055/8.0),
+    REAL_CONST(94925.358044839784/8.0),
+    REAL_CONST(94948.762453958523/8.0),
+    REAL_CONST(94972.168305434476/8.0),
+    REAL_CONST(94995.575599089891/8.0),
+    REAL_CONST(95018.984334747074/8.0),
+    REAL_CONST(95042.394512228391/8.0),
+    REAL_CONST(95065.806131356265/8.0),
+    REAL_CONST(95089.219191953176/8.0),
+    REAL_CONST(95112.633693841635/8.0),
+    REAL_CONST(95136.04963684424/8.0),
+    REAL_CONST(95159.467020783617/8.0),
+    REAL_CONST(95182.885845482466/8.0),
+    REAL_CONST(95206.306110763529/8.0),
+    REAL_CONST(95229.727816449609/8.0),
+    REAL_CONST(95253.150962363579/8.0),
+    REAL_CONST(95276.575548328314/8.0),
+    REAL_CONST(95300.001574166803/8.0),
+    REAL_CONST(95323.429039702052/8.0),
+    REAL_CONST(95346.857944757154/8.0),
+    REAL_CONST(95370.288289155214/8.0),
+    REAL_CONST(95393.720072719429/8.0),
+    REAL_CONST(95417.153295273019/8.0),
+    REAL_CONST(95440.587956639298/8.0),
+    REAL_CONST(95464.024056641589/8.0),
+    REAL_CONST(95487.461595103305/8.0),
+    REAL_CONST(95510.900571847902/8.0),
+    REAL_CONST(95534.340986698866/8.0),
+    REAL_CONST(95557.782839479783/8.0),
+    REAL_CONST(95581.226130014256/8.0),
+    REAL_CONST(95604.670858125959/8.0),
+    REAL_CONST(95628.117023638595/8.0),
+    REAL_CONST(95651.564626375985/8.0),
+    REAL_CONST(95675.013666161918/8.0),
+    REAL_CONST(95698.464142820303/8.0),
+    REAL_CONST(95721.916056175076/8.0),
+    REAL_CONST(95745.369406050231/8.0),
+    REAL_CONST(95768.824192269807/8.0),
+    REAL_CONST(95792.280414657915/8.0),
+    REAL_CONST(95815.738073038709/8.0),
+    REAL_CONST(95839.197167236387/8.0),
+    REAL_CONST(95862.657697075221/8.0),
+    REAL_CONST(95886.11966237954/8.0),
+    REAL_CONST(95909.583062973688/8.0),
+    REAL_CONST(95933.047898682111/8.0),
+    REAL_CONST(95956.514169329268/8.0),
+    REAL_CONST(95979.981874739708/8.0),
+    REAL_CONST(96003.451014738006/8.0),
+    REAL_CONST(96026.921589148798/8.0),
+    REAL_CONST(96050.393597796792/8.0),
+    REAL_CONST(96073.867040506724/8.0),
+    REAL_CONST(96097.341917103375/8.0),
+    REAL_CONST(96120.818227411626/8.0),
+    REAL_CONST(96144.295971256375/8.0),
+    REAL_CONST(96167.775148462577/8.0),
+    REAL_CONST(96191.255758855244/8.0),
+    REAL_CONST(96214.737802259449/8.0),
+    REAL_CONST(96238.221278500292/8.0),
+    REAL_CONST(96261.70618740299/8.0),
+    REAL_CONST(96285.192528792715/8.0),
+    REAL_CONST(96308.680302494788/8.0),
+    REAL_CONST(96332.169508334526/8.0),
+    REAL_CONST(96355.660146137321/8.0),
+    REAL_CONST(96379.152215728609/8.0),
+    REAL_CONST(96402.645716933868/8.0),
+    REAL_CONST(96426.14064957868/8.0),
+    REAL_CONST(96449.637013488609/8.0),
+    REAL_CONST(96473.134808489311/8.0),
+    REAL_CONST(96496.63403440651/8.0),
+    REAL_CONST(96520.134691065963/8.0),
+    REAL_CONST(96543.636778293469/8.0),
+    REAL_CONST(96567.140295914898/8.0),
+    REAL_CONST(96590.645243756153/8.0),
+    REAL_CONST(96614.151621643221/8.0),
+    REAL_CONST(96637.659429402134/8.0),
+    REAL_CONST(96661.168666858954/8.0),
+    REAL_CONST(96684.679333839798/8.0),
+    REAL_CONST(96708.191430170875/8.0),
+    REAL_CONST(96731.70495567839/8.0),
+    REAL_CONST(96755.219910188665/8.0),
+    REAL_CONST(96778.736293528011/8.0),
+    REAL_CONST(96802.254105522836/8.0),
+    REAL_CONST(96825.77334599958/8.0),
+    REAL_CONST(96849.29401478474/8.0),
+    REAL_CONST(96872.816111704873/8.0),
+    REAL_CONST(96896.339636586577/8.0),
+    REAL_CONST(96919.864589256511/8.0),
+    REAL_CONST(96943.390969541389/8.0),
+    REAL_CONST(96966.918777267958/8.0),
+    REAL_CONST(96990.448012263048/8.0),
+    REAL_CONST(97013.978674353522/8.0),
+    REAL_CONST(97037.510763366285/8.0),
+    REAL_CONST(97061.044279128328/8.0),
+    REAL_CONST(97084.579221466673/8.0),
+    REAL_CONST(97108.115590208385/8.0),
+    REAL_CONST(97131.653385180587/8.0),
+    REAL_CONST(97155.19260621049/8.0),
+    REAL_CONST(97178.733253125291/8.0),
+    REAL_CONST(97202.2753257523/8.0),
+    REAL_CONST(97225.81882391886/8.0),
+    REAL_CONST(97249.363747452342/8.0),
+    REAL_CONST(97272.910096180189/8.0),
+    REAL_CONST(97296.457869929916/8.0),
+    REAL_CONST(97320.007068529041/8.0),
+    REAL_CONST(97343.557691805196/8.0),
+    REAL_CONST(97367.109739586012/8.0),
+    REAL_CONST(97390.663211699197/8.0),
+    REAL_CONST(97414.218107972498/8.0),
+    REAL_CONST(97437.774428233737/8.0),
+    REAL_CONST(97461.332172310766/8.0),
+    REAL_CONST(97484.891340031507/8.0),
+    REAL_CONST(97508.451931223899/8.0),
+    REAL_CONST(97532.013945715982/8.0),
+    REAL_CONST(97555.577383335811/8.0),
+    REAL_CONST(97579.142243911512/8.0),
+    REAL_CONST(97602.708527271257/8.0),
+    REAL_CONST(97626.276233243261/8.0),
+    REAL_CONST(97649.845361655811/8.0),
+    REAL_CONST(97673.415912337223/8.0),
+    REAL_CONST(97696.987885115886/8.0),
+    REAL_CONST(97720.561279820206/8.0),
+    REAL_CONST(97744.1360962787/8.0),
+    REAL_CONST(97767.712334319876/8.0),
+    REAL_CONST(97791.289993772341/8.0),
+    REAL_CONST(97814.869074464703/8.0),
+    REAL_CONST(97838.449576225685/8.0),
+    REAL_CONST(97862.031498883996/8.0),
+    REAL_CONST(97885.614842268449/8.0),
+    REAL_CONST(97909.199606207883/8.0),
+    REAL_CONST(97932.785790531183/8.0),
+    REAL_CONST(97956.37339506732/8.0),
+    REAL_CONST(97979.962419645264/8.0),
+    REAL_CONST(98003.552864094076/8.0),
+    REAL_CONST(98027.144728242856/8.0),
+    REAL_CONST(98050.738011920766/8.0),
+    REAL_CONST(98074.332714956996/8.0),
+    REAL_CONST(98097.928837180807/8.0),
+    REAL_CONST(98121.526378421506/8.0),
+    REAL_CONST(98145.125338508456/8.0),
+    REAL_CONST(98168.725717271067/8.0),
+    REAL_CONST(98192.327514538789/8.0),
+    REAL_CONST(98215.930730141132/8.0),
+    REAL_CONST(98239.535363907664/8.0),
+    REAL_CONST(98263.141415668011/8.0),
+    REAL_CONST(98286.748885251814/8.0),
+    REAL_CONST(98310.357772488816/8.0),
+    REAL_CONST(98333.968077208759/8.0),
+    REAL_CONST(98357.579799241488/8.0),
+    REAL_CONST(98381.192938416847/8.0),
+    REAL_CONST(98404.807494564782/8.0),
+    REAL_CONST(98428.42346751524/8.0),
+    REAL_CONST(98452.040857098269/8.0),
+    REAL_CONST(98475.659663143917/8.0),
+    REAL_CONST(98499.27988548232/8.0),
+    REAL_CONST(98522.901523943656/8.0),
+    REAL_CONST(98546.524578358163/8.0),
+    REAL_CONST(98570.149048556093/8.0),
+    REAL_CONST(98593.774934367786/8.0),
+    REAL_CONST(98617.402235623624/8.0),
+    REAL_CONST(98641.030952154048/8.0),
+    REAL_CONST(98664.661083789513/8.0),
+    REAL_CONST(98688.292630360564/8.0),
+    REAL_CONST(98711.925591697771/8.0),
+    REAL_CONST(98735.559967631794/8.0),
+    REAL_CONST(98759.195757993293/8.0),
+    REAL_CONST(98782.832962613014/8.0),
+    REAL_CONST(98806.471581321734/8.0),
+    REAL_CONST(98830.111613950285/8.0),
+    REAL_CONST(98853.753060329575/8.0),
+    REAL_CONST(98877.39592029051/8.0),
+    REAL_CONST(98901.040193664099/8.0),
+    REAL_CONST(98924.68588028138/8.0),
+    REAL_CONST(98948.33297997342/8.0),
+    REAL_CONST(98971.981492571387/8.0),
+    REAL_CONST(98995.63141790645/8.0),
+    REAL_CONST(99019.282755809851/8.0),
+    REAL_CONST(99042.935506112874/8.0),
+    REAL_CONST(99066.589668646877/8.0),
+    REAL_CONST(99090.245243243233/8.0),
+    REAL_CONST(99113.902229733401/8.0),
+    REAL_CONST(99137.560627948857/8.0),
+    REAL_CONST(99161.220437721131/8.0),
+    REAL_CONST(99184.881658881859/8.0),
+    REAL_CONST(99208.544291262631/8.0),
+    REAL_CONST(99232.208334695169/8.0),
+    REAL_CONST(99255.87378901121/8.0),
+    REAL_CONST(99279.540654042547/8.0),
+    REAL_CONST(99303.208929621018/8.0),
+    REAL_CONST(99326.878615578535/8.0),
+    REAL_CONST(99350.549711746993/8.0),
+    REAL_CONST(99374.222217958435/8.0),
+    REAL_CONST(99397.896134044888/8.0),
+    REAL_CONST(99421.571459838422/8.0),
+    REAL_CONST(99445.248195171211/8.0),
+    REAL_CONST(99468.926339875441/8.0),
+    REAL_CONST(99492.605893783344/8.0),
+    REAL_CONST(99516.286856727209/8.0),
+    REAL_CONST(99539.969228539398/8.0),
+    REAL_CONST(99563.653009052287/8.0),
+    REAL_CONST(99587.338198098325/8.0),
+    REAL_CONST(99611.024795510006/8.0),
+    REAL_CONST(99634.712801119866/8.0),
+    REAL_CONST(99658.402214760499/8.0),
+    REAL_CONST(99682.093036264545/8.0),
+    REAL_CONST(99705.785265464699/8.0),
+    REAL_CONST(99729.478902193689/8.0),
+    REAL_CONST(99753.173946284325/8.0),
+    REAL_CONST(99776.870397569437/8.0),
+    REAL_CONST(99800.56825588191/8.0),
+    REAL_CONST(99824.267521054688/8.0),
+    REAL_CONST(99847.968192920773/8.0),
+    REAL_CONST(99871.670271313182/8.0),
+    REAL_CONST(99895.373756065004/8.0),
+    REAL_CONST(99919.078647009388/8.0),
+    REAL_CONST(99942.78494397951/8.0),
+    REAL_CONST(99966.492646808634/8.0),
+    REAL_CONST(99990.20175533001/8.0),
+    REAL_CONST(100013.91226937699/8.0),
+    REAL_CONST(100037.62418878295/8.0),
+    REAL_CONST(100061.33751338134/8.0),
+    REAL_CONST(100085.05224300563/8.0),
+    REAL_CONST(100108.76837748935/8.0),
+    REAL_CONST(100132.4859166661/8.0),
+    REAL_CONST(100156.2048603695/8.0),
+    REAL_CONST(100179.92520843323/8.0),
+    REAL_CONST(100203.64696069101/8.0),
+    REAL_CONST(100227.37011697664/8.0),
+    REAL_CONST(100251.09467712394/8.0),
+    REAL_CONST(100274.82064096678/8.0),
+    REAL_CONST(100298.54800833909/8.0),
+    REAL_CONST(100322.27677907483/8.0),
+    REAL_CONST(100346.00695300807/8.0),
+    REAL_CONST(100369.73852997283/8.0),
+    REAL_CONST(100393.47150980328/8.0),
+    REAL_CONST(100417.20589233354/8.0),
+    REAL_CONST(100440.94167739789/8.0),
+    REAL_CONST(100464.67886483055/8.0),
+    REAL_CONST(100488.41745446586/8.0),
+    REAL_CONST(100512.1574461382/8.0),
+    REAL_CONST(100535.89883968196/8.0),
+    REAL_CONST(100559.64163493161/8.0),
+    REAL_CONST(100583.38583172169/8.0),
+    REAL_CONST(100607.13142988674/8.0),
+    REAL_CONST(100630.87842926137/8.0),
+    REAL_CONST(100654.62682968024/8.0),
+    REAL_CONST(100678.37663097809/8.0),
+    REAL_CONST(100702.12783298964/8.0),
+    REAL_CONST(100725.88043554971/8.0),
+    REAL_CONST(100749.63443849317/8.0),
+    REAL_CONST(100773.38984165489/8.0),
+    REAL_CONST(100797.14664486986/8.0),
+    REAL_CONST(100820.90484797307/8.0),
+    REAL_CONST(100844.66445079957/8.0),
+    REAL_CONST(100868.42545318443/8.0),
+    REAL_CONST(100892.18785496285/8.0),
+    REAL_CONST(100915.95165596998/8.0),
+    REAL_CONST(100939.71685604109/8.0),
+    REAL_CONST(100963.48345501146/8.0),
+    REAL_CONST(100987.25145271645/8.0),
+    REAL_CONST(101011.02084899142/8.0),
+    REAL_CONST(101034.79164367182/8.0),
+    REAL_CONST(101058.56383659317/8.0),
+    REAL_CONST(101082.33742759094/8.0),
+    REAL_CONST(101106.11241650078/8.0),
+    REAL_CONST(101129.88880315828/8.0),
+    REAL_CONST(101153.66658739912/8.0),
+    REAL_CONST(101177.44576905905/8.0),
+    REAL_CONST(101201.22634797383/8.0),
+    REAL_CONST(101225.00832397929/8.0),
+    REAL_CONST(101248.7916969113/8.0),
+    REAL_CONST(101272.57646660579/8.0),
+    REAL_CONST(101296.36263289873/8.0),
+    REAL_CONST(101320.15019562612/8.0),
+    REAL_CONST(101343.93915462404/8.0),
+    REAL_CONST(101367.7295097286/8.0),
+    REAL_CONST(101391.52126077596/8.0),
+    REAL_CONST(101415.31440760233/8.0),
+    REAL_CONST(101439.10895004397/8.0),
+    REAL_CONST(101462.9048879372/8.0),
+    REAL_CONST(101486.70222111834/8.0),
+    REAL_CONST(101510.50094942382/8.0),
+    REAL_CONST(101534.30107269008/8.0),
+    REAL_CONST(101558.10259075361/8.0),
+    REAL_CONST(101581.90550345098/8.0),
+    REAL_CONST(101605.70981061876/8.0),
+    REAL_CONST(101629.5155120936/8.0),
+    REAL_CONST(101653.32260771218/8.0),
+    REAL_CONST(101677.13109731126/8.0),
+    REAL_CONST(101700.9409807276/8.0),
+    REAL_CONST(101724.75225779804/8.0),
+    REAL_CONST(101748.56492835947/8.0),
+    REAL_CONST(101772.37899224881/8.0),
+    REAL_CONST(101796.19444930303/8.0),
+    REAL_CONST(101820.01129935916/8.0),
+    REAL_CONST(101843.82954225427/8.0),
+    REAL_CONST(101867.64917782549/8.0),
+    REAL_CONST(101891.47020590997/8.0),
+    REAL_CONST(101915.29262634492/8.0),
+    REAL_CONST(101939.11643896763/8.0),
+    REAL_CONST(101962.94164361537/8.0),
+    REAL_CONST(101986.76824012553/8.0),
+    REAL_CONST(102010.59622833549/8.0),
+    REAL_CONST(102034.42560808272/8.0),
+    REAL_CONST(102058.25637920471/8.0),
+    REAL_CONST(102082.08854153901/8.0),
+    REAL_CONST(102105.9220949232/8.0),
+    REAL_CONST(102129.75703919494/8.0),
+    REAL_CONST(102153.59337419191/8.0),
+    REAL_CONST(102177.43109975185/8.0),
+    REAL_CONST(102201.27021571253/8.0),
+    REAL_CONST(102225.1107219118/8.0),
+    REAL_CONST(102248.95261818753/8.0),
+    REAL_CONST(102272.79590437764/8.0),
+    REAL_CONST(102296.64058032009/8.0),
+    REAL_CONST(102320.48664585294/8.0),
+    REAL_CONST(102344.33410081422/8.0),
+    REAL_CONST(102368.18294504205/8.0),
+    REAL_CONST(102392.03317837461/8.0),
+    REAL_CONST(102415.88480065008/8.0),
+    REAL_CONST(102439.73781170673/8.0),
+    REAL_CONST(102463.59221138287/8.0),
+    REAL_CONST(102487.44799951684/8.0),
+    REAL_CONST(102511.30517594704/8.0),
+    REAL_CONST(102535.1637405119/8.0),
+    REAL_CONST(102559.02369304992/8.0),
+    REAL_CONST(102582.88503339965/8.0),
+    REAL_CONST(102606.74776139967/8.0),
+    REAL_CONST(102630.61187688859/8.0),
+    REAL_CONST(102654.4773797051/8.0),
+    REAL_CONST(102678.34426968795/8.0),
+    REAL_CONST(102702.21254667587/8.0),
+    REAL_CONST(102726.08221050771/8.0),
+    REAL_CONST(102749.95326102231/8.0),
+    REAL_CONST(102773.8256980586/8.0),
+    REAL_CONST(102797.69952145554/8.0),
+    REAL_CONST(102821.57473105213/8.0),
+    REAL_CONST(102845.45132668741/8.0),
+    REAL_CONST(102869.32930820051/8.0),
+    REAL_CONST(102893.20867543056/8.0),
+    REAL_CONST(102917.08942821674/8.0),
+    REAL_CONST(102940.97156639832/8.0),
+    REAL_CONST(102964.85508981455/8.0),
+    REAL_CONST(102988.73999830478/8.0),
+    REAL_CONST(103012.6262917084/8.0),
+    REAL_CONST(103036.51396986481/8.0),
+    REAL_CONST(103060.40303261351/8.0),
+    REAL_CONST(103084.293479794/8.0),
+    REAL_CONST(103108.18531124585/8.0),
+    REAL_CONST(103132.07852680866/8.0),
+    REAL_CONST(103155.97312632212/8.0),
+    REAL_CONST(103179.8691096259/8.0),
+    REAL_CONST(103203.76647655977/8.0),
+    REAL_CONST(103227.66522696352/8.0),
+    REAL_CONST(103251.56536067701/8.0),
+    REAL_CONST(103275.46687754011/8.0),
+    REAL_CONST(103299.36977739276/8.0),
+    REAL_CONST(103323.27406007495/8.0),
+    REAL_CONST(103347.1797254267/8.0),
+    REAL_CONST(103371.0867732881/8.0),
+    REAL_CONST(103394.99520349925/8.0),
+    REAL_CONST(103418.90501590034/8.0),
+    REAL_CONST(103442.81621033157/8.0),
+    REAL_CONST(103466.72878663319/8.0),
+    REAL_CONST(103490.64274464553/8.0),
+    REAL_CONST(103514.55808420894/8.0),
+    REAL_CONST(103538.4748051638/8.0),
+    REAL_CONST(103562.39290735057/8.0),
+    REAL_CONST(103586.31239060973/8.0),
+    REAL_CONST(103610.23325478184/8.0),
+    REAL_CONST(103634.15549970744/8.0),
+    REAL_CONST(103658.07912522719/8.0),
+    REAL_CONST(103682.00413118176/8.0),
+    REAL_CONST(103705.93051741188/8.0),
+    REAL_CONST(103729.85828375829/8.0),
+    REAL_CONST(103753.78743006183/8.0),
+    REAL_CONST(103777.71795616332/8.0),
+    REAL_CONST(103801.64986190372/8.0),
+    REAL_CONST(103825.58314712394/8.0),
+    REAL_CONST(103849.51781166498/8.0),
+    REAL_CONST(103873.4538553679/8.0),
+    REAL_CONST(103897.39127807376/8.0),
+    REAL_CONST(103921.33007962372/8.0),
+    REAL_CONST(103945.27025985894/8.0),
+    REAL_CONST(103969.21181862066/8.0),
+    REAL_CONST(103993.15475575015/8.0),
+    REAL_CONST(104017.0990710887/8.0),
+    REAL_CONST(104041.0447644777/8.0),
+    REAL_CONST(104064.99183575854/8.0),
+    REAL_CONST(104088.94028477269/8.0),
+    REAL_CONST(104112.89011136163/8.0),
+    REAL_CONST(104136.84131536692/8.0),
+    REAL_CONST(104160.79389663014/8.0),
+    REAL_CONST(104184.74785499295/8.0),
+    REAL_CONST(104208.70319029699/8.0),
+    REAL_CONST(104232.65990238401/8.0),
+    REAL_CONST(104256.61799109577/8.0),
+    REAL_CONST(104280.57745627411/8.0),
+    REAL_CONST(104304.53829776087/8.0),
+    REAL_CONST(104328.50051539797/8.0),
+    REAL_CONST(104352.46410902737/8.0),
+    REAL_CONST(104376.42907849104/8.0),
+    REAL_CONST(104400.39542363105/8.0),
+    REAL_CONST(104424.36314428948/8.0),
+    REAL_CONST(104448.33224030846/8.0),
+    REAL_CONST(104472.3027115302/8.0),
+    REAL_CONST(104496.27455779689/8.0),
+    REAL_CONST(104520.24777895081/8.0),
+    REAL_CONST(104544.22237483428/8.0),
+    REAL_CONST(104568.19834528965/8.0),
+    REAL_CONST(104592.17569015936/8.0),
+    REAL_CONST(104616.15440928582/8.0),
+    REAL_CONST(104640.13450251156/8.0),
+    REAL_CONST(104664.1159696791/8.0),
+    REAL_CONST(104688.09881063103/8.0),
+    REAL_CONST(104712.08302520998/8.0),
+    REAL_CONST(104736.06861325864/8.0),
+    REAL_CONST(104760.05557461972/8.0),
+    REAL_CONST(104784.043909136/8.0),
+    REAL_CONST(104808.03361665027/8.0),
+    REAL_CONST(104832.0246970054/8.0),
+    REAL_CONST(104856.01715004431/8.0),
+    REAL_CONST(104880.01097560991/8.0),
+    REAL_CONST(104904.00617354522/8.0),
+    REAL_CONST(104928.00274369326/8.0),
+    REAL_CONST(104952.00068589712/8.0),
+    REAL_CONST(104975.99999999993/8.0),
+    REAL_CONST(105000.00068584486/8.0),
+    REAL_CONST(105024.00274327511/8.0),
+    REAL_CONST(105048.00617213396/8.0),
+    REAL_CONST(105072.0109722647/8.0),
+    REAL_CONST(105096.0171435107/8.0),
+    REAL_CONST(105120.02468571534/8.0),
+    REAL_CONST(105144.03359872208/8.0),
+    REAL_CONST(105168.04388237436/8.0),
+    REAL_CONST(105192.05553651576/8.0),
+    REAL_CONST(105216.06856098982/8.0),
+    REAL_CONST(105240.08295564017/8.0),
+    REAL_CONST(105264.09872031047/8.0),
+    REAL_CONST(105288.11585484444/8.0),
+    REAL_CONST(105312.13435908582/8.0),
+    REAL_CONST(105336.1542328784/8.0),
+    REAL_CONST(105360.17547606604/8.0),
+    REAL_CONST(105384.19808849262/8.0),
+    REAL_CONST(105408.22207000206/8.0),
+    REAL_CONST(105432.24742043833/8.0),
+    REAL_CONST(105456.27413964548/8.0),
+    REAL_CONST(105480.30222746753/8.0),
+    REAL_CONST(105504.33168374863/8.0),
+    REAL_CONST(105528.36250833291/8.0),
+    REAL_CONST(105552.39470106458/8.0),
+    REAL_CONST(105576.42826178786/8.0),
+    REAL_CONST(105600.46319034706/8.0),
+    REAL_CONST(105624.49948658649/8.0),
+    REAL_CONST(105648.53715035053/8.0),
+    REAL_CONST(105672.5761814836/8.0),
+    REAL_CONST(105696.61657983017/8.0),
+    REAL_CONST(105720.65834523473/8.0),
+    REAL_CONST(105744.70147754184/8.0),
+    REAL_CONST(105768.7459765961/8.0),
+    REAL_CONST(105792.79184224214/8.0),
+    REAL_CONST(105816.83907432464/8.0),
+    REAL_CONST(105840.88767268835/8.0),
+    REAL_CONST(105864.93763717801/8.0),
+    REAL_CONST(105888.98896763846/8.0),
+    REAL_CONST(105913.04166391456/8.0),
+    REAL_CONST(105937.09572585119/8.0),
+    REAL_CONST(105961.15115329332/8.0),
+    REAL_CONST(105985.20794608595/8.0),
+    REAL_CONST(106009.26610407409/8.0),
+    REAL_CONST(106033.32562710284/8.0),
+    REAL_CONST(106057.38651501729/8.0),
+    REAL_CONST(106081.44876766266/8.0),
+    REAL_CONST(106105.51238488412/8.0),
+    REAL_CONST(106129.57736652695/8.0),
+    REAL_CONST(106153.64371243643/8.0),
+    REAL_CONST(106177.71142245791/8.0),
+    REAL_CONST(106201.78049643678/8.0),
+    REAL_CONST(106225.85093421848/8.0),
+    REAL_CONST(106249.92273564848/8.0),
+    REAL_CONST(106273.99590057228/8.0),
+    REAL_CONST(106298.07042883546/8.0),
+    REAL_CONST(106322.14632028362/8.0),
+    REAL_CONST(106346.22357476239/8.0),
+    REAL_CONST(106370.30219211751/8.0),
+    REAL_CONST(106394.38217219469/8.0),
+    REAL_CONST(106418.46351483969/8.0),
+    REAL_CONST(106442.54621989837/8.0),
+    REAL_CONST(106466.63028721658/8.0),
+    REAL_CONST(106490.71571664025/8.0),
+    REAL_CONST(106514.80250801529/8.0),
+    REAL_CONST(106538.89066118775/8.0),
+    REAL_CONST(106562.98017600364/8.0),
+    REAL_CONST(106587.07105230905/8.0),
+    REAL_CONST(106611.16328995011/8.0),
+    REAL_CONST(106635.25688877302/8.0),
+    REAL_CONST(106659.35184862395/8.0),
+    REAL_CONST(106683.44816934918/8.0),
+    REAL_CONST(106707.54585079502/8.0),
+    REAL_CONST(106731.64489280782/8.0),
+    REAL_CONST(106755.74529523395/8.0),
+    REAL_CONST(106779.84705791986/8.0),
+    REAL_CONST(106803.95018071201/8.0),
+    REAL_CONST(106828.05466345693/8.0),
+    REAL_CONST(106852.16050600118/8.0),
+    REAL_CONST(106876.26770819137/8.0),
+    REAL_CONST(106900.37626987413/8.0),
+    REAL_CONST(106924.48619089619/8.0),
+    REAL_CONST(106948.59747110425/8.0),
+    REAL_CONST(106972.71011034511/8.0),
+    REAL_CONST(106996.82410846559/8.0),
+    REAL_CONST(107020.93946531253/8.0),
+    REAL_CONST(107045.05618073288/8.0),
+    REAL_CONST(107069.17425457356/8.0),
+    REAL_CONST(107093.29368668159/8.0),
+    REAL_CONST(107117.41447690397/8.0),
+    REAL_CONST(107141.53662508781/8.0),
+    REAL_CONST(107165.66013108024/8.0),
+    REAL_CONST(107189.7849947284/8.0),
+    REAL_CONST(107213.91121587952/8.0),
+    REAL_CONST(107238.03879438085/8.0),
+    REAL_CONST(107262.16773007967/8.0),
+    REAL_CONST(107286.29802282334/8.0),
+    REAL_CONST(107310.42967245923/8.0),
+    REAL_CONST(107334.56267883476/8.0),
+    REAL_CONST(107358.69704179741/8.0),
+    REAL_CONST(107382.83276119467/8.0),
+    REAL_CONST(107406.96983687414/8.0),
+    REAL_CONST(107431.10826868335/8.0),
+    REAL_CONST(107455.24805646999/8.0),
+    REAL_CONST(107479.38920008171/8.0),
+    REAL_CONST(107503.53169936626/8.0),
+    REAL_CONST(107527.67555417139/8.0),
+    REAL_CONST(107551.82076434491/8.0),
+    REAL_CONST(107575.96732973469/8.0),
+    REAL_CONST(107600.11525018861/8.0),
+    REAL_CONST(107624.26452555459/8.0),
+    REAL_CONST(107648.41515568066/8.0),
+    REAL_CONST(107672.56714041479/8.0),
+    REAL_CONST(107696.72047960508/8.0),
+    REAL_CONST(107720.87517309963/8.0),
+    REAL_CONST(107745.03122074658/8.0),
+    REAL_CONST(107769.18862239413/8.0),
+    REAL_CONST(107793.34737789053/8.0),
+    REAL_CONST(107817.50748708403/8.0),
+    REAL_CONST(107841.66894982298/8.0),
+    REAL_CONST(107865.83176595572/8.0),
+    REAL_CONST(107889.99593533068/8.0),
+    REAL_CONST(107914.16145779629/8.0),
+    REAL_CONST(107938.32833320105/8.0),
+    REAL_CONST(107962.49656139348/8.0),
+    REAL_CONST(107986.66614222217/8.0),
+    REAL_CONST(108010.83707553572/8.0),
+    REAL_CONST(108035.00936118282/8.0),
+    REAL_CONST(108059.18299901215/8.0),
+    REAL_CONST(108083.35798887245/8.0),
+    REAL_CONST(108107.53433061253/8.0),
+    REAL_CONST(108131.71202408121/8.0),
+    REAL_CONST(108155.89106912735/8.0),
+    REAL_CONST(108180.07146559987/8.0),
+    REAL_CONST(108204.25321334775/8.0),
+    REAL_CONST(108228.43631221994/8.0),
+    REAL_CONST(108252.62076206553/8.0),
+    REAL_CONST(108276.80656273357/8.0),
+    REAL_CONST(108300.99371407321/8.0),
+    REAL_CONST(108325.18221593359/8.0),
+    REAL_CONST(108349.37206816394/8.0),
+    REAL_CONST(108373.56327061349/8.0),
+    REAL_CONST(108397.75582313156/8.0),
+    REAL_CONST(108421.94972556747/8.0),
+    REAL_CONST(108446.1449777706/8.0),
+    REAL_CONST(108470.34157959036/8.0),
+    REAL_CONST(108494.53953087622/8.0),
+    REAL_CONST(108518.73883147769/8.0),
+    REAL_CONST(108542.93948124432/8.0),
+    REAL_CONST(108567.14148002568/8.0),
+    REAL_CONST(108591.34482767139/8.0),
+    REAL_CONST(108615.54952403114/8.0),
+    REAL_CONST(108639.75556895464/8.0),
+    REAL_CONST(108663.96296229165/8.0),
+    REAL_CONST(108688.17170389196/8.0),
+    REAL_CONST(108712.38179360541/8.0),
+    REAL_CONST(108736.59323128188/8.0),
+    REAL_CONST(108760.80601677128/8.0),
+    REAL_CONST(108785.02014992358/8.0),
+    REAL_CONST(108809.23563058881/8.0),
+    REAL_CONST(108833.45245861699/8.0),
+    REAL_CONST(108857.67063385822/8.0),
+    REAL_CONST(108881.89015616261/8.0),
+    REAL_CONST(108906.11102538036/8.0),
+    REAL_CONST(108930.33324136167/8.0),
+    REAL_CONST(108954.55680395682/8.0),
+    REAL_CONST(108978.78171301607/8.0),
+    REAL_CONST(109003.00796838976/8.0),
+    REAL_CONST(109027.23556992831/8.0),
+    REAL_CONST(109051.46451748211/8.0),
+    REAL_CONST(109075.69481090162/8.0),
+    REAL_CONST(109099.92645003737/8.0),
+    REAL_CONST(109124.15943473989/8.0),
+    REAL_CONST(109148.39376485976/8.0),
+    REAL_CONST(109172.62944024763/8.0),
+    REAL_CONST(109196.86646075416/8.0),
+    REAL_CONST(109221.10482623006/8.0),
+    REAL_CONST(109245.34453652608/8.0),
+    REAL_CONST(109269.58559149304/8.0),
+    REAL_CONST(109293.82799098175/8.0),
+    REAL_CONST(109318.07173484311/8.0),
+    REAL_CONST(109342.31682292801/8.0),
+    REAL_CONST(109366.56325508743/8.0),
+    REAL_CONST(109390.81103117237/8.0),
+    REAL_CONST(109415.06015103387/8.0),
+    REAL_CONST(109439.31061452301/8.0),
+    REAL_CONST(109463.56242149093/8.0),
+    REAL_CONST(109487.8155717888/8.0),
+    REAL_CONST(109512.07006526781/8.0),
+    REAL_CONST(109536.3259017792/8.0),
+    REAL_CONST(109560.58308117429/8.0),
+    REAL_CONST(109584.8416033044/8.0),
+    REAL_CONST(109609.1014680209/8.0),
+    REAL_CONST(109633.36267517522/8.0),
+    REAL_CONST(109657.62522461878/8.0),
+    REAL_CONST(109681.88911620311/8.0),
+    REAL_CONST(109706.15434977971/8.0),
+    REAL_CONST(109730.4209252002/8.0),
+    REAL_CONST(109754.68884231619/8.0),
+    REAL_CONST(109778.95810097932/8.0),
+    REAL_CONST(109803.22870104131/8.0),
+    REAL_CONST(109827.50064235389/8.0),
+    REAL_CONST(109851.77392476884/8.0),
+    REAL_CONST(109876.04854813802/8.0),
+    REAL_CONST(109900.32451231324/8.0),
+    REAL_CONST(109924.60181714644/8.0),
+    REAL_CONST(109948.88046248957/8.0),
+    REAL_CONST(109973.1604481946/8.0),
+    REAL_CONST(109997.44177411357/8.0),
+    REAL_CONST(110021.72444009855/8.0),
+    REAL_CONST(110046.00844600165/8.0),
+    REAL_CONST(110070.29379167501/8.0),
+    REAL_CONST(110094.58047697082/8.0),
+    REAL_CONST(110118.86850174134/8.0),
+    REAL_CONST(110143.15786583882/8.0),
+    REAL_CONST(110167.44856911557/8.0),
+    REAL_CONST(110191.74061142397/8.0),
+    REAL_CONST(110216.03399261639/8.0),
+    REAL_CONST(110240.32871254528/8.0),
+    REAL_CONST(110264.62477106311/8.0),
+    REAL_CONST(110288.9221680224/8.0),
+    REAL_CONST(110313.22090327571/8.0),
+    REAL_CONST(110337.52097667565/8.0),
+    REAL_CONST(110361.82238807483/8.0),
+    REAL_CONST(110386.12513732594/8.0),
+    REAL_CONST(110410.42922428172/8.0),
+    REAL_CONST(110434.73464879491/8.0),
+    REAL_CONST(110459.04141071832/8.0),
+    REAL_CONST(110483.34950990479/8.0),
+    REAL_CONST(110507.6589462072/8.0),
+    REAL_CONST(110531.96971947847/8.0),
+    REAL_CONST(110556.28182957157/8.0),
+    REAL_CONST(110580.5952763395/8.0),
+    REAL_CONST(110604.91005963532/8.0),
+    REAL_CONST(110629.22617931209/8.0),
+    REAL_CONST(110653.54363522294/8.0),
+    REAL_CONST(110677.86242722106/8.0),
+    REAL_CONST(110702.18255515963/8.0),
+    REAL_CONST(110726.50401889188/8.0),
+    REAL_CONST(110750.82681827113/8.0),
+    REAL_CONST(110775.1509531507/8.0),
+    REAL_CONST(110799.47642338395/8.0),
+    REAL_CONST(110823.80322882428/8.0),
+    REAL_CONST(110848.13136932514/8.0),
+    REAL_CONST(110872.46084474004/8.0),
+    REAL_CONST(110896.79165492248/8.0),
+    REAL_CONST(110921.12379972603/8.0),
+    REAL_CONST(110945.4572790043/8.0),
+    REAL_CONST(110969.79209261097/8.0),
+    REAL_CONST(110994.12824039967/8.0),
+    REAL_CONST(111018.46572222417/8.0),
+    REAL_CONST(111042.80453793822/8.0),
+    REAL_CONST(111067.14468739564/8.0),
+    REAL_CONST(111091.48617045028/8.0),
+    REAL_CONST(111115.82898695602/8.0),
+    REAL_CONST(111140.1731367668/8.0),
+    REAL_CONST(111164.51861973655/8.0),
+    REAL_CONST(111188.86543571933/8.0),
+    REAL_CONST(111213.21358456917/8.0),
+    REAL_CONST(111237.56306614014/8.0),
+    REAL_CONST(111261.91388028639/8.0),
+    REAL_CONST(111286.26602686207/8.0),
+    REAL_CONST(111310.61950572141/8.0),
+    REAL_CONST(111334.97431671864/8.0),
+    REAL_CONST(111359.33045970804/8.0),
+    REAL_CONST(111383.68793454397/8.0),
+    REAL_CONST(111408.04674108078/8.0),
+    REAL_CONST(111432.40687917286/8.0),
+    REAL_CONST(111456.76834867468/8.0),
+    REAL_CONST(111481.13114944073/8.0),
+    REAL_CONST(111505.49528132551/8.0),
+    REAL_CONST(111529.86074418361/8.0),
+    REAL_CONST(111554.22753786964/8.0),
+    REAL_CONST(111578.59566223821/8.0),
+    REAL_CONST(111602.96511714405/8.0),
+    REAL_CONST(111627.33590244185/8.0),
+    REAL_CONST(111651.7080179864/8.0),
+    REAL_CONST(111676.08146363248/8.0),
+    REAL_CONST(111700.45623923496/8.0),
+    REAL_CONST(111724.8323446487/8.0),
+    REAL_CONST(111749.20977972864/8.0),
+    REAL_CONST(111773.58854432974/8.0),
+    REAL_CONST(111797.96863830699/8.0),
+    REAL_CONST(111822.35006151545/8.0),
+    REAL_CONST(111846.73281381019/8.0),
+    REAL_CONST(111871.11689504632/8.0),
+    REAL_CONST(111895.50230507903/8.0),
+    REAL_CONST(111919.8890437635/8.0),
+    REAL_CONST(111944.27711095495/8.0),
+    REAL_CONST(111968.6665065087/8.0),
+    REAL_CONST(111993.05723028004/8.0),
+    REAL_CONST(112017.44928212435/8.0),
+    REAL_CONST(112041.842661897/8.0),
+    REAL_CONST(112066.23736945343/8.0),
+    REAL_CONST(112090.63340464912/8.0),
+    REAL_CONST(112115.03076733962/8.0),
+    REAL_CONST(112139.42945738042/8.0),
+    REAL_CONST(112163.82947462716/8.0),
+    REAL_CONST(112188.23081893545/8.0),
+    REAL_CONST(112212.63349016097/8.0),
+    REAL_CONST(112237.03748815943/8.0),
+    REAL_CONST(112261.44281278658/8.0),
+    REAL_CONST(112285.84946389822/8.0),
+    REAL_CONST(112310.25744135017/8.0),
+    REAL_CONST(112334.66674499828/8.0),
+    REAL_CONST(112359.07737469849/8.0),
+    REAL_CONST(112383.48933030672/8.0),
+    REAL_CONST(112407.90261167898/8.0),
+    REAL_CONST(112432.31721867126/8.0),
+    REAL_CONST(112456.73315113965/8.0),
+    REAL_CONST(112481.15040894024/8.0),
+    REAL_CONST(112505.56899192919/8.0),
+    REAL_CONST(112529.98889996267/8.0),
+    REAL_CONST(112554.41013289688/8.0),
+    REAL_CONST(112578.8326905881/8.0),
+    REAL_CONST(112603.25657289263/8.0),
+    REAL_CONST(112627.68177966679/8.0),
+    REAL_CONST(112652.10831076698/8.0),
+    REAL_CONST(112676.53616604958/8.0),
+    REAL_CONST(112700.96534537108/8.0),
+    REAL_CONST(112725.39584858794/8.0),
+    REAL_CONST(112749.82767555672/8.0),
+    REAL_CONST(112774.26082613398/8.0),
+    REAL_CONST(112798.6953001763/8.0),
+    REAL_CONST(112823.13109754038/8.0),
+    REAL_CONST(112847.56821808286/8.0),
+    REAL_CONST(112872.00666166049/8.0),
+    REAL_CONST(112896.44642813003/8.0),
+    REAL_CONST(112920.88751734827/8.0),
+    REAL_CONST(112945.32992917208/8.0),
+    REAL_CONST(112969.77366345831/8.0),
+    REAL_CONST(112994.21872006389/8.0),
+    REAL_CONST(113018.66509884578/8.0),
+    REAL_CONST(113043.11279966099/8.0),
+    REAL_CONST(113067.56182236652/8.0),
+    REAL_CONST(113092.01216681948/8.0),
+    REAL_CONST(113116.46383287695/8.0),
+    REAL_CONST(113140.9168203961/8.0),
+    REAL_CONST(113165.37112923413/8.0),
+    REAL_CONST(113189.82675924824/8.0),
+    REAL_CONST(113214.28371029573/8.0),
+    REAL_CONST(113238.74198223387/8.0),
+    REAL_CONST(113263.20157492002/8.0),
+    REAL_CONST(113287.66248821157/8.0),
+    REAL_CONST(113312.12472196593/8.0),
+    REAL_CONST(113336.58827604055/8.0),
+    REAL_CONST(113361.05315029295/8.0),
+    REAL_CONST(113385.51934458067/8.0),
+    REAL_CONST(113409.98685876124/8.0),
+    REAL_CONST(113434.45569269233/8.0),
+    REAL_CONST(113458.92584623155/8.0),
+    REAL_CONST(113483.39731923661/8.0),
+    REAL_CONST(113507.87011156522/8.0),
+    REAL_CONST(113532.34422307517/8.0),
+    REAL_CONST(113556.81965362425/8.0),
+    REAL_CONST(113581.2964030703/8.0),
+    REAL_CONST(113605.77447127122/8.0),
+    REAL_CONST(113630.25385808491/8.0),
+    REAL_CONST(113654.73456336933/8.0),
+    REAL_CONST(113679.2165869825/8.0),
+    REAL_CONST(113703.69992878241/8.0),
+    REAL_CONST(113728.18458862718/8.0),
+    REAL_CONST(113752.67056637487/8.0),
+    REAL_CONST(113777.15786188368/8.0),
+    REAL_CONST(113801.64647501177/8.0),
+    REAL_CONST(113826.13640561736/8.0),
+    REAL_CONST(113850.62765355874/8.0),
+    REAL_CONST(113875.12021869418/8.0),
+    REAL_CONST(113899.61410088204/8.0),
+    REAL_CONST(113924.1092999807/8.0),
+    REAL_CONST(113948.60581584855/8.0),
+    REAL_CONST(113973.10364834407/8.0),
+    REAL_CONST(113997.60279732574/8.0),
+    REAL_CONST(114022.1032626521/8.0),
+    REAL_CONST(114046.60504418171/8.0),
+    REAL_CONST(114071.10814177318/8.0),
+    REAL_CONST(114095.61255528514/8.0),
+    REAL_CONST(114120.11828457628/8.0),
+    REAL_CONST(114144.62532950533/8.0),
+    REAL_CONST(114169.13368993104/8.0),
+    REAL_CONST(114193.6433657122/8.0),
+    REAL_CONST(114218.15435670764/8.0),
+    REAL_CONST(114242.66666277625/8.0),
+    REAL_CONST(114267.18028377694/8.0),
+    REAL_CONST(114291.69521956862/8.0),
+    REAL_CONST(114316.21147001031/8.0),
+    REAL_CONST(114340.72903496103/8.0),
+    REAL_CONST(114365.24791427983/8.0),
+    REAL_CONST(114389.7681078258/8.0),
+    REAL_CONST(114414.2896154581/8.0),
+    REAL_CONST(114438.81243703589/8.0),
+    REAL_CONST(114463.33657241837/8.0),
+    REAL_CONST(114487.8620214648/8.0),
+    REAL_CONST(114512.38878403447/8.0),
+    REAL_CONST(114536.91685998671/8.0),
+    REAL_CONST(114561.44624918087/8.0),
+    REAL_CONST(114585.97695147636/8.0),
+    REAL_CONST(114610.5089667326/8.0),
+    REAL_CONST(114635.04229480909/8.0),
+    REAL_CONST(114659.57693556532/8.0),
+    REAL_CONST(114684.11288886084/8.0),
+    REAL_CONST(114708.65015455526/8.0),
+    REAL_CONST(114733.18873250818/8.0),
+    REAL_CONST(114757.72862257928/8.0),
+    REAL_CONST(114782.26982462825/8.0),
+    REAL_CONST(114806.81233851484/8.0),
+    REAL_CONST(114831.35616409882/8.0),
+    REAL_CONST(114855.90130123998/8.0),
+    REAL_CONST(114880.44774979822/8.0),
+    REAL_CONST(114904.99550963337/8.0),
+    REAL_CONST(114929.5445806054/8.0),
+    REAL_CONST(114954.09496257425/8.0),
+    REAL_CONST(114978.64665539992/8.0),
+    REAL_CONST(115003.19965894247/8.0),
+    REAL_CONST(115027.75397306195/8.0),
+    REAL_CONST(115052.30959761847/8.0),
+    REAL_CONST(115076.86653247218/8.0),
+    REAL_CONST(115101.42477748329/8.0),
+    REAL_CONST(115125.984332512/8.0),
+    REAL_CONST(115150.54519741859/8.0),
+    REAL_CONST(115175.10737206334/8.0),
+    REAL_CONST(115199.67085630659/8.0),
+    REAL_CONST(115224.23565000873/8.0),
+    REAL_CONST(115248.80175303014/8.0),
+    REAL_CONST(115273.3691652313/8.0),
+    REAL_CONST(115297.93788647266/8.0),
+    REAL_CONST(115322.50791661476/8.0),
+    REAL_CONST(115347.07925551817/8.0),
+    REAL_CONST(115371.65190304347/8.0),
+    REAL_CONST(115396.22585905129/8.0),
+    REAL_CONST(115420.80112340231/8.0),
+    REAL_CONST(115445.37769595724/8.0),
+    REAL_CONST(115469.95557657682/8.0),
+    REAL_CONST(115494.53476512182/8.0),
+    REAL_CONST(115519.11526145306/8.0),
+    REAL_CONST(115543.69706543141/8.0),
+    REAL_CONST(115568.28017691776/8.0),
+    REAL_CONST(115592.86459577303/8.0),
+    REAL_CONST(115617.4503218582/8.0),
+    REAL_CONST(115642.03735503425/8.0),
+    REAL_CONST(115666.62569516223/8.0),
+    REAL_CONST(115691.21534210323/8.0),
+    REAL_CONST(115715.80629571836/8.0),
+    REAL_CONST(115740.39855586876/8.0),
+    REAL_CONST(115764.99212241563/8.0),
+    REAL_CONST(115789.58699522018/8.0),
+    REAL_CONST(115814.18317414368/8.0),
+    REAL_CONST(115838.78065904744/8.0),
+    REAL_CONST(115863.37944979276/8.0),
+    REAL_CONST(115887.97954624105/8.0),
+    REAL_CONST(115912.5809482537/8.0),
+    REAL_CONST(115937.18365569216/8.0),
+    REAL_CONST(115961.78766841792/8.0),
+    REAL_CONST(115986.39298629249/8.0),
+    REAL_CONST(116010.99960917742/8.0),
+    REAL_CONST(116035.60753693432/8.0),
+    REAL_CONST(116060.21676942479/8.0),
+    REAL_CONST(116084.82730651053/8.0),
+    REAL_CONST(116109.43914805322/8.0),
+    REAL_CONST(116134.0522939146/8.0),
+    REAL_CONST(116158.66674395646/8.0),
+    REAL_CONST(116183.2824980406/8.0),
+    REAL_CONST(116207.89955602887/8.0),
+    REAL_CONST(116232.51791778316/8.0),
+    REAL_CONST(116257.13758316539/8.0),
+    REAL_CONST(116281.75855203751/8.0),
+    REAL_CONST(116306.38082426153/8.0),
+    REAL_CONST(116331.00439969949/8.0),
+    REAL_CONST(116355.62927821343/8.0),
+    REAL_CONST(116380.25545966547/8.0),
+    REAL_CONST(116404.88294391775/8.0),
+    REAL_CONST(116429.51173083246/8.0),
+    REAL_CONST(116454.14182027178/8.0),
+    REAL_CONST(116478.77321209799/8.0),
+    REAL_CONST(116503.40590617337/8.0),
+    REAL_CONST(116528.03990236025/8.0),
+    REAL_CONST(116552.67520052097/8.0),
+    REAL_CONST(116577.31180051794/8.0),
+    REAL_CONST(116601.94970221359/8.0),
+    REAL_CONST(116626.5889054704/8.0),
+    REAL_CONST(116651.22941015086/8.0),
+    REAL_CONST(116675.87121611751/8.0),
+    REAL_CONST(116700.51432323294/8.0),
+    REAL_CONST(116725.15873135976/8.0),
+    REAL_CONST(116749.8044403606/8.0),
+    REAL_CONST(116774.45145009817/8.0),
+    REAL_CONST(116799.0997604352/8.0),
+    REAL_CONST(116823.74937123443/8.0),
+    REAL_CONST(116848.40028235866/8.0),
+    REAL_CONST(116873.05249367072/8.0),
+    REAL_CONST(116897.70600503348/8.0),
+    REAL_CONST(116922.36081630984/8.0),
+    REAL_CONST(116947.01692736275/8.0),
+    REAL_CONST(116971.67433805518/8.0),
+    REAL_CONST(116996.33304825013/8.0),
+    REAL_CONST(117020.99305781067/8.0),
+    REAL_CONST(117045.65436659988/8.0),
+    REAL_CONST(117070.31697448085/8.0),
+    REAL_CONST(117094.98088131678/8.0),
+    REAL_CONST(117119.64608697082/8.0),
+    REAL_CONST(117144.31259130624/8.0),
+    REAL_CONST(117168.98039418629/8.0),
+    REAL_CONST(117193.64949547425/8.0),
+    REAL_CONST(117218.31989503348/8.0),
+    REAL_CONST(117242.99159272734/8.0),
+    REAL_CONST(117267.66458841923/8.0),
+    REAL_CONST(117292.33888197262/8.0),
+    REAL_CONST(117317.01447325097/8.0),
+    REAL_CONST(117341.6913621178/8.0),
+    REAL_CONST(117366.36954843666/8.0),
+    REAL_CONST(117391.04903207115/8.0),
+    REAL_CONST(117415.72981288488/8.0),
+    REAL_CONST(117440.41189074152/8.0),
+    REAL_CONST(117465.09526550474/8.0),
+    REAL_CONST(117489.77993703831/8.0),
+    REAL_CONST(117514.46590520597/8.0),
+    REAL_CONST(117539.15316987153/8.0),
+    REAL_CONST(117563.84173089883/8.0),
+    REAL_CONST(117588.53158815173/8.0),
+    REAL_CONST(117613.22274149416/8.0),
+    REAL_CONST(117637.91519079007/8.0),
+    REAL_CONST(117662.60893590341/8.0),
+    REAL_CONST(117687.30397669821/8.0),
+    REAL_CONST(117712.00031303853/8.0),
+    REAL_CONST(117736.69794478847/8.0),
+    REAL_CONST(117761.39687181212/8.0),
+    REAL_CONST(117786.09709397367/8.0),
+    REAL_CONST(117810.7986111373/8.0),
+    REAL_CONST(117835.50142316725/8.0),
+    REAL_CONST(117860.20552992777/8.0),
+    REAL_CONST(117884.91093128319/8.0),
+    REAL_CONST(117909.6176270978/8.0),
+    REAL_CONST(117934.32561723603/8.0),
+    REAL_CONST(117959.03490156225/8.0),
+    REAL_CONST(117983.74547994092/8.0),
+    REAL_CONST(118008.45735223651/8.0),
+    REAL_CONST(118033.17051831353/8.0),
+    REAL_CONST(118057.88497803656/8.0),
+    REAL_CONST(118082.60073127014/8.0),
+    REAL_CONST(118107.31777787894/8.0),
+    REAL_CONST(118132.03611772758/8.0),
+    REAL_CONST(118156.75575068076/8.0),
+    REAL_CONST(118181.47667660323/8.0),
+    REAL_CONST(118206.19889535972/8.0),
+    REAL_CONST(118230.92240681504/8.0),
+    REAL_CONST(118255.64721083404/8.0),
+    REAL_CONST(118280.37330728157/8.0),
+    REAL_CONST(118305.10069602253/8.0),
+    REAL_CONST(118329.82937692189/8.0),
+    REAL_CONST(118354.55934984458/8.0),
+    REAL_CONST(118379.29061465565/8.0),
+    REAL_CONST(118404.02317122012/8.0),
+    REAL_CONST(118428.75701940308/8.0),
+    REAL_CONST(118453.49215906965/8.0),
+    REAL_CONST(118478.22859008498/8.0),
+    REAL_CONST(118502.96631231424/8.0),
+    REAL_CONST(118527.70532562268/8.0),
+    REAL_CONST(118552.44562987552/8.0),
+    REAL_CONST(118577.18722493808/8.0),
+    REAL_CONST(118601.93011067568/8.0),
+    REAL_CONST(118626.67428695368/8.0),
+    REAL_CONST(118651.41975363747/8.0),
+    REAL_CONST(118676.16651059251/8.0),
+    REAL_CONST(118700.91455768423/8.0),
+    REAL_CONST(118725.66389477813/8.0),
+    REAL_CONST(118750.41452173979/8.0),
+    REAL_CONST(118775.16643843475/8.0),
+    REAL_CONST(118799.91964472862/8.0),
+    REAL_CONST(118824.67414048707/8.0),
+    REAL_CONST(118849.42992557574/8.0),
+    REAL_CONST(118874.18699986035/8.0),
+    REAL_CONST(118898.94536320666/8.0),
+    REAL_CONST(118923.70501548045/8.0),
+    REAL_CONST(118948.46595654752/8.0),
+    REAL_CONST(118973.22818627374/8.0),
+    REAL_CONST(118997.99170452499/8.0),
+    REAL_CONST(119022.7565111672/8.0),
+    REAL_CONST(119047.52260606633/8.0),
+    REAL_CONST(119072.28998908834/8.0),
+    REAL_CONST(119097.0586600993/8.0),
+    REAL_CONST(119121.82861896523/8.0),
+    REAL_CONST(119146.59986555226/8.0),
+    REAL_CONST(119171.3723997265/8.0),
+    REAL_CONST(119196.14622135412/8.0),
+    REAL_CONST(119220.92133030134/8.0),
+    REAL_CONST(119245.69772643436/8.0),
+    REAL_CONST(119270.47540961947/8.0),
+    REAL_CONST(119295.25437972297/8.0),
+    REAL_CONST(119320.03463661121/8.0),
+    REAL_CONST(119344.81618015055/8.0),
+    REAL_CONST(119369.5990102074/8.0),
+    REAL_CONST(119394.38312664822/8.0),
+    REAL_CONST(119419.16852933947/8.0),
+    REAL_CONST(119443.95521814766/8.0),
+    REAL_CONST(119468.74319293935/8.0),
+    REAL_CONST(119493.53245358112/8.0),
+    REAL_CONST(119518.32299993958/8.0),
+    REAL_CONST(119543.11483188139/8.0),
+    REAL_CONST(119567.90794927324/8.0),
+    REAL_CONST(119592.70235198183/8.0),
+    REAL_CONST(119617.49803987393/8.0),
+    REAL_CONST(119642.29501281632/8.0),
+    REAL_CONST(119667.09327067583/8.0),
+    REAL_CONST(119691.89281331931/8.0),
+    REAL_CONST(119716.69364061367/8.0),
+    REAL_CONST(119741.49575242582/8.0),
+    REAL_CONST(119766.29914862274/8.0),
+    REAL_CONST(119791.10382907141/8.0),
+    REAL_CONST(119815.90979363887/8.0),
+    REAL_CONST(119840.71704219218/8.0),
+    REAL_CONST(119865.52557459843/8.0),
+    REAL_CONST(119890.33539072477/8.0),
+    REAL_CONST(119915.14649043836/8.0),
+    REAL_CONST(119939.95887360642/8.0),
+    REAL_CONST(119964.77254009615/8.0),
+    REAL_CONST(119989.58748977486/8.0),
+    REAL_CONST(120014.40372250983/8.0),
+    REAL_CONST(120039.22123816841/8.0),
+    REAL_CONST(120064.04003661797/8.0),
+    REAL_CONST(120088.86011772591/8.0),
+    REAL_CONST(120113.6814813597/8.0),
+    REAL_CONST(120138.5041273868/8.0),
+    REAL_CONST(120163.3280556747/8.0),
+    REAL_CONST(120188.15326609099/8.0),
+    REAL_CONST(120212.97975850321/8.0),
+    REAL_CONST(120237.807532779/8.0),
+    REAL_CONST(120262.63658878599/8.0),
+    REAL_CONST(120287.46692639188/8.0),
+    REAL_CONST(120312.29854546436/8.0),
+    REAL_CONST(120337.13144587121/8.0),
+    REAL_CONST(120361.9656274802/8.0),
+    REAL_CONST(120386.80109015915/8.0),
+    REAL_CONST(120411.63783377589/8.0),
+    REAL_CONST(120436.47585819835/8.0),
+    REAL_CONST(120461.31516329442/8.0),
+    REAL_CONST(120486.15574893207/8.0),
+    REAL_CONST(120510.99761497928/8.0),
+    REAL_CONST(120535.84076130406/8.0),
+    REAL_CONST(120560.68518777451/8.0),
+    REAL_CONST(120585.53089425867/8.0),
+    REAL_CONST(120610.3778806247/8.0),
+    REAL_CONST(120635.22614674074/8.0),
+    REAL_CONST(120660.07569247499/8.0),
+    REAL_CONST(120684.92651769568/8.0),
+    REAL_CONST(120709.77862227106/8.0),
+    REAL_CONST(120734.63200606944/8.0),
+    REAL_CONST(120759.48666895913/8.0),
+    REAL_CONST(120784.3426108085/8.0),
+    REAL_CONST(120809.19983148595/8.0),
+    REAL_CONST(120834.05833085992/8.0),
+    REAL_CONST(120858.91810879884/8.0),
+    REAL_CONST(120883.77916517125/8.0),
+    REAL_CONST(120908.64149984565/8.0),
+    REAL_CONST(120933.5051126906/8.0),
+    REAL_CONST(120958.37000357473/8.0),
+    REAL_CONST(120983.23617236665/8.0),
+    REAL_CONST(121008.10361893504/8.0),
+    REAL_CONST(121032.97234314861/8.0),
+    REAL_CONST(121057.84234487606/8.0),
+    REAL_CONST(121082.71362398617/8.0),
+    REAL_CONST(121107.58618034775/8.0),
+    REAL_CONST(121132.46001382964/8.0),
+    REAL_CONST(121157.33512430069/8.0),
+    REAL_CONST(121182.21151162982/8.0),
+    REAL_CONST(121207.08917568595/8.0),
+    REAL_CONST(121231.96811633807/8.0),
+    REAL_CONST(121256.84833345517/8.0),
+    REAL_CONST(121281.72982690629/8.0),
+    REAL_CONST(121306.61259656049/8.0),
+    REAL_CONST(121331.49664228689/8.0),
+    REAL_CONST(121356.38196395461/8.0),
+    REAL_CONST(121381.26856143285/8.0),
+    REAL_CONST(121406.15643459078/8.0),
+    REAL_CONST(121431.04558329767/8.0),
+    REAL_CONST(121455.93600742276/8.0),
+    REAL_CONST(121480.82770683538/8.0),
+    REAL_CONST(121505.72068140487/8.0),
+    REAL_CONST(121530.61493100057/8.0),
+    REAL_CONST(121555.51045549192/8.0),
+    REAL_CONST(121580.40725474835/8.0),
+    REAL_CONST(121605.30532863933/8.0),
+    REAL_CONST(121630.20467703436/8.0),
+    REAL_CONST(121655.10529980299/8.0),
+    REAL_CONST(121680.00719681478/8.0),
+    REAL_CONST(121704.91036793934/8.0),
+    REAL_CONST(121729.81481304632/8.0),
+    REAL_CONST(121754.72053200539/8.0),
+    REAL_CONST(121779.62752468624/8.0),
+    REAL_CONST(121804.53579095862/8.0),
+    REAL_CONST(121829.44533069231/8.0),
+    REAL_CONST(121854.3561437571/8.0),
+    REAL_CONST(121879.26823002285/8.0),
+    REAL_CONST(121904.1815893594/8.0),
+    REAL_CONST(121929.09622163669/8.0),
+    REAL_CONST(121954.01212672464/8.0),
+    REAL_CONST(121978.92930449323/8.0),
+    REAL_CONST(122003.84775481246/8.0),
+    REAL_CONST(122028.76747755238/8.0),
+    REAL_CONST(122053.68847258303/8.0),
+    REAL_CONST(122078.61073977455/8.0),
+    REAL_CONST(122103.53427899707/8.0),
+    REAL_CONST(122128.45909012076/8.0),
+    REAL_CONST(122153.38517301581/8.0),
+    REAL_CONST(122178.31252755247/8.0),
+    REAL_CONST(122203.24115360099/8.0),
+    REAL_CONST(122228.17105103172/8.0),
+    REAL_CONST(122253.10221971494/8.0),
+    REAL_CONST(122278.03465952107/8.0),
+    REAL_CONST(122302.96837032049/8.0),
+    REAL_CONST(122327.90335198362/8.0),
+    REAL_CONST(122352.83960438096/8.0),
+    REAL_CONST(122377.777127383/8.0),
+    REAL_CONST(122402.71592086025/8.0),
+    REAL_CONST(122427.65598468333/8.0),
+    REAL_CONST(122452.59731872278/8.0),
+    REAL_CONST(122477.53992284928/8.0),
+    REAL_CONST(122502.48379693348/8.0),
+    REAL_CONST(122527.42894084606/8.0),
+    REAL_CONST(122552.37535445779/8.0),
+    REAL_CONST(122577.32303763942/8.0),
+    REAL_CONST(122602.27199026172/8.0),
+    REAL_CONST(122627.22221219557/8.0),
+    REAL_CONST(122652.17370331181/8.0),
+    REAL_CONST(122677.12646348133/8.0),
+    REAL_CONST(122702.08049257506/8.0),
+    REAL_CONST(122727.03579046397/8.0),
+    REAL_CONST(122751.99235701906/8.0),
+    REAL_CONST(122776.95019211136/8.0),
+    REAL_CONST(122801.9092956119/8.0),
+    REAL_CONST(122826.8696673918/8.0),
+    REAL_CONST(122851.83130732219/8.0),
+    REAL_CONST(122876.79421527422/8.0),
+    REAL_CONST(122901.75839111909/8.0),
+    REAL_CONST(122926.72383472799/8.0),
+    REAL_CONST(122951.69054597223/8.0),
+    REAL_CONST(122976.65852472307/8.0),
+    REAL_CONST(123001.62777085182/8.0),
+    REAL_CONST(123026.59828422987/8.0),
+    REAL_CONST(123051.57006472857/8.0),
+    REAL_CONST(123076.54311221937/8.0),
+    REAL_CONST(123101.5174265737/8.0),
+    REAL_CONST(123126.49300766307/8.0),
+    REAL_CONST(123151.46985535898/8.0),
+    REAL_CONST(123176.44796953299/8.0),
+    REAL_CONST(123201.42735005668/8.0),
+    REAL_CONST(123226.40799680166/8.0),
+    REAL_CONST(123251.38990963959/8.0),
+    REAL_CONST(123276.37308844214/8.0),
+    REAL_CONST(123301.35753308103/8.0),
+    REAL_CONST(123326.343243428/8.0),
+    REAL_CONST(123351.33021935483/8.0),
+    REAL_CONST(123376.31846073334/8.0),
+    REAL_CONST(123401.30796743535/8.0),
+    REAL_CONST(123426.29873933276/8.0),
+    REAL_CONST(123451.29077629748/8.0),
+    REAL_CONST(123476.28407820144/8.0),
+    REAL_CONST(123501.2786449166/8.0),
+    REAL_CONST(123526.27447631498/8.0),
+    REAL_CONST(123551.27157226863/8.0),
+    REAL_CONST(123576.26993264959/8.0),
+    REAL_CONST(123601.26955732999/8.0),
+    REAL_CONST(123626.27044618195/8.0),
+    REAL_CONST(123651.27259907764/8.0),
+    REAL_CONST(123676.27601588926/8.0),
+    REAL_CONST(123701.28069648903/8.0),
+    REAL_CONST(123726.28664074924/8.0),
+    REAL_CONST(123751.29384854218/8.0),
+    REAL_CONST(123776.30231974016/8.0),
+    REAL_CONST(123801.31205421555/8.0),
+    REAL_CONST(123826.32305184075/8.0),
+    REAL_CONST(123851.33531248817/8.0),
+    REAL_CONST(123876.34883603029/8.0),
+    REAL_CONST(123901.36362233957/8.0),
+    REAL_CONST(123926.37967128855/8.0),
+    REAL_CONST(123951.39698274979/8.0),
+    REAL_CONST(123976.41555659588/8.0),
+    REAL_CONST(124001.43539269941/8.0),
+    REAL_CONST(124026.45649093305/8.0),
+    REAL_CONST(124051.47885116948/8.0),
+    REAL_CONST(124076.50247328142/8.0),
+    REAL_CONST(124101.5273571416/8.0),
+    REAL_CONST(124126.55350262282/8.0),
+    REAL_CONST(124151.58090959788/8.0),
+    REAL_CONST(124176.60957793961/8.0),
+    REAL_CONST(124201.63950752091/8.0),
+    REAL_CONST(124226.67069821467/8.0),
+    REAL_CONST(124251.70314989384/8.0),
+    REAL_CONST(124276.73686243138/8.0),
+    REAL_CONST(124301.7718357003/8.0),
+    REAL_CONST(124326.80806957364/8.0),
+    REAL_CONST(124351.84556392446/8.0),
+    REAL_CONST(124376.88431862585/8.0),
+    REAL_CONST(124401.92433355095/8.0),
+    REAL_CONST(124426.96560857294/8.0),
+    REAL_CONST(124452.00814356498/8.0),
+    REAL_CONST(124477.05193840031/8.0),
+    REAL_CONST(124502.0969929522/8.0),
+    REAL_CONST(124527.14330709392/8.0),
+    REAL_CONST(124552.19088069882/8.0),
+    REAL_CONST(124577.23971364023/8.0),
+    REAL_CONST(124602.28980579154/8.0),
+    REAL_CONST(124627.34115702618/8.0),
+    REAL_CONST(124652.3937672176/8.0),
+    REAL_CONST(124677.44763623926/8.0),
+    REAL_CONST(124702.50276396469/8.0),
+    REAL_CONST(124727.55915026742/8.0),
+    REAL_CONST(124752.61679502104/8.0),
+    REAL_CONST(124777.67569809916/8.0),
+    REAL_CONST(124802.73585937542/8.0),
+    REAL_CONST(124827.79727872348/8.0),
+    REAL_CONST(124852.85995601704/8.0),
+    REAL_CONST(124877.92389112986/8.0),
+    REAL_CONST(124902.98908393568/8.0),
+    REAL_CONST(124928.05553430831/8.0),
+    REAL_CONST(124953.1232421216/8.0),
+    REAL_CONST(124978.19220724938/8.0),
+    REAL_CONST(125003.26242956554/8.0),
+    REAL_CONST(125028.33390894404/8.0),
+    REAL_CONST(125053.40664525882/8.0),
+    REAL_CONST(125078.48063838384/8.0),
+    REAL_CONST(125103.55588819318/8.0),
+    REAL_CONST(125128.63239456083/8.0),
+    REAL_CONST(125153.71015736091/8.0),
+    REAL_CONST(125178.78917646752/8.0),
+    REAL_CONST(125203.86945175481/8.0),
+    REAL_CONST(125228.95098309696/8.0),
+    REAL_CONST(125254.03377036817/8.0),
+    REAL_CONST(125279.1178134427/8.0),
+    REAL_CONST(125304.20311219479/8.0),
+    REAL_CONST(125329.28966649878/8.0),
+    REAL_CONST(125354.37747622898/8.0),
+    REAL_CONST(125379.46654125977/8.0),
+    REAL_CONST(125404.55686146552/8.0),
+    REAL_CONST(125429.6484367207/8.0),
+    REAL_CONST(125454.74126689974/8.0),
+    REAL_CONST(125479.83535187715/8.0),
+    REAL_CONST(125504.93069152744/8.0),
+    REAL_CONST(125530.02728572517/8.0),
+    REAL_CONST(125555.12513434493/8.0),
+    REAL_CONST(125580.22423726133/8.0),
+    REAL_CONST(125605.32459434902/8.0),
+    REAL_CONST(125630.4262054827/8.0),
+    REAL_CONST(125655.52907053704/8.0),
+    REAL_CONST(125680.63318938682/8.0),
+    REAL_CONST(125705.73856190679/8.0),
+    REAL_CONST(125730.84518797178/8.0),
+    REAL_CONST(125755.9530674566/8.0),
+    REAL_CONST(125781.06220023613/8.0),
+    REAL_CONST(125806.17258618528/8.0),
+    REAL_CONST(125831.28422517896/8.0),
+    REAL_CONST(125856.39711709213/8.0),
+    REAL_CONST(125881.51126179981/8.0),
+    REAL_CONST(125906.62665917698/8.0),
+    REAL_CONST(125931.74330909875/8.0),
+    REAL_CONST(125956.86121144016/8.0),
+    REAL_CONST(125981.98036607634/8.0),
+    REAL_CONST(126007.10077288245/8.0),
+    REAL_CONST(126032.22243173365/8.0),
+    REAL_CONST(126057.34534250517/8.0),
+    REAL_CONST(126082.46950507225/8.0),
+    REAL_CONST(126107.59491931014/8.0),
+    REAL_CONST(126132.72158509417/8.0),
+    REAL_CONST(126157.84950229966/8.0),
+    REAL_CONST(126182.97867080198/8.0),
+    REAL_CONST(126208.10909047653/8.0),
+    REAL_CONST(126233.24076119871/8.0),
+    REAL_CONST(126258.37368284403/8.0),
+    REAL_CONST(126283.50785528794/8.0),
+    REAL_CONST(126308.64327840599/8.0),
+    REAL_CONST(126333.77995207369/8.0),
+    REAL_CONST(126358.91787616667/8.0),
+    REAL_CONST(126384.0570505605/8.0),
+    REAL_CONST(126409.19747513086/8.0),
+    REAL_CONST(126434.3391497534/8.0),
+    REAL_CONST(126459.48207430386/8.0),
+    REAL_CONST(126484.62624865794/8.0),
+    REAL_CONST(126509.77167269142/8.0),
+    REAL_CONST(126534.9183462801/8.0),
+    REAL_CONST(126560.06626929982/8.0),
+    REAL_CONST(126585.21544162642/8.0),
+    REAL_CONST(126610.36586313581/8.0),
+    REAL_CONST(126635.51753370393/8.0),
+    REAL_CONST(126660.67045320668/8.0),
+    REAL_CONST(126685.82462152008/8.0),
+    REAL_CONST(126710.98003852014/8.0),
+    REAL_CONST(126736.13670408291/8.0),
+    REAL_CONST(126761.29461808444/8.0),
+    REAL_CONST(126786.45378040087/8.0),
+    REAL_CONST(126811.61419090834/8.0),
+    REAL_CONST(126836.77584948298/8.0),
+    REAL_CONST(126861.93875600102/8.0),
+    REAL_CONST(126887.10291033868/8.0),
+    REAL_CONST(126912.26831237224/8.0),
+    REAL_CONST(126937.43496197795/8.0),
+    REAL_CONST(126962.60285903217/8.0),
+    REAL_CONST(126987.77200341123/8.0),
+    REAL_CONST(127012.94239499152/8.0),
+    REAL_CONST(127038.11403364947/8.0),
+    REAL_CONST(127063.2869192615/8.0),
+    REAL_CONST(127088.46105170409/8.0),
+    REAL_CONST(127113.63643085376/8.0),
+    REAL_CONST(127138.81305658702/8.0),
+    REAL_CONST(127163.99092878048/8.0),
+    REAL_CONST(127189.17004731069/8.0),
+    REAL_CONST(127214.35041205429/8.0),
+    REAL_CONST(127239.53202288797/8.0),
+    REAL_CONST(127264.71487968838/8.0),
+    REAL_CONST(127289.89898233226/8.0),
+    REAL_CONST(127315.08433069635/8.0),
+    REAL_CONST(127340.27092465744/8.0),
+    REAL_CONST(127365.45876409234/8.0),
+    REAL_CONST(127390.64784887788/8.0),
+    REAL_CONST(127415.83817889093/8.0),
+    REAL_CONST(127441.02975400841/8.0),
+    REAL_CONST(127466.22257410725/8.0),
+    REAL_CONST(127491.41663906439/8.0),
+    REAL_CONST(127516.61194875685/8.0),
+    REAL_CONST(127541.80850306165/8.0),
+    REAL_CONST(127567.00630185583/8.0),
+    REAL_CONST(127592.20534501647/8.0),
+    REAL_CONST(127617.4056324207/8.0),
+    REAL_CONST(127642.60716394568/8.0),
+    REAL_CONST(127667.80993946856/8.0),
+    REAL_CONST(127693.01395886653/8.0),
+    REAL_CONST(127718.21922201688/8.0),
+    REAL_CONST(127743.42572879682/8.0),
+    REAL_CONST(127768.63347908368/8.0),
+    REAL_CONST(127793.84247275478/8.0),
+    REAL_CONST(127819.05270968749/8.0),
+    REAL_CONST(127844.26418975917/8.0),
+    REAL_CONST(127869.47691284724/8.0),
+    REAL_CONST(127894.69087882918/8.0),
+    REAL_CONST(127919.90608758242/8.0),
+    REAL_CONST(127945.12253898452/8.0),
+    REAL_CONST(127970.34023291297/8.0),
+    REAL_CONST(127995.55916924537/8.0),
+    REAL_CONST(128020.77934785932/8.0),
+    REAL_CONST(128046.00076863244/8.0),
+    REAL_CONST(128071.22343144237/8.0),
+    REAL_CONST(128096.44733616684/8.0),
+    REAL_CONST(128121.67248268353/8.0),
+    REAL_CONST(128146.89887087021/8.0),
+    REAL_CONST(128172.12650060465/8.0),
+    REAL_CONST(128197.35537176467/8.0),
+    REAL_CONST(128222.5854842281/8.0),
+    REAL_CONST(128247.81683787282/8.0),
+    REAL_CONST(128273.04943257671/8.0),
+    REAL_CONST(128298.28326821771/8.0),
+    REAL_CONST(128323.51834467379/8.0),
+    REAL_CONST(128348.75466182294/8.0),
+    REAL_CONST(128373.99221954317/8.0),
+    REAL_CONST(128399.23101771252/8.0),
+    REAL_CONST(128424.47105620909/8.0),
+    REAL_CONST(128449.71233491098/8.0),
+    REAL_CONST(128474.95485369631/8.0),
+    REAL_CONST(128500.19861244329/8.0),
+    REAL_CONST(128525.44361103009/8.0),
+    REAL_CONST(128550.68984933494/8.0),
+    REAL_CONST(128575.93732723613/8.0),
+    REAL_CONST(128601.18604461191/8.0),
+    REAL_CONST(128626.43600134061/8.0),
+    REAL_CONST(128651.68719730059/8.0),
+    REAL_CONST(128676.93963237021/8.0),
+    REAL_CONST(128702.1933064279/8.0),
+    REAL_CONST(128727.44821935208/8.0),
+    REAL_CONST(128752.70437102125/8.0),
+    REAL_CONST(128777.96176131385/8.0),
+    REAL_CONST(128803.22039010846/8.0),
+    REAL_CONST(128828.48025728362/8.0),
+    REAL_CONST(128853.74136271792/8.0),
+    REAL_CONST(128879.00370628996/8.0),
+    REAL_CONST(128904.26728787841/8.0),
+    REAL_CONST(128929.53210736193/8.0),
+    REAL_CONST(128954.79816461923/8.0),
+    REAL_CONST(128980.06545952905/8.0),
+    REAL_CONST(129005.33399197015/8.0),
+    REAL_CONST(129030.60376182134/8.0),
+    REAL_CONST(129055.87476896142/8.0),
+    REAL_CONST(129081.14701326926/8.0),
+    REAL_CONST(129106.42049462376/8.0),
+    REAL_CONST(129131.6952129038/8.0),
+    REAL_CONST(129156.97116798835/8.0),
+    REAL_CONST(129182.24835975636/8.0),
+    REAL_CONST(129207.52678808685/8.0),
+    REAL_CONST(129232.80645285884/8.0),
+    REAL_CONST(129258.08735395141/8.0),
+    REAL_CONST(129283.36949124365/8.0),
+    REAL_CONST(129308.65286461466/8.0),
+    REAL_CONST(129333.9374739436/8.0),
+    REAL_CONST(129359.22331910966/8.0),
+    REAL_CONST(129384.51039999202/8.0),
+    REAL_CONST(129409.79871646997/8.0),
+    REAL_CONST(129435.08826842274/8.0),
+    REAL_CONST(129460.37905572963/8.0),
+    REAL_CONST(129485.67107826998/8.0),
+    REAL_CONST(129510.96433592314/8.0),
+    REAL_CONST(129536.25882856851/8.0),
+    REAL_CONST(129561.55455608548/8.0),
+    REAL_CONST(129586.85151835352/8.0),
+    REAL_CONST(129612.14971525209/8.0),
+    REAL_CONST(129637.4491466607/8.0),
+    REAL_CONST(129662.74981245887/8.0),
+    REAL_CONST(129688.0517125262/8.0),
+    REAL_CONST(129713.35484674224/8.0),
+    REAL_CONST(129738.65921498663/8.0),
+    REAL_CONST(129763.96481713903/8.0),
+    REAL_CONST(129789.27165307909/8.0),
+    REAL_CONST(129814.57972268655/8.0),
+    REAL_CONST(129839.88902584116/8.0),
+    REAL_CONST(129865.19956242264/8.0),
+    REAL_CONST(129890.51133231082/8.0),
+    REAL_CONST(129915.82433538554/8.0),
+    REAL_CONST(129941.13857152662/8.0),
+    REAL_CONST(129966.45404061397/8.0),
+    REAL_CONST(129991.7707425275/8.0),
+    REAL_CONST(130017.08867714716/8.0),
+    REAL_CONST(130042.4078443529/8.0),
+    REAL_CONST(130067.72824402474/8.0),
+    REAL_CONST(130093.04987604271/8.0),
+    REAL_CONST(130118.37274028687/8.0),
+    REAL_CONST(130143.69683663732/8.0),
+    REAL_CONST(130169.02216497416/8.0),
+    REAL_CONST(130194.34872517755/8.0),
+    REAL_CONST(130219.67651712766/8.0),
+    REAL_CONST(130245.0055407047/8.0),
+    REAL_CONST(130270.33579578891/8.0),
+    REAL_CONST(130295.66728226055/8.0),
+    REAL_CONST(130320.99999999991/8.0),
+    REAL_CONST(130346.33394888733/8.0),
+    REAL_CONST(130371.66912880314/8.0),
+    REAL_CONST(130397.00553962773/8.0),
+    REAL_CONST(130422.34318124152/8.0),
+    REAL_CONST(130447.68205352494/8.0),
+    REAL_CONST(130473.02215635845/8.0),
+    REAL_CONST(130498.36348962256/8.0),
+    REAL_CONST(130523.70605319779/8.0),
+    REAL_CONST(130549.0498469647/8.0),
+    REAL_CONST(130574.39487080388/8.0),
+    REAL_CONST(130599.74112459592/8.0),
+    REAL_CONST(130625.08860822149/8.0),
+    REAL_CONST(130650.43732156123/8.0),
+    REAL_CONST(130675.78726449587/8.0),
+    REAL_CONST(130701.13843690613/8.0),
+    REAL_CONST(130726.49083867275/8.0),
+    REAL_CONST(130751.84446967654/8.0),
+    REAL_CONST(130777.19932979831/8.0),
+    REAL_CONST(130802.5554189189/8.0),
+    REAL_CONST(130827.91273691918/8.0),
+    REAL_CONST(130853.27128368006/8.0),
+    REAL_CONST(130878.63105908247/8.0),
+    REAL_CONST(130903.99206300738/8.0),
+    REAL_CONST(130929.35429533575/8.0),
+    REAL_CONST(130954.71775594862/8.0),
+    REAL_CONST(130980.08244472703/8.0),
+    REAL_CONST(131005.44836155206/8.0),
+    REAL_CONST(131030.81550630482/8.0),
+    REAL_CONST(131056.18387886642/8.0),
+    REAL_CONST(131081.55347911804/8.0),
+    REAL_CONST(131106.92430694087/8.0),
+    REAL_CONST(131132.29636221612/8.0),
+    REAL_CONST(131157.66964482504/8.0),
+    REAL_CONST(131183.0441546489/8.0),
+    REAL_CONST(131208.41989156904/8.0),
+    REAL_CONST(131233.79685546676/8.0),
+    REAL_CONST(131259.17504622342/8.0),
+    REAL_CONST(131284.55446372041/8.0),
+    REAL_CONST(131309.93510783918/8.0),
+    REAL_CONST(131335.31697846117/8.0),
+    REAL_CONST(131360.70007546784/8.0),
+    REAL_CONST(131386.0843987407/8.0),
+    REAL_CONST(131411.46994816128/8.0),
+    REAL_CONST(131436.85672361116/8.0),
+    REAL_CONST(131462.24472497194/8.0),
+    REAL_CONST(131487.63395212521/8.0),
+    REAL_CONST(131513.02440495262/8.0),
+    REAL_CONST(131538.41608333588/8.0),
+    REAL_CONST(131563.80898715663/8.0),
+    REAL_CONST(131589.2031162967/8.0),
+    REAL_CONST(131614.59847063778/8.0),
+    REAL_CONST(131639.9950500617/8.0),
+    REAL_CONST(131665.39285445024/8.0),
+    REAL_CONST(131690.79188368531/8.0),
+    REAL_CONST(131716.19213764873/8.0),
+    REAL_CONST(131741.59361622241/8.0),
+    REAL_CONST(131766.99631928833/8.0),
+    REAL_CONST(131792.40024672839/8.0),
+    REAL_CONST(131817.80539842462/8.0),
+    REAL_CONST(131843.21177425905/8.0),
+    REAL_CONST(131868.61937411371/8.0),
+    REAL_CONST(131894.02819787065/8.0),
+    REAL_CONST(131919.43824541202/8.0),
+    REAL_CONST(131944.84951661993/8.0),
+    REAL_CONST(131970.26201137656/8.0),
+    REAL_CONST(131995.67572956407/8.0),
+    REAL_CONST(132021.09067106468/8.0),
+    REAL_CONST(132046.50683576067/8.0),
+    REAL_CONST(132071.9242235343/8.0),
+    REAL_CONST(132097.34283426782/8.0),
+    REAL_CONST(132122.76266784366/8.0),
+    REAL_CONST(132148.1837241441/8.0),
+    REAL_CONST(132173.60600305157/8.0),
+    REAL_CONST(132199.02950444847/8.0),
+    REAL_CONST(132224.45422821722/8.0),
+    REAL_CONST(132249.88017424036/8.0),
+    REAL_CONST(132275.30734240031/8.0),
+    REAL_CONST(132300.73573257966/8.0),
+    REAL_CONST(132326.16534466096/8.0),
+    REAL_CONST(132351.59617852676/8.0),
+    REAL_CONST(132377.02823405969/8.0),
+    REAL_CONST(132402.46151114244/8.0),
+    REAL_CONST(132427.89600965759/8.0),
+    REAL_CONST(132453.33172948789/8.0),
+    REAL_CONST(132478.76867051609/8.0),
+    REAL_CONST(132504.20683262491/8.0),
+    REAL_CONST(132529.64621569714/8.0),
+    REAL_CONST(132555.08681961559/8.0),
+    REAL_CONST(132580.5286442631/8.0),
+    REAL_CONST(132605.97168952253/8.0),
+    REAL_CONST(132631.41595527678/8.0),
+    REAL_CONST(132656.86144140881/8.0),
+    REAL_CONST(132682.30814780149/8.0),
+    REAL_CONST(132707.75607433787/8.0),
+    REAL_CONST(132733.20522090094/8.0),
+    REAL_CONST(132758.65558737374/8.0),
+    REAL_CONST(132784.10717363929/8.0),
+    REAL_CONST(132809.55997958075/8.0),
+    REAL_CONST(132835.01400508118/8.0),
+    REAL_CONST(132860.46925002377/8.0),
+    REAL_CONST(132885.92571429166/8.0),
+    REAL_CONST(132911.38339776811/8.0),
+    REAL_CONST(132936.84230033628/8.0),
+    REAL_CONST(132962.30242187946/8.0),
+    REAL_CONST(132987.76376228096/8.0),
+    REAL_CONST(133013.22632142407/8.0),
+    REAL_CONST(133038.69009919214/8.0),
+    REAL_CONST(133064.15509546854/8.0),
+    REAL_CONST(133089.62131013666/8.0),
+    REAL_CONST(133115.08874307995/8.0),
+    REAL_CONST(133140.55739418184/8.0),
+    REAL_CONST(133166.02726332581/8.0),
+    REAL_CONST(133191.49835039541/8.0),
+    REAL_CONST(133216.97065527414/8.0),
+    REAL_CONST(133242.44417784561/8.0),
+    REAL_CONST(133267.91891799335/8.0),
+    REAL_CONST(133293.39487560102/8.0),
+    REAL_CONST(133318.87205055228/8.0),
+    REAL_CONST(133344.35044273079/8.0),
+    REAL_CONST(133369.83005202023/8.0),
+    REAL_CONST(133395.31087830439/8.0),
+    REAL_CONST(133420.79292146701/8.0),
+    REAL_CONST(133446.27618139185/8.0),
+    REAL_CONST(133471.76065796276/8.0),
+    REAL_CONST(133497.24635106357/8.0),
+    REAL_CONST(133522.73326057816/8.0),
+    REAL_CONST(133548.22138639039/8.0),
+    REAL_CONST(133573.71072838426/8.0),
+    REAL_CONST(133599.20128644365/8.0),
+    REAL_CONST(133624.69306045261/8.0),
+    REAL_CONST(133650.1860502951/8.0),
+    REAL_CONST(133675.68025585517/8.0),
+    REAL_CONST(133701.1756770169/8.0),
+    REAL_CONST(133726.67231366437/8.0),
+    REAL_CONST(133752.17016568172/8.0),
+    REAL_CONST(133777.66923295305/8.0),
+    REAL_CONST(133803.16951536259/8.0),
+    REAL_CONST(133828.67101279454/8.0),
+    REAL_CONST(133854.17372513309/8.0),
+    REAL_CONST(133879.67765226253/8.0),
+    REAL_CONST(133905.18279406714/8.0),
+    REAL_CONST(133930.68915043125/8.0),
+    REAL_CONST(133956.19672123916/8.0),
+    REAL_CONST(133981.70550637526/8.0),
+    REAL_CONST(134007.21550572399/8.0),
+    REAL_CONST(134032.7267191697/8.0),
+    REAL_CONST(134058.23914659687/8.0),
+    REAL_CONST(134083.75278789/8.0),
+    REAL_CONST(134109.26764293358/8.0),
+    REAL_CONST(134134.78371161217/8.0),
+    REAL_CONST(134160.30099381026/8.0),
+    REAL_CONST(134185.8194894125/8.0),
+    REAL_CONST(134211.33919830353/8.0),
+    REAL_CONST(134236.8601203679/8.0),
+    REAL_CONST(134262.38225549037/8.0),
+    REAL_CONST(134287.90560355558/8.0),
+    REAL_CONST(134313.43016444831/8.0),
+    REAL_CONST(134338.95593805326/8.0),
+    REAL_CONST(134364.48292425525/8.0),
+    REAL_CONST(134390.01112293909/8.0),
+    REAL_CONST(134415.54053398955/8.0),
+    REAL_CONST(134441.07115729159/8.0),
+    REAL_CONST(134466.60299273001/8.0),
+    REAL_CONST(134492.1360401898/8.0),
+    REAL_CONST(134517.67029955584/8.0),
+    REAL_CONST(134543.20577071316/8.0),
+    REAL_CONST(134568.74245354676/8.0),
+    REAL_CONST(134594.28034794159/8.0),
+    REAL_CONST(134619.81945378278/8.0),
+    REAL_CONST(134645.35977095537/8.0),
+    REAL_CONST(134670.90129934452/8.0),
+    REAL_CONST(134696.4440388353/8.0),
+    REAL_CONST(134721.98798931291/8.0),
+    REAL_CONST(134747.53315066252/8.0),
+    REAL_CONST(134773.07952276937/8.0),
+    REAL_CONST(134798.62710551871/8.0),
+    REAL_CONST(134824.17589879577/8.0),
+    REAL_CONST(134849.72590248589/8.0),
+    REAL_CONST(134875.27711647438/8.0),
+    REAL_CONST(134900.82954064661/8.0),
+    REAL_CONST(134926.38317488792/8.0),
+    REAL_CONST(134951.93801908373/8.0),
+    REAL_CONST(134977.49407311951/8.0),
+    REAL_CONST(135003.05133688069/8.0),
+    REAL_CONST(135028.60981025276/8.0),
+    REAL_CONST(135054.16949312127/8.0),
+    REAL_CONST(135079.73038537172/8.0),
+    REAL_CONST(135105.29248688967/8.0),
+    REAL_CONST(135130.85579756077/8.0),
+    REAL_CONST(135156.42031727062/8.0),
+    REAL_CONST(135181.98604590484/8.0),
+    REAL_CONST(135207.55298334916/8.0),
+    REAL_CONST(135233.12112948924/8.0),
+    REAL_CONST(135258.69048421088/8.0),
+    REAL_CONST(135284.26104739975/8.0),
+    REAL_CONST(135309.83281894168/8.0),
+    REAL_CONST(135335.4057987225/8.0),
+    REAL_CONST(135360.97998662802/8.0),
+    REAL_CONST(135386.55538254412/8.0),
+    REAL_CONST(135412.13198635669/8.0),
+    REAL_CONST(135437.70979795168/8.0),
+    REAL_CONST(135463.28881721498/8.0),
+    REAL_CONST(135488.86904403262/8.0),
+    REAL_CONST(135514.45047829056/8.0),
+    REAL_CONST(135540.03311987486/8.0),
+    REAL_CONST(135565.61696867159/8.0),
+    REAL_CONST(135591.20202456677/8.0),
+    REAL_CONST(135616.78828744654/8.0),
+    REAL_CONST(135642.37575719706/8.0),
+    REAL_CONST(135667.96443370447/8.0),
+    REAL_CONST(135693.55431685498/8.0),
+    REAL_CONST(135719.14540653475/8.0),
+    REAL_CONST(135744.73770263011/8.0),
+    REAL_CONST(135770.33120502727/8.0),
+    REAL_CONST(135795.92591361253/8.0),
+    REAL_CONST(135821.52182827223/8.0),
+    REAL_CONST(135847.11894889272/8.0),
+    REAL_CONST(135872.7172753604/8.0),
+    REAL_CONST(135898.31680756161/8.0),
+    REAL_CONST(135923.91754538284/8.0),
+    REAL_CONST(135949.51948871053/8.0),
+    REAL_CONST(135975.12263743114/8.0),
+    REAL_CONST(136000.72699143123/8.0),
+    REAL_CONST(136026.33255059729/8.0),
+    REAL_CONST(136051.93931481591/8.0),
+    REAL_CONST(136077.54728397369/8.0),
+    REAL_CONST(136103.15645795723/8.0),
+    REAL_CONST(136128.76683665317/8.0),
+    REAL_CONST(136154.37841994822/8.0),
+    REAL_CONST(136179.99120772901/8.0),
+    REAL_CONST(136205.60519988232/8.0),
+    REAL_CONST(136231.2203962949/8.0),
+    REAL_CONST(136256.83679685349/8.0),
+    REAL_CONST(136282.45440144493/8.0),
+    REAL_CONST(136308.07320995603/8.0),
+    REAL_CONST(136333.69322227367/8.0),
+    REAL_CONST(136359.31443828469/8.0),
+    REAL_CONST(136384.93685787608/8.0),
+    REAL_CONST(136410.56048093468/8.0),
+    REAL_CONST(136436.18530734754/8.0),
+    REAL_CONST(136461.81133700156/8.0),
+    REAL_CONST(136487.43856978384/8.0),
+    REAL_CONST(136513.06700558143/8.0),
+    REAL_CONST(136538.6966442813/8.0),
+    REAL_CONST(136564.32748577066/8.0),
+    REAL_CONST(136589.95952993655/8.0),
+    REAL_CONST(136615.59277666616/8.0),
+    REAL_CONST(136641.22722584667/8.0),
+    REAL_CONST(136666.86287736523/8.0),
+    REAL_CONST(136692.49973110916/8.0),
+    REAL_CONST(136718.13778696564/8.0),
+    REAL_CONST(136743.77704482197/8.0),
+    REAL_CONST(136769.41750456547/8.0),
+    REAL_CONST(136795.05916608346/8.0),
+    REAL_CONST(136820.70202926331/8.0),
+    REAL_CONST(136846.34609399244/8.0),
+    REAL_CONST(136871.99136015819/8.0),
+    REAL_CONST(136897.63782764805/8.0),
+    REAL_CONST(136923.28549634948/8.0),
+    REAL_CONST(136948.93436614997/8.0),
+    REAL_CONST(136974.58443693706/8.0),
+    REAL_CONST(137000.23570859825/8.0),
+    REAL_CONST(137025.88818102115/8.0),
+    REAL_CONST(137051.54185409332/8.0),
+    REAL_CONST(137077.19672770242/8.0),
+    REAL_CONST(137102.85280173609/8.0),
+    REAL_CONST(137128.51007608202/8.0),
+    REAL_CONST(137154.16855062786/8.0),
+    REAL_CONST(137179.82822526142/8.0),
+    REAL_CONST(137205.48909987041/8.0),
+    REAL_CONST(137231.15117434258/8.0),
+    REAL_CONST(137256.8144485658/8.0),
+    REAL_CONST(137282.47892242789/8.0),
+    REAL_CONST(137308.14459581667/8.0),
+    REAL_CONST(137333.81146862009/8.0),
+    REAL_CONST(137359.47954072602/8.0),
+    REAL_CONST(137385.14881202241/8.0),
+    REAL_CONST(137410.81928239719/8.0),
+    REAL_CONST(137436.49095173844/8.0),
+    REAL_CONST(137462.16381993407/8.0),
+    REAL_CONST(137487.83788687221/8.0),
+    REAL_CONST(137513.51315244089/8.0),
+    REAL_CONST(137539.18961652822/8.0),
+    REAL_CONST(137564.86727902229/8.0),
+    REAL_CONST(137590.54613981131/8.0),
+    REAL_CONST(137616.22619878338/8.0),
+    REAL_CONST(137641.90745582676/8.0),
+    REAL_CONST(137667.58991082967/8.0),
+    REAL_CONST(137693.27356368033/8.0),
+    REAL_CONST(137718.95841426702/8.0),
+    REAL_CONST(137744.64446247809/8.0),
+    REAL_CONST(137770.33170820182/8.0),
+    REAL_CONST(137796.02015132661/8.0),
+    REAL_CONST(137821.70979174081/8.0),
+    REAL_CONST(137847.40062933284/8.0),
+    REAL_CONST(137873.09266399115/8.0),
+    REAL_CONST(137898.78589560417/8.0),
+    REAL_CONST(137924.48032406042/8.0),
+    REAL_CONST(137950.17594924837/8.0),
+    REAL_CONST(137975.8727710566/8.0),
+    REAL_CONST(138001.57078937365/8.0),
+    REAL_CONST(138027.27000408815/8.0),
+    REAL_CONST(138052.97041508864/8.0),
+    REAL_CONST(138078.67202226384/8.0),
+    REAL_CONST(138104.3748255024/8.0),
+    REAL_CONST(138130.07882469296/8.0),
+    REAL_CONST(138155.78401972432/8.0),
+    REAL_CONST(138181.49041048516/8.0),
+    REAL_CONST(138207.1979968643/8.0),
+    REAL_CONST(138232.9067787505/8.0),
+    REAL_CONST(138258.61675603263/8.0),
+    REAL_CONST(138284.32792859949/8.0),
+    REAL_CONST(138310.04029633995/8.0),
+    REAL_CONST(138335.75385914298/8.0),
+    REAL_CONST(138361.46861689744/8.0),
+    REAL_CONST(138387.18456949232/8.0),
+    REAL_CONST(138412.90171681659/8.0),
+    REAL_CONST(138438.62005875923/8.0),
+    REAL_CONST(138464.33959520931/8.0),
+    REAL_CONST(138490.06032605586/8.0),
+    REAL_CONST(138515.78225118798/8.0),
+    REAL_CONST(138541.50537049473/8.0),
+    REAL_CONST(138567.2296838653/8.0),
+    REAL_CONST(138592.95519118884/8.0),
+    REAL_CONST(138618.68189235451/8.0),
+    REAL_CONST(138644.40978725153/8.0),
+    REAL_CONST(138670.13887576913/8.0),
+    REAL_CONST(138695.86915779658/8.0),
+    REAL_CONST(138721.60063322316/8.0),
+    REAL_CONST(138747.33330193823/8.0),
+    REAL_CONST(138773.06716383106/8.0),
+    REAL_CONST(138798.80221879104/8.0),
+    REAL_CONST(138824.53846670757/8.0),
+    REAL_CONST(138850.27590747006/8.0),
+    REAL_CONST(138876.01454096794/8.0),
+    REAL_CONST(138901.7543670907/8.0),
+    REAL_CONST(138927.49538572782/8.0),
+    REAL_CONST(138953.2375967688/8.0),
+    REAL_CONST(138978.9810001032/8.0),
+    REAL_CONST(139004.72559562061/8.0),
+    REAL_CONST(139030.47138321059/8.0),
+    REAL_CONST(139056.2183627628/8.0),
+    REAL_CONST(139081.96653416683/8.0),
+    REAL_CONST(139107.71589731239/8.0),
+    REAL_CONST(139133.46645208917/8.0),
+    REAL_CONST(139159.21819838689/8.0),
+    REAL_CONST(139184.97113609532/8.0),
+    REAL_CONST(139210.72526510421/8.0),
+    REAL_CONST(139236.48058530336/8.0),
+    REAL_CONST(139262.23709658257/8.0),
+    REAL_CONST(139287.99479883176/8.0),
+    REAL_CONST(139313.75369194071/8.0),
+    REAL_CONST(139339.51377579942/8.0),
+    REAL_CONST(139365.27505029776/8.0),
+    REAL_CONST(139391.03751532568/8.0),
+    REAL_CONST(139416.80117077316/8.0),
+    REAL_CONST(139442.56601653024/8.0),
+    REAL_CONST(139468.33205248689/8.0),
+    REAL_CONST(139494.09927853322/8.0),
+    REAL_CONST(139519.86769455927/8.0),
+    REAL_CONST(139545.63730045516/8.0),
+    REAL_CONST(139571.408096111/8.0),
+    REAL_CONST(139597.18008141697/8.0),
+    REAL_CONST(139622.95325626322/8.0),
+    REAL_CONST(139648.72762054001/8.0),
+    REAL_CONST(139674.5031741375/8.0),
+    REAL_CONST(139700.27991694602/8.0),
+    REAL_CONST(139726.05784885579/8.0),
+    REAL_CONST(139751.83696975713/8.0),
+    REAL_CONST(139777.61727954043/8.0),
+    REAL_CONST(139803.39877809596/8.0),
+    REAL_CONST(139829.18146531415/8.0),
+    REAL_CONST(139854.96534108539/8.0),
+    REAL_CONST(139880.75040530015/8.0),
+    REAL_CONST(139906.53665784886/8.0),
+    REAL_CONST(139932.32409862199/8.0),
+    REAL_CONST(139958.11272751007/8.0),
+    REAL_CONST(139983.90254440365/8.0),
+    REAL_CONST(140009.69354919327/8.0),
+    REAL_CONST(140035.48574176949/8.0),
+    REAL_CONST(140061.27912202294/8.0),
+    REAL_CONST(140087.07368984428/8.0),
+    REAL_CONST(140112.86944512415/8.0),
+    REAL_CONST(140138.66638775321/8.0),
+    REAL_CONST(140164.4645176222/8.0),
+    REAL_CONST(140190.26383462184/8.0),
+    REAL_CONST(140216.06433864293/8.0),
+    REAL_CONST(140241.86602957622/8.0),
+    REAL_CONST(140267.66890731253/8.0),
+    REAL_CONST(140293.47297174268/8.0),
+    REAL_CONST(140319.27822275754/8.0),
+    REAL_CONST(140345.08466024802/8.0),
+    REAL_CONST(140370.89228410498/8.0),
+    REAL_CONST(140396.70109421943/8.0),
+    REAL_CONST(140422.51109048226/8.0),
+    REAL_CONST(140448.32227278448/8.0),
+    REAL_CONST(140474.13464101712/8.0),
+    REAL_CONST(140499.94819507122/8.0),
+    REAL_CONST(140525.76293483781/8.0),
+    REAL_CONST(140551.57886020801/8.0),
+    REAL_CONST(140577.3959710729/8.0),
+    REAL_CONST(140603.21426732364/8.0),
+    REAL_CONST(140629.03374885136/8.0),
+    REAL_CONST(140654.85441554731/8.0),
+    REAL_CONST(140680.67626730262/8.0),
+    REAL_CONST(140706.49930400858/8.0),
+    REAL_CONST(140732.32352555645/8.0),
+    REAL_CONST(140758.1489318375/8.0),
+    REAL_CONST(140783.97552274304/8.0),
+    REAL_CONST(140809.80329816442/8.0),
+    REAL_CONST(140835.63225799298/8.0),
+    REAL_CONST(140861.46240212015/8.0),
+    REAL_CONST(140887.29373043729/8.0),
+    REAL_CONST(140913.12624283586/8.0),
+    REAL_CONST(140938.95993920733/8.0),
+    REAL_CONST(140964.79481944317/8.0),
+    REAL_CONST(140990.63088343487/8.0),
+    REAL_CONST(141016.46813107401/8.0),
+    REAL_CONST(141042.30656225214/8.0),
+    REAL_CONST(141068.14617686081/8.0),
+    REAL_CONST(141093.98697479168/8.0),
+    REAL_CONST(141119.82895593636/8.0),
+    REAL_CONST(141145.6721201865/8.0),
+    REAL_CONST(141171.51646743377/8.0),
+    REAL_CONST(141197.36199756994/8.0),
+    REAL_CONST(141223.20871048668/8.0),
+    REAL_CONST(141249.05660607578/8.0),
+    REAL_CONST(141274.90568422904/8.0),
+    REAL_CONST(141300.75594483822/8.0),
+    REAL_CONST(141326.6073877952/8.0),
+    REAL_CONST(141352.4600129918/8.0),
+    REAL_CONST(141378.31382031992/8.0),
+    REAL_CONST(141404.16880967148/8.0),
+    REAL_CONST(141430.02498093838/8.0),
+    REAL_CONST(141455.8823340126/8.0),
+    REAL_CONST(141481.74086878612/8.0),
+    REAL_CONST(141507.60058515094/8.0),
+    REAL_CONST(141533.46148299909/8.0),
+    REAL_CONST(141559.32356222265/8.0),
+    REAL_CONST(141585.18682271364/8.0),
+    REAL_CONST(141611.05126436421/8.0),
+    REAL_CONST(141636.9168870665/8.0),
+    REAL_CONST(141662.78369071262/8.0),
+    REAL_CONST(141688.65167519479/8.0),
+    REAL_CONST(141714.5208404052/8.0),
+    REAL_CONST(141740.39118623605/8.0),
+    REAL_CONST(141766.26271257963/8.0),
+    REAL_CONST(141792.1354193282/8.0),
+    REAL_CONST(141818.00930637406/8.0),
+    REAL_CONST(141843.88437360956/8.0),
+    REAL_CONST(141869.760620927/8.0),
+    REAL_CONST(141895.6380482188/8.0),
+    REAL_CONST(141921.51665537735/8.0),
+    REAL_CONST(141947.39644229505/8.0),
+    REAL_CONST(141973.27740886438/8.0),
+    REAL_CONST(141999.15955497778/8.0),
+    REAL_CONST(142025.04288052776/8.0),
+    REAL_CONST(142050.92738540689/8.0),
+    REAL_CONST(142076.81306950765/8.0),
+    REAL_CONST(142102.69993272264/8.0),
+    REAL_CONST(142128.58797494444/8.0),
+    REAL_CONST(142154.47719606571/8.0),
+    REAL_CONST(142180.36759597904/8.0),
+    REAL_CONST(142206.25917457714/8.0),
+    REAL_CONST(142232.15193175265/8.0),
+    REAL_CONST(142258.04586739838/8.0),
+    REAL_CONST(142283.94098140698/8.0),
+    REAL_CONST(142309.83727367126/8.0),
+    REAL_CONST(142335.73474408401/8.0),
+    REAL_CONST(142361.63339253806/8.0),
+    REAL_CONST(142387.5332189262/8.0),
+    REAL_CONST(142413.43422314132/8.0),
+    REAL_CONST(142439.33640507635/8.0),
+    REAL_CONST(142465.23976462413/8.0),
+    REAL_CONST(142491.14430167765/8.0),
+    REAL_CONST(142517.05001612983/8.0),
+    REAL_CONST(142542.95690787368/8.0),
+    REAL_CONST(142568.86497680223/8.0),
+    REAL_CONST(142594.77422280848/8.0),
+    REAL_CONST(142620.68464578551/8.0),
+    REAL_CONST(142646.5962456264/8.0),
+    REAL_CONST(142672.50902222423/8.0),
+    REAL_CONST(142698.42297547215/8.0),
+    REAL_CONST(142724.33810526333/8.0),
+    REAL_CONST(142750.25441149093/8.0),
+    REAL_CONST(142776.17189404817/8.0),
+    REAL_CONST(142802.09055282827/8.0),
+    REAL_CONST(142828.01038772447/8.0),
+    REAL_CONST(142853.93139863008/8.0),
+    REAL_CONST(142879.85358543837/8.0),
+    REAL_CONST(142905.77694804268/8.0),
+    REAL_CONST(142931.70148633636/8.0),
+    REAL_CONST(142957.62720021277/8.0),
+    REAL_CONST(142983.55408956532/8.0),
+    REAL_CONST(143009.48215428743/8.0),
+    REAL_CONST(143035.41139427255/8.0),
+    REAL_CONST(143061.34180941415/8.0),
+    REAL_CONST(143087.27339960571/8.0),
+    REAL_CONST(143113.20616474075/8.0),
+    REAL_CONST(143139.14010471283/8.0),
+    REAL_CONST(143165.07521941551/8.0),
+    REAL_CONST(143191.01150874238/8.0),
+    REAL_CONST(143216.94897258704/8.0),
+    REAL_CONST(143242.88761084314/8.0),
+    REAL_CONST(143268.82742340435/8.0),
+    REAL_CONST(143294.76841016437/8.0),
+    REAL_CONST(143320.71057101688/8.0),
+    REAL_CONST(143346.65390585564/8.0),
+    REAL_CONST(143372.59841457437/8.0),
+    REAL_CONST(143398.54409706692/8.0),
+    REAL_CONST(143424.49095322701/8.0),
+    REAL_CONST(143450.43898294857/8.0),
+    REAL_CONST(143476.38818612538/8.0),
+    REAL_CONST(143502.33856265133/8.0),
+    REAL_CONST(143528.29011242036/8.0),
+    REAL_CONST(143554.24283532638/8.0),
+    REAL_CONST(143580.19673126334/8.0),
+    REAL_CONST(143606.1518001252/8.0),
+    REAL_CONST(143632.10804180597/8.0),
+    REAL_CONST(143658.06545619969/8.0),
+    REAL_CONST(143684.02404320039/8.0),
+    REAL_CONST(143709.98380270213/8.0),
+    REAL_CONST(143735.944734599/8.0),
+    REAL_CONST(143761.90683878519/8.0),
+    REAL_CONST(143787.87011515474/8.0),
+    REAL_CONST(143813.83456360188/8.0),
+    REAL_CONST(143839.8001840208/8.0),
+    REAL_CONST(143865.76697630569/8.0),
+    REAL_CONST(143891.73494035081/8.0),
+    REAL_CONST(143917.7040760504/8.0),
+    REAL_CONST(143943.67438329876/8.0),
+    REAL_CONST(143969.6458619902/8.0),
+    REAL_CONST(143995.61851201905/8.0),
+    REAL_CONST(144021.59233327967/8.0),
+    REAL_CONST(144047.56732566646/8.0),
+    REAL_CONST(144073.54348907378/8.0),
+    REAL_CONST(144099.52082339607/8.0),
+    REAL_CONST(144125.49932852783/8.0),
+    REAL_CONST(144151.4790043635/8.0),
+    REAL_CONST(144177.45985079758/8.0),
+    REAL_CONST(144203.44186772458/8.0),
+    REAL_CONST(144229.42505503909/8.0),
+    REAL_CONST(144255.40941263564/8.0),
+    REAL_CONST(144281.39494040885/8.0),
+    REAL_CONST(144307.38163825331/8.0),
+    REAL_CONST(144333.36950606373/8.0),
+    REAL_CONST(144359.35854373468/8.0),
+    REAL_CONST(144385.34875116093/8.0),
+    REAL_CONST(144411.34012823718/8.0),
+    REAL_CONST(144437.33267485813/8.0),
+    REAL_CONST(144463.32639091855/8.0),
+    REAL_CONST(144489.32127631325/8.0),
+    REAL_CONST(144515.31733093705/8.0),
+    REAL_CONST(144541.31455468474/8.0),
+    REAL_CONST(144567.3129474512/8.0),
+    REAL_CONST(144593.3125091313/8.0),
+    REAL_CONST(144619.31323961995/8.0),
+    REAL_CONST(144645.31513881206/8.0),
+    REAL_CONST(144671.31820660262/8.0),
+    REAL_CONST(144697.32244288657/8.0),
+    REAL_CONST(144723.32784755889/8.0),
+    REAL_CONST(144749.33442051467/8.0),
+    REAL_CONST(144775.34216164888/8.0),
+    REAL_CONST(144801.35107085665/8.0),
+    REAL_CONST(144827.36114803303/8.0),
+    REAL_CONST(144853.37239307314/8.0),
+    REAL_CONST(144879.38480587213/8.0),
+    REAL_CONST(144905.39838632516/8.0),
+    REAL_CONST(144931.41313432742/8.0),
+    REAL_CONST(144957.4290497741/8.0),
+    REAL_CONST(144983.44613256046/8.0),
+    REAL_CONST(145009.46438258173/8.0),
+    REAL_CONST(145035.48379973322/8.0),
+    REAL_CONST(145061.50438391021/8.0),
+    REAL_CONST(145087.52613500805/8.0),
+    REAL_CONST(145113.54905292206/8.0),
+    REAL_CONST(145139.57313754765/8.0),
+    REAL_CONST(145165.59838878017/8.0),
+    REAL_CONST(145191.62480651509/8.0),
+    REAL_CONST(145217.65239064783/8.0),
+    REAL_CONST(145243.68114107384/8.0),
+    REAL_CONST(145269.71105768863/8.0),
+    REAL_CONST(145295.74214038774/8.0),
+    REAL_CONST(145321.77438906668/8.0),
+    REAL_CONST(145347.80780362099/8.0),
+    REAL_CONST(145373.84238394629/8.0),
+    REAL_CONST(145399.87812993818/8.0),
+    REAL_CONST(145425.91504149229/8.0),
+    REAL_CONST(145451.95311850426/8.0),
+    REAL_CONST(145477.9923608698/8.0),
+    REAL_CONST(145504.03276848458/8.0),
+    REAL_CONST(145530.07434124436/8.0),
+    REAL_CONST(145556.11707904484/8.0),
+    REAL_CONST(145582.16098178181/8.0),
+    REAL_CONST(145608.20604935108/8.0),
+    REAL_CONST(145634.25228164849/8.0),
+    REAL_CONST(145660.29967856981/8.0),
+    REAL_CONST(145686.34824001096/8.0),
+    REAL_CONST(145712.39796586783/8.0),
+    REAL_CONST(145738.4488560363/8.0),
+    REAL_CONST(145764.50091041232/8.0),
+    REAL_CONST(145790.55412889185/8.0),
+    REAL_CONST(145816.60851137087/8.0),
+    REAL_CONST(145842.66405774537/8.0),
+    REAL_CONST(145868.72076791141/8.0),
+    REAL_CONST(145894.77864176501/8.0),
+    REAL_CONST(145920.83767920226/8.0),
+    REAL_CONST(145946.89788011924/8.0),
+    REAL_CONST(145972.95924441208/8.0),
+    REAL_CONST(145999.02177197693/8.0),
+    REAL_CONST(146025.08546270995/8.0),
+    REAL_CONST(146051.15031650732/8.0),
+    REAL_CONST(146077.21633326527/8.0),
+    REAL_CONST(146103.28351288004/8.0),
+    REAL_CONST(146129.35185524789/8.0),
+    REAL_CONST(146155.42136026506/8.0),
+    REAL_CONST(146181.49202782792/8.0),
+    REAL_CONST(146207.56385783272/8.0),
+    REAL_CONST(146233.63685017588/8.0),
+    REAL_CONST(146259.71100475377/8.0),
+    REAL_CONST(146285.78632146274/8.0),
+    REAL_CONST(146311.86280019928/8.0),
+    REAL_CONST(146337.94044085976/8.0),
+    REAL_CONST(146364.01924334071/8.0),
+    REAL_CONST(146390.09920753856/8.0),
+    REAL_CONST(146416.18033334985/8.0),
+    REAL_CONST(146442.26262067116/8.0),
+    REAL_CONST(146468.34606939898/8.0),
+    REAL_CONST(146494.43067942993/8.0),
+    REAL_CONST(146520.51645066062/8.0),
+    REAL_CONST(146546.60338298764/8.0),
+    REAL_CONST(146572.69147630769/8.0),
+    REAL_CONST(146598.78073051744/8.0),
+    REAL_CONST(146624.87114551352/8.0),
+    REAL_CONST(146650.96272119274/8.0),
+    REAL_CONST(146677.05545745179/8.0),
+    REAL_CONST(146703.14935418745/8.0),
+    REAL_CONST(146729.2444112965/8.0),
+    REAL_CONST(146755.34062867577/8.0),
+    REAL_CONST(146781.43800622207/8.0),
+    REAL_CONST(146807.53654383228/8.0),
+    REAL_CONST(146833.63624140329/8.0),
+    REAL_CONST(146859.73709883197/8.0),
+    REAL_CONST(146885.83911601527/8.0),
+    REAL_CONST(146911.94229285014/8.0),
+    REAL_CONST(146938.04662923355/8.0),
+    REAL_CONST(146964.15212506248/8.0),
+    REAL_CONST(146990.25878023397/8.0),
+    REAL_CONST(147016.36659464505/8.0),
+    REAL_CONST(147042.47556819281/8.0),
+    REAL_CONST(147068.58570077427/8.0),
+    REAL_CONST(147094.6969922866/8.0),
+    REAL_CONST(147120.80944262692/8.0),
+    REAL_CONST(147146.92305169237/8.0),
+    REAL_CONST(147173.03781938017/8.0),
+    REAL_CONST(147199.15374558745/8.0),
+    REAL_CONST(147225.27083021149/8.0),
+    REAL_CONST(147251.38907314953/8.0),
+    REAL_CONST(147277.50847429881/8.0),
+    REAL_CONST(147303.62903355664/8.0),
+    REAL_CONST(147329.75075082036/8.0),
+    REAL_CONST(147355.87362598727/8.0),
+    REAL_CONST(147381.99765895473/8.0),
+    REAL_CONST(147408.12284962015/8.0),
+    REAL_CONST(147434.24919788091/8.0),
+    REAL_CONST(147460.37670363448/8.0),
+    REAL_CONST(147486.50536677826/8.0),
+    REAL_CONST(147512.63518720976/8.0),
+    REAL_CONST(147538.76616482646/8.0),
+    REAL_CONST(147564.89829952587/8.0),
+    REAL_CONST(147591.03159120557/8.0),
+    REAL_CONST(147617.16603976308/8.0),
+    REAL_CONST(147643.30164509601/8.0),
+    REAL_CONST(147669.43840710199/8.0),
+    REAL_CONST(147695.57632567859/8.0),
+    REAL_CONST(147721.71540072354/8.0),
+    REAL_CONST(147747.85563213445/8.0),
+    REAL_CONST(147773.99701980909/8.0),
+    REAL_CONST(147800.13956364512/8.0),
+    REAL_CONST(147826.28326354033/8.0),
+    REAL_CONST(147852.42811939248/8.0),
+    REAL_CONST(147878.57413109933/8.0),
+    REAL_CONST(147904.72129855872/8.0),
+    REAL_CONST(147930.86962166851/8.0),
+    REAL_CONST(147957.01910032652/8.0),
+    REAL_CONST(147983.16973443062/8.0),
+    REAL_CONST(148009.32152387875/8.0),
+    REAL_CONST(148035.47446856883/8.0),
+    REAL_CONST(148061.62856839882/8.0),
+    REAL_CONST(148087.78382326665/8.0),
+    REAL_CONST(148113.94023307035/8.0),
+    REAL_CONST(148140.09779770792/8.0),
+    REAL_CONST(148166.25651707739/8.0),
+    REAL_CONST(148192.41639107687/8.0),
+    REAL_CONST(148218.57741960438/8.0),
+    REAL_CONST(148244.73960255808/8.0),
+    REAL_CONST(148270.90293983606/8.0),
+    REAL_CONST(148297.0674313365/8.0),
+    REAL_CONST(148323.23307695755/8.0),
+    REAL_CONST(148349.39987659742/8.0),
+    REAL_CONST(148375.56783015432/8.0),
+    REAL_CONST(148401.73693752653/8.0),
+    REAL_CONST(148427.90719861226/8.0),
+    REAL_CONST(148454.07861330983/8.0),
+    REAL_CONST(148480.25118151752/8.0),
+    REAL_CONST(148506.42490313368/8.0),
+    REAL_CONST(148532.59977805667/8.0),
+    REAL_CONST(148558.77580618486/8.0),
+    REAL_CONST(148584.95298741665/8.0),
+    REAL_CONST(148611.13132165043/8.0),
+    REAL_CONST(148637.31080878471/8.0),
+    REAL_CONST(148663.49144871789/8.0),
+    REAL_CONST(148689.6732413485/8.0),
+    REAL_CONST(148715.85618657502/8.0),
+    REAL_CONST(148742.040284296/8.0),
+    REAL_CONST(148768.22553440998/8.0),
+    REAL_CONST(148794.41193681557/8.0),
+    REAL_CONST(148820.59949141133/8.0),
+    REAL_CONST(148846.78819809589/8.0),
+    REAL_CONST(148872.97805676793/8.0),
+    REAL_CONST(148899.16906732606/8.0),
+    REAL_CONST(148925.36122966901/8.0),
+    REAL_CONST(148951.55454369547/8.0),
+    REAL_CONST(148977.74900930419/8.0),
+    REAL_CONST(149003.9446263939/8.0),
+    REAL_CONST(149030.1413948634/8.0),
+    REAL_CONST(149056.33931461151/8.0),
+    REAL_CONST(149082.53838553699/8.0),
+    REAL_CONST(149108.73860753875/8.0),
+    REAL_CONST(149134.9399805156/8.0),
+    REAL_CONST(149161.14250436646/8.0),
+    REAL_CONST(149187.34617899026/8.0),
+    REAL_CONST(149213.5510042859/8.0),
+    REAL_CONST(149239.75698015234/8.0),
+    REAL_CONST(149265.96410648854/8.0),
+    REAL_CONST(149292.17238319354/8.0),
+    REAL_CONST(149318.38181016635/8.0),
+    REAL_CONST(149344.59238730598/8.0),
+    REAL_CONST(149370.80411451156/8.0),
+    REAL_CONST(149397.01699168212/8.0),
+    REAL_CONST(149423.23101871679/8.0),
+    REAL_CONST(149449.44619551473/8.0),
+    REAL_CONST(149475.66252197503/8.0),
+    REAL_CONST(149501.87999799693/8.0),
+    REAL_CONST(149528.0986234796/8.0),
+    REAL_CONST(149554.31839832227/8.0),
+    REAL_CONST(149580.53932242419/8.0),
+    REAL_CONST(149606.76139568459/8.0),
+    REAL_CONST(149632.98461800278/8.0),
+    REAL_CONST(149659.20898927809/8.0),
+    REAL_CONST(149685.43450940982/8.0),
+    REAL_CONST(149711.66117829733/8.0),
+    REAL_CONST(149737.88899584001/8.0),
+    REAL_CONST(149764.11796193724/8.0),
+    REAL_CONST(149790.34807648844/8.0),
+    REAL_CONST(149816.57933939309/8.0),
+    REAL_CONST(149842.81175055061/8.0),
+    REAL_CONST(149869.04530986046/8.0),
+    REAL_CONST(149895.28001722222/8.0),
+    REAL_CONST(149921.51587253538/8.0),
+    REAL_CONST(149947.75287569952/8.0),
+    REAL_CONST(149973.99102661415/8.0),
+    REAL_CONST(150000.23032517891/8.0),
+    REAL_CONST(150026.47077129342/8.0),
+    REAL_CONST(150052.71236485732/8.0),
+    REAL_CONST(150078.95510577026/8.0),
+    REAL_CONST(150105.1989939319/8.0),
+    REAL_CONST(150131.444029242/8.0),
+    REAL_CONST(150157.69021160025/8.0),
+    REAL_CONST(150183.93754090639/8.0),
+    REAL_CONST(150210.18601706024/8.0),
+    REAL_CONST(150236.43563996154/8.0),
+    REAL_CONST(150262.68640951012/8.0),
+    REAL_CONST(150288.93832560582/8.0),
+    REAL_CONST(150315.19138814852/8.0),
+    REAL_CONST(150341.44559703805/8.0),
+    REAL_CONST(150367.70095217437/8.0),
+    REAL_CONST(150393.95745345735/8.0),
+    REAL_CONST(150420.21510078697/8.0),
+    REAL_CONST(150446.47389406321/8.0),
+    REAL_CONST(150472.73383318601/8.0),
+    REAL_CONST(150498.99491805542/8.0),
+    REAL_CONST(150525.25714857146/8.0),
+    REAL_CONST(150551.52052463419/8.0),
+    REAL_CONST(150577.78504614369/8.0),
+    REAL_CONST(150604.05071300003/8.0),
+    REAL_CONST(150630.31752510337/8.0),
+    REAL_CONST(150656.58548235384/8.0),
+    REAL_CONST(150682.85458465159/8.0),
+    REAL_CONST(150709.1248318968/8.0),
+    REAL_CONST(150735.39622398972/8.0),
+    REAL_CONST(150761.66876083051/8.0),
+    REAL_CONST(150787.9424423195/8.0),
+    REAL_CONST(150814.21726835691/8.0),
+    REAL_CONST(150840.49323884305/8.0),
+    REAL_CONST(150866.77035367821/8.0),
+    REAL_CONST(150893.04861276277/8.0),
+    REAL_CONST(150919.32801599705/8.0),
+    REAL_CONST(150945.60856328148/8.0),
+    REAL_CONST(150971.89025451642/8.0),
+    REAL_CONST(150998.17308960229/8.0),
+    REAL_CONST(151024.45706843957/8.0),
+    REAL_CONST(151050.74219092872/8.0),
+    REAL_CONST(151077.02845697021/8.0),
+    REAL_CONST(151103.31586646455/8.0),
+    REAL_CONST(151129.60441931229/8.0),
+    REAL_CONST(151155.894115414/8.0),
+    REAL_CONST(151182.1849546702/8.0),
+    REAL_CONST(151208.47693698155/8.0),
+    REAL_CONST(151234.77006224863/8.0),
+    REAL_CONST(151261.06433037209/8.0),
+    REAL_CONST(151287.35974125259/8.0),
+    REAL_CONST(151313.65629479082/8.0),
+    REAL_CONST(151339.95399088747/8.0),
+    REAL_CONST(151366.25282944329/8.0),
+    REAL_CONST(151392.55281035902/8.0),
+    REAL_CONST(151418.85393353543/8.0),
+    REAL_CONST(151445.1561988733/8.0),
+    REAL_CONST(151471.45960627345/8.0),
+    REAL_CONST(151497.76415563675/8.0),
+    REAL_CONST(151524.06984686397/8.0),
+    REAL_CONST(151550.37667985607/8.0),
+    REAL_CONST(151576.68465451393/8.0),
+    REAL_CONST(151602.99377073845/8.0),
+    REAL_CONST(151629.30402843058/8.0),
+    REAL_CONST(151655.61542749128/8.0),
+    REAL_CONST(151681.92796782157/8.0),
+    REAL_CONST(151708.24164932242/8.0),
+    REAL_CONST(151734.55647189484/8.0),
+    REAL_CONST(151760.87243543993/8.0),
+    REAL_CONST(151787.18953985872/8.0),
+    REAL_CONST(151813.50778505235/8.0),
+    REAL_CONST(151839.82717092187/8.0),
+    REAL_CONST(151866.14769736846/8.0),
+    REAL_CONST(151892.46936429327/8.0),
+    REAL_CONST(151918.79217159748/8.0),
+    REAL_CONST(151945.11611918229/8.0),
+    REAL_CONST(151971.44120694889/8.0),
+    REAL_CONST(151997.76743479856/8.0),
+    REAL_CONST(152024.09480263255/8.0),
+    REAL_CONST(152050.42331035214/8.0),
+    REAL_CONST(152076.75295785864/8.0),
+    REAL_CONST(152103.08374505339/8.0),
+    REAL_CONST(152129.41567183775/8.0),
+    REAL_CONST(152155.74873811303/8.0),
+    REAL_CONST(152182.08294378067/8.0),
+    REAL_CONST(152208.41828874208/8.0),
+    REAL_CONST(152234.75477289871/8.0),
+    REAL_CONST(152261.09239615197/8.0),
+    REAL_CONST(152287.43115840337/8.0),
+    REAL_CONST(152313.77105955439/8.0),
+    REAL_CONST(152340.11209950657/8.0),
+    REAL_CONST(152366.45427816146/8.0),
+    REAL_CONST(152392.79759542056/8.0),
+    REAL_CONST(152419.14205118554/8.0),
+    REAL_CONST(152445.48764535793/8.0),
+    REAL_CONST(152471.8343778394/8.0),
+    REAL_CONST(152498.18224853161/8.0),
+    REAL_CONST(152524.53125733617/8.0),
+    REAL_CONST(152550.88140415482/8.0),
+    REAL_CONST(152577.23268888926/8.0),
+    REAL_CONST(152603.58511144121/8.0),
+    REAL_CONST(152629.93867171241/8.0),
+    REAL_CONST(152656.29336960468/8.0),
+    REAL_CONST(152682.64920501978/8.0),
+    REAL_CONST(152709.00617785956/8.0),
+    REAL_CONST(152735.36428802583/8.0),
+    REAL_CONST(152761.72353542043/8.0),
+    REAL_CONST(152788.08391994529/8.0),
+    REAL_CONST(152814.44544150229/8.0),
+    REAL_CONST(152840.80809999333/8.0),
+    REAL_CONST(152867.17189532038/8.0),
+    REAL_CONST(152893.53682738543/8.0),
+    REAL_CONST(152919.90289609041/8.0),
+    REAL_CONST(152946.27010133737/8.0),
+    REAL_CONST(152972.63844302832/8.0),
+    REAL_CONST(152999.00792106529/8.0),
+    REAL_CONST(153025.37853535041/8.0),
+    REAL_CONST(153051.7502857857/8.0),
+    REAL_CONST(153078.12317227334/8.0),
+    REAL_CONST(153104.4971947154/8.0),
+    REAL_CONST(153130.8723530141/8.0),
+    REAL_CONST(153157.24864707157/8.0),
+    REAL_CONST(153183.62607679001/8.0),
+    REAL_CONST(153210.00464207167/8.0),
+    REAL_CONST(153236.38434281875/8.0),
+    REAL_CONST(153262.76517893354/8.0),
+    REAL_CONST(153289.14715031831/8.0),
+    REAL_CONST(153315.53025687535/8.0),
+    REAL_CONST(153341.91449850702/8.0),
+    REAL_CONST(153368.2998751156/8.0),
+    REAL_CONST(153394.68638660354/8.0),
+    REAL_CONST(153421.07403287315/8.0),
+    REAL_CONST(153447.46281382689/8.0),
+    REAL_CONST(153473.85272936718/8.0),
+    REAL_CONST(153500.24377939643/8.0),
+    REAL_CONST(153526.63596381716/8.0),
+    REAL_CONST(153553.02928253182/8.0),
+    REAL_CONST(153579.42373544298/8.0),
+    REAL_CONST(153605.81932245308/8.0),
+    REAL_CONST(153632.21604346478/8.0),
+    REAL_CONST(153658.61389838057/8.0),
+    REAL_CONST(153685.0128871031/8.0),
+    REAL_CONST(153711.41300953497/8.0),
+    REAL_CONST(153737.81426557881/8.0),
+    REAL_CONST(153764.21665513728/8.0),
+    REAL_CONST(153790.62017811305/8.0),
+    REAL_CONST(153817.02483440886/8.0),
+    REAL_CONST(153843.43062392739/8.0),
+    REAL_CONST(153869.83754657139/8.0),
+    REAL_CONST(153896.24560224367/8.0),
+    REAL_CONST(153922.65479084692/8.0),
+    REAL_CONST(153949.06511228404/8.0),
+    REAL_CONST(153975.4765664578/8.0),
+    REAL_CONST(154001.88915327107/8.0),
+    REAL_CONST(154028.30287262669/8.0),
+    REAL_CONST(154054.71772442761/8.0),
+    REAL_CONST(154081.13370857667/8.0),
+    REAL_CONST(154107.55082497682/8.0),
+    REAL_CONST(154133.96907353101/8.0),
+    REAL_CONST(154160.38845414223/8.0),
+    REAL_CONST(154186.80896671346/8.0),
+    REAL_CONST(154213.23061114774/8.0),
+    REAL_CONST(154239.65338734805/8.0),
+    REAL_CONST(154266.07729521746/8.0),
+    REAL_CONST(154292.50233465908/8.0),
+    REAL_CONST(154318.92850557598/8.0),
+    REAL_CONST(154345.35580787127/8.0),
+    REAL_CONST(154371.7842414481/8.0),
+    REAL_CONST(154398.21380620965/8.0),
+    REAL_CONST(154424.64450205903/8.0),
+    REAL_CONST(154451.07632889951/8.0),
+    REAL_CONST(154477.50928663427/8.0),
+    REAL_CONST(154503.94337516659/8.0),
+    REAL_CONST(154530.37859439969/8.0),
+    REAL_CONST(154556.81494423689/8.0),
+    REAL_CONST(154583.25242458144/8.0),
+    REAL_CONST(154609.69103533673/8.0),
+    REAL_CONST(154636.13077640603/8.0),
+    REAL_CONST(154662.57164769279/8.0),
+    REAL_CONST(154689.01364910032/8.0),
+    REAL_CONST(154715.45678053208/8.0),
+    REAL_CONST(154741.90104189145/8.0),
+    REAL_CONST(154768.34643308193/8.0),
+    REAL_CONST(154794.79295400696/8.0),
+    REAL_CONST(154821.24060457002/8.0),
+    REAL_CONST(154847.68938467462/8.0),
+    REAL_CONST(154874.13929422433/8.0),
+    REAL_CONST(154900.59033312264/8.0),
+    REAL_CONST(154927.04250127316/8.0),
+    REAL_CONST(154953.49579857948/8.0),
+    REAL_CONST(154979.95022494521/8.0),
+    REAL_CONST(155006.40578027396/8.0),
+    REAL_CONST(155032.86246446942/8.0),
+    REAL_CONST(155059.32027743524/8.0),
+    REAL_CONST(155085.77921907514/8.0),
+    REAL_CONST(155112.2392892928/8.0),
+    REAL_CONST(155138.70048799197/8.0),
+    REAL_CONST(155165.16281507642/8.0),
+    REAL_CONST(155191.62627044989/8.0),
+    REAL_CONST(155218.09085401625/8.0),
+    REAL_CONST(155244.55656567923/8.0),
+    REAL_CONST(155271.02340534274/8.0),
+    REAL_CONST(155297.49137291059/8.0),
+    REAL_CONST(155323.96046828668/8.0),
+    REAL_CONST(155350.4306913749/8.0),
+    REAL_CONST(155376.90204207919/8.0),
+    REAL_CONST(155403.37452030348/8.0),
+    REAL_CONST(155429.84812595171/8.0),
+    REAL_CONST(155456.32285892789/8.0),
+    REAL_CONST(155482.79871913602/8.0),
+    REAL_CONST(155509.27570648011/8.0),
+    REAL_CONST(155535.75382086422/8.0),
+    REAL_CONST(155562.23306219239/8.0),
+    REAL_CONST(155588.71343036872/8.0),
+    REAL_CONST(155615.19492529731/8.0),
+    REAL_CONST(155641.67754688227/8.0),
+    REAL_CONST(155668.16129502779/8.0),
+    REAL_CONST(155694.64616963797/8.0),
+    REAL_CONST(155721.13217061706/8.0),
+    REAL_CONST(155747.61929786921/8.0),
+    REAL_CONST(155774.10755129869/8.0),
+    REAL_CONST(155800.59693080973/8.0),
+    REAL_CONST(155827.08743630661/8.0),
+    REAL_CONST(155853.57906769359/8.0),
+    REAL_CONST(155880.07182487496/8.0),
+    REAL_CONST(155906.56570775513/8.0),
+    REAL_CONST(155933.06071623837/8.0),
+    REAL_CONST(155959.55685022907/8.0),
+    REAL_CONST(155986.05410963166/8.0),
+    REAL_CONST(156012.5524943505/8.0),
+    REAL_CONST(156039.05200429002/8.0),
+    REAL_CONST(156065.55263935472/8.0),
+    REAL_CONST(156092.054399449/8.0),
+    REAL_CONST(156118.5572844774/8.0),
+    REAL_CONST(156145.06129434443/8.0),
+    REAL_CONST(156171.5664289546/8.0),
+    REAL_CONST(156198.07268821247/8.0),
+    REAL_CONST(156224.5800720226/8.0),
+    REAL_CONST(156251.08858028959/8.0),
+    REAL_CONST(156277.59821291809/8.0),
+    REAL_CONST(156304.10896981266/8.0),
+    REAL_CONST(156330.62085087801/8.0),
+    REAL_CONST(156357.1338560188/8.0),
+    REAL_CONST(156383.64798513969/8.0),
+    REAL_CONST(156410.16323814544/8.0),
+    REAL_CONST(156436.67961494075/8.0),
+    REAL_CONST(156463.1971154304/8.0),
+    REAL_CONST(156489.71573951913/8.0),
+    REAL_CONST(156516.23548711176/8.0),
+    REAL_CONST(156542.75635811311/8.0),
+    REAL_CONST(156569.27835242799/8.0),
+    REAL_CONST(156595.80146996127/8.0),
+    REAL_CONST(156622.32571061782/8.0),
+    REAL_CONST(156648.85107430254/8.0),
+    REAL_CONST(156675.37756092031/8.0),
+    REAL_CONST(156701.90517037612/8.0),
+    REAL_CONST(156728.43390257491/8.0),
+    REAL_CONST(156754.96375742162/8.0),
+    REAL_CONST(156781.49473482129/8.0),
+    REAL_CONST(156808.02683467892/8.0),
+    REAL_CONST(156834.5600568995/8.0),
+    REAL_CONST(156861.09440138817/8.0),
+    REAL_CONST(156887.62986804993/8.0),
+    REAL_CONST(156914.16645678994/8.0),
+    REAL_CONST(156940.70416751326/8.0),
+    REAL_CONST(156967.24300012505/8.0),
+    REAL_CONST(156993.78295453047/8.0),
+    REAL_CONST(157020.32403063469/8.0),
+    REAL_CONST(157046.8662283429/8.0),
+    REAL_CONST(157073.40954756032/8.0),
+    REAL_CONST(157099.9539881922/8.0),
+    REAL_CONST(157126.49955014378/8.0),
+    REAL_CONST(157153.04623332032/8.0),
+    REAL_CONST(157179.59403762716/8.0),
+    REAL_CONST(157206.14296296958/8.0),
+    REAL_CONST(157232.69300925292/8.0),
+    REAL_CONST(157259.24417638258/8.0),
+    REAL_CONST(157285.79646426387/8.0),
+    REAL_CONST(157312.34987280221/8.0),
+    REAL_CONST(157338.90440190304/8.0),
+    REAL_CONST(157365.46005147175/8.0),
+    REAL_CONST(157392.01682141385/8.0),
+    REAL_CONST(157418.57471163478/8.0),
+    REAL_CONST(157445.13372204005/8.0),
+    REAL_CONST(157471.69385253513/8.0),
+    REAL_CONST(157498.25510302564/8.0),
+    REAL_CONST(157524.81747341706/8.0),
+    REAL_CONST(157551.38096361503/8.0),
+    REAL_CONST(157577.9455735251/8.0),
+    REAL_CONST(157604.51130305286/8.0),
+    REAL_CONST(157631.07815210402/8.0),
+    REAL_CONST(157657.64612058419/8.0),
+    REAL_CONST(157684.21520839902/8.0),
+    REAL_CONST(157710.78541545427/8.0),
+    REAL_CONST(157737.35674165559/8.0),
+    REAL_CONST(157763.92918690876/8.0),
+    REAL_CONST(157790.50275111952/8.0),
+    REAL_CONST(157817.07743419363/8.0),
+    REAL_CONST(157843.65323603692/8.0),
+    REAL_CONST(157870.23015655516/8.0),
+    REAL_CONST(157896.80819565422/8.0),
+    REAL_CONST(157923.3873532399/8.0),
+    REAL_CONST(157949.96762921812/8.0),
+    REAL_CONST(157976.54902349479/8.0),
+    REAL_CONST(158003.13153597576/8.0),
+    REAL_CONST(158029.71516656701/8.0),
+    REAL_CONST(158056.29991517449/8.0),
+    REAL_CONST(158082.88578170416/8.0),
+    REAL_CONST(158109.47276606198/8.0),
+    REAL_CONST(158136.06086815402/8.0),
+    REAL_CONST(158162.65008788629/8.0),
+    REAL_CONST(158189.24042516484/8.0),
+    REAL_CONST(158215.83187989573/8.0),
+    REAL_CONST(158242.42445198505/8.0),
+    REAL_CONST(158269.01814133892/8.0),
+    REAL_CONST(158295.61294786347/8.0),
+    REAL_CONST(158322.20887146486/8.0),
+    REAL_CONST(158348.80591204923/8.0),
+    REAL_CONST(158375.4040695228/8.0),
+    REAL_CONST(158402.00334379176/8.0),
+    REAL_CONST(158428.60373476235/8.0),
+    REAL_CONST(158455.2052423408/8.0),
+    REAL_CONST(158481.80786643337/8.0),
+    REAL_CONST(158508.41160694641/8.0),
+    REAL_CONST(158535.01646378616/8.0),
+    REAL_CONST(158561.62243685898/8.0),
+    REAL_CONST(158588.2295260712/8.0),
+    REAL_CONST(158614.8377313292/8.0),
+    REAL_CONST(158641.44705253936/8.0),
+    REAL_CONST(158668.05748960807/8.0),
+    REAL_CONST(158694.66904244179/8.0),
+    REAL_CONST(158721.28171094693/8.0),
+    REAL_CONST(158747.89549502998/8.0),
+    REAL_CONST(158774.5103945974/8.0),
+    REAL_CONST(158801.12640955573/8.0),
+    REAL_CONST(158827.74353981143/8.0),
+    REAL_CONST(158854.36178527112/8.0),
+    REAL_CONST(158880.9811458413/8.0),
+    REAL_CONST(158907.60162142856/8.0),
+    REAL_CONST(158934.22321193956/8.0),
+    REAL_CONST(158960.84591728085/8.0),
+    REAL_CONST(158987.46973735912/8.0),
+    REAL_CONST(159014.09467208097/8.0),
+    REAL_CONST(159040.72072135314/8.0),
+    REAL_CONST(159067.3478850823/8.0),
+    REAL_CONST(159093.97616317519/8.0),
+    REAL_CONST(159120.60555553852/8.0),
+    REAL_CONST(159147.23606207906/8.0),
+    REAL_CONST(159173.8676827036/8.0),
+    REAL_CONST(159200.50041731889/8.0),
+    REAL_CONST(159227.13426583182/8.0),
+    REAL_CONST(159253.76922814918/8.0),
+    REAL_CONST(159280.40530417781/8.0),
+    REAL_CONST(159307.04249382461/8.0),
+    REAL_CONST(159333.68079699649/8.0),
+    REAL_CONST(159360.32021360032/8.0),
+    REAL_CONST(159386.96074354305/8.0),
+    REAL_CONST(159413.60238673165/8.0),
+    REAL_CONST(159440.24514307309/8.0),
+    REAL_CONST(159466.88901247433/8.0),
+    REAL_CONST(159493.53399484244/8.0),
+    REAL_CONST(159520.18009008438/8.0),
+    REAL_CONST(159546.82729810724/8.0),
+    REAL_CONST(159573.47561881805/8.0),
+    REAL_CONST(159600.12505212394/8.0),
+    REAL_CONST(159626.77559793202/8.0),
+    REAL_CONST(159653.42725614941/8.0),
+    REAL_CONST(159680.08002668325/8.0),
+    REAL_CONST(159706.73390944069/8.0),
+    REAL_CONST(159733.38890432892/8.0),
+    REAL_CONST(159760.04501125516/8.0),
+    REAL_CONST(159786.70223012666/8.0),
+    REAL_CONST(159813.36056085059/8.0),
+    REAL_CONST(159840.02000333427/8.0),
+    REAL_CONST(159866.68055748497/8.0),
+    REAL_CONST(159893.34222320997/8.0),
+    REAL_CONST(159920.00500041663/8.0),
+    REAL_CONST(159946.66888901225/8.0),
+    REAL_CONST(159973.33388890422/8.0),
+    REAL_CONST(159999.99999999988/8.0),
+    REAL_CONST(160026.66722220668/8.0),
+    REAL_CONST(160053.33555543202/8.0),
+    REAL_CONST(160080.0049995833/8.0),
+    REAL_CONST(160106.67555456801/8.0),
+    REAL_CONST(160133.3472202936/8.0),
+    REAL_CONST(160160.0199966676/8.0),
+    REAL_CONST(160186.6938835975/8.0),
+    REAL_CONST(160213.36888099083/8.0),
+    REAL_CONST(160240.04498875517/8.0),
+    REAL_CONST(160266.72220679806/8.0),
+    REAL_CONST(160293.40053502709/8.0),
+    REAL_CONST(160320.07997334987/8.0),
+    REAL_CONST(160346.76052167406/8.0),
+    REAL_CONST(160373.44217990729/8.0),
+    REAL_CONST(160400.1249479572/8.0),
+    REAL_CONST(160426.80882573154/8.0),
+    REAL_CONST(160453.49381313793/8.0),
+    REAL_CONST(160480.17991008417/8.0),
+    REAL_CONST(160506.86711647795/8.0),
+    REAL_CONST(160533.55543222709/8.0),
+    REAL_CONST(160560.24485723933/8.0),
+    REAL_CONST(160586.93539142248/8.0),
+    REAL_CONST(160613.62703468435/8.0),
+    REAL_CONST(160640.31978693281/8.0),
+    REAL_CONST(160667.01364807569/8.0),
+    REAL_CONST(160693.70861802087/8.0),
+    REAL_CONST(160720.40469667627/8.0),
+    REAL_CONST(160747.1018839498/8.0),
+    REAL_CONST(160773.80017974938/8.0),
+    REAL_CONST(160800.49958398298/8.0),
+    REAL_CONST(160827.20009655855/8.0),
+    REAL_CONST(160853.90171738411/8.0),
+    REAL_CONST(160880.60444636765/8.0),
+    REAL_CONST(160907.30828341722/8.0),
+    REAL_CONST(160934.01322844089/8.0),
+    REAL_CONST(160960.71928134665/8.0),
+    REAL_CONST(160987.42644204266/8.0),
+    REAL_CONST(161014.13471043704/8.0),
+    REAL_CONST(161040.84408643784/8.0),
+    REAL_CONST(161067.55456995327/8.0),
+    REAL_CONST(161094.26616089148/8.0),
+    REAL_CONST(161120.97885916062/8.0),
+    REAL_CONST(161147.69266466892/8.0),
+    REAL_CONST(161174.40757732463/8.0),
+    REAL_CONST(161201.12359703594/8.0),
+    REAL_CONST(161227.84072371112/8.0),
+    REAL_CONST(161254.55895725847/8.0),
+    REAL_CONST(161281.27829758628/8.0),
+    REAL_CONST(161307.99874460287/8.0),
+    REAL_CONST(161334.72029821656/8.0),
+    REAL_CONST(161361.44295833571/8.0),
+    REAL_CONST(161388.1667248687/8.0),
+    REAL_CONST(161414.89159772391/8.0),
+    REAL_CONST(161441.61757680977/8.0),
+    REAL_CONST(161468.34466203468/8.0),
+    REAL_CONST(161495.07285330712/8.0),
+    REAL_CONST(161521.80215053557/8.0),
+    REAL_CONST(161548.53255362847/8.0),
+    REAL_CONST(161575.26406249436/8.0),
+    REAL_CONST(161601.99667704175/8.0),
+    REAL_CONST(161628.7303971792/8.0),
+    REAL_CONST(161655.46522281526/8.0),
+    REAL_CONST(161682.20115385848/8.0),
+    REAL_CONST(161708.93819021754/8.0),
+    REAL_CONST(161735.67633180099/8.0),
+    REAL_CONST(161762.41557851751/8.0),
+    REAL_CONST(161789.15593027571/8.0),
+    REAL_CONST(161815.89738698432/8.0),
+    REAL_CONST(161842.63994855201/8.0),
+    REAL_CONST(161869.38361488748/8.0),
+    REAL_CONST(161896.1283858995/8.0),
+    REAL_CONST(161922.87426149679/8.0),
+    REAL_CONST(161949.62124158812/8.0),
+    REAL_CONST(161976.36932608229/8.0),
+    REAL_CONST(162003.1185148881/8.0),
+    REAL_CONST(162029.8688079144/8.0),
+    REAL_CONST(162056.62020507001/8.0),
+    REAL_CONST(162083.37270626382/8.0),
+    REAL_CONST(162110.12631140469/8.0),
+    REAL_CONST(162136.88102040152/8.0),
+    REAL_CONST(162163.63683316324/8.0),
+    REAL_CONST(162190.39374959879/8.0),
+    REAL_CONST(162217.15176961714/8.0),
+    REAL_CONST(162243.91089312723/8.0),
+    REAL_CONST(162270.67112003808/8.0),
+    REAL_CONST(162297.43245025873/8.0),
+    REAL_CONST(162324.19488369819/8.0),
+    REAL_CONST(162350.9584202655/8.0),
+    REAL_CONST(162377.72305986975/8.0),
+    REAL_CONST(162404.48880242003/8.0),
+    REAL_CONST(162431.25564782543/8.0),
+    REAL_CONST(162458.02359599507/8.0),
+    REAL_CONST(162484.79264683815/8.0),
+    REAL_CONST(162511.56280026378/8.0),
+    REAL_CONST(162538.33405618116/8.0),
+    REAL_CONST(162565.10641449949/8.0),
+    REAL_CONST(162591.87987512801/8.0),
+    REAL_CONST(162618.65443797593/8.0),
+    REAL_CONST(162645.43010295252/8.0),
+    REAL_CONST(162672.20686996708/8.0),
+    REAL_CONST(162698.98473892888/8.0),
+    REAL_CONST(162725.76370974723/8.0),
+    REAL_CONST(162752.54378233149/8.0),
+    REAL_CONST(162779.32495659095/8.0),
+    REAL_CONST(162806.10723243505/8.0),
+    REAL_CONST(162832.89060977317/8.0),
+    REAL_CONST(162859.67508851466/8.0),
+    REAL_CONST(162886.46066856899/8.0),
+    REAL_CONST(162913.24734984562/8.0),
+    REAL_CONST(162940.03513225398/8.0),
+    REAL_CONST(162966.82401570358/8.0),
+    REAL_CONST(162993.6140001039/8.0),
+    REAL_CONST(163020.40508536444/8.0),
+    REAL_CONST(163047.19727139481/8.0),
+    REAL_CONST(163073.99055810447/8.0),
+    REAL_CONST(163100.78494540305/8.0),
+    REAL_CONST(163127.58043320014/8.0),
+    REAL_CONST(163154.37702140535/8.0),
+    REAL_CONST(163181.17470992831/8.0),
+    REAL_CONST(163207.97349867865/8.0),
+    REAL_CONST(163234.77338756606/8.0),
+    REAL_CONST(163261.57437650024/8.0),
+    REAL_CONST(163288.37646539087/8.0),
+    REAL_CONST(163315.17965414765/8.0),
+    REAL_CONST(163341.98394268038/8.0),
+    REAL_CONST(163368.78933089875/8.0),
+    REAL_CONST(163395.59581871261/8.0),
+    REAL_CONST(163422.40340603172/8.0),
+    REAL_CONST(163449.2120927659/8.0),
+    REAL_CONST(163476.02187882498/8.0),
+    REAL_CONST(163502.83276411882/8.0),
+    REAL_CONST(163529.6447485573/8.0),
+    REAL_CONST(163556.45783205028/8.0),
+    REAL_CONST(163583.2720145077/8.0),
+    REAL_CONST(163610.08729583945/8.0),
+    REAL_CONST(163636.90367595552/8.0),
+    REAL_CONST(163663.72115476584/8.0),
+    REAL_CONST(163690.53973218042/8.0),
+    REAL_CONST(163717.35940810922/8.0),
+    REAL_CONST(163744.18018246227/8.0),
+    REAL_CONST(163771.00205514964/8.0),
+    REAL_CONST(163797.82502608138/8.0),
+    REAL_CONST(163824.64909516752/8.0),
+    REAL_CONST(163851.4742623182/8.0),
+    REAL_CONST(163878.3005274435/8.0),
+    REAL_CONST(163905.12789045356/8.0),
+    REAL_CONST(163931.95635125853/8.0),
+    REAL_CONST(163958.78590976857/8.0),
+    REAL_CONST(163985.61656589387/8.0),
+    REAL_CONST(164012.44831954464/8.0),
+    REAL_CONST(164039.28117063109/8.0),
+    REAL_CONST(164066.11511906344/8.0),
+    REAL_CONST(164092.95016475199/8.0),
+    REAL_CONST(164119.78630760699/8.0),
+    REAL_CONST(164146.62354753874/8.0),
+    REAL_CONST(164173.46188445756/8.0),
+    REAL_CONST(164200.30131827376/8.0),
+    REAL_CONST(164227.14184889771/8.0),
+    REAL_CONST(164253.98347623978/8.0),
+    REAL_CONST(164280.82620021031/8.0),
+    REAL_CONST(164307.67002071979/8.0),
+    REAL_CONST(164334.51493767856/8.0),
+    REAL_CONST(164361.3609509971/8.0),
+    REAL_CONST(164388.20806058586/8.0),
+    REAL_CONST(164415.05626635533/8.0),
+    REAL_CONST(164441.905568216/8.0),
+    REAL_CONST(164468.75596607837/8.0),
+    REAL_CONST(164495.607459853/8.0),
+    REAL_CONST(164522.4600494504/8.0),
+    REAL_CONST(164549.31373478117/8.0),
+    REAL_CONST(164576.16851575591/8.0),
+    REAL_CONST(164603.02439228518/8.0),
+    REAL_CONST(164629.88136427966/8.0),
+    REAL_CONST(164656.73943164994/8.0),
+    REAL_CONST(164683.59859430668/8.0),
+    REAL_CONST(164710.45885216061/8.0),
+    REAL_CONST(164737.32020512238/8.0),
+    REAL_CONST(164764.1826531027/8.0),
+    REAL_CONST(164791.04619601235/8.0),
+    REAL_CONST(164817.91083376206/8.0),
+    REAL_CONST(164844.77656626256/8.0),
+    REAL_CONST(164871.64339342469/8.0),
+    REAL_CONST(164898.51131515924/8.0),
+    REAL_CONST(164925.38033137703/8.0),
+    REAL_CONST(164952.25044198887/8.0),
+    REAL_CONST(164979.1216469057/8.0),
+    REAL_CONST(165005.9939460383/8.0),
+    REAL_CONST(165032.86733929763/8.0),
+    REAL_CONST(165059.7418265946/8.0),
+    REAL_CONST(165086.61740784015/8.0),
+    REAL_CONST(165113.4940829452/8.0)
+#endif
 };
 
 #endif
--- a/Plugins/Input/aac/libfaad2/is.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/is.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: is.c,v 1.17 2003/11/12 20:47:58 menno Exp $
+** $Id: is.c,v 1.24 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -47,7 +47,7 @@
                uint16_t frame_len)
 {
     uint8_t g, sfb, b;
-    uint16_t i, k;
+    uint16_t i;
 #ifndef FIXED_POINT
     real_t scale;
 #else
@@ -66,36 +66,37 @@
             {
                 if (is_intensity(icsr, g, sfb))
                 {
+#ifdef MAIN_DEC
                     /* For scalefactor bands coded in intensity stereo the
                        corresponding predictors in the right channel are
                        switched to "off".
                      */
                     ics->pred.prediction_used[sfb] = 0;
                     icsr->pred.prediction_used[sfb] = 0;
+#endif
 
 #ifndef FIXED_POINT
                     scale = (real_t)pow(0.5, (0.25*icsr->scale_factors[g][sfb]));
 #else
-                    exp = icsr->scale_factors[g][sfb] / 4;
-                    frac = icsr->scale_factors[g][sfb] % 4;
+                    exp = icsr->scale_factors[g][sfb] >> 2;
+                    frac = icsr->scale_factors[g][sfb] & 3;
 #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);
+                        r_spec[(group*nshort)+i] = MUL_R(l_spec[(group*nshort)+i], scale);
 #else
                         if (exp < 0)
-                            r_spec[k] = l_spec[k] << -exp;
+                            r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] << -exp;
                         else
-                            r_spec[k] = l_spec[k] >> exp;
-                        r_spec[k] = MUL_C(r_spec[k], pow05_table[frac + 3]);
+                            r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] >> exp;
+                        r_spec[(group*nshort)+i] = MUL_C(r_spec[(group*nshort)+i], pow05_table[frac + 3]);
 #endif
                         if (is_intensity(icsr, g, sfb) != invert_intensity(ics, g, sfb))
-                            r_spec[k] = -r_spec[k];
+                            r_spec[(group*nshort)+i] = -r_spec[(group*nshort)+i];
                     }
                 }
             }
--- a/Plugins/Input/aac/libfaad2/is.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/is.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: is.h,v 1.11 2003/11/12 20:47:58 menno Exp $
+** $Id: is.h,v 1.16 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __IS_H__
--- a/Plugins/Input/aac/libfaad2/kbd_win.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/kbd_win.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: kbd_win.h,v 1.11 2003/11/12 20:47:58 menno Exp $
+** $Id: kbd_win.h,v 1.17 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __KBD_WIN_H__
@@ -37,7 +37,7 @@
 #pragma warning(disable:4244)
 #endif
 
-real_t kbd_long_1024[] =
+ALIGN static const real_t kbd_long_1024[] =
 {
     FRAC_CONST(0.00029256153896361),
     FRAC_CONST(0.00042998567353047),
@@ -1066,7 +1066,7 @@
 };
 
 #ifdef ALLOW_SMALL_FRAMELENGTH
-real_t kbd_long_960[] = {
+ALIGN static const real_t kbd_long_960[] = {
     FRAC_CONST(0.0003021562530949),
     FRAC_CONST(0.0004452267024786),
     FRAC_CONST(0.0005674947527496),
@@ -2030,7 +2030,7 @@
 };
 #endif
 
-real_t kbd_short_128[] =
+ALIGN static const real_t kbd_short_128[] =
 {
     FRAC_CONST(4.3795702929468881e-005),
     FRAC_CONST(0.00011867384265436617),
@@ -2163,7 +2163,7 @@
 };
 
 #ifdef ALLOW_SMALL_FRAMELENGTH
-real_t kbd_short_120[] =
+ALIGN static const real_t kbd_short_120[] =
 {
     FRAC_CONST(0.0000452320086910),
     FRAC_CONST(0.0001274564692111),
--- a/Plugins/Input/aac/libfaad2/libfaad.dsp	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/libfaad.dsp	Wed Nov 16 16:21:11 2005 -0800
@@ -68,7 +68,7 @@
 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 CPP /nologo /MDd /W3 /Gm /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
@@ -109,6 +109,10 @@
 # End Source File
 # Begin Source File
 
+SOURCE=.\drm_dec.c
+# End Source File
+# Begin Source File
+
 SOURCE=.\error.c
 # End Source File
 # Begin Source File
@@ -157,6 +161,14 @@
 # End Source File
 # Begin Source File
 
+SOURCE=.\ps_dec.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ps_syntax.c
+# End Source File
+# Begin Source File
+
 SOURCE=.\pulse.c
 # End Source File
 # Begin Source File
@@ -309,11 +321,11 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\dither.h
+SOURCE=.\drc.h
 # End Source File
 # Begin Source File
 
-SOURCE=.\drc.h
+SOURCE=.\drm_dec.h
 # End Source File
 # Begin Source File
 
@@ -361,6 +373,10 @@
 # End Source File
 # Begin Source File
 
+SOURCE=.\mdct_tab.h
+# End Source File
+# Begin Source File
+
 SOURCE=.\mp4.h
 # End Source File
 # Begin Source File
@@ -377,6 +393,14 @@
 # End Source File
 # Begin Source File
 
+SOURCE=.\ps_dec.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ps_tables.h
+# End Source File
+# Begin Source File
+
 SOURCE=.\pulse.h
 # End Source File
 # Begin Source File
--- a/Plugins/Input/aac/libfaad2/libfaad.sln	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/libfaad.sln	Wed Nov 16 16:21:11 2005 -0800
@@ -1,12 +1,15 @@
-Microsoft Visual Studio Solution File, Format Version 7.00
+Microsoft Visual Studio Solution File, Format Version 8.00
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaad", "libfaad.vcproj", "{4274723E-6B9D-4B3E-A8BE-7566165AA169}"
+	ProjectSection(ProjectDependencies) = postProject
+	EndProjectSection
 EndProject
 Global
+	GlobalSection(DPCodeReviewSolutionGUID) = preSolution
+		DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
+	EndGlobalSection
 	GlobalSection(SolutionConfiguration) = preSolution
-		ConfigName.0 = Debug
-		ConfigName.1 = Release
-	EndGlobalSection
-	GlobalSection(ProjectDependencies) = postSolution
+		Debug = Debug
+		Release = Release
 	EndGlobalSection
 	GlobalSection(ProjectConfiguration) = postSolution
 		{4274723E-6B9D-4B3E-A8BE-7566165AA169}.Debug.ActiveCfg = Debug|Win32
--- a/Plugins/Input/aac/libfaad2/libfaad.vcproj	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/libfaad.vcproj	Wed Nov 16 16:21:11 2005 -0800
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding = "Windows-1252"?>
+<?xml version="1.0" encoding="Windows-1252"?>
 <VisualStudioProject
 	ProjectType="Visual C++"
 	Version="7.10"
@@ -21,12 +21,13 @@
 			CharacterSet="2">
 			<Tool
 				Name="VCCLCompilerTool"
+				AdditionalOptions=""
 				Optimization="2"
 				InlineFunctionExpansion="1"
 				OptimizeForProcessor="2"
 				PreprocessorDefinitions="NDEBUG;WIN32;_LIB"
 				StringPooling="TRUE"
-				RuntimeLibrary="0"
+				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="TRUE"
 				UsePrecompiledHeader="2"
 				PrecompiledHeaderFile=".\Release/libfaad.pch"
@@ -35,15 +36,14 @@
 				ProgramDataBaseFileName=".\Release/"
 				WarningLevel="3"
 				SuppressStartupBanner="TRUE"
-				Detect64BitPortabilityProblems="TRUE"
-				AdditionalOptions=""/>
+				Detect64BitPortabilityProblems="TRUE"/>
 			<Tool
 				Name="VCCustomBuildTool"/>
 			<Tool
 				Name="VCLibrarianTool"
+				AdditionalOptions=""
 				OutputFile=".\Release\libfaad.lib"
-				SuppressStartupBanner="TRUE"
-				AdditionalOptions=""/>
+				SuppressStartupBanner="TRUE"/>
 			<Tool
 				Name="VCMIDLTool"/>
 			<Tool
@@ -75,10 +75,11 @@
 			CharacterSet="2">
 			<Tool
 				Name="VCCLCompilerTool"
+				AdditionalOptions=""
 				Optimization="0"
 				PreprocessorDefinitions="_DEBUG;WIN32;_LIB"
 				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
+				RuntimeLibrary="3"
 				UsePrecompiledHeader="2"
 				PrecompiledHeaderFile=".\Debug/libfaad.pch"
 				AssemblerListingLocation=".\Debug/"
@@ -86,15 +87,14 @@
 				ProgramDataBaseFileName=".\Debug/"
 				WarningLevel="3"
 				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"
-				AdditionalOptions=""/>
+				DebugInformationFormat="4"/>
 			<Tool
 				Name="VCCustomBuildTool"/>
 			<Tool
 				Name="VCLibrarianTool"
+				AdditionalOptions=""
 				OutputFile=".\Debug\libfaad.lib"
-				SuppressStartupBanner="TRUE"
-				AdditionalOptions=""/>
+				SuppressStartupBanner="TRUE"/>
 			<Tool
 				Name="VCMIDLTool"/>
 			<Tool
@@ -117,7 +117,8 @@
 				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
 		</Configuration>
 	</Configurations>
-	<References/>
+	<References>
+	</References>
 	<Files>
 		<Filter
 			Name="Source Files"
@@ -128,18 +129,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -148,18 +149,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -168,18 +169,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -188,38 +189,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						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=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -228,38 +209,41 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
+				RelativePath=".\drm_dec.c">
+			</File>
+			<File
 				RelativePath="error.c">
 				<FileConfiguration
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -268,18 +252,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -288,18 +272,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -308,18 +292,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -328,18 +312,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -348,18 +332,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -368,18 +352,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -388,18 +372,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -408,18 +392,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -428,18 +412,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -448,18 +432,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -468,38 +452,44 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
+				RelativePath=".\ps_dec.c">
+			</File>
+			<File
+				RelativePath=".\ps_syntax.c">
+			</File>
+			<File
 				RelativePath="pulse.c">
 				<FileConfiguration
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -508,18 +498,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -528,18 +518,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -548,18 +538,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -568,18 +558,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -588,18 +578,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -608,18 +598,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -628,18 +618,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -648,18 +638,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -668,18 +658,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -688,18 +678,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -708,18 +698,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -728,18 +718,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -748,18 +738,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -768,18 +758,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -788,18 +778,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -808,18 +798,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -828,18 +818,18 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="2"
-						PreprocessorDefinitions=""
-						AdditionalOptions=""/>
+						PreprocessorDefinitions=""/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
+						AdditionalOptions=""
 						Optimization="0"
 						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						AdditionalOptions=""/>
+						BasicRuntimeChecks="3"/>
 				</FileConfiguration>
 			</File>
 		</Filter>
@@ -847,118 +837,179 @@
 			Name="Header Files"
 			Filter="h;hpp;hxx;hm;inl">
 			<File
-				RelativePath="analysis.h"/>
+				RelativePath="analysis.h">
+			</File>
 			<File
-				RelativePath="bits.h"/>
+				RelativePath="bits.h">
+			</File>
 			<File
-				RelativePath="cfft.h"/>
+				RelativePath="cfft.h">
+			</File>
 			<File
-				RelativePath="cfft_tab.h"/>
+				RelativePath="cfft_tab.h">
+			</File>
 			<File
-				RelativePath="common.h"/>
+				RelativePath="common.h">
+			</File>
 			<File
-				RelativePath="decoder.h"/>
+				RelativePath="decoder.h">
+			</File>
 			<File
-				RelativePath="dither.h"/>
+				RelativePath="drc.h">
+			</File>
+			<File
+				RelativePath=".\drm_dec.h">
+			</File>
 			<File
-				RelativePath="drc.h"/>
+				RelativePath="error.h">
+			</File>
 			<File
-				RelativePath="error.h"/>
+				RelativePath="filtbank.h">
+			</File>
 			<File
-				RelativePath="filtbank.h"/>
+				RelativePath="fixed.h">
+			</File>
 			<File
-				RelativePath="fixed.h"/>
+				RelativePath="codebook\hcb.h">
+			</File>
 			<File
-				RelativePath="codebook\hcb.h"/>
+				RelativePath="huffman.h">
+			</File>
 			<File
-				RelativePath="huffman.h"/>
+				RelativePath="ic_predict.h">
+			</File>
 			<File
-				RelativePath="ic_predict.h"/>
+				RelativePath="iq_table.h">
+			</File>
 			<File
-				RelativePath="iq_table.h"/>
+				RelativePath="is.h">
+			</File>
 			<File
-				RelativePath="is.h"/>
+				RelativePath="kbd_win.h">
+			</File>
 			<File
-				RelativePath="kbd_win.h"/>
+				RelativePath="lt_predict.h">
+			</File>
 			<File
-				RelativePath="lt_predict.h"/>
+				RelativePath="mdct.h">
+			</File>
 			<File
-				RelativePath="mdct.h"/>
+				RelativePath="mp4.h">
+			</File>
 			<File
-				RelativePath="mp4.h"/>
+				RelativePath="ms.h">
+			</File>
 			<File
-				RelativePath="ms.h"/>
+				RelativePath="output.h">
+			</File>
 			<File
-				RelativePath="output.h"/>
+				RelativePath="pns.h">
+			</File>
 			<File
-				RelativePath="pns.h"/>
+				RelativePath=".\ps_dec.h">
+			</File>
 			<File
-				RelativePath="pulse.h"/>
+				RelativePath=".\ps_tables.h">
+			</File>
 			<File
-				RelativePath="rvlc.h"/>
+				RelativePath="pulse.h">
+			</File>
 			<File
-				RelativePath="sbr_dct.h"/>
+				RelativePath="rvlc.h">
+			</File>
 			<File
-				RelativePath="sbr_dec.h"/>
+				RelativePath="sbr_dct.h">
+			</File>
 			<File
-				RelativePath="sbr_e_nf.h"/>
+				RelativePath="sbr_dec.h">
+			</File>
+			<File
+				RelativePath="sbr_e_nf.h">
+			</File>
 			<File
-				RelativePath="sbr_fbt.h"/>
+				RelativePath="sbr_fbt.h">
+			</File>
 			<File
-				RelativePath="sbr_hfadj.h"/>
+				RelativePath="sbr_hfadj.h">
+			</File>
 			<File
-				RelativePath="sbr_hfgen.h"/>
+				RelativePath="sbr_hfgen.h">
+			</File>
 			<File
-				RelativePath="sbr_huff.h"/>
+				RelativePath="sbr_huff.h">
+			</File>
 			<File
-				RelativePath="sbr_noise.h"/>
+				RelativePath="sbr_noise.h">
+			</File>
 			<File
-				RelativePath="sbr_qmf.h"/>
+				RelativePath="sbr_qmf.h">
+			</File>
 			<File
-				RelativePath="sbr_syntax.h"/>
+				RelativePath="sbr_syntax.h">
+			</File>
 			<File
-				RelativePath="sbr_tf_grid.h"/>
+				RelativePath="sbr_tf_grid.h">
+			</File>
 			<File
-				RelativePath="sine_win.h"/>
+				RelativePath="sine_win.h">
+			</File>
 			<File
-				RelativePath="specrec.h"/>
+				RelativePath="specrec.h">
+			</File>
 			<File
-				RelativePath="ssr.h"/>
+				RelativePath="ssr.h">
+			</File>
 			<File
-				RelativePath="structs.h"/>
+				RelativePath="structs.h">
+			</File>
 			<File
-				RelativePath="syntax.h"/>
+				RelativePath="syntax.h">
+			</File>
 			<File
-				RelativePath="tns.h"/>
+				RelativePath="tns.h">
+			</File>
 			<Filter
 				Name="codebook"
 				Filter="">
 				<File
-					RelativePath="codebook\hcb_1.h"/>
+					RelativePath="codebook\hcb_1.h">
+				</File>
 				<File
-					RelativePath="codebook\hcb_10.h"/>
+					RelativePath="codebook\hcb_10.h">
+				</File>
 				<File
-					RelativePath="codebook\hcb_11.h"/>
+					RelativePath="codebook\hcb_11.h">
+				</File>
 				<File
-					RelativePath="codebook\hcb_2.h"/>
+					RelativePath="codebook\hcb_2.h">
+				</File>
 				<File
-					RelativePath="codebook\hcb_3.h"/>
+					RelativePath="codebook\hcb_3.h">
+				</File>
 				<File
-					RelativePath="codebook\hcb_4.h"/>
+					RelativePath="codebook\hcb_4.h">
+				</File>
 				<File
-					RelativePath="codebook\hcb_5.h"/>
+					RelativePath="codebook\hcb_5.h">
+				</File>
 				<File
-					RelativePath="codebook\hcb_6.h"/>
+					RelativePath="codebook\hcb_6.h">
+				</File>
 				<File
-					RelativePath="codebook\hcb_7.h"/>
+					RelativePath="codebook\hcb_7.h">
+				</File>
 				<File
-					RelativePath="codebook\hcb_8.h"/>
+					RelativePath="codebook\hcb_8.h">
+				</File>
 				<File
-					RelativePath="codebook\hcb_9.h"/>
+					RelativePath="codebook\hcb_9.h">
+				</File>
 				<File
-					RelativePath="codebook\hcb_sf.h"/>
+					RelativePath="codebook\hcb_sf.h">
+				</File>
 			</Filter>
 		</Filter>
 	</Files>
-	<Globals/>
+	<Globals>
+	</Globals>
 </VisualStudioProject>
--- a/Plugins/Input/aac/libfaad2/lt_predict.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/lt_predict.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: lt_predict.c,v 1.18 2003/11/12 20:47:58 menno Exp $
+** $Id: lt_predict.c,v 1.23 2004/09/04 14:56:28 menno Exp $
 **/
 
 
@@ -37,6 +37,11 @@
 #include "filtbank.h"
 #include "tns.h"
 
+
+/* static function declarations */
+static int16_t real_to_int16(real_t sig_in);
+
+
 /* check if the object type is an object type that can have LTP */
 uint8_t is_ltp_ot(uint8_t object_type)
 {
@@ -48,6 +53,9 @@
 #ifdef LD_DEC
         || (object_type == LD)
 #endif
+#ifdef SCALABLE_DEC
+        || (object_type == 6) /* TODO */
+#endif
         )
     {
         return 1;
@@ -57,7 +65,7 @@
     return 0;
 }
 
-static real_t codebook[8] =
+ALIGN static const real_t codebook[8] =
 {
     REAL_CONST(0.570829),
     REAL_CONST(0.696616),
@@ -76,8 +84,8 @@
 {
     uint8_t sfb;
     uint16_t bin, i, num_samples;
-    real_t x_est[2048];
-    real_t X_est[2048];
+    ALIGN real_t x_est[2048];
+    ALIGN real_t X_est[2048];
 
     if (ics->window_sequence != EIGHT_SHORT_SEQUENCE)
     {
@@ -125,37 +133,37 @@
 }
 
 #ifdef FIXED_POINT
-INLINE int16_t real_to_int16(real_t sig_in)
+static INLINE int16_t real_to_int16(real_t sig_in)
 {
     if (sig_in >= 0)
     {
         sig_in += (1 << (REAL_BITS-1));
-        if (sig_in > REAL_CONST(32767))
-            sig_in = 32767.0f;
+        if (sig_in >= REAL_CONST(32768))
+            return 32767;
     } else {
         sig_in += -(1 << (REAL_BITS-1));
-        if (sig_in < REAL_CONST(-32768))
-            sig_in = -32768.0f;
+        if (sig_in <= REAL_CONST(-32768))
+            return -32768;
     }
 
     return (sig_in >> REAL_BITS);
 }
 #else
-INLINE int16_t real_to_int16(real_t sig_in)
+static INLINE int16_t real_to_int16(real_t sig_in)
 {
     if (sig_in >= 0)
     {
 #ifndef HAS_LRINTF
         sig_in += 0.5f;
 #endif
-        if (sig_in > REAL_CONST(32767))
-            sig_in = 32767.0f;
+        if (sig_in >= 32768.0f)
+            return 32767;
     } else {
 #ifndef HAS_LRINTF
-        sig_in -= 0.5f;
+        sig_in += -0.5f;
 #endif
-        if (sig_in < REAL_CONST(-32768))
-            sig_in = -32768.0f;
+        if (sig_in <= -32768.0f)
+            return -32768;
     }
 
     return lrintf(sig_in);
--- a/Plugins/Input/aac/libfaad2/lt_predict.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/lt_predict.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: lt_predict.h,v 1.11 2003/11/12 20:47:58 menno Exp $
+** $Id: lt_predict.h,v 1.16 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifdef LTP_DEC
@@ -55,9 +55,6 @@
                      uint16_t frame_len,
                      uint8_t object_type);
 
-
-static int16_t real_to_int16(real_t sig_in);
-
 #ifdef __cplusplus
 }
 #endif
--- a/Plugins/Input/aac/libfaad2/mdct.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/mdct.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: mdct.c,v 1.34 2003/11/12 20:47:58 menno Exp $
+** $Id: mdct.c,v 1.43 2004/09/04 14:56:28 menno Exp $
 **/
 
 /*
@@ -53,143 +53,51 @@
 
 #include "cfft.h"
 #include "mdct.h"
+#include "mdct_tab.h"
 
-/* const_tab[]:
-    0: sqrt(2 / N)
-    1: cos(2 * PI / N)
-    2: sin(2 * PI / N)
-    3: cos(2 * PI * (1/8) / N)
-    4: sin(2 * PI * (1/8) / N)
- */
-#ifdef FIXED_POINT
-real_t const_tab[][5] =
-{
-    {    /* 2048 */
-        COEF_CONST(1),
-        FRAC_CONST(0.99999529380957619),
-        FRAC_CONST(0.0030679567629659761),
-        FRAC_CONST(0.99999992646571789),
-        FRAC_CONST(0.00038349518757139556)
-    }, { /* 1920 */
-        COEF_CONST(/* sqrt(1024/960) */ 1.0327955589886444),
-        FRAC_CONST(0.99999464540169647),
-        FRAC_CONST(0.0032724865065266251),
-        FRAC_CONST(0.99999991633432805),
-        FRAC_CONST(0.00040906153202803459)
-    }, { /* 1024 */
-        COEF_CONST(1),
-        FRAC_CONST(0.99998117528260111),
-        FRAC_CONST(0.0061358846491544753),
-        FRAC_CONST(0.99999970586288223),
-        FRAC_CONST(0.00076699031874270449)
-    }, { /* 960 */
-        COEF_CONST(/* sqrt(512/480) */ 1.0327955589886444),
-        FRAC_CONST(0.99997858166412923),
-        FRAC_CONST(0.0065449379673518581),
-        FRAC_CONST(0.99999966533732598),
-        FRAC_CONST(0.00081812299560725323)
-    }, { /* 256 */
-        COEF_CONST(1),
-        FRAC_CONST(0.99969881869620425),
-        FRAC_CONST(0.024541228522912288),
-        FRAC_CONST(0.99999529380957619),
-        FRAC_CONST(0.0030679567629659761)
-    }, {  /* 240 */
-        COEF_CONST(/* sqrt(256/240) */ 1.0327955589886444),
-        FRAC_CONST(0.99965732497555726),
-        FRAC_CONST(0.026176948307873149),
-        FRAC_CONST(0.99999464540169647),
-        FRAC_CONST(0.0032724865065266251)
-    }
-#ifdef SSR_DEC
-    ,{   /* 512 */
-        COEF_CONST(1),
-        FRAC_CONST(0.9999247018391445),
-        FRAC_CONST(0.012271538285719925),
-        FRAC_CONST(0.99999882345170188),
-        FRAC_CONST(0.0015339801862847655)
-    }, { /* 64 */
-        COEF_CONST(1),
-        FRAC_CONST(0.99518472667219693),
-        FRAC_CONST(0.098017140329560604),
-        FRAC_CONST(0.9999247018391445),
-        FRAC_CONST(0.012271538285719925)
-    }
-#endif
-};
-#endif
-
-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));
+    mdct_info *mdct = (mdct_info*)faad_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
+    /* NOTE: For "small framelengths" in FIXED_POINT the coefficients need to be
+     * scaled by sqrt("(nearest power of 2) > N" / N) */
 
-    /* (co)sine table build using recurrence relations */
-    /* this can also be done using static table lookup or */
-    /* some form of interpolation */
-    for (k = 0; k < N/4; k++)
+    /* RE(mdct->sincos[k]) = scale*(real_t)(cos(2.0*M_PI*(k+1./8.) / (real_t)N));
+     * IM(mdct->sincos[k]) = scale*(real_t)(sin(2.0*M_PI*(k+1./8.) / (real_t)N)); */
+    /* scale is 1 for fixed point, sqrt(N) for floating point */
+    switch (N)
     {
-#ifdef FIXED_POINT
-        RE(mdct->sincos[k]) = c; //MUL_C_C(c,scale);
-        IM(mdct->sincos[k]) = s; //MUL_C_C(s,scale);
-
-        cold = c;
-        c = MUL_F(c,cangle) - MUL_F(s,sangle);
-        s = MUL_F(s,cangle) + MUL_F(cold,sangle);
-#else
-        /* no recurrence, just sines */
-        RE(mdct->sincos[k]) = scale*(real_t)(cos(2.0*M_PI*(k+1./8.) / (real_t)N));
-        IM(mdct->sincos[k]) = scale*(real_t)(sin(2.0*M_PI*(k+1./8.) / (real_t)N));
+    case 2048: mdct->sincos = (complex_t*)mdct_tab_2048; break;
+    case 256:  mdct->sincos = (complex_t*)mdct_tab_256;  break;
+#ifdef LD_DEC
+    case 1024: mdct->sincos = (complex_t*)mdct_tab_1024; break;
+#endif
+#ifdef ALLOW_SMALL_FRAMELENGTH
+    case 1920: mdct->sincos = (complex_t*)mdct_tab_1920; break;
+    case 240:  mdct->sincos = (complex_t*)mdct_tab_240;  break;
+#ifdef LD_DEC
+    case 960:  mdct->sincos = (complex_t*)mdct_tab_960;  break;
+#endif
+#endif
+#ifdef SSR_DEC
+    case 512:  mdct->sincos = (complex_t*)mdct_tab_512;  break;
+    case 64:   mdct->sincos = (complex_t*)mdct_tab_64;   break;
 #endif
     }
 
     /* initialise fft */
     mdct->cfft = cffti(N/4);
 
+#ifdef PROFILE
+    mdct->cycles = 0;
+    mdct->fft_cycles = 0;
+#endif
+
     return mdct;
 }
 
@@ -197,11 +105,14 @@
 {
     if (mdct != NULL)
     {
+#ifdef PROFILE
+        printf("MDCT[%.4d]:         %I64d cycles\n", mdct->N, mdct->cycles);
+        printf("CFFT[%.4d]:         %I64d cycles\n", mdct->N/4, mdct->fft_cycles);
+#endif
+
         cfftu(mdct->cfft);
 
-        if (mdct->sincos) free(mdct->sincos);
-
-        free(mdct);
+        faad_free(mdct);
     }
 }
 
@@ -210,7 +121,12 @@
     uint16_t k;
 
     complex_t x;
-    complex_t Z1[512];
+#ifdef ALLOW_SMALL_FRAMELENGTH
+#ifdef FIXED_POINT
+    real_t scale, b_scale = 0;
+#endif
+#endif
+    ALIGN complex_t Z1[512];
     complex_t *sincos = mdct->sincos;
 
     uint16_t N  = mdct->N;
@@ -218,6 +134,23 @@
     uint16_t N4 = N >> 2;
     uint16_t N8 = N >> 3;
 
+#ifdef PROFILE
+    int64_t count1, count2 = faad_get_ts();
+#endif
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+#ifdef FIXED_POINT
+    /* detect non-power of 2 */
+    if (N & (N-1))
+    {
+        /* adjust scale for non-power of 2 MDCT */
+        /* 2048/1920 */
+        b_scale = 1;
+        scale = COEF_CONST(1.0666666666666667);
+    }
+#endif
+#endif
+
     /* pre-IFFT complex multiplication */
     for (k = 0; k < N4; k++)
     {
@@ -225,9 +158,17 @@
             X_in[2*k], X_in[N2 - 1 - 2*k], RE(sincos[k]), IM(sincos[k]));
     }
 
+#ifdef PROFILE
+    count1 = faad_get_ts();
+#endif
+
     /* complex IFFT, any non-scaling FFT can be used here */
     cfftb(mdct->cfft, Z1);
 
+#ifdef PROFILE
+    count1 = faad_get_ts() - count1;
+#endif
+
     /* post-IFFT complex multiplication */
     for (k = 0; k < N4; k++)
     {
@@ -236,38 +177,51 @@
         ComplexMult(&IM(Z1[k]), &RE(Z1[k]),
             IM(x), RE(x), RE(sincos[k]), IM(sincos[k]));
 
+#ifdef ALLOW_SMALL_FRAMELENGTH
 #ifdef FIXED_POINT
-#if (REAL_BITS == 16)
-        if (abs(RE(Z1[k])) > REAL_CONST(16383.5))
+        /* non-power of 2 MDCT scaling */
+        if (b_scale)
         {
-            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;
+            RE(Z1[k]) = MUL_C(RE(Z1[k]), scale);
+            IM(Z1[k]) = MUL_C(IM(Z1[k]), scale);
         }
 #endif
 #endif
     }
 
     /* reordering */
-    for (k = 0; k < N8; k++)
+    for (k = 0; k < N8; k+=2)
     {
         X_out[              2*k] =  IM(Z1[N8 +     k]);
+        X_out[          2 + 2*k] =  IM(Z1[N8 + 1 + k]);
+
         X_out[          1 + 2*k] = -RE(Z1[N8 - 1 - k]);
+        X_out[          3 + 2*k] = -RE(Z1[N8 - 2 - k]);
+
         X_out[N4 +          2*k] =  RE(Z1[         k]);
+        X_out[N4 +    + 2 + 2*k] =  RE(Z1[     1 + k]);
+
         X_out[N4 +      1 + 2*k] = -IM(Z1[N4 - 1 - k]);
+        X_out[N4 +      3 + 2*k] = -IM(Z1[N4 - 2 - k]);
+
         X_out[N2 +          2*k] =  RE(Z1[N8 +     k]);
+        X_out[N2 +    + 2 + 2*k] =  RE(Z1[N8 + 1 + k]);
+
         X_out[N2 +      1 + 2*k] = -IM(Z1[N8 - 1 - k]);
+        X_out[N2 +      3 + 2*k] = -IM(Z1[N8 - 2 - k]);
+
         X_out[N2 + N4 +     2*k] = -IM(Z1[         k]);
+        X_out[N2 + N4 + 2 + 2*k] = -IM(Z1[     1 + k]);
+
         X_out[N2 + N4 + 1 + 2*k] =  RE(Z1[N4 - 1 - k]);
+        X_out[N2 + N4 + 3 + 2*k] =  RE(Z1[N4 - 2 - k]);
     }
+
+#ifdef PROFILE
+    count2 = faad_get_ts() - count2;
+    mdct->fft_cycles += count1;
+    mdct->cycles += (count2 - count1);
+#endif
 }
 
 #ifdef LTP_DEC
@@ -276,7 +230,7 @@
     uint16_t k;
 
     complex_t x;
-    complex_t Z1[512];
+    ALIGN complex_t Z1[512];
     complex_t *sincos = mdct->sincos;
 
     uint16_t N  = mdct->N;
@@ -290,6 +244,18 @@
 	real_t scale = REAL_CONST(4.0/N);
 #endif
 
+#ifdef ALLOW_SMALL_FRAMELENGTH
+#ifdef FIXED_POINT
+    /* detect non-power of 2 */
+    if (N & (N-1))
+    {
+        /* adjust scale for non-power of 2 MDCT */
+        /* *= sqrt(2048/1920) */
+        scale = MUL_C(scale, COEF_CONST(1.0327955589886444));
+    }
+#endif
+#endif
+
     /* pre-FFT complex multiplication */
     for (k = 0; k < N8; k++)
     {
--- a/Plugins/Input/aac/libfaad2/mdct.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/mdct.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: mdct.h,v 1.20 2003/11/12 20:47:58 menno Exp $
+** $Id: mdct.h,v 1.26 2004/09/08 09:43:11 gcp Exp $
 **/
 
 #ifndef __MDCT_H__
--- a/Plugins/Input/aac/libfaad2/mp4.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/mp4.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: mp4.c,v 1.24 2003/11/12 20:47:58 menno Exp $
+** $Id: mp4.c,v 1.32 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -58,7 +58,11 @@
 #else
     0, /*  5 SBR */
 #endif
+#ifdef SCALABLE_DEC
+    1, /*  6 AAC Scalable */
+#else
     0, /*  6 AAC Scalable */
+#endif
     0, /*  7 TwinVQ */
     0, /*  8 CELP */
     0, /*  9 HVXC */
@@ -79,7 +83,11 @@
 #else
     0, /* 19 ER AAC LTP */
 #endif
+#ifdef SCALABLE_DEC
+    1, /* 20 ER AAC scalable */
+#else
     0, /* 20 ER AAC scalable */
+#endif
     0, /* 21 ER TwinVQ */
     0, /* 22 ER BSAC */
 #ifdef LD_DEC
@@ -111,17 +119,17 @@
 };
 
 /* Table 1.6.1 */
-int8_t FAADAPI AudioSpecificConfig(uint8_t *pBuffer,
-                                   uint32_t buffer_size,
-                                   mp4AudioSpecificConfig *mp4ASC)
+int8_t NEAACDECAPI NeAACDecAudioSpecificConfig(uint8_t *pBuffer,
+                                               uint32_t buffer_size,
+                                               mp4AudioSpecificConfig *mp4ASC)
 {
     return AudioSpecificConfig2(pBuffer, buffer_size, mp4ASC, NULL);
 }
 
-int8_t FAADAPI AudioSpecificConfig2(uint8_t *pBuffer,
-                                    uint32_t buffer_size,
-                                    mp4AudioSpecificConfig *mp4ASC,
-                                    program_config *pce)
+int8_t AudioSpecificConfig2(uint8_t *pBuffer,
+                            uint32_t buffer_size,
+                            mp4AudioSpecificConfig *mp4ASC,
+                            program_config *pce)
 {
     bitfile ld;
     int8_t result = 0;
@@ -168,13 +176,28 @@
         return -3;
     }
 
+#if (defined(PS_DEC) || defined(DRM_PS))
+    /* check if we have a mono file */
+    if (mp4ASC->channelsConfiguration == 1)
+    {
+        /* upMatrix to 2 channels for implicit signalling of PS */
+        mp4ASC->channelsConfiguration = 2;
+    }
+#endif
+
 #ifdef SBR_DEC
     mp4ASC->sbr_present_flag = -1;
     if (mp4ASC->objectTypeIndex == 5)
     {
+        uint8_t tmp;
+
         mp4ASC->sbr_present_flag = 1;
-        mp4ASC->samplingFrequencyIndex = (uint8_t)faad_getbits(&ld, 4
+        tmp = (uint8_t)faad_getbits(&ld, 4
             DEBUGVAR(1,5,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
+        /* check for downsampled SBR */
+        if (tmp == mp4ASC->samplingFrequencyIndex)
+            mp4ASC->downSampledSBR = 1;
+        mp4ASC->samplingFrequencyIndex = tmp;
         if (mp4ASC->samplingFrequencyIndex == 15)
         {
             mp4ASC->samplingFrequency = (uint32_t)faad_getbits(&ld, 24
@@ -235,8 +258,15 @@
 
                 if (mp4ASC->sbr_present_flag)
                 {
-                    mp4ASC->samplingFrequencyIndex = (uint8_t)faad_getbits(&ld, 4
+                    uint8_t tmp;
+                    tmp = (uint8_t)faad_getbits(&ld, 4
                         DEBUGVAR(1,12,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
+
+                    /* check for downsampled SBR */
+                    if (tmp == mp4ASC->samplingFrequencyIndex)
+                        mp4ASC->downSampledSBR = 1;
+                    mp4ASC->samplingFrequencyIndex = tmp;
+
                     if (mp4ASC->samplingFrequencyIndex == 15)
                     {
                         mp4ASC->samplingFrequency = (uint32_t)faad_getbits(&ld, 24
@@ -257,6 +287,8 @@
         {
             mp4ASC->samplingFrequency *= 2;
             mp4ASC->forceUpSampling = 1;
+        } else /* > 24000*/ {
+            mp4ASC->downSampledSBR = 1;
         }
     }
 #endif
--- a/Plugins/Input/aac/libfaad2/mp4.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/mp4.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: mp4.h,v 1.15 2003/11/12 20:47:58 menno Exp $
+** $Id: mp4.h,v 1.21 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __MP4_H__
@@ -34,14 +34,14 @@
 
 #include "decoder.h"
 
-int8_t FAADAPI AudioSpecificConfig(uint8_t *pBuffer,
-                                   uint32_t buffer_size,
-                                   mp4AudioSpecificConfig *mp4ASC);
+int8_t NEAACDECAPI NeAACDecAudioSpecificConfig(uint8_t *pBuffer,
+                                               uint32_t buffer_size,
+                                               mp4AudioSpecificConfig *mp4ASC);
 
-int8_t FAADAPI AudioSpecificConfig2(uint8_t *pBuffer,
-                                    uint32_t buffer_size,
-                                    mp4AudioSpecificConfig *mp4ASC,
-                                    program_config *pce);
+int8_t AudioSpecificConfig2(uint8_t *pBuffer,
+                            uint32_t buffer_size,
+                            mp4AudioSpecificConfig *mp4ASC,
+                            program_config *pce);
 
 #ifdef __cplusplus
 }
--- a/Plugins/Input/aac/libfaad2/ms.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/ms.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: ms.c,v 1.11 2003/11/12 20:47:58 menno Exp $
+** $Id: ms.c,v 1.17 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -49,7 +49,7 @@
         {
             for (b = 0; b < ics->window_group_length[g]; b++)
             {
-                for(sfb = 0; sfb < ics->max_sfb; sfb++)
+                for (sfb = 0; sfb < ics->max_sfb; sfb++)
                 {
                     /* If intensity stereo coding or noise substitution is on
                        for a particular scalefactor band, no M/S stereo decoding
--- a/Plugins/Input/aac/libfaad2/ms.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/ms.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: ms.h,v 1.10 2003/11/12 20:47:58 menno Exp $
+** $Id: ms.h,v 1.15 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __MS_H__
--- a/Plugins/Input/aac/libfaad2/output.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/output.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,19 +1,19 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
 ** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
-**  
+**
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
 ** the Free Software Foundation; either version 2 of the License, or
 ** (at your option) any later version.
-** 
+**
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ** GNU General Public License for more details.
-** 
+**
 ** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software 
+** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
 ** Any non-GPL usage of this software or parts of this software is strictly
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: output.c,v 1.29 2003/11/12 20:47:58 menno Exp $
+** $Id: output.c,v 1.42 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -36,149 +36,434 @@
 
 #define FLOAT_SCALE (1.0f/(1<<15))
 
-#define DM_MUL ((real_t)1.0/((real_t)1.0+(real_t)sqrt(2.0)))
+#define DM_MUL REAL_CONST(0.3203772410170407) // 1/(1+sqrt(2) + 1/sqrt(2))
+#define RSQRT2 REAL_CONST(0.7071067811865475244) // 1/sqrt(2)
 
 
 static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample,
-                                uint8_t downMatrix, uint8_t *internal_channel)
+                                uint8_t down_matrix, uint8_t *internal_channel)
 {
-    if (!downMatrix)
+    if (!down_matrix)
         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.));
+            input[internal_channel[0]][sample] * RSQRT2 +
+            input[internal_channel[3]][sample] * RSQRT2);
     } 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.));
+            input[internal_channel[0]][sample] * RSQRT2 +
+            input[internal_channel[4]][sample] * RSQRT2);
+    }
+}
+
+#ifndef HAS_LRINTF
+#define CLIP(sample, max, min) \
+if (sample >= 0.0f)            \
+{                              \
+    sample += 0.5f;            \
+    if (sample >= max)         \
+        sample = max;          \
+} else {                       \
+    sample += -0.5f;           \
+    if (sample <= min)         \
+        sample = min;          \
+}
+#else
+#define CLIP(sample, max, min) \
+if (sample >= 0.0f)            \
+{                              \
+    if (sample >= max)         \
+        sample = max;          \
+} else {                       \
+    if (sample <= min)         \
+        sample = min;          \
+}
+#endif
+
+#define CONV(a,b) ((a<<1)|(b&0x1))
+
+static void to_PCM_16bit(NeAACDecHandle hDecoder, real_t **input,
+                         uint8_t channels, uint16_t frame_len,
+                         int16_t **sample_buffer)
+{
+    uint8_t ch, ch1;
+    uint16_t i;
+
+    switch (CONV(channels,hDecoder->downMatrix))
+    {
+    case CONV(1,0):
+    case CONV(1,1):
+        for(i = 0; i < frame_len; i++)
+        {
+            real_t inp = input[hDecoder->internal_channel[0]][i];
+
+            CLIP(inp, 32767.0f, -32768.0f);
+
+            (*sample_buffer)[i] = (int16_t)lrintf(inp);
+        }
+        break;
+    case CONV(2,0):
+        if (hDecoder->upMatrix)
+        {
+            ch  = hDecoder->internal_channel[0];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch][i];
+
+                CLIP(inp0, 32767.0f, -32768.0f);
+
+                (*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp0);
+            }
+        } else {
+            ch  = hDecoder->internal_channel[0];
+            ch1 = hDecoder->internal_channel[1];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch ][i];
+                real_t inp1 = input[ch1][i];
+
+                CLIP(inp0, 32767.0f, -32768.0f);
+                CLIP(inp1, 32767.0f, -32768.0f);
+
+                (*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp1);
+            }
+        }
+        break;
+    default:
+        for (ch = 0; ch < channels; ch++)
+        {
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
+
+                CLIP(inp, 32767.0f, -32768.0f);
+
+                (*sample_buffer)[(i*channels)+ch] = (int16_t)lrintf(inp);
+            }
+        }
+        break;
+    }
+}
+
+static void to_PCM_24bit(NeAACDecHandle hDecoder, real_t **input,
+                         uint8_t channels, uint16_t frame_len,
+                         int32_t **sample_buffer)
+{
+    uint8_t ch, ch1;
+    uint16_t i;
+
+    switch (CONV(channels,hDecoder->downMatrix))
+    {
+    case CONV(1,0):
+    case CONV(1,1):
+        for(i = 0; i < frame_len; i++)
+        {
+            real_t inp = input[hDecoder->internal_channel[0]][i];
+
+            inp *= 256.0f;
+            CLIP(inp, 8388607.0f, -8388608.0f);
+
+            (*sample_buffer)[i] = (int32_t)lrintf(inp);
+        }
+        break;
+    case CONV(2,0):
+        if (hDecoder->upMatrix)
+        {
+            ch = hDecoder->internal_channel[0];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch][i];
+
+                inp0 *= 256.0f;
+                CLIP(inp0, 8388607.0f, -8388608.0f);
+
+                (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0);
+            }
+        } else {
+            ch  = hDecoder->internal_channel[0];
+            ch1 = hDecoder->internal_channel[1];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch ][i];
+                real_t inp1 = input[ch1][i];
+
+                inp0 *= 256.0f;
+                inp1 *= 256.0f;
+                CLIP(inp0, 8388607.0f, -8388608.0f);
+                CLIP(inp1, 8388607.0f, -8388608.0f);
+
+                (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1);
+            }
+        }
+        break;
+    default:
+        for (ch = 0; ch < channels; ch++)
+        {
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
+
+                inp *= 256.0f;
+                CLIP(inp, 8388607.0f, -8388608.0f);
+
+                (*sample_buffer)[(i*channels)+ch] = (int32_t)lrintf(inp);
+            }
+        }
+        break;
     }
 }
 
-void* output_to_PCM(faacDecHandle hDecoder,
+static void to_PCM_32bit(NeAACDecHandle hDecoder, real_t **input,
+                         uint8_t channels, uint16_t frame_len,
+                         int32_t **sample_buffer)
+{
+    uint8_t ch, ch1;
+    uint16_t i;
+
+    switch (CONV(channels,hDecoder->downMatrix))
+    {
+    case CONV(1,0):
+    case CONV(1,1):
+        for(i = 0; i < frame_len; i++)
+        {
+            real_t inp = input[hDecoder->internal_channel[0]][i];
+
+            inp *= 65536.0f;
+            CLIP(inp, 2147483647.0f, -2147483648.0f);
+
+            (*sample_buffer)[i] = (int32_t)lrintf(inp);
+        }
+        break;
+    case CONV(2,0):
+        if (hDecoder->upMatrix)
+        {
+            ch = hDecoder->internal_channel[0];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch][i];
+
+                inp0 *= 65536.0f;
+                CLIP(inp0, 2147483647.0f, -2147483648.0f);
+
+                (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0);
+            }
+        } else {
+            ch  = hDecoder->internal_channel[0];
+            ch1 = hDecoder->internal_channel[1];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch ][i];
+                real_t inp1 = input[ch1][i];
+
+                inp0 *= 65536.0f;
+                inp1 *= 65536.0f;
+                CLIP(inp0, 2147483647.0f, -2147483648.0f);
+                CLIP(inp1, 2147483647.0f, -2147483648.0f);
+
+                (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1);
+            }
+        }
+        break;
+    default:
+        for (ch = 0; ch < channels; ch++)
+        {
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
+
+                inp *= 65536.0f;
+                CLIP(inp, 2147483647.0f, -2147483648.0f);
+
+                (*sample_buffer)[(i*channels)+ch] = (int32_t)lrintf(inp);
+            }
+        }
+        break;
+    }
+}
+
+static void to_PCM_float(NeAACDecHandle hDecoder, real_t **input,
+                         uint8_t channels, uint16_t frame_len,
+                         float32_t **sample_buffer)
+{
+    uint8_t ch, ch1;
+    uint16_t i;
+
+    switch (CONV(channels,hDecoder->downMatrix))
+    {
+    case CONV(1,0):
+    case CONV(1,1):
+        for(i = 0; i < frame_len; i++)
+        {
+            real_t inp = input[hDecoder->internal_channel[0]][i];
+            (*sample_buffer)[i] = inp*FLOAT_SCALE;
+        }
+        break;
+    case CONV(2,0):
+        if (hDecoder->upMatrix)
+        {
+            ch = hDecoder->internal_channel[0];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch][i];
+                (*sample_buffer)[(i*2)+0] = inp0*FLOAT_SCALE;
+                (*sample_buffer)[(i*2)+1] = inp0*FLOAT_SCALE;
+            }
+        } else {
+            ch  = hDecoder->internal_channel[0];
+            ch1 = hDecoder->internal_channel[1];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch ][i];
+                real_t inp1 = input[ch1][i];
+                (*sample_buffer)[(i*2)+0] = inp0*FLOAT_SCALE;
+                (*sample_buffer)[(i*2)+1] = inp1*FLOAT_SCALE;
+            }
+        }
+        break;
+    default:
+        for (ch = 0; ch < channels; ch++)
+        {
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
+                (*sample_buffer)[(i*channels)+ch] = inp*FLOAT_SCALE;
+            }
+        }
+        break;
+    }
+}
+
+static void to_PCM_double(NeAACDecHandle hDecoder, real_t **input,
+                          uint8_t channels, uint16_t frame_len,
+                          double **sample_buffer)
+{
+    uint8_t ch, ch1;
+    uint16_t i;
+
+    switch (CONV(channels,hDecoder->downMatrix))
+    {
+    case CONV(1,0):
+    case CONV(1,1):
+        for(i = 0; i < frame_len; i++)
+        {
+            real_t inp = input[hDecoder->internal_channel[0]][i];
+            (*sample_buffer)[i] = (double)inp*FLOAT_SCALE;
+        }
+        break;
+    case CONV(2,0):
+        if (hDecoder->upMatrix)
+        {
+            ch = hDecoder->internal_channel[0];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch][i];
+                (*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE;
+                (*sample_buffer)[(i*2)+1] = (double)inp0*FLOAT_SCALE;
+            }
+        } else {
+            ch  = hDecoder->internal_channel[0];
+            ch1 = hDecoder->internal_channel[1];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch ][i];
+                real_t inp1 = input[ch1][i];
+                (*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE;
+                (*sample_buffer)[(i*2)+1] = (double)inp1*FLOAT_SCALE;
+            }
+        }
+        break;
+    default:
+        for (ch = 0; ch < channels; ch++)
+        {
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
+                (*sample_buffer)[(i*channels)+ch] = (double)inp*FLOAT_SCALE;
+            }
+        }
+        break;
+    }
+}
+
+void *output_to_PCM(NeAACDecHandle 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;
+#ifdef PROFILE
+    int64_t count = faad_get_ts();
 #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;
+
+    /* Copy output to a standard PCM buffer */
+    switch (format)
+    {
+    case FAAD_FMT_16BIT:
+        to_PCM_16bit(hDecoder, input, channels, frame_len, &short_sample_buffer);
+        break;
+    case FAAD_FMT_24BIT:
+        to_PCM_24bit(hDecoder, input, channels, frame_len, &int_sample_buffer);
+        break;
+    case FAAD_FMT_32BIT:
+        to_PCM_32bit(hDecoder, input, channels, frame_len, &int_sample_buffer);
+        break;
+    case FAAD_FMT_FLOAT:
+        to_PCM_float(hDecoder, input, channels, frame_len, &float_sample_buffer);
+        break;
+    case FAAD_FMT_DOUBLE:
+        to_PCM_double(hDecoder, input, channels, frame_len, &double_sample_buffer);
+        break;
+    }
+
+#ifdef PROFILE
+    count = faad_get_ts() - count;
+    hDecoder->output_cycles += count;
 #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,
+#define DM_MUL FRAC_CONST(0.3203772410170407) // 1/(1+sqrt(2) + 1/sqrt(2))
+#define RSQRT2 FRAC_CONST(0.7071067811865475244) // 1/sqrt(2)
+
+static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample,
+                                uint8_t down_matrix, uint8_t up_matrix,
+                                uint8_t *internal_channel)
+{
+    if (up_matrix == 1)
+        return input[internal_channel[0]][sample];
+
+    if (!down_matrix)
+        return input[internal_channel[channel]][sample];
+
+    if (channel == 0)
+    {
+        real_t C   = MUL_F(input[internal_channel[0]][sample], RSQRT2);
+        real_t L_S = MUL_F(input[internal_channel[3]][sample], RSQRT2);
+        real_t cum = input[internal_channel[1]][sample] + C + L_S;
+        return MUL_F(cum, DM_MUL);
+    } else {
+        real_t C   = MUL_F(input[internal_channel[0]][sample], RSQRT2);
+        real_t R_S = MUL_F(input[internal_channel[4]][sample], RSQRT2);
+        real_t cum = input[internal_channel[2]][sample] + C + R_S;
+        return MUL_F(cum, DM_MUL);
+    }
+}
+
+void* output_to_PCM(NeAACDecHandle hDecoder,
                     real_t **input, void *sample_buffer, uint8_t channels,
                     uint16_t frame_len, uint8_t format)
 {
@@ -195,17 +480,18 @@
         case FAAD_FMT_16BIT:
             for(i = 0; i < frame_len; i++)
             {
-                int32_t tmp = input[ch][i];
+                int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
+                    hDecoder->internal_channel);
                 if (tmp >= 0)
                 {
                     tmp += (1 << (REAL_BITS-1));
-                    if (tmp >= REAL_CONST(32768))
+                    if (tmp >= REAL_CONST(32767))
                     {
                         tmp = REAL_CONST(32767);
                     }
                 } else {
                     tmp += -(1 << (REAL_BITS-1));
-                    if (tmp <= REAL_CONST(-32769))
+                    if (tmp <= REAL_CONST(-32768))
                     {
                         tmp = REAL_CONST(-32768);
                     }
@@ -217,19 +503,20 @@
         case FAAD_FMT_24BIT:
             for(i = 0; i < frame_len; i++)
             {
-                int32_t tmp = input[ch][i];
+                int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
+                    hDecoder->internal_channel);
                 if (tmp >= 0)
                 {
                     tmp += (1 << (REAL_BITS-9));
                     tmp >>= (REAL_BITS-8);
-                    if (tmp >= 8388608)
+                    if (tmp >= 8388607)
                     {
                         tmp = 8388607;
                     }
                 } else {
                     tmp += -(1 << (REAL_BITS-9));
                     tmp >>= (REAL_BITS-8);
-                    if (tmp <= -8388609)
+                    if (tmp <= -8388608)
                     {
                         tmp = -8388608;
                     }
@@ -240,7 +527,8 @@
         case FAAD_FMT_32BIT:
             for(i = 0; i < frame_len; i++)
             {
-                int32_t tmp = input[ch][i];
+                int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
+                    hDecoder->internal_channel);
                 if (tmp >= 0)
                 {
                     tmp += (1 << (16-REAL_BITS-1));
@@ -252,6 +540,14 @@
                 int_sample_buffer[(i*channels)+ch] = (int32_t)tmp;
             }
             break;
+        case FAAD_FMT_FIXED:
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
+                    hDecoder->internal_channel);
+                int_sample_buffer[(i*channels)+ch] = (int32_t)tmp;
+            }
+            break;
         }
     }
 
--- a/Plugins/Input/aac/libfaad2/output.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/output.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: output.h,v 1.14 2003/11/12 20:47:58 menno Exp $
+** $Id: output.h,v 1.21 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __OUTPUT_H__
@@ -32,16 +32,13 @@
 extern "C" {
 #endif
 
-void* output_to_PCM(faacDecHandle hDecoder,
+void* output_to_PCM(NeAACDecHandle 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
--- a/Plugins/Input/aac/libfaad2/pns.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/pns.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: pns.c,v 1.27 2003/11/12 20:47:58 menno Exp $
+** $Id: pns.c,v 1.34 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -31,6 +31,11 @@
 #include "pns.h"
 
 
+/* static function declarations */
+static void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size,
+                            uint8_t sub);
+
+
 #ifdef FIXED_POINT
 
 #define DIV(A, B) (((int64_t)A << REAL_BITS)/B)
@@ -65,9 +70,6 @@
 
 static real_t pow2_table[] =
 {
-    COEF_CONST(0.59460355750136),
-    COEF_CONST(0.70710678118655),
-    COEF_CONST(0.84089641525371),
     COEF_CONST(1.0),
     COEF_CONST(1.18920711500272),
     COEF_CONST(1.41421356237310),
@@ -126,8 +128,8 @@
     {
         scale = DIV(REAL_CONST(1),energy);
 
-        exp = scale_factor / 4;
-        frac = scale_factor % 4;
+        exp = scale_factor >> 2;
+        frac = scale_factor & 3;
 
         /* IMDCT pre-scaling */
         exp -= sub;
@@ -138,7 +140,7 @@
             scale <<= exp;
 
         if (frac)
-            scale = MUL_C(scale, pow2_table[frac + 3]);
+            scale = MUL_C(scale, pow2_table[frac]);
 
         for (i = 0; i < size; i++)
         {
@@ -182,6 +184,7 @@
             {
                 if (is_noise(ics_left, g, sfb))
                 {
+#ifdef LTP_DEC
                     /* Simultaneous use of LTP and PNS is not prevented in the
                        syntax. If both LTP, and PNS are enabled on the same
                        scalefactor band, PNS takes precedence, and no prediction
@@ -189,11 +192,14 @@
                     */
                     ics_left->ltp.long_used[sfb] = 0;
                     ics_left->ltp2.long_used[sfb] = 0;
+#endif
 
+#ifdef MAIN_DEC
                     /* For scalefactor bands coded using PNS the corresponding
                        predictors are switched to "off".
                     */
                     ics_left->pred.prediction_used[sfb] = 0;
+#endif
 
                     offs = ics_left->swb_offset[sfb];
                     size = ics_left->swb_offset[sfb+1] - offs;
@@ -235,9 +241,13 @@
                                     spec_left[(group*nshort) + offs + c];
                             }
                         } else /*if (ics_left->ms_mask_present == 0)*/ {
+#ifdef LTP_DEC
                             ics_right->ltp.long_used[sfb] = 0;
                             ics_right->ltp2.long_used[sfb] = 0;
+#endif
+#ifdef MAIN_DEC
                             ics_right->pred.prediction_used[sfb] = 0;
+#endif
 
                             offs = ics_right->swb_offset[sfb];
                             size = ics_right->swb_offset[sfb+1] - offs;
--- a/Plugins/Input/aac/libfaad2/pns.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/pns.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: pns.h,v 1.17 2003/11/12 20:47:58 menno Exp $
+** $Id: pns.h,v 1.23 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __PNS_H__
@@ -32,8 +32,6 @@
 extern "C" {
 #endif
 
-#include "common.h"
-
 #include "syntax.h"
 
 #define NOISE_OFFSET 90
@@ -42,10 +40,6 @@
                 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)
--- a/Plugins/Input/aac/libfaad2/pulse.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/pulse.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: pulse.c,v 1.12 2003/11/12 20:47:58 menno Exp $
+** $Id: pulse.c,v 1.17 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -39,7 +39,8 @@
 
     k = ics->swb_offset[pul->pulse_start_sfb];
 
-    for(i = 0; i <= pul->number_pulse; i++) {
+    for (i = 0; i <= pul->number_pulse; i++)
+    {
         k += pul->pulse_offset[i];
 
         if (k >= framelen)
--- a/Plugins/Input/aac/libfaad2/pulse.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/pulse.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: pulse.h,v 1.11 2003/11/12 20:47:58 menno Exp $
+** $Id: pulse.h,v 1.16 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __PULSE_H__
--- a/Plugins/Input/aac/libfaad2/rvlc.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/rvlc.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: rvlc.c,v 1.11 2003/11/12 20:47:58 menno Exp $
+** $Id: rvlc.c,v 1.17 2004/09/04 14:56:28 menno Exp $
 **/
 
 /* RVLC scalefactor decoding
@@ -52,25 +52,41 @@
 
 //#define PRINT_RVLC
 
+/* static function declarations */
+static uint8_t rvlc_decode_sf_forward(ic_stream *ics,
+                                      bitfile *ld_sf,
+                                      bitfile *ld_esc,
+                                      uint8_t *is_used);
+#if 0
+static uint8_t rvlc_decode_sf_reverse(ic_stream *ics,
+                                      bitfile *ld_sf,
+                                      bitfile *ld_esc,
+                                      uint8_t is_used);
+#endif
+static int8_t rvlc_huffman_sf(bitfile *ld_sf, bitfile *ld_esc,
+                              int8_t direction);
+static int8_t rvlc_huffman_esc(bitfile *ld_esc, int8_t direction);
+
+
 uint8_t rvlc_scale_factor_data(ic_stream *ics, bitfile *ld)
 {
     uint8_t bits = 9;
 
     ics->sf_concealment = faad_get1bit(ld
         DEBUGVAR(1,149,"rvlc_scale_factor_data(): sf_concealment"));
-    ics->rev_global_gain = faad_getbits(ld, 8
+    ics->rev_global_gain = (uint8_t)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
+    ics->length_of_rvlc_sf = (uint16_t)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
+        ics->dpcm_noise_nrg = (uint16_t)faad_getbits(ld, 9
             DEBUGVAR(1,152,"rvlc_scale_factor_data(): dpcm_noise_nrg"));
 
         ics->length_of_rvlc_sf -= 9;
@@ -81,13 +97,13 @@
 
     if (ics->sf_escapes_present)
     {
-        ics->length_of_rvlc_escapes = faad_getbits(ld, 8
+        ics->length_of_rvlc_escapes = (uint8_t)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
+        ics->dpcm_noise_last_position = (uint16_t)faad_getbits(ld, 9
             DEBUGVAR(1,155,"rvlc_scale_factor_data(): dpcm_noise_last_position"));
     }
 
@@ -136,8 +152,8 @@
 //        &ld_rvlc_esc_rev, intensity_used);
 
 
-    if (rvlc_esc_buffer) free(rvlc_esc_buffer);
-    if (rvlc_sf_buffer) free(rvlc_sf_buffer);
+    if (rvlc_esc_buffer) faad_free(rvlc_esc_buffer);
+    if (rvlc_sf_buffer) faad_free(rvlc_sf_buffer);
 
     if (ics->length_of_rvlc_sf > 0)
         faad_endbits(&ld_rvlc_sf);
@@ -235,6 +251,7 @@
     return 0;
 }
 
+#if 0 // not used right now, doesn't work correctly yet
 static uint8_t rvlc_decode_sf_reverse(ic_stream *ics, bitfile *ld_sf, bitfile *ld_esc,
                                       uint8_t intensity_used)
 {
@@ -337,6 +354,7 @@
 
     return 0;
 }
+#endif
 
 /* index == 99 means not allowed codeword */
 static rvlc_huff_table book_rvlc[] = {
@@ -508,4 +526,5 @@
     return h->index;
 }
 
-#endif
\ No newline at end of file
+#endif
+
--- a/Plugins/Input/aac/libfaad2/rvlc.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/rvlc.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: rvlc.h,v 1.8 2003/11/12 20:47:58 menno Exp $
+** $Id: rvlc.h,v 1.13 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __RVLC_SCF_H__
@@ -46,18 +46,6 @@
 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
 }
--- a/Plugins/Input/aac/libfaad2/sbr_dct.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_dct.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,19 +1,19 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
-**  
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
+**
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
 ** the Free Software Foundation; either version 2 of the License, or
 ** (at your option) any later version.
-** 
+**
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ** GNU General Public License for more details.
-** 
+**
 ** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software 
+** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
 ** Any non-GPL usage of this software or parts of this software is strictly
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_dct.c,v 1.8 2003/11/12 20:47:58 menno Exp $
+** $Id: sbr_dct.c,v 1.15 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -37,8 +37,758 @@
 
 #include "sbr_dct.h"
 
+void DCT4_32(real_t *y, real_t *x)
+{
+    real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
+    real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20;
+    real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30;
+    real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40;
+    real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50;
+    real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60;
+    real_t f61, f62, f63, f64, f65, f66, f67, f68, f69, f70;
+    real_t f71, f72, f73, f74, f75, f76, f77, f78, f79, f80;
+    real_t f81, f82, f83, f84, f85, f86, f87, f88, f89, f90;
+    real_t f91, f92, f93, f94, f95, f96, f97, f98, f99, f100;
+    real_t f101, f102, f103, f104, f105, f106, f107, f108, f109, f110;
+    real_t f111, f112, f113, f114, f115, f116, f117, f118, f119, f120;
+    real_t f121, f122, f123, f124, f125, f126, f127, f128, f129, f130;
+    real_t f131, f132, f133, f134, f135, f136, f137, f138, f139, f140;
+    real_t f141, f142, f143, f144, f145, f146, f147, f148, f149, f150;
+    real_t f151, f152, f153, f154, f155, f156, f157, f158, f159, f160;
+    real_t f161, f162, f163, f164, f165, f166, f167, f168, f169, f170;
+    real_t f171, f172, f173, f174, f175, f176, f177, f178, f179, f180;
+    real_t f181, f182, f183, f184, f185, f186, f187, f188, f189, f190;
+    real_t f191, f192, f193, f194, f195, f196, f197, f198, f199, f200;
+    real_t f201, f202, f203, f204, f205, f206, f207, f208, f209, f210;
+    real_t f211, f212, f213, f214, f215, f216, f217, f218, f219, f220;
+    real_t f221, f222, f223, f224, f225, f226, f227, f228, f229, f230;
+    real_t f231, f232, f233, f234, f235, f236, f237, f238, f239, f240;
+    real_t f241, f242, f243, f244, f245, f246, f247, f248, f249, f250;
+    real_t f251, f252, f253, f254, f255, f256, f257, f258, f259, f260;
+    real_t f261, f262, f263, f264, f265, f266, f267, f268, f269, f270;
+    real_t f271, f272, f273, f274, f275, f276, f277, f278, f279, f280;
+    real_t f281, f282, f283, f284, f285, f286, f287, f288, f289, f290;
+    real_t f291, f292, f293, f294, f295, f296, f297, f298, f299, f300;
+    real_t f301, f302, f303, f304, f305, f306, f307, f310, f311, f312;
+    real_t f313, f316, f317, f318, f319, f322, f323, f324, f325, f328;
+    real_t f329, f330, f331, f334, f335, f336, f337, f340, f341, f342;
+    real_t f343, f346, f347, f348, f349, f352, f353, f354, f355, f358;
+    real_t f359, f360, f361, f364, f365, f366, f367, f370, f371, f372;
+    real_t f373, f376, f377, f378, f379, f382, f383, f384, f385, f388;
+    real_t f389, f390, f391, f394, f395, f396, f397;
+
+    f0 = x[15] - x[16];
+    f1 = x[15] + x[16];
+    f2 = MUL_F(FRAC_CONST(0.7071067811865476), f1);
+    f3 = MUL_F(FRAC_CONST(0.7071067811865476), f0);
+    f4 = x[8] - x[23];
+    f5 = x[8] + x[23];
+    f6 = MUL_F(FRAC_CONST(0.7071067811865476), f5);
+    f7 = MUL_F(FRAC_CONST(0.7071067811865476), f4);
+    f8 = x[12] - x[19];
+    f9 = x[12] + x[19];
+    f10 = MUL_F(FRAC_CONST(0.7071067811865476), f9);
+    f11 = MUL_F(FRAC_CONST(0.7071067811865476), f8);
+    f12 = x[11] - x[20];
+    f13 = x[11] + x[20];
+    f14 = MUL_F(FRAC_CONST(0.7071067811865476), f13);
+    f15 = MUL_F(FRAC_CONST(0.7071067811865476), f12);
+    f16 = x[14] - x[17];
+    f17 = x[14] + x[17];
+    f18 = MUL_F(FRAC_CONST(0.7071067811865476), f17);
+    f19 = MUL_F(FRAC_CONST(0.7071067811865476), f16);
+    f20 = x[9] - x[22];
+    f21 = x[9] + x[22];
+    f22 = MUL_F(FRAC_CONST(0.7071067811865476), f21);
+    f23 = MUL_F(FRAC_CONST(0.7071067811865476), f20);
+    f24 = x[13] - x[18];
+    f25 = x[13] + x[18];
+    f26 = MUL_F(FRAC_CONST(0.7071067811865476), f25);
+    f27 = MUL_F(FRAC_CONST(0.7071067811865476), f24);
+    f28 = x[10] - x[21];
+    f29 = x[10] + x[21];
+    f30 = MUL_F(FRAC_CONST(0.7071067811865476), f29);
+    f31 = MUL_F(FRAC_CONST(0.7071067811865476), f28);
+    f32 = x[0] - f2;
+    f33 = x[0] + f2;
+    f34 = x[31] - f3;
+    f35 = x[31] + f3;
+    f36 = x[7] - f6;
+    f37 = x[7] + f6;
+    f38 = x[24] - f7;
+    f39 = x[24] + f7;
+    f40 = x[3] - f10;
+    f41 = x[3] + f10;
+    f42 = x[28] - f11;
+    f43 = x[28] + f11;
+    f44 = x[4] - f14;
+    f45 = x[4] + f14;
+    f46 = x[27] - f15;
+    f47 = x[27] + f15;
+    f48 = x[1] - f18;
+    f49 = x[1] + f18;
+    f50 = x[30] - f19;
+    f51 = x[30] + f19;
+    f52 = x[6] - f22;
+    f53 = x[6] + f22;
+    f54 = x[25] - f23;
+    f55 = x[25] + f23;
+    f56 = x[2] - f26;
+    f57 = x[2] + f26;
+    f58 = x[29] - f27;
+    f59 = x[29] + f27;
+    f60 = x[5] - f30;
+    f61 = x[5] + f30;
+    f62 = x[26] - f31;
+    f63 = x[26] + f31;
+    f64 = f39 + f37;
+    f65 = MUL_F(FRAC_CONST(-0.5411961001461969), f39);
+    f66 = MUL_F(FRAC_CONST(0.9238795325112867), f64);
+    f67 = MUL_C(COEF_CONST(1.3065629648763766), f37);
+    f68 = f65 + f66;
+    f69 = f67 - f66;
+    f70 = f38 + f36;
+    f71 = MUL_C(COEF_CONST(1.3065629648763770), f38);
+    f72 = MUL_F(FRAC_CONST(-0.3826834323650904), f70);
+    f73 = MUL_F(FRAC_CONST(0.5411961001461961), f36);
+    f74 = f71 + f72;
+    f75 = f73 - f72;
+    f76 = f47 + f45;
+    f77 = MUL_F(FRAC_CONST(-0.5411961001461969), f47);
+    f78 = MUL_F(FRAC_CONST(0.9238795325112867), f76);
+    f79 = MUL_C(COEF_CONST(1.3065629648763766), f45);
+    f80 = f77 + f78;
+    f81 = f79 - f78;
+    f82 = f46 + f44;
+    f83 = MUL_C(COEF_CONST(1.3065629648763770), f46);
+    f84 = MUL_F(FRAC_CONST(-0.3826834323650904), f82);
+    f85 = MUL_F(FRAC_CONST(0.5411961001461961), f44);
+    f86 = f83 + f84;
+    f87 = f85 - f84;
+    f88 = f55 + f53;
+    f89 = MUL_F(FRAC_CONST(-0.5411961001461969), f55);
+    f90 = MUL_F(FRAC_CONST(0.9238795325112867), f88);
+    f91 = MUL_C(COEF_CONST(1.3065629648763766), f53);
+    f92 = f89 + f90;
+    f93 = f91 - f90;
+    f94 = f54 + f52;
+    f95 = MUL_C(COEF_CONST(1.3065629648763770), f54);
+    f96 = MUL_F(FRAC_CONST(-0.3826834323650904), f94);
+    f97 = MUL_F(FRAC_CONST(0.5411961001461961), f52);
+    f98 = f95 + f96;
+    f99 = f97 - f96;
+    f100 = f63 + f61;
+    f101 = MUL_F(FRAC_CONST(-0.5411961001461969), f63);
+    f102 = MUL_F(FRAC_CONST(0.9238795325112867), f100);
+    f103 = MUL_C(COEF_CONST(1.3065629648763766), f61);
+    f104 = f101 + f102;
+    f105 = f103 - f102;
+    f106 = f62 + f60;
+    f107 = MUL_C(COEF_CONST(1.3065629648763770), f62);
+    f108 = MUL_F(FRAC_CONST(-0.3826834323650904), f106);
+    f109 = MUL_F(FRAC_CONST(0.5411961001461961), f60);
+    f110 = f107 + f108;
+    f111 = f109 - f108;
+    f112 = f33 - f68;
+    f113 = f33 + f68;
+    f114 = f35 - f69;
+    f115 = f35 + f69;
+    f116 = f32 - f74;
+    f117 = f32 + f74;
+    f118 = f34 - f75;
+    f119 = f34 + f75;
+    f120 = f41 - f80;
+    f121 = f41 + f80;
+    f122 = f43 - f81;
+    f123 = f43 + f81;
+    f124 = f40 - f86;
+    f125 = f40 + f86;
+    f126 = f42 - f87;
+    f127 = f42 + f87;
+    f128 = f49 - f92;
+    f129 = f49 + f92;
+    f130 = f51 - f93;
+    f131 = f51 + f93;
+    f132 = f48 - f98;
+    f133 = f48 + f98;
+    f134 = f50 - f99;
+    f135 = f50 + f99;
+    f136 = f57 - f104;
+    f137 = f57 + f104;
+    f138 = f59 - f105;
+    f139 = f59 + f105;
+    f140 = f56 - f110;
+    f141 = f56 + f110;
+    f142 = f58 - f111;
+    f143 = f58 + f111;
+    f144 = f123 + f121;
+    f145 = MUL_F(FRAC_CONST(-0.7856949583871021), f123);
+    f146 = MUL_F(FRAC_CONST(0.9807852804032304), f144);
+    f147 = MUL_C(COEF_CONST(1.1758756024193588), f121);
+    f148 = f145 + f146;
+    f149 = f147 - f146;
+    f150 = f127 + f125;
+    f151 = MUL_F(FRAC_CONST(0.2758993792829431), f127);
+    f152 = MUL_F(FRAC_CONST(0.5555702330196022), f150);
+    f153 = MUL_C(COEF_CONST(1.3870398453221475), f125);
+    f154 = f151 + f152;
+    f155 = f153 - f152;
+    f156 = f122 + f120;
+    f157 = MUL_C(COEF_CONST(1.1758756024193591), f122);
+    f158 = MUL_F(FRAC_CONST(-0.1950903220161287), f156);
+    f159 = MUL_F(FRAC_CONST(0.7856949583871016), f120);
+    f160 = f157 + f158;
+    f161 = f159 - f158;
+    f162 = f126 + f124;
+    f163 = MUL_C(COEF_CONST(1.3870398453221473), f126);
+    f164 = MUL_F(FRAC_CONST(-0.8314696123025455), f162);
+    f165 = MUL_F(FRAC_CONST(-0.2758993792829436), f124);
+    f166 = f163 + f164;
+    f167 = f165 - f164;
+    f168 = f139 + f137;
+    f169 = MUL_F(FRAC_CONST(-0.7856949583871021), f139);
+    f170 = MUL_F(FRAC_CONST(0.9807852804032304), f168);
+    f171 = MUL_C(COEF_CONST(1.1758756024193588), f137);
+    f172 = f169 + f170;
+    f173 = f171 - f170;
+    f174 = f143 + f141;
+    f175 = MUL_F(FRAC_CONST(0.2758993792829431), f143);
+    f176 = MUL_F(FRAC_CONST(0.5555702330196022), f174);
+    f177 = MUL_C(COEF_CONST(1.3870398453221475), f141);
+    f178 = f175 + f176;
+    f179 = f177 - f176;
+    f180 = f138 + f136;
+    f181 = MUL_C(COEF_CONST(1.1758756024193591), f138);
+    f182 = MUL_F(FRAC_CONST(-0.1950903220161287), f180);
+    f183 = MUL_F(FRAC_CONST(0.7856949583871016), f136);
+    f184 = f181 + f182;
+    f185 = f183 - f182;
+    f186 = f142 + f140;
+    f187 = MUL_C(COEF_CONST(1.3870398453221473), f142);
+    f188 = MUL_F(FRAC_CONST(-0.8314696123025455), f186);
+    f189 = MUL_F(FRAC_CONST(-0.2758993792829436), f140);
+    f190 = f187 + f188;
+    f191 = f189 - f188;
+    f192 = f113 - f148;
+    f193 = f113 + f148;
+    f194 = f115 - f149;
+    f195 = f115 + f149;
+    f196 = f117 - f154;
+    f197 = f117 + f154;
+    f198 = f119 - f155;
+    f199 = f119 + f155;
+    f200 = f112 - f160;
+    f201 = f112 + f160;
+    f202 = f114 - f161;
+    f203 = f114 + f161;
+    f204 = f116 - f166;
+    f205 = f116 + f166;
+    f206 = f118 - f167;
+    f207 = f118 + f167;
+    f208 = f129 - f172;
+    f209 = f129 + f172;
+    f210 = f131 - f173;
+    f211 = f131 + f173;
+    f212 = f133 - f178;
+    f213 = f133 + f178;
+    f214 = f135 - f179;
+    f215 = f135 + f179;
+    f216 = f128 - f184;
+    f217 = f128 + f184;
+    f218 = f130 - f185;
+    f219 = f130 + f185;
+    f220 = f132 - f190;
+    f221 = f132 + f190;
+    f222 = f134 - f191;
+    f223 = f134 + f191;
+    f224 = f211 + f209;
+    f225 = MUL_F(FRAC_CONST(-0.8971675863426361), f211);
+    f226 = MUL_F(FRAC_CONST(0.9951847266721968), f224);
+    f227 = MUL_C(COEF_CONST(1.0932018670017576), f209);
+    f228 = f225 + f226;
+    f229 = f227 - f226;
+    f230 = f215 + f213;
+    f231 = MUL_F(FRAC_CONST(-0.4105245275223571), f215);
+    f232 = MUL_F(FRAC_CONST(0.8819212643483549), f230);
+    f233 = MUL_C(COEF_CONST(1.3533180011743529), f213);
+    f234 = f231 + f232;
+    f235 = f233 - f232;
+    f236 = f219 + f217;
+    f237 = MUL_F(FRAC_CONST(0.1386171691990915), f219);
+    f238 = MUL_F(FRAC_CONST(0.6343932841636455), f236);
+    f239 = MUL_C(COEF_CONST(1.4074037375263826), f217);
+    f240 = f237 + f238;
+    f241 = f239 - f238;
+    f242 = f223 + f221;
+    f243 = MUL_F(FRAC_CONST(0.6666556584777466), f223);
+    f244 = MUL_F(FRAC_CONST(0.2902846772544623), f242);
+    f245 = MUL_C(COEF_CONST(1.2472250129866711), f221);
+    f246 = f243 + f244;
+    f247 = f245 - f244;
+    f248 = f210 + f208;
+    f249 = MUL_C(COEF_CONST(1.0932018670017574), f210);
+    f250 = MUL_F(FRAC_CONST(-0.0980171403295605), f248);
+    f251 = MUL_F(FRAC_CONST(0.8971675863426364), f208);
+    f252 = f249 + f250;
+    f253 = f251 - f250;
+    f254 = f214 + f212;
+    f255 = MUL_C(COEF_CONST(1.3533180011743529), f214);
+    f256 = MUL_F(FRAC_CONST(-0.4713967368259979), f254);
+    f257 = MUL_F(FRAC_CONST(0.4105245275223569), f212);
+    f258 = f255 + f256;
+    f259 = f257 - f256;
+    f260 = f218 + f216;
+    f261 = MUL_C(COEF_CONST(1.4074037375263826), f218);
+    f262 = MUL_F(FRAC_CONST(-0.7730104533627369), f260);
+    f263 = MUL_F(FRAC_CONST(-0.1386171691990913), f216);
+    f264 = f261 + f262;
+    f265 = f263 - f262;
+    f266 = f222 + f220;
+    f267 = MUL_C(COEF_CONST(1.2472250129866711), f222);
+    f268 = MUL_F(FRAC_CONST(-0.9569403357322089), f266);
+    f269 = MUL_F(FRAC_CONST(-0.6666556584777469), f220);
+    f270 = f267 + f268;
+    f271 = f269 - f268;
+    f272 = f193 - f228;
+    f273 = f193 + f228;
+    f274 = f195 - f229;
+    f275 = f195 + f229;
+    f276 = f197 - f234;
+    f277 = f197 + f234;
+    f278 = f199 - f235;
+    f279 = f199 + f235;
+    f280 = f201 - f240;
+    f281 = f201 + f240;
+    f282 = f203 - f241;
+    f283 = f203 + f241;
+    f284 = f205 - f246;
+    f285 = f205 + f246;
+    f286 = f207 - f247;
+    f287 = f207 + f247;
+    f288 = f192 - f252;
+    f289 = f192 + f252;
+    f290 = f194 - f253;
+    f291 = f194 + f253;
+    f292 = f196 - f258;
+    f293 = f196 + f258;
+    f294 = f198 - f259;
+    f295 = f198 + f259;
+    f296 = f200 - f264;
+    f297 = f200 + f264;
+    f298 = f202 - f265;
+    f299 = f202 + f265;
+    f300 = f204 - f270;
+    f301 = f204 + f270;
+    f302 = f206 - f271;
+    f303 = f206 + f271;
+    f304 = f275 + f273;
+    f305 = MUL_F(FRAC_CONST(-0.9751575901732920), f275);
+    f306 = MUL_F(FRAC_CONST(0.9996988186962043), f304);
+    f307 = MUL_C(COEF_CONST(1.0242400472191164), f273);
+    y[0] = f305 + f306;
+    y[31] = f307 - f306;
+    f310 = f279 + f277;
+    f311 = MUL_F(FRAC_CONST(-0.8700688593994936), f279);
+    f312 = MUL_F(FRAC_CONST(0.9924795345987100), f310);
+    f313 = MUL_C(COEF_CONST(1.1148902097979263), f277);
+    y[2] = f311 + f312;
+    y[29] = f313 - f312;
+    f316 = f283 + f281;
+    f317 = MUL_F(FRAC_CONST(-0.7566008898816587), f283);
+    f318 = MUL_F(FRAC_CONST(0.9757021300385286), f316);
+    f319 = MUL_C(COEF_CONST(1.1948033701953984), f281);
+    y[4] = f317 + f318;
+    y[27] = f319 - f318;
+    f322 = f287 + f285;
+    f323 = MUL_F(FRAC_CONST(-0.6358464401941451), f287);
+    f324 = MUL_F(FRAC_CONST(0.9495281805930367), f322);
+    f325 = MUL_C(COEF_CONST(1.2632099209919283), f285);
+    y[6] = f323 + f324;
+    y[25] = f325 - f324;
+    f328 = f291 + f289;
+    f329 = MUL_F(FRAC_CONST(-0.5089684416985408), f291);
+    f330 = MUL_F(FRAC_CONST(0.9142097557035307), f328);
+    f331 = MUL_C(COEF_CONST(1.3194510697085207), f289);
+    y[8] = f329 + f330;
+    y[23] = f331 - f330;
+    f334 = f295 + f293;
+    f335 = MUL_F(FRAC_CONST(-0.3771887988789273), f295);
+    f336 = MUL_F(FRAC_CONST(0.8700869911087114), f334);
+    f337 = MUL_C(COEF_CONST(1.3629851833384954), f293);
+    y[10] = f335 + f336;
+    y[21] = f337 - f336;
+    f340 = f299 + f297;
+    f341 = MUL_F(FRAC_CONST(-0.2417766217337384), f299);
+    f342 = MUL_F(FRAC_CONST(0.8175848131515837), f340);
+    f343 = MUL_C(COEF_CONST(1.3933930045694289), f297);
+    y[12] = f341 + f342;
+    y[19] = f343 - f342;
+    f346 = f303 + f301;
+    f347 = MUL_F(FRAC_CONST(-0.1040360035527077), f303);
+    f348 = MUL_F(FRAC_CONST(0.7572088465064845), f346);
+    f349 = MUL_C(COEF_CONST(1.4103816894602612), f301);
+    y[14] = f347 + f348;
+    y[17] = f349 - f348;
+    f352 = f274 + f272;
+    f353 = MUL_F(FRAC_CONST(0.0347065382144002), f274);
+    f354 = MUL_F(FRAC_CONST(0.6895405447370668), f352);
+    f355 = MUL_C(COEF_CONST(1.4137876276885337), f272);
+    y[16] = f353 + f354;
+    y[15] = f355 - f354;
+    f358 = f278 + f276;
+    f359 = MUL_F(FRAC_CONST(0.1731148370459795), f278);
+    f360 = MUL_F(FRAC_CONST(0.6152315905806268), f358);
+    f361 = MUL_C(COEF_CONST(1.4035780182072330), f276);
+    y[18] = f359 + f360;
+    y[13] = f361 - f360;
+    f364 = f282 + f280;
+    f365 = MUL_F(FRAC_CONST(0.3098559453626100), f282);
+    f366 = MUL_F(FRAC_CONST(0.5349976198870972), f364);
+    f367 = MUL_C(COEF_CONST(1.3798511851368043), f280);
+    y[20] = f365 + f366;
+    y[11] = f367 - f366;
+    f370 = f286 + f284;
+    f371 = MUL_F(FRAC_CONST(0.4436129715409088), f286);
+    f372 = MUL_F(FRAC_CONST(0.4496113296546065), f370);
+    f373 = MUL_C(COEF_CONST(1.3428356308501219), f284);
+    y[22] = f371 + f372;
+    y[9] = f373 - f372;
+    f376 = f290 + f288;
+    f377 = MUL_F(FRAC_CONST(0.5730977622997509), f290);
+    f378 = MUL_F(FRAC_CONST(0.3598950365349881), f376);
+    f379 = MUL_C(COEF_CONST(1.2928878353697271), f288);
+    y[24] = f377 + f378;
+    y[7] = f379 - f378;
+    f382 = f294 + f292;
+    f383 = MUL_F(FRAC_CONST(0.6970633083205415), f294);
+    f384 = MUL_F(FRAC_CONST(0.2667127574748984), f382);
+    f385 = MUL_C(COEF_CONST(1.2304888232703382), f292);
+    y[26] = f383 + f384;
+    y[5] = f385 - f384;
+    f388 = f298 + f296;
+    f389 = MUL_F(FRAC_CONST(0.8143157536286401), f298);
+    f390 = MUL_F(FRAC_CONST(0.1709618887603012), f388);
+    f391 = MUL_C(COEF_CONST(1.1562395311492424), f296);
+    y[28] = f389 + f390;
+    y[3] = f391 - f390;
+    f394 = f302 + f300;
+    f395 = MUL_F(FRAC_CONST(0.9237258930790228), f302);
+    f396 = MUL_F(FRAC_CONST(0.0735645635996674), f394);
+    f397 = MUL_C(COEF_CONST(1.0708550202783576), f300);
+    y[30] = f395 + f396;
+    y[1] = f397 - f396;
+}
+
 #ifdef SBR_LOW_POWER
 
+void DCT2_16_unscaled(real_t *y, real_t *x)
+{
+    real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
+    real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20;
+    real_t f21, f22, f23, f24, f25, f26, f27, f28, f31, f32;
+    real_t f33, f34, f37, f38, f39, f40, f41, f42, f43, f44;
+    real_t f45, f46, f47, f48, f49, f51, f53, f54, f57, f58;
+    real_t f59, f60, f61, f62, f63, f64, f65, f66, f67, f68;
+    real_t f69, f70, f71, f72, f73, f74, f75, f76, f77, f78;
+    real_t f79, f80, f81, f82, f83, f84, f85, f86, f87, f88;
+    real_t f89, f90, f91, f92, f95, f96, f97, f98, f101, f102;
+    real_t f103, f104, f107, f108, f109, f110;
+
+    f0 = x[0] - x[15];
+    f1 = x[0] + x[15];
+    f2 = x[1] - x[14];
+    f3 = x[1] + x[14];
+    f4 = x[2] - x[13];
+    f5 = x[2] + x[13];
+    f6 = x[3] - x[12];
+    f7 = x[3] + x[12];
+    f8 = x[4] - x[11];
+    f9 = x[4] + x[11];
+    f10 = x[5] - x[10];
+    f11 = x[5] + x[10];
+    f12 = x[6] - x[9];
+    f13 = x[6] + x[9];
+    f14 = x[7] - x[8];
+    f15 = x[7] + x[8];
+    f16 = f1 - f15;
+    f17 = f1 + f15;
+    f18 = f3 - f13;
+    f19 = f3 + f13;
+    f20 = f5 - f11;
+    f21 = f5 + f11;
+    f22 = f7 - f9;
+    f23 = f7 + f9;
+    f24 = f17 - f23;
+    f25 = f17 + f23;
+    f26 = f19 - f21;
+    f27 = f19 + f21;
+    f28 = f25 - f27;
+    y[0] = f25 + f27;
+    y[8] = MUL_F(f28, FRAC_CONST(0.7071067811865476));
+    f31 = f24 + f26;
+    f32 = MUL_C(f24, COEF_CONST(1.3065629648763766));
+    f33 = MUL_F(f31, FRAC_CONST(-0.9238795325112866));
+    f34 = MUL_F(f26, FRAC_CONST(-0.5411961001461967));
+    y[12] = f32 + f33;
+    y[4] = f34 - f33;
+    f37 = f16 + f22;
+    f38 = MUL_C(f16, COEF_CONST(1.1758756024193588));
+    f39 = MUL_F(f37, FRAC_CONST(-0.9807852804032304));
+    f40 = MUL_F(f22, FRAC_CONST(-0.7856949583871021));
+    f41 = f38 + f39;
+    f42 = f40 - f39;
+    f43 = f18 + f20;
+    f44 = MUL_C(f18, COEF_CONST(1.3870398453221473));
+    f45 = MUL_F(f43, FRAC_CONST(-0.8314696123025455));
+    f46 = MUL_F(f20, FRAC_CONST(-0.2758993792829436));
+    f47 = f44 + f45;
+    f48 = f46 - f45;
+    f49 = f42 - f48;
+    y[2] = f42 + f48;
+    f51 = MUL_F(f49, FRAC_CONST(0.7071067811865476));
+    y[14] = f41 - f47;
+    f53 = f41 + f47;
+    f54 = MUL_F(f53, FRAC_CONST(0.7071067811865476));
+    y[10] = f51 - f54;
+    y[6] = f51 + f54;
+    f57 = f2 - f4;
+    f58 = f2 + f4;
+    f59 = f6 - f8;
+    f60 = f6 + f8;
+    f61 = f10 - f12;
+    f62 = f10 + f12;
+    f63 = MUL_F(f60, FRAC_CONST(0.7071067811865476));
+    f64 = f0 - f63;
+    f65 = f0 + f63;
+    f66 = f58 + f62;
+    f67 = MUL_C(f58, COEF_CONST(1.3065629648763766));
+    f68 = MUL_F(f66, FRAC_CONST(-0.9238795325112866));
+    f69 = MUL_F(f62, FRAC_CONST(-0.5411961001461967));
+    f70 = f67 + f68;
+    f71 = f69 - f68;
+    f72 = f65 - f71;
+    f73 = f65 + f71;
+    f74 = f64 - f70;
+    f75 = f64 + f70;
+    f76 = MUL_F(f59, FRAC_CONST(0.7071067811865476));
+    f77 = f14 - f76;
+    f78 = f14 + f76;
+    f79 = f61 + f57;
+    f80 = MUL_C(f61, COEF_CONST(1.3065629648763766));
+    f81 = MUL_F(f79, FRAC_CONST(-0.9238795325112866));
+    f82 = MUL_F(f57, FRAC_CONST(-0.5411961001461967));
+    f83 = f80 + f81;
+    f84 = f82 - f81;
+    f85 = f78 - f84;
+    f86 = f78 + f84;
+    f87 = f77 - f83;
+    f88 = f77 + f83;
+    f89 = f86 + f73;
+    f90 = MUL_F(f86, FRAC_CONST(-0.8971675863426361));
+    f91 = MUL_F(f89, FRAC_CONST(0.9951847266721968));
+    f92 = MUL_C(f73, COEF_CONST(1.0932018670017576));
+    y[1] = f90 + f91;
+    y[15] = f92 - f91;
+    f95 = f75 - f88;
+    f96 = MUL_F(f88, FRAC_CONST(-0.6666556584777466));
+    f97 = MUL_F(f95, FRAC_CONST(0.9569403357322089));
+    f98 = MUL_C(f75, COEF_CONST(1.2472250129866713));
+    y[3] = f97 - f96;
+    y[13] = f98 - f97;
+    f101 = f87 + f74;
+    f102 = MUL_F(f87, FRAC_CONST(-0.4105245275223571));
+    f103 = MUL_F(f101, FRAC_CONST(0.8819212643483549));
+    f104 = MUL_C(f74, COEF_CONST(1.3533180011743529));
+    y[5] = f102 + f103;
+    y[11] = f104 - f103;
+    f107 = f72 - f85;
+    f108 = MUL_F(f85, FRAC_CONST(-0.1386171691990915));
+    f109 = MUL_F(f107, FRAC_CONST(0.7730104533627370));
+    f110 = MUL_C(f72, COEF_CONST(1.4074037375263826));
+    y[7] = f109 - f108;
+    y[9] = f110 - f109;
+}
+
+void DCT4_16(real_t *y, real_t *x)
+{
+    real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
+    real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20;
+    real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30;
+    real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40;
+    real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50;
+    real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60;
+    real_t f61, f62, f63, f64, f65, f66, f67, f68, f69, f70;
+    real_t f71, f72, f73, f74, f75, f76, f77, f78, f79, f80;
+    real_t f81, f82, f83, f84, f85, f86, f87, f88, f89, f90;
+    real_t f91, f92, f93, f94, f95, f96, f97, f98, f99, f100;
+    real_t f101, f102, f103, f104, f105, f106, f107, f108, f109, f110;
+    real_t f111, f112, f113, f114, f115, f116, f117, f118, f119, f120;
+    real_t f121, f122, f123, f124, f125, f126, f127, f128, f130, f132;
+    real_t f134, f136, f138, f140, f142, f144, f145, f148, f149, f152;
+    real_t f153, f156, f157;
+
+    f0 = x[0] + x[15];
+    f1 = MUL_C(COEF_CONST(1.0478631305325901), x[0]);
+    f2 = MUL_F(FRAC_CONST(-0.9987954562051724), f0);
+    f3 = MUL_F(FRAC_CONST(-0.9497277818777548), x[15]);
+    f4 = f1 + f2;
+    f5 = f3 - f2;
+    f6 = x[2] + x[13];
+    f7 = MUL_C(COEF_CONST(1.2130114330978077), x[2]);
+    f8 = MUL_F(FRAC_CONST(-0.9700312531945440), f6);
+    f9 = MUL_F(FRAC_CONST(-0.7270510732912803), x[13]);
+    f10 = f7 + f8;
+    f11 = f9 - f8;
+    f12 = x[4] + x[11];
+    f13 = MUL_C(COEF_CONST(1.3315443865537255), x[4]);
+    f14 = MUL_F(FRAC_CONST(-0.9039892931234433), f12);
+    f15 = MUL_F(FRAC_CONST(-0.4764341996931612), x[11]);
+    f16 = f13 + f14;
+    f17 = f15 - f14;
+    f18 = x[6] + x[9];
+    f19 = MUL_C(COEF_CONST(1.3989068359730781), x[6]);
+    f20 = MUL_F(FRAC_CONST(-0.8032075314806453), f18);
+    f21 = MUL_F(FRAC_CONST(-0.2075082269882124), x[9]);
+    f22 = f19 + f20;
+    f23 = f21 - f20;
+    f24 = x[8] + x[7];
+    f25 = MUL_C(COEF_CONST(1.4125100802019777), x[8]);
+    f26 = MUL_F(FRAC_CONST(-0.6715589548470187), f24);
+    f27 = MUL_F(FRAC_CONST(0.0693921705079402), x[7]);
+    f28 = f25 + f26;
+    f29 = f27 - f26;
+    f30 = x[10] + x[5];
+    f31 = MUL_C(COEF_CONST(1.3718313541934939), x[10]);
+    f32 = MUL_F(FRAC_CONST(-0.5141027441932219), f30);
+    f33 = MUL_F(FRAC_CONST(0.3436258658070501), x[5]);
+    f34 = f31 + f32;
+    f35 = f33 - f32;
+    f36 = x[12] + x[3];
+    f37 = MUL_C(COEF_CONST(1.2784339185752409), x[12]);
+    f38 = MUL_F(FRAC_CONST(-0.3368898533922200), f36);
+    f39 = MUL_F(FRAC_CONST(0.6046542117908008), x[3]);
+    f40 = f37 + f38;
+    f41 = f39 - f38;
+    f42 = x[14] + x[1];
+    f43 = MUL_C(COEF_CONST(1.1359069844201433), x[14]);
+    f44 = MUL_F(FRAC_CONST(-0.1467304744553624), f42);
+    f45 = MUL_F(FRAC_CONST(0.8424460355094185), x[1]);
+    f46 = f43 + f44;
+    f47 = f45 - f44;
+    f48 = f5 - f29;
+    f49 = f5 + f29;
+    f50 = f4 - f28;
+    f51 = f4 + f28;
+    f52 = f11 - f35;
+    f53 = f11 + f35;
+    f54 = f10 - f34;
+    f55 = f10 + f34;
+    f56 = f17 - f41;
+    f57 = f17 + f41;
+    f58 = f16 - f40;
+    f59 = f16 + f40;
+    f60 = f23 - f47;
+    f61 = f23 + f47;
+    f62 = f22 - f46;
+    f63 = f22 + f46;
+    f64 = f48 + f50;
+    f65 = MUL_C(COEF_CONST(1.1758756024193588), f48);
+    f66 = MUL_F(FRAC_CONST(-0.9807852804032304), f64);
+    f67 = MUL_F(FRAC_CONST(-0.7856949583871021), f50);
+    f68 = f65 + f66;
+    f69 = f67 - f66;
+    f70 = f52 + f54;
+    f71 = MUL_C(COEF_CONST(1.3870398453221475), f52);
+    f72 = MUL_F(FRAC_CONST(-0.5555702330196022), f70);
+    f73 = MUL_F(FRAC_CONST(0.2758993792829431), f54);
+    f74 = f71 + f72;
+    f75 = f73 - f72;
+    f76 = f56 + f58;
+    f77 = MUL_F(FRAC_CONST(0.7856949583871022), f56);
+    f78 = MUL_F(FRAC_CONST(0.1950903220161283), f76);
+    f79 = MUL_C(COEF_CONST(1.1758756024193586), f58);
+    f80 = f77 + f78;
+    f81 = f79 - f78;
+    f82 = f60 + f62;
+    f83 = MUL_F(FRAC_CONST(-0.2758993792829430), f60);
+    f84 = MUL_F(FRAC_CONST(0.8314696123025452), f82);
+    f85 = MUL_C(COEF_CONST(1.3870398453221475), f62);
+    f86 = f83 + f84;
+    f87 = f85 - f84;
+    f88 = f49 - f57;
+    f89 = f49 + f57;
+    f90 = f51 - f59;
+    f91 = f51 + f59;
+    f92 = f53 - f61;
+    f93 = f53 + f61;
+    f94 = f55 - f63;
+    f95 = f55 + f63;
+    f96 = f69 - f81;
+    f97 = f69 + f81;
+    f98 = f68 - f80;
+    f99 = f68 + f80;
+    f100 = f75 - f87;
+    f101 = f75 + f87;
+    f102 = f74 - f86;
+    f103 = f74 + f86;
+    f104 = f88 + f90;
+    f105 = MUL_C(COEF_CONST(1.3065629648763766), f88);
+    f106 = MUL_F(FRAC_CONST(-0.9238795325112866), f104);
+    f107 = MUL_F(FRAC_CONST(-0.5411961001461967), f90);
+    f108 = f105 + f106;
+    f109 = f107 - f106;
+    f110 = f92 + f94;
+    f111 = MUL_F(FRAC_CONST(0.5411961001461969), f92);
+    f112 = MUL_F(FRAC_CONST(0.3826834323650898), f110);
+    f113 = MUL_C(COEF_CONST(1.3065629648763766), f94);
+    f114 = f111 + f112;
+    f115 = f113 - f112;
+    f116 = f96 + f98;
+    f117 = MUL_C(COEF_CONST(1.3065629648763766), f96);
+    f118 = MUL_F(FRAC_CONST(-0.9238795325112866), f116);
+    f119 = MUL_F(FRAC_CONST(-0.5411961001461967), f98);
+    f120 = f117 + f118;
+    f121 = f119 - f118;
+    f122 = f100 + f102;
+    f123 = MUL_F(FRAC_CONST(0.5411961001461969), f100);
+    f124 = MUL_F(FRAC_CONST(0.3826834323650898), f122);
+    f125 = MUL_C(COEF_CONST(1.3065629648763766), f102);
+    f126 = f123 + f124;
+    f127 = f125 - f124;
+    f128 = f89 - f93;
+    y[0] = f89 + f93;
+    f130 = f91 - f95;
+    y[15] = f91 + f95;
+    f132 = f109 - f115;
+    y[3] = f109 + f115;
+    f134 = f108 - f114;
+    y[12] = f108 + f114;
+    f136 = f97 - f101;
+    y[1] = f97 + f101;
+    f138 = f99 - f103;
+    y[14] = f99 + f103;
+    f140 = f121 - f127;
+    y[2] = f121 + f127;
+    f142 = f120 - f126;
+    y[13] = f120 + f126;
+    f144 = f128 - f130;
+    f145 = f128 + f130;
+    y[8] = MUL_F(FRAC_CONST(0.7071067811865474), f144);
+    y[7] = MUL_F(FRAC_CONST(0.7071067811865474), f145);
+    f148 = f132 - f134;
+    f149 = f132 + f134;
+    y[11] = MUL_F(FRAC_CONST(0.7071067811865474), f148);
+    y[4] = MUL_F(FRAC_CONST(0.7071067811865474), f149);
+    f152 = f136 - f138;
+    f153 = f136 + f138;
+    y[9] = MUL_F(FRAC_CONST(0.7071067811865474), f152);
+    y[6] = MUL_F(FRAC_CONST(0.7071067811865474), f153);
+    f156 = f140 - f142;
+    f157 = f140 + f142;
+    y[10] = MUL_F(FRAC_CONST(0.7071067811865474), f156);
+    y[5] = MUL_F(FRAC_CONST(0.7071067811865474), f157);
+}
+
 void DCT3_32_unscaled(real_t *y, real_t *x)
 {
     real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
@@ -70,13 +820,13 @@
     real_t f261, f262, f263, f264, f265, f266, f267, f268, f269, f270;
     real_t f271, f272;
 
-    f0 = MUL_C(COEF_CONST(0.7071067811865476), x[16]);
+    f0 = MUL_F(x[16], FRAC_CONST(0.7071067811865476));
     f1 = x[0] - f0;
     f2 = x[0] + f0;
     f3 = x[8] + x[24];
-    f4 = MUL_C(COEF_CONST(1.3065629648763766), x[8]);
-    f5 = MUL_C(COEF_CONST((-0.9238795325112866)), f3);
-    f6 = MUL_C(COEF_CONST((-0.5411961001461967)), x[24]);
+    f4 = MUL_C(x[8], COEF_CONST(1.3065629648763766));
+    f5 = MUL_F(f3, FRAC_CONST((-0.9238795325112866)));
+    f6 = MUL_F(x[24], FRAC_CONST((-0.5411961001461967)));
     f7 = f4 + f5;
     f8 = f6 - f5;
     f9 = f2 - f8;
@@ -84,23 +834,23 @@
     f11 = f1 - f7;
     f12 = f1 + f7;
     f13 = x[4] + x[28];
-    f14 = MUL_C(COEF_CONST(1.1758756024193588), x[4]);
-    f15 = MUL_C(COEF_CONST((-0.9807852804032304)), f13);
-    f16 = MUL_C(COEF_CONST((-0.7856949583871021)), x[28]);
+    f14 = MUL_C(x[4], COEF_CONST(1.1758756024193588));
+    f15 = MUL_F(f13, FRAC_CONST((-0.9807852804032304)));
+    f16 = MUL_F(x[28], FRAC_CONST((-0.7856949583871021)));
     f17 = f14 + f15;
     f18 = f16 - f15;
     f19 = x[12] + x[20];
-    f20 = MUL_C(COEF_CONST(1.3870398453221473), x[12]);
-    f21 = MUL_C(COEF_CONST((-0.8314696123025455)), f19);
-    f22 = MUL_C(COEF_CONST((-0.2758993792829436)), x[20]);
+    f20 = MUL_C(x[12], COEF_CONST(1.3870398453221473));
+    f21 = MUL_F(f19, FRAC_CONST((-0.8314696123025455)));
+    f22 = MUL_F(x[20], FRAC_CONST((-0.2758993792829436)));
     f23 = f20 + f21;
     f24 = f22 - f21;
     f25 = f18 - f24;
     f26 = f18 + f24;
-    f27 = MUL_C(COEF_CONST(0.7071067811865476), f25);
+    f27 = MUL_F(f25, FRAC_CONST(0.7071067811865476));
     f28 = f17 - f23;
     f29 = f17 + f23;
-    f30 = MUL_C(COEF_CONST(0.7071067811865476), f29);
+    f30 = MUL_F(f29, FRAC_CONST(0.7071067811865476));
     f31 = f27 - f30;
     f32 = f27 + f30;
     f33 = f10 - f26;
@@ -112,27 +862,27 @@
     f39 = f9 - f28;
     f40 = f9 + f28;
     f41 = x[2] + x[30];
-    f42 = MUL_C(COEF_CONST(1.0932018670017569), x[2]);
-    f43 = MUL_C(COEF_CONST((-0.9951847266721969)), f41);
-    f44 = MUL_C(COEF_CONST((-0.8971675863426368)), x[30]);
+    f42 = MUL_C(x[2], COEF_CONST(1.0932018670017569));
+    f43 = MUL_F(f41, FRAC_CONST((-0.9951847266721969)));
+    f44 = MUL_F(x[30], FRAC_CONST((-0.8971675863426368)));
     f45 = f42 + f43;
     f46 = f44 - f43;
     f47 = x[6] + x[26];
-    f48 = MUL_C(COEF_CONST(1.2472250129866711), x[6]);
-    f49 = MUL_C(COEF_CONST((-0.9569403357322089)), f47);
-    f50 = MUL_C(COEF_CONST((-0.6666556584777469)), x[26]);
+    f48 = MUL_C(x[6], COEF_CONST(1.2472250129866711));
+    f49 = MUL_F(f47, FRAC_CONST((-0.9569403357322089)));
+    f50 = MUL_F(x[26], FRAC_CONST((-0.6666556584777469)));
     f51 = f48 + f49;
     f52 = f50 - f49;
     f53 = x[10] + x[22];
-    f54 = MUL_C(COEF_CONST(1.3533180011743526), x[10]);
-    f55 = MUL_C(COEF_CONST((-0.8819212643483551)), f53);
-    f56 = MUL_C(COEF_CONST((-0.4105245275223575)), x[22]);
+    f54 = MUL_C(x[10], COEF_CONST(1.3533180011743526));
+    f55 = MUL_F(f53, FRAC_CONST((-0.8819212643483551)));
+    f56 = MUL_F(x[22], FRAC_CONST((-0.4105245275223575)));
     f57 = f54 + f55;
     f58 = f56 - f55;
     f59 = x[14] + x[18];
-    f60 = MUL_C(COEF_CONST(1.4074037375263826), x[14]);
-    f61 = MUL_C(COEF_CONST((-0.7730104533627369)), f59);
-    f62 = MUL_C(COEF_CONST((-0.1386171691990913)), x[18]);
+    f60 = MUL_C(x[14], COEF_CONST(1.4074037375263826));
+    f61 = MUL_F(f59, FRAC_CONST((-0.7730104533627369)));
+    f62 = MUL_F(x[18], FRAC_CONST((-0.1386171691990913)));
     f63 = f60 + f61;
     f64 = f62 - f61;
     f65 = f46 - f64;
@@ -141,11 +891,11 @@
     f68 = f52 + f58;
     f69 = f66 - f68;
     f70 = f66 + f68;
-    f71 = MUL_C(COEF_CONST(0.7071067811865476), f69);
+    f71 = MUL_F(f69, FRAC_CONST(0.7071067811865476));
     f72 = f65 + f67;
-    f73 = MUL_C(COEF_CONST(1.3065629648763766), f65);
-    f74 = MUL_C(COEF_CONST((-0.9238795325112866)), f72);
-    f75 = MUL_C(COEF_CONST((-0.5411961001461967)), f67);
+    f73 = MUL_C(f65, COEF_CONST(1.3065629648763766));
+    f74 = MUL_F(f72, FRAC_CONST((-0.9238795325112866)));
+    f75 = MUL_F(f67, FRAC_CONST((-0.5411961001461967)));
     f76 = f73 + f74;
     f77 = f75 - f74;
     f78 = f45 - f63;
@@ -153,14 +903,14 @@
     f80 = f51 - f57;
     f81 = f51 + f57;
     f82 = f79 + f81;
-    f83 = MUL_C(COEF_CONST(1.3065629648763770), f79);
-    f84 = MUL_C(COEF_CONST((-0.3826834323650904)), f82);
-    f85 = MUL_C(COEF_CONST(0.5411961001461961), f81);
+    f83 = MUL_C(f79, COEF_CONST(1.3065629648763770));
+    f84 = MUL_F(f82, FRAC_CONST((-0.3826834323650904)));
+    f85 = MUL_F(f81, FRAC_CONST(0.5411961001461961));
     f86 = f83 + f84;
     f87 = f85 - f84;
     f88 = f78 - f80;
     f89 = f78 + f80;
-    f90 = MUL_C(COEF_CONST(0.7071067811865476), f89);
+    f90 = MUL_F(f89, FRAC_CONST(0.7071067811865476));
     f91 = f77 - f87;
     f92 = f77 + f87;
     f93 = f71 - f90;
@@ -184,51 +934,51 @@
     f111 = f33 - f88;
     f112 = f33 + f88;
     f113 = x[1] + x[31];
-    f114 = MUL_C(COEF_CONST(1.0478631305325901), x[1]);
-    f115 = MUL_C(COEF_CONST((-0.9987954562051724)), f113);
-    f116 = MUL_C(COEF_CONST((-0.9497277818777548)), x[31]);
+    f114 = MUL_C(x[1], COEF_CONST(1.0478631305325901));
+    f115 = MUL_F(f113, FRAC_CONST((-0.9987954562051724)));
+    f116 = MUL_F(x[31], FRAC_CONST((-0.9497277818777548)));
     f117 = f114 + f115;
     f118 = f116 - f115;
     f119 = x[5] + x[27];
-    f120 = MUL_C(COEF_CONST(1.2130114330978077), x[5]);
-    f121 = MUL_C(COEF_CONST((-0.9700312531945440)), f119);
-    f122 = MUL_C(COEF_CONST((-0.7270510732912803)), x[27]);
+    f120 = MUL_C(x[5], COEF_CONST(1.2130114330978077));
+    f121 = MUL_F(f119, FRAC_CONST((-0.9700312531945440)));
+    f122 = MUL_F(x[27], FRAC_CONST((-0.7270510732912803)));
     f123 = f120 + f121;
     f124 = f122 - f121;
     f125 = x[9] + x[23];
-    f126 = MUL_C(COEF_CONST(1.3315443865537255), x[9]);
-    f127 = MUL_C(COEF_CONST((-0.9039892931234433)), f125);
-    f128 = MUL_C(COEF_CONST((-0.4764341996931612)), x[23]);
+    f126 = MUL_C(x[9], COEF_CONST(1.3315443865537255));
+    f127 = MUL_F(f125, FRAC_CONST((-0.9039892931234433)));
+    f128 = MUL_F(x[23], FRAC_CONST((-0.4764341996931612)));
     f129 = f126 + f127;
     f130 = f128 - f127;
     f131 = x[13] + x[19];
-    f132 = MUL_C(COEF_CONST(1.3989068359730781), x[13]);
-    f133 = MUL_C(COEF_CONST((-0.8032075314806453)), f131);
-    f134 = MUL_C(COEF_CONST((-0.2075082269882124)), x[19]);
+    f132 = MUL_C(x[13], COEF_CONST(1.3989068359730781));
+    f133 = MUL_F(f131, FRAC_CONST((-0.8032075314806453)));
+    f134 = MUL_F(x[19], FRAC_CONST((-0.2075082269882124)));
     f135 = f132 + f133;
     f136 = f134 - f133;
     f137 = x[17] + x[15];
-    f138 = MUL_C(COEF_CONST(1.4125100802019777), x[17]);
-    f139 = MUL_C(COEF_CONST((-0.6715589548470187)), f137);
-    f140 = MUL_C(COEF_CONST(0.0693921705079402), x[15]);
+    f138 = MUL_C(x[17], COEF_CONST(1.4125100802019777));
+    f139 = MUL_F(f137, FRAC_CONST((-0.6715589548470187)));
+    f140 = MUL_F(x[15], FRAC_CONST(0.0693921705079402));
     f141 = f138 + f139;
     f142 = f140 - f139;
     f143 = x[21] + x[11];
-    f144 = MUL_C(COEF_CONST(1.3718313541934939), x[21]);
-    f145 = MUL_C(COEF_CONST((-0.5141027441932219)), f143);
-    f146 = MUL_C(COEF_CONST(0.3436258658070501), x[11]);
+    f144 = MUL_C(x[21], COEF_CONST(1.3718313541934939));
+    f145 = MUL_F(f143, FRAC_CONST((-0.5141027441932219)));
+    f146 = MUL_F(x[11], FRAC_CONST(0.3436258658070501));
     f147 = f144 + f145;
     f148 = f146 - f145;
     f149 = x[25] + x[7];
-    f150 = MUL_C(COEF_CONST(1.2784339185752409), x[25]);
-    f151 = MUL_C(COEF_CONST((-0.3368898533922200)), f149);
-    f152 = MUL_C(COEF_CONST(0.6046542117908008), x[7]);
+    f150 = MUL_C(x[25], COEF_CONST(1.2784339185752409));
+    f151 = MUL_F(f149, FRAC_CONST((-0.3368898533922200)));
+    f152 = MUL_F(x[7], FRAC_CONST(0.6046542117908008));
     f153 = f150 + f151;
     f154 = f152 - f151;
     f155 = x[29] + x[3];
-    f156 = MUL_C(COEF_CONST(1.1359069844201433), x[29]);
-    f157 = MUL_C(COEF_CONST((-0.1467304744553624)), f155);
-    f158 = MUL_C(COEF_CONST(0.8424460355094185), x[3]);
+    f156 = MUL_C(x[29], COEF_CONST(1.1359069844201433));
+    f157 = MUL_F(f155, FRAC_CONST((-0.1467304744553624)));
+    f158 = MUL_F(x[3], FRAC_CONST(0.8424460355094185));
     f159 = f156 + f157;
     f160 = f158 - f157;
     f161 = f118 - f142;
@@ -248,27 +998,27 @@
     f175 = f135 - f159;
     f176 = f135 + f159;
     f177 = f161 + f163;
-    f178 = MUL_C(COEF_CONST(1.1758756024193588), f161);
-    f179 = MUL_C(COEF_CONST((-0.9807852804032304)), f177);
-    f180 = MUL_C(COEF_CONST((-0.7856949583871021)), f163);
+    f178 = MUL_C(f161, COEF_CONST(1.1758756024193588));
+    f179 = MUL_F(f177, FRAC_CONST((-0.9807852804032304)));
+    f180 = MUL_F(f163, FRAC_CONST((-0.7856949583871021)));
     f181 = f178 + f179;
     f182 = f180 - f179;
     f183 = f165 + f167;
-    f184 = MUL_C(COEF_CONST(1.3870398453221475), f165);
-    f185 = MUL_C(COEF_CONST((-0.5555702330196022)), f183);
-    f186 = MUL_C(COEF_CONST(0.2758993792829431), f167);
+    f184 = MUL_C(f165, COEF_CONST(1.3870398453221475));
+    f185 = MUL_F(f183, FRAC_CONST((-0.5555702330196022)));
+    f186 = MUL_F(f167, FRAC_CONST(0.2758993792829431));
     f187 = f184 + f185;
     f188 = f186 - f185;
     f189 = f169 + f171;
-    f190 = MUL_C(COEF_CONST(0.7856949583871022), f169);
-    f191 = MUL_C(COEF_CONST(0.1950903220161283), f189);
-    f192 = MUL_C(COEF_CONST(1.1758756024193586), f171);
+    f190 = MUL_F(f169, FRAC_CONST(0.7856949583871022));
+    f191 = MUL_F(f189, FRAC_CONST(0.1950903220161283));
+    f192 = MUL_C(f171, COEF_CONST(1.1758756024193586));
     f193 = f190 + f191;
     f194 = f192 - f191;
     f195 = f173 + f175;
-    f196 = MUL_C(COEF_CONST((-0.2758993792829430)), f173);
-    f197 = MUL_C(COEF_CONST(0.8314696123025452), f195);
-    f198 = MUL_C(COEF_CONST(1.3870398453221475), f175);
+    f196 = MUL_F(f173, FRAC_CONST((-0.2758993792829430)));
+    f197 = MUL_F(f195, FRAC_CONST(0.8314696123025452));
+    f198 = MUL_C(f175, COEF_CONST(1.3870398453221475));
     f199 = f196 + f197;
     f200 = f198 - f197;
     f201 = f162 - f170;
@@ -288,27 +1038,27 @@
     f215 = f187 - f199;
     f216 = f187 + f199;
     f217 = f201 + f203;
-    f218 = MUL_C(COEF_CONST(1.3065629648763766), f201);
-    f219 = MUL_C(COEF_CONST((-0.9238795325112866)), f217);
-    f220 = MUL_C(COEF_CONST((-0.5411961001461967)), f203);
+    f218 = MUL_C(f201, COEF_CONST(1.3065629648763766));
+    f219 = MUL_F(f217, FRAC_CONST((-0.9238795325112866)));
+    f220 = MUL_F(f203, FRAC_CONST((-0.5411961001461967)));
     f221 = f218 + f219;
     f222 = f220 - f219;
     f223 = f205 + f207;
-    f224 = MUL_C(COEF_CONST(0.5411961001461969), f205);
-    f225 = MUL_C(COEF_CONST(0.3826834323650898), f223);
-    f226 = MUL_C(COEF_CONST(1.3065629648763766), f207);
+    f224 = MUL_F(f205, FRAC_CONST(0.5411961001461969));
+    f225 = MUL_F(f223, FRAC_CONST(0.3826834323650898));
+    f226 = MUL_C(f207, COEF_CONST(1.3065629648763766));
     f227 = f224 + f225;
     f228 = f226 - f225;
     f229 = f209 + f211;
-    f230 = MUL_C(COEF_CONST(1.3065629648763766), f209);
-    f231 = MUL_C(COEF_CONST((-0.9238795325112866)), f229);
-    f232 = MUL_C(COEF_CONST((-0.5411961001461967)), f211);
+    f230 = MUL_C(f209, COEF_CONST(1.3065629648763766));
+    f231 = MUL_F(f229, FRAC_CONST((-0.9238795325112866)));
+    f232 = MUL_F(f211, FRAC_CONST((-0.5411961001461967)));
     f233 = f230 + f231;
     f234 = f232 - f231;
     f235 = f213 + f215;
-    f236 = MUL_C(COEF_CONST(0.5411961001461969), f213);
-    f237 = MUL_C(COEF_CONST(0.3826834323650898), f235);
-    f238 = MUL_C(COEF_CONST(1.3065629648763766), f215);
+    f236 = MUL_F(f213, FRAC_CONST(0.5411961001461969));
+    f237 = MUL_F(f235, FRAC_CONST(0.3826834323650898));
+    f238 = MUL_C(f215, COEF_CONST(1.3065629648763766));
     f239 = f236 + f237;
     f240 = f238 - f237;
     f241 = f202 - f206;
@@ -329,20 +1079,20 @@
     f256 = f233 + f239;
     f257 = f241 - f243;
     f258 = f241 + f243;
-    f259 = MUL_C(COEF_CONST(0.7071067811865474), f257);
-    f260 = MUL_C(COEF_CONST(0.7071067811865474), f258);
+    f259 = MUL_F(f257, FRAC_CONST(0.7071067811865474));
+    f260 = MUL_F(f258, FRAC_CONST(0.7071067811865474));
     f261 = f245 - f247;
     f262 = f245 + f247;
-    f263 = MUL_C(COEF_CONST(0.7071067811865474), f261);
-    f264 = MUL_C(COEF_CONST(0.7071067811865474), f262);
+    f263 = MUL_F(f261, FRAC_CONST(0.7071067811865474));
+    f264 = MUL_F(f262, FRAC_CONST(0.7071067811865474));
     f265 = f249 - f251;
     f266 = f249 + f251;
-    f267 = MUL_C(COEF_CONST(0.7071067811865474), f265);
-    f268 = MUL_C(COEF_CONST(0.7071067811865474), f266);
+    f267 = MUL_F(f265, FRAC_CONST(0.7071067811865474));
+    f268 = MUL_F(f266, FRAC_CONST(0.7071067811865474));
     f269 = f253 - f255;
     f270 = f253 + f255;
-    f271 = MUL_C(COEF_CONST(0.7071067811865474), f269);
-    f272 = MUL_C(COEF_CONST(0.7071067811865474), f270);
+    f271 = MUL_F(f269, FRAC_CONST(0.7071067811865474));
+    f272 = MUL_F(f270, FRAC_CONST(0.7071067811865474));
     y[31] = f98 - f242;
     y[0] = f98 + f242;
     y[30] = f100 - f250;
@@ -377,2286 +1127,1145 @@
     y[15] = f97 + f244;
 }
 
-void DCT2_64_unscaled(real_t *y, real_t *x)
+void DCT2_32_unscaled(real_t *y, real_t *x)
 {
-    int16_t i0;
-    real_t f2, f3, f4, f5, f6, f7, f8, f9, f10;
+    real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
     real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20;
     real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30;
     real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40;
     real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50;
     real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60;
-    real_t f61, f62, f65, f66, f67, f68, f71, f72, f73, f74;
-    real_t f75, f76, f77, f78, f79, f80, f81, f82, f85, f86;
-    real_t f87, f88, f91, f92, f93, f94, f95, f96, f97, f98;
+    real_t f63, f64, f65, f66, f69, f70, f71, f72, f73, f74;
+    real_t f75, f76, f77, f78, f79, f80, f81, f83, f85, f86;
+    real_t f89, f90, f91, f92, f93, f94, f95, f96, f97, f98;
     real_t f99, f100, f101, f102, f103, f104, f105, f106, f107, f108;
     real_t f109, f110, f111, f112, f113, f114, f115, f116, f117, f118;
-    real_t f119, f120, f121, f122, f123, f124, f125, f126, 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 f119, f120, f121, f122, f123, f124, f127, f128, f129, f130;
+    real_t f133, f134, f135, f136, f139, f140, f141, f142, f145, f146;
+    real_t f147, f148, f149, f150, f151, f152, f153, f154, f155, f156;
     real_t f157, f158, f159, f160, f161, f162, f163, f164, f165, f166;
     real_t f167, f168, f169, f170, f171, f172, f173, f174, f175, f176;
     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];
+    real_t f207, f208, f209, f210, f211, f212, f213, f214, f215, f216;
+    real_t f217, f218, f219, f220, f221, f222, f223, f224, f225, f226;
+    real_t f227, f228, f229, f230, f231, f232, f233, f234, f235, f236;
+    real_t f237, f238, f239, f240, f241, f242, f243, f244, f247, f248;
+    real_t f249, f250, f253, f254, f255, f256, f259, f260, f261, f262;
+    real_t f265, f266, f267, f268, f271, f272, f273, f274, f277, f278;
+    real_t f279, f280, f283, f284, f285, f286;
 
-    for (i0=0; i0<32; i0++)
-    {
-        t2[2*i0+1] = x[i0] - x[-i0+63];
-        t2[2*i0] = x[i0] + x[-i0+63];
-    }
-    f2 = t2[0] - t2[62];
-    f3 = t2[0] + t2[62];
-    f4 = t2[2] - t2[60];
-    f5 = t2[2] + t2[60];
-    f6 = t2[4] - t2[58];
-    f7 = t2[4] + t2[58];
-    f8 = t2[6] - t2[56];
-    f9 = t2[6] + t2[56];
-    f10 = t2[8] - t2[54];
-    f11 = t2[8] + t2[54];
-    f12 = t2[10] - t2[52];
-    f13 = t2[10] + t2[52];
-    f14 = t2[12] - t2[50];
-    f15 = t2[12] + t2[50];
-    f16 = t2[14] - t2[48];
-    f17 = t2[14] + t2[48];
-    f18 = t2[16] - t2[46];
-    f19 = t2[16] + t2[46];
-    f20 = t2[18] - t2[44];
-    f21 = t2[18] + t2[44];
-    f22 = t2[20] - t2[42];
-    f23 = t2[20] + t2[42];
-    f24 = t2[22] - t2[40];
-    f25 = t2[22] + t2[40];
-    f26 = t2[24] - t2[38];
-    f27 = t2[24] + t2[38];
-    f28 = t2[26] - t2[36];
-    f29 = t2[26] + t2[36];
-    f30 = t2[28] - t2[34];
-    f31 = t2[28] + t2[34];
-    f32 = t2[30] - t2[32];
-    f33 = t2[30] + t2[32];
-    f34 = f3 - f33;
-    f35 = f3 + f33;
-    f36 = f5 - f31;
-    f37 = f5 + f31;
-    f38 = f7 - f29;
-    f39 = f7 + f29;
-    f40 = f9 - f27;
-    f41 = f9 + f27;
-    f42 = f11 - f25;
-    f43 = f11 + f25;
-    f44 = f13 - f23;
-    f45 = f13 + f23;
-    f46 = f15 - f21;
-    f47 = f15 + f21;
-    f48 = f17 - f19;
-    f49 = f17 + f19;
-    f50 = f35 - f49;
-    f51 = f35 + f49;
-    f52 = f37 - f47;
-    f53 = f37 + f47;
-    f54 = f39 - f45;
-    f55 = f39 + f45;
-    f56 = f41 - f43;
-    f57 = f41 + f43;
-    f58 = f51 - f57;
-    f59 = f51 + f57;
-    f60 = f53 - f55;
-    f61 = f53 + f55;
-    f62 = f59 - f61;
-    y[0] = f59 + f61;
-    y[32] = MUL_C(COEF_CONST(0.7071067811865476), f62);
-    f65 = f58 + f60;
-    f66 = MUL_C(COEF_CONST(1.3065629648763766), f58);
-    f67 = MUL_C(COEF_CONST((-0.9238795325112866)), f65);
-    f68 = MUL_C(COEF_CONST((-0.5411961001461967)), f60);
-    y[48] = f66 + f67;
-    y[16] = f68 - f67;
-    f71 = 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;
+    f0 = x[0] - x[31];
+    f1 = x[0] + x[31];
+    f2 = x[1] - x[30];
+    f3 = x[1] + x[30];
+    f4 = x[2] - x[29];
+    f5 = x[2] + x[29];
+    f6 = x[3] - x[28];
+    f7 = x[3] + x[28];
+    f8 = x[4] - x[27];
+    f9 = x[4] + x[27];
+    f10 = x[5] - x[26];
+    f11 = x[5] + x[26];
+    f12 = x[6] - x[25];
+    f13 = x[6] + x[25];
+    f14 = x[7] - x[24];
+    f15 = x[7] + x[24];
+    f16 = x[8] - x[23];
+    f17 = x[8] + x[23];
+    f18 = x[9] - x[22];
+    f19 = x[9] + x[22];
+    f20 = x[10] - x[21];
+    f21 = x[10] + x[21];
+    f22 = x[11] - x[20];
+    f23 = x[11] + x[20];
+    f24 = x[12] - x[19];
+    f25 = x[12] + x[19];
+    f26 = x[13] - x[18];
+    f27 = x[13] + x[18];
+    f28 = x[14] - x[17];
+    f29 = x[14] + x[17];
+    f30 = x[15] - x[16];
+    f31 = x[15] + x[16];
+    f32 = f1 - f31;
+    f33 = f1 + f31;
+    f34 = f3 - f29;
+    f35 = f3 + f29;
+    f36 = f5 - f27;
+    f37 = f5 + f27;
+    f38 = f7 - f25;
+    f39 = f7 + f25;
+    f40 = f9 - f23;
+    f41 = f9 + f23;
+    f42 = f11 - f21;
+    f43 = f11 + f21;
+    f44 = f13 - f19;
+    f45 = f13 + f19;
+    f46 = f15 - f17;
+    f47 = f15 + f17;
+    f48 = f33 - f47;
+    f49 = f33 + f47;
+    f50 = f35 - f45;
+    f51 = f35 + f45;
+    f52 = f37 - f43;
+    f53 = f37 + f43;
+    f54 = f39 - f41;
+    f55 = f39 + f41;
+    f56 = f49 - f55;
+    f57 = f49 + f55;
+    f58 = f51 - f53;
+    f59 = f51 + f53;
+    f60 = f57 - f59;
+    y[0] = f57 + f59;
+    y[16] = MUL_F(FRAC_CONST(0.7071067811865476), f60);
+    f63 = f56 + f58;
+    f64 = MUL_C(COEF_CONST(1.3065629648763766), f56);
+    f65 = MUL_F(FRAC_CONST(-0.9238795325112866), f63);
+    f66 = MUL_F(FRAC_CONST(-0.5411961001461967), f58);
+    y[24] = f64 + f65;
+    y[8] = f66 - f65;
+    f69 = f48 + f54;
+    f70 = MUL_C(COEF_CONST(1.1758756024193588), f48);
+    f71 = MUL_F(FRAC_CONST(-0.9807852804032304), f69);
+    f72 = MUL_F(FRAC_CONST(-0.7856949583871021), f54);
+    f73 = f70 + f71;
+    f74 = f72 - f71;
+    f75 = f50 + f52;
+    f76 = MUL_C(COEF_CONST(1.3870398453221473), f50);
+    f77 = MUL_F(FRAC_CONST(-0.8314696123025455), f75);
+    f78 = MUL_F(FRAC_CONST(-0.2758993792829436), f52);
+    f79 = f76 + f77;
+    f80 = f78 - f77;
+    f81 = f74 - f80;
+    y[4] = f74 + f80;
+    f83 = MUL_F(FRAC_CONST(0.7071067811865476), f81);
+    y[28] = f73 - f79;
+    f85 = f73 + f79;
+    f86 = MUL_F(FRAC_CONST(0.7071067811865476), f85);
+    y[20] = f83 - f86;
+    y[12] = f83 + f86;
+    f89 = f34 - f36;
+    f90 = f34 + f36;
+    f91 = f38 - f40;
+    f92 = f38 + f40;
+    f93 = f42 - f44;
+    f94 = f42 + f44;
+    f95 = MUL_F(FRAC_CONST(0.7071067811865476), f92);
+    f96 = f32 - f95;
+    f97 = f32 + f95;
+    f98 = f90 + f94;
+    f99 = MUL_C(COEF_CONST(1.3065629648763766), f90);
+    f100 = MUL_F(FRAC_CONST(-0.9238795325112866), f98);
+    f101 = MUL_F(FRAC_CONST(-0.5411961001461967), f94);
+    f102 = f99 + f100;
+    f103 = f101 - f100;
+    f104 = f97 - f103;
+    f105 = f97 + f103;
+    f106 = f96 - f102;
+    f107 = f96 + f102;
+    f108 = MUL_F(FRAC_CONST(0.7071067811865476), f91);
+    f109 = f46 - f108;
+    f110 = f46 + f108;
+    f111 = f93 + f89;
+    f112 = MUL_C(COEF_CONST(1.3065629648763766), f93);
+    f113 = MUL_F(FRAC_CONST(-0.9238795325112866), f111);
+    f114 = MUL_F(FRAC_CONST(-0.5411961001461967), f89);
+    f115 = f112 + f113;
+    f116 = f114 - f113;
+    f117 = f110 - f116;
+    f118 = f110 + f116;
+    f119 = f109 - f115;
+    f120 = f109 + f115;
+    f121 = f118 + f105;
+    f122 = MUL_F(FRAC_CONST(-0.8971675863426361), f118);
+    f123 = MUL_F(FRAC_CONST(0.9951847266721968), f121);
+    f124 = MUL_C(COEF_CONST(1.0932018670017576), f105);
+    y[2] = f122 + f123;
+    y[30] = f124 - f123;
+    f127 = f107 - f120;
+    f128 = MUL_F(FRAC_CONST(-0.6666556584777466), f120);
+    f129 = MUL_F(FRAC_CONST(0.9569403357322089), f127);
+    f130 = MUL_C(COEF_CONST(1.2472250129866713), f107);
+    y[6] = f129 - f128;
+    y[26] = f130 - f129;
+    f133 = f119 + f106;
+    f134 = MUL_F(FRAC_CONST(-0.4105245275223571), f119);
+    f135 = MUL_F(FRAC_CONST(0.8819212643483549), f133);
+    f136 = MUL_C(COEF_CONST(1.3533180011743529), f106);
+    y[10] = f134 + f135;
+    y[22] = f136 - f135;
+    f139 = f104 - f117;
+    f140 = MUL_F(FRAC_CONST(-0.1386171691990915), f117);
+    f141 = MUL_F(FRAC_CONST(0.7730104533627370), f139);
+    f142 = MUL_C(COEF_CONST(1.4074037375263826), f104);
+    y[14] = f141 - f140;
+    y[18] = f142 - f141;
+    f145 = f2 - f4;
+    f146 = f2 + f4;
+    f147 = f6 - f8;
+    f148 = f6 + f8;
+    f149 = f10 - f12;
+    f150 = f10 + f12;
+    f151 = f14 - f16;
+    f152 = f14 + f16;
+    f153 = f18 - f20;
+    f154 = f18 + f20;
+    f155 = f22 - f24;
+    f156 = f22 + f24;
+    f157 = f26 - f28;
+    f158 = f26 + f28;
+    f159 = MUL_F(FRAC_CONST(0.7071067811865476), f152);
+    f160 = f0 - f159;
+    f161 = f0 + f159;
+    f162 = f148 + f156;
+    f163 = MUL_C(COEF_CONST(1.3065629648763766), f148);
+    f164 = MUL_F(FRAC_CONST(-0.9238795325112866), f162);
+    f165 = MUL_F(FRAC_CONST(-0.5411961001461967), f156);
+    f166 = f163 + f164;
+    f167 = f165 - f164;
+    f168 = f161 - f167;
+    f169 = f161 + f167;
+    f170 = f160 - f166;
+    f171 = f160 + f166;
+    f172 = f146 + f158;
+    f173 = MUL_C(COEF_CONST(1.1758756024193588), f146);
+    f174 = MUL_F(FRAC_CONST(-0.9807852804032304), f172);
+    f175 = MUL_F(FRAC_CONST(-0.7856949583871021), f158);
+    f176 = f173 + f174;
+    f177 = f175 - f174;
+    f178 = f150 + f154;
+    f179 = MUL_C(COEF_CONST(1.3870398453221473), f150);
+    f180 = MUL_F(FRAC_CONST(-0.8314696123025455), f178);
+    f181 = MUL_F(FRAC_CONST(-0.2758993792829436), f154);
+    f182 = f179 + f180;
+    f183 = f181 - f180;
+    f184 = f177 - f183;
+    f185 = f177 + f183;
+    f186 = MUL_F(FRAC_CONST(0.7071067811865476), f184);
+    f187 = f176 - f182;
+    f188 = f176 + f182;
+    f189 = MUL_F(FRAC_CONST(0.7071067811865476), f188);
+    f190 = f186 - f189;
+    f191 = f186 + f189;
+    f192 = f169 - f185;
+    f193 = f169 + f185;
+    f194 = f171 - f191;
+    f195 = f171 + f191;
+    f196 = f170 - f190;
+    f197 = f170 + f190;
+    f198 = f168 - f187;
+    f199 = f168 + f187;
+    f200 = MUL_F(FRAC_CONST(0.7071067811865476), f151);
+    f201 = f30 - f200;
+    f202 = f30 + f200;
+    f203 = f155 + f147;
+    f204 = MUL_C(COEF_CONST(1.3065629648763766), f155);
+    f205 = MUL_F(FRAC_CONST(-0.9238795325112866), f203);
+    f206 = MUL_F(FRAC_CONST(-0.5411961001461967), f147);
+    f207 = f204 + f205;
+    f208 = f206 - f205;
+    f209 = f202 - f208;
+    f210 = f202 + f208;
+    f211 = f201 - f207;
+    f212 = f201 + f207;
+    f213 = f157 + f145;
+    f214 = MUL_C(COEF_CONST(1.1758756024193588), f157);
+    f215 = MUL_F(FRAC_CONST(-0.9807852804032304), f213);
+    f216 = MUL_F(FRAC_CONST(-0.7856949583871021), f145);
+    f217 = f214 + f215;
+    f218 = f216 - f215;
+    f219 = f153 + f149;
+    f220 = MUL_C(COEF_CONST(1.3870398453221473), f153);
+    f221 = MUL_F(FRAC_CONST(-0.8314696123025455), f219);
+    f222 = MUL_F(FRAC_CONST(-0.2758993792829436), f149);
+    f223 = f220 + f221;
+    f224 = f222 - f221;
+    f225 = f218 - f224;
+    f226 = f218 + f224;
+    f227 = MUL_F(FRAC_CONST(0.7071067811865476), f225);
+    f228 = f217 - f223;
+    f229 = f217 + f223;
+    f230 = MUL_F(FRAC_CONST(0.7071067811865476), f229);
+    f231 = f227 - f230;
+    f232 = f227 + f230;
+    f233 = f210 - f226;
+    f234 = f210 + f226;
+    f235 = f212 - f232;
+    f236 = f212 + f232;
+    f237 = f211 - f231;
+    f238 = f211 + f231;
+    f239 = f209 - f228;
+    f240 = f209 + f228;
+    f241 = f234 + f193;
+    f242 = MUL_F(FRAC_CONST(-0.9497277818777543), f234);
+    f243 = MUL_F(FRAC_CONST(0.9987954562051724), f241);
+    f244 = MUL_C(COEF_CONST(1.0478631305325905), f193);
+    y[1] = f242 + f243;
+    y[31] = f244 - f243;
+    f247 = f195 - f236;
+    f248 = MUL_F(FRAC_CONST(-0.8424460355094192), f236);
+    f249 = MUL_F(FRAC_CONST(0.9891765099647810), f247);
+    f250 = MUL_C(COEF_CONST(1.1359069844201428), f195);
+    y[3] = f249 - f248;
+    y[29] = f250 - f249;
+    f253 = f238 + f197;
+    f254 = MUL_F(FRAC_CONST(-0.7270510732912801), f238);
+    f255 = MUL_F(FRAC_CONST(0.9700312531945440), f253);
+    f256 = MUL_C(COEF_CONST(1.2130114330978079), f197);
+    y[5] = f254 + f255;
+    y[27] = f256 - f255;
+    f259 = f199 - f240;
+    f260 = MUL_F(FRAC_CONST(-0.6046542117908007), f240);
+    f261 = MUL_F(FRAC_CONST(0.9415440651830208), f259);
+    f262 = MUL_C(COEF_CONST(1.2784339185752409), f199);
+    y[7] = f261 - f260;
+    y[25] = f262 - f261;
+    f265 = f239 + f198;
+    f266 = MUL_F(FRAC_CONST(-0.4764341996931611), f239);
+    f267 = MUL_F(FRAC_CONST(0.9039892931234433), f265);
+    f268 = MUL_C(COEF_CONST(1.3315443865537255), f198);
+    y[9] = f266 + f267;
+    y[23] = f268 - f267;
+    f271 = f196 - f237;
+    f272 = MUL_F(FRAC_CONST(-0.3436258658070505), f237);
+    f273 = MUL_F(FRAC_CONST(0.8577286100002721), f271);
+    f274 = MUL_C(COEF_CONST(1.3718313541934939), f196);
+    y[11] = f273 - f272;
+    y[21] = f274 - f273;
+    f277 = f235 + f194;
+    f278 = MUL_F(FRAC_CONST(-0.2075082269882114), f235);
+    f279 = MUL_F(FRAC_CONST(0.8032075314806448), f277);
+    f280 = MUL_C(COEF_CONST(1.3989068359730783), f194);
+    y[13] = f278 + f279;
+    y[19] = f280 - f279;
+    f283 = f192 - f233;
+    f284 = MUL_F(FRAC_CONST(-0.0693921705079408), f233);
+    f285 = MUL_F(FRAC_CONST(0.7409511253549591), f283);
+    f286 = MUL_C(COEF_CONST(1.4125100802019774), f192);
+    y[15] = f285 - f284;
+    y[17] = f286 - f285;
 }
 
 #else
 
-void DCT4_64(real_t *y, real_t *x)
+
+#define n 32
+#define log2n 5
+
+// w_array_real[i] = cos(2*M_PI*i/32)
+static const real_t w_array_real[] = {
+    FRAC_CONST(1.000000000000000), FRAC_CONST(0.980785279337272),
+    FRAC_CONST(0.923879528329380), FRAC_CONST(0.831469603195765),
+    FRAC_CONST(0.707106765732237), FRAC_CONST(0.555570210304169),
+    FRAC_CONST(0.382683402077046), FRAC_CONST(0.195090284503576),
+    FRAC_CONST(0.000000000000000), FRAC_CONST(-0.195090370246552),
+    FRAC_CONST(-0.382683482845162), FRAC_CONST(-0.555570282993553),
+    FRAC_CONST(-0.707106827549476), FRAC_CONST(-0.831469651765257),
+    FRAC_CONST(-0.923879561784627), FRAC_CONST(-0.980785296392607)
+};
+
+// w_array_imag[i] = sin(-2*M_PI*i/32)
+static const real_t w_array_imag[] = {
+    FRAC_CONST(0.000000000000000), FRAC_CONST(-0.195090327375064),
+    FRAC_CONST(-0.382683442461104), FRAC_CONST(-0.555570246648862),
+    FRAC_CONST(-0.707106796640858), FRAC_CONST(-0.831469627480512),
+    FRAC_CONST(-0.923879545057005), FRAC_CONST(-0.980785287864940),
+    FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.980785270809601),
+    FRAC_CONST(-0.923879511601754), FRAC_CONST(-0.831469578911016),
+    FRAC_CONST(-0.707106734823616), FRAC_CONST(-0.555570173959476),
+    FRAC_CONST(-0.382683361692986), FRAC_CONST(-0.195090241632088)
+};
+
+// FFT decimation in frequency
+// 4*16*2+16=128+16=144 multiplications
+// 6*16*2+10*8+4*16*2=192+80+128=400 additions
+static void fft_dif(real_t * Real, real_t * Imag)
 {
-    int16_t i0;
-    static real_t t2[64];
+    real_t w_real, w_imag; // For faster access
+    real_t point1_real, point1_imag, point2_real, point2_imag; // For faster access
+    uint32_t j, i, i2, w_index; // Counters
+
+    // First 2 stages of 32 point FFT decimation in frequency
+    // 4*16*2=64*2=128 multiplications
+    // 6*16*2=96*2=192 additions
+	// Stage 1 of 32 point FFT decimation in frequency
+    for (i = 0; i < 16; i++)
+    {
+        point1_real = Real[i];
+        point1_imag = Imag[i];
+        i2 = i+16;
+        point2_real = Real[i2];
+        point2_imag = Imag[i2];
+
+        w_real = w_array_real[i];
+        w_imag = w_array_imag[i];
+
+        // temp1 = x[i] - x[i2]
+        point1_real -= point2_real;
+        point1_imag -= point2_imag;
+
+        // x[i1] = x[i] + x[i2]
+        Real[i] += point2_real;
+        Imag[i] += point2_imag;
+
+        // x[i2] = (x[i] - x[i2]) * w
+        Real[i2] = (MUL_F(point1_real,w_real) - MUL_F(point1_imag,w_imag));
+        Imag[i2] = (MUL_F(point1_real,w_imag) + MUL_F(point1_imag,w_real));
+     }
+    // Stage 2 of 32 point FFT decimation in frequency
+    for (j = 0, w_index = 0; j < 8; j++, w_index += 2)
+    {
+        w_real = w_array_real[w_index];
+        w_imag = w_array_imag[w_index];
+
+    	i = j;
+        point1_real = Real[i];
+        point1_imag = Imag[i];
+        i2 = i+8;
+        point2_real = Real[i2];
+        point2_imag = Imag[i2];
+
+        // temp1 = x[i] - x[i2]
+        point1_real -= point2_real;
+        point1_imag -= point2_imag;
+
+        // x[i1] = x[i] + x[i2]
+        Real[i] += point2_real;
+        Imag[i] += point2_imag;
+
+        // x[i2] = (x[i] - x[i2]) * w
+        Real[i2] = (MUL_F(point1_real,w_real) - MUL_F(point1_imag,w_imag));
+        Imag[i2] = (MUL_F(point1_real,w_imag) + MUL_F(point1_imag,w_real));
+
+        i = j+16;
+        point1_real = Real[i];
+        point1_imag = Imag[i];
+        i2 = i+8;
+        point2_real = Real[i2];
+        point2_imag = Imag[i2];
+
+        // temp1 = x[i] - x[i2]
+        point1_real -= point2_real;
+        point1_imag -= point2_imag;
+
+        // x[i1] = x[i] + x[i2]
+        Real[i] += point2_real;
+        Imag[i] += point2_imag;
+
+        // x[i2] = (x[i] - x[i2]) * w
+        Real[i2] = (MUL_F(point1_real,w_real) - MUL_F(point1_imag,w_imag));
+        Imag[i2] = (MUL_F(point1_real,w_imag) + MUL_F(point1_imag,w_real));
+    }
+
+    // Stage 3 of 32 point FFT decimation in frequency
+    // 2*4*2=16 multiplications
+    // 4*4*2+6*4*2=10*8=80 additions
+    for (i = 0; i < n; i += 8)
+    {
+        i2 = i+4;
+        point1_real = Real[i];
+        point1_imag = Imag[i];
+
+        point2_real = Real[i2];
+        point2_imag = Imag[i2];
+
+        // out[i1] = point1 + point2
+        Real[i] += point2_real;
+        Imag[i] += point2_imag;
+
+        // out[i2] = point1 - point2
+        Real[i2] = point1_real - point2_real;
+        Imag[i2] = point1_imag - point2_imag;
+    }
+    w_real = w_array_real[4]; // = sqrt(2)/2
+    // w_imag = -w_real; // = w_array_imag[4]; // = -sqrt(2)/2
+    for (i = 1; i < n; i += 8)
+    {
+        i2 = i+4;
+        point1_real = Real[i];
+        point1_imag = Imag[i];
+
+        point2_real = Real[i2];
+        point2_imag = Imag[i2];
+
+        // temp1 = x[i] - x[i2]
+        point1_real -= point2_real;
+        point1_imag -= point2_imag;
+
+        // x[i1] = x[i] + x[i2]
+        Real[i] += point2_real;
+        Imag[i] += point2_imag;
+
+        // x[i2] = (x[i] - x[i2]) * w
+        Real[i2] = MUL_F(point1_real+point1_imag, w_real);
+        Imag[i2] = MUL_F(point1_imag-point1_real, w_real);
+    }
+    for (i = 2; i < n; i += 8)
+    {
+        i2 = i+4;
+        point1_real = Real[i];
+        point1_imag = Imag[i];
+
+        point2_real = Real[i2];
+        point2_imag = Imag[i2];
+
+        // x[i] = x[i] + x[i2]
+        Real[i] += point2_real;
+        Imag[i] += point2_imag;
+
+        // x[i2] = (x[i] - x[i2]) * (-i)
+        Real[i2] = point1_imag - point2_imag;
+        Imag[i2] = point2_real - point1_real;
+    }
+    w_real = w_array_real[12]; // = -sqrt(2)/2
+    // w_imag = w_real; // = w_array_imag[12]; // = -sqrt(2)/2
+    for (i = 3; i < n; i += 8)
+    {
+        i2 = i+4;
+        point1_real = Real[i];
+        point1_imag = Imag[i];
+
+        point2_real = Real[i2];
+        point2_imag = Imag[i2];
+
+        // temp1 = x[i] - x[i2]
+        point1_real -= point2_real;
+        point1_imag -= point2_imag;
+
+        // x[i1] = x[i] + x[i2]
+        Real[i] += point2_real;
+        Imag[i] += point2_imag;
+
+        // x[i2] = (x[i] - x[i2]) * w
+        Real[i2] = MUL_F(point1_real-point1_imag, w_real);
+        Imag[i2] = MUL_F(point1_real+point1_imag, w_real);
+    }
+
+
+    // Stage 4 of 32 point FFT decimation in frequency (no multiplications)
+    // 16*4=64 additions
+    for (i = 0; i < n; i += 4)
+    {
+        i2 = i+2;
+        point1_real = Real[i];
+        point1_imag = Imag[i];
 
-    t2[0] = x[0];
-    for (i0=0; i0<31; i0++)
+        point2_real = Real[i2];
+        point2_imag = Imag[i2];
+
+        // x[i1] = x[i] + x[i2]
+        Real[i] += point2_real;
+        Imag[i] += point2_imag;
+
+        // x[i2] = x[i] - x[i2]
+        Real[i2] = point1_real - point2_real;
+        Imag[i2] = point1_imag - point2_imag;
+    }
+    for (i = 1; i < n; i += 4)
+    {
+        i2 = i+2;
+        point1_real = Real[i];
+        point1_imag = Imag[i];
+
+        point2_real = Real[i2];
+        point2_imag = Imag[i2];
+
+        // x[i] = x[i] + x[i2]
+        Real[i] += point2_real;
+        Imag[i] += point2_imag;
+
+        // x[i2] = (x[i] - x[i2]) * (-i)
+        Real[i2] = point1_imag - point2_imag;
+        Imag[i2] = point2_real - point1_real;
+    }
+
+    // Stage 5 of 32 point FFT decimation in frequency (no multiplications)
+    // 16*4=64 additions
+    for (i = 0; i < n; i += 2)
     {
-        t2[2*i0+1] = x[2*i0+1] - x[2*i0+2];
-        t2[2*i0+2] = x[2*i0+1] + x[2*i0+2];
+        i2 = i+1;
+        point1_real = Real[i];
+        point1_imag = Imag[i];
+
+        point2_real = Real[i2];
+        point2_imag = Imag[i2];
+
+        // out[i1] = point1 + point2
+        Real[i] += point2_real;
+        Imag[i] += point2_imag;
+
+        // out[i2] = point1 - point2
+        Real[i2] = point1_real - point2_real;
+        Imag[i2] = point1_imag - point2_imag;
     }
-    t2[63] = x[63];
+
+#ifdef REORDER_IN_FFT
+    FFTReorder(Real, Imag);
+#endif // #ifdef REORDER_IN_FFT
+}
+#undef n
+#undef log2n
 
-    DCT4_64_kernel(y, t2);
+static const real_t dct4_64_tab[] = {
+    COEF_CONST(0.999924719333649), COEF_CONST(0.998118102550507),
+    COEF_CONST(0.993906974792480), COEF_CONST(0.987301409244537),
+    COEF_CONST(0.978317379951477), COEF_CONST(0.966976463794708),
+    COEF_CONST(0.953306019306183), COEF_CONST(0.937339007854462),
+    COEF_CONST(0.919113874435425), COEF_CONST(0.898674488067627),
+    COEF_CONST(0.876070082187653), COEF_CONST(0.851355195045471),
+    COEF_CONST(0.824589252471924), COEF_CONST(0.795836925506592),
+    COEF_CONST(0.765167236328125), COEF_CONST(0.732654273509979),
+    COEF_CONST(0.698376238346100), COEF_CONST(0.662415742874146),
+    COEF_CONST(0.624859452247620), COEF_CONST(0.585797846317291),
+    COEF_CONST(0.545324981212616), COEF_CONST(0.503538429737091),
+    COEF_CONST(0.460538715124130), COEF_CONST(0.416429549455643),
+    COEF_CONST(0.371317148208618), COEF_CONST(0.325310230255127),
+    COEF_CONST(0.278519600629807), COEF_CONST(0.231058135628700),
+    COEF_CONST(0.183039888739586), COEF_CONST(0.134580686688423),
+    COEF_CONST(0.085797272622585), COEF_CONST(0.036807164549828),
+    COEF_CONST(-1.012196302413940), COEF_CONST(-1.059438824653626),
+    COEF_CONST(-1.104129195213318), COEF_CONST(-1.146159529685974),
+    COEF_CONST(-1.185428738594055), COEF_CONST(-1.221842169761658),
+    COEF_CONST(-1.255311965942383), COEF_CONST(-1.285757660865784),
+    COEF_CONST(-1.313105940818787), COEF_CONST(-1.337290763854981),
+    COEF_CONST(-1.358253836631775), COEF_CONST(-1.375944852828980),
+    COEF_CONST(-1.390321016311646), COEF_CONST(-1.401347875595093),
+    COEF_CONST(-1.408998727798462), COEF_CONST(-1.413255214691162),
+    COEF_CONST(-1.414107084274292), COEF_CONST(-1.411552190780640),
+    COEF_CONST(-1.405596733093262), COEF_CONST(-1.396255016326904),
+    COEF_CONST(-1.383549690246582), COEF_CONST(-1.367511272430420),
+    COEF_CONST(-1.348178386688232), COEF_CONST(-1.325597524642944),
+    COEF_CONST(-1.299823284149170), COEF_CONST(-1.270917654037476),
+    COEF_CONST(-1.238950133323669), COEF_CONST(-1.203998088836670),
+    COEF_CONST(-1.166145324707031), COEF_CONST(-1.125483393669128),
+    COEF_CONST(-1.082109928131104), COEF_CONST(-1.036129593849182),
+    COEF_CONST(-0.987653195858002), COEF_CONST(-0.936797380447388),
+    COEF_CONST(-0.883684754371643), COEF_CONST(-0.828443288803101),
+    COEF_CONST(-0.771206021308899), COEF_CONST(-0.712110757827759),
+    COEF_CONST(-0.651300072669983), COEF_CONST(-0.588920354843140),
+    COEF_CONST(-0.525121808052063), COEF_CONST(-0.460058242082596),
+    COEF_CONST(-0.393886327743530), COEF_CONST(-0.326765477657318),
+    COEF_CONST(-0.258857429027557), COEF_CONST(-0.190325915813446),
+    COEF_CONST(-0.121335685253143), COEF_CONST(-0.052053272724152),
+    COEF_CONST(0.017354607582092), COEF_CONST(0.086720645427704),
+    COEF_CONST(0.155877828598022), COEF_CONST(0.224659323692322),
+    COEF_CONST(0.292899727821350), COEF_CONST(0.360434412956238),
+    COEF_CONST(0.427100926637650), COEF_CONST(0.492738455533981),
+    COEF_CONST(0.557188928127289), COEF_CONST(0.620297133922577),
+    COEF_CONST(0.681910991668701), COEF_CONST(0.741881847381592),
+    COEF_CONST(0.800065577030182), COEF_CONST(0.856321990489960),
+    COEF_CONST(0.910515367984772), COEF_CONST(0.962515234947205),
+    COEF_CONST(1.000000000000000), COEF_CONST(0.998795449733734),
+    COEF_CONST(0.995184719562531), COEF_CONST(0.989176511764526),
+    COEF_CONST(0.980785250663757), COEF_CONST(0.970031261444092),
+    COEF_CONST(0.956940352916718), COEF_CONST(0.941544055938721),
+    COEF_CONST(0.923879504203796), COEF_CONST(0.903989315032959),
+    COEF_CONST(0.881921231746674), COEF_CONST(0.857728600502014),
+    COEF_CONST(0.831469595432281), COEF_CONST(0.803207516670227),
+    COEF_CONST(0.773010432720184), COEF_CONST(0.740951120853424),
+    COEF_CONST(0.707106769084930), COEF_CONST(0.671558916568756),
+    COEF_CONST(0.634393274784088), COEF_CONST(0.595699310302734),
+    COEF_CONST(0.555570185184479), COEF_CONST(0.514102697372437),
+    COEF_CONST(0.471396654844284), COEF_CONST(0.427555114030838),
+    COEF_CONST(0.382683426141739), COEF_CONST(0.336889833211899),
+    COEF_CONST(0.290284633636475), COEF_CONST(0.242980122566223),
+    COEF_CONST(0.195090234279633), COEF_CONST(0.146730497479439),
+    COEF_CONST(0.098017133772373), COEF_CONST(0.049067649990320),
+    COEF_CONST(-1.000000000000000), COEF_CONST(-1.047863125801086),
+    COEF_CONST(-1.093201875686646), COEF_CONST(-1.135906934738159),
+    COEF_CONST(-1.175875544548035), COEF_CONST(-1.213011503219605),
+    COEF_CONST(-1.247225046157837), COEF_CONST(-1.278433918952942),
+    COEF_CONST(-1.306562900543213), COEF_CONST(-1.331544399261475),
+    COEF_CONST(-1.353317975997925), COEF_CONST(-1.371831417083740),
+    COEF_CONST(-1.387039899826050), COEF_CONST(-1.398906826972961),
+    COEF_CONST(-1.407403707504273), COEF_CONST(-1.412510156631470),
+    COEF_CONST(0), COEF_CONST(-1.412510156631470),
+    COEF_CONST(-1.407403707504273), COEF_CONST(-1.398906826972961),
+    COEF_CONST(-1.387039899826050), COEF_CONST(-1.371831417083740),
+    COEF_CONST(-1.353317975997925), COEF_CONST(-1.331544399261475),
+    COEF_CONST(-1.306562900543213), COEF_CONST(-1.278433918952942),
+    COEF_CONST(-1.247225046157837), COEF_CONST(-1.213011384010315),
+    COEF_CONST(-1.175875544548035), COEF_CONST(-1.135907053947449),
+    COEF_CONST(-1.093201875686646), COEF_CONST(-1.047863125801086),
+    COEF_CONST(-1.000000000000000), COEF_CONST(-0.949727773666382),
+    COEF_CONST(-0.897167563438416), COEF_CONST(-0.842446029186249),
+    COEF_CONST(-0.785694956779480), COEF_CONST(-0.727051079273224),
+    COEF_CONST(-0.666655659675598), COEF_CONST(-0.604654192924500),
+    COEF_CONST(-0.541196048259735), COEF_CONST(-0.476434230804443),
+    COEF_CONST(-0.410524487495422), COEF_CONST(-0.343625843524933),
+    COEF_CONST(-0.275899350643158), COEF_CONST(-0.207508206367493),
+    COEF_CONST(-0.138617098331451), COEF_CONST(-0.069392144680023),
+    COEF_CONST(0), COEF_CONST(0.069392263889313),
+    COEF_CONST(0.138617157936096), COEF_CONST(0.207508206367493),
+    COEF_CONST(0.275899469852448), COEF_CONST(0.343625962734222),
+    COEF_CONST(0.410524636507034), COEF_CONST(0.476434201002121),
+    COEF_CONST(0.541196107864380), COEF_CONST(0.604654192924500),
+    COEF_CONST(0.666655719280243), COEF_CONST(0.727051138877869),
+    COEF_CONST(0.785695075988770), COEF_CONST(0.842446029186249),
+    COEF_CONST(0.897167563438416), COEF_CONST(0.949727773666382)
+};
+
+/* size 64 only! */
+void dct4_kernel(real_t * in_real, real_t * in_imag, real_t * out_real, real_t * out_imag)
+{
+    // Tables with bit reverse values for 5 bits, bit reverse of i at i-th position
+    const uint8_t bit_rev_tab[32] = { 0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30,1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31 };
+    uint16_t i, i_rev;
+
+    /* Step 2: modulate */
+    // 3*32=96 multiplications
+    // 3*32=96 additions
+    for (i = 0; i < 32; i++)
+    {
+    	real_t x_re, x_im, tmp;
+    	x_re = in_real[i];
+    	x_im = in_imag[i];
+        tmp =        MUL_C(x_re + x_im, dct4_64_tab[i]);
+        in_real[i] = MUL_C(x_im, dct4_64_tab[i + 64]) + tmp;
+        in_imag[i] = MUL_C(x_re, dct4_64_tab[i + 32]) + tmp;
+    }
+
+    /* Step 3: FFT, but with output in bit reverse order */
+    fft_dif(in_real, in_imag);
+
+    /* Step 4: modulate + bitreverse reordering */
+    // 3*31+2=95 multiplications
+    // 3*31+2=95 additions
+    for (i = 0; i < 16; i++)
+    {
+    	real_t x_re, x_im, tmp;
+    	i_rev = bit_rev_tab[i];
+    	x_re = in_real[i_rev];
+    	x_im = in_imag[i_rev];
+
+        tmp =         MUL_C(x_re + x_im, dct4_64_tab[i + 3*32]);
+        out_real[i] = MUL_C(x_im, dct4_64_tab[i + 5*32]) + tmp;
+        out_imag[i] = MUL_C(x_re, dct4_64_tab[i + 4*32]) + tmp;
+    }
+    // i = 16, i_rev = 1 = rev(16);
+    out_imag[16] = MUL_C(in_imag[1] - in_real[1], dct4_64_tab[16 + 3*32]);
+    out_real[16] = MUL_C(in_real[1] + in_imag[1], dct4_64_tab[16 + 3*32]);
+    for (i = 17; i < 32; i++)
+    {
+    	real_t x_re, x_im, tmp;
+    	i_rev = bit_rev_tab[i];
+    	x_re = in_real[i_rev];
+    	x_im = in_imag[i_rev];
+        tmp =         MUL_C(x_re + x_im, dct4_64_tab[i + 3*32]);
+        out_real[i] = MUL_C(x_im, dct4_64_tab[i + 5*32]) + tmp;
+        out_imag[i] = MUL_C(x_re, dct4_64_tab[i + 4*32]) + tmp;
+    }
+
 }
 
-void DCT4_64_kernel(real_t *y, real_t *t2)
+void DST4_32(real_t *y, real_t *x)
 {
-    real_t f2;
-    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;
+    real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9;
+    real_t f10, f11, f12, f13, f14, f15, f16, f17, f18, f19;
+    real_t f20, f21, f22, f23, f24, f25, f26, f27, f28, f29;
+    real_t f30, f31, f32, f33, f34, f35, f36, f37, f38, f39;
+    real_t f40, f41, f42, f43, f44, f45, f46, f47, f48, f49;
+    real_t f50, f51, f52, f53, f54, f55, f56, f57, f58, f59;
+    real_t f60, f61, f62, f63, f64, f65, f66, f67, f68, f69;
+    real_t f70, f71, f72, f73, f74, f75, f76, f77, f78, f79;
+    real_t f80, f81, f82, f83, f84, f85, f86, f87, f88, f89;
+    real_t f90, f91, f92, f93, f94, f95, f96, f97, f98, f99;
+    real_t f100, f101, f102, f103, f104, f105, f106, f107, f108, f109;
+    real_t f110, f111, f112, f113, f114, f115, f116, f117, f118, f119;
+    real_t f120, f121, f122, f123, f124, f125, f126, f127, f128, f129;
+    real_t f130, f131, f132, f133, f134, f135, f136, f137, f138, f139;
+    real_t f140, f141, f142, f143, f144, f145, f146, f147, f148, f149;
+    real_t f150, f151, f152, f153, f154, f155, f156, f157, f158, f159;
+    real_t f160, f161, f162, f163, f164, f165, f166, f167, f168, f169;
+    real_t f170, f171, f172, f173, f174, f175, f176, f177, f178, f179;
+    real_t f180, f181, f182, f183, f184, f185, f186, f187, f188, f189;
+    real_t f190, f191, f192, f193, f194, f195, f196, f197, f198, f199;
+    real_t f200, f201, f202, f203, f204, f205, f206, f207, f208, f209;
+    real_t f210, f211, f212, f213, f214, f215, f216, f217, f218, f219;
+    real_t f220, f221, f222, f223, f224, f225, f226, f227, f228, f229;
+    real_t f230, f231, f232, f233, f234, f235, f236, f237, f238, f239;
+    real_t f240, f241, f242, f243, f244, f245, f246, f247, f248, f249;
+    real_t f250, f251, f252, f253, f254, f255, f256, f257, f258, f259;
+    real_t f260, f261, f262, f263, f264, f265, f266, f267, f268, f269;
+    real_t f270, f271, f272, f273, f274, f275, f276, f277, f278, f279;
+    real_t f280, f281, f282, f283, f284, f285, f286, f287, f288, f289;
+    real_t f290, f291, f292, f293, f294, f295, f296, f297, f298, f299;
+    real_t f300, f301, f302, f303, f304, f305, f306, f307, f308, f309;
+    real_t f310, f311, f312, f313, f314, f315, f316, f317, f318, f319;
+    real_t f320, f321, f322, f323, f324, f325, f326, f327, f328, f329;
+    real_t f330, f331, f332, f333, f334, f335;
 
-    f2 = 0.7071067811865476 * t2[32];
-    f3 = t2[0] - f2;
-    f4 = t2[0] + f2;
-    f5 = t2[16] + t2[48];
-    f6 = 1.3065629648763766 * t2[16];
-    f7 = (-0.9238795325112866) * f5;
-    f8 = (-0.5411961001461967) * t2[48];
-    f9 = f6 + f7;
-    f10 = f8 - f7;
-    f11 = f4 - f10;
-    f12 = f4 + f10;
-    f13 = f3 - f9;
-    f14 = f3 + f9;
-    f15 = t2[8] + t2[56];
-    f16 = 1.1758756024193588 * t2[8];
-    f17 = (-0.9807852804032304) * f15;
-    f18 = (-0.7856949583871021) * t2[56];
-    f19 = f16 + f17;
-    f20 = f18 - f17;
-    f21 = t2[24] + t2[40];
-    f22 = 1.3870398453221473 * t2[24];
-    f23 = (-0.8314696123025455) * f21;
-    f24 = (-0.2758993792829436) * t2[40];
-    f25 = f22 + f23;
-    f26 = f24 - f23;
-    f27 = f20 - f26;
-    f28 = f20 + f26;
-    f29 = 0.7071067811865476 * f27;
-    f30 = f19 - f25;
-    f31 = f19 + f25;
-    f32 = 0.7071067811865476 * f31;
-    f33 = f29 - f32;
-    f34 = f29 + f32;
-    f35 = f12 - f28;
-    f36 = f12 + f28;
-    f37 = f14 - f34;
-    f38 = f14 + f34;
-    f39 = f13 - f33;
-    f40 = f13 + f33;
-    f41 = f11 - f30;
-    f42 = f11 + f30;
-    f43 = t2[4] + t2[60];
-    f44 = 1.0932018670017569 * t2[4];
-    f45 = (-0.9951847266721969) * f43;
-    f46 = (-0.8971675863426368) * t2[60];
-    f47 = f44 + f45;
-    f48 = f46 - f45;
-    f49 = t2[12] + t2[52];
-    f50 = 1.2472250129866711 * t2[12];
-    f51 = (-0.9569403357322089) * f49;
-    f52 = (-0.6666556584777469) * t2[52];
-    f53 = f50 + f51;
-    f54 = f52 - f51;
-    f55 = t2[20] + t2[44];
-    f56 = 1.3533180011743526 * t2[20];
-    f57 = (-0.8819212643483551) * f55;
-    f58 = (-0.4105245275223575) * t2[44];
-    f59 = f56 + f57;
-    f60 = f58 - f57;
-    f61 = t2[28] + t2[36];
-    f62 = 1.4074037375263826 * t2[28];
-    f63 = (-0.7730104533627369) * f61;
-    f64 = (-0.1386171691990913) * t2[36];
-    f65 = f62 + f63;
-    f66 = f64 - f63;
-    f67 = f48 - f66;
-    f68 = f48 + f66;
-    f69 = f54 - f60;
-    f70 = f54 + f60;
-    f71 = f68 - f70;
-    f72 = f68 + f70;
-    f73 = 0.7071067811865476 * f71;
-    f74 = f67 + f69;
-    f75 = 1.3065629648763766 * f67;
-    f76 = (-0.9238795325112866) * f74;
-    f77 = (-0.5411961001461967) * f69;
-    f78 = f75 + f76;
-    f79 = f77 - f76;
-    f80 = f47 - f65;
-    f81 = f47 + f65;
-    f82 = f53 - f59;
-    f83 = f53 + f59;
-    f84 = f81 + f83;
-    f85 = 1.3065629648763770 * f81;
-    f86 = (-0.3826834323650904) * f84;
-    f87 = 0.5411961001461961 * f83;
-    f88 = f85 + f86;
-    f89 = f87 - f86;
-    f90 = f80 - f82;
-    f91 = f80 + f82;
-    f92 = 0.7071067811865476 * f91;
-    f93 = f79 - f89;
-    f94 = f79 + f89;
-    f95 = f73 - f92;
-    f96 = f73 + f92;
-    f97 = f78 - f88;
-    f98 = f78 + f88;
-    f99 = f36 - f72;
-    f100 = f36 + f72;
-    f101 = f38 - f94;
-    f102 = f38 + f94;
-    f103 = f40 - f93;
-    f104 = f40 + f93;
-    f105 = f42 - f96;
-    f106 = f42 + f96;
-    f107 = f41 - f95;
-    f108 = f41 + f95;
-    f109 = f39 - f98;
-    f110 = f39 + f98;
-    f111 = f37 - f97;
-    f112 = f37 + f97;
-    f113 = f35 - f90;
-    f114 = f35 + f90;
-    f115 = t2[2] + t2[62];
-    f116 = 1.0478631305325901 * t2[2];
-    f117 = (-0.9987954562051724) * f115;
-    f118 = (-0.9497277818777548) * t2[62];
-    f119 = f116 + f117;
-    f120 = f118 - f117;
-    f121 = t2[10] + t2[54];
-    f122 = 1.2130114330978077 * t2[10];
-    f123 = (-0.9700312531945440) * f121;
-    f124 = (-0.7270510732912803) * t2[54];
-    f125 = f122 + f123;
+    f0 = x[0] - x[1];
+    f1 = x[2] - x[1];
+    f2 = x[2] - x[3];
+    f3 = x[4] - x[3];
+    f4 = x[4] - x[5];
+    f5 = x[6] - x[5];
+    f6 = x[6] - x[7];
+    f7 = x[8] - x[7];
+    f8 = x[8] - x[9];
+    f9 = x[10] - x[9];
+    f10 = x[10] - x[11];
+    f11 = x[12] - x[11];
+    f12 = x[12] - x[13];
+    f13 = x[14] - x[13];
+    f14 = x[14] - x[15];
+    f15 = x[16] - x[15];
+    f16 = x[16] - x[17];
+    f17 = x[18] - x[17];
+    f18 = x[18] - x[19];
+    f19 = x[20] - x[19];
+    f20 = x[20] - x[21];
+    f21 = x[22] - x[21];
+    f22 = x[22] - x[23];
+    f23 = x[24] - x[23];
+    f24 = x[24] - x[25];
+    f25 = x[26] - x[25];
+    f26 = x[26] - x[27];
+    f27 = x[28] - x[27];
+    f28 = x[28] - x[29];
+    f29 = x[30] - x[29];
+    f30 = x[30] - x[31];
+    f31 = MUL_F(FRAC_CONST(0.7071067811865476), f15);
+    f32 = x[0] - f31;
+    f33 = x[0] + f31;
+    f34 = f7 + f23;
+    f35 = MUL_C(COEF_CONST(1.3065629648763766), f7);
+    f36 = MUL_F(FRAC_CONST(-0.9238795325112866), f34);
+    f37 = MUL_F(FRAC_CONST(-0.5411961001461967), f23);
+    f38 = f35 + f36;
+    f39 = f37 - f36;
+    f40 = f33 - f39;
+    f41 = f33 + f39;
+    f42 = f32 - f38;
+    f43 = f32 + f38;
+    f44 = f11 - f19;
+    f45 = f11 + f19;
+    f46 = MUL_F(FRAC_CONST(0.7071067811865476), f45);
+    f47 = f3 - f46;
+    f48 = f3 + f46;
+    f49 = MUL_F(FRAC_CONST(0.7071067811865476), f44);
+    f50 = f49 - f27;
+    f51 = f49 + f27;
+    f52 = f51 + f48;
+    f53 = MUL_F(FRAC_CONST(-0.7856949583871021), f51);
+    f54 = MUL_F(FRAC_CONST(0.9807852804032304), f52);
+    f55 = MUL_C(COEF_CONST(1.1758756024193588), f48);
+    f56 = f53 + f54;
+    f57 = f55 - f54;
+    f58 = f50 + f47;
+    f59 = MUL_F(FRAC_CONST(-0.2758993792829430), f50);
+    f60 = MUL_F(FRAC_CONST(0.8314696123025452), f58);
+    f61 = MUL_C(COEF_CONST(1.3870398453221475), f47);
+    f62 = f59 + f60;
+    f63 = f61 - f60;
+    f64 = f41 - f56;
+    f65 = f41 + f56;
+    f66 = f43 - f62;
+    f67 = f43 + f62;
+    f68 = f42 - f63;
+    f69 = f42 + f63;
+    f70 = f40 - f57;
+    f71 = f40 + f57;
+    f72 = f5 - f9;
+    f73 = f5 + f9;
+    f74 = f13 - f17;
+    f75 = f13 + f17;
+    f76 = f21 - f25;
+    f77 = f21 + f25;
+    f78 = MUL_F(FRAC_CONST(0.7071067811865476), f75);
+    f79 = f1 - f78;
+    f80 = f1 + f78;
+    f81 = f73 + f77;
+    f82 = MUL_C(COEF_CONST(1.3065629648763766), f73);
+    f83 = MUL_F(FRAC_CONST(-0.9238795325112866), f81);
+    f84 = MUL_F(FRAC_CONST(-0.5411961001461967), f77);
+    f85 = f82 + f83;
+    f86 = f84 - f83;
+    f87 = f80 - f86;
+    f88 = f80 + f86;
+    f89 = f79 - f85;
+    f90 = f79 + f85;
+    f91 = MUL_F(FRAC_CONST(0.7071067811865476), f74);
+    f92 = f29 - f91;
+    f93 = f29 + f91;
+    f94 = f76 + f72;
+    f95 = MUL_C(COEF_CONST(1.3065629648763766), f76);
+    f96 = MUL_F(FRAC_CONST(-0.9238795325112866), f94);
+    f97 = MUL_F(FRAC_CONST(-0.5411961001461967), f72);
+    f98 = f95 + f96;
+    f99 = f97 - f96;
+    f100 = f93 - f99;
+    f101 = f93 + f99;
+    f102 = f92 - f98;
+    f103 = f92 + f98;
+    f104 = f101 + f88;
+    f105 = MUL_F(FRAC_CONST(-0.8971675863426361), f101);
+    f106 = MUL_F(FRAC_CONST(0.9951847266721968), f104);
+    f107 = MUL_C(COEF_CONST(1.0932018670017576), f88);
+    f108 = f105 + f106;
+    f109 = f107 - f106;
+    f110 = f90 - f103;
+    f111 = MUL_F(FRAC_CONST(-0.6666556584777466), f103);
+    f112 = MUL_F(FRAC_CONST(0.9569403357322089), f110);
+    f113 = MUL_C(COEF_CONST(1.2472250129866713), f90);
+    f114 = f112 - f111;
+    f115 = f113 - f112;
+    f116 = f102 + f89;
+    f117 = MUL_F(FRAC_CONST(-0.4105245275223571), f102);
+    f118 = MUL_F(FRAC_CONST(0.8819212643483549), f116);
+    f119 = MUL_C(COEF_CONST(1.3533180011743529), f89);
+    f120 = f117 + f118;
+    f121 = f119 - f118;
+    f122 = f87 - f100;
+    f123 = MUL_F(FRAC_CONST(-0.1386171691990915), f100);
+    f124 = MUL_F(FRAC_CONST(0.7730104533627370), f122);
+    f125 = MUL_C(COEF_CONST(1.4074037375263826), f87);
     f126 = f124 - f123;
-    f127 = t2[18] + t2[46];
-    f128 = 1.3315443865537255 * t2[18];
-    f129 = (-0.9039892931234433) * f127;
-    f130 = (-0.4764341996931612) * t2[46];
-    f131 = f128 + f129;
-    f132 = f130 - f129;
-    f133 = t2[26] + t2[38];
-    f134 = 1.3989068359730781 * t2[26];
-    f135 = (-0.8032075314806453) * f133;
-    f136 = (-0.2075082269882124) * t2[38];
-    f137 = f134 + f135;
-    f138 = f136 - f135;
-    f139 = t2[34] + t2[30];
-    f140 = 1.4125100802019777 * t2[34];
-    f141 = (-0.6715589548470187) * f139;
-    f142 = 0.0693921705079402 * t2[30];
-    f143 = f140 + f141;
-    f144 = f142 - f141;
-    f145 = t2[42] + t2[22];
-    f146 = 1.3718313541934939 * t2[42];
-    f147 = (-0.5141027441932219) * f145;
-    f148 = 0.3436258658070501 * t2[22];
-    f149 = f146 + f147;
-    f150 = f148 - f147;
-    f151 = t2[50] + t2[14];
-    f152 = 1.2784339185752409 * t2[50];
-    f153 = (-0.3368898533922200) * f151;
-    f154 = 0.6046542117908008 * t2[14];
-    f155 = f152 + f153;
-    f156 = f154 - f153;
-    f157 = t2[58] + t2[6];
-    f158 = 1.1359069844201433 * t2[58];
-    f159 = (-0.1467304744553624) * f157;
-    f160 = 0.8424460355094185 * t2[6];
-    f161 = f158 + f159;
-    f162 = f160 - f159;
-    f163 = f120 - f144;
-    f164 = f120 + f144;
-    f165 = f119 - f143;
-    f166 = f119 + f143;
-    f167 = f126 - f150;
-    f168 = f126 + f150;
-    f169 = f125 - f149;
-    f170 = f125 + f149;
-    f171 = f132 - f156;
-    f172 = f132 + f156;
-    f173 = f131 - f155;
-    f174 = f131 + f155;
-    f175 = f138 - f162;
-    f176 = f138 + f162;
-    f177 = f137 - f161;
-    f178 = f137 + f161;
-    f179 = f163 + f165;
-    f180 = 1.1758756024193588 * f163;
-    f181 = (-0.9807852804032304) * f179;
-    f182 = (-0.7856949583871021) * f165;
-    f183 = f180 + f181;
-    f184 = f182 - f181;
-    f185 = f167 + f169;
-    f186 = 1.3870398453221475 * f167;
-    f187 = (-0.5555702330196022) * f185;
-    f188 = 0.2758993792829431 * f169;
-    f189 = f186 + f187;
-    f190 = f188 - f187;
-    f191 = f171 + f173;
-    f192 = 0.7856949583871022 * f171;
-    f193 = 0.1950903220161283 * f191;
-    f194 = 1.1758756024193586 * f173;
-    f195 = f192 + f193;
-    f196 = f194 - f193;
-    f197 = f175 + f177;
-    f198 = (-0.2758993792829430) * f175;
-    f199 = 0.8314696123025452 * f197;
-    f200 = 1.3870398453221475 * f177;
-    f201 = f198 + f199;
-    f202 = f200 - f199;
-    f203 = f164 - f172;
-    f204 = f164 + f172;
-    f205 = f166 - f174;
-    f206 = f166 + f174;
-    f207 = f168 - f176;
-    f208 = f168 + f176;
-    f209 = f170 - f178;
-    f210 = f170 + f178;
-    f211 = f184 - f196;
-    f212 = f184 + f196;
-    f213 = f183 - f195;
-    f214 = f183 + f195;
-    f215 = f190 - f202;
-    f216 = f190 + f202;
-    f217 = f189 - f201;
-    f218 = f189 + f201;
-    f219 = f203 + f205;
-    f220 = 1.3065629648763766 * f203;
-    f221 = (-0.9238795325112866) * f219;
-    f222 = (-0.5411961001461967) * f205;
-    f223 = f220 + f221;
-    f224 = f222 - f221;
-    f225 = f207 + f209;
-    f226 = 0.5411961001461969 * f207;
-    f227 = 0.3826834323650898 * f225;
-    f228 = 1.3065629648763766 * f209;
-    f229 = f226 + f227;
-    f230 = f228 - f227;
-    f231 = f211 + f213;
-    f232 = 1.3065629648763766 * f211;
-    f233 = (-0.9238795325112866) * f231;
-    f234 = (-0.5411961001461967) * f213;
-    f235 = f232 + f233;
-    f236 = f234 - f233;
-    f237 = f215 + f217;
-    f238 = 0.5411961001461969 * f215;
-    f239 = 0.3826834323650898 * f237;
-    f240 = 1.3065629648763766 * f217;
-    f241 = f238 + f239;
-    f242 = f240 - f239;
-    f243 = f204 - f208;
-    f244 = f204 + f208;
-    f245 = f206 - f210;
-    f246 = f206 + f210;
-    f247 = f224 - f230;
-    f248 = f224 + f230;
-    f249 = f223 - f229;
-    f250 = f223 + f229;
-    f251 = f212 - f216;
-    f252 = f212 + f216;
-    f253 = f214 - f218;
-    f254 = f214 + f218;
-    f255 = f236 - f242;
-    f256 = f236 + f242;
-    f257 = f235 - f241;
-    f258 = f235 + f241;
-    f259 = f243 - f245;
-    f260 = f243 + f245;
-    f261 = 0.7071067811865474 * f259;
-    f262 = 0.7071067811865474 * f260;
-    f263 = f247 - f249;
-    f264 = f247 + f249;
-    f265 = 0.7071067811865474 * f263;
-    f266 = 0.7071067811865474 * f264;
-    f267 = f251 - f253;
-    f268 = f251 + f253;
-    f269 = 0.7071067811865474 * f267;
-    f270 = 0.7071067811865474 * f268;
-    f271 = f255 - f257;
-    f272 = f255 + f257;
-    f273 = 0.7071067811865474 * f271;
-    f274 = 0.7071067811865474 * f272;
-    f275 = f100 - f244;
-    f276 = f100 + f244;
-    f277 = f102 - f252;
-    f278 = f102 + f252;
-    f279 = f104 - f256;
-    f280 = f104 + f256;
-    f281 = f106 - f248;
-    f282 = f106 + f248;
-    f283 = f108 - f266;
-    f284 = f108 + f266;
-    f285 = f110 - f274;
-    f286 = f110 + f274;
-    f287 = f112 - f270;
-    f288 = f112 + f270;
-    f289 = f114 - f262;
-    f290 = f114 + f262;
-    f291 = f113 - f261;
-    f292 = f113 + f261;
-    f293 = f111 - f269;
-    f294 = f111 + f269;
-    f295 = f109 - f273;
-    f296 = f109 + f273;
-    f297 = f107 - f265;
-    f298 = f107 + f265;
-    f299 = f105 - f250;
-    f300 = f105 + f250;
-    f301 = f103 - f258;
-    f302 = f103 + f258;
-    f303 = f101 - f254;
-    f304 = f101 + f254;
-    f305 = f99 - f246;
-    f306 = f99 + f246;
-    f307 = t2[1] - t2[61];
-    f308 = 1.0478631305325901 * t2[1];
-    f309 = (-0.9987954562051724) * f307;
-    f310 = (-0.9497277818777548) * t2[61];
-    f311 = f308 + f309;
-    f312 = f309 + f310;
-    f313 = t2[9] - t2[53];
-    f314 = 1.2130114330978077 * t2[9];
-    f315 = (-0.9700312531945440) * f313;
-    f316 = (-0.7270510732912803) * t2[53];
-    f317 = f314 + f315;
-    f318 = f315 + f316;
-    f319 = t2[17] - t2[45];
-    f320 = 1.3315443865537255 * t2[17];
-    f321 = (-0.9039892931234433) * f319;
-    f322 = (-0.4764341996931612) * t2[45];
-    f323 = f320 + f321;
-    f324 = f321 + f322;
-    f325 = t2[25] - t2[37];
-    f326 = 1.3989068359730781 * t2[25];
-    f327 = (-0.8032075314806453) * f325;
-    f328 = (-0.2075082269882124) * t2[37];
-    f329 = f326 + f327;
-    f330 = f327 + f328;
-    f331 = t2[33] - t2[29];
-    f332 = 1.4125100802019777 * t2[33];
-    f333 = (-0.6715589548470187) * f331;
-    f334 = 0.0693921705079402 * t2[29];
-    f335 = f332 + f333;
-    f336 = f333 + f334;
-    f337 = t2[41] - t2[21];
-    f338 = 1.3718313541934939 * t2[41];
-    f339 = (-0.5141027441932219) * f337;
-    f340 = 0.3436258658070501 * t2[21];
-    f341 = f338 + f339;
-    f342 = f339 + f340;
-    f343 = t2[49] - t2[13];
-    f344 = 1.2784339185752409 * t2[49];
-    f345 = (-0.3368898533922200) * f343;
-    f346 = 0.6046542117908008 * t2[13];
-    f347 = f344 + f345;
-    f348 = f345 + f346;
-    f349 = t2[57] - t2[5];
-    f350 = 1.1359069844201433 * t2[57];
-    f351 = (-0.1467304744553624) * f349;
-    f352 = 0.8424460355094185 * t2[5];
-    f353 = f350 + f351;
-    f354 = f351 + f352;
-    f355 = f336 - f312;
-    f356 = f312 + f336;
-    f357 = f311 - f335;
-    f358 = f311 + f335;
-    f359 = f342 - f318;
-    f360 = f318 + f342;
-    f361 = f317 - f341;
-    f362 = f317 + f341;
-    f363 = f348 - f324;
-    f364 = f324 + f348;
-    f365 = f323 - f347;
-    f366 = f323 + f347;
-    f367 = f354 - f330;
-    f368 = f330 + f354;
-    f369 = f329 - f353;
-    f370 = f329 + f353;
-    f371 = f355 + f357;
-    f372 = 1.1758756024193588 * f355;
-    f373 = (-0.9807852804032304) * f371;
-    f374 = (-0.7856949583871021) * f357;
-    f375 = f372 + f373;
-    f376 = f374 - f373;
-    f377 = f359 + f361;
-    f378 = 1.3870398453221475 * f359;
-    f379 = (-0.5555702330196022) * f377;
-    f380 = 0.2758993792829431 * f361;
-    f381 = f378 + f379;
-    f382 = f380 - f379;
-    f383 = f363 + f365;
-    f384 = 0.7856949583871022 * f363;
-    f385 = 0.1950903220161283 * f383;
-    f386 = 1.1758756024193586 * f365;
-    f387 = f384 + f385;
-    f388 = f386 - f385;
-    f389 = f367 + f369;
-    f390 = (-0.2758993792829430) * f367;
-    f391 = 0.8314696123025452 * f389;
-    f392 = 1.3870398453221475 * f369;
-    f393 = f390 + f391;
-    f394 = f392 - f391;
-    f395 = f364 - f356;
-    f396 = f356 + f364;
-    f397 = f358 - f366;
-    f398 = f358 + f366;
-    f399 = f368 - f360;
-    f400 = f360 + f368;
-    f401 = f362 - f370;
-    f402 = f362 + f370;
-    f403 = f376 - f388;
-    f404 = f376 + f388;
-    f405 = f375 - f387;
-    f406 = f375 + f387;
-    f407 = f382 - f394;
-    f408 = f382 + f394;
-    f409 = f381 - f393;
-    f410 = f381 + f393;
-    f411 = f395 + f397;
-    f412 = 1.3065629648763766 * f395;
-    f413 = (-0.9238795325112866) * f411;
-    f414 = (-0.5411961001461967) * f397;
-    f415 = f412 + f413;
-    f416 = f414 - f413;
-    f417 = f399 + f401;
-    f418 = 0.5411961001461969 * f399;
-    f419 = 0.3826834323650898 * f417;
-    f420 = 1.3065629648763766 * f401;
-    f421 = f418 + f419;
-    f422 = f420 - f419;
-    f423 = f403 + f405;
-    f424 = 1.3065629648763766 * f403;
-    f425 = (-0.9238795325112866) * f423;
-    f426 = (-0.5411961001461967) * f405;
-    f427 = f424 + f425;
-    f428 = f426 - f425;
-    f429 = f407 + f409;
-    f430 = 0.5411961001461969 * f407;
-    f431 = 0.3826834323650898 * f429;
-    f432 = 1.3065629648763766 * f409;
-    f433 = f430 + f431;
-    f434 = f432 - f431;
-    f435 = f400 - f396;
-    f436 = f396 + f400;
-    f437 = f398 - f402;
-    f438 = f398 + f402;
-    f439 = f416 - f422;
-    f440 = f416 + f422;
-    f441 = f415 - f421;
-    f442 = f415 + f421;
-    f443 = f404 - f408;
-    f444 = f404 + f408;
-    f445 = f406 - f410;
-    f446 = f406 + f410;
-    f447 = f428 - f434;
-    f448 = f428 + f434;
-    f449 = f427 - f433;
-    f450 = f427 + f433;
-    f451 = f435 - f437;
-    f452 = f435 + f437;
-    f453 = 0.7071067811865474 * f451;
-    f454 = 0.7071067811865474 * f452;
-    f455 = f439 - f441;
-    f456 = f439 + f441;
-    f457 = 0.7071067811865474 * f455;
-    f458 = 0.7071067811865474 * f456;
-    f459 = f443 - f445;
-    f460 = f443 + f445;
-    f461 = 0.7071067811865474 * f459;
-    f462 = 0.7071067811865474 * f460;
-    f463 = f447 - f449;
-    f464 = f447 + f449;
-    f465 = 0.7071067811865474 * f463;
-    f466 = 0.7071067811865474 * f464;
-    f467 = 0.7071067811865476 * t2[31];
-    f468 = t2[63] - f467;
-    f469 = t2[63] + f467;
-    f470 = t2[47] + t2[15];
-    f471 = 1.3065629648763766 * t2[47];
-    f472 = (-0.9238795325112866) * f470;
-    f473 = (-0.5411961001461967) * t2[15];
-    f474 = f471 + f472;
-    f475 = f473 - f472;
-    f476 = f469 - f475;
-    f477 = f469 + f475;
-    f478 = f468 - f474;
-    f479 = f468 + f474;
-    f480 = t2[55] + t2[7];
-    f481 = 1.1758756024193588 * t2[55];
-    f482 = (-0.9807852804032304) * f480;
-    f483 = (-0.7856949583871021) * t2[7];
-    f484 = f481 + f482;
-    f485 = f483 - f482;
-    f486 = t2[39] + t2[23];
-    f487 = 1.3870398453221473 * t2[39];
-    f488 = (-0.8314696123025455) * f486;
-    f489 = (-0.2758993792829436) * t2[23];
-    f490 = f487 + f488;
-    f491 = f489 - f488;
-    f492 = f485 - f491;
-    f493 = f485 + f491;
-    f494 = 0.7071067811865476 * f492;
-    f495 = f484 - f490;
-    f496 = f484 + f490;
-    f497 = 0.7071067811865476 * f496;
-    f498 = f494 - f497;
-    f499 = f494 + f497;
-    f500 = f477 - f493;
-    f501 = f477 + f493;
-    f502 = f479 - f499;
-    f503 = f479 + f499;
-    f504 = f478 - f498;
-    f505 = f478 + f498;
-    f506 = f476 - f495;
-    f507 = f476 + f495;
-    f508 = t2[59] + t2[3];
-    f509 = 1.0932018670017569 * t2[59];
-    f510 = (-0.9951847266721969) * f508;
-    f511 = (-0.8971675863426368) * t2[3];
-    f512 = f509 + f510;
-    f513 = f511 - f510;
-    f514 = t2[51] + t2[11];
-    f515 = 1.2472250129866711 * t2[51];
-    f516 = (-0.9569403357322089) * f514;
-    f517 = (-0.6666556584777469) * t2[11];
-    f518 = f515 + f516;
-    f519 = f517 - f516;
-    f520 = t2[43] + t2[19];
-    f521 = 1.3533180011743526 * t2[43];
-    f522 = (-0.8819212643483551) * f520;
-    f523 = (-0.4105245275223575) * t2[19];
-    f524 = f521 + f522;
-    f525 = f523 - f522;
-    f526 = t2[35] + t2[27];
-    f527 = 1.4074037375263826 * t2[35];
-    f528 = (-0.7730104533627369) * f526;
-    f529 = (-0.1386171691990913) * t2[27];
-    f530 = f527 + f528;
-    f531 = f529 - f528;
-    f532 = f513 - f531;
-    f533 = f513 + f531;
-    f534 = f519 - f525;
-    f535 = f519 + f525;
-    f536 = f533 - f535;
-    f537 = f533 + f535;
-    f538 = 0.7071067811865476 * f536;
-    f539 = f532 + f534;
-    f540 = 1.3065629648763766 * f532;
-    f541 = (-0.9238795325112866) * f539;
-    f542 = (-0.5411961001461967) * f534;
-    f543 = f540 + f541;
-    f544 = f542 - f541;
-    f545 = f512 - f530;
-    f546 = f512 + f530;
-    f547 = f518 - f524;
-    f548 = f518 + f524;
-    f549 = f546 + f548;
-    f550 = 1.3065629648763770 * f546;
-    f551 = (-0.3826834323650904) * f549;
-    f552 = 0.5411961001461961 * f548;
-    f553 = f550 + f551;
-    f554 = f552 - f551;
-    f555 = f545 - f547;
-    f556 = f545 + f547;
-    f557 = 0.7071067811865476 * f556;
-    f558 = f544 - f554;
-    f559 = f544 + f554;
-    f560 = f538 - f557;
-    f561 = f538 + f557;
-    f562 = f543 - f553;
-    f563 = f543 + f553;
-    f564 = f501 - f537;
-    f565 = f501 + f537;
-    f566 = f503 - f559;
-    f567 = f503 + f559;
-    f568 = f505 - f558;
-    f569 = f505 + f558;
-    f570 = f507 - f561;
-    f571 = f507 + f561;
-    f572 = f506 - f560;
-    f573 = f506 + f560;
-    f574 = f504 - f563;
-    f575 = f504 + f563;
-    f576 = f502 - f562;
-    f577 = f502 + f562;
-    f578 = f500 - f555;
-    f579 = f500 + f555;
-    f580 = f438 - f565;
-    f581 = f438 + f565;
-    f582 = f446 + f567;
-    f583 = f446 - f567;
-    f584 = f450 - f569;
-    f585 = f450 + f569;
-    f586 = f442 + f571;
-    f587 = f442 - f571;
-    f588 = f457 - f573;
-    f589 = f457 + f573;
-    f590 = f465 + f575;
-    f591 = f465 - f575;
-    f592 = f461 - f577;
-    f593 = f461 + f577;
-    f594 = f453 + f579;
-    f595 = f453 - f579;
-    f596 = f454 - f578;
-    f597 = f454 + f578;
-    f598 = f462 + f576;
-    f599 = f462 - f576;
-    f600 = f466 - f574;
-    f601 = f466 + f574;
-    f602 = f458 + f572;
-    f603 = f458 - f572;
-    f604 = f440 - f570;
-    f605 = f440 + f570;
-    f606 = f448 + f568;
-    f607 = f448 - f568;
-    f608 = f444 - f566;
-    f609 = f444 + f566;
-    f610 = f564 - f436;
-    f611 = f436 + f564;
-    f612 = f581 + f276;
-    f613 = (-0.9876531635534246) * f581;
-    f614 = 0.9999247018391445 * f612;
-    f615 = 1.0121962401248645 * f276;
-    y[0] = f613 + f614;
-    y[63] = f615 - f614;
-    f618 = f583 + f278;
-    f619 = (-0.9625151616469906) * f583;
-    f620 = 0.9993223845883495 * f618;
-    f621 = 1.0361296075297086 * f278;
-    y[1] = f619 + f620;
-    y[62] = f621 - f620;
-    f624 = f585 + f280;
-    f625 = (-0.9367973765979405) * f585;
-    f626 = 0.9981181129001492 * f624;
-    f627 = 1.0594388492023579 * f280;
-    y[2] = f625 + f626;
-    y[61] = f627 - f626;
-    f630 = f587 + f282;
-    f631 = (-0.9105152998383381) * f587;
-    f632 = 0.9963126121827780 * f630;
-    f633 = 1.0821099245272179 * f282;
-    y[3] = f631 + f632;
-    y[60] = f633 - f632;
-    f636 = f589 + f284;
-    f637 = (-0.8836847627084729) * f589;
-    f638 = 0.9939069700023561 * f636;
-    f639 = 1.1041291772962392 * f284;
-    y[4] = f637 + f638;
-    y[59] = f639 - f638;
-    f642 = f591 + f286;
-    f643 = (-0.8563219269206538) * f591;
-    f644 = 0.9909026354277800 * f642;
-    f645 = 1.1254833439349063 * f286;
-    y[5] = f643 + f644;
-    y[58] = f645 - f644;
-    f648 = f593 + f288;
-    f649 = (-0.8284432748239970) * f593;
-    f650 = 0.9873014181578584 * f648;
-    f651 = 1.1461595614917197 * f288;
-    y[6] = f649 + f650;
-    y[57] = f651 - f650;
-    f654 = f595 + f290;
-    f655 = (-0.8000655994760753) * f595;
-    f656 = 0.9831054874312163 * f654;
-    f657 = 1.1661453753863573 * f290;
-    y[7] = f655 + f656;
-    y[56] = f657 - f656;
-    f660 = f597 + f292;
-    f661 = (-0.7712059945274091) * f597;
-    f662 = 0.9783173707196277 * f660;
-    f663 = 1.1854287469118463 * f292;
-    y[8] = f661 + f662;
-    y[55] = f663 - f662;
-    f666 = f599 + f294;
-    f667 = (-0.7418818439248888) * f599;
-    f668 = 0.9729399522055601 * f666;
-    f669 = 1.2039980604862313 * f294;
-    y[9] = f667 + f668;
-    y[54] = f669 - f668;
-    f672 = f601 + f296;
-    f673 = (-0.7121108114403374) * f601;
-    f674 = 0.9669764710448521 * f672;
-    f675 = 1.2218421306493668 * f296;
-    y[10] = f673 + f674;
-    y[53] = f675 - f674;
-    f678 = f603 + f298;
-    f679 = (-0.6819108300305128) * f603;
-    f680 = 0.9604305194155658 * f678;
-    f681 = 1.2389502088006188 * f298;
-    y[11] = f679 + f680;
-    y[52] = f681 - f680;
-    f684 = f605 + f300;
-    f685 = (-0.6513000910349656) * f605;
-    f686 = 0.9533060403541938 * f684;
-    f687 = 1.2553119896734219 * f300;
-    y[12] = f685 + f686;
-    y[51] = f687 - f686;
-    f690 = f607 + f302;
-    f691 = (-0.6202970332182582) * f607;
-    f692 = 0.9456073253805213 * f690;
-    f693 = 1.2709176175427843 * f302;
-    y[13] = f691 + f692;
-    y[50] = f693 - f692;
-    f696 = f609 + f304;
-    f697 = (-0.5889203316631404) * f609;
-    f698 = 0.9373390119125750 * f696;
-    f699 = 1.2857576921620095 * f304;
-    y[14] = f697 + f698;
-    y[49] = f699 - f698;
-    f702 = f306 - f611;
-    f703 = (-0.5571888865213779) * f611;
-    f704 = 0.9285060804732155 * f702;
-    f705 = 1.2998232744250531 * f306;
-    y[15] = f704 - f703;
-    y[48] = f705 - f704;
-    f708 = f610 + f305;
-    f709 = (-0.5251218116290097) * f610;
-    f710 = 0.9191138516900578 * f708;
-    f711 = 1.3131058917511058 * f305;
-    y[16] = f709 + f710;
-    y[47] = f711 - f710;
-    f714 = f608 + f303;
-    f715 = (-0.4927384229928850) * f608;
-    f716 = 0.9091679830905223 * f714;
-    f717 = 1.3255975431881595 * f303;
-    y[17] = f715 + f716;
-    y[46] = f717 - f716;
-    f720 = f606 + f301;
-    f721 = (-0.4600582271554261) * f606;
-    f722 = 0.8986744656939538 * f720;
-    f723 = 1.3372907042324815 * f301;
-    y[18] = f721 + f722;
-    y[45] = f723 - f722;
-    f726 = f604 + f299;
-    f727 = (-0.4271009094446139) * f604;
-    f728 = 0.8876396204028539 * f726;
-    f729 = 1.3481783313610940 * f299;
-    y[19] = f727 + f728;
-    y[44] = f729 - f728;
-    f732 = f602 + f297;
-    f733 = (-0.3938863221162838) * f602;
-    f734 = 0.8760700941954066 * f732;
-    f735 = 1.3582538662745294 * f297;
-    y[20] = f733 + f734;
-    y[43] = f735 - f734;
-    f738 = f600 + f295;
-    f739 = (-0.3604344723958691) * f600;
-    f740 = 0.8639728561215867 * f738;
-    f741 = 1.3675112398473042 * f295;
-    y[21] = f739 + f740;
-    y[42] = f741 - f740;
-    f744 = f598 + f293;
-    f745 = (-0.3267655104267964) * f598;
-    f746 = 0.8513551931052652 * f744;
-    f747 = 1.3759448757837340 * f293;
-    y[22] = f745 + f746;
-    y[41] = f747 - f746;
-    f750 = f596 + f291;
-    f751 = (-0.2928997171327915) * f596;
-    f752 = 0.8382247055548380 * f750;
-    f753 = 1.3835496939768843 * f291;
-    y[23] = f751 + f752;
-    y[40] = f753 - f752;
-    f756 = f594 + f289;
-    f757 = (-0.2588574920014121) * f594;
-    f758 = 0.8245893027850253 * f756;
-    f759 = 1.3903211135686386 * f289;
-    y[24] = f757 + f758;
-    y[39] = f759 - f758;
-    f762 = f592 + f287;
-    f763 = (-0.2246593407961559) * f592;
-    f764 = 0.8104571982525948 * f762;
-    f765 = 1.3962550557090336 * f287;
-    y[25] = f763 + f764;
-    y[38] = f765 - f764;
-    f768 = f590 + f285;
-    f769 = (-0.1903258632045579) * f590;
-    f770 = 0.7958369046088835 * f768;
-    f771 = 1.4013479460132090 * f285;
-    y[26] = f769 + f770;
-    y[37] = f771 - f770;
-    f774 = f588 + f283;
-    f775 = (-0.1558777404297079) * f588;
-    f776 = 0.7807372285720944 * f774;
-    f777 = 1.4055967167144807 * f283;
-    y[27] = f775 + f776;
-    y[36] = f777 - f776;
-    f780 = f586 + f281;
-    f781 = (-0.1213357227326675) * f586;
-    f782 = 0.7651672656224590 * f780;
-    f783 = 1.4089988085122505 * f281;
-    y[28] = f781 + f782;
-    y[35] = f783 - f782;
-    f786 = f584 + f279;
-    f787 = (-0.0867206169332875) * f584;
-    f788 = 0.7491363945234593 * f786;
-    f789 = 1.4115521721136310 * f279;
-    y[29] = f787 + f788;
-    y[34] = f789 - f788;
-    f792 = f582 + f277;
-    f793 = (-0.0520532738769597) * f582;
-    f794 = 0.7326542716724128 * f792;
-    f795 = 1.4132552694678659 * f277;
-    y[30] = f793 + f794;
-    y[33] = f795 - f794;
-    f798 = f580 + f275;
-    f799 = (-0.0173545758748457) * f580;
-    f800 = 0.7157308252838186 * f798;
-    f801 = 1.4141070746927915 * f275;
-    y[31] = f799 + f800;
-    y[32] = f801 - f800;
+    f127 = f125 - f124;
+    f128 = f65 - f108;
+    f129 = f65 + f108;
+    f130 = f67 - f114;
+    f131 = f67 + f114;
+    f132 = f69 - f120;
+    f133 = f69 + f120;
+    f134 = f71 - f126;
+    f135 = f71 + f126;
+    f136 = f70 - f127;
+    f137 = f70 + f127;
+    f138 = f68 - f121;
+    f139 = f68 + f121;
+    f140 = f66 - f115;
+    f141 = f66 + f115;
+    f142 = f64 - f109;
+    f143 = f64 + f109;
+    f144 = f0 + f30;
+    f145 = MUL_C(COEF_CONST(1.0478631305325901), f0);
+    f146 = MUL_F(FRAC_CONST(-0.9987954562051724), f144);
+    f147 = MUL_F(FRAC_CONST(-0.9497277818777548), f30);
+    f148 = f145 + f146;
+    f149 = f147 - f146;
+    f150 = f4 + f26;
+    f151 = MUL_F(FRAC_CONST(1.2130114330978077), f4);
+    f152 = MUL_F(FRAC_CONST(-0.9700312531945440), f150);
+    f153 = MUL_F(FRAC_CONST(-0.7270510732912803), f26);
+    f154 = f151 + f152;
+    f155 = f153 - f152;
+    f156 = f8 + f22;
+    f157 = MUL_C(COEF_CONST(1.3315443865537255), f8);
+    f158 = MUL_F(FRAC_CONST(-0.9039892931234433), f156);
+    f159 = MUL_F(FRAC_CONST(-0.4764341996931612), f22);
+    f160 = f157 + f158;
+    f161 = f159 - f158;
+    f162 = f12 + f18;
+    f163 = MUL_C(COEF_CONST(1.3989068359730781), f12);
+    f164 = MUL_F(FRAC_CONST(-0.8032075314806453), f162);
+    f165 = MUL_F(FRAC_CONST(-0.2075082269882124), f18);
+    f166 = f163 + f164;
+    f167 = f165 - f164;
+    f168 = f16 + f14;
+    f169 = MUL_C(COEF_CONST(1.4125100802019777), f16);
+    f170 = MUL_F(FRAC_CONST(-0.6715589548470187), f168);
+    f171 = MUL_F(FRAC_CONST(0.0693921705079402), f14);
+    f172 = f169 + f170;
+    f173 = f171 - f170;
+    f174 = f20 + f10;
+    f175 = MUL_C(COEF_CONST(1.3718313541934939), f20);
+    f176 = MUL_F(FRAC_CONST(-0.5141027441932219), f174);
+    f177 = MUL_F(FRAC_CONST(0.3436258658070501), f10);
+    f178 = f175 + f176;
+    f179 = f177 - f176;
+    f180 = f24 + f6;
+    f181 = MUL_C(COEF_CONST(1.2784339185752409), f24);
+    f182 = MUL_F(FRAC_CONST(-0.3368898533922200), f180);
+    f183 = MUL_F(FRAC_CONST(0.6046542117908008), f6);
+    f184 = f181 + f182;
+    f185 = f183 - f182;
+    f186 = f28 + f2;
+    f187 = MUL_C(COEF_CONST(1.1359069844201433), f28);
+    f188 = MUL_F(FRAC_CONST(-0.1467304744553624), f186);
+    f189 = MUL_F(FRAC_CONST(0.8424460355094185), f2);
+    f190 = f187 + f188;
+    f191 = f189 - f188;
+    f192 = f149 - f173;
+    f193 = f149 + f173;
+    f194 = f148 - f172;
+    f195 = f148 + f172;
+    f196 = f155 - f179;
+    f197 = f155 + f179;
+    f198 = f154 - f178;
+    f199 = f154 + f178;
+    f200 = f161 - f185;
+    f201 = f161 + f185;
+    f202 = f160 - f184;
+    f203 = f160 + f184;
+    f204 = f167 - f191;
+    f205 = f167 + f191;
+    f206 = f166 - f190;
+    f207 = f166 + f190;
+    f208 = f192 + f194;
+    f209 = MUL_C(COEF_CONST(1.1758756024193588), f192);
+    f210 = MUL_F(FRAC_CONST(-0.9807852804032304), f208);
+    f211 = MUL_F(FRAC_CONST(-0.7856949583871021), f194);
+    f212 = f209 + f210;
+    f213 = f211 - f210;
+    f214 = f196 + f198;
+    f215 = MUL_C(COEF_CONST(1.3870398453221475), f196);
+    f216 = MUL_F(FRAC_CONST(-0.5555702330196022), f214);
+    f217 = MUL_F(FRAC_CONST(0.2758993792829431), f198);
+    f218 = f215 + f216;
+    f219 = f217 - f216;
+    f220 = f200 + f202;
+    f221 = MUL_F(FRAC_CONST(0.7856949583871022), f200);
+    f222 = MUL_F(FRAC_CONST(0.1950903220161283), f220);
+    f223 = MUL_C(COEF_CONST(1.1758756024193586), f202);
+    f224 = f221 + f222;
+    f225 = f223 - f222;
+    f226 = f204 + f206;
+    f227 = MUL_F(FRAC_CONST(-0.2758993792829430), f204);
+    f228 = MUL_F(FRAC_CONST(0.8314696123025452), f226);
+    f229 = MUL_C(COEF_CONST(1.3870398453221475), f206);
+    f230 = f227 + f228;
+    f231 = f229 - f228;
+    f232 = f193 - f201;
+    f233 = f193 + f201;
+    f234 = f195 - f203;
+    f235 = f195 + f203;
+    f236 = f197 - f205;
+    f237 = f197 + f205;
+    f238 = f199 - f207;
+    f239 = f199 + f207;
+    f240 = f213 - f225;
+    f241 = f213 + f225;
+    f242 = f212 - f224;
+    f243 = f212 + f224;
+    f244 = f219 - f231;
+    f245 = f219 + f231;
+    f246 = f218 - f230;
+    f247 = f218 + f230;
+    f248 = f232 + f234;
+    f249 = MUL_C(COEF_CONST(1.3065629648763766), f232);
+    f250 = MUL_F(FRAC_CONST(-0.9238795325112866), f248);
+    f251 = MUL_F(FRAC_CONST(-0.5411961001461967), f234);
+    f252 = f249 + f250;
+    f253 = f251 - f250;
+    f254 = f236 + f238;
+    f255 = MUL_F(FRAC_CONST(0.5411961001461969), f236);
+    f256 = MUL_F(FRAC_CONST(0.3826834323650898), f254);
+    f257 = MUL_C(COEF_CONST(1.3065629648763766), f238);
+    f258 = f255 + f256;
+    f259 = f257 - f256;
+    f260 = f240 + f242;
+    f261 = MUL_C(COEF_CONST(1.3065629648763766), f240);
+    f262 = MUL_F(FRAC_CONST(-0.9238795325112866), f260);
+    f263 = MUL_F(FRAC_CONST(-0.5411961001461967), f242);
+    f264 = f261 + f262;
+    f265 = f263 - f262;
+    f266 = f244 + f246;
+    f267 = MUL_F(FRAC_CONST(0.5411961001461969), f244);
+    f268 = MUL_F(FRAC_CONST(0.3826834323650898), f266);
+    f269 = MUL_C(COEF_CONST(1.3065629648763766), f246);
+    f270 = f267 + f268;
+    f271 = f269 - f268;
+    f272 = f233 - f237;
+    f273 = f233 + f237;
+    f274 = f235 - f239;
+    f275 = f235 + f239;
+    f276 = f253 - f259;
+    f277 = f253 + f259;
+    f278 = f252 - f258;
+    f279 = f252 + f258;
+    f280 = f241 - f245;
+    f281 = f241 + f245;
+    f282 = f243 - f247;
+    f283 = f243 + f247;
+    f284 = f265 - f271;
+    f285 = f265 + f271;
+    f286 = f264 - f270;
+    f287 = f264 + f270;
+    f288 = f272 - f274;
+    f289 = f272 + f274;
+    f290 = MUL_F(FRAC_CONST(0.7071067811865474), f288);
+    f291 = MUL_F(FRAC_CONST(0.7071067811865474), f289);
+    f292 = f276 - f278;
+    f293 = f276 + f278;
+    f294 = MUL_F(FRAC_CONST(0.7071067811865474), f292);
+    f295 = MUL_F(FRAC_CONST(0.7071067811865474), f293);
+    f296 = f280 - f282;
+    f297 = f280 + f282;
+    f298 = MUL_F(FRAC_CONST(0.7071067811865474), f296);
+    f299 = MUL_F(FRAC_CONST(0.7071067811865474), f297);
+    f300 = f284 - f286;
+    f301 = f284 + f286;
+    f302 = MUL_F(FRAC_CONST(0.7071067811865474), f300);
+    f303 = MUL_F(FRAC_CONST(0.7071067811865474), f301);
+    f304 = f129 - f273;
+    f305 = f129 + f273;
+    f306 = f131 - f281;
+    f307 = f131 + f281;
+    f308 = f133 - f285;
+    f309 = f133 + f285;
+    f310 = f135 - f277;
+    f311 = f135 + f277;
+    f312 = f137 - f295;
+    f313 = f137 + f295;
+    f314 = f139 - f303;
+    f315 = f139 + f303;
+    f316 = f141 - f299;
+    f317 = f141 + f299;
+    f318 = f143 - f291;
+    f319 = f143 + f291;
+    f320 = f142 - f290;
+    f321 = f142 + f290;
+    f322 = f140 - f298;
+    f323 = f140 + f298;
+    f324 = f138 - f302;
+    f325 = f138 + f302;
+    f326 = f136 - f294;
+    f327 = f136 + f294;
+    f328 = f134 - f279;
+    f329 = f134 + f279;
+    f330 = f132 - f287;
+    f331 = f132 + f287;
+    f332 = f130 - f283;
+    f333 = f130 + f283;
+    f334 = f128 - f275;
+    f335 = f128 + f275;
+    y[31] = MUL_F(FRAC_CONST(0.5001506360206510), f305);
+    y[30] = MUL_F(FRAC_CONST(0.5013584524464084), f307);
+    y[29] = MUL_F(FRAC_CONST(0.5037887256810443), f309);
+    y[28] = MUL_F(FRAC_CONST(0.5074711720725553), f311);
+    y[27] = MUL_F(FRAC_CONST(0.5124514794082247), f313);
+    y[26] = MUL_F(FRAC_CONST(0.5187927131053328), f315);
+    y[25] = MUL_F(FRAC_CONST(0.5265773151542700), f317);
+    y[24] = MUL_F(FRAC_CONST(0.5359098169079920), f319);
+    y[23] = MUL_F(FRAC_CONST(0.5469204379855088), f321);
+    y[22] = MUL_F(FRAC_CONST(0.5597698129470802), f323);
+    y[21] = MUL_F(FRAC_CONST(0.5746551840326600), f325);
+    y[20] = MUL_F(FRAC_CONST(0.5918185358574165), f327);
+    y[19] = MUL_F(FRAC_CONST(0.6115573478825099), f329);
+    y[18] = MUL_F(FRAC_CONST(0.6342389366884031), f331);
+    y[17] = MUL_F(FRAC_CONST(0.6603198078137061), f333);
+    y[16] = MUL_F(FRAC_CONST(0.6903721282002123), f335);
+    y[15] = MUL_F(FRAC_CONST(0.7251205223771985), f334);
+    y[14] = MUL_F(FRAC_CONST(0.7654941649730891), f332);
+    y[13] = MUL_F(FRAC_CONST(0.8127020908144905), f330);
+    y[12] = MUL_F(FRAC_CONST(0.8683447152233481), f328);
+    y[11] = MUL_F(FRAC_CONST(0.9345835970364075), f326);
+    y[10] = MUL_C(COEF_CONST(1.0144082649970547), f324);
+    y[9] = MUL_C(COEF_CONST(1.1120716205797176), f322);
+    y[8] = MUL_C(COEF_CONST(1.2338327379765710), f320);
+    y[7] = MUL_C(COEF_CONST(1.3892939586328277), f318);
+    y[6] = MUL_C(COEF_CONST(1.5939722833856311), f316);
+    y[5] = MUL_C(COEF_CONST(1.8746759800084078), f314);
+    y[4] = MUL_C(COEF_CONST(2.2820500680051619), f312);
+    y[3] = MUL_C(COEF_CONST(2.9246284281582162), f310);
+    y[2] = MUL_C(COEF_CONST(4.0846110781292477), f308);
+    y[1] = MUL_C(COEF_CONST(6.7967507116736332), f306);
+    y[0] = MUL_R(REAL_CONST(20.3738781672314530), f304);
 }
 
 #endif
 
 #endif
-
--- a/Plugins/Input/aac/libfaad2/sbr_dct.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_dct.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_dct.h,v 1.8 2003/11/12 20:47:58 menno Exp $
+** $Id: sbr_dct.h,v 1.15 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_DCT_H__
@@ -32,10 +32,14 @@
 extern "C" {
 #endif
 
+void dct4_kernel(real_t * in_real, real_t * in_imag, real_t * out_real, real_t * out_imag);
+
 void DCT3_32_unscaled(real_t *y, real_t *x);
-void DCT2_64_unscaled(real_t *y, real_t *x);
-void DCT4_64(real_t *y, real_t *x);
-void DCT4_64_kernel(real_t *y, real_t *t2);
+void DCT4_32(real_t *y, real_t *x);
+void DST4_32(real_t *y, real_t *x);
+void DCT2_32_unscaled(real_t *y, real_t *x);
+void DCT4_16(real_t *y, real_t *x);
+void DCT2_16_unscaled(real_t *y, real_t *x);
 
 
 #ifdef __cplusplus
--- a/Plugins/Input/aac/libfaad2/sbr_dec.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_dec.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_dec.c,v 1.17 2003/11/12 20:47:58 menno Exp $
+** $Id: sbr_dec.c,v 1.39 2004/09/04 14:56:28 menno Exp $
 **/
 
 
@@ -31,6 +31,7 @@
 
 #ifdef SBR_DEC
 
+#include <string.h>
 #include <stdlib.h>
 
 #include "syntax.h"
@@ -41,15 +42,25 @@
 #include "sbr_hfadj.h"
 
 
-sbr_info *sbrDecodeInit(uint16_t framelength
+/* static function declarations */
+static uint8_t sbr_save_prev_data(sbr_info *sbr, uint8_t ch);
+static void sbr_save_matrix(sbr_info *sbr, uint8_t ch);
+
+
+sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac,
+                        uint32_t sample_rate, uint8_t downSampledSBR
 #ifdef DRM
 						, uint8_t IsDRM
 #endif
                         )
 {
-    sbr_info *sbr = malloc(sizeof(sbr_info));
+    sbr_info *sbr = faad_malloc(sizeof(sbr_info));
     memset(sbr, 0, sizeof(sbr_info));
 
+    /* save id of the parent element */
+    sbr->id_aac = id_aac;
+    sbr->sample_rate = sample_rate;
+
     sbr->bs_freq_scale = 2;
     sbr->bs_alter_scale = 1;
     sbr->bs_noise_bands = 2;
@@ -63,24 +74,18 @@
     sbr->prevEnvIsShort[0] = -1;
     sbr->prevEnvIsShort[1] = -1;
     sbr->header_count = 0;
+    sbr->Reset = 1;
 
 #ifdef DRM
-    sbr->Is_DRM_SBR = 0;
-    if (IsDRM)
-    {
-        sbr->Is_DRM_SBR = 1;
-        sbr->tHFGen = T_HFGEN_DRM;
-        sbr->tHFAdj = T_HFADJ_DRM;
+    sbr->Is_DRM_SBR = IsDRM;
+#endif
+    sbr->tHFGen = T_HFGEN;
+    sbr->tHFAdj = T_HFADJ;
 
-        /* "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;
-    }
+    sbr->bsco = 0;
+    sbr->bsco_prev = 0;
+    sbr->M_prev = 0;
+    sbr->frame_len = framelength;
 
     /* force sbr reset */
     sbr->bs_start_freq_prev = -1;
@@ -94,6 +99,44 @@
         sbr->numTimeSlots = NO_TIME_SLOTS;
     }
 
+    sbr->GQ_ringbuf_index[0] = 0;
+    sbr->GQ_ringbuf_index[1] = 0;
+
+    if (id_aac == ID_CPE)
+    {
+        /* stereo */
+        uint8_t j;
+        sbr->qmfa[0] = qmfa_init(32);
+        sbr->qmfa[1] = qmfa_init(32);
+        sbr->qmfs[0] = qmfs_init((downSampledSBR)?32:64);
+        sbr->qmfs[1] = qmfs_init((downSampledSBR)?32:64);
+
+        for (j = 0; j < 5; j++)
+        {
+            sbr->G_temp_prev[0][j] = faad_malloc(64*sizeof(real_t));
+            sbr->G_temp_prev[1][j] = faad_malloc(64*sizeof(real_t));
+            sbr->Q_temp_prev[0][j] = faad_malloc(64*sizeof(real_t));
+            sbr->Q_temp_prev[1][j] = faad_malloc(64*sizeof(real_t));
+        }
+
+        memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t));
+        memset(sbr->Xsbr[1], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t));
+    } else {
+        /* mono */
+        uint8_t j;
+        sbr->qmfa[0] = qmfa_init(32);
+        sbr->qmfs[0] = qmfs_init((downSampledSBR)?32:64);
+        sbr->qmfs[1] = NULL;
+
+        for (j = 0; j < 5; j++)
+        {
+            sbr->G_temp_prev[0][j] = faad_malloc(64*sizeof(real_t));
+            sbr->Q_temp_prev[0][j] = faad_malloc(64*sizeof(real_t));
+        }
+
+        memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t));
+    }
+
     return sbr;
 }
 
@@ -105,46 +148,57 @@
     {
         qmfa_end(sbr->qmfa[0]);
         qmfs_end(sbr->qmfs[0]);
-        if (sbr->id_aac == ID_CPE)
+        if (sbr->qmfs[1] != NULL)
         {
             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]);
+            if (sbr->G_temp_prev[0][j]) faad_free(sbr->G_temp_prev[0][j]);
+            if (sbr->Q_temp_prev[0][j]) faad_free(sbr->Q_temp_prev[0][j]);
+            if (sbr->G_temp_prev[1][j]) faad_free(sbr->G_temp_prev[1][j]);
+            if (sbr->Q_temp_prev[1][j]) faad_free(sbr->Q_temp_prev[1][j]);
         }
 
-        free(sbr);
+#ifdef PS_DEC
+        if (sbr->ps != NULL) 
+            ps_free(sbr->ps);
+#endif
+
+#ifdef DRM_PS
+        if (sbr->drm_ps != NULL)
+            drm_ps_free(sbr->drm_ps);
+#endif
+
+        faad_free(sbr);
     }
 }
 
-void sbr_save_prev_data(sbr_info *sbr, uint8_t ch)
+static uint8_t sbr_save_prev_data(sbr_info *sbr, uint8_t ch)
 {
     uint8_t i;
 
     /* save data for next frame */
     sbr->kx_prev = sbr->kx;
+    sbr->M_prev = sbr->M;
+    sbr->bsco_prev = sbr->bsco;
 
     sbr->L_E_prev[ch] = sbr->L_E[ch];
 
+    /* sbr->L_E[ch] can become 0 on files with bit errors */
+    if (sbr->L_E[ch] <= 0)
+        return 19;
+
     sbr->f_prev[ch] = sbr->f[ch][sbr->L_E[ch] - 1];
-    for (i = 0; i < 64; i++)
+    for (i = 0; i < MAX_M; i++)
     {
         sbr->E_prev[ch][i] = sbr->E[ch][i][sbr->L_E[ch] - 1];
         sbr->Q_prev[ch][i] = sbr->Q[ch][i][sbr->L_Q[ch] - 1];
     }
 
-    for (i = 0; i < 64; i++)
+    for (i = 0; i < MAX_M; i++)
     {
         sbr->bs_add_harmonic_prev[ch][i] = sbr->bs_add_harmonic[ch][i];
     }
@@ -154,54 +208,188 @@
         sbr->prevEnvIsShort[ch] = 0;
     else
         sbr->prevEnvIsShort[ch] = -1;
+
+    return 0;
+}
+
+static void sbr_save_matrix(sbr_info *sbr, uint8_t ch)
+{
+    uint8_t i;
+
+    for (i = 0; i < sbr->tHFGen; i++)
+    {
+        memmove(sbr->Xsbr[ch][i], sbr->Xsbr[ch][i+sbr->numTimeSlotsRate], 64 * sizeof(qmf_t));
+    }
+    for (i = sbr->tHFGen; i < MAX_NTSRHFG; i++)
+    {
+        memset(sbr->Xsbr[ch][i], 0, 64 * sizeof(qmf_t));
+    }
 }
 
-void sbrDecodeFrame(sbr_info *sbr, real_t *left_channel,
-                    real_t *right_channel,
-                    const uint8_t just_seeked, const uint8_t upsample_only)
+static void sbr_process_channel(sbr_info *sbr, real_t *channel_buf, qmf_t X[MAX_NTSR][64],
+                                uint8_t ch, uint8_t dont_process,
+                                const uint8_t downSampledSBR)
 {
-    int16_t i, k, l;
+    int16_t k, l;
+
+#ifdef SBR_LOW_POWER
+    ALIGN real_t deg[64];
+#endif
+
+#ifdef DRM
+    if (sbr->Is_DRM_SBR)
+    {
+        sbr->bsco = max((int32_t)sbr->maxAACLine*32/(int32_t)sbr->frame_len - (int32_t)sbr->kx, 0);
+    } else {
+#endif
+        sbr->bsco = 0;
+#ifdef DRM
+    }
+#endif
+
 
-    uint8_t dont_process = 0;
-    uint8_t ch, channels, ret;
-    real_t *ch_buf;
+//#define PRE_QMF_PRINT
+#ifdef PRE_QMF_PRINT
+    {
+        int i;
+        for (i = 0; i < 1024; i++)
+        {
+            printf("%d\n", channel_buf[i]);
+        }
+    }
+#endif
+
+
+    /* subband analysis */
+    if (dont_process)
+        sbr_qmf_analysis_32(sbr, sbr->qmfa[ch], channel_buf, sbr->Xsbr[ch], sbr->tHFGen, 32);
+    else
+        sbr_qmf_analysis_32(sbr, sbr->qmfa[ch], channel_buf, sbr->Xsbr[ch], sbr->tHFGen, sbr->kx);
 
-    qmf_t X[MAX_NTSR][64];
+    if (!dont_process)
+    {
+#if 1
+        /* insert high frequencies here */
+        /* hf generation using patching */
+        hf_generation(sbr, sbr->Xsbr[ch], sbr->Xsbr[ch]
 #ifdef SBR_LOW_POWER
-    real_t deg[64];
+            ,deg
+#endif
+            ,ch);
+#endif
+
+#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
 
-    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 1
+        /* hf adjustment */
+        hf_adjustment(sbr, sbr->Xsbr[ch]
+#ifdef SBR_LOW_POWER
+            ,deg
+#endif
+            ,ch);
+#endif
     }
 
-    if (sbr->data) free(sbr->data);
-    sbr->data = NULL;
+    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->Xsbr[ch][l + sbr->tHFAdj][k]);
+#ifndef SBR_LOW_POWER
+                QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
+#endif
+            }
+            for (k = 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 kx_band, M_band, bsco_band;
+
+            if (l < sbr->t_E[ch][0])
+            {
+                kx_band = sbr->kx_prev;
+                M_band = sbr->M_prev;
+                bsco_band = sbr->bsco_prev;
+            } else {
+                kx_band = sbr->kx;
+                M_band = sbr->M;
+                bsco_band = sbr->bsco;
+            }
 
-    if (ret || (sbr->header_count == 0))
+#ifndef SBR_LOW_POWER
+            for (k = 0; k < kx_band + bsco_band; k++)
+            {
+                QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
+                QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
+            }
+            for (k = kx_band + bsco_band; k < kx_band + M_band; k++)
+            {
+                QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
+                QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
+            }
+            for (k = max(kx_band + bsco_band, kx_band + M_band); k < 64; k++)
+            {
+                QMF_RE(X[l][k]) = 0;
+                QMF_IM(X[l][k]) = 0;
+            }
+#else
+            for (k = 0; k < kx_band + bsco_band; k++)
+            {
+                QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
+            }
+            for (k = kx_band + bsco_band; k < min(kx_band + M_band, 63); k++)
+            {
+                QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
+            }
+            for (k = max(kx_band + bsco_band, kx_band + M_band); k < 64; k++)
+            {
+                QMF_RE(X[l][k]) = 0;
+            }
+            QMF_RE(X[l][kx_band - 1 + bsco_band]) +=
+                QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][kx_band - 1 + bsco_band]);
+#endif
+        }
+    }
+}
+
+uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan,
+                             const uint8_t just_seeked, const uint8_t downSampledSBR)
+{
+    uint8_t dont_process = 0;
+    uint8_t ret = 0;
+    ALIGN qmf_t X[MAX_NTSR][64];
+
+    if (sbr == NULL)
+        return 20;
+
+    /* case can occur due to bit errors */
+    if (sbr->id_aac != ID_CPE)
+        return 21;
+
+    if (sbr->ret || (sbr->header_count == 0))
     {
         /* don't process just upsample */
         dont_process = 1;
 
         /* Re-activate reset for next frame */
-        if (ret && sbr->Reset)
+        if (sbr->ret && sbr->Reset)
             sbr->bs_start_freq_prev = -1;
     }
 
@@ -212,147 +400,215 @@
         sbr->just_seeked = 0;
     }
 
-    for (ch = 0; ch < channels; ch++)
+    sbr_process_channel(sbr, left_chan, X, 0, dont_process, downSampledSBR);
+    /* subband synthesis */
+    if (downSampledSBR)
     {
-        if (sbr->frame == 0)
-        {
-            uint8_t j;
-            sbr->qmfa[ch] = qmfa_init(32);
-            sbr->qmfs[ch] = qmfs_init(64);
-            
-            for (j = 0; j < 5; j++)
-            {
-                sbr->G_temp_prev[ch][j] = malloc(64*sizeof(real_t));
-                sbr->Q_temp_prev[ch][j] = malloc(64*sizeof(real_t));
-            }
+        sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X, left_chan);
+    } else {
+        sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, left_chan);
+    }
 
-            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));
-        }
+    sbr_process_channel(sbr, right_chan, X, 1, dont_process, downSampledSBR);
+    /* subband synthesis */
+    if (downSampledSBR)
+    {
+        sbr_qmf_synthesis_32(sbr, sbr->qmfs[1], X, right_chan);
+    } else {
+        sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X, right_chan);
+    }
 
-        if (ch == 0)
-            ch_buf = left_channel;
-        else
-            ch_buf = right_channel;
+    if (sbr->bs_header_flag)
+        sbr->just_seeked = 0;
 
-        /* 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 (sbr->header_count != 0 && sbr->ret == 0)
+    {
+        ret = sbr_save_prev_data(sbr, 0);
+        if (ret) return ret;
+        ret = sbr_save_prev_data(sbr, 1);
+        if (ret) return ret;
+    }
 
-        if (!dont_process)
+    sbr_save_matrix(sbr, 0);
+    sbr_save_matrix(sbr, 1);
+
+    sbr->frame++;
+
+//#define POST_QMF_PRINT
+#ifdef POST_QMF_PRINT
+    {
+        int i;
+        for (i = 0; i < 2048; i++)
         {
-            /* 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;
-                }
-            }
+            printf("%d\n", left_chan[i]);
+        }
+        for (i = 0; i < 2048; i++)
+        {
+            printf("%d\n", right_chan[i]);
+        }
+    }
 #endif
 
-            /* hf adjustment */
-            hf_adjustment(sbr, sbr->Xsbr[ch]
-#ifdef SBR_LOW_POWER
-                ,deg
-#endif
-                ,ch);
-        }
+    return 0;
+}
 
-        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;
+uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel,
+                             const uint8_t just_seeked, const uint8_t downSampledSBR)
+{
+    uint8_t dont_process = 0;
+    uint8_t ret = 0;
+    ALIGN qmf_t X[MAX_NTSR][64];
 
-                if (l < sbr->t_E[ch][0])
-                    xover_band = sbr->kx_prev;
-                else
-                    xover_band = sbr->kx;
+    if (sbr == NULL)
+        return 20;
+
+    /* case can occur due to bit errors */
+    if (sbr->id_aac != ID_SCE && sbr->id_aac != ID_LFE)
+        return 21;
 
-#ifdef DRM
-				if (sbr->Is_DRM_SBR)
-					xover_band = sbr->kx;
-#endif
+    if (sbr->ret || (sbr->header_count == 0))
+    {
+        /* don't process just upsample */
+        dont_process = 1;
+
+        /* Re-activate reset for next frame */
+        if (sbr->ret && sbr->Reset)
+            sbr->bs_start_freq_prev = -1;
+    }
 
-                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
-            }
-        }
+    if (just_seeked)
+    {
+        sbr->just_seeked = 1;
+    } else {
+        sbr->just_seeked = 0;
+    }
 
-        /* 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));
-        }
+    sbr_process_channel(sbr, channel, X, 0, dont_process, downSampledSBR);
+    /* subband synthesis */
+    if (downSampledSBR)
+    {
+        sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X, channel);
+    } else {
+        sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, channel);
     }
 
     if (sbr->bs_header_flag)
         sbr->just_seeked = 0;
 
-    if (sbr->header_count != 0)
+    if (sbr->header_count != 0 && sbr->ret == 0)
+    {
+        ret = sbr_save_prev_data(sbr, 0);
+        if (ret) return ret;
+    }
+
+    sbr_save_matrix(sbr, 0);
+
+    sbr->frame++;
+
+//#define POST_QMF_PRINT
+#ifdef POST_QMF_PRINT
     {
-        for (ch = 0; ch < channels; ch++)
-            sbr_save_prev_data(sbr, ch);
+        int i;
+        for (i = 0; i < 2048; i++)
+        {
+            printf("%d\n", channel[i]);
+        }
+    }
+#endif
+
+    return 0;
+}
+
+#if (defined(PS_DEC) || defined(DRM_PS))
+uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel,
+                               const uint8_t just_seeked, const uint8_t downSampledSBR)
+{
+    uint8_t l, k;
+    uint8_t dont_process = 0;
+    uint8_t ret = 0;
+    ALIGN qmf_t X_left[38][64] = {{0}};
+    ALIGN qmf_t X_right[38][64] = {{0}}; /* must set this to 0 */
+
+    if (sbr == NULL)
+        return 20;
+
+    /* case can occur due to bit errors */
+    if (sbr->id_aac != ID_SCE && sbr->id_aac != ID_LFE)
+        return 21;
+
+    if (sbr->ret || (sbr->header_count == 0))
+    {
+        /* don't process just upsample */
+        dont_process = 1;
+
+        /* Re-activate reset for next frame */
+        if (sbr->ret && sbr->Reset)
+            sbr->bs_start_freq_prev = -1;
+    }
+
+    if (just_seeked)
+    {
+        sbr->just_seeked = 1;
+    } else {
+        sbr->just_seeked = 0;
     }
 
+    if (sbr->qmfs[1] == NULL)
+    {
+        sbr->qmfs[1] = qmfs_init((downSampledSBR)?32:64);
+    }
+
+    sbr_process_channel(sbr, left_channel, X_left, 0, dont_process, downSampledSBR);
+
+    /* copy some extra data for PS */
+    for (l = 32; l < 38; l++)
+    {
+        for (k = 0; k < 5; k++)
+        {
+            QMF_RE(X_left[l][k]) = QMF_RE(sbr->Xsbr[0][sbr->tHFAdj+l][k]);
+            QMF_IM(X_left[l][k]) = QMF_IM(sbr->Xsbr[0][sbr->tHFAdj+l][k]);
+        }
+    }
+
+    /* perform parametric stereo */
+#ifdef DRM_PS
+    if (sbr->Is_DRM_SBR)
+    {
+        drm_ps_decode(sbr->drm_ps, (sbr->ret > 0), sbr->sample_rate, X_left, X_right);
+    } else {
+#endif
+#ifdef PS_DEC
+        ps_decode(sbr->ps, X_left, X_right);
+#endif
+#ifdef DRM_PS
+    }
+#endif
+
+    /* subband synthesis */
+    if (downSampledSBR)
+    {
+        sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X_left, left_channel);
+        sbr_qmf_synthesis_32(sbr, sbr->qmfs[1], X_right, right_channel);
+    } else {
+        sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X_left, left_channel);
+        sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X_right, right_channel);
+    }
+
+    if (sbr->bs_header_flag)
+        sbr->just_seeked = 0;
+
+    if (sbr->header_count != 0 && sbr->ret == 0)
+    {
+        ret = sbr_save_prev_data(sbr, 0);
+        if (ret) return ret;
+    }
+
+    sbr_save_matrix(sbr, 0);
+
     sbr->frame++;
+
+    return 0;
 }
+#endif
 
 #endif
--- a/Plugins/Input/aac/libfaad2/sbr_dec.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_dec.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,19 +1,19 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
-**  
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
+**
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
 ** the Free Software Foundation; either version 2 of the License, or
 ** (at your option) any later version.
-** 
+**
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ** GNU General Public License for more details.
-** 
+**
 ** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software 
+** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
 ** Any non-GPL usage of this software or parts of this software is strictly
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_dec.h,v 1.12 2003/11/12 20:47:58 menno Exp $
+** $Id: sbr_dec.h,v 1.35 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_DEC_H__
@@ -32,33 +32,42 @@
 extern "C" {
 #endif
 
+#ifdef PS_DEC
+#include "ps_dec.h"
+#endif
+#ifdef DRM_PS
+#include "drm_dec.h"
+#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 */
+/* MAX_NTSRHFG: maximum of number_time_slots * rate + HFGen. 16*2+8 */
+#define MAX_NTSRHFG 40
+#define MAX_NTSR    32 /* max number_time_slots * rate, ok for DRM and not DRM mode */
 
+/* MAX_M: maximum value for M */
+#define MAX_M       49
+/* MAX_L_E: maximum value for L_E */
+#define MAX_L_E      5
 
 typedef struct {
     real_t *x;
+    int16_t x_index;
     uint8_t channels;
 } qmfa_info;
 
 typedef struct {
-    real_t *v[2];
-    uint8_t v_index;
+    real_t *v;
+    int16_t v_index;
     uint8_t channels;
 } qmfs_info;
 
 typedef struct
 {
     uint32_t sample_rate;
+    uint32_t maxAACLine;
 
     uint8_t rate;
     uint8_t just_seeked;
+    uint8_t ret;
 
     uint8_t amp_res[2];
 
@@ -92,27 +101,33 @@
     uint8_t L_E_prev[2];
     uint8_t L_Q[2];
 
-    uint8_t t_E[2][6];
+    uint8_t t_E[2][MAX_L_E+1];
     uint8_t t_Q[2][3];
-    uint8_t f[2][6];
+    uint8_t f[2][MAX_L_E+1];
     uint8_t f_prev[2];
 
     real_t *G_temp_prev[2][5];
     real_t *Q_temp_prev[2][5];
+    int8_t GQ_ringbuf_index[2];
 
-    int16_t E[2][64][5];
+    int16_t E[2][64][MAX_L_E];
     int16_t E_prev[2][64];
-    real_t E_orig[2][64][5];
-    real_t E_curr[2][64][5];
+#ifndef FIXED_POINT
+    real_t E_orig[2][64][MAX_L_E];
+#endif
+    real_t E_curr[2][64][MAX_L_E];
     int32_t Q[2][64][2];
+#ifndef FIXED_POINT
+    real_t Q_div[2][64][2];
+    real_t Q_div2[2][64][2];
+#endif
     int32_t Q_prev[2][64];
-    real_t Q_orig[2][64][2];
 
     int8_t l_A[2];
     int8_t l_A_prev[2];
 
-    uint8_t bs_invf_mode[2][5];
-    uint8_t bs_invf_mode_prev[2][5];
+    uint8_t bs_invf_mode[2][MAX_L_E];
+    uint8_t bs_invf_mode_prev[2][MAX_L_E];
     real_t bwArray[2][64];
     real_t bwArray_prev[2][64];
 
@@ -136,32 +151,39 @@
     int8_t prevEnvIsShort[2];
 
     int8_t kx_prev;
+    uint8_t bsco;
+    uint8_t bsco_prev;
+    uint8_t M_prev;
+    uint16_t frame_len;
 
     uint8_t Reset;
     uint32_t frame;
     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;
+#ifdef DRM_PS
+    drm_ps_info *drm_ps;
+#endif
 #endif
 
-	uint16_t numTimeSlotsRate;
-	uint16_t numTimeSlots;
-	uint8_t tHFGen;
-	uint8_t tHFAdj;
+    uint8_t numTimeSlotsRate;
+    uint8_t numTimeSlots;
+    uint8_t tHFGen;
+    uint8_t tHFAdj;
+
+#ifdef PS_DEC
+    ps_info *ps;
+#endif
+#if (defined(PS_DEC) || defined(DRM_PS))
+    uint8_t ps_used;
+#endif
 
     /* to get it compiling */
     /* we'll see during the coding of all the tools, whether
@@ -202,16 +224,22 @@
     uint8_t bs_df_noise[2][3];
 } sbr_info;
 
-sbr_info *sbrDecodeInit(uint16_t framelength
+sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac,
+                        uint32_t sample_rate, uint8_t downSampledSBR
 #ifdef DRM
-						, uint8_t IsDRM
+                        , 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);
+uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan,
+                             const uint8_t just_seeked, const uint8_t downSampledSBR);
+uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel,
+                             const uint8_t just_seeked, const uint8_t downSampledSBR);
+#if (defined(PS_DEC) || defined(DRM_PS))
+uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel,
+                               const uint8_t just_seeked, const uint8_t downSampledSBR);
+#endif
 
 
 #ifdef __cplusplus
--- a/Plugins/Input/aac/libfaad2/sbr_e_nf.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_e_nf.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,19 +1,19 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
-**
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
+**  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
 ** the Free Software Foundation; either version 2 of the License, or
 ** (at your option) any later version.
-**
+** 
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ** GNU General Public License for more details.
-**
+** 
 ** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software 
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
 ** Any non-GPL usage of this software or parts of this software is strictly
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_e_nf.c,v 1.9 2003/11/14 15:15:51 menno Exp $
+** $Id: sbr_e_nf.c,v 1.17 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -46,6 +46,8 @@
             for (k = 1; k < sbr->n[sbr->f[ch][l]]; k++)
             {
                 sbr->E[ch][k][l] = sbr->E[ch][k - 1][l] + sbr->E[ch][k][l];
+                if (sbr->E[ch][k][l] < 0)
+                    sbr->E[ch][k][l] = 0;
             }
 
         } else { /* bs_df_env == 1 */
@@ -137,20 +139,286 @@
     }
 }
 
-/* FIXME: pow() not needed */
+#ifndef FIXED_POINT
+
+/* table for Q_div values when no coupling */
+static const real_t Q_div_tab[31] = {
+    FRAC_CONST(0.0153846), FRAC_CONST(0.030303),
+    FRAC_CONST(0.0588235), FRAC_CONST(0.111111),
+    FRAC_CONST(0.2),       FRAC_CONST(0.333333),
+    FRAC_CONST(0.5),       FRAC_CONST(0.666667),
+    FRAC_CONST(0.8),       FRAC_CONST(0.888889),
+    FRAC_CONST(0.941176),  FRAC_CONST(0.969697),
+    FRAC_CONST(0.984615),  FRAC_CONST(0.992248),
+    FRAC_CONST(0.996109),  FRAC_CONST(0.998051),
+    FRAC_CONST(0.999024),  FRAC_CONST(0.999512),
+    FRAC_CONST(0.999756),  FRAC_CONST(0.999878),
+    FRAC_CONST(0.999939),  FRAC_CONST(0.999969),
+    FRAC_CONST(0.999985),  FRAC_CONST(0.999992),
+    FRAC_CONST(0.999996),  FRAC_CONST(0.999998),
+    FRAC_CONST(0.999999),  FRAC_CONST(1),
+    FRAC_CONST(1),         FRAC_CONST(1),
+    FRAC_CONST(1)
+};
+
+static const real_t Q_div_tab_left[31][13] = {
+    { FRAC_CONST(0.969704), FRAC_CONST(0.888985), FRAC_CONST(0.667532), FRAC_CONST(0.336788), FRAC_CONST(0.117241), FRAC_CONST(0.037594), FRAC_CONST(0.0153846), FRAC_CONST(0.00967118), FRAC_CONST(0.00823245), FRAC_CONST(0.00787211), FRAC_CONST(0.00778198), FRAC_CONST(0.00775945), FRAC_CONST(0.00775382) },
+    { FRAC_CONST(0.984619), FRAC_CONST(0.94123), FRAC_CONST(0.800623), FRAC_CONST(0.503876), FRAC_CONST(0.209877), FRAC_CONST(0.0724638), FRAC_CONST(0.030303), FRAC_CONST(0.0191571), FRAC_CONST(0.0163305), FRAC_CONST(0.0156212), FRAC_CONST(0.0154438), FRAC_CONST(0.0153994), FRAC_CONST(0.0153883) },
+    { FRAC_CONST(0.99225), FRAC_CONST(0.969726), FRAC_CONST(0.889273), FRAC_CONST(0.670103), FRAC_CONST(0.346939), FRAC_CONST(0.135135), FRAC_CONST(0.0588235), FRAC_CONST(0.037594), FRAC_CONST(0.0321361), FRAC_CONST(0.0307619), FRAC_CONST(0.0304178), FRAC_CONST(0.0303317), FRAC_CONST(0.0303102) },
+    { FRAC_CONST(0.99611), FRAC_CONST(0.98463), FRAC_CONST(0.941392), FRAC_CONST(0.802469), FRAC_CONST(0.515152), FRAC_CONST(0.238095), FRAC_CONST(0.111111), FRAC_CONST(0.0724638), FRAC_CONST(0.0622711), FRAC_CONST(0.0596878), FRAC_CONST(0.0590397), FRAC_CONST(0.0588776), FRAC_CONST(0.058837) },
+    { FRAC_CONST(0.998051), FRAC_CONST(0.992256), FRAC_CONST(0.969811), FRAC_CONST(0.890411), FRAC_CONST(0.68), FRAC_CONST(0.384615), FRAC_CONST(0.2), FRAC_CONST(0.135135), FRAC_CONST(0.117241), FRAC_CONST(0.112652), FRAC_CONST(0.111497), FRAC_CONST(0.111208), FRAC_CONST(0.111135) },
+    { FRAC_CONST(0.999025), FRAC_CONST(0.996113), FRAC_CONST(0.984674), FRAC_CONST(0.942029), FRAC_CONST(0.809524), FRAC_CONST(0.555556), FRAC_CONST(0.333333), FRAC_CONST(0.238095), FRAC_CONST(0.209877), FRAC_CONST(0.202492), FRAC_CONST(0.200625), FRAC_CONST(0.200156), FRAC_CONST(0.200039) },
+    { FRAC_CONST(0.999512), FRAC_CONST(0.998053), FRAC_CONST(0.992278), FRAC_CONST(0.970149), FRAC_CONST(0.894737), FRAC_CONST(0.714286), FRAC_CONST(0.5), FRAC_CONST(0.384615), FRAC_CONST(0.346939), FRAC_CONST(0.336788), FRAC_CONST(0.3342), FRAC_CONST(0.33355), FRAC_CONST(0.333388) },
+    { FRAC_CONST(0.999756), FRAC_CONST(0.999025), FRAC_CONST(0.996124), FRAC_CONST(0.984848), FRAC_CONST(0.944444), FRAC_CONST(0.833333), FRAC_CONST(0.666667), FRAC_CONST(0.555556), FRAC_CONST(0.515152), FRAC_CONST(0.503876), FRAC_CONST(0.500975), FRAC_CONST(0.500244), FRAC_CONST(0.500061) },
+    { FRAC_CONST(0.999878), FRAC_CONST(0.999512), FRAC_CONST(0.998058), FRAC_CONST(0.992366), FRAC_CONST(0.971429), FRAC_CONST(0.909091), FRAC_CONST(0.8), FRAC_CONST(0.714286), FRAC_CONST(0.68), FRAC_CONST(0.670103), FRAC_CONST(0.667532), FRAC_CONST(0.666884), FRAC_CONST(0.666721) },
+    { FRAC_CONST(0.999939), FRAC_CONST(0.999756), FRAC_CONST(0.999028), FRAC_CONST(0.996169), FRAC_CONST(0.985507), FRAC_CONST(0.952381), FRAC_CONST(0.888889), FRAC_CONST(0.833333), FRAC_CONST(0.809524), FRAC_CONST(0.802469), FRAC_CONST(0.800623), FRAC_CONST(0.800156), FRAC_CONST(0.800039) },
+    { FRAC_CONST(0.999969), FRAC_CONST(0.999878), FRAC_CONST(0.999514), FRAC_CONST(0.998081), FRAC_CONST(0.992701), FRAC_CONST(0.97561), FRAC_CONST(0.941176), FRAC_CONST(0.909091), FRAC_CONST(0.894737), FRAC_CONST(0.890411), FRAC_CONST(0.889273), FRAC_CONST(0.888985), FRAC_CONST(0.888913) },
+    { FRAC_CONST(0.999985), FRAC_CONST(0.999939), FRAC_CONST(0.999757), FRAC_CONST(0.999039), FRAC_CONST(0.996337), FRAC_CONST(0.987654), FRAC_CONST(0.969697), FRAC_CONST(0.952381), FRAC_CONST(0.944444), FRAC_CONST(0.942029), FRAC_CONST(0.941392), FRAC_CONST(0.94123), FRAC_CONST(0.94119) },
+    { FRAC_CONST(0.999992), FRAC_CONST(0.99997), FRAC_CONST(0.999878), FRAC_CONST(0.999519), FRAC_CONST(0.998165), FRAC_CONST(0.993789), FRAC_CONST(0.984615), FRAC_CONST(0.97561), FRAC_CONST(0.971429), FRAC_CONST(0.970149), FRAC_CONST(0.969811), FRAC_CONST(0.969726), FRAC_CONST(0.969704) },
+    { FRAC_CONST(0.999996), FRAC_CONST(0.999985), FRAC_CONST(0.999939), FRAC_CONST(0.99976), FRAC_CONST(0.999082), FRAC_CONST(0.996885), FRAC_CONST(0.992248), FRAC_CONST(0.987654), FRAC_CONST(0.985507), FRAC_CONST(0.984848), FRAC_CONST(0.984674), FRAC_CONST(0.98463), FRAC_CONST(0.984619) },
+    { FRAC_CONST(0.999998), FRAC_CONST(0.999992), FRAC_CONST(0.99997), FRAC_CONST(0.99988), FRAC_CONST(0.999541), FRAC_CONST(0.99844), FRAC_CONST(0.996109), FRAC_CONST(0.993789), FRAC_CONST(0.992701), FRAC_CONST(0.992366), FRAC_CONST(0.992278), FRAC_CONST(0.992256), FRAC_CONST(0.99225) },
+    { FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999985), FRAC_CONST(0.99994), FRAC_CONST(0.99977), FRAC_CONST(0.999219), FRAC_CONST(0.998051), FRAC_CONST(0.996885), FRAC_CONST(0.996337), FRAC_CONST(0.996169), FRAC_CONST(0.996124), FRAC_CONST(0.996113), FRAC_CONST(0.99611) },
+    { FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999992), FRAC_CONST(0.99997), FRAC_CONST(0.999885), FRAC_CONST(0.99961), FRAC_CONST(0.999024), FRAC_CONST(0.99844), FRAC_CONST(0.998165), FRAC_CONST(0.998081), FRAC_CONST(0.998058), FRAC_CONST(0.998053), FRAC_CONST(0.998051) },
+    { FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999985), FRAC_CONST(0.999943), FRAC_CONST(0.999805), FRAC_CONST(0.999512), FRAC_CONST(0.999219), FRAC_CONST(0.999082), FRAC_CONST(0.999039), FRAC_CONST(0.999028), FRAC_CONST(0.999025), FRAC_CONST(0.999025) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999992), FRAC_CONST(0.999971), FRAC_CONST(0.999902), FRAC_CONST(0.999756), FRAC_CONST(0.99961), FRAC_CONST(0.999541), FRAC_CONST(0.999519), FRAC_CONST(0.999514), FRAC_CONST(0.999512), FRAC_CONST(0.999512) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999986), FRAC_CONST(0.999951), FRAC_CONST(0.999878), FRAC_CONST(0.999805), FRAC_CONST(0.99977), FRAC_CONST(0.99976), FRAC_CONST(0.999757), FRAC_CONST(0.999756), FRAC_CONST(0.999756) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999993), FRAC_CONST(0.999976), FRAC_CONST(0.999939), FRAC_CONST(0.999902), FRAC_CONST(0.999885), FRAC_CONST(0.99988), FRAC_CONST(0.999878), FRAC_CONST(0.999878), FRAC_CONST(0.999878) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999988), FRAC_CONST(0.999969), FRAC_CONST(0.999951), FRAC_CONST(0.999943), FRAC_CONST(0.99994), FRAC_CONST(0.999939), FRAC_CONST(0.999939), FRAC_CONST(0.999939) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999994), FRAC_CONST(0.999985), FRAC_CONST(0.999976), FRAC_CONST(0.999971), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.999969) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999997), FRAC_CONST(0.999992), FRAC_CONST(0.999988), FRAC_CONST(0.999986), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999996), FRAC_CONST(0.999994), FRAC_CONST(0.999993), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999998), FRAC_CONST(0.999997), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }
+};
+
+static const real_t Q_div_tab_right[31][13] = {
+    { FRAC_CONST(0.00775382), FRAC_CONST(0.00775945), FRAC_CONST(0.00778198), FRAC_CONST(0.00787211), FRAC_CONST(0.00823245), FRAC_CONST(0.00967118), FRAC_CONST(0.0153846), FRAC_CONST(0.037594), FRAC_CONST(0.117241), FRAC_CONST(0.336788), FRAC_CONST(0.667532), FRAC_CONST(0.888985), FRAC_CONST(0.969704) },
+    { FRAC_CONST(0.0153883), FRAC_CONST(0.0153994), FRAC_CONST(0.0154438), FRAC_CONST(0.0156212), FRAC_CONST(0.0163305), FRAC_CONST(0.0191571), FRAC_CONST(0.030303), FRAC_CONST(0.0724638), FRAC_CONST(0.209877), FRAC_CONST(0.503876), FRAC_CONST(0.800623), FRAC_CONST(0.94123), FRAC_CONST(0.984619) },
+    { FRAC_CONST(0.0303102), FRAC_CONST(0.0303317), FRAC_CONST(0.0304178), FRAC_CONST(0.0307619), FRAC_CONST(0.0321361), FRAC_CONST(0.037594), FRAC_CONST(0.0588235), FRAC_CONST(0.135135), FRAC_CONST(0.346939), FRAC_CONST(0.670103), FRAC_CONST(0.889273), FRAC_CONST(0.969726), FRAC_CONST(0.99225) },
+    { FRAC_CONST(0.058837), FRAC_CONST(0.0588776), FRAC_CONST(0.0590397), FRAC_CONST(0.0596878), FRAC_CONST(0.0622711), FRAC_CONST(0.0724638), FRAC_CONST(0.111111), FRAC_CONST(0.238095), FRAC_CONST(0.515152), FRAC_CONST(0.802469), FRAC_CONST(0.941392), FRAC_CONST(0.98463), FRAC_CONST(0.99611) },
+    { FRAC_CONST(0.111135), FRAC_CONST(0.111208), FRAC_CONST(0.111497), FRAC_CONST(0.112652), FRAC_CONST(0.117241), FRAC_CONST(0.135135), FRAC_CONST(0.2), FRAC_CONST(0.384615), FRAC_CONST(0.68), FRAC_CONST(0.890411), FRAC_CONST(0.969811), FRAC_CONST(0.992256), FRAC_CONST(0.998051) },
+    { FRAC_CONST(0.200039), FRAC_CONST(0.200156), FRAC_CONST(0.200625), FRAC_CONST(0.202492), FRAC_CONST(0.209877), FRAC_CONST(0.238095), FRAC_CONST(0.333333), FRAC_CONST(0.555556), FRAC_CONST(0.809524), FRAC_CONST(0.942029), FRAC_CONST(0.984674), FRAC_CONST(0.996113), FRAC_CONST(0.999025) },
+    { FRAC_CONST(0.333388), FRAC_CONST(0.33355), FRAC_CONST(0.3342), FRAC_CONST(0.336788), FRAC_CONST(0.346939), FRAC_CONST(0.384615), FRAC_CONST(0.5), FRAC_CONST(0.714286), FRAC_CONST(0.894737), FRAC_CONST(0.970149), FRAC_CONST(0.992278), FRAC_CONST(0.998053), FRAC_CONST(0.999512) },
+    { FRAC_CONST(0.500061), FRAC_CONST(0.500244), FRAC_CONST(0.500975), FRAC_CONST(0.503876), FRAC_CONST(0.515152), FRAC_CONST(0.555556), FRAC_CONST(0.666667), FRAC_CONST(0.833333), FRAC_CONST(0.944444), FRAC_CONST(0.984848), FRAC_CONST(0.996124), FRAC_CONST(0.999025), FRAC_CONST(0.999756) },
+    { FRAC_CONST(0.666721), FRAC_CONST(0.666884), FRAC_CONST(0.667532), FRAC_CONST(0.670103), FRAC_CONST(0.68), FRAC_CONST(0.714286), FRAC_CONST(0.8), FRAC_CONST(0.909091), FRAC_CONST(0.971429), FRAC_CONST(0.992366), FRAC_CONST(0.998058), FRAC_CONST(0.999512), FRAC_CONST(0.999878) },
+    { FRAC_CONST(0.800039), FRAC_CONST(0.800156), FRAC_CONST(0.800623), FRAC_CONST(0.802469), FRAC_CONST(0.809524), FRAC_CONST(0.833333), FRAC_CONST(0.888889), FRAC_CONST(0.952381), FRAC_CONST(0.985507), FRAC_CONST(0.996169), FRAC_CONST(0.999028), FRAC_CONST(0.999756), FRAC_CONST(0.999939) },
+    { FRAC_CONST(0.888913), FRAC_CONST(0.888985), FRAC_CONST(0.889273), FRAC_CONST(0.890411), FRAC_CONST(0.894737), FRAC_CONST(0.909091), FRAC_CONST(0.941176), FRAC_CONST(0.97561), FRAC_CONST(0.992701), FRAC_CONST(0.998081), FRAC_CONST(0.999514), FRAC_CONST(0.999878), FRAC_CONST(0.999969) },
+    { FRAC_CONST(0.94119), FRAC_CONST(0.94123), FRAC_CONST(0.941392), FRAC_CONST(0.942029), FRAC_CONST(0.944444), FRAC_CONST(0.952381), FRAC_CONST(0.969697), FRAC_CONST(0.987654), FRAC_CONST(0.996337), FRAC_CONST(0.999039), FRAC_CONST(0.999757), FRAC_CONST(0.999939), FRAC_CONST(0.999985) },
+    { FRAC_CONST(0.969704), FRAC_CONST(0.969726), FRAC_CONST(0.969811), FRAC_CONST(0.970149), FRAC_CONST(0.971429), FRAC_CONST(0.97561), FRAC_CONST(0.984615), FRAC_CONST(0.993789), FRAC_CONST(0.998165), FRAC_CONST(0.999519), FRAC_CONST(0.999878), FRAC_CONST(0.99997), FRAC_CONST(0.999992) },
+    { FRAC_CONST(0.984619), FRAC_CONST(0.98463), FRAC_CONST(0.984674), FRAC_CONST(0.984848), FRAC_CONST(0.985507), FRAC_CONST(0.987654), FRAC_CONST(0.992248), FRAC_CONST(0.996885), FRAC_CONST(0.999082), FRAC_CONST(0.99976), FRAC_CONST(0.999939), FRAC_CONST(0.999985), FRAC_CONST(0.999996) },
+    { FRAC_CONST(0.99225), FRAC_CONST(0.992256), FRAC_CONST(0.992278), FRAC_CONST(0.992366), FRAC_CONST(0.992701), FRAC_CONST(0.993789), FRAC_CONST(0.996109), FRAC_CONST(0.99844), FRAC_CONST(0.999541), FRAC_CONST(0.99988), FRAC_CONST(0.99997), FRAC_CONST(0.999992), FRAC_CONST(0.999998) },
+    { FRAC_CONST(0.99611), FRAC_CONST(0.996113), FRAC_CONST(0.996124), FRAC_CONST(0.996169), FRAC_CONST(0.996337), FRAC_CONST(0.996885), FRAC_CONST(0.998051), FRAC_CONST(0.999219), FRAC_CONST(0.99977), FRAC_CONST(0.99994), FRAC_CONST(0.999985), FRAC_CONST(0.999996), FRAC_CONST(0.999999) },
+    { FRAC_CONST(0.998051), FRAC_CONST(0.998053), FRAC_CONST(0.998058), FRAC_CONST(0.998081), FRAC_CONST(0.998165), FRAC_CONST(0.99844), FRAC_CONST(0.999024), FRAC_CONST(0.99961), FRAC_CONST(0.999885), FRAC_CONST(0.99997), FRAC_CONST(0.999992), FRAC_CONST(0.999998), FRAC_CONST(1) },
+    { FRAC_CONST(0.999025), FRAC_CONST(0.999025), FRAC_CONST(0.999028), FRAC_CONST(0.999039), FRAC_CONST(0.999082), FRAC_CONST(0.999219), FRAC_CONST(0.999512), FRAC_CONST(0.999805), FRAC_CONST(0.999943), FRAC_CONST(0.999985), FRAC_CONST(0.999996), FRAC_CONST(0.999999), FRAC_CONST(1) },
+    { FRAC_CONST(0.999512), FRAC_CONST(0.999512), FRAC_CONST(0.999514), FRAC_CONST(0.999519), FRAC_CONST(0.999541), FRAC_CONST(0.99961), FRAC_CONST(0.999756), FRAC_CONST(0.999902), FRAC_CONST(0.999971), FRAC_CONST(0.999992), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(0.999756), FRAC_CONST(0.999756), FRAC_CONST(0.999757), FRAC_CONST(0.99976), FRAC_CONST(0.99977), FRAC_CONST(0.999805), FRAC_CONST(0.999878), FRAC_CONST(0.999951), FRAC_CONST(0.999986), FRAC_CONST(0.999996), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(0.999878), FRAC_CONST(0.999878), FRAC_CONST(0.999878), FRAC_CONST(0.99988), FRAC_CONST(0.999885), FRAC_CONST(0.999902), FRAC_CONST(0.999939), FRAC_CONST(0.999976), FRAC_CONST(0.999993), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(0.999939), FRAC_CONST(0.999939), FRAC_CONST(0.999939), FRAC_CONST(0.99994), FRAC_CONST(0.999943), FRAC_CONST(0.999951), FRAC_CONST(0.999969), FRAC_CONST(0.999988), FRAC_CONST(0.999996), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(0.999969), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.999971), FRAC_CONST(0.999976), FRAC_CONST(0.999985), FRAC_CONST(0.999994), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999986), FRAC_CONST(0.999988), FRAC_CONST(0.999992), FRAC_CONST(0.999997), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999993), FRAC_CONST(0.999994), FRAC_CONST(0.999996), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999997), FRAC_CONST(0.999998), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+    { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }
+};
+
+/* calculates 1/(1+Q) */
+/* [0..1] */
+real_t calc_Q_div(sbr_info *sbr, uint8_t ch, uint8_t m, uint8_t l)
+{
+    if (sbr->bs_coupling)
+    {
+        /* left channel */
+        if ((sbr->Q[0][m][l] < 0 || sbr->Q[0][m][l] > 30) ||
+            (sbr->Q[1][m][l] < 0 || sbr->Q[1][m][l] > 24 /* 2*panOffset(1) */))
+        {
+            return 0;
+        } else {
+            /* the pan parameter is always even */
+            if (ch == 0)
+            {
+                return Q_div_tab_left[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1];
+            } else {
+                return Q_div_tab_right[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1];
+            }
+        }
+    } else {
+        /* no coupling */
+        if (sbr->Q[ch][m][l] < 0 || sbr->Q[ch][m][l] > 30)
+        {
+            return 0;
+        } else {
+            return Q_div_tab[sbr->Q[ch][m][l]];
+        }
+    }
+}
+
+/* table for Q_div2 values when no coupling */
+static const real_t Q_div2_tab[31] = {
+    FRAC_CONST(0.984615),     FRAC_CONST(0.969697),
+    FRAC_CONST(0.941176),     FRAC_CONST(0.888889),
+    FRAC_CONST(0.8),          FRAC_CONST(0.666667),
+    FRAC_CONST(0.5),          FRAC_CONST(0.333333),
+    FRAC_CONST(0.2),          FRAC_CONST(0.111111),
+    FRAC_CONST(0.0588235),    FRAC_CONST(0.030303),
+    FRAC_CONST(0.0153846),    FRAC_CONST(0.00775194),
+    FRAC_CONST(0.00389105),   FRAC_CONST(0.00194932),
+    FRAC_CONST(0.00097561),   FRAC_CONST(0.000488043),
+    FRAC_CONST(0.000244081),  FRAC_CONST(0.000122055),
+    FRAC_CONST(6.10314E-005), FRAC_CONST(3.05166E-005),
+    FRAC_CONST(1.52586E-005), FRAC_CONST(7.62934E-006),
+    FRAC_CONST(3.81468E-006), FRAC_CONST(1.90734E-006),
+    FRAC_CONST(9.53673E-007), FRAC_CONST(4.76837E-007),
+    FRAC_CONST(2.38419E-007), FRAC_CONST(1.19209E-007),
+    FRAC_CONST(5.96046E-008)
+};
+
+static const real_t Q_div2_tab_left[31][13] = {
+    { FRAC_CONST(0.0302959), FRAC_CONST(0.111015), FRAC_CONST(0.332468), FRAC_CONST(0.663212), FRAC_CONST(0.882759), FRAC_CONST(0.962406), FRAC_CONST(0.984615), FRAC_CONST(0.990329), FRAC_CONST(0.991768), FRAC_CONST(0.992128), FRAC_CONST(0.992218), FRAC_CONST(0.992241), FRAC_CONST(0.992246) },
+    { FRAC_CONST(0.0153809), FRAC_CONST(0.0587695), FRAC_CONST(0.199377), FRAC_CONST(0.496124), FRAC_CONST(0.790123), FRAC_CONST(0.927536), FRAC_CONST(0.969697), FRAC_CONST(0.980843), FRAC_CONST(0.98367), FRAC_CONST(0.984379), FRAC_CONST(0.984556), FRAC_CONST(0.984601), FRAC_CONST(0.984612) },
+    { FRAC_CONST(0.00775006), FRAC_CONST(0.0302744), FRAC_CONST(0.110727), FRAC_CONST(0.329897), FRAC_CONST(0.653061), FRAC_CONST(0.864865), FRAC_CONST(0.941176), FRAC_CONST(0.962406), FRAC_CONST(0.967864), FRAC_CONST(0.969238), FRAC_CONST(0.969582), FRAC_CONST(0.969668), FRAC_CONST(0.96969) },
+    { FRAC_CONST(0.0038901), FRAC_CONST(0.0153698), FRAC_CONST(0.0586081), FRAC_CONST(0.197531), FRAC_CONST(0.484848), FRAC_CONST(0.761905), FRAC_CONST(0.888889), FRAC_CONST(0.927536), FRAC_CONST(0.937729), FRAC_CONST(0.940312), FRAC_CONST(0.94096), FRAC_CONST(0.941122), FRAC_CONST(0.941163) },
+    { FRAC_CONST(0.00194884), FRAC_CONST(0.00774443), FRAC_CONST(0.0301887), FRAC_CONST(0.109589), FRAC_CONST(0.32), FRAC_CONST(0.615385), FRAC_CONST(0.8), FRAC_CONST(0.864865), FRAC_CONST(0.882759), FRAC_CONST(0.887348), FRAC_CONST(0.888503), FRAC_CONST(0.888792), FRAC_CONST(0.888865) },
+    { FRAC_CONST(0.000975372), FRAC_CONST(0.00388727), FRAC_CONST(0.0153257), FRAC_CONST(0.057971), FRAC_CONST(0.190476), FRAC_CONST(0.444444), FRAC_CONST(0.666667), FRAC_CONST(0.761905), FRAC_CONST(0.790123), FRAC_CONST(0.797508), FRAC_CONST(0.799375), FRAC_CONST(0.799844), FRAC_CONST(0.799961) },
+    { FRAC_CONST(0.000487924), FRAC_CONST(0.00194742), FRAC_CONST(0.00772201), FRAC_CONST(0.0298507), FRAC_CONST(0.105263), FRAC_CONST(0.285714), FRAC_CONST(0.5), FRAC_CONST(0.615385), FRAC_CONST(0.653061), FRAC_CONST(0.663212), FRAC_CONST(0.6658), FRAC_CONST(0.66645), FRAC_CONST(0.666612) },
+    { FRAC_CONST(0.000244021), FRAC_CONST(0.000974659), FRAC_CONST(0.00387597), FRAC_CONST(0.0151515), FRAC_CONST(0.0555556), FRAC_CONST(0.166667), FRAC_CONST(0.333333), FRAC_CONST(0.444444), FRAC_CONST(0.484848), FRAC_CONST(0.496124), FRAC_CONST(0.499025), FRAC_CONST(0.499756), FRAC_CONST(0.499939) },
+    { FRAC_CONST(0.000122026), FRAC_CONST(0.000487567), FRAC_CONST(0.00194175), FRAC_CONST(0.00763359), FRAC_CONST(0.0285714), FRAC_CONST(0.0909091), FRAC_CONST(0.2), FRAC_CONST(0.285714), FRAC_CONST(0.32), FRAC_CONST(0.329897), FRAC_CONST(0.332468), FRAC_CONST(0.333116), FRAC_CONST(0.333279) },
+    { FRAC_CONST(6.10165E-005), FRAC_CONST(0.000243843), FRAC_CONST(0.000971817), FRAC_CONST(0.00383142), FRAC_CONST(0.0144928), FRAC_CONST(0.047619), FRAC_CONST(0.111111), FRAC_CONST(0.166667), FRAC_CONST(0.190476), FRAC_CONST(0.197531), FRAC_CONST(0.199377), FRAC_CONST(0.199844), FRAC_CONST(0.199961) },
+    { FRAC_CONST(3.05092E-005), FRAC_CONST(0.000121936), FRAC_CONST(0.000486145), FRAC_CONST(0.00191939), FRAC_CONST(0.00729927), FRAC_CONST(0.0243902), FRAC_CONST(0.0588235), FRAC_CONST(0.0909091), FRAC_CONST(0.105263), FRAC_CONST(0.109589), FRAC_CONST(0.110727), FRAC_CONST(0.111015), FRAC_CONST(0.111087) },
+    { FRAC_CONST(1.52548E-005), FRAC_CONST(6.09719E-005), FRAC_CONST(0.000243132), FRAC_CONST(0.000960615), FRAC_CONST(0.003663), FRAC_CONST(0.0123457), FRAC_CONST(0.030303), FRAC_CONST(0.047619), FRAC_CONST(0.0555556), FRAC_CONST(0.057971), FRAC_CONST(0.0586081), FRAC_CONST(0.0587695), FRAC_CONST(0.05881) },
+    { FRAC_CONST(7.62747E-006), FRAC_CONST(3.04869E-005), FRAC_CONST(0.000121581), FRAC_CONST(0.000480538), FRAC_CONST(0.00183486), FRAC_CONST(0.00621118), FRAC_CONST(0.0153846), FRAC_CONST(0.0243902), FRAC_CONST(0.0285714), FRAC_CONST(0.0298507), FRAC_CONST(0.0301887), FRAC_CONST(0.0302744), FRAC_CONST(0.0302959) },
+    { FRAC_CONST(3.81375E-006), FRAC_CONST(1.52437E-005), FRAC_CONST(6.0794E-005), FRAC_CONST(0.000240327), FRAC_CONST(0.000918274), FRAC_CONST(0.00311526), FRAC_CONST(0.00775194), FRAC_CONST(0.0123457), FRAC_CONST(0.0144928), FRAC_CONST(0.0151515), FRAC_CONST(0.0153257), FRAC_CONST(0.0153698), FRAC_CONST(0.0153809) },
+    { FRAC_CONST(1.90688E-006), FRAC_CONST(7.62189E-006), FRAC_CONST(3.03979E-005), FRAC_CONST(0.000120178), FRAC_CONST(0.000459348), FRAC_CONST(0.00156006), FRAC_CONST(0.00389105), FRAC_CONST(0.00621118), FRAC_CONST(0.00729927), FRAC_CONST(0.00763359), FRAC_CONST(0.00772201), FRAC_CONST(0.00774443), FRAC_CONST(0.00775006) },
+    { FRAC_CONST(9.53441E-007), FRAC_CONST(3.81096E-006), FRAC_CONST(1.51992E-005), FRAC_CONST(6.00925E-005), FRAC_CONST(0.000229727), FRAC_CONST(0.00078064), FRAC_CONST(0.00194932), FRAC_CONST(0.00311526), FRAC_CONST(0.003663), FRAC_CONST(0.00383142), FRAC_CONST(0.00387597), FRAC_CONST(0.00388727), FRAC_CONST(0.0038901) },
+    { FRAC_CONST(4.76721E-007), FRAC_CONST(1.90548E-006), FRAC_CONST(7.59965E-006), FRAC_CONST(3.00472E-005), FRAC_CONST(0.000114877), FRAC_CONST(0.000390472), FRAC_CONST(0.00097561), FRAC_CONST(0.00156006), FRAC_CONST(0.00183486), FRAC_CONST(0.00191939), FRAC_CONST(0.00194175), FRAC_CONST(0.00194742), FRAC_CONST(0.00194884) },
+    { FRAC_CONST(2.3836E-007), FRAC_CONST(9.52743E-007), FRAC_CONST(3.79984E-006), FRAC_CONST(1.50238E-005), FRAC_CONST(5.74416E-005), FRAC_CONST(0.000195274), FRAC_CONST(0.000488043), FRAC_CONST(0.00078064), FRAC_CONST(0.000918274), FRAC_CONST(0.000960615), FRAC_CONST(0.000971817), FRAC_CONST(0.000974659), FRAC_CONST(0.000975372) },
+    { FRAC_CONST(1.1918E-007), FRAC_CONST(4.76372E-007), FRAC_CONST(1.89992E-006), FRAC_CONST(7.51196E-006), FRAC_CONST(2.87216E-005), FRAC_CONST(9.76467E-005), FRAC_CONST(0.000244081), FRAC_CONST(0.000390472), FRAC_CONST(0.000459348), FRAC_CONST(0.000480538), FRAC_CONST(0.000486145), FRAC_CONST(0.000487567), FRAC_CONST(0.000487924) },
+    { FRAC_CONST(5.95901E-008), FRAC_CONST(2.38186E-007), FRAC_CONST(9.49963E-007), FRAC_CONST(3.756E-006), FRAC_CONST(1.4361E-005), FRAC_CONST(4.88257E-005), FRAC_CONST(0.000122055), FRAC_CONST(0.000195274), FRAC_CONST(0.000229727), FRAC_CONST(0.000240327), FRAC_CONST(0.000243132), FRAC_CONST(0.000243843), FRAC_CONST(0.000244021) },
+    { FRAC_CONST(2.9795E-008), FRAC_CONST(1.19093E-007), FRAC_CONST(4.74982E-007), FRAC_CONST(1.878E-006), FRAC_CONST(7.18056E-006), FRAC_CONST(2.44135E-005), FRAC_CONST(6.10314E-005), FRAC_CONST(9.76467E-005), FRAC_CONST(0.000114877), FRAC_CONST(0.000120178), FRAC_CONST(0.000121581), FRAC_CONST(0.000121936), FRAC_CONST(0.000122026) },
+    { FRAC_CONST(1.48975E-008), FRAC_CONST(5.95465E-008), FRAC_CONST(2.37491E-007), FRAC_CONST(9.39002E-007), FRAC_CONST(3.59029E-006), FRAC_CONST(1.22069E-005), FRAC_CONST(3.05166E-005), FRAC_CONST(4.88257E-005), FRAC_CONST(5.74416E-005), FRAC_CONST(6.00925E-005), FRAC_CONST(6.0794E-005), FRAC_CONST(6.09719E-005), FRAC_CONST(6.10165E-005) },
+    { FRAC_CONST(7.44876E-009), FRAC_CONST(2.97732E-008), FRAC_CONST(1.18745E-007), FRAC_CONST(4.69501E-007), FRAC_CONST(1.79515E-006), FRAC_CONST(6.10348E-006), FRAC_CONST(1.52586E-005), FRAC_CONST(2.44135E-005), FRAC_CONST(2.87216E-005), FRAC_CONST(3.00472E-005), FRAC_CONST(3.03979E-005), FRAC_CONST(3.04869E-005), FRAC_CONST(3.05092E-005) },
+    { FRAC_CONST(3.72438E-009), FRAC_CONST(1.48866E-008), FRAC_CONST(5.93727E-008), FRAC_CONST(2.34751E-007), FRAC_CONST(8.97575E-007), FRAC_CONST(3.05175E-006), FRAC_CONST(7.62934E-006), FRAC_CONST(1.22069E-005), FRAC_CONST(1.4361E-005), FRAC_CONST(1.50238E-005), FRAC_CONST(1.51992E-005), FRAC_CONST(1.52437E-005), FRAC_CONST(1.52548E-005) },
+    { FRAC_CONST(1.86219E-009), FRAC_CONST(7.44331E-009), FRAC_CONST(2.96864E-008), FRAC_CONST(1.17375E-007), FRAC_CONST(4.48788E-007), FRAC_CONST(1.52588E-006), FRAC_CONST(3.81468E-006), FRAC_CONST(6.10348E-006), FRAC_CONST(7.18056E-006), FRAC_CONST(7.51196E-006), FRAC_CONST(7.59965E-006), FRAC_CONST(7.62189E-006), FRAC_CONST(7.62747E-006) },
+    { FRAC_CONST(9.31095E-010), FRAC_CONST(3.72166E-009), FRAC_CONST(1.48432E-008), FRAC_CONST(5.86876E-008), FRAC_CONST(2.24394E-007), FRAC_CONST(7.62939E-007), FRAC_CONST(1.90734E-006), FRAC_CONST(3.05175E-006), FRAC_CONST(3.59029E-006), FRAC_CONST(3.756E-006), FRAC_CONST(3.79984E-006), FRAC_CONST(3.81096E-006), FRAC_CONST(3.81375E-006) },
+    { FRAC_CONST(4.65548E-010), FRAC_CONST(1.86083E-009), FRAC_CONST(7.42159E-009), FRAC_CONST(2.93438E-008), FRAC_CONST(1.12197E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(9.53673E-007), FRAC_CONST(1.52588E-006), FRAC_CONST(1.79515E-006), FRAC_CONST(1.878E-006), FRAC_CONST(1.89992E-006), FRAC_CONST(1.90548E-006), FRAC_CONST(1.90688E-006) },
+    { FRAC_CONST(2.32774E-010), FRAC_CONST(9.30414E-010), FRAC_CONST(3.71079E-009), FRAC_CONST(1.46719E-008), FRAC_CONST(5.60985E-008), FRAC_CONST(1.90735E-007), FRAC_CONST(4.76837E-007), FRAC_CONST(7.62939E-007), FRAC_CONST(8.97575E-007), FRAC_CONST(9.39002E-007), FRAC_CONST(9.49963E-007), FRAC_CONST(9.52743E-007), FRAC_CONST(9.53441E-007) },
+    { FRAC_CONST(1.16387E-010), FRAC_CONST(4.65207E-010), FRAC_CONST(1.8554E-009), FRAC_CONST(7.33596E-009), FRAC_CONST(2.80492E-008), FRAC_CONST(9.53674E-008), FRAC_CONST(2.38419E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(4.48788E-007), FRAC_CONST(4.69501E-007), FRAC_CONST(4.74982E-007), FRAC_CONST(4.76372E-007), FRAC_CONST(4.76721E-007) },
+    { FRAC_CONST(5.81935E-011), FRAC_CONST(2.32603E-010), FRAC_CONST(9.27699E-010), FRAC_CONST(3.66798E-009), FRAC_CONST(1.40246E-008), FRAC_CONST(4.76837E-008), FRAC_CONST(1.19209E-007), FRAC_CONST(1.90735E-007), FRAC_CONST(2.24394E-007), FRAC_CONST(2.34751E-007), FRAC_CONST(2.37491E-007), FRAC_CONST(2.38186E-007), FRAC_CONST(2.3836E-007) },
+    { FRAC_CONST(2.90967E-011), FRAC_CONST(1.16302E-010), FRAC_CONST(4.63849E-010), FRAC_CONST(1.83399E-009), FRAC_CONST(7.01231E-009), FRAC_CONST(2.38419E-008), FRAC_CONST(5.96046E-008), FRAC_CONST(9.53674E-008), FRAC_CONST(1.12197E-007), FRAC_CONST(1.17375E-007), FRAC_CONST(1.18745E-007), FRAC_CONST(1.19093E-007), FRAC_CONST(1.1918E-007) }
+};
+
+static const real_t Q_div2_tab_right[31][13] = {
+    { FRAC_CONST(0.992246), FRAC_CONST(0.992241), FRAC_CONST(0.992218), FRAC_CONST(0.992128), FRAC_CONST(0.991768), FRAC_CONST(0.990329), FRAC_CONST(0.984615), FRAC_CONST(0.962406), FRAC_CONST(0.882759), FRAC_CONST(0.663212), FRAC_CONST(0.332468), FRAC_CONST(0.111015), FRAC_CONST(0.0302959) },
+    { FRAC_CONST(0.984612), FRAC_CONST(0.984601), FRAC_CONST(0.984556), FRAC_CONST(0.984379), FRAC_CONST(0.98367), FRAC_CONST(0.980843), FRAC_CONST(0.969697), FRAC_CONST(0.927536), FRAC_CONST(0.790123), FRAC_CONST(0.496124), FRAC_CONST(0.199377), FRAC_CONST(0.0587695), FRAC_CONST(0.0153809) },
+    { FRAC_CONST(0.96969), FRAC_CONST(0.969668), FRAC_CONST(0.969582), FRAC_CONST(0.969238), FRAC_CONST(0.967864), FRAC_CONST(0.962406), FRAC_CONST(0.941176), FRAC_CONST(0.864865), FRAC_CONST(0.653061), FRAC_CONST(0.329897), FRAC_CONST(0.110727), FRAC_CONST(0.0302744), FRAC_CONST(0.00775006) },
+    { FRAC_CONST(0.941163), FRAC_CONST(0.941122), FRAC_CONST(0.94096), FRAC_CONST(0.940312), FRAC_CONST(0.937729), FRAC_CONST(0.927536), FRAC_CONST(0.888889), FRAC_CONST(0.761905), FRAC_CONST(0.484848), FRAC_CONST(0.197531), FRAC_CONST(0.0586081), FRAC_CONST(0.0153698), FRAC_CONST(0.0038901) },
+    { FRAC_CONST(0.888865), FRAC_CONST(0.888792), FRAC_CONST(0.888503), FRAC_CONST(0.887348), FRAC_CONST(0.882759), FRAC_CONST(0.864865), FRAC_CONST(0.8), FRAC_CONST(0.615385), FRAC_CONST(0.32), FRAC_CONST(0.109589), FRAC_CONST(0.0301887), FRAC_CONST(0.00774443), FRAC_CONST(0.00194884) },
+    { FRAC_CONST(0.799961), FRAC_CONST(0.799844), FRAC_CONST(0.799375), FRAC_CONST(0.797508), FRAC_CONST(0.790123), FRAC_CONST(0.761905), FRAC_CONST(0.666667), FRAC_CONST(0.444444), FRAC_CONST(0.190476), FRAC_CONST(0.057971), FRAC_CONST(0.0153257), FRAC_CONST(0.00388727), FRAC_CONST(0.000975372) },
+    { FRAC_CONST(0.666612), FRAC_CONST(0.66645), FRAC_CONST(0.6658), FRAC_CONST(0.663212), FRAC_CONST(0.653061), FRAC_CONST(0.615385), FRAC_CONST(0.5), FRAC_CONST(0.285714), FRAC_CONST(0.105263), FRAC_CONST(0.0298507), FRAC_CONST(0.00772201), FRAC_CONST(0.00194742), FRAC_CONST(0.000487924) },
+    { FRAC_CONST(0.499939), FRAC_CONST(0.499756), FRAC_CONST(0.499025), FRAC_CONST(0.496124), FRAC_CONST(0.484848), FRAC_CONST(0.444444), FRAC_CONST(0.333333), FRAC_CONST(0.166667), FRAC_CONST(0.0555556), FRAC_CONST(0.0151515), FRAC_CONST(0.00387597), FRAC_CONST(0.000974659), FRAC_CONST(0.000244021) },
+    { FRAC_CONST(0.333279), FRAC_CONST(0.333116), FRAC_CONST(0.332468), FRAC_CONST(0.329897), FRAC_CONST(0.32), FRAC_CONST(0.285714), FRAC_CONST(0.2), FRAC_CONST(0.0909091), FRAC_CONST(0.0285714), FRAC_CONST(0.00763359), FRAC_CONST(0.00194175), FRAC_CONST(0.000487567), FRAC_CONST(0.000122026) },
+    { FRAC_CONST(0.199961), FRAC_CONST(0.199844), FRAC_CONST(0.199377), FRAC_CONST(0.197531), FRAC_CONST(0.190476), FRAC_CONST(0.166667), FRAC_CONST(0.111111), FRAC_CONST(0.047619), FRAC_CONST(0.0144928), FRAC_CONST(0.00383142), FRAC_CONST(0.000971817), FRAC_CONST(0.000243843), FRAC_CONST(6.10165E-005) },
+    { FRAC_CONST(0.111087), FRAC_CONST(0.111015), FRAC_CONST(0.110727), FRAC_CONST(0.109589), FRAC_CONST(0.105263), FRAC_CONST(0.0909091), FRAC_CONST(0.0588235), FRAC_CONST(0.0243902), FRAC_CONST(0.00729927), FRAC_CONST(0.00191939), FRAC_CONST(0.000486145), FRAC_CONST(0.000121936), FRAC_CONST(3.05092E-005) },
+    { FRAC_CONST(0.05881), FRAC_CONST(0.0587695), FRAC_CONST(0.0586081), FRAC_CONST(0.057971), FRAC_CONST(0.0555556), FRAC_CONST(0.047619), FRAC_CONST(0.030303), FRAC_CONST(0.0123457), FRAC_CONST(0.003663), FRAC_CONST(0.000960615), FRAC_CONST(0.000243132), FRAC_CONST(6.09719E-005), FRAC_CONST(1.52548E-005) },
+    { FRAC_CONST(0.0302959), FRAC_CONST(0.0302744), FRAC_CONST(0.0301887), FRAC_CONST(0.0298507), FRAC_CONST(0.0285714), FRAC_CONST(0.0243902), FRAC_CONST(0.0153846), FRAC_CONST(0.00621118), FRAC_CONST(0.00183486), FRAC_CONST(0.000480538), FRAC_CONST(0.000121581), FRAC_CONST(3.04869E-005), FRAC_CONST(7.62747E-006) },
+    { FRAC_CONST(0.0153809), FRAC_CONST(0.0153698), FRAC_CONST(0.0153257), FRAC_CONST(0.0151515), FRAC_CONST(0.0144928), FRAC_CONST(0.0123457), FRAC_CONST(0.00775194), FRAC_CONST(0.00311526), FRAC_CONST(0.000918274), FRAC_CONST(0.000240327), FRAC_CONST(6.0794E-005), FRAC_CONST(1.52437E-005), FRAC_CONST(3.81375E-006) },
+    { FRAC_CONST(0.00775006), FRAC_CONST(0.00774443), FRAC_CONST(0.00772201), FRAC_CONST(0.00763359), FRAC_CONST(0.00729927), FRAC_CONST(0.00621118), FRAC_CONST(0.00389105), FRAC_CONST(0.00156006), FRAC_CONST(0.000459348), FRAC_CONST(0.000120178), FRAC_CONST(3.03979E-005), FRAC_CONST(7.62189E-006), FRAC_CONST(1.90688E-006) },
+    { FRAC_CONST(0.0038901), FRAC_CONST(0.00388727), FRAC_CONST(0.00387597), FRAC_CONST(0.00383142), FRAC_CONST(0.003663), FRAC_CONST(0.00311526), FRAC_CONST(0.00194932), FRAC_CONST(0.00078064), FRAC_CONST(0.000229727), FRAC_CONST(6.00925E-005), FRAC_CONST(1.51992E-005), FRAC_CONST(3.81096E-006), FRAC_CONST(9.53441E-007) },
+    { FRAC_CONST(0.00194884), FRAC_CONST(0.00194742), FRAC_CONST(0.00194175), FRAC_CONST(0.00191939), FRAC_CONST(0.00183486), FRAC_CONST(0.00156006), FRAC_CONST(0.00097561), FRAC_CONST(0.000390472), FRAC_CONST(0.000114877), FRAC_CONST(3.00472E-005), FRAC_CONST(7.59965E-006), FRAC_CONST(1.90548E-006), FRAC_CONST(4.76721E-007) },
+    { FRAC_CONST(0.000975372), FRAC_CONST(0.000974659), FRAC_CONST(0.000971817), FRAC_CONST(0.000960615), FRAC_CONST(0.000918274), FRAC_CONST(0.00078064), FRAC_CONST(0.000488043), FRAC_CONST(0.000195274), FRAC_CONST(5.74416E-005), FRAC_CONST(1.50238E-005), FRAC_CONST(3.79984E-006), FRAC_CONST(9.52743E-007), FRAC_CONST(2.3836E-007) },
+    { FRAC_CONST(0.000487924), FRAC_CONST(0.000487567), FRAC_CONST(0.000486145), FRAC_CONST(0.000480538), FRAC_CONST(0.000459348), FRAC_CONST(0.000390472), FRAC_CONST(0.000244081), FRAC_CONST(9.76467E-005), FRAC_CONST(2.87216E-005), FRAC_CONST(7.51196E-006), FRAC_CONST(1.89992E-006), FRAC_CONST(4.76372E-007), FRAC_CONST(1.1918E-007) },
+    { FRAC_CONST(0.000244021), FRAC_CONST(0.000243843), FRAC_CONST(0.000243132), FRAC_CONST(0.000240327), FRAC_CONST(0.000229727), FRAC_CONST(0.000195274), FRAC_CONST(0.000122055), FRAC_CONST(4.88257E-005), FRAC_CONST(1.4361E-005), FRAC_CONST(3.756E-006), FRAC_CONST(9.49963E-007), FRAC_CONST(2.38186E-007), FRAC_CONST(5.95901E-008) },
+    { FRAC_CONST(0.000122026), FRAC_CONST(0.000121936), FRAC_CONST(0.000121581), FRAC_CONST(0.000120178), FRAC_CONST(0.000114877), FRAC_CONST(9.76467E-005), FRAC_CONST(6.10314E-005), FRAC_CONST(2.44135E-005), FRAC_CONST(7.18056E-006), FRAC_CONST(1.878E-006), FRAC_CONST(4.74982E-007), FRAC_CONST(1.19093E-007), FRAC_CONST(2.9795E-008) },
+    { FRAC_CONST(6.10165E-005), FRAC_CONST(6.09719E-005), FRAC_CONST(6.0794E-005), FRAC_CONST(6.00925E-005), FRAC_CONST(5.74416E-005), FRAC_CONST(4.88257E-005), FRAC_CONST(3.05166E-005), FRAC_CONST(1.22069E-005), FRAC_CONST(3.59029E-006), FRAC_CONST(9.39002E-007), FRAC_CONST(2.37491E-007), FRAC_CONST(5.95465E-008), FRAC_CONST(1.48975E-008) },
+    { FRAC_CONST(3.05092E-005), FRAC_CONST(3.04869E-005), FRAC_CONST(3.03979E-005), FRAC_CONST(3.00472E-005), FRAC_CONST(2.87216E-005), FRAC_CONST(2.44135E-005), FRAC_CONST(1.52586E-005), FRAC_CONST(6.10348E-006), FRAC_CONST(1.79515E-006), FRAC_CONST(4.69501E-007), FRAC_CONST(1.18745E-007), FRAC_CONST(2.97732E-008), FRAC_CONST(7.44876E-009) },
+    { FRAC_CONST(1.52548E-005), FRAC_CONST(1.52437E-005), FRAC_CONST(1.51992E-005), FRAC_CONST(1.50238E-005), FRAC_CONST(1.4361E-005), FRAC_CONST(1.22069E-005), FRAC_CONST(7.62934E-006), FRAC_CONST(3.05175E-006), FRAC_CONST(8.97575E-007), FRAC_CONST(2.34751E-007), FRAC_CONST(5.93727E-008), FRAC_CONST(1.48866E-008), FRAC_CONST(3.72438E-009) },
+    { FRAC_CONST(7.62747E-006), FRAC_CONST(7.62189E-006), FRAC_CONST(7.59965E-006), FRAC_CONST(7.51196E-006), FRAC_CONST(7.18056E-006), FRAC_CONST(6.10348E-006), FRAC_CONST(3.81468E-006), FRAC_CONST(1.52588E-006), FRAC_CONST(4.48788E-007), FRAC_CONST(1.17375E-007), FRAC_CONST(2.96864E-008), FRAC_CONST(7.44331E-009), FRAC_CONST(1.86219E-009) },
+    { FRAC_CONST(3.81375E-006), FRAC_CONST(3.81096E-006), FRAC_CONST(3.79984E-006), FRAC_CONST(3.756E-006), FRAC_CONST(3.59029E-006), FRAC_CONST(3.05175E-006), FRAC_CONST(1.90734E-006), FRAC_CONST(7.62939E-007), FRAC_CONST(2.24394E-007), FRAC_CONST(5.86876E-008), FRAC_CONST(1.48432E-008), FRAC_CONST(3.72166E-009), FRAC_CONST(9.31095E-010) },
+    { FRAC_CONST(1.90688E-006), FRAC_CONST(1.90548E-006), FRAC_CONST(1.89992E-006), FRAC_CONST(1.878E-006), FRAC_CONST(1.79515E-006), FRAC_CONST(1.52588E-006), FRAC_CONST(9.53673E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(1.12197E-007), FRAC_CONST(2.93438E-008), FRAC_CONST(7.42159E-009), FRAC_CONST(1.86083E-009), FRAC_CONST(4.65548E-010) },
+    { FRAC_CONST(9.53441E-007), FRAC_CONST(9.52743E-007), FRAC_CONST(9.49963E-007), FRAC_CONST(9.39002E-007), FRAC_CONST(8.97575E-007), FRAC_CONST(7.62939E-007), FRAC_CONST(4.76837E-007), FRAC_CONST(1.90735E-007), FRAC_CONST(5.60985E-008), FRAC_CONST(1.46719E-008), FRAC_CONST(3.71079E-009), FRAC_CONST(9.30414E-010), FRAC_CONST(2.32774E-010) },
+    { FRAC_CONST(4.76721E-007), FRAC_CONST(4.76372E-007), FRAC_CONST(4.74982E-007), FRAC_CONST(4.69501E-007), FRAC_CONST(4.48788E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(2.38419E-007), FRAC_CONST(9.53674E-008), FRAC_CONST(2.80492E-008), FRAC_CONST(7.33596E-009), FRAC_CONST(1.8554E-009), FRAC_CONST(4.65207E-010), FRAC_CONST(1.16387E-010) },
+    { FRAC_CONST(2.3836E-007), FRAC_CONST(2.38186E-007), FRAC_CONST(2.37491E-007), FRAC_CONST(2.34751E-007), FRAC_CONST(2.24394E-007), FRAC_CONST(1.90735E-007), FRAC_CONST(1.19209E-007), FRAC_CONST(4.76837E-008), FRAC_CONST(1.40246E-008), FRAC_CONST(3.66798E-009), FRAC_CONST(9.27699E-010), FRAC_CONST(2.32603E-010), FRAC_CONST(5.81935E-011) },
+    { FRAC_CONST(1.1918E-007), FRAC_CONST(1.19093E-007), FRAC_CONST(1.18745E-007), FRAC_CONST(1.17375E-007), FRAC_CONST(1.12197E-007), FRAC_CONST(9.53674E-008), FRAC_CONST(5.96046E-008), FRAC_CONST(2.38419E-008), FRAC_CONST(7.01231E-009), FRAC_CONST(1.83399E-009), FRAC_CONST(4.63849E-010), FRAC_CONST(1.16302E-010), FRAC_CONST(2.90967E-011) }
+};
+
+/* calculates Q/(1+Q) */
+/* [0..1] */
+real_t calc_Q_div2(sbr_info *sbr, uint8_t ch, uint8_t m, uint8_t l)
+{
+    if (sbr->bs_coupling)
+    {
+        if ((sbr->Q[0][m][l] < 0 || sbr->Q[0][m][l] > 30) ||
+            (sbr->Q[1][m][l] < 0 || sbr->Q[1][m][l] > 24 /* 2*panOffset(1) */))
+        {
+            return 0;
+        } else {
+            /* the pan parameter is always even */
+            if (ch == 0)
+            {
+                return Q_div2_tab_left[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1];
+            } else {
+                return Q_div2_tab_right[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1];
+            }
+        }
+    } else {
+        /* no coupling */
+        if (sbr->Q[ch][m][l] < 0 || sbr->Q[ch][m][l] > 30)
+        {
+            return 0;
+        } else {
+            return Q_div2_tab[sbr->Q[ch][m][l]];
+        }
+    }
+}
+
+static const real_t E_deq_tab[64] = {
+    64.0f, 128.0f, 256.0f, 512.0f, 1024.0f, 2048.0f, 4096.0f, 8192.0f,
+    16384.0f, 32768.0f, 65536.0f, 131072.0f, 262144.0f, 524288.0f, 1.04858E+006f, 2.09715E+006f,
+    4.1943E+006f, 8.38861E+006f, 1.67772E+007f, 3.35544E+007f, 6.71089E+007f, 1.34218E+008f, 2.68435E+008f, 5.36871E+008f,
+    1.07374E+009f, 2.14748E+009f, 4.29497E+009f, 8.58993E+009f, 1.71799E+010f, 3.43597E+010f, 6.87195E+010f, 1.37439E+011f,
+    2.74878E+011f, 5.49756E+011f, 1.09951E+012f, 2.19902E+012f, 4.39805E+012f, 8.79609E+012f, 1.75922E+013f, 3.51844E+013f,
+    7.03687E+013f, 1.40737E+014f, 2.81475E+014f, 5.6295E+014f, 1.1259E+015f, 2.2518E+015f, 4.5036E+015f, 9.0072E+015f,
+    1.80144E+016f, 3.60288E+016f, 7.20576E+016f, 1.44115E+017f, 2.8823E+017f, 5.76461E+017f, 1.15292E+018f, 2.30584E+018f,
+    4.61169E+018f, 9.22337E+018f, 1.84467E+019f, 3.68935E+019f, 7.3787E+019f, 1.47574E+020f, 2.95148E+020f, 5.90296E+020f
+};
+
 void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch)
 {
     if (sbr->bs_coupling == 0)
     {
+        int16_t exp;
         uint8_t l, k;
-        real_t amp = (sbr->amp_res[ch]) ? 1.0f : 0.5f;
+        uint8_t amp = (sbr->amp_res[ch]) ? 0 : 1;
 
         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);
+                /* +6 for the *64 and -10 for the /32 in the synthesis QMF (fixed)
+                 * since this is a energy value: (x/32)^2 = (x^2)/1024
+                 */
+                /* exp = (sbr->E[ch][k][l] >> amp) + 6; */
+                exp = (sbr->E[ch][k][l] >> amp);
+
+                if ((exp < 0) || (exp >= 64))
+                {
+                    sbr->E_orig[ch][k][l] = 0;
+                } else {
+                    sbr->E_orig[ch][k][l] = E_deq_tab[exp];
+
+                    /* save half the table size at the cost of 1 multiply */
+                    if (amp && (sbr->E[ch][k][l] & 1))
+                    {
+                        sbr->E_orig[ch][k][l] = MUL_C(sbr->E_orig[ch][k][l], COEF_CONST(1.414213562));
+                    }
+                }
             }
         }
 
@@ -158,58 +426,82 @@
         {
             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]);
-                }
+                sbr->Q_div[ch][k][l] = calc_Q_div(sbr, ch, k, l);
+                sbr->Q_div2[ch][k][l] = calc_Q_div2(sbr, ch, k, l);
             }
         }
     }
 }
 
+static const real_t E_pan_tab[25] = {
+    FRAC_CONST(0.000244081), FRAC_CONST(0.000488043),
+    FRAC_CONST(0.00097561),  FRAC_CONST(0.00194932),
+    FRAC_CONST(0.00389105),  FRAC_CONST(0.00775194),
+    FRAC_CONST(0.0153846),   FRAC_CONST(0.030303),
+    FRAC_CONST(0.0588235),   FRAC_CONST(0.111111),
+    FRAC_CONST(0.2),         FRAC_CONST(0.333333),
+    FRAC_CONST(0.5),         FRAC_CONST(0.666667),
+    FRAC_CONST(0.8),         FRAC_CONST(0.888889),
+    FRAC_CONST(0.941176),    FRAC_CONST(0.969697),
+    FRAC_CONST(0.984615),    FRAC_CONST(0.992248),
+    FRAC_CONST(0.996109),    FRAC_CONST(0.998051),
+    FRAC_CONST(0.999024),    FRAC_CONST(0.999512),
+    FRAC_CONST(0.999756)
+};
+
 void unmap_envelope_noise(sbr_info *sbr)
 {
+    real_t tmp;
+    int16_t exp0, exp1;
     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;
+    uint8_t amp0 = (sbr->amp_res[0]) ? 0 : 1;
+    uint8_t amp1 = (sbr->amp_res[1]) ? 0 : 1;
 
     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 ; */
+            exp0 = (sbr->E[0][k][l] >> amp0) + 1;
 
-            /* +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);
+            /* E[1] is always even so no need for compensating the divide by 2 with
+             * an extra multiplication
+             */
+            /* exp1 = (sbr->E[1][k][l] >> amp1) - 12; */
+            exp1 = (sbr->E[1][k][l] >> amp1);
 
-            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]);
+            if ((exp0 < 0) || (exp0 >= 64) ||
+                (exp1 < 0) || (exp1 > 24))
+            {
+                sbr->E_orig[1][k][l] = 0;
+                sbr->E_orig[0][k][l] = 0;
+            } else {
+                tmp = E_deq_tab[exp0];
+                if (amp0 && (sbr->E[0][k][l] & 1))
+                {
+                    tmp = MUL_C(tmp, COEF_CONST(1.414213562));
+                }
+
+                /* panning */
+                sbr->E_orig[0][k][l] = MUL_F(tmp, E_pan_tab[exp1]);
+                sbr->E_orig[1][k][l] = MUL_F(tmp, E_pan_tab[24 - exp1]);
+            }
         }
     }
+
     for (l = 0; l < sbr->L_Q[0]; l++)
     {
         for (k = 0; k < sbr->N_Q; k++)
         {
-            if ((sbr->Q[0][k][l] < 0 || sbr->Q[0][k][l] > 30) ||
-                (sbr->Q[1][k][l] < 0 || sbr->Q[1][k][l] > 24 /* 2*panOffset(1) */))
-            {
-                sbr->Q_orig[0][k][l] = 0;
-                sbr->Q_orig[1][k][l] = 0;
-            } else {
-                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]);
-            }
+            sbr->Q_div[0][k][l] = calc_Q_div(sbr, 0, k, l);
+            sbr->Q_div[1][k][l] = calc_Q_div(sbr, 1, k, l);
+            sbr->Q_div2[0][k][l] = calc_Q_div2(sbr, 0, k, l);
+            sbr->Q_div2[1][k][l] = calc_Q_div2(sbr, 1, k, l);
         }
     }
 }
 
 #endif
+
+#endif
--- a/Plugins/Input/aac/libfaad2/sbr_e_nf.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_e_nf.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_e_nf.h,v 1.7 2003/11/12 20:47:58 menno Exp $
+** $Id: sbr_e_nf.h,v 1.14 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_E_NF_H__
@@ -32,11 +32,13 @@
 extern "C" {
 #endif
 
+
 void extract_envelope_data(sbr_info *sbr, uint8_t ch);
 void extract_noise_floor_data(sbr_info *sbr, uint8_t ch);
+#ifndef FIXED_POINT
 void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch);
 void unmap_envelope_noise(sbr_info *sbr);
-
+#endif
 
 #ifdef __cplusplus
 }
--- a/Plugins/Input/aac/libfaad2/sbr_fbt.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_fbt.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_fbt.c,v 1.7 2003/11/12 20:47:58 menno Exp $
+** $Id: sbr_fbt.c,v 1.17 2004/09/08 09:43:11 gcp Exp $
 **/
 
 /* Calculate frequency band tables */
@@ -37,6 +37,10 @@
 #include "sbr_syntax.h"
 #include "sbr_fbt.h"
 
+/* static function declarations */
+static int32_t find_bands(uint8_t warp, uint8_t bands, uint8_t a0, uint8_t a1);
+
+
 /* calculate the start QMF channel for the master frequency band table */
 /* parameter is also called k0 */
 uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode,
@@ -98,9 +102,9 @@
     }
 }
 
-static int32_t longcmp(const void *a, const void *b)
+static int longcmp(const void *a, const void *b)
 {
-    return ((int32_t)(*(int32_t*)a - *(int32_t*)b));
+    return ((int)(*(int32_t*)a - *(int32_t*)b));
 }
 
 /* calculate the stop QMF channel for the master frequency band table */
@@ -180,8 +184,8 @@
 
    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)
+uint8_t master_frequency_table_fs0(sbr_info *sbr, uint8_t k0, uint8_t k2,
+                                   uint8_t bs_alter_scale)
 {
     int8_t incr;
     uint8_t k;
@@ -193,7 +197,7 @@
     if (k2 <= k0)
     {
         sbr->N_master = 0;
-        return;
+        return 1;
     }
 
     dk = bs_alter_scale ? 2 : 1;
@@ -209,6 +213,8 @@
     }
 #endif
     nrBands = min(nrBands, 63);
+    if (nrBands <= 0)
+        return 1;
 
     k2Achieved = k0 + nrBands * dk;
     k2Diff = k2 - k2Achieved;
@@ -218,7 +224,7 @@
     if (k2Diff)
     {
         incr = (k2Diff > 0) ? -1 : 1;
-        k = (k2Diff > 0) ? (nrBands-1) : 0;
+        k = (uint8_t) ((k2Diff > 0) ? (nrBands-1) : 0);
 
         while (k2Diff != 0)
         {
@@ -230,10 +236,10 @@
 
     sbr->f_master[0] = k0;
     for (k = 1; k <= nrBands; k++)
-        sbr->f_master[k] = sbr->f_master[k-1] + vDk[k-1];
+        sbr->f_master[k] = (uint8_t)(sbr->f_master[k-1] + vDk[k-1]);
 
-    sbr->N_master = nrBands;
-    sbr->N_master = min(sbr->N_master, 64);
+    sbr->N_master = (uint8_t)nrBands;
+    sbr->N_master = (min(sbr->N_master, 64));
 
 #if 0
     printf("f_master[%d]: ", nrBands);
@@ -243,6 +249,8 @@
     }
     printf("\n");
 #endif
+
+    return 0;
 }
 
 /*
@@ -251,22 +259,93 @@
 */
 static int32_t find_bands(uint8_t warp, uint8_t bands, uint8_t a0, uint8_t a1)
 {
+#ifdef FIXED_POINT
+    /* table with log2() values */
+    static const real_t log2Table[65] = {
+        COEF_CONST(0.0), COEF_CONST(0.0), COEF_CONST(1.0000000000), COEF_CONST(1.5849625007),
+        COEF_CONST(2.0000000000), COEF_CONST(2.3219280949), COEF_CONST(2.5849625007), COEF_CONST(2.8073549221),
+        COEF_CONST(3.0000000000), COEF_CONST(3.1699250014), COEF_CONST(3.3219280949), COEF_CONST(3.4594316186),
+        COEF_CONST(3.5849625007), COEF_CONST(3.7004397181), COEF_CONST(3.8073549221), COEF_CONST(3.9068905956),
+        COEF_CONST(4.0000000000), COEF_CONST(4.0874628413), COEF_CONST(4.1699250014), COEF_CONST(4.2479275134),
+        COEF_CONST(4.3219280949), COEF_CONST(4.3923174228), COEF_CONST(4.4594316186), COEF_CONST(4.5235619561),
+        COEF_CONST(4.5849625007), COEF_CONST(4.6438561898), COEF_CONST(4.7004397181), COEF_CONST(4.7548875022),
+        COEF_CONST(4.8073549221), COEF_CONST(4.8579809951), COEF_CONST(4.9068905956), COEF_CONST(4.9541963104),
+        COEF_CONST(5.0000000000), COEF_CONST(5.0443941194), COEF_CONST(5.0874628413), COEF_CONST(5.1292830169),
+        COEF_CONST(5.1699250014), COEF_CONST(5.2094533656), COEF_CONST(5.2479275134), COEF_CONST(5.2854022189),
+        COEF_CONST(5.3219280949), COEF_CONST(5.3575520046), COEF_CONST(5.3923174228), COEF_CONST(5.4262647547),
+        COEF_CONST(5.4594316186), COEF_CONST(5.4918530963), COEF_CONST(5.5235619561), COEF_CONST(5.5545888517),
+        COEF_CONST(5.5849625007), COEF_CONST(5.6147098441), COEF_CONST(5.6438561898), COEF_CONST(5.6724253420),
+        COEF_CONST(5.7004397181), COEF_CONST(5.7279204546), COEF_CONST(5.7548875022), COEF_CONST(5.7813597135),
+        COEF_CONST(5.8073549221), COEF_CONST(5.8328900142), COEF_CONST(5.8579809951), COEF_CONST(5.8826430494),
+        COEF_CONST(5.9068905956), COEF_CONST(5.9307373376), COEF_CONST(5.9541963104), COEF_CONST(5.9772799235),
+        COEF_CONST(6.0)
+    };
+    real_t r0 = log2Table[a0]; /* coef */
+    real_t r1 = log2Table[a1]; /* coef */
+    real_t r2 = (r1 - r0); /* coef */
+
+    if (warp)
+        r2 = MUL_C(r2, COEF_CONST(1.0/1.3));
+
+    /* convert r2 to real and then multiply and round */
+    r2 = (r2 >> (COEF_BITS-REAL_BITS)) * bands + (1<<(REAL_BITS-1));
+
+    return (r2 >> REAL_BITS);
+#else
     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);
+#endif
 }
 
 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);
+#ifdef FIXED_POINT
+    /* table with log() values */
+    static const real_t logTable[65] = {
+        COEF_CONST(0.0), COEF_CONST(0.0), COEF_CONST(0.6931471806), COEF_CONST(1.0986122887),
+        COEF_CONST(1.3862943611), COEF_CONST(1.6094379124), COEF_CONST(1.7917594692), COEF_CONST(1.9459101491),
+        COEF_CONST(2.0794415417), COEF_CONST(2.1972245773), COEF_CONST(2.3025850930), COEF_CONST(2.3978952728),
+        COEF_CONST(2.4849066498), COEF_CONST(2.5649493575), COEF_CONST(2.6390573296), COEF_CONST(2.7080502011),
+        COEF_CONST(2.7725887222), COEF_CONST(2.8332133441), COEF_CONST(2.8903717579), COEF_CONST(2.9444389792),
+        COEF_CONST(2.9957322736), COEF_CONST(3.0445224377), COEF_CONST(3.0910424534), COEF_CONST(3.1354942159),
+        COEF_CONST(3.1780538303), COEF_CONST(3.2188758249), COEF_CONST(3.2580965380), COEF_CONST(3.2958368660),
+        COEF_CONST(3.3322045102), COEF_CONST(3.3672958300), COEF_CONST(3.4011973817), COEF_CONST(3.4339872045),
+        COEF_CONST(3.4657359028), COEF_CONST(3.4965075615), COEF_CONST(3.5263605246), COEF_CONST(3.5553480615),
+        COEF_CONST(3.5835189385), COEF_CONST(3.6109179126), COEF_CONST(3.6375861597), COEF_CONST(3.6635616461),
+        COEF_CONST(3.6888794541), COEF_CONST(3.7135720667), COEF_CONST(3.7376696183), COEF_CONST(3.7612001157),
+        COEF_CONST(3.7841896339), COEF_CONST(3.8066624898), COEF_CONST(3.8286413965), COEF_CONST(3.8501476017),
+        COEF_CONST(3.8712010109), COEF_CONST(3.8918202981), COEF_CONST(3.9120230054), COEF_CONST(3.9318256327),
+        COEF_CONST(3.9512437186), COEF_CONST(3.9702919136), COEF_CONST(3.9889840466), COEF_CONST(4.0073331852),
+        COEF_CONST(4.0253516907), COEF_CONST(4.0430512678), COEF_CONST(4.0604430105), COEF_CONST(4.0775374439),
+        COEF_CONST(4.0943445622), COEF_CONST(4.1108738642), COEF_CONST(4.1271343850), COEF_CONST(4.1431347264),
+        COEF_CONST(4.158883083)
+    };
+    /* standard Taylor polynomial coefficients for exp(x) around 0 */
+    /* a polynomial around x=1 is more precise, as most values are around 1.07,
+       but this is just fine already */
+    static const real_t c1 = COEF_CONST(1.0);
+    static const real_t c2 = COEF_CONST(1.0/2.0);
+    static const real_t c3 = COEF_CONST(1.0/6.0);
+    static const real_t c4 = COEF_CONST(1.0/24.0);
+
+    real_t r0 = logTable[a0]; /* coef */
+    real_t r1 = logTable[a1]; /* coef */
+    real_t r2 = (r1 - r0) / bands; /* coef */
+    real_t rexp = c1 + MUL_C((c1 + MUL_C((c2 + MUL_C((c3 + MUL_C(c4,r2)), r2)), r2)), r2);
+
+    return (rexp >> (COEF_BITS-REAL_BITS)); /* real */
+#else
+    return (real_t)pow((real_t)a1/(real_t)a0, 1.0/(real_t)bands);
+#endif
 }
 
 /*
    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 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;
@@ -276,17 +355,26 @@
     uint8_t temp1[] = { 6, 5, 4 };
     real_t q, qk;
     int32_t A_1;
+#ifdef FIXED_POINT
+    real_t rk2, rk0;
+#endif
 
     /* mft only defined for k2 > k0 */
     if (k2 <= k0)
     {
         sbr->N_master = 0;
-        return;
+        return 1;
     }
 
     bands = temp1[bs_freq_scale-1];
 
+#ifdef FIXED_POINT
+    rk0 = (real_t)k0 << REAL_BITS;
+    rk2 = (real_t)k2 << REAL_BITS;
+    if (rk2 > MUL_C(rk0, COEF_CONST(2.2449)))
+#else
     if ((float)k2/(float)k0 > 2.2449)
+#endif
     {
         twoRegions = 1;
         k1 = k0 << 1;
@@ -295,17 +383,30 @@
         k1 = k2;
     }
 
-    nrBand0 = 2 * find_bands(0, bands, k0, k1);
+    nrBand0 = (uint8_t)(2 * find_bands(0, bands, k0, k1));
     nrBand0 = min(nrBand0, 63);
+    if (nrBand0 <= 0)
+        return 1;
 
     q = find_initial_power(nrBand0, k0, k1);
+#ifdef FIXED_POINT
+    qk = (real_t)k0 << REAL_BITS;
+    //A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS);
+    A_1 = k0;
+#else
     qk = REAL_CONST(k0);
     A_1 = (int32_t)(qk + .5);
+#endif
     for (k = 0; k <= nrBand0; k++)
     {
         int32_t A_0 = A_1;
+#ifdef FIXED_POINT
+        qk = MUL_R(qk,q);
+        A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS);
+#else
         qk *= q;
         A_1 = (int32_t)(qk + 0.5);
+#endif
         vDk0[k] = A_1 - A_0;
     }
 
@@ -316,29 +417,42 @@
     for (k = 1; k <= nrBand0; k++)
     {
         vk0[k] = vk0[k-1] + vDk0[k-1];
+        if (vDk0[k-1] == 0)
+            return 1;
     }
 
     if (!twoRegions)
     {
         for (k = 0; k <= nrBand0; k++)
-            sbr->f_master[k] = vk0[k];
+            sbr->f_master[k] = (uint8_t) vk0[k];
 
         sbr->N_master = nrBand0;
         sbr->N_master = min(sbr->N_master, 64);
-        return;
+        return 0;
     }
 
-    nrBand1 = 2 * find_bands(1 /* warped */, bands, k1, k2);
+    nrBand1 = (uint8_t)(2 * find_bands(1 /* warped */, bands, k1, k2));
     nrBand1 = min(nrBand1, 63);
 
     q = find_initial_power(nrBand1, k1, k2);
+#ifdef FIXED_POINT
+    qk = (real_t)k1 << REAL_BITS;
+    //A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS);
+    A_1 = k1;
+#else
     qk = REAL_CONST(k1);
     A_1 = (int32_t)(qk + .5);
+#endif
     for (k = 0; k <= nrBand1 - 1; k++)
     {
         int32_t A_0 = A_1;
+#ifdef FIXED_POINT
+        qk = MUL_R(qk,q);
+        A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS);
+#else
         qk *= q;
         A_1 = (int32_t)(qk + 0.5);
+#endif
         vDk1[k] = A_1 - A_0;
     }
 
@@ -359,17 +473,19 @@
     for (k = 1; k <= nrBand1; k++)
     {
         vk1[k] = vk1[k-1] + vDk1[k-1];
+        if (vDk1[k-1] == 0)
+            return 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];
+        sbr->f_master[k] =  (uint8_t) vk0[k];
     }
     for (k = nrBand0 + 1; k <= sbr->N_master; k++)
     {
-        sbr->f_master[k] = vk1[k - nrBand0];
+        sbr->f_master[k] = (uint8_t) vk1[k - nrBand0];
     }
 
 #if 0
@@ -380,6 +496,8 @@
     }
     printf("\n");
 #endif
+
+    return 0;
 }
 
 /* calculate the derived frequency border tables from f_master */
@@ -406,6 +524,10 @@
 
     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];
+    if (sbr->kx > 32)
+        return 1;
+    if (sbr->kx + sbr->M > 64)
+        return 1;
 
     minus = (sbr->N_high & 1) ? 1 : 0;
 
@@ -414,11 +536,13 @@
         if (k == 0)
             i = 0;
         else
-            i = 2*k - minus;
+            i = (uint8_t)(2*k - minus);
         sbr->f_table_res[LO_RES][k] = sbr->f_table_res[HI_RES][i];
     }
 
 #if 0
+    printf("bs_freq_scale: %d\n", sbr->bs_freq_scale);
+    printf("bs_limiter_bands: %d\n", sbr->bs_limiter_bands);
     printf("f_table_res[HI_RES][%d]: ", sbr->N_high);
     for (k = 0; k <= sbr->N_high; k++)
     {
@@ -443,7 +567,7 @@
 #if 0
         sbr->N_Q = max(1, (int32_t)(sbr->bs_noise_bands*(log(k2/(float)sbr->kx)/log(2.0)) + 0.5));
 #else
-        sbr->N_Q = max(1, find_bands(0, sbr->bs_noise_bands, sbr->kx, k2));
+        sbr->N_Q = (uint8_t)(max(1, find_bands(0, sbr->bs_noise_bands, sbr->kx, k2)));
 #endif
         sbr->N_Q = min(5, sbr->N_Q);
     }
@@ -479,7 +603,7 @@
     printf("f_table_noise[%d]: ", sbr->N_Q);
     for (k = 0; k <= sbr->N_Q; k++)
     {
-        printf("%d ", sbr->f_table_noise[k]);
+        printf("%d ", sbr->f_table_noise[k] - sbr->kx);
     }
     printf("\n");
 #endif
@@ -498,8 +622,8 @@
     static const real_t limiterBandsPerOctave[] = { REAL_CONST(1.2),
         REAL_CONST(2), REAL_CONST(3) };
 #else
-    static const real_t limiterBandsCompare[] = { REAL_CONST(1.328125),
-        REAL_CONST(1.1875), REAL_CONST(1.125) };
+    static const real_t limiterBandsCompare[] = { REAL_CONST(1.327152),
+        REAL_CONST(1.185093), REAL_CONST(1.119872) };
 #endif
     uint8_t k, s;
     int8_t nrLim;
@@ -511,6 +635,15 @@
     sbr->f_table_lim[0][1] = sbr->f_table_res[LO_RES][sbr->N_low] - sbr->kx;
     sbr->N_L[0] = 1;
 
+#if 0
+    printf("f_table_lim[%d][%d]: ", 0, sbr->N_L[0]);
+    for (k = 0; k <= sbr->N_L[0]; k++)
+    {
+        printf("%d ", sbr->f_table_lim[0][k]);
+    }
+    printf("\n");
+#endif
+
     for (s = 1; s < 4; s++)
     {
         int32_t limTable[100 /*TODO*/] = {0};
@@ -551,13 +684,18 @@
             if (limTable[k-1] != 0)
 #if 0
                 nOctaves = REAL_CONST(log((float)limTable[k]/(float)limTable[k-1])/log(2.0));
+#else
+#ifdef FIXED_POINT
+                nOctaves = DIV_R((limTable[k]<<REAL_BITS),REAL_CONST(limTable[k-1]));
+#else
+                nOctaves = (real_t)limTable[k]/(real_t)limTable[k-1];
 #endif
-                nOctaves = (real_t)limTable[k]/(real_t)limTable[k-1];
+#endif
             else
                 nOctaves = 0;
 
 #if 0
-            if ((MUL(nOctaves,limBands)) < REAL_CONST(0.49))
+            if ((MUL_R(nOctaves,limBands)) < REAL_CONST(0.49))
 #else
             if (nOctaves < limiterBandsCompare[s - 1])
 #endif
--- a/Plugins/Input/aac/libfaad2/sbr_fbt.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_fbt.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_fbt.h,v 1.7 2003/11/12 20:47:58 menno Exp $
+** $Id: sbr_fbt.h,v 1.14 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_FBT_H__
@@ -32,15 +32,14 @@
 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 master_frequency_table_fs0(sbr_info *sbr, uint8_t k0, uint8_t k2,
+                                   uint8_t bs_alter_scale);
+uint8_t 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);
--- a/Plugins/Input/aac/libfaad2/sbr_hfadj.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_hfadj.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_hfadj.c,v 1.8 2003/11/12 20:47:58 menno Exp $
+** $Id: sbr_hfadj.c,v 1.18 2004/09/04 14:56:28 menno Exp $
 **/
 
 /* High Frequency adjustment */
@@ -37,61 +37,25 @@
 
 #include "sbr_noise.h"
 
+
+/* static function declarations */
+static void estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj,
+                                      qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch);
+static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch);
+#ifdef SBR_LOW_POWER
+static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch);
+static void aliasing_reduction(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch);
+#endif
+static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj, qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch);
+
+
 void hf_adjustment(sbr_info *sbr, qmf_t Xsbr[MAX_NTSRHFG][64]
 #ifdef SBR_LOW_POWER
                    ,real_t *deg /* aliasing degree */
 #endif
                    ,uint8_t ch)
 {
-    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;
+    ALIGN sbr_hfadj_info adj = {{{0}}};
 
     if (sbr->bs_frame_class[ch] == FIXFIX)
     {
@@ -108,82 +72,57 @@
             sbr->l_A[ch] = sbr->L_E[ch] + 1 - sbr->bs_pointer[ch];
     }
 
-    for (l = 0; l < 5; l++)
+    estimate_current_envelope(sbr, &adj, Xsbr, ch);
+
+    calculate_gain(sbr, &adj, ch);
+
+#ifdef SBR_LOW_POWER
+    calc_gain_groups(sbr, &adj, deg, ch);
+    aliasing_reduction(sbr, &adj, deg, ch);
+#endif
+
+    hf_assembly(sbr, &adj, Xsbr, ch);
+}
+
+static uint8_t get_S_mapped(sbr_info *sbr, uint8_t ch, uint8_t l, uint8_t current_band)
+{
+    if (sbr->f[ch][l] == HI_RES)
     {
-        for (i = 0; i < 64; i++)
+        /* in case of using f_table_high we just have 1 to 1 mapping
+         * from bs_add_harmonic[l][k]
+         */
+        if ((l >= sbr->l_A[ch]) ||
+            (sbr->bs_add_harmonic_prev[ch][current_band] && sbr->bs_add_harmonic_flag_prev[ch]))
         {
-            adj->S_index_mapped[i][l] = 0;
-            adj->S_mapped[i][l] = 0;
+            return sbr->bs_add_harmonic[ch][current_band];
         }
-    }
+    } else {
+        uint8_t b, lb, ub;
+
+        /* in case of f_table_low we check if any of the HI_RES bands
+         * within this LO_RES band has bs_add_harmonic[l][k] turned on
+         * (note that borders in the LO_RES table are also present in
+         * the HI_RES table)
+         */
 
-    for (l = 0; l < sbr->L_E[ch]; l++)
-    {
-        for (i = 0; i < sbr->N_high; i++)
+        /* find first HI_RES band in current LO_RES band */
+        lb = 2*current_band - ((sbr->N_high & 1) ? 1 : 0);
+        /* find first HI_RES band in next LO_RES band */
+        ub = 2*(current_band+1) - ((sbr->N_high & 1) ? 1 : 0);
+
+        /* check all HI_RES bands in current LO_RES band for sinusoid */
+        for (b = lb; b < ub; b++)
         {
-            for (m = sbr->f_table_res[HI_RES][i]; m < sbr->f_table_res[HI_RES][i+1]; m++)
+            if ((l >= sbr->l_A[ch]) ||
+                (sbr->bs_add_harmonic_prev[ch][b] && sbr->bs_add_harmonic_flag_prev[ch]))
             {
-                uint8_t delta_step = 0;
-                if ((l >= sbr->l_A[ch]) || ((sbr->bs_add_harmonic_prev[ch][i]) &&
-                    (sbr->bs_add_harmonic_flag_prev[ch])))
-                {
-                    delta_step = 1;
-                }
-
-                if (m == (int32_t)((real_t)(sbr->f_table_res[HI_RES][i+1]+sbr->f_table_res[HI_RES][i])/2.))
-                {
-                    adj->S_index_mapped[m - sbr->kx][l] =
-                        delta_step * sbr->bs_add_harmonic[ch][i];
-                } else {
-                    adj->S_index_mapped[m - sbr->kx][l] = 0;
-                }
+                if (sbr->bs_add_harmonic[ch][b] == 1)
+                    return 1;
             }
         }
     }
 
-    for (l = 0; l < sbr->L_E[ch]; l++)
-    {
-        for (i = 0; i < sbr->N_high; i++)
-        {
-            if (sbr->f[ch][l] == 1)
-            {
-                k1 = i;
-                k2 = i + 1;
-            } else {
-                for (k1 = 0; k1 < sbr->N_low; k1++)
-                {
-                    if ((sbr->f_table_res[HI_RES][i] >= sbr->f_table_res[LO_RES][k1]) &&
-                        (sbr->f_table_res[HI_RES][i+1] <= sbr->f_table_res[LO_RES][k1+1]))
-                    {
-                        break;
-                    }
-                }
-                for (k2 = 0; k2 < sbr->N_low; k2++)
-                {
-                    if ((sbr->f_table_res[HI_RES][i+1] >= sbr->f_table_res[LO_RES][k2]) &&
-                        (sbr->f_table_res[HI_RES][i+2] <= sbr->f_table_res[LO_RES][k2+1]))
-                    {
-                        break;
-                    }
-                }
-            }
-
-            l_i = sbr->f_table_res[sbr->f[ch][l]][k1];
-            u_i = sbr->f_table_res[sbr->f[ch][l]][k2];
-
-            delta_S = 0;
-            for (k = l_i; k < u_i; k++)
-            {
-                if (adj->S_index_mapped[k - sbr->kx][l] == 1)
-                    delta_S = 1;
-            }
-
-            for (m = l_i; m < u_i; m++)
-            {
-                adj->S_mapped[m - sbr->kx][l] = delta_S;
-            }
-        }
-    }
+    return 0;
 }
 
 static void estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj,
@@ -209,17 +148,30 @@
 
                 for (i = l_i + sbr->tHFAdj; i < u_i + sbr->tHFAdj; i++)
                 {
+#ifdef FIXED_POINT
+#ifdef SBR_LOW_POWER
+                    nrg += ((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS);
+#else
+                    nrg += ((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS) +
+                        ((QMF_IM(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_IM(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS);
+#endif
+#else
                     nrg += MUL_R(QMF_RE(Xsbr[i][m + sbr->kx]), QMF_RE(Xsbr[i][m + sbr->kx]))
 #ifndef SBR_LOW_POWER
                         + MUL_R(QMF_IM(Xsbr[i][m + sbr->kx]), QMF_IM(Xsbr[i][m + sbr->kx]))
 #endif
                         ;
+#endif
                 }
 
                 sbr->E_curr[ch][m][l] = nrg / div;
 #ifdef SBR_LOW_POWER
+#ifdef FIXED_POINT
+                sbr->E_curr[ch][m][l] <<= 1;
+#else
                 sbr->E_curr[ch][m][l] *= 2;
 #endif
+#endif
             }
         }
     } else {
@@ -233,7 +185,7 @@
                 for (k = k_l; k < k_h; k++)
                 {
                     uint8_t i, l_i, u_i;
-                    nrg = 0.0;
+                    nrg = 0;
 
                     l_i = sbr->t_E[ch][l];
                     u_i = sbr->t_E[ch][l+1];
@@ -244,51 +196,972 @@
                     {
                         for (j = k_l; j < k_h; j++)
                         {
+#ifdef FIXED_POINT
+#ifdef SBR_LOW_POWER
+                            nrg += ((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS);
+#else
+                            nrg += ((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS) +
+                                ((QMF_IM(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_IM(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS);
+#endif
+#else
                             nrg += MUL_R(QMF_RE(Xsbr[i][j]), QMF_RE(Xsbr[i][j]))
 #ifndef SBR_LOW_POWER
                                 + MUL_R(QMF_IM(Xsbr[i][j]), QMF_IM(Xsbr[i][j]))
 #endif
                                 ;
+#endif
                         }
                     }
 
                     sbr->E_curr[ch][k - sbr->kx][l] = nrg / div;
 #ifdef SBR_LOW_POWER
+#ifdef FIXED_POINT
+                    sbr->E_curr[ch][k - sbr->kx][l] <<= 1;
+#else
                     sbr->E_curr[ch][k - sbr->kx][l] *= 2;
 #endif
+#endif
                 }
             }
         }
     }
 }
 
+#ifdef FIXED_POINT
+#define EPS (1) /* smallest number available in fixed point */
+#else
 #define EPS (1e-12)
+#endif
+
+
+
+#ifdef FIXED_POINT
+
+/* log2 values of [0..63] */
+static const real_t log2_int_tab[] = {
+    LOG2_MIN_INF, REAL_CONST(0.000000000000000), REAL_CONST(1.000000000000000), REAL_CONST(1.584962500721156),
+    REAL_CONST(2.000000000000000), REAL_CONST(2.321928094887362), REAL_CONST(2.584962500721156), REAL_CONST(2.807354922057604),
+    REAL_CONST(3.000000000000000), REAL_CONST(3.169925001442313), REAL_CONST(3.321928094887363), REAL_CONST(3.459431618637297),
+    REAL_CONST(3.584962500721156), REAL_CONST(3.700439718141092), REAL_CONST(3.807354922057604), REAL_CONST(3.906890595608519),
+    REAL_CONST(4.000000000000000), REAL_CONST(4.087462841250339), REAL_CONST(4.169925001442312), REAL_CONST(4.247927513443585),
+    REAL_CONST(4.321928094887362), REAL_CONST(4.392317422778761), REAL_CONST(4.459431618637297), REAL_CONST(4.523561956057013),
+    REAL_CONST(4.584962500721156), REAL_CONST(4.643856189774724), REAL_CONST(4.700439718141093), REAL_CONST(4.754887502163468),
+    REAL_CONST(4.807354922057604), REAL_CONST(4.857980995127572), REAL_CONST(4.906890595608519), REAL_CONST(4.954196310386875),
+    REAL_CONST(5.000000000000000), REAL_CONST(5.044394119358453), REAL_CONST(5.087462841250340), REAL_CONST(5.129283016944966),
+    REAL_CONST(5.169925001442312), REAL_CONST(5.209453365628949), REAL_CONST(5.247927513443585), REAL_CONST(5.285402218862248),
+    REAL_CONST(5.321928094887363), REAL_CONST(5.357552004618084), REAL_CONST(5.392317422778761), REAL_CONST(5.426264754702098),
+    REAL_CONST(5.459431618637297), REAL_CONST(5.491853096329675), REAL_CONST(5.523561956057013), REAL_CONST(5.554588851677637),
+    REAL_CONST(5.584962500721156), REAL_CONST(5.614709844115208), REAL_CONST(5.643856189774724), REAL_CONST(5.672425341971495),
+    REAL_CONST(5.700439718141093), REAL_CONST(5.727920454563200), REAL_CONST(5.754887502163469), REAL_CONST(5.781359713524660),
+    REAL_CONST(5.807354922057605), REAL_CONST(5.832890014164742), REAL_CONST(5.857980995127572), REAL_CONST(5.882643049361842),
+    REAL_CONST(5.906890595608518), REAL_CONST(5.930737337562887), REAL_CONST(5.954196310386876), REAL_CONST(5.977279923499916)
+};
+
+static const real_t pan_log2_tab[] = {
+    REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362), REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339),
+    REAL_CONST(0.044394119358453), REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878), REAL_CONST(0.002815015607054),
+    REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247), REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122),
+    REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667)
+};
+
+static real_t find_log2_E(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
+{
+    /* check for coupled energy/noise data */
+    if (sbr->bs_coupling == 1)
+    {
+        uint8_t amp0 = (sbr->amp_res[0]) ? 0 : 1;
+        uint8_t amp1 = (sbr->amp_res[1]) ? 0 : 1;
+        real_t tmp = (7 << REAL_BITS) + (sbr->E[0][k][l] << (REAL_BITS-amp0));
+        real_t pan;
+
+        /* E[1] should always be even so shifting is OK */
+        uint8_t E = sbr->E[1][k][l] >> amp1;
+
+        if (ch == 0)
+        {
+            if (E > 12)
+            {
+                /* negative */
+                pan = pan_log2_tab[-12 + E];
+            } else {
+                /* positive */
+                pan = pan_log2_tab[12 - E] + ((12 - E)<<REAL_BITS);
+            }
+        } else {
+            if (E < 12)
+            {
+                /* negative */
+                pan = pan_log2_tab[-E + 12];
+            } else {
+                /* positive */
+                pan = pan_log2_tab[E - 12] + ((E - 12)<<REAL_BITS);
+            }
+        }
+
+        /* tmp / pan in log2 */
+        return tmp - pan;
+    } else {
+        uint8_t amp = (sbr->amp_res[ch]) ? 0 : 1;
+
+        return (6 << REAL_BITS) + (sbr->E[ch][k][l] << (REAL_BITS-amp));
+    }
+}
+
+static real_t find_log2_Q(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
+{
+    /* check for coupled energy/noise data */
+    if (sbr->bs_coupling == 1)
+    {
+        real_t tmp = (7 << REAL_BITS) - (sbr->Q[0][k][l] << REAL_BITS);
+        real_t pan;
+
+        uint8_t Q = sbr->Q[1][k][l];
+
+        if (ch == 0)
+        {
+            if (Q > 12)
+            {
+                /* negative */
+                pan = pan_log2_tab[-12 + Q];
+            } else {
+                /* positive */
+                pan = pan_log2_tab[12 - Q] + ((12 - Q)<<REAL_BITS);
+            }
+        } else {
+            if (Q < 12)
+            {
+                /* negative */
+                pan = pan_log2_tab[-Q + 12];
+            } else {
+                /* positive */
+                pan = pan_log2_tab[Q - 12] + ((Q - 12)<<REAL_BITS);
+            }
+        }
+
+        /* tmp / pan in log2 */
+        return tmp - pan;
+    } else {
+        return (6 << REAL_BITS) - (sbr->Q[ch][k][l] << REAL_BITS);
+    }
+}
+
+static const real_t log_Qplus1_pan[31][13] = {
+    { REAL_CONST(0.044383447617292), REAL_CONST(0.169768601655960), REAL_CONST(0.583090126514435), REAL_CONST(1.570089221000671), REAL_CONST(3.092446088790894), REAL_CONST(4.733354568481445), REAL_CONST(6.022367954254150), REAL_CONST(6.692092418670654), REAL_CONST(6.924463272094727), REAL_CONST(6.989034175872803), REAL_CONST(7.005646705627441), REAL_CONST(7.009829998016357), REAL_CONST(7.010877609252930) },
+    { REAL_CONST(0.022362394258380), REAL_CONST(0.087379962205887), REAL_CONST(0.320804953575134), REAL_CONST(0.988859415054321), REAL_CONST(2.252387046813965), REAL_CONST(3.786596298217773), REAL_CONST(5.044394016265869), REAL_CONST(5.705977916717529), REAL_CONST(5.936291694641113), REAL_CONST(6.000346660614014), REAL_CONST(6.016829967498779), REAL_CONST(6.020981311798096), REAL_CONST(6.022020816802979) },
+    { REAL_CONST(0.011224525049329), REAL_CONST(0.044351425021887), REAL_CONST(0.169301137328148), REAL_CONST(0.577544987201691), REAL_CONST(1.527246952056885), REAL_CONST(2.887525320053101), REAL_CONST(4.087462902069092), REAL_CONST(4.733354568481445), REAL_CONST(4.959661006927490), REAL_CONST(5.022709369659424), REAL_CONST(5.038940429687500), REAL_CONST(5.043028831481934), REAL_CONST(5.044052600860596) },
+    { REAL_CONST(0.005623178556561), REAL_CONST(0.022346137091517), REAL_CONST(0.087132595479488), REAL_CONST(0.317482173442841), REAL_CONST(0.956931233406067), REAL_CONST(2.070389270782471), REAL_CONST(3.169924974441528), REAL_CONST(3.786596298217773), REAL_CONST(4.005294322967529), REAL_CONST(4.066420555114746), REAL_CONST(4.082170009613037), REAL_CONST(4.086137294769287), REAL_CONST(4.087131500244141) },
+    { REAL_CONST(0.002814328996465), REAL_CONST(0.011216334067285), REAL_CONST(0.044224001467228), REAL_CONST(0.167456731200218), REAL_CONST(0.556393325328827), REAL_CONST(1.378511548042297), REAL_CONST(2.321928024291992), REAL_CONST(2.887525320053101), REAL_CONST(3.092446088790894), REAL_CONST(3.150059700012207), REAL_CONST(3.164926528930664), REAL_CONST(3.168673276901245), REAL_CONST(3.169611930847168) },
+    { REAL_CONST(0.001407850766554), REAL_CONST(0.005619067233056), REAL_CONST(0.022281449288130), REAL_CONST(0.086156636476517), REAL_CONST(0.304854571819305), REAL_CONST(0.847996890544891), REAL_CONST(1.584962487220764), REAL_CONST(2.070389270782471), REAL_CONST(2.252387046813965), REAL_CONST(2.304061651229858), REAL_CONST(2.317430257797241), REAL_CONST(2.320801734924316), REAL_CONST(2.321646213531494) },
+    { REAL_CONST(0.000704097095877), REAL_CONST(0.002812269143760), REAL_CONST(0.011183738708496), REAL_CONST(0.043721374124289), REAL_CONST(0.160464659333229), REAL_CONST(0.485426813364029), REAL_CONST(1.000000000000000), REAL_CONST(1.378511548042297), REAL_CONST(1.527246952056885), REAL_CONST(1.570089221000671), REAL_CONST(1.581215262413025), REAL_CONST(1.584023833274841), REAL_CONST(1.584727644920349) },
+    { REAL_CONST(0.000352177477907), REAL_CONST(0.001406819908880), REAL_CONST(0.005602621007711), REAL_CONST(0.022026389837265), REAL_CONST(0.082462236285210), REAL_CONST(0.263034462928772), REAL_CONST(0.584962487220764), REAL_CONST(0.847996890544891), REAL_CONST(0.956931233406067), REAL_CONST(0.988859415054321), REAL_CONST(0.997190535068512), REAL_CONST(0.999296069145203), REAL_CONST(0.999823868274689) },
+    { REAL_CONST(0.000176099492819), REAL_CONST(0.000703581434209), REAL_CONST(0.002804030198604), REAL_CONST(0.011055230163038), REAL_CONST(0.041820213198662), REAL_CONST(0.137503549456596), REAL_CONST(0.321928083896637), REAL_CONST(0.485426813364029), REAL_CONST(0.556393325328827), REAL_CONST(0.577544987201691), REAL_CONST(0.583090126514435), REAL_CONST(0.584493279457092), REAL_CONST(0.584845066070557) },
+    { REAL_CONST(0.000088052431238), REAL_CONST(0.000351833587047), REAL_CONST(0.001402696361765), REAL_CONST(0.005538204684854), REAL_CONST(0.021061634644866), REAL_CONST(0.070389263331890), REAL_CONST(0.169925004243851), REAL_CONST(0.263034462928772), REAL_CONST(0.304854571819305), REAL_CONST(0.317482173442841), REAL_CONST(0.320804953575134), REAL_CONST(0.321646571159363), REAL_CONST(0.321857661008835) },
+    { REAL_CONST(0.000044026888645), REAL_CONST(0.000175927518285), REAL_CONST(0.000701518612914), REAL_CONST(0.002771759871393), REAL_CONST(0.010569252073765), REAL_CONST(0.035623874515295), REAL_CONST(0.087462842464447), REAL_CONST(0.137503549456596), REAL_CONST(0.160464659333229), REAL_CONST(0.167456731200218), REAL_CONST(0.169301137328148), REAL_CONST(0.169768601655960), REAL_CONST(0.169885858893394) },
+    { REAL_CONST(0.000022013611670), REAL_CONST(0.000088052431238), REAL_CONST(0.000350801943569), REAL_CONST(0.001386545598507), REAL_CONST(0.005294219125062), REAL_CONST(0.017921976745129), REAL_CONST(0.044394120573997), REAL_CONST(0.070389263331890), REAL_CONST(0.082462236285210), REAL_CONST(0.086156636476517), REAL_CONST(0.087132595479488), REAL_CONST(0.087379962205887), REAL_CONST(0.087442122399807) },
+    { REAL_CONST(0.000011006847672), REAL_CONST(0.000044026888645), REAL_CONST(0.000175411638338), REAL_CONST(0.000693439331371), REAL_CONST(0.002649537986144), REAL_CONST(0.008988817222416), REAL_CONST(0.022367812693119), REAL_CONST(0.035623874515295), REAL_CONST(0.041820213198662), REAL_CONST(0.043721374124289), REAL_CONST(0.044224001467228), REAL_CONST(0.044351425021887), REAL_CONST(0.044383447617292) },
+    { REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000087708482170), REAL_CONST(0.000346675369656), REAL_CONST(0.001325377263129), REAL_CONST(0.004501323681325), REAL_CONST(0.011227255687118), REAL_CONST(0.017921976745129), REAL_CONST(0.021061634644866), REAL_CONST(0.022026389837265), REAL_CONST(0.022281449288130), REAL_CONST(0.022346137091517), REAL_CONST(0.022362394258380) },
+    { REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043854910473), REAL_CONST(0.000173348103999), REAL_CONST(0.000662840844598), REAL_CONST(0.002252417383716), REAL_CONST(0.005624548997730), REAL_CONST(0.008988817222416), REAL_CONST(0.010569252073765), REAL_CONST(0.011055230163038), REAL_CONST(0.011183738708496), REAL_CONST(0.011216334067285), REAL_CONST(0.011224525049329) },
+    { REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000086676649516), REAL_CONST(0.000331544462824), REAL_CONST(0.001126734190620), REAL_CONST(0.002815015614033), REAL_CONST(0.004501323681325), REAL_CONST(0.005294219125062), REAL_CONST(0.005538204684854), REAL_CONST(0.005602621007711), REAL_CONST(0.005619067233056), REAL_CONST(0.005623178556561) },
+    { REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043338975956), REAL_CONST(0.000165781748365), REAL_CONST(0.000563477107789), REAL_CONST(0.001408194424585), REAL_CONST(0.002252417383716), REAL_CONST(0.002649537986144), REAL_CONST(0.002771759871393), REAL_CONST(0.002804030198604), REAL_CONST(0.002812269143760), REAL_CONST(0.002814328996465) },
+    { REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000021669651687), REAL_CONST(0.000082893253420), REAL_CONST(0.000281680084299), REAL_CONST(0.000704268983100), REAL_CONST(0.001126734190620), REAL_CONST(0.001325377263129), REAL_CONST(0.001386545598507), REAL_CONST(0.001402696361765), REAL_CONST(0.001406819908880), REAL_CONST(0.001407850766554) },
+    { REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010834866771), REAL_CONST(0.000041447223339), REAL_CONST(0.000140846910654), REAL_CONST(0.000352177477907), REAL_CONST(0.000563477107789), REAL_CONST(0.000662840844598), REAL_CONST(0.000693439331371), REAL_CONST(0.000701518612914), REAL_CONST(0.000703581434209), REAL_CONST(0.000704097095877) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000020637769921), REAL_CONST(0.000070511166996), REAL_CONST(0.000176099492819), REAL_CONST(0.000281680084299), REAL_CONST(0.000331544462824), REAL_CONST(0.000346675369656), REAL_CONST(0.000350801943569), REAL_CONST(0.000351833587047), REAL_CONST(0.000352177477907) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010318922250), REAL_CONST(0.000035256012779), REAL_CONST(0.000088052431238), REAL_CONST(0.000140846910654), REAL_CONST(0.000165781748365), REAL_CONST(0.000173348103999), REAL_CONST(0.000175411638338), REAL_CONST(0.000175927518285), REAL_CONST(0.000176099492819) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005159470220), REAL_CONST(0.000017542124624), REAL_CONST(0.000044026888645), REAL_CONST(0.000070511166996), REAL_CONST(0.000082893253420), REAL_CONST(0.000086676649516), REAL_CONST(0.000087708482170), REAL_CONST(0.000088052431238), REAL_CONST(0.000088052431238) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002579737384), REAL_CONST(0.000008771088687), REAL_CONST(0.000022013611670), REAL_CONST(0.000035256012779), REAL_CONST(0.000041447223339), REAL_CONST(0.000043338975956), REAL_CONST(0.000043854910473), REAL_CONST(0.000044026888645), REAL_CONST(0.000044026888645) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000004471542070), REAL_CONST(0.000011006847672), REAL_CONST(0.000017542124624), REAL_CONST(0.000020637769921), REAL_CONST(0.000021669651687), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002235772627), REAL_CONST(0.000005503434295), REAL_CONST(0.000008771088687), REAL_CONST(0.000010318922250), REAL_CONST(0.000010834866771), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001031895522), REAL_CONST(0.000002751719876), REAL_CONST(0.000004471542070), REAL_CONST(0.000005159470220), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000515947875), REAL_CONST(0.000001375860506), REAL_CONST(0.000002235772627), REAL_CONST(0.000002579737384), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000000687930424), REAL_CONST(0.000001031895522), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000515947875), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634) }
+};
+
+static const real_t log_Qplus1[31] = {
+    REAL_CONST(6.022367813028454), REAL_CONST(5.044394119358453), REAL_CONST(4.087462841250339), 
+    REAL_CONST(3.169925001442313), REAL_CONST(2.321928094887362), REAL_CONST(1.584962500721156), 
+    REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362), 
+    REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339), REAL_CONST(0.044394119358453), 
+    REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878), 
+    REAL_CONST(0.002815015607054), REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247), 
+    REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122), 
+    REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667), 
+    REAL_CONST(0.000005503434331), REAL_CONST(0.000002751719790), REAL_CONST(0.000001375860551), 
+    REAL_CONST(0.000000687930439), REAL_CONST(0.000000343965261), REAL_CONST(0.000000171982641), 
+    REAL_CONST(0.000000000000000)
+};
+
+static real_t find_log2_Qplus1(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
+{
+    /* check for coupled energy/noise data */
+    if (sbr->bs_coupling == 1)
+    {
+        if ((sbr->Q[0][k][l] >= 0) && (sbr->Q[0][k][l] <= 30) &&
+            (sbr->Q[1][k][l] >= 0) && (sbr->Q[1][k][l] <= 24))
+        {
+            if (ch == 0)
+            {
+                return log_Qplus1_pan[sbr->Q[0][k][l]][sbr->Q[1][k][l] >> 1];
+            } else {
+                return log_Qplus1_pan[sbr->Q[0][k][l]][12 - (sbr->Q[1][k][l] >> 1)];
+            }
+        } else {
+            return 0;
+        }
+    } else {
+        if (sbr->Q[ch][k][l] >= 0 && sbr->Q[ch][k][l] <= 30)
+        {
+            return log_Qplus1[sbr->Q[ch][k][l]];
+        } else {
+            return 0;
+        }
+    }
+}
+
+static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
+{
+    /* log2 values of limiter gains */
+    static real_t limGain[] = {
+        REAL_CONST(-1.0), REAL_CONST(0.0), REAL_CONST(1.0), REAL_CONST(33.219)
+    };
+    uint8_t m, l, k;
+
+    uint8_t current_t_noise_band = 0;
+    uint8_t S_mapped;
+
+    ALIGN real_t Q_M_lim[MAX_M];
+    ALIGN real_t G_lim[MAX_M];
+    ALIGN real_t G_boost;
+    ALIGN real_t S_M[MAX_M];
+
+
+    for (l = 0; l < sbr->L_E[ch]; l++)
+    {
+        uint8_t current_f_noise_band = 0;
+        uint8_t current_res_band = 0;
+        uint8_t current_res_band2 = 0;
+        uint8_t current_hi_res_band = 0;
+
+        real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1;
+
+        S_mapped = get_S_mapped(sbr, ch, l, current_res_band2);
+
+        if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1])
+        {
+            current_t_noise_band++;
+        }
+
+        for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++)
+        {
+            real_t Q_M = 0;
+            real_t G_max;
+            real_t den = 0;
+            real_t acc1 = 0;
+            real_t acc2 = 0;
+            uint8_t current_res_band_size = 0;
+            uint8_t Q_M_size = 0;
+
+            uint8_t ml1, ml2;
+
+            /* bounds of current limiter bands */
+            ml1 = sbr->f_table_lim[sbr->bs_limiter_bands][k];
+            ml2 = sbr->f_table_lim[sbr->bs_limiter_bands][k+1];
+
+
+            /* calculate the accumulated E_orig and E_curr over the limiter band */
+            for (m = ml1; m < ml2; m++)
+            {
+                if ((m + sbr->kx) < sbr->f_table_res[sbr->f[ch][l]][current_res_band+1])
+                {
+                    current_res_band_size++;
+                } else {
+                    acc1 += pow2_int(-REAL_CONST(10) + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch));
+
+                    current_res_band++;
+                    current_res_band_size = 1;
+                }
+
+                acc2 += sbr->E_curr[ch][m][l];
+            }
+            acc1 += pow2_int(-REAL_CONST(10) + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch));
+
+
+            if (acc1 == 0)
+                acc1 = LOG2_MIN_INF;
+            else
+                acc1 = log2_int(acc1);
+
+
+            /* calculate the maximum gain */
+            /* ratio of the energy of the original signal and the energy
+             * of the HF generated signal
+             */
+            G_max = acc1 - log2_int(acc2) + limGain[sbr->bs_limiter_gains];
+            G_max = min(G_max, limGain[3]);
+
+
+            for (m = ml1; m < ml2; m++)
+            {
+                real_t G;
+                real_t E_curr, E_orig;
+                real_t Q_orig, Q_orig_plus1;
+                uint8_t S_index_mapped;
+
+
+                /* check if m is on a noise band border */
+                if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1])
+                {
+                    /* step to next noise band */
+                    current_f_noise_band++;
+                }
+
+
+                /* check if m is on a resolution band border */
+                if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1])
+                {
+                    /* accumulate a whole range of equal Q_Ms */
+                    if (Q_M_size > 0)
+                        den += pow2_int(log2_int_tab[Q_M_size] + Q_M);
+                    Q_M_size = 0;
+
+                    /* step to next resolution band */
+                    current_res_band2++;
+
+                    /* if we move to a new resolution band, we should check if we are
+                     * going to add a sinusoid in this band
+                     */
+                    S_mapped = get_S_mapped(sbr, ch, l, current_res_band2);
+                }
+
+
+                /* check if m is on a HI_RES band border */
+                if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1])
+                {
+                    /* step to next HI_RES band */
+                    current_hi_res_band++;
+                }
+
+
+                /* find S_index_mapped
+                 * S_index_mapped can only be 1 for the m in the middle of the
+                 * current HI_RES band
+                 */
+                S_index_mapped = 0;
+                if ((l >= sbr->l_A[ch]) ||
+                    (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch]))
+                {
+                    /* find the middle subband of the HI_RES frequency band */
+                    if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1)
+                        S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band];
+                }
+
+
+                /* find bitstream parameters */
+                if (sbr->E_curr[ch][m][l] == 0)
+                    E_curr = LOG2_MIN_INF;
+                else
+                    E_curr = log2_int(sbr->E_curr[ch][m][l]);
+                E_orig = -REAL_CONST(10) + find_log2_E(sbr, current_res_band2, l, ch);
+
+
+                Q_orig = find_log2_Q(sbr, current_f_noise_band, current_t_noise_band, ch);
+                Q_orig_plus1 = find_log2_Qplus1(sbr, current_f_noise_band, current_t_noise_band, ch);
+
+
+                /* Q_M only depends on E_orig and Q_div2:
+                 * since N_Q <= N_Low <= N_High we only need to recalculate Q_M on
+                 * a change of current res band (HI or LO)
+                 */
+                Q_M = E_orig + Q_orig - Q_orig_plus1;
+
+
+                /* S_M only depends on E_orig, Q_div and S_index_mapped:
+                 * S_index_mapped can only be non-zero once per HI_RES band
+                 */
+                if (S_index_mapped == 0)
+                {
+                    S_M[m] = LOG2_MIN_INF; /* -inf */
+                } else {
+                    S_M[m] = E_orig - Q_orig_plus1;
+
+                    /* accumulate sinusoid part of the total energy */
+                    den += pow2_int(S_M[m]);
+                }
+
+
+                /* calculate gain */
+                /* ratio of the energy of the original signal and the energy
+                 * of the HF generated signal
+                 */
+                /* E_curr here is officially E_curr+1 so the log2() of that can never be < 0 */
+                /* scaled by -10 */
+                G = E_orig - max(-REAL_CONST(10), E_curr);
+                if ((S_mapped == 0) && (delta == 1))
+                {
+                    /* G = G * 1/(1+Q) */
+                    G -= Q_orig_plus1;
+                } else if (S_mapped == 1) {
+                    /* G = G * Q/(1+Q) */
+                    G += Q_orig - Q_orig_plus1;
+                }
+
+
+                /* limit the additional noise energy level */
+                /* and apply the limiter */
+                if (G_max > G)
+                {
+                    Q_M_lim[m] = Q_M;
+                    G_lim[m] = G;
+
+                    if ((S_index_mapped == 0) && (l != sbr->l_A[ch]))
+                    {
+                        Q_M_size++;
+                    }
+                } else {
+                    /* G > G_max */
+                    Q_M_lim[m] = Q_M + G_max - G;
+                    G_lim[m] = G_max;
+
+                    /* accumulate limited Q_M */
+                    if ((S_index_mapped == 0) && (l != sbr->l_A[ch]))
+                    {
+                        den += pow2_int(Q_M_lim[m]);
+                    }
+                }
+
+
+                /* accumulate the total energy */
+                /* E_curr changes for every m so we do need to accumulate every m */
+                den += pow2_int(E_curr + G_lim[m]);
+            }
+
+            /* accumulate last range of equal Q_Ms */
+            if (Q_M_size > 0)
+            {
+                den += pow2_int(log2_int_tab[Q_M_size] + Q_M);
+            }
+
+
+            /* calculate the final gain */
+            /* G_boost: [0..2.51188643] */
+            G_boost = acc1 - log2_int(den /*+ EPS*/);
+            G_boost = min(G_boost, REAL_CONST(1.328771237) /* log2(1.584893192 ^ 2) */);
+
+
+            for (m = ml1; m < ml2; m++)
+            {
+                /* apply compensation to gain, noise floor sf's and sinusoid levels */
+#ifndef SBR_LOW_POWER
+                adj->G_lim_boost[l][m] = pow2_fix((G_lim[m] + G_boost) >> 1);
+#else
+                /* sqrt() will be done after the aliasing reduction to save a
+                 * few multiplies
+                 */
+                adj->G_lim_boost[l][m] = pow2_fix(G_lim[m] + G_boost);
+#endif
+                adj->Q_M_lim_boost[l][m] = pow2_fix((Q_M_lim[m] + G_boost) >> 1);
+
+                if (S_M[m] != LOG2_MIN_INF)
+                {
+                    adj->S_M_boost[l][m] = pow2_int((S_M[m] + G_boost) >> 1);
+                } else {
+                    adj->S_M_boost[l][m] = 0;
+                }
+            }
+        }
+    }
+}
+
+#else
+
+//#define LOG2_TEST
+
+#ifdef LOG2_TEST
 
-#define ONE (1)
+#define LOG2_MIN_INF -100000
+
+__inline float pow2(float val)
+{
+    return pow(2.0, val);
+}
+__inline float log2(float val)
+{
+    return log(val)/log(2.0);
+}
+
+#define RB 14
+
+float QUANTISE2REAL(float val)
+{
+    __int32 ival = (__int32)(val * (1<<RB));
+    return (float)ival / (float)((1<<RB));
+}
+
+float QUANTISE2INT(float val)
+{
+    return floor(val);
+}
+
+/* log2 values of [0..63] */
+static const real_t log2_int_tab[] = {
+    LOG2_MIN_INF,      0.000000000000000, 1.000000000000000, 1.584962500721156,
+    2.000000000000000, 2.321928094887362, 2.584962500721156, 2.807354922057604,
+    3.000000000000000, 3.169925001442313, 3.321928094887363, 3.459431618637297,
+    3.584962500721156, 3.700439718141092, 3.807354922057604, 3.906890595608519,
+    4.000000000000000, 4.087462841250339, 4.169925001442312, 4.247927513443585,
+    4.321928094887362, 4.392317422778761, 4.459431618637297, 4.523561956057013,
+    4.584962500721156, 4.643856189774724, 4.700439718141093, 4.754887502163468,
+    4.807354922057604, 4.857980995127572, 4.906890595608519, 4.954196310386875,
+    5.000000000000000, 5.044394119358453, 5.087462841250340, 5.129283016944966,
+    5.169925001442312, 5.209453365628949, 5.247927513443585, 5.285402218862248,
+    5.321928094887363, 5.357552004618084, 5.392317422778761, 5.426264754702098,
+    5.459431618637297, 5.491853096329675, 5.523561956057013, 5.554588851677637,
+    5.584962500721156, 5.614709844115208, 5.643856189774724, 5.672425341971495,
+    5.700439718141093, 5.727920454563200, 5.754887502163469, 5.781359713524660,
+    5.807354922057605, 5.832890014164742, 5.857980995127572, 5.882643049361842,
+    5.906890595608518, 5.930737337562887, 5.954196310386876, 5.977279923499916
+};
+
+static const real_t pan_log2_tab[] = {
+    1.000000000000000, 0.584962500721156, 0.321928094887362, 0.169925001442312, 0.087462841250339,
+    0.044394119358453, 0.022367813028455, 0.011227255423254, 0.005624549193878, 0.002815015607054,
+    0.001408194392808, 0.000704269011247, 0.000352177480301, 0.000176099486443, 0.000088052430122,
+    0.000044026886827, 0.000022013611360, 0.000011006847667
+};
+
+static real_t find_log2_E(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
+{
+    /* check for coupled energy/noise data */
+    if (sbr->bs_coupling == 1)
+    {
+        real_t amp0 = (sbr->amp_res[0]) ? 1.0 : 0.5;
+        real_t amp1 = (sbr->amp_res[1]) ? 1.0 : 0.5;
+        float tmp = QUANTISE2REAL(7.0 + (real_t)sbr->E[0][k][l] * amp0);
+        float pan;
+
+        int E = (int)(sbr->E[1][k][l] * amp1);
+
+        if (ch == 0)
+        {
+            if (E > 12)
+            {
+                /* negative */
+                pan = QUANTISE2REAL(pan_log2_tab[-12 + E]);
+            } else {
+                /* positive */
+                pan = QUANTISE2REAL(pan_log2_tab[12 - E] + (12 - E));
+            }
+        } else {
+            if (E < 12)
+            {
+                /* negative */
+                pan = QUANTISE2REAL(pan_log2_tab[-E + 12]);
+            } else {
+                /* positive */
+                pan = QUANTISE2REAL(pan_log2_tab[E - 12] + (E - 12));
+            }
+        }
+
+        /* tmp / pan in log2 */
+        return QUANTISE2REAL(tmp - pan);
+    } else {
+        real_t amp = (sbr->amp_res[ch]) ? 1.0 : 0.5;
+
+        return QUANTISE2REAL(6.0 + (real_t)sbr->E[ch][k][l] * amp);
+    }
+}
+
+static real_t find_log2_Q(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
+{
+    /* check for coupled energy/noise data */
+    if (sbr->bs_coupling == 1)
+    {
+        float tmp = QUANTISE2REAL(7.0 - (real_t)sbr->Q[0][k][l]);
+        float pan;
+
+        int Q = (int)(sbr->Q[1][k][l]);
+
+        if (ch == 0)
+        {
+            if (Q > 12)
+            {
+                /* negative */
+                pan = QUANTISE2REAL(pan_log2_tab[-12 + Q]);
+            } else {
+                /* positive */
+                pan = QUANTISE2REAL(pan_log2_tab[12 - Q] + (12 - Q));
+            }
+        } else {
+            if (Q < 12)
+            {
+                /* negative */
+                pan = QUANTISE2REAL(pan_log2_tab[-Q + 12]);
+            } else {
+                /* positive */
+                pan = QUANTISE2REAL(pan_log2_tab[Q - 12] + (Q - 12));
+            }
+        }
+
+        /* tmp / pan in log2 */
+        return QUANTISE2REAL(tmp - pan);
+    } else {
+        return QUANTISE2REAL(6.0 - (real_t)sbr->Q[ch][k][l]);
+    }
+}
+
+static const real_t log_Qplus1_pan[31][13] = {
+    { REAL_CONST(0.044383447617292), REAL_CONST(0.169768601655960), REAL_CONST(0.583090126514435), REAL_CONST(1.570089221000671), REAL_CONST(3.092446088790894), REAL_CONST(4.733354568481445), REAL_CONST(6.022367954254150), REAL_CONST(6.692092418670654), REAL_CONST(6.924463272094727), REAL_CONST(6.989034175872803), REAL_CONST(7.005646705627441), REAL_CONST(7.009829998016357), REAL_CONST(7.010877609252930) },
+    { REAL_CONST(0.022362394258380), REAL_CONST(0.087379962205887), REAL_CONST(0.320804953575134), REAL_CONST(0.988859415054321), REAL_CONST(2.252387046813965), REAL_CONST(3.786596298217773), REAL_CONST(5.044394016265869), REAL_CONST(5.705977916717529), REAL_CONST(5.936291694641113), REAL_CONST(6.000346660614014), REAL_CONST(6.016829967498779), REAL_CONST(6.020981311798096), REAL_CONST(6.022020816802979) },
+    { REAL_CONST(0.011224525049329), REAL_CONST(0.044351425021887), REAL_CONST(0.169301137328148), REAL_CONST(0.577544987201691), REAL_CONST(1.527246952056885), REAL_CONST(2.887525320053101), REAL_CONST(4.087462902069092), REAL_CONST(4.733354568481445), REAL_CONST(4.959661006927490), REAL_CONST(5.022709369659424), REAL_CONST(5.038940429687500), REAL_CONST(5.043028831481934), REAL_CONST(5.044052600860596) },
+    { REAL_CONST(0.005623178556561), REAL_CONST(0.022346137091517), REAL_CONST(0.087132595479488), REAL_CONST(0.317482173442841), REAL_CONST(0.956931233406067), REAL_CONST(2.070389270782471), REAL_CONST(3.169924974441528), REAL_CONST(3.786596298217773), REAL_CONST(4.005294322967529), REAL_CONST(4.066420555114746), REAL_CONST(4.082170009613037), REAL_CONST(4.086137294769287), REAL_CONST(4.087131500244141) },
+    { REAL_CONST(0.002814328996465), REAL_CONST(0.011216334067285), REAL_CONST(0.044224001467228), REAL_CONST(0.167456731200218), REAL_CONST(0.556393325328827), REAL_CONST(1.378511548042297), REAL_CONST(2.321928024291992), REAL_CONST(2.887525320053101), REAL_CONST(3.092446088790894), REAL_CONST(3.150059700012207), REAL_CONST(3.164926528930664), REAL_CONST(3.168673276901245), REAL_CONST(3.169611930847168) },
+    { REAL_CONST(0.001407850766554), REAL_CONST(0.005619067233056), REAL_CONST(0.022281449288130), REAL_CONST(0.086156636476517), REAL_CONST(0.304854571819305), REAL_CONST(0.847996890544891), REAL_CONST(1.584962487220764), REAL_CONST(2.070389270782471), REAL_CONST(2.252387046813965), REAL_CONST(2.304061651229858), REAL_CONST(2.317430257797241), REAL_CONST(2.320801734924316), REAL_CONST(2.321646213531494) },
+    { REAL_CONST(0.000704097095877), REAL_CONST(0.002812269143760), REAL_CONST(0.011183738708496), REAL_CONST(0.043721374124289), REAL_CONST(0.160464659333229), REAL_CONST(0.485426813364029), REAL_CONST(1.000000000000000), REAL_CONST(1.378511548042297), REAL_CONST(1.527246952056885), REAL_CONST(1.570089221000671), REAL_CONST(1.581215262413025), REAL_CONST(1.584023833274841), REAL_CONST(1.584727644920349) },
+    { REAL_CONST(0.000352177477907), REAL_CONST(0.001406819908880), REAL_CONST(0.005602621007711), REAL_CONST(0.022026389837265), REAL_CONST(0.082462236285210), REAL_CONST(0.263034462928772), REAL_CONST(0.584962487220764), REAL_CONST(0.847996890544891), REAL_CONST(0.956931233406067), REAL_CONST(0.988859415054321), REAL_CONST(0.997190535068512), REAL_CONST(0.999296069145203), REAL_CONST(0.999823868274689) },
+    { REAL_CONST(0.000176099492819), REAL_CONST(0.000703581434209), REAL_CONST(0.002804030198604), REAL_CONST(0.011055230163038), REAL_CONST(0.041820213198662), REAL_CONST(0.137503549456596), REAL_CONST(0.321928083896637), REAL_CONST(0.485426813364029), REAL_CONST(0.556393325328827), REAL_CONST(0.577544987201691), REAL_CONST(0.583090126514435), REAL_CONST(0.584493279457092), REAL_CONST(0.584845066070557) },
+    { REAL_CONST(0.000088052431238), REAL_CONST(0.000351833587047), REAL_CONST(0.001402696361765), REAL_CONST(0.005538204684854), REAL_CONST(0.021061634644866), REAL_CONST(0.070389263331890), REAL_CONST(0.169925004243851), REAL_CONST(0.263034462928772), REAL_CONST(0.304854571819305), REAL_CONST(0.317482173442841), REAL_CONST(0.320804953575134), REAL_CONST(0.321646571159363), REAL_CONST(0.321857661008835) },
+    { REAL_CONST(0.000044026888645), REAL_CONST(0.000175927518285), REAL_CONST(0.000701518612914), REAL_CONST(0.002771759871393), REAL_CONST(0.010569252073765), REAL_CONST(0.035623874515295), REAL_CONST(0.087462842464447), REAL_CONST(0.137503549456596), REAL_CONST(0.160464659333229), REAL_CONST(0.167456731200218), REAL_CONST(0.169301137328148), REAL_CONST(0.169768601655960), REAL_CONST(0.169885858893394) },
+    { REAL_CONST(0.000022013611670), REAL_CONST(0.000088052431238), REAL_CONST(0.000350801943569), REAL_CONST(0.001386545598507), REAL_CONST(0.005294219125062), REAL_CONST(0.017921976745129), REAL_CONST(0.044394120573997), REAL_CONST(0.070389263331890), REAL_CONST(0.082462236285210), REAL_CONST(0.086156636476517), REAL_CONST(0.087132595479488), REAL_CONST(0.087379962205887), REAL_CONST(0.087442122399807) },
+    { REAL_CONST(0.000011006847672), REAL_CONST(0.000044026888645), REAL_CONST(0.000175411638338), REAL_CONST(0.000693439331371), REAL_CONST(0.002649537986144), REAL_CONST(0.008988817222416), REAL_CONST(0.022367812693119), REAL_CONST(0.035623874515295), REAL_CONST(0.041820213198662), REAL_CONST(0.043721374124289), REAL_CONST(0.044224001467228), REAL_CONST(0.044351425021887), REAL_CONST(0.044383447617292) },
+    { REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000087708482170), REAL_CONST(0.000346675369656), REAL_CONST(0.001325377263129), REAL_CONST(0.004501323681325), REAL_CONST(0.011227255687118), REAL_CONST(0.017921976745129), REAL_CONST(0.021061634644866), REAL_CONST(0.022026389837265), REAL_CONST(0.022281449288130), REAL_CONST(0.022346137091517), REAL_CONST(0.022362394258380) },
+    { REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043854910473), REAL_CONST(0.000173348103999), REAL_CONST(0.000662840844598), REAL_CONST(0.002252417383716), REAL_CONST(0.005624548997730), REAL_CONST(0.008988817222416), REAL_CONST(0.010569252073765), REAL_CONST(0.011055230163038), REAL_CONST(0.011183738708496), REAL_CONST(0.011216334067285), REAL_CONST(0.011224525049329) },
+    { REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000086676649516), REAL_CONST(0.000331544462824), REAL_CONST(0.001126734190620), REAL_CONST(0.002815015614033), REAL_CONST(0.004501323681325), REAL_CONST(0.005294219125062), REAL_CONST(0.005538204684854), REAL_CONST(0.005602621007711), REAL_CONST(0.005619067233056), REAL_CONST(0.005623178556561) },
+    { REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043338975956), REAL_CONST(0.000165781748365), REAL_CONST(0.000563477107789), REAL_CONST(0.001408194424585), REAL_CONST(0.002252417383716), REAL_CONST(0.002649537986144), REAL_CONST(0.002771759871393), REAL_CONST(0.002804030198604), REAL_CONST(0.002812269143760), REAL_CONST(0.002814328996465) },
+    { REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000021669651687), REAL_CONST(0.000082893253420), REAL_CONST(0.000281680084299), REAL_CONST(0.000704268983100), REAL_CONST(0.001126734190620), REAL_CONST(0.001325377263129), REAL_CONST(0.001386545598507), REAL_CONST(0.001402696361765), REAL_CONST(0.001406819908880), REAL_CONST(0.001407850766554) },
+    { REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010834866771), REAL_CONST(0.000041447223339), REAL_CONST(0.000140846910654), REAL_CONST(0.000352177477907), REAL_CONST(0.000563477107789), REAL_CONST(0.000662840844598), REAL_CONST(0.000693439331371), REAL_CONST(0.000701518612914), REAL_CONST(0.000703581434209), REAL_CONST(0.000704097095877) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000020637769921), REAL_CONST(0.000070511166996), REAL_CONST(0.000176099492819), REAL_CONST(0.000281680084299), REAL_CONST(0.000331544462824), REAL_CONST(0.000346675369656), REAL_CONST(0.000350801943569), REAL_CONST(0.000351833587047), REAL_CONST(0.000352177477907) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010318922250), REAL_CONST(0.000035256012779), REAL_CONST(0.000088052431238), REAL_CONST(0.000140846910654), REAL_CONST(0.000165781748365), REAL_CONST(0.000173348103999), REAL_CONST(0.000175411638338), REAL_CONST(0.000175927518285), REAL_CONST(0.000176099492819) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005159470220), REAL_CONST(0.000017542124624), REAL_CONST(0.000044026888645), REAL_CONST(0.000070511166996), REAL_CONST(0.000082893253420), REAL_CONST(0.000086676649516), REAL_CONST(0.000087708482170), REAL_CONST(0.000088052431238), REAL_CONST(0.000088052431238) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002579737384), REAL_CONST(0.000008771088687), REAL_CONST(0.000022013611670), REAL_CONST(0.000035256012779), REAL_CONST(0.000041447223339), REAL_CONST(0.000043338975956), REAL_CONST(0.000043854910473), REAL_CONST(0.000044026888645), REAL_CONST(0.000044026888645) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000004471542070), REAL_CONST(0.000011006847672), REAL_CONST(0.000017542124624), REAL_CONST(0.000020637769921), REAL_CONST(0.000021669651687), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002235772627), REAL_CONST(0.000005503434295), REAL_CONST(0.000008771088687), REAL_CONST(0.000010318922250), REAL_CONST(0.000010834866771), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001031895522), REAL_CONST(0.000002751719876), REAL_CONST(0.000004471542070), REAL_CONST(0.000005159470220), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000515947875), REAL_CONST(0.000001375860506), REAL_CONST(0.000002235772627), REAL_CONST(0.000002579737384), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000000687930424), REAL_CONST(0.000001031895522), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000515947875), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269) },
+    { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634) }
+};
+
+static const real_t log_Qplus1[31] = {
+    REAL_CONST(6.022367813028454), REAL_CONST(5.044394119358453), REAL_CONST(4.087462841250339), 
+    REAL_CONST(3.169925001442313), REAL_CONST(2.321928094887362), REAL_CONST(1.584962500721156), 
+    REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362), 
+    REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339), REAL_CONST(0.044394119358453), 
+    REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878), 
+    REAL_CONST(0.002815015607054), REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247), 
+    REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122), 
+    REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667), 
+    REAL_CONST(0.000005503434331), REAL_CONST(0.000002751719790), REAL_CONST(0.000001375860551), 
+    REAL_CONST(0.000000687930439), REAL_CONST(0.000000343965261), REAL_CONST(0.000000171982641), 
+    REAL_CONST(0.000000000000000)
+};
+
+static real_t find_log2_Qplus1(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
+{
+    /* check for coupled energy/noise data */
+    if (sbr->bs_coupling == 1)
+    {
+        if ((sbr->Q[0][k][l] >= 0) && (sbr->Q[0][k][l] <= 30) &&
+            (sbr->Q[1][k][l] >= 0) && (sbr->Q[1][k][l] <= 24))
+        {
+            if (ch == 0)
+            {
+                return QUANTISE2REAL(log_Qplus1_pan[sbr->Q[0][k][l]][sbr->Q[1][k][l] >> 1]);
+            } else {
+                return QUANTISE2REAL(log_Qplus1_pan[sbr->Q[0][k][l]][12 - (sbr->Q[1][k][l] >> 1)]);
+            }
+        } else {
+            return 0;
+        }
+    } else {
+        if (sbr->Q[ch][k][l] >= 0 && sbr->Q[ch][k][l] <= 30)
+        {
+            return QUANTISE2REAL(log_Qplus1[sbr->Q[ch][k][l]]);
+        } else {
+            return 0;
+        }
+    }
+}
+
+static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
+{
+    /* log2 values of limiter gains */
+    static real_t limGain[] = { -1.0, 0.0, 1.0, 33.219 };
+    uint8_t m, l, k;
+
+    uint8_t current_t_noise_band = 0;
+    uint8_t S_mapped;
+
+    ALIGN real_t Q_M_lim[MAX_M];
+    ALIGN real_t G_lim[MAX_M];
+    ALIGN real_t G_boost;
+    ALIGN real_t S_M[MAX_M];
+
 
+    for (l = 0; l < sbr->L_E[ch]; l++)
+    {
+        uint8_t current_f_noise_band = 0;
+        uint8_t current_res_band = 0;
+        uint8_t current_res_band2 = 0;
+        uint8_t current_hi_res_band = 0;
+
+        real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1;
+
+        S_mapped = get_S_mapped(sbr, ch, l, current_res_band2);
+
+        if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1])
+        {
+            current_t_noise_band++;
+        }
+
+        for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++)
+        {
+            real_t Q_M = 0;
+            real_t G_max;
+            real_t den = 0;
+            real_t acc1 = 0;
+            real_t acc2 = 0;
+            uint8_t current_res_band_size = 0;
+            uint8_t Q_M_size = 0;
+
+            uint8_t ml1, ml2;
+
+            /* bounds of current limiter bands */
+            ml1 = sbr->f_table_lim[sbr->bs_limiter_bands][k];
+            ml2 = sbr->f_table_lim[sbr->bs_limiter_bands][k+1];
+
+
+            /* calculate the accumulated E_orig and E_curr over the limiter band */
+            for (m = ml1; m < ml2; m++)
+            {
+                if ((m + sbr->kx) < sbr->f_table_res[sbr->f[ch][l]][current_res_band+1])
+                {
+                    current_res_band_size++;
+                } else {
+                    acc1 += QUANTISE2INT(pow2(-10 + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch)));
+
+                    current_res_band++;
+                    current_res_band_size = 1;
+                }
+
+                acc2 += QUANTISE2INT(sbr->E_curr[ch][m][l]/1024.0);
+            }
+            acc1 += QUANTISE2INT(pow2(-10 + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch)));
+
+            acc1 = QUANTISE2REAL( log2(EPS + acc1) );
+
+
+            /* calculate the maximum gain */
+            /* ratio of the energy of the original signal and the energy
+             * of the HF generated signal
+             */
+            G_max = acc1 - QUANTISE2REAL(log2(EPS + acc2)) + QUANTISE2REAL(limGain[sbr->bs_limiter_gains]);
+            G_max = min(G_max, QUANTISE2REAL(limGain[3]));
+
+
+            for (m = ml1; m < ml2; m++)
+            {
+                real_t G;
+                real_t E_curr, E_orig;
+                real_t Q_orig, Q_orig_plus1;
+                uint8_t S_index_mapped;
+
+
+                /* check if m is on a noise band border */
+                if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1])
+                {
+                    /* step to next noise band */
+                    current_f_noise_band++;
+                }
+
+
+                /* check if m is on a resolution band border */
+                if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1])
+                {
+                    /* accumulate a whole range of equal Q_Ms */
+                    if (Q_M_size > 0)
+                        den += QUANTISE2INT(pow2(log2_int_tab[Q_M_size] + Q_M));
+                    Q_M_size = 0;
+
+                    /* step to next resolution band */
+                    current_res_band2++;
+
+                    /* if we move to a new resolution band, we should check if we are
+                     * going to add a sinusoid in this band
+                     */
+                    S_mapped = get_S_mapped(sbr, ch, l, current_res_band2);
+                }
+
+
+                /* check if m is on a HI_RES band border */
+                if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1])
+                {
+                    /* step to next HI_RES band */
+                    current_hi_res_band++;
+                }
+
+
+                /* find S_index_mapped
+                 * S_index_mapped can only be 1 for the m in the middle of the
+                 * current HI_RES band
+                 */
+                S_index_mapped = 0;
+                if ((l >= sbr->l_A[ch]) ||
+                    (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch]))
+                {
+                    /* find the middle subband of the HI_RES frequency band */
+                    if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1)
+                        S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band];
+                }
+
+
+                /* find bitstream parameters */
+                if (sbr->E_curr[ch][m][l] == 0)
+                    E_curr = LOG2_MIN_INF;
+                else
+                    E_curr = -10 + log2(sbr->E_curr[ch][m][l]);
+                E_orig = -10 + find_log2_E(sbr, current_res_band2, l, ch);
+
+                Q_orig = find_log2_Q(sbr, current_f_noise_band, current_t_noise_band, ch);
+                Q_orig_plus1 = find_log2_Qplus1(sbr, current_f_noise_band, current_t_noise_band, ch);
+
+
+                /* Q_M only depends on E_orig and Q_div2:
+                 * since N_Q <= N_Low <= N_High we only need to recalculate Q_M on
+                 * a change of current res band (HI or LO)
+                 */
+                Q_M = E_orig + Q_orig - Q_orig_plus1;
+
+
+                /* S_M only depends on E_orig, Q_div and S_index_mapped:
+                 * S_index_mapped can only be non-zero once per HI_RES band
+                 */
+                if (S_index_mapped == 0)
+                {
+                    S_M[m] = LOG2_MIN_INF; /* -inf */
+                } else {
+                    S_M[m] = E_orig - Q_orig_plus1;
+
+                    /* accumulate sinusoid part of the total energy */
+                    den += pow2(S_M[m]);
+                }
+
+
+                /* calculate gain */
+                /* ratio of the energy of the original signal and the energy
+                 * of the HF generated signal
+                 */
+                /* E_curr here is officially E_curr+1 so the log2() of that can never be < 0 */
+                /* scaled by -10 */
+                G = E_orig - max(-10, E_curr);
+                if ((S_mapped == 0) && (delta == 1))
+                {
+                    /* G = G * 1/(1+Q) */
+                    G -= Q_orig_plus1;
+                } else if (S_mapped == 1) {
+                    /* G = G * Q/(1+Q) */
+                    G += Q_orig - Q_orig_plus1;
+                }
+
+
+                /* limit the additional noise energy level */
+                /* and apply the limiter */
+                if (G_max > G)
+                {
+                    Q_M_lim[m] = QUANTISE2REAL(Q_M);
+                    G_lim[m] = QUANTISE2REAL(G);
+
+                    if ((S_index_mapped == 0) && (l != sbr->l_A[ch]))
+                    {
+                        Q_M_size++;
+                    }
+                } else {
+                    /* G > G_max */
+                    Q_M_lim[m] = QUANTISE2REAL(Q_M) + G_max - QUANTISE2REAL(G);
+                    G_lim[m] = G_max;
+
+                    /* accumulate limited Q_M */
+                    if ((S_index_mapped == 0) && (l != sbr->l_A[ch]))
+                    {
+                        den += QUANTISE2INT(pow2(Q_M_lim[m]));
+                    }
+                }
+
+
+                /* accumulate the total energy */
+                /* E_curr changes for every m so we do need to accumulate every m */
+                den += QUANTISE2INT(pow2(E_curr + G_lim[m]));
+            }
+
+            /* accumulate last range of equal Q_Ms */
+            if (Q_M_size > 0)
+            {
+                den += QUANTISE2INT(pow2(log2_int_tab[Q_M_size] + Q_M));
+            }
+
+
+            /* calculate the final gain */
+            /* G_boost: [0..2.51188643] */
+            G_boost = acc1 - QUANTISE2REAL(log2(den + EPS));
+            G_boost = min(G_boost, QUANTISE2REAL(1.328771237) /* log2(1.584893192 ^ 2) */);
+
+
+            for (m = ml1; m < ml2; m++)
+            {
+                /* apply compensation to gain, noise floor sf's and sinusoid levels */
+#ifndef SBR_LOW_POWER
+                adj->G_lim_boost[l][m] = QUANTISE2REAL(pow2((G_lim[m] + G_boost) / 2.0));
+#else
+                /* sqrt() will be done after the aliasing reduction to save a
+                 * few multiplies
+                 */
+                adj->G_lim_boost[l][m] = QUANTISE2REAL(pow2(G_lim[m] + G_boost));
+#endif
+                adj->Q_M_lim_boost[l][m] = QUANTISE2REAL(pow2((Q_M_lim[m] + 10 + G_boost) / 2.0));
+
+                if (S_M[m] != LOG2_MIN_INF)
+                {
+                    adj->S_M_boost[l][m] = QUANTISE2REAL(pow2((S_M[m] + 10 + G_boost) / 2.0));
+                } else {
+                    adj->S_M_boost[l][m] = 0;
+                }
+            }
+        }
+    }
+}
+
+#else
 
 static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
 {
     static real_t limGain[] = { 0.5, 1.0, 2.0, 1e10 };
-    uint8_t m, l, k, i;
+    uint8_t m, l, k;
+
+    uint8_t current_t_noise_band = 0;
+    uint8_t S_mapped;
 
-    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];
-
+    ALIGN real_t Q_M_lim[MAX_M];
+    ALIGN real_t G_lim[MAX_M];
+    ALIGN real_t G_boost;
+    ALIGN real_t S_M[MAX_M];
 
     for (l = 0; l < sbr->L_E[ch]; l++)
     {
+        uint8_t current_f_noise_band = 0;
+        uint8_t current_res_band = 0;
+        uint8_t current_res_band2 = 0;
+        uint8_t current_hi_res_band = 0;
+
         real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1;
 
-        for (i = 0; i < sbr->n[sbr->f[ch][l]]; i++)
+        S_mapped = get_S_mapped(sbr, ch, l, current_res_band2);
+
+        if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1])
         {
-            for (m = sbr->f_table_res[sbr->f[ch][l]][i]; m < sbr->f_table_res[sbr->f[ch][l]][i+1]; m++)
-            {
-                table_map_res_to_m[m - sbr->kx] = i;
-            }
+            current_t_noise_band++;
         }
 
         for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++)
@@ -297,44 +1170,123 @@
             real_t den = 0;
             real_t acc1 = 0;
             real_t acc2 = 0;
+            uint8_t current_res_band_size = 0;
 
-            for (m = sbr->f_table_lim[sbr->bs_limiter_bands][k];
-                 m < sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; m++)
+            uint8_t ml1, ml2;
+
+            ml1 = sbr->f_table_lim[sbr->bs_limiter_bands][k];
+            ml2 = sbr->f_table_lim[sbr->bs_limiter_bands][k+1];
+
+
+            /* calculate the accumulated E_orig and E_curr over the limiter band */
+            for (m = ml1; m < ml2; m++)
             {
-                acc1 += sbr->E_orig[ch][table_map_res_to_m[m]][l];
+                if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band+1])
+                {
+                    current_res_band++;
+                }
+                acc1 += sbr->E_orig[ch][current_res_band][l];
                 acc2 += sbr->E_curr[ch][m][l];
             }
 
-            G_max = ((EPS + acc1)/(EPS + acc2)) * limGain[sbr->bs_limiter_gains];
+
+            /* calculate the maximum gain */
+            /* ratio of the energy of the original signal and the energy
+             * of the HF generated signal
+             */
+            G_max = ((EPS + acc1) / (EPS + acc2)) * limGain[sbr->bs_limiter_gains];
             G_max = min(G_max, 1e10);
 
-            for (m = sbr->f_table_lim[sbr->bs_limiter_bands][k];
-                 m < sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; m++)
+
+            for (m = ml1; m < ml2; m++)
             {
-                real_t d, Q_M, G;
-                real_t div2;
+                real_t Q_M, G;
+                real_t Q_div, Q_div2;
+                uint8_t S_index_mapped;
+
+
+                /* check if m is on a noise band border */
+                if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1])
+                {
+                    /* step to next noise band */
+                    current_f_noise_band++;
+                }
+
+
+                /* check if m is on a resolution band border */
+                if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1])
+                {
+                    /* step to next resolution band */
+                    current_res_band2++;
+
+                    /* if we move to a new resolution band, we should check if we are
+                     * going to add a sinusoid in this band
+                     */
+                    S_mapped = get_S_mapped(sbr, ch, l, current_res_band2);
+                }
+
 
-                div2 = adj->Q_mapped[m][l] / (1 + adj->Q_mapped[m][l]);
-                Q_M = sbr->E_orig[ch][table_map_res_to_m[m]][l] * div2;
+                /* check if m is on a HI_RES band border */
+                if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1])
+                {
+                    /* step to next HI_RES band */
+                    current_hi_res_band++;
+                }
+
+
+                /* find S_index_mapped
+                 * S_index_mapped can only be 1 for the m in the middle of the
+                 * current HI_RES band
+                 */
+                S_index_mapped = 0;
+                if ((l >= sbr->l_A[ch]) ||
+                    (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch]))
+                {
+                    /* find the middle subband of the HI_RES frequency band */
+                    if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1)
+                        S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band];
+                }
 
-                /* 12-Nov: Changed S_mapped to S_index_mapped */
-                if (adj->S_index_mapped[m][l] == 0)
+
+                /* Q_div: [0..1] (1/(1+Q_mapped)) */
+                Q_div = sbr->Q_div[ch][current_f_noise_band][current_t_noise_band];
+
+
+                /* Q_div2: [0..1] (Q_mapped/(1+Q_mapped)) */
+                Q_div2 = sbr->Q_div2[ch][current_f_noise_band][current_t_noise_band];
+
+
+                /* Q_M only depends on E_orig and Q_div2:
+                 * since N_Q <= N_Low <= N_High we only need to recalculate Q_M on
+                 * a change of current noise band
+                 */
+                Q_M = sbr->E_orig[ch][current_res_band2][l] * Q_div2;
+
+
+                /* S_M only depends on E_orig, Q_div and S_index_mapped:
+                 * S_index_mapped can only be non-zero once per HI_RES band
+                 */
+                if (S_index_mapped == 0)
                 {
                     S_M[m] = 0;
                 } else {
-                    real_t div;
+                    S_M[m] = sbr->E_orig[ch][current_res_band2][l] * Q_div;
 
-                    div = adj->S_index_mapped[m][l] / (1. + adj->Q_mapped[m][l]);
-                    S_M[m] = sbr->E_orig[ch][table_map_res_to_m[m]][l] * div;
+                    /* accumulate sinusoid part of the total energy */
+                    den += S_M[m];
                 }
 
-                if (adj->S_mapped[m][l] == 0)
-                {
-                    d = (1 + sbr->E_curr[ch][m][l]) * (1 + delta*adj->Q_mapped[m][l]);
-                    G = sbr->E_orig[ch][table_map_res_to_m[m]][l] / d;
-                } else {
-                    G = (sbr->E_orig[ch][table_map_res_to_m[m]][l] / (1. + sbr->E_curr[ch][m][l])) * div2;
-                }
+
+                /* calculate gain */
+                /* ratio of the energy of the original signal and the energy
+                 * of the HF generated signal
+                 */
+                G = sbr->E_orig[ch][current_res_band2][l] / (1.0 + sbr->E_curr[ch][m][l]);
+                if ((S_mapped == 0) && (delta == 1))
+                    G *= Q_div;
+                else if (S_mapped == 1)
+                    G *= Q_div2;
+
 
                 /* limit the additional noise energy level */
                 /* and apply the limiter */
@@ -347,18 +1299,18 @@
                     G_lim[m] = G_max;
                 }
 
+
+                /* accumulate the total energy */
                 den += sbr->E_curr[ch][m][l] * G_lim[m];
-                if (adj->S_index_mapped[m][l])
-                    den += S_M[m];
-                else if (l != sbr->l_A[ch])
+                if ((S_index_mapped == 0) && (l != sbr->l_A[ch]))
                     den += Q_M_lim[m];
             }
 
+            /* G_boost: [0..2.51188643] */
             G_boost = (acc1 + EPS) / (den + EPS);
             G_boost = min(G_boost, 2.51188643 /* 1.584893192 ^ 2 */);
 
-            for (m = sbr->f_table_lim[sbr->bs_limiter_bands][k];
-                 m < sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; m++)
+            for (m = ml1; m < ml2; m++)
             {
                 /* apply compensation to gain, noise floor sf's and sinusoid levels */
 #ifndef SBR_LOW_POWER
@@ -371,14 +1323,19 @@
 #endif
                 adj->Q_M_lim_boost[l][m] = sqrt(Q_M_lim[m] * G_boost);
 
-                if (adj->S_index_mapped[m][l])
+                if (S_M[m] != 0)
+                {
                     adj->S_M_boost[l][m] = sqrt(S_M[m] * G_boost);
-                else
+                } else {
                     adj->S_M_boost[l][m] = 0;
+                }
             }
         }
     }
 }
+#endif // log2_test
+
+#endif
 
 #ifdef SBR_LOW_POWER
 static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch)
@@ -393,7 +1350,7 @@
 
         for (k = sbr->kx; k < sbr->kx + sbr->M - 1; k++)
         {
-            if (deg[k + 1] && adj->S_mapped[k-sbr->kx][l] == 0)
+            if (deg[k + 1] && adj->S_mapped[l][k-sbr->kx] == 0)
             {
                 if (grouping == 0)
                 {
@@ -404,10 +1361,12 @@
             } else {
                 if (grouping)
                 {
-                    if (adj->S_mapped[k-sbr->kx][l])
+                    if (adj->S_mapped[l][k-sbr->kx])
+                    {
                         sbr->f_group[l][i] = k;
-                    else
+                    } else {
                         sbr->f_group[l][i] = k + 1;
+                    }
                     grouping = 0;
                     i++;
                 }
@@ -442,21 +1401,31 @@
                 /* E_total_est: integer */
                 /* E_total: integer */
                 E_total_est += sbr->E_curr[ch][m-sbr->kx][l];
-                E_total += MUL_R(sbr->E_curr[ch][m-sbr->kx][l], adj->G_lim_boost[l][m-sbr->kx]);
+#ifdef FIXED_POINT
+                E_total += MUL_Q2(sbr->E_curr[ch][m-sbr->kx][l], adj->G_lim_boost[l][m-sbr->kx]);
+#else
+                E_total += sbr->E_curr[ch][m-sbr->kx][l] * adj->G_lim_boost[l][m-sbr->kx];
+#endif
             }
 
             /* G_target: fixed point */
             if ((E_total_est + EPS) == 0)
+            {
                 G_target = 0;
-            else
+            } else {
+#ifdef FIXED_POINT
+                G_target = (((int64_t)(E_total))<<Q2_BITS)/(E_total_est + EPS);
+#else
                 G_target = E_total / (E_total_est + EPS);
+#endif
+            }
             acc = 0;
 
             for (m = sbr->f_group[l][(k<<1)]; m < sbr->f_group[l][(k<<1) + 1]; m++)
             {
                 real_t alpha;
 
-                /* alpha: fixed point */
+                /* alpha: (COEF) fixed point */
                 if (m < sbr->kx + sbr->M - 1)
                 {
                     alpha = max(deg[m], deg[m + 1]);
@@ -464,21 +1433,35 @@
                     alpha = deg[m];
                 }
 
-                adj->G_lim_boost[l][m-sbr->kx] = MUL_R(alpha, G_target) +
-                    MUL_R((REAL_CONST(1)-alpha), adj->G_lim_boost[l][m-sbr->kx]);
+                adj->G_lim_boost[l][m-sbr->kx] = MUL_C(alpha, G_target) +
+                    MUL_C((COEF_CONST(1)-alpha), adj->G_lim_boost[l][m-sbr->kx]);
 
                 /* acc: integer */
-                acc += MUL_R(adj->G_lim_boost[l][m-sbr->kx], sbr->E_curr[ch][m-sbr->kx][l]);
+#ifdef FIXED_POINT
+                acc += MUL_Q2(adj->G_lim_boost[l][m-sbr->kx], sbr->E_curr[ch][m-sbr->kx][l]);
+#else
+                acc += adj->G_lim_boost[l][m-sbr->kx] * sbr->E_curr[ch][m-sbr->kx][l];
+#endif
             }
 
             /* acc: fixed point */
             if (acc + EPS == 0)
+            {
                 acc = 0;
-            else
+            } else {
+#ifdef FIXED_POINT
+                acc = (((int64_t)(E_total))<<Q2_BITS)/(acc + EPS);
+#else
                 acc = E_total / (acc + EPS);
+#endif
+            }
             for(m = sbr->f_group[l][(k<<1)]; m < sbr->f_group[l][(k<<1) + 1]; m++)
             {
-                adj->G_lim_boost[l][m-sbr->kx] = MUL_R(acc, adj->G_lim_boost[l][m-sbr->kx]);
+#ifdef FIXED_POINT
+                adj->G_lim_boost[l][m-sbr->kx] = MUL_Q2(acc, adj->G_lim_boost[l][m-sbr->kx]);
+#else
+                adj->G_lim_boost[l][m-sbr->kx] = acc * adj->G_lim_boost[l][m-sbr->kx];
+#endif
             }
         }
     }
@@ -490,7 +1473,11 @@
             for (m = sbr->f_table_lim[sbr->bs_limiter_bands][k];
                  m < sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; m++)
             {
+#ifdef FIXED_POINT
+                 adj->G_lim_boost[l][m] = SBR_SQRT_Q2(adj->G_lim_boost[l][m]);
+#else
                  adj->G_lim_boost[l][m] = sqrt(adj->G_lim_boost[l][m]);
+#endif
             }
         }
     }
@@ -501,9 +1488,9 @@
                         qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch)
 {
     static real_t h_smooth[] = {
-        COEF_CONST(0.03183050093751), COEF_CONST(0.11516383427084),
-        COEF_CONST(0.21816949906249), COEF_CONST(0.30150283239582),
-        COEF_CONST(0.33333333333333)
+        FRAC_CONST(0.03183050093751), FRAC_CONST(0.11516383427084),
+        FRAC_CONST(0.21816949906249), FRAC_CONST(0.30150283239582),
+        FRAC_CONST(0.33333333333333)
     };
     static int8_t phi_re[] = { 1, 0, -1, 0 };
     static int8_t phi_im[] = { 0, 1, 0, -1 };
@@ -512,7 +1499,6 @@
     uint16_t fIndexNoise = 0;
     uint8_t fIndexSine = 0;
     uint8_t assembly_reset = 0;
-    real_t *temp;
 
     real_t G_filt, Q_filt;
 
@@ -547,6 +1533,8 @@
                 memcpy(sbr->G_temp_prev[ch][n], adj->G_lim_boost[l], sbr->M*sizeof(real_t));
                 memcpy(sbr->Q_temp_prev[ch][n], adj->Q_M_lim_boost[l], sbr->M*sizeof(real_t));
             }
+            /* reset ringbuffer index */
+            sbr->GQ_ringbuf_index[ch] = 4;
             assembly_reset = 0;
         }
 
@@ -557,31 +1545,37 @@
             uint8_t sinusoids = 0;
 #endif
 
-            memcpy(sbr->G_temp_prev[ch][4], adj->G_lim_boost[l], sbr->M*sizeof(real_t));
-            memcpy(sbr->Q_temp_prev[ch][4], adj->Q_M_lim_boost[l], sbr->M*sizeof(real_t));
+            /* load new values into ringbuffer */
+            memcpy(sbr->G_temp_prev[ch][sbr->GQ_ringbuf_index[ch]], adj->G_lim_boost[l], sbr->M*sizeof(real_t));
+            memcpy(sbr->Q_temp_prev[ch][sbr->GQ_ringbuf_index[ch]], adj->Q_M_lim_boost[l], sbr->M*sizeof(real_t));
 
             for (m = 0; m < sbr->M; m++)
             {
-                uint8_t j;
                 qmf_t psi;
 
-
                 G_filt = 0;
                 Q_filt = 0;
-                j = 0;
 
+#ifndef SBR_LOW_POWER
                 if (h_SL != 0)
                 {
+                	uint8_t ri = sbr->GQ_ringbuf_index[ch];
                     for (n = 0; n <= 4; n++)
                     {
-                        G_filt += MUL_C(sbr->G_temp_prev[ch][n][m], h_smooth[j]);
-                        Q_filt += MUL_C(sbr->Q_temp_prev[ch][n][m], h_smooth[j]);
-                        j++;
+                        real_t curr_h_smooth = h_smooth[n];
+                        ri++;
+                        if (ri >= 5)
+                            ri -= 5;
+                        G_filt += MUL_F(sbr->G_temp_prev[ch][ri][m], curr_h_smooth);
+                        Q_filt += MUL_F(sbr->Q_temp_prev[ch][ri][m], curr_h_smooth);
                     }
-                } else {
-                    G_filt = sbr->G_temp_prev[ch][4][m];
-                    Q_filt = sbr->Q_temp_prev[ch][4][m];
+               } else {
+#endif
+                    G_filt = sbr->G_temp_prev[ch][sbr->GQ_ringbuf_index[ch]][m];
+                    Q_filt = sbr->Q_temp_prev[ch][sbr->GQ_ringbuf_index[ch]][m];
+#ifndef SBR_LOW_POWER
                 }
+#endif
 
                 Q_filt = (adj->S_M_boost[l][m] != 0 || no_noise) ? 0 : Q_filt;
 
@@ -590,68 +1584,132 @@
 
                 /* the smoothed gain values are applied to Xsbr */
                 /* V is defined, not calculated */
+#ifndef FIXED_POINT
+                QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = G_filt * QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx])
+                    + MUL_F(Q_filt, RE(V[fIndexNoise]));
+#else
+                //QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_Q2(G_filt, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]))
+                //    + MUL_F(Q_filt, RE(V[fIndexNoise]));
                 QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]))
                     + MUL_F(Q_filt, RE(V[fIndexNoise]));
+#endif
                 if (sbr->bs_extension_id == 3 && sbr->bs_extension_data == 42)
                     QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = 16428320;
 #ifndef SBR_LOW_POWER
+#ifndef FIXED_POINT
+                QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = G_filt * QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx])
+                    + MUL_F(Q_filt, IM(V[fIndexNoise]));
+#else
+                //QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_Q2(G_filt, QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]))
+                //    + MUL_F(Q_filt, IM(V[fIndexNoise]));
                 QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]))
                     + MUL_F(Q_filt, IM(V[fIndexNoise]));
 #endif
-
+#endif
 
-                if (adj->S_index_mapped[m][l])
                 {
-                    int8_t rev = ((m + sbr->kx) & 1) ? -1 : 1;
-                    QMF_RE(psi) = MUL_R(adj->S_M_boost[l][m], phi_re[fIndexSine]);
+                    int8_t rev = (((m + sbr->kx) & 1) ? -1 : 1);
+                    QMF_RE(psi) = adj->S_M_boost[l][m] * phi_re[fIndexSine];
+#ifdef FIXED_POINT
+                    QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += (QMF_RE(psi) << REAL_BITS);
+#else
                     QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += QMF_RE(psi);
+#endif
 
 #ifndef SBR_LOW_POWER
-                    QMF_IM(psi) = rev * MUL_R(adj->S_M_boost[l][m], phi_im[fIndexSine]);
+                    QMF_IM(psi) = rev * adj->S_M_boost[l][m] * phi_im[fIndexSine];
+#ifdef FIXED_POINT
+                    QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += (QMF_IM(psi) << REAL_BITS);
+#else
                     QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += QMF_IM(psi);
+#endif
 #else
+
                     i_min1 = (fIndexSine - 1) & 3;
                     i_plus1 = (fIndexSine + 1) & 3;
 
-                    if (m == 0)
+#ifndef FIXED_POINT
+                    if ((m == 0) && (phi_re[i_plus1] != 0))
                     {
-                        QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) -=
-                            (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 - 1]) +=
+                            (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][0], FRAC_CONST(0.00815)));
+                        if (sbr->M != 0)
+                        {
+                            QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+                                (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][1], FRAC_CONST(0.00815)));
+                        }
+                    }
+                    if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
+                    {
                         QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
-                            (rev * MUL_C(MUL_R(adj->S_M_boost[l][1], phi_re[i_plus1]), COEF_CONST(0.00815)));
+                            (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m - 1], FRAC_CONST(0.00815)));
                     }
-                    if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16))
+                    if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0))
                     {
                         QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
-                            (rev * MUL_C(MUL_R(adj->S_M_boost[l][m - 1], phi_re[i_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)));
+                            (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][m + 1], FRAC_CONST(0.00815)));
                     }
-                    if ((m == sbr->M - 1) && (sinusoids < 16) && (m + sbr->kx + 1 < 63))
+                    if ((m == sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
+                    {
+                        if (m > 0)
+                        {
+                            QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+                                (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m - 1], FRAC_CONST(0.00815)));
+                        }
+                        if (m + sbr->kx < 64)
+                        {
+                            QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) +=
+                                (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m], FRAC_CONST(0.00815)));
+                        }
+                    }
+#else
+                    if ((m == 0) && (phi_re[i_plus1] != 0))
+                    {
+                        QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) +=
+                            (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][0]<<REAL_BITS), FRAC_CONST(0.00815)));
+                        if (sbr->M != 0)
+                        {
+                            QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+                                (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][1]<<REAL_BITS), FRAC_CONST(0.00815)));
+                        }
+                    }
+                    if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
                     {
                         QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
-                            (rev * 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)));
+                            (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m - 1]<<REAL_BITS), FRAC_CONST(0.00815)));
+                    }
+                    if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0))
+                    {
+                        QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+                            (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][m + 1]<<REAL_BITS), FRAC_CONST(0.00815)));
                     }
+                    if ((m == sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
+                    {
+                        if (m > 0)
+                        {
+                            QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+                                (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m - 1]<<REAL_BITS), FRAC_CONST(0.00815)));
+                        }
+                        if (m + sbr->kx < 64)
+                        {
+                            QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) +=
+                                (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m]<<REAL_BITS), FRAC_CONST(0.00815)));
+                        }
+                    }
+#endif
 
-                    sinusoids++;
+                    if (adj->S_M_boost[l][m] != 0)
+                        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;
+            /* update the ringbuffer index used for filtering G and Q with h_smooth */
+            sbr->GQ_ringbuf_index[ch]++;
+            if (sbr->GQ_ringbuf_index[ch] >= 5)
+                sbr->GQ_ringbuf_index[ch] = 0;
         }
     }
 
--- a/Plugins/Input/aac/libfaad2/sbr_hfadj.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_hfadj.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_hfadj.h,v 1.7 2003/11/12 20:47:58 menno Exp $
+** $Id: sbr_hfadj.h,v 1.15 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_HFADJ_H__
@@ -32,17 +32,11 @@
 extern "C" {
 #endif
 
-typedef struct {
-
-    real_t Q_mapped[64][5];
-
-    uint8_t S_index_mapped[64][5];
-    uint8_t S_mapped[64][5];
-
-    real_t G_lim_boost[5][64];
-    real_t Q_M_lim_boost[5][64];
-    real_t S_M_boost[5][64];
-
+typedef struct
+{
+    real_t G_lim_boost[MAX_L_E][MAX_M];
+    real_t Q_M_lim_boost[MAX_L_E][MAX_M];
+    real_t S_M_boost[MAX_L_E][MAX_M];
 } sbr_hfadj_info;
 
 
@@ -53,20 +47,6 @@
                    ,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
--- a/Plugins/Input/aac/libfaad2/sbr_hfgen.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_hfgen.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_hfgen.c,v 1.10 2003/11/12 20:47:58 menno Exp $
+** $Id: sbr_hfgen.c,v 1.22 2004/09/08 09:43:11 gcp Exp $
 **/
 
 /* High Frequency generation */
@@ -36,7 +36,21 @@
 #include "sbr_hfgen.h"
 #include "sbr_fbt.h"
 
-void hf_generation(sbr_info *sbr, const qmf_t Xlow[MAX_NTSRHFG][32],
+
+/* static function declarations */
+#ifdef SBR_LOW_POWER
+static void calc_prediction_coef_lp(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
+                                    complex_t *alpha_0, complex_t *alpha_1, real_t *rxx);
+static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg);
+#else
+static void calc_prediction_coef(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
+                                 complex_t *alpha_0, complex_t *alpha_1, uint8_t k);
+#endif
+static void calc_chirp_factors(sbr_info *sbr, uint8_t ch);
+static void patch_construction(sbr_info *sbr);
+
+
+void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
                    qmf_t Xhigh[MAX_NTSRHFG][64]
 #ifdef SBR_LOW_POWER
                    ,real_t *deg
@@ -44,44 +58,27 @@
                    ,uint8_t ch)
 {
     uint8_t l, i, x;
-    uint8_t offset, first, last;
-    complex_t alpha_0[64], alpha_1[64];
+    ALIGN complex_t alpha_0[64], alpha_1[64];
 #ifdef SBR_LOW_POWER
-    real_t rxx[64];
+    ALIGN 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]];
-    }
+    uint8_t offset = sbr->tHFAdj;
+    uint8_t first = sbr->t_E[ch][0];
+    uint8_t 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));
-    }
+#ifdef SBR_LOW_POWER
+    memset(deg, 0, 64*sizeof(real_t));
+#endif
 
     if ((ch == 0) && (sbr->Reset))
         patch_construction(sbr);
 
     /* calculate the prediction coefficients */
-    calc_prediction_coef(sbr, Xlow, alpha_0, alpha_1
 #ifdef SBR_LOW_POWER
-        , rxx
-#endif
-        );
-
-#ifdef SBR_LOW_POWER
+    calc_prediction_coef_lp(sbr, Xlow, alpha_0, alpha_1, rxx);
     calc_aliasing_degree(sbr, rxx, deg);
 #endif
 
@@ -90,7 +87,7 @@
     {
         for (x = 0; x < sbr->patchNoSubbands[i]; x++)
         {
-            complex_t a0, a1;
+            real_t a0_r, a0_i, a1_r, a1_i;
             real_t bw, bw2;
             uint8_t q, p, k, g;
 
@@ -114,40 +111,58 @@
             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);
+                real_t temp1_r, temp2_r, temp3_r;
 #ifndef SBR_LOW_POWER
-                IM(a0) = MUL_C(IM(alpha_0[p]), bw);
-                IM(a1) = MUL_C(IM(alpha_1[p]), bw2);
+                real_t temp1_i, temp2_i, temp3_i;
+                calc_prediction_coef(sbr, Xlow, alpha_0, alpha_1, p);
+#endif
+
+                a0_r = MUL_C(RE(alpha_0[p]), bw);
+                a1_r = MUL_C(RE(alpha_1[p]), bw2);
+#ifndef SBR_LOW_POWER
+                a0_i = MUL_C(IM(alpha_0[p]), bw);
+                a1_i = MUL_C(IM(alpha_1[p]), bw2);
 #endif
 
+            	temp2_r = QMF_RE(Xlow[first - 2 + offset][p]);
+            	temp3_r = QMF_RE(Xlow[first - 1 + offset][p]);
+#ifndef SBR_LOW_POWER
+            	temp2_i = QMF_IM(Xlow[first - 2 + offset][p]);
+            	temp3_i = QMF_IM(Xlow[first - 1 + offset][p]);
+#endif
 				for (l = first; l < last; l++)
                 {
-                    QMF_RE(Xhigh[l + offset][k]) = QMF_RE(Xlow[l + offset][p]);
+                	temp1_r = temp2_r;
+                	temp2_r = temp3_r;
+                	temp3_r = QMF_RE(Xlow[l + offset][p]);
 #ifndef SBR_LOW_POWER
-                    QMF_IM(Xhigh[l + offset][k]) = QMF_IM(Xlow[l + offset][p]);
+                	temp1_i = temp2_i;
+                	temp2_i = temp3_i;
+                    temp3_i = QMF_IM(Xlow[l + offset][p]);
 #endif
 
 #ifdef SBR_LOW_POWER
-                    QMF_RE(Xhigh[l + offset][k]) += (
-                        MUL_R(RE(a0), QMF_RE(Xlow[l - 1 + offset][p])) +
-                        MUL_R(RE(a1), QMF_RE(Xlow[l - 2 + offset][p])));
+                    QMF_RE(Xhigh[l + offset][k]) =
+                        temp3_r
+                      +(MUL_R(a0_r, temp2_r) +
+                        MUL_R(a1_r, temp1_r));
 #else
-                    QMF_RE(Xhigh[l + offset][k]) += (
-                        RE(a0) * QMF_RE(Xlow[l - 1 + offset][p]) -
-                        IM(a0) * QMF_IM(Xlow[l - 1 + offset][p]) +
-                        RE(a1) * QMF_RE(Xlow[l - 2 + offset][p]) -
-                        IM(a1) * QMF_IM(Xlow[l - 2 + offset][p]));
-                    QMF_IM(Xhigh[l + offset][k]) += (
-                        IM(a0) * QMF_RE(Xlow[l - 1 + offset][p]) +
-                        RE(a0) * QMF_IM(Xlow[l - 1 + offset][p]) +
-                        IM(a1) * QMF_RE(Xlow[l - 2 + offset][p]) +
-                        RE(a1) * QMF_IM(Xlow[l - 2 + offset][p]));
+                    QMF_RE(Xhigh[l + offset][k]) =
+                        temp3_r
+                      +(MUL_R(a0_r, temp2_r) -
+                        MUL_R(a0_i, temp2_i) +
+                        MUL_R(a1_r, temp1_r) -
+                        MUL_R(a1_i, temp1_i));
+                    QMF_IM(Xhigh[l + offset][k]) =
+                        temp3_i
+                      +(MUL_R(a0_i, temp2_r) +
+                        MUL_R(a0_r, temp2_i) +
+                        MUL_R(a1_i, temp1_r) +
+                        MUL_R(a1_r, temp1_i));
 #endif
                 }
             } else {
@@ -178,32 +193,62 @@
     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],
+                             qmf_t buffer[MAX_NTSRHFG][64],
                              uint8_t bd, uint8_t len)
 {
     real_t r01 = 0, r02 = 0, r11 = 0;
     int8_t j;
-    uint8_t offset;
+    uint8_t offset = sbr->tHFAdj;
+#ifdef FIXED_POINT
+    const real_t rel = FRAC_CONST(0.999999); // 1 / (1 + 1e-6f);
+    uint32_t maxi = 0;
+    uint32_t pow2, exp;
+#else
     const real_t rel = 1 / (1 + 1e-6f);
+#endif
+
+
+#ifdef FIXED_POINT
+    mask = 0;
 
-#ifdef DRM
-    if (sbr->Is_DRM_SBR)
-        offset = sbr->tHFGen;
-    else
-#endif
+    for (j = (offset-2); j < (len + offset); j++)
     {
-        offset = sbr->tHFAdj;
+        real_t x;
+        x = QMF_RE(buffer[j][bd])>>REAL_BITS;
+        mask |= x ^ (x >> 31);
     }
 
+    exp = wl_min_lzc(mask);
+
+    /* improves accuracy */
+    if (exp > 0)
+        exp -= 1;
+
     for (j = offset; j < len + offset; j++)
     {
-        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]);
+        real_t buf_j = ((QMF_RE(buffer[j][bd])+(1<<(exp-1)))>>exp);
+        real_t buf_j_1 = ((QMF_RE(buffer[j-1][bd])+(1<<(exp-1)))>>exp);
+        real_t buf_j_2 = ((QMF_RE(buffer[j-2][bd])+(1<<(exp-1)))>>exp);
+
+        /* normalisation with rounding */
+        r01 += MUL_R(buf_j, buf_j_1);
+        r02 += MUL_R(buf_j, buf_j_2);
+        r11 += MUL_R(buf_j_1, buf_j_1);
+    }
+    RE(ac->r12) = r01 -
+        MUL_R(((QMF_RE(buffer[len+offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp)) +
+        MUL_R(((QMF_RE(buffer[offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp));
+    RE(ac->r22) = r11 -
+        MUL_R(((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp)) +
+        MUL_R(((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp));
+#else
+    for (j = offset; j < len + offset; j++)
+    {
+        r01 += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-1][bd]);
+        r02 += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-2][bd]);
+        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]) +
@@ -211,71 +256,213 @@
     RE(ac->r22) = r11 -
         QMF_RE(buffer[len+offset-2][bd]) * QMF_RE(buffer[len+offset-2][bd]) +
         QMF_RE(buffer[offset-2][bd]) * QMF_RE(buffer[offset-2][bd]);
+#endif
     RE(ac->r01) = r01;
     RE(ac->r02) = r02;
     RE(ac->r11) = r11;
 
-    ac->det = MUL_R(RE(ac->r11), RE(ac->r22)) - MUL_C(MUL_R(RE(ac->r12), RE(ac->r12)), rel);
+    ac->det = MUL_R(RE(ac->r11), RE(ac->r22)) - MUL_F(MUL_R(RE(ac->r12), RE(ac->r12)), rel);
 }
 #else
-static void auto_correlation(sbr_info *sbr, acorr_coef *ac, const qmf_t buffer[MAX_NTSRHFG][32],
+static void auto_correlation(sbr_info *sbr, acorr_coef *ac, qmf_t buffer[MAX_NTSRHFG][64],
                              uint8_t bd, uint8_t len)
 {
     real_t r01r = 0, r01i = 0, r02r = 0, r02i = 0, r11r = 0;
+    real_t temp1_r, temp1_i, temp2_r, temp2_i, temp3_r, temp3_i, temp4_r, temp4_i, temp5_r, temp5_i;
+#ifdef FIXED_POINT
+    const real_t rel = FRAC_CONST(0.999999); // 1 / (1 + 1e-6f);
+    uint32_t mask, exp;
+    real_t pow2_to_exp;
+#else
     const real_t rel = 1 / (1 + 1e-6f);
+#endif
     int8_t j;
-    uint8_t offset;
+    uint8_t offset = sbr->tHFAdj;
+
+#ifdef FIXED_POINT
+    mask = 0;
 
-#ifdef DRM
-    if (sbr->Is_DRM_SBR)
-        offset = sbr->tHFGen;
-    else
-#endif
+    for (j = (offset-2); j < (len + offset); j++)
     {
-        offset = sbr->tHFAdj;
+        real_t x;
+        x = QMF_RE(buffer[j][bd])>>REAL_BITS;
+        mask |= x ^ (x >> 31);
+        x = QMF_IM(buffer[j][bd])>>REAL_BITS;
+        mask |= x ^ (x >> 31);
     }
 
+    exp = wl_min_lzc(mask);
+
+    /* improves accuracy */
+    if (exp > 0)
+        exp -= 1;
+   
+    pow2_to_exp = 1<<(exp-1);
+
+    temp2_r = (QMF_RE(buffer[offset-2][bd]) + pow2_to_exp) >> exp;
+    temp2_i = (QMF_IM(buffer[offset-2][bd]) + pow2_to_exp) >> exp;
+    temp3_r = (QMF_RE(buffer[offset-1][bd]) + pow2_to_exp) >> exp;
+    temp3_i = (QMF_IM(buffer[offset-1][bd]) + pow2_to_exp) >> exp;
+    // Save these because they are needed after loop
+    temp4_r = temp2_r;
+    temp4_i = temp2_i;
+    temp5_r = temp3_r;
+    temp5_i = temp3_i;
+
     for (j = offset; j < len + offset; j++)
     {
-        r01r += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-1][bd]) +
-            QMF_IM(buffer[j][bd]) * QMF_IM(buffer[j-1][bd]);
-        r01i += QMF_IM(buffer[j][bd]) * QMF_RE(buffer[j-1][bd]) -
-            QMF_RE(buffer[j][bd]) * QMF_IM(buffer[j-1][bd]);
-        r02r += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-2][bd]) +
-            QMF_IM(buffer[j][bd]) * QMF_IM(buffer[j-2][bd]);
-        r02i += QMF_IM(buffer[j][bd]) * QMF_RE(buffer[j-2][bd]) -
-            QMF_RE(buffer[j][bd]) * QMF_IM(buffer[j-2][bd]);
-        r11r += QMF_RE(buffer[j-1][bd]) * QMF_RE(buffer[j-1][bd]) +
-            QMF_IM(buffer[j-1][bd]) * QMF_IM(buffer[j-1][bd]);
+    	temp1_r = temp2_r; // temp1_r = (QMF_RE(buffer[offset-2][bd] + (1<<(exp-1))) >> exp;
+    	temp1_i = temp2_i; // temp1_i = (QMF_IM(buffer[offset-2][bd] + (1<<(exp-1))) >> exp;
+    	temp2_r = temp3_r; // temp2_r = (QMF_RE(buffer[offset-1][bd] + (1<<(exp-1))) >> exp;
+    	temp2_i = temp3_i; // temp2_i = (QMF_IM(buffer[offset-1][bd] + (1<<(exp-1))) >> exp;
+        temp3_r = (QMF_RE(buffer[j][bd]) + pow2_to_exp) >> exp;
+        temp3_i = (QMF_IM(buffer[j][bd]) + pow2_to_exp) >> exp;
+        r01r += MUL_R(temp3_r, temp2_r) + MUL_R(temp3_i, temp2_i);
+        r01i += MUL_R(temp3_i, temp2_r) - MUL_R(temp3_r, temp2_i);
+        r02r += MUL_R(temp3_r, temp1_r) + MUL_R(temp3_i, temp1_i);
+        r02i += MUL_R(temp3_i, temp1_r) - MUL_R(temp3_r, temp1_i);
+        r11r += MUL_R(temp2_r, temp2_r) + MUL_R(temp2_i, temp2_i);
     }
 
+    // These are actual values in temporary variable at this point
+    // temp1_r = (QMF_RE(buffer[len+offset-1-2][bd] + (1<<(exp-1))) >> exp;
+    // temp1_i = (QMF_IM(buffer[len+offset-1-2][bd] + (1<<(exp-1))) >> exp;
+    // temp2_r = (QMF_RE(buffer[len+offset-1-1][bd] + (1<<(exp-1))) >> exp;
+    // temp2_i = (QMF_IM(buffer[len+offset-1-1][bd] + (1<<(exp-1))) >> exp;
+    // temp3_r = (QMF_RE(buffer[len+offset-1][bd]) + (1<<(exp-1))) >> exp;
+    // temp3_i = (QMF_IM(buffer[len+offset-1][bd]) + (1<<(exp-1))) >> exp;
+    // temp4_r = (QMF_RE(buffer[offset-2][bd]) + (1<<(exp-1))) >> exp;
+    // temp4_i = (QMF_IM(buffer[offset-2][bd]) + (1<<(exp-1))) >> exp;
+    // temp5_r = (QMF_RE(buffer[offset-1][bd]) + (1<<(exp-1))) >> exp;
+    // temp5_i = (QMF_IM(buffer[offset-1][bd]) + (1<<(exp-1))) >> exp;
+
+    RE(ac->r12) = r01r -
+        (MUL_R(temp3_r, temp2_r) + MUL_R(temp3_i, temp2_i)) +
+        (MUL_R(temp5_r, temp4_r) + MUL_R(temp5_i, temp4_i));
+    IM(ac->r12) = r01i -
+        (MUL_R(temp3_i, temp2_r) - MUL_R(temp3_r, temp2_i)) +
+        (MUL_R(temp5_i, temp4_r) - MUL_R(temp5_r, temp4_i));
+    RE(ac->r22) = r11r -
+        (MUL_R(temp2_r, temp2_r) + MUL_R(temp2_i, temp2_i)) +
+        (MUL_R(temp4_r, temp4_r) + MUL_R(temp4_i, temp4_i));
+
+#else
+
+    temp2_r = QMF_RE(buffer[offset-2][bd]);
+    temp2_i = QMF_IM(buffer[offset-2][bd]);
+    temp3_r = QMF_RE(buffer[offset-1][bd]);
+    temp3_i = QMF_IM(buffer[offset-1][bd]);
+    // Save these because they are needed after loop
+    temp4_r = temp2_r;
+    temp4_i = temp2_i;
+    temp5_r = temp3_r;
+    temp5_i = temp3_i;
+
+    for (j = offset; j < len + offset; j++)
+    {
+    	temp1_r = temp2_r; // temp1_r = QMF_RE(buffer[j-2][bd];
+    	temp1_i = temp2_i; // temp1_i = QMF_IM(buffer[j-2][bd];
+    	temp2_r = temp3_r; // temp2_r = QMF_RE(buffer[j-1][bd];
+    	temp2_i = temp3_i; // temp2_i = QMF_IM(buffer[j-1][bd];
+        temp3_r = QMF_RE(buffer[j][bd]);
+        temp3_i = QMF_IM(buffer[j][bd]);
+        r01r += temp3_r * temp2_r + temp3_i * temp2_i;
+        r01i += temp3_i * temp2_r - temp3_r * temp2_i;
+        r02r += temp3_r * temp1_r + temp3_i * temp1_i;
+        r02i += temp3_i * temp1_r - temp3_r * temp1_i;
+        r11r += temp2_r * temp2_r + temp2_i * temp2_i;
+    }
+
+    // These are actual values in temporary variable at this point
+    // temp1_r = QMF_RE(buffer[len+offset-1-2][bd];
+    // temp1_i = QMF_IM(buffer[len+offset-1-2][bd];
+    // temp2_r = QMF_RE(buffer[len+offset-1-1][bd];
+    // temp2_i = QMF_IM(buffer[len+offset-1-1][bd];
+    // temp3_r = QMF_RE(buffer[len+offset-1][bd]);
+    // temp3_i = QMF_IM(buffer[len+offset-1][bd]);
+    // temp4_r = QMF_RE(buffer[offset-2][bd]);
+    // temp4_i = QMF_IM(buffer[offset-2][bd]);
+    // temp5_r = QMF_RE(buffer[offset-1][bd]);
+    // temp5_i = QMF_IM(buffer[offset-1][bd]);
+
+    RE(ac->r12) = r01r -
+        (temp3_r * temp2_r + temp3_i * temp2_i) +
+        (temp5_r * temp4_r + temp5_i * temp4_i);
+    IM(ac->r12) = r01i -
+        (temp3_i * temp2_r - temp3_r * temp2_i) +
+        (temp5_i * temp4_r - temp5_r * temp4_i);
+    RE(ac->r22) = r11r -
+        (temp2_r * temp2_r + temp2_i * temp2_i) +
+        (temp4_r * temp4_r + temp4_i * temp4_i);
+
+#endif
+
     RE(ac->r01) = r01r;
     IM(ac->r01) = r01i;
     RE(ac->r02) = r02r;
     IM(ac->r02) = r02i;
     RE(ac->r11) = r11r;
 
-    RE(ac->r12) = r01r -
-        (QMF_RE(buffer[len+offset-1][bd]) * QMF_RE(buffer[len+offset-2][bd]) + QMF_IM(buffer[len+offset-1][bd]) * QMF_IM(buffer[len+offset-2][bd])) +
-        (QMF_RE(buffer[offset-1][bd]) * QMF_RE(buffer[offset-2][bd]) + QMF_IM(buffer[offset-1][bd]) * QMF_IM(buffer[offset-2][bd]));
-    IM(ac->r12) = r01i -
-        (QMF_IM(buffer[len+offset-1][bd]) * QMF_RE(buffer[len+offset-2][bd]) - QMF_RE(buffer[len+offset-1][bd]) * QMF_IM(buffer[len+offset-2][bd])) +
-        (QMF_IM(buffer[offset-1][bd]) * QMF_RE(buffer[offset-2][bd]) - QMF_RE(buffer[offset-1][bd]) * QMF_IM(buffer[offset-2][bd]));
-    RE(ac->r22) = r11r -
-        (QMF_RE(buffer[len+offset-2][bd]) * QMF_RE(buffer[len+offset-2][bd]) + QMF_IM(buffer[len+offset-2][bd]) * QMF_IM(buffer[len+offset-2][bd])) +
-        (QMF_RE(buffer[offset-2][bd]) * QMF_RE(buffer[offset-2][bd]) + QMF_IM(buffer[offset-2][bd]) * QMF_IM(buffer[offset-2][bd]));
-
-    ac->det = RE(ac->r11) * RE(ac->r22) - rel * (RE(ac->r12) * RE(ac->r12) + IM(ac->r12) * IM(ac->r12));
+    ac->det = MUL_R(RE(ac->r11), RE(ac->r22)) - MUL_F(rel, (MUL_R(RE(ac->r12), RE(ac->r12)) + MUL_R(IM(ac->r12), IM(ac->r12))));
 }
 #endif
 
 /* calculate linear prediction coefficients using the covariance method */
-static void calc_prediction_coef(sbr_info *sbr, const qmf_t Xlow[MAX_NTSRHFG][32],
-                                 complex_t *alpha_0, complex_t *alpha_1
-#ifdef SBR_LOW_POWER
-                                 , real_t *rxx
+#ifndef SBR_LOW_POWER
+static void calc_prediction_coef(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
+                                 complex_t *alpha_0, complex_t *alpha_1, uint8_t k)
+{
+    real_t tmp;
+    acorr_coef ac;
+
+    auto_correlation(sbr, &ac, Xlow, k, sbr->numTimeSlotsRate + 6);
+
+    if (ac.det == 0)
+    {
+        RE(alpha_1[k]) = 0;
+        IM(alpha_1[k]) = 0;
+    } else {
+#ifdef FIXED_POINT
+        tmp = (MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(IM(ac.r01), IM(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11)));
+        RE(alpha_1[k]) = DIV_R(tmp, ac.det);
+        tmp = (MUL_R(IM(ac.r01), RE(ac.r12)) + MUL_R(RE(ac.r01), IM(ac.r12)) - MUL_R(IM(ac.r02), RE(ac.r11)));
+        IM(alpha_1[k]) = DIV_R(tmp, ac.det);
+#else
+        tmp = REAL_CONST(1.0) / ac.det;
+        RE(alpha_1[k]) = (MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(IM(ac.r01), IM(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11))) * tmp;
+        IM(alpha_1[k]) = (MUL_R(IM(ac.r01), RE(ac.r12)) + MUL_R(RE(ac.r01), IM(ac.r12)) - MUL_R(IM(ac.r02), RE(ac.r11))) * tmp;
 #endif
-                                 )
+    }
+
+    if (RE(ac.r11) == 0)
+    {
+        RE(alpha_0[k]) = 0;
+        IM(alpha_0[k]) = 0;
+    } else {
+#ifdef FIXED_POINT
+        tmp = -(RE(ac.r01) + MUL_R(RE(alpha_1[k]), RE(ac.r12)) + MUL_R(IM(alpha_1[k]), IM(ac.r12)));
+        RE(alpha_0[k]) = DIV_R(tmp, RE(ac.r11));
+        tmp = -(IM(ac.r01) + MUL_R(IM(alpha_1[k]), RE(ac.r12)) - MUL_R(RE(alpha_1[k]), IM(ac.r12)));
+        IM(alpha_0[k]) = DIV_R(tmp, RE(ac.r11));
+#else
+        tmp = 1.0f / RE(ac.r11);
+        RE(alpha_0[k]) = -(RE(ac.r01) + MUL_R(RE(alpha_1[k]), RE(ac.r12)) + MUL_R(IM(alpha_1[k]), IM(ac.r12))) * tmp;
+        IM(alpha_0[k]) = -(IM(ac.r01) + MUL_R(IM(alpha_1[k]), RE(ac.r12)) - MUL_R(RE(alpha_1[k]), IM(ac.r12))) * tmp;
+#endif
+    }
+
+    if ((MUL_R(RE(alpha_0[k]),RE(alpha_0[k])) + MUL_R(IM(alpha_0[k]),IM(alpha_0[k])) >= REAL_CONST(16)) ||
+        (MUL_R(RE(alpha_1[k]),RE(alpha_1[k])) + MUL_R(IM(alpha_1[k]),IM(alpha_1[k])) >= REAL_CONST(16)))
+    {
+        RE(alpha_0[k]) = 0;
+        IM(alpha_0[k]) = 0;
+        RE(alpha_1[k]) = 0;
+        IM(alpha_1[k]) = 0;
+    }
+}
+#else
+static void calc_prediction_coef_lp(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
+                                    complex_t *alpha_0, complex_t *alpha_1, real_t *rxx)
 {
     uint8_t k;
     real_t tmp;
@@ -283,30 +470,18 @@
 
     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);
-        }
+        auto_correlation(sbr, &ac, Xlow, k, sbr->numTimeSlotsRate + 6);
 
-#ifdef SBR_LOW_POWER
         if (ac.det == 0)
         {
+            RE(alpha_0[k]) = 0;
             RE(alpha_1[k]) = 0;
         } else {
-            tmp = MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11));
-            RE(alpha_1[k]) = SBR_DIV(tmp, ac.det);
-        }
+            tmp = MUL_R(RE(ac.r01), RE(ac.r22)) - MUL_R(RE(ac.r12), RE(ac.r02));
+            RE(alpha_0[k]) = DIV_R(tmp, (-ac.det));
 
-        if (RE(ac.r11) == 0)
-        {
-            RE(alpha_0[k]) = 0;
-        } else {
-            tmp = RE(ac.r01) + MUL_R(RE(alpha_1[k]), RE(ac.r12));
-            RE(alpha_0[k]) = -SBR_DIV(tmp, RE(ac.r11));
+            tmp = MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11));
+            RE(alpha_1[k]) = DIV_R(tmp, ac.det);
         }
 
         if ((RE(alpha_0[k]) >= REAL_CONST(4)) || (RE(alpha_1[k]) >= REAL_CONST(4)))
@@ -316,92 +491,63 @@
         }
 
         /* 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;
+            rxx[k] = COEF_CONST(0.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;
+            rxx[k] = DIV_C(RE(ac.r01), RE(ac.r11));
+            rxx[k] = -rxx[k];
+            if (rxx[k] > COEF_CONST(1.0)) rxx[k] = COEF_CONST(1.0);
+            if (rxx[k] < COEF_CONST(-1.0)) rxx[k] = COEF_CONST(-1.0);
         }
-
-        if ((RE(alpha_0[k])*RE(alpha_0[k]) + IM(alpha_0[k])*IM(alpha_0[k]) >= 16) ||
-            (RE(alpha_1[k])*RE(alpha_1[k]) + IM(alpha_1[k])*IM(alpha_1[k]) >= 16))
-        {
-            RE(alpha_0[k]) = 0;
-            IM(alpha_0[k]) = 0;
-            RE(alpha_1[k]) = 0;
-            IM(alpha_1[k]) = 0;
-        }
-#endif
     }
 }
 
-#ifdef SBR_LOW_POWER
 static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg)
 {
     uint8_t k;
 
-    rxx[0] = REAL_CONST(0.0);
-    deg[1] = REAL_CONST(0.0);
+    rxx[0] = COEF_CONST(0.0);
+    deg[1] = COEF_CONST(0.0);
 
     for (k = 2; k < sbr->k0; k++)
     {
         deg[k] = 0.0;
 
-        if ((k % 2 == 0) && (rxx[k] < REAL_CONST(0.0)))
+        if ((k % 2 == 0) && (rxx[k] < COEF_CONST(0.0)))
         {
             if (rxx[k-1] < 0.0)
             {
-                deg[k] = REAL_CONST(1.0);
+                deg[k] = COEF_CONST(1.0);
 
-                if (rxx[k-2] > REAL_CONST(0.0))
+                if (rxx[k-2] > COEF_CONST(0.0))
                 {
-                    deg[k-1] = REAL_CONST(1.0) - MUL_R(rxx[k-1], rxx[k-1]);
+                    deg[k-1] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]);
                 }
-            } else if (rxx[k-2] > REAL_CONST(0.0)) {
-                deg[k]   = REAL_CONST(1.0) - MUL_R(rxx[k-1], rxx[k-1]);
+            } else if (rxx[k-2] > COEF_CONST(0.0)) {
+                deg[k] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]);
             }
         }
 
-        if ((k % 2 == 1) && (rxx[k] > REAL_CONST(0.0)))
+        if ((k % 2 == 1) && (rxx[k] > COEF_CONST(0.0)))
         {
-            if (rxx[k-1] > REAL_CONST(0.0))
+            if (rxx[k-1] > COEF_CONST(0.0))
             {
-                deg[k] = REAL_CONST(1.0);
+                deg[k] = COEF_CONST(1.0);
 
-                if (rxx[k-2] < REAL_CONST(0.0))
+                if (rxx[k-2] < COEF_CONST(0.0))
                 {
-                    deg[k-1] = REAL_CONST(1.0) - MUL_R(rxx[k-1], rxx[k-1]);
+                    deg[k-1] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]);
                 }
-            } else if (rxx[k-2] < REAL_CONST(0.0)) {
-                deg[k] = REAL_CONST(1.0) - MUL_R(rxx[k-1], rxx[k-1]);
+            } else if (rxx[k-2] < COEF_CONST(0.0)) {
+                deg[k] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]);
             }
         }
     }
 }
 #endif
 
+/* FIXED POINT: bwArray = COEF */
 static real_t mapNewBw(uint8_t invf_mode, uint8_t invf_mode_prev)
 {
     switch (invf_mode)
@@ -426,6 +572,7 @@
     }
 }
 
+/* FIXED POINT: bwArray = COEF */
 static void calc_chirp_factors(sbr_info *sbr, uint8_t ch)
 {
     uint8_t i;
@@ -435,9 +582,9 @@
         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]);
+            sbr->bwArray[ch][i] = MUL_F(sbr->bwArray[ch][i], FRAC_CONST(0.75)) + MUL_F(sbr->bwArray_prev[ch][i], FRAC_CONST(0.25));
         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]);
+            sbr->bwArray[ch][i] = MUL_F(sbr->bwArray[ch][i], FRAC_CONST(0.90625)) + MUL_F(sbr->bwArray_prev[ch][i], FRAC_CONST(0.09375));
 
         if (sbr->bwArray[ch][i] < COEF_CONST(0.015625))
             sbr->bwArray[ch][i] = COEF_CONST(0.0);
@@ -456,7 +603,9 @@
     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);
+    uint8_t goalSbTab[] = { 21, 23, 32, 43, 46, 64, 85, 93, 128, 0, 0, 0 };
+    /* (uint8_t)(2.048e6/sbr->sample_rate + 0.5); */
+    uint8_t goalSb = goalSbTab[get_sr_index(sbr->sample_rate)];
 
     sbr->noPatches = 0;
 
@@ -468,6 +617,15 @@
         k = sbr->N_master;
     }
 
+    if (sbr->N_master == 0)
+    {
+        sbr->noPatches = 0;
+        sbr->patchNoSubbands[0] = 0;
+        sbr->patchStartSubband[0] = 0;
+
+        return;
+    }
+
     do
     {
         uint8_t j = k + 1;
--- a/Plugins/Input/aac/libfaad2/sbr_hfgen.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_hfgen.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_hfgen.h,v 1.8 2003/11/12 20:47:58 menno Exp $
+** $Id: sbr_hfgen.h,v 1.16 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_HFGEN_H__
@@ -32,23 +32,13 @@
 extern "C" {
 #endif
 
-void hf_generation(sbr_info *sbr, const qmf_t Xlow[MAX_NTSRHFG][32],
+void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
                    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
--- a/Plugins/Input/aac/libfaad2/sbr_huff.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_huff.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_huff.c,v 1.11 2003/11/12 20:47:58 menno Exp $
+** $Id: sbr_huff.c,v 1.17 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -190,7 +190,6 @@
     { -57, -56 },    {  22,  23 },    { -55, -54 },    { -53, -52 }
 };
 
-
 static const int8_t t_huffman_noise_3_0dB[62][2] = {
     { -64,   1 },    { -63,   2 },    { -65,   3 },    { -66,   4 },
     { -62,   5 },    { -67,   6 },    {   7,   8 },    { -61, -68 },
@@ -220,14 +219,14 @@
 };
 
 
-INLINE int16_t sbr_huff_dec(bitfile *ld, sbr_huff_tab t_huff)
+static INLINE int16_t sbr_huff_dec(bitfile *ld, sbr_huff_tab t_huff)
 {
     uint8_t bit;
     int16_t index = 0;
 
     while (index >= 0)
     {
-        bit = (uint8_t)faad_getbits(ld, 1);
+        bit = (uint8_t)faad_get1bit(ld);
         index = t_huff[index][bit];
     }
 
@@ -241,17 +240,10 @@
     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;
+    if ((sbr->L_E[ch] == 1) && (sbr->bs_frame_class[ch] == FIXFIX))
+        sbr->amp_res[ch] = 0;
     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;
-    }
+        sbr->amp_res[ch] = sbr->bs_amp_res;
 
     if ((sbr->bs_coupling) && (ch == 1))
     {
@@ -284,19 +276,19 @@
             {
                 if (sbr->amp_res[ch])
                 {
-                    sbr->E[ch][0][env] = (faad_getbits(ld, 5
+                    sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 5
                         DEBUGVAR(1,272,"sbr_envelope(): bs_data_env")) << delta);
                 } else {
-                    sbr->E[ch][0][env] = (faad_getbits(ld, 6
+                    sbr->E[ch][0][env] = (uint16_t)(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
+                    sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 6
                         DEBUGVAR(1,274,"sbr_envelope(): bs_data_env")) << delta);
                 } else {
-                    sbr->E[ch][0][env] = (faad_getbits(ld, 7
+                    sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 7
                         DEBUGVAR(1,275,"sbr_envelope(): bs_data_env")) << delta);
                 }
             }
--- a/Plugins/Input/aac/libfaad2/sbr_huff.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_huff.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_huff.h,v 1.11 2003/11/12 20:47:58 menno Exp $
+** $Id: sbr_huff.h,v 1.17 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_HUFF_H__
--- a/Plugins/Input/aac/libfaad2/sbr_noise.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_noise.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_noise.h,v 1.7 2003/11/12 20:47:58 menno Exp $
+** $Id: sbr_noise.h,v 1.13 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_NOISE_H__
@@ -39,7 +39,7 @@
 
 
 /* Table 1.A.13 Noise table V */
-complex_t V[] = {
+ALIGN static const 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) },
@@ -557,4 +557,5 @@
 #ifdef __cplusplus
 
 #endif
-#endif
\ No newline at end of file
+#endif
+
--- a/Plugins/Input/aac/libfaad2/sbr_qmf.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_qmf.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,19 +1,19 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
-**  
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
+**
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
 ** the Free Software Foundation; either version 2 of the License, or
 ** (at your option) any later version.
-** 
+**
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ** GNU General Public License for more details.
-** 
+**
 ** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software 
+** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
 ** Any non-GPL usage of this software or parts of this software is strictly
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_qmf.c,v 1.17 2003/11/12 20:47:58 menno Exp $
+** $Id: sbr_qmf.c,v 1.27 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -38,12 +38,16 @@
 #include "sbr_qmf_c.h"
 #include "sbr_syntax.h"
 
-
 qmfa_info *qmfa_init(uint8_t channels)
 {
-    qmfa_info *qmfa = (qmfa_info*)malloc(sizeof(qmfa_info));
-    qmfa->x = (real_t*)malloc(channels * 10 * sizeof(real_t));
-    memset(qmfa->x, 0, channels * 10 * sizeof(real_t));
+    qmfa_info *qmfa = (qmfa_info*)faad_malloc(sizeof(qmfa_info));
+
+	/* x is implemented as double ringbuffer */
+    qmfa->x = (real_t*)faad_malloc(2 * channels * 10 * sizeof(real_t));
+    memset(qmfa->x, 0, 2 * channels * 10 * sizeof(real_t));
+
+	/* ringbuffer index */
+	qmfa->x_index = 0;
 
     qmfa->channels = channels;
 
@@ -54,19 +58,19 @@
 {
     if (qmfa)
     {
-        if (qmfa->x) free(qmfa->x);
-        free(qmfa);
+        if (qmfa->x) faad_free(qmfa->x);
+        faad_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)
+                         qmf_t X[MAX_NTSRHFG][64], uint8_t offset, uint8_t kx)
 {
-    real_t u[64];
+    ALIGN real_t u[64];
 #ifndef SBR_LOW_POWER
-    real_t x[64], y[64];
+    ALIGN real_t in_real[32], in_imag[32], out_real[32], out_imag[32];
 #else
-    real_t y[32];
+    ALIGN real_t y[32];
 #endif
     uint16_t in = 0;
     uint8_t l;
@@ -77,28 +81,34 @@
         int16_t n;
 
         /* shift input buffer x */
-        memmove(qmfa->x + 32, qmfa->x, (320-32)*sizeof(real_t));
+		/* input buffer is not shifted anymore, x is implemented as double ringbuffer */
+        //memmove(qmfa->x + 32, qmfa->x, (320-32)*sizeof(real_t));
 
         /* add new samples to input buffer x */
         for (n = 32 - 1; n >= 0; n--)
         {
 #ifdef FIXED_POINT
-            qmfa->x[n] = (input[in++]) >> 5;
+            qmfa->x[qmfa->x_index + n] = qmfa->x[qmfa->x_index + n + 320] = (input[in++]) >> 4;
 #else
-            qmfa->x[n] = input[in++];
+            qmfa->x[qmfa->x_index + n] = qmfa->x[qmfa->x_index + n + 320] = input[in++];
 #endif
         }
 
         /* window and summation to create array u */
         for (n = 0; n < 64; n++)
         {
-            u[n] = MUL_F(qmfa->x[n], qmf_c[2*n]) +
-                MUL_F(qmfa->x[n + 64], qmf_c[2*(n + 64)]) +
-                MUL_F(qmfa->x[n + 128], qmf_c[2*(n + 128)]) +
-                MUL_F(qmfa->x[n + 192], qmf_c[2*(n + 192)]) +
-                MUL_F(qmfa->x[n + 256], qmf_c[2*(n + 256)]);
+            u[n] = MUL_F(qmfa->x[qmfa->x_index + n], qmf_c[2*n]) +
+                MUL_F(qmfa->x[qmfa->x_index + n + 64], qmf_c[2*(n + 64)]) +
+                MUL_F(qmfa->x[qmfa->x_index + n + 128], qmf_c[2*(n + 128)]) +
+                MUL_F(qmfa->x[qmfa->x_index + n + 192], qmf_c[2*(n + 192)]) +
+                MUL_F(qmfa->x[qmfa->x_index + n + 256], qmf_c[2*(n + 256)]);
         }
 
+		/* update ringbuffer index */
+		qmfa->x_index -= 32;
+		if (qmfa->x_index < 0)
+			qmfa->x_index = (320-32);
+
         /* calculate 32 subband samples by introducing X */
 #ifdef SBR_LOW_POWER
         y[0] = u[48];
@@ -114,7 +124,7 @@
             if (n < kx)
             {
 #ifdef FIXED_POINT
-                QMF_RE(X[l + offset][n]) = u[n] << 1;
+                QMF_RE(X[l + offset][n]) = u[n] /*<< 1*/;
 #else
                 QMF_RE(X[l + offset][n]) = 2. * u[n];
 #endif
@@ -123,44 +133,100 @@
             }
         }
 #else
-        x[0] = u[0];
-        for (n = 0; n < 31; n++)
+
+        // Reordering of data moved from DCT_IV to here
+        in_imag[31] = u[1];
+        in_real[0] = u[0];
+        for (n = 1; n < 31; n++)
         {
-            x[2*n+1] = u[n+1] + u[63-n];
-            x[2*n+2] = u[n+1] - u[63-n];
+            in_imag[31 - n] = u[n+1];
+            in_real[n] = -u[64-n];
         }
-        x[63] = u[32];
-
-        DCT4_64_kernel(y, x);
+        in_imag[0] = u[32];
+        in_real[31] = -u[33];
 
-        for (n = 0; n < 32; n++)
-        {
-            if (n < kx)
-            {
+        // dct4_kernel is DCT_IV without reordering which is done before and after FFT
+        dct4_kernel(in_real, in_imag, out_real, out_imag);
+
+        // Reordering of data moved from DCT_IV to here
+        for (n = 0; n < 16; n++) {
+            if (2*n+1 < kx) {
 #ifdef FIXED_POINT
-                QMF_RE(X[l + offset][n]) = y[n] << 1;
-                QMF_IM(X[l + offset][n]) = -y[63-n] << 1;
+                QMF_RE(X[l + offset][2*n])   = out_real[n];
+                QMF_IM(X[l + offset][2*n])   = out_imag[n];
+                QMF_RE(X[l + offset][2*n+1]) = -out_imag[31-n];
+                QMF_IM(X[l + offset][2*n+1]) = -out_real[31-n];
 #else
-                QMF_RE(X[l + offset][n]) = 2. * y[n];
-                QMF_IM(X[l + offset][n]) = -2. * y[63-n];
+                QMF_RE(X[l + offset][2*n])   = 2. * out_real[n];
+                QMF_IM(X[l + offset][2*n])   = 2. * out_imag[n];
+                QMF_RE(X[l + offset][2*n+1]) = -2. * out_imag[31-n];
+                QMF_IM(X[l + offset][2*n+1]) = -2. * out_real[31-n];
 #endif
             } else {
-                QMF_RE(X[l + offset][n]) = 0;
-                QMF_IM(X[l + offset][n]) = 0;
+                if (2*n < kx) {
+#ifdef FIXED_POINT
+                    QMF_RE(X[l + offset][2*n])   = out_real[n];
+                    QMF_IM(X[l + offset][2*n])   = out_imag[n];
+#else
+                    QMF_RE(X[l + offset][2*n])   = 2. * out_real[n];
+                    QMF_IM(X[l + offset][2*n])   = 2. * out_imag[n];
+#endif
+                }
+                else {
+                    QMF_RE(X[l + offset][2*n]) = 0;
+                    QMF_IM(X[l + offset][2*n]) = 0;
+                }
+                QMF_RE(X[l + offset][2*n+1]) = 0;
+                QMF_IM(X[l + offset][2*n+1]) = 0;
             }
         }
 #endif
     }
 }
 
+static const complex_t qmf32_pre_twiddle[] =
+{
+    { FRAC_CONST(0.999924701839145), FRAC_CONST(-0.012271538285720) },
+    { FRAC_CONST(0.999322384588350), FRAC_CONST(-0.036807222941359) },
+    { FRAC_CONST(0.998118112900149), FRAC_CONST(-0.061320736302209) },
+    { FRAC_CONST(0.996312612182778), FRAC_CONST(-0.085797312344440) },
+    { FRAC_CONST(0.993906970002356), FRAC_CONST(-0.110222207293883) },
+    { FRAC_CONST(0.990902635427780), FRAC_CONST(-0.134580708507126) },
+    { FRAC_CONST(0.987301418157858), FRAC_CONST(-0.158858143333861) },
+    { FRAC_CONST(0.983105487431216), FRAC_CONST(-0.183039887955141) },
+    { FRAC_CONST(0.978317370719628), FRAC_CONST(-0.207111376192219) },
+    { FRAC_CONST(0.972939952205560), FRAC_CONST(-0.231058108280671) },
+    { FRAC_CONST(0.966976471044852), FRAC_CONST(-0.254865659604515) },
+    { FRAC_CONST(0.960430519415566), FRAC_CONST(-0.278519689385053) },
+    { FRAC_CONST(0.953306040354194), FRAC_CONST(-0.302005949319228) },
+    { FRAC_CONST(0.945607325380521), FRAC_CONST(-0.325310292162263) },
+    { FRAC_CONST(0.937339011912575), FRAC_CONST(-0.348418680249435) },
+    { FRAC_CONST(0.928506080473216), FRAC_CONST(-0.371317193951838) },
+    { FRAC_CONST(0.919113851690058), FRAC_CONST(-0.393992040061048) },
+    { FRAC_CONST(0.909167983090522), FRAC_CONST(-0.416429560097637) },
+    { FRAC_CONST(0.898674465693954), FRAC_CONST(-0.438616238538528) },
+    { FRAC_CONST(0.887639620402854), FRAC_CONST(-0.460538710958240) },
+    { FRAC_CONST(0.876070094195407), FRAC_CONST(-0.482183772079123) },
+    { FRAC_CONST(0.863972856121587), FRAC_CONST(-0.503538383725718) },
+    { FRAC_CONST(0.851355193105265), FRAC_CONST(-0.524589682678469) },
+    { FRAC_CONST(0.838224705554838), FRAC_CONST(-0.545324988422046) },
+    { FRAC_CONST(0.824589302785025), FRAC_CONST(-0.565731810783613) },
+    { FRAC_CONST(0.810457198252595), FRAC_CONST(-0.585797857456439) },
+    { FRAC_CONST(0.795836904608884), FRAC_CONST(-0.605511041404326) },
+    { FRAC_CONST(0.780737228572094), FRAC_CONST(-0.624859488142386) },
+    { FRAC_CONST(0.765167265622459), FRAC_CONST(-0.643831542889791) },
+    { FRAC_CONST(0.749136394523459), FRAC_CONST(-0.662415777590172) },
+    { FRAC_CONST(0.732654271672413), FRAC_CONST(-0.680600997795453) },
+    { FRAC_CONST(0.715730825283819), FRAC_CONST(-0.698376249408973) }
+};
+
 qmfs_info *qmfs_init(uint8_t channels)
 {
-    qmfs_info *qmfs = (qmfs_info*)malloc(sizeof(qmfs_info));
+    qmfs_info *qmfs = (qmfs_info*)faad_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));
+	/* v is a double ringbuffer */
+    qmfs->v = (real_t*)faad_malloc(2 * channels * 20 * sizeof(real_t));
+    memset(qmfs->v, 0, 2 * channels * 20 * sizeof(real_t));
 
     qmfs->v_index = 0;
 
@@ -173,17 +239,159 @@
 {
     if (qmfs)
     {
-        if (qmfs->v[0]) free(qmfs->v[0]);
-        if (qmfs->v[1]) free(qmfs->v[1]);
-        free(qmfs);
+        if (qmfs->v) faad_free(qmfs->v);
+        faad_free(qmfs);
     }
 }
 
 #ifdef SBR_LOW_POWER
-void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, const qmf_t X[MAX_NTSRHFG][64],
+
+void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
+                          real_t *output)
+{
+    ALIGN real_t x[16];
+    ALIGN real_t y[16];
+    int16_t n, k, out = 0;
+    uint8_t l;
+
+    /* qmf subsample l */
+    for (l = 0; l < sbr->numTimeSlotsRate; l++)
+    {
+        /* shift buffers */
+        /* we are not shifting v, it is a double ringbuffer */
+        //memmove(qmfs->v + 64, qmfs->v, (640-64)*sizeof(real_t));
+
+        /* calculate 64 samples */
+        for (k = 0; k < 16; k++)
+        {
+#ifdef FIXED_POINT
+            y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][31 - k]));
+            x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][31 - k]));
+#else
+            y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][31 - k])) / 32.0;
+            x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][31 - k])) / 32.0;
+#endif
+        }
+
+        /* even n samples */
+        DCT2_16_unscaled(x, x);
+        /* odd n samples */
+        DCT4_16(y, y);
+
+        for (n = 8; n < 24; n++)
+        {
+            qmfs->v[qmfs->v_index + n*2] = qmfs->v[qmfs->v_index + 640 + n*2] = x[n-8];
+            qmfs->v[qmfs->v_index + n*2+1] = qmfs->v[qmfs->v_index + 640 + n*2+1] = y[n-8];
+        }
+        for (n = 0; n < 16; n++)
+        {
+            qmfs->v[qmfs->v_index + n] = qmfs->v[qmfs->v_index + 640 + n] = qmfs->v[qmfs->v_index + 32-n];
+        }
+        qmfs->v[qmfs->v_index + 48] = qmfs->v[qmfs->v_index + 640 + 48] = 0;
+        for (n = 1; n < 16; n++)
+        {
+            qmfs->v[qmfs->v_index + 48+n] = qmfs->v[qmfs->v_index + 640 + 48+n] = -qmfs->v[qmfs->v_index + 48-n];
+        }
+
+        /* calculate 32 output samples and window */
+        for (k = 0; k < 32; k++)
+        {
+            output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 96 + k], qmf_c[64 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 128 + k], qmf_c[128 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 224 + k], qmf_c[192 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[256 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 352 + k], qmf_c[320 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 384 + k], qmf_c[384 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 480 + k], qmf_c[448 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[512 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 608 + k], qmf_c[576 + 2*k]);
+        }
+
+        /* update the ringbuffer index */
+        qmfs->v_index -= 64;
+        if (qmfs->v_index < 0)
+            qmfs->v_index = (640-64);
+    }
+}
+
+void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
                           real_t *output)
 {
-    real_t x[64];
+    ALIGN real_t x[64];
+    ALIGN real_t y[64];
+    int16_t n, k, out = 0;
+    uint8_t l;
+
+
+    /* qmf subsample l */
+    for (l = 0; l < sbr->numTimeSlotsRate; l++)
+    {
+        /* shift buffers */
+        /* we are not shifting v, it is a double ringbuffer */
+        //memmove(qmfs->v + 128, qmfs->v, (1280-128)*sizeof(real_t));
+
+        /* calculate 128 samples */
+        for (k = 0; k < 32; k++)
+        {
+#ifdef FIXED_POINT
+            y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][63 - k]));
+            x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][63 - k]));
+#else
+            y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][63 - k])) / 32.0;
+            x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][63 - k])) / 32.0;
+#endif
+        }
+
+        /* even n samples */
+        DCT2_32_unscaled(x, x);
+        /* odd n samples */
+        DCT4_32(y, y);
+
+        for (n = 16; n < 48; n++)
+        {
+            qmfs->v[qmfs->v_index + n*2]   = qmfs->v[qmfs->v_index + 1280 + n*2]   = x[n-16];
+            qmfs->v[qmfs->v_index + n*2+1] = qmfs->v[qmfs->v_index + 1280 + n*2+1] = y[n-16];
+        }
+        for (n = 0; n < 32; n++)
+        {
+            qmfs->v[qmfs->v_index + n] = qmfs->v[qmfs->v_index + 1280 + n] = qmfs->v[qmfs->v_index + 64-n];
+        }
+        qmfs->v[qmfs->v_index + 96] = qmfs->v[qmfs->v_index + 1280 + 96] = 0;
+        for (n = 1; n < 32; n++)
+        {
+            qmfs->v[qmfs->v_index + 96+n] = qmfs->v[qmfs->v_index + 1280 + 96+n] = -qmfs->v[qmfs->v_index + 96-n];
+        }
+
+        /* calculate 64 output samples and window */
+        for (k = 0; k < 64; k++)
+        {
+            output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 192 + k], qmf_c[64 + k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[128 + k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 256 + 192 + k], qmf_c[128 + 64 + k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[256 + k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 512 + 192 + k], qmf_c[256 + 64 + k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 768 + k], qmf_c[384 + k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 768 + 192 + k], qmf_c[384 + 64 + k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 1024 + k], qmf_c[512 + k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 1024 + 192 + k], qmf_c[512 + 64 + k]);
+        }
+
+        /* update the ringbuffer index */
+        qmfs->v_index -= 128;
+        if (qmfs->v_index < 0)
+            qmfs->v_index = (1280-128);
+    }
+}
+#else
+void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
+                          real_t *output)
+{
+    ALIGN real_t x1[32], x2[32];
+#ifndef FIXED_POINT
+    real_t scale = 1.f/64.f;
+#endif
     int16_t n, k, out = 0;
     uint8_t l;
 
@@ -191,63 +399,82 @@
     /* 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));
+        /* shift buffer v */
+        /* buffer is not shifted, we are using a ringbuffer */
+        //memmove(qmfs->v + 64, qmfs->v, (640-64)*sizeof(real_t));
 
-        v0 = qmfs->v[qmfs->v_index];
-        v1 = qmfs->v[(qmfs->v_index + 1) & 0x1];
-        qmfs->v_index = (qmfs->v_index + 1) & 0x1;
+        /* calculate 64 samples */
+        /* complex pre-twiddle */
+        for (k = 0; k < 32; k++)
+        {
+            x1[k] = MUL_F(QMF_RE(X[l][k]), RE(qmf32_pre_twiddle[k])) - MUL_F(QMF_IM(X[l][k]), IM(qmf32_pre_twiddle[k]));
+            x2[k] = MUL_F(QMF_IM(X[l][k]), RE(qmf32_pre_twiddle[k])) + MUL_F(QMF_RE(X[l][k]), IM(qmf32_pre_twiddle[k]));
 
-        /* calculate 128 samples */
-        for (k = 0; k < 64; k++)
-        {
-#ifdef FIXED_POINT
-            x[k] = QMF_RE(X[l][k]);
+#ifndef FIXED_POINT
+            x1[k] *= scale;
+            x2[k] *= scale;
 #else
-            x[k] = QMF_RE(X[l][k]) / 32.;
+            x1[k] >>= 1;
+            x2[k] >>= 1;
 #endif
         }
 
-        DCT2_64_unscaled(x, x);
+        /* transform */
+        DCT4_32(x1, x1);
+        DST4_32(x2, x2);
 
         for (n = 0; n < 32; n++)
         {
-            v0[n+32] = x[n];
-            v1[n] = x[n+32];
+            qmfs->v[qmfs->v_index + n]      = qmfs->v[qmfs->v_index + 640 + n]      = -x1[n] + x2[n];
+            qmfs->v[qmfs->v_index + 63 - n] = qmfs->v[qmfs->v_index + 640 + 63 - n] =  x1[n] + x2[n];
         }
-        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++)
+        /* calculate 32 output samples and window */
+        for (k = 0; k < 32; k++)
         {
-            output[out++] = MUL_F(v0[k], qmf_c[k]) +
-                MUL_F(v0[64 + k], qmf_c[64 + k]) +
-                MUL_F(v0[128 + k], qmf_c[128 + k]) +
-                MUL_F(v0[192 + k], qmf_c[192 + k]) +
-                MUL_F(v0[256 + k], qmf_c[256 + k]) +
-                MUL_F(v0[320 + k], qmf_c[320 + k]) +
-                MUL_F(v0[384 + k], qmf_c[384 + k]) +
-                MUL_F(v0[448 + k], qmf_c[448 + k]) +
-                MUL_F(v0[512 + k], qmf_c[512 + k]) +
-                MUL_F(v0[576 + k], qmf_c[576 + k]);
+            output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 96 + k], qmf_c[64 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 128 + k], qmf_c[128 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 224 + k], qmf_c[192 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[256 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 352 + k], qmf_c[320 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 384 + k], qmf_c[384 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 480 + k], qmf_c[448 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[512 + 2*k]) +
+                MUL_F(qmfs->v[qmfs->v_index + 608 + k], qmf_c[576 + 2*k]);
         }
+
+        /* update ringbuffer index */
+        qmfs->v_index -= 64;
+        if (qmfs->v_index < 0)
+            qmfs->v_index = (640 - 64);
     }
 }
-#else
-void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, const qmf_t X[MAX_NTSRHFG][64],
+
+void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
                           real_t *output)
 {
-    real_t x1[64], x2[64];
+//    ALIGN real_t x1[64], x2[64];
+#ifndef SBR_LOW_POWER
+    ALIGN real_t in_real1[32], in_imag1[32], out_real1[32], out_imag1[32];
+    ALIGN real_t in_real2[32], in_imag2[32], out_real2[32], out_imag2[32];
+#endif
+    qmf_t * pX;
+    real_t * pring_buffer_1, * pring_buffer_3;
+//    real_t * ptemp_1, * ptemp_2;
+#ifdef PREFER_POINTERS
+    // These pointers are used if target platform has autoinc address generators
+    real_t * pring_buffer_2, * pring_buffer_4;
+    real_t * pring_buffer_5, * pring_buffer_6;
+    real_t * pring_buffer_7, * pring_buffer_8;
+    real_t * pring_buffer_9, * pring_buffer_10;
+    const real_t * pqmf_c_1, * pqmf_c_2, * pqmf_c_3, * pqmf_c_4;
+    const real_t * pqmf_c_5, * pqmf_c_6, * pqmf_c_7, * pqmf_c_8;
+    const real_t * pqmf_c_9, * pqmf_c_10;
+#endif // #ifdef PREFER_POINTERS
+#ifndef FIXED_POINT
     real_t scale = 1.f/64.f;
+#endif
     int16_t n, k, out = 0;
     uint8_t l;
 
@@ -255,55 +482,150 @@
     /* 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;
+        /* shift buffer v */
+		/* buffer is not shifted, we use double ringbuffer */
+		//memmove(qmfs->v + 128, qmfs->v, (1280-128)*sizeof(real_t));
 
         /* calculate 128 samples */
-        x1[0] = scale*QMF_RE(X[l][0]);
-        x2[63] = scale*QMF_IM(X[l][0]);
-        for (k = 0; k < 31; k++)
+#ifndef FIXED_POINT
+
+        pX = X[l];
+
+        in_imag1[31] = scale*QMF_RE(pX[1]);
+        in_real1[0]  = scale*QMF_RE(pX[0]);
+        in_imag2[31] = scale*QMF_IM(pX[63-1]);
+        in_real2[0]  = scale*QMF_IM(pX[63-0]);
+        for (k = 1; k < 31; k++)
         {
-            x1[2*k+1] = scale*(QMF_RE(X[l][2*k+1]) - QMF_RE(X[l][2*k+2]));
-            x1[2*k+2] = scale*(QMF_RE(X[l][2*k+1]) + QMF_RE(X[l][2*k+2]));
+            in_imag1[31 - k] = scale*QMF_RE(pX[2*k + 1]);
+            in_real1[     k] = scale*QMF_RE(pX[2*k    ]);
+            in_imag2[31 - k] = scale*QMF_IM(pX[63 - (2*k + 1)]);
+            in_real2[     k] = scale*QMF_IM(pX[63 - (2*k    )]);
+        }
+        in_imag1[0]  = scale*QMF_RE(pX[63]);
+        in_real1[31] = scale*QMF_RE(pX[62]);
+        in_imag2[0]  = scale*QMF_IM(pX[63-63]);
+        in_real2[31] = scale*QMF_IM(pX[63-62]);
+
+#else
+
+        pX = X[l];
 
-            x2[61 - 2*k] = scale*(QMF_IM(X[l][2*k+2]) - QMF_IM(X[l][2*k+1]));
-            x2[62 - 2*k] = scale*(QMF_IM(X[l][2*k+2]) + QMF_IM(X[l][2*k+1]));
+        in_imag1[31] = QMF_RE(pX[1]) >> 1;
+        in_real1[0]  = QMF_RE(pX[0]) >> 1;
+        in_imag2[31] = QMF_IM(pX[62]) >> 1;
+        in_real2[0]  = QMF_IM(pX[63]) >> 1;
+        for (k = 1; k < 31; k++)
+        {
+            in_imag1[31 - k] = QMF_RE(pX[2*k + 1]) >> 1;
+            in_real1[     k] = QMF_RE(pX[2*k    ]) >> 1;
+            in_imag2[31 - k] = QMF_IM(pX[63 - (2*k + 1)]) >> 1;
+            in_real2[     k] = QMF_IM(pX[63 - (2*k    )]) >> 1;
         }
-        x1[63] = scale*QMF_RE(X[l][63]);
-        x2[0] = scale*QMF_IM(X[l][63]);
+        in_imag1[0]  = QMF_RE(pX[63]) >> 1;
+        in_real1[31] = QMF_RE(pX[62]) >> 1;
+        in_imag2[0]  = QMF_IM(pX[0]) >> 1;
+        in_real2[31] = QMF_IM(pX[1]) >> 1;
+
+#endif
+
+
+        // dct4_kernel is DCT_IV without reordering which is done before and after FFT
+        dct4_kernel(in_real1, in_imag1, out_real1, out_imag1);
+        dct4_kernel(in_real2, in_imag2, out_real2, out_imag2);
+
 
-        DCT4_64_kernel(x1, x1);
-        DCT4_64_kernel(x2, x2);
+        pring_buffer_1 = qmfs->v + qmfs->v_index;
+        pring_buffer_3 = pring_buffer_1 + 1280;
+#ifdef PREFER_POINTERS
+        pring_buffer_2 = pring_buffer_1 + 127;
+        pring_buffer_4 = pring_buffer_1 + (1280 + 127);
+#endif // #ifdef PREFER_POINTERS
+//        ptemp_1 = x1;
+//        ptemp_2 = x2;
+#ifdef PREFER_POINTERS
+        for (n = 0; n < 32; n ++)
+        {
+            //real_t x1 = *ptemp_1++;
+            //real_t x2 = *ptemp_2++;
+            // pring_buffer_3 and pring_buffer_4 are needed only for double ring buffer
+            *pring_buffer_1++ = *pring_buffer_3++ = out_real2[n] - out_real1[n];
+            *pring_buffer_2-- = *pring_buffer_4-- = out_real2[n] + out_real1[n];
+            //x1 = *ptemp_1++;
+            //x2 = *ptemp_2++;
+            *pring_buffer_1++ = *pring_buffer_3++ = out_imag2[31-n] + out_imag1[31-n];
+            *pring_buffer_2-- = *pring_buffer_4-- = out_imag2[31-n] - out_imag1[31-n];
+        }
+#else // #ifdef PREFER_POINTERS
 
         for (n = 0; n < 32; n++)
         {
-            v0[   2*n]   =  x2[2*n]   - x1[2*n];
-            v1[63-2*n]   =  x2[2*n]   + x1[2*n];
-            v0[   2*n+1] = -x2[2*n+1] - x1[2*n+1];
-            v1[62-2*n]   = -x2[2*n+1] + x1[2*n+1];
+            // pring_buffer_3 and pring_buffer_4 are needed only for double ring buffer
+            pring_buffer_1[2*n]         = pring_buffer_3[2*n]         = out_real2[n] - out_real1[n];
+            pring_buffer_1[127-2*n]     = pring_buffer_3[127-2*n]     = out_real2[n] + out_real1[n];
+            pring_buffer_1[2*n+1]       = pring_buffer_3[2*n+1]       = out_imag2[31-n] + out_imag1[31-n];
+            pring_buffer_1[127-(2*n+1)] = pring_buffer_3[127-(2*n+1)] = out_imag2[31-n] - out_imag1[31-n];
         }
 
+#endif // #ifdef PREFER_POINTERS
+
+        pring_buffer_1 = qmfs->v + qmfs->v_index;
+#ifdef PREFER_POINTERS
+        pring_buffer_2 = pring_buffer_1 + 192;
+        pring_buffer_3 = pring_buffer_1 + 256;
+        pring_buffer_4 = pring_buffer_1 + (256 + 192);
+        pring_buffer_5 = pring_buffer_1 + 512;
+        pring_buffer_6 = pring_buffer_1 + (512 + 192);
+        pring_buffer_7 = pring_buffer_1 + 768;
+        pring_buffer_8 = pring_buffer_1 + (768 + 192);
+        pring_buffer_9 = pring_buffer_1 + 1024;
+        pring_buffer_10 = pring_buffer_1 + (1024 + 192);
+        pqmf_c_1 = qmf_c;
+        pqmf_c_2 = qmf_c + 64;
+        pqmf_c_3 = qmf_c + 128;
+        pqmf_c_4 = qmf_c + 192;
+        pqmf_c_5 = qmf_c + 256;
+        pqmf_c_6 = qmf_c + 320;
+        pqmf_c_7 = qmf_c + 384;
+        pqmf_c_8 = qmf_c + 448;
+        pqmf_c_9 = qmf_c + 512;
+        pqmf_c_10 = qmf_c + 576;
+#endif // #ifdef PREFER_POINTERS
+
         /* calculate 64 output samples and window */
         for (k = 0; k < 64; k++)
         {
-            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]);
+#ifdef PREFER_POINTERS
+            output[out++] =
+                MUL_F(*pring_buffer_1++,  *pqmf_c_1++) +
+                MUL_F(*pring_buffer_2++,  *pqmf_c_2++) +
+                MUL_F(*pring_buffer_3++,  *pqmf_c_3++) +
+                MUL_F(*pring_buffer_4++,  *pqmf_c_4++) +
+                MUL_F(*pring_buffer_5++,  *pqmf_c_5++) +
+                MUL_F(*pring_buffer_6++,  *pqmf_c_6++) +
+                MUL_F(*pring_buffer_7++,  *pqmf_c_7++) +
+                MUL_F(*pring_buffer_8++,  *pqmf_c_8++) +
+                MUL_F(*pring_buffer_9++,  *pqmf_c_9++) +
+                MUL_F(*pring_buffer_10++, *pqmf_c_10++);
+#else // #ifdef PREFER_POINTERS
+            output[out++] =
+                MUL_F(pring_buffer_1[k+0],          qmf_c[k+0])   +
+                MUL_F(pring_buffer_1[k+192],        qmf_c[k+64])  +
+                MUL_F(pring_buffer_1[k+256],        qmf_c[k+128]) +
+                MUL_F(pring_buffer_1[k+(256+192)],  qmf_c[k+192]) +
+                MUL_F(pring_buffer_1[k+512],        qmf_c[k+256]) +
+                MUL_F(pring_buffer_1[k+(512+192)],  qmf_c[k+320]) +
+                MUL_F(pring_buffer_1[k+768],        qmf_c[k+384]) +
+                MUL_F(pring_buffer_1[k+(768+192)],  qmf_c[k+448]) +
+                MUL_F(pring_buffer_1[k+1024],       qmf_c[k+512]) +
+                MUL_F(pring_buffer_1[k+(1024+192)], qmf_c[k+576]);
+#endif // #ifdef PREFER_POINTERS
         }
+
+        /* update ringbuffer index */
+        qmfs->v_index -= 128;
+        if (qmfs->v_index < 0)
+            qmfs->v_index = (1280 - 128);
     }
 }
 #endif
--- a/Plugins/Input/aac/libfaad2/sbr_qmf.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_qmf.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_qmf.h,v 1.12 2003/11/12 20:47:58 menno Exp $
+** $Id: sbr_qmf.h,v 1.21 2004/09/08 09:43:11 gcp Exp $
 **/
 
 #ifndef __SBR_QMF_H__
@@ -38,10 +38,10 @@
 void qmfs_end(qmfs_info *qmfs);
 
 void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input,
-                         qmf_t X[MAX_NTSRHFG][32], uint8_t offset, uint8_t kx);
-void sbr_qmf_synthesis_32(qmfs_info *qmfs, const qmf_t *X,
+                         qmf_t X[MAX_NTSRHFG][64], uint8_t offset, uint8_t kx);
+void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
                           real_t *output);
-void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, const qmf_t X[MAX_NTSRHFG][64],
+void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
                           real_t *output);
 
 
--- a/Plugins/Input/aac/libfaad2/sbr_qmf_c.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_qmf_c.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_qmf_c.h,v 1.7 2003/11/12 20:47:58 menno Exp $
+** $Id: sbr_qmf_c.h,v 1.13 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_QMF_C_H__
@@ -38,7 +38,7 @@
 #pragma warning(disable:4244)
 #endif
 
-static real_t qmf_c[640] = {
+ALIGN static const 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),
@@ -199,7 +199,7 @@
     FRAC_CONST(0.84803157770763), FRAC_CONST(0.84978051984268),
     FRAC_CONST(0.85119715249343), FRAC_CONST(0.85230470352147),
     FRAC_CONST(0.85310209497017), FRAC_CONST(0.85357205739107),
-    FRAC_CONST(0.85373856005937), FRAC_CONST(0.85357205739107),
+    FRAC_CONST(0.85373856005937 /*max*/), FRAC_CONST(0.85357205739107),
     FRAC_CONST(0.85310209497017), FRAC_CONST(0.85230470352147),
     FRAC_CONST(0.85119715249343), FRAC_CONST(0.84978051984268),
     FRAC_CONST(0.84803157770763), FRAC_CONST(0.84598184698206),
@@ -361,4 +361,5 @@
     FRAC_CONST(-0.00056176925738), FRAC_CONST(-0.00055252865047)
 };
 
-#endif
\ No newline at end of file
+#endif
+
--- a/Plugins/Input/aac/libfaad2/sbr_syntax.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_syntax.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_syntax.c,v 1.15 2003/11/12 20:47:58 menno Exp $
+** $Id: sbr_syntax.c,v 1.34 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -37,8 +37,30 @@
 #include "sbr_tf_grid.h"
 #include "sbr_e_nf.h"
 #include "bits.h"
+#ifdef PS_DEC
+#include "ps_dec.h"
+#endif
+#ifdef DRM_PS
+#include "drm_dec.h"
+#endif
 #include "analysis.h"
 
+/* static function declarations */
+static void sbr_header(bitfile *ld, sbr_info *sbr);
+static uint8_t calc_sbr_tables(sbr_info *sbr, uint8_t start_freq, uint8_t stop_freq,
+                               uint8_t samplerate_mode, uint8_t freq_scale,
+                               uint8_t alter_scale, uint8_t xover_band);
+static uint8_t sbr_data(bitfile *ld, sbr_info *sbr);
+static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr,
+                              uint8_t bs_extension_id, uint16_t num_bits_left);
+static uint8_t sbr_single_channel_element(bitfile *ld, sbr_info *sbr);
+static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr);
+static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch);
+static void sbr_dtdf(bitfile *ld, sbr_info *sbr, uint8_t ch);
+static void invf_mode(bitfile *ld, sbr_info *sbr, uint8_t ch);
+static void sinusoidal_coding(bitfile *ld, sbr_info *sbr, uint8_t ch);
+
+
 static void sbr_reset(sbr_info *sbr)
 {
 #if 0
@@ -54,16 +76,6 @@
     if ((sbr->bs_start_freq != sbr->bs_start_freq_prev) ||
         (sbr->bs_stop_freq != sbr->bs_stop_freq_prev) ||
         (sbr->bs_freq_scale != sbr->bs_freq_scale_prev) ||
-        (sbr->bs_alter_scale != sbr->bs_alter_scale_prev))
-    {
-        sbr->Reset = 1;
-    } else {
-        sbr->Reset = 0;
-    }
-
-    if ((sbr->bs_start_freq != sbr->bs_start_freq_prev) ||
-        (sbr->bs_stop_freq != sbr->bs_stop_freq_prev) ||
-        (sbr->bs_freq_scale != sbr->bs_freq_scale_prev) ||
         (sbr->bs_alter_scale != sbr->bs_alter_scale_prev) ||
         (sbr->bs_xover_band != sbr->bs_xover_band_prev) ||
         (sbr->bs_noise_bands != sbr->bs_noise_bands_prev))
@@ -79,23 +91,58 @@
     sbr->bs_alter_scale_prev = sbr->bs_alter_scale;
     sbr->bs_xover_band_prev = sbr->bs_xover_band;
     sbr->bs_noise_bands_prev = sbr->bs_noise_bands;
+}
 
-    if (sbr->frame == 0)
+static uint8_t calc_sbr_tables(sbr_info *sbr, uint8_t start_freq, uint8_t stop_freq,
+                               uint8_t samplerate_mode, uint8_t freq_scale,
+                               uint8_t alter_scale, uint8_t xover_band)
+{
+    uint8_t result = 0;
+    uint8_t k2;
+
+    /* calculate the Master Frequency Table */
+    sbr->k0 = qmf_start_channel(start_freq, samplerate_mode, sbr->sample_rate);
+    k2 = qmf_stop_channel(stop_freq, sbr->sample_rate, sbr->k0);
+
+    /* check k0 and k2 */
+    if (sbr->sample_rate >= 48000)
     {
-        sbr->Reset = 1;
+        if ((k2 - sbr->k0) > 32)
+            result += 1;
+    } else if (sbr->sample_rate <= 32000) {
+        if ((k2 - sbr->k0) > 48)
+            result += 1;
+    } else { /* (sbr->sample_rate == 44100) */
+        if ((k2 - sbr->k0) > 45)
+            result += 1;
     }
+
+    if (freq_scale == 0)
+    {
+        result += master_frequency_table_fs0(sbr, sbr->k0, k2, alter_scale);
+    } else {
+        result += master_frequency_table(sbr, sbr->k0, k2, freq_scale, alter_scale);
+    }
+    result += derived_frequency_table(sbr, xover_band, k2);
+
+    result = (result > 0) ? 1 : 0;
+
+    return result;
 }
 
 /* table 2 */
-uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr)
+uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint16_t cnt)
 {
-    uint8_t result;
+    uint8_t result = 0;
+    uint16_t num_align_bits = 0;
+    uint16_t num_sbr_bits = (uint16_t)faad_get_processed_bits(ld);
+
+    uint8_t saved_start_freq, saved_samplerate_mode;
+    uint8_t saved_stop_freq, saved_freq_scale;
+    uint8_t saved_alter_scale, saved_xover_band;
+
 #ifdef DRM
-    uint8_t crc_len;
-
-    if (sbr->Is_DRM_SBR)
-        faad_getbits(ld, 8); /* 8-bit CRC */
-    else
+    if (!sbr->Is_DRM_SBR)
 #endif
     {
         uint8_t bs_extension_type = (uint8_t)faad_getbits(ld, 4
@@ -108,93 +155,91 @@
         }
     }
 
+    /* save old header values, in case the new ones are corrupted */
+    saved_start_freq = sbr->bs_start_freq;
+    saved_samplerate_mode = sbr->bs_samplerate_mode;
+    saved_stop_freq = sbr->bs_stop_freq;
+    saved_freq_scale = sbr->bs_freq_scale;
+    saved_alter_scale = sbr->bs_alter_scale;
+    saved_xover_band = sbr->bs_xover_band;
+
     sbr->bs_header_flag = faad_get1bit(ld
         DEBUGVAR(1,200,"sbr_bitstream(): bs_header_flag"));
 
-#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? */
+    /* 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))
+    //if (!(sbr->frame == 0 && sbr->bs_header_flag == 0))
+    if (sbr->header_count != 0)
     {
-        uint8_t k2;
+        if (sbr->Reset || (sbr->bs_header_flag && sbr->just_seeked))
+        {
+            uint8_t rt = calc_sbr_tables(sbr, sbr->bs_start_freq, sbr->bs_stop_freq,
+                sbr->bs_samplerate_mode, sbr->bs_freq_scale,
+                sbr->bs_alter_scale, sbr->bs_xover_band);
 
-        /* calculate the Master Frequency Table */
-        sbr->k0 = qmf_start_channel(sbr->bs_start_freq, sbr->bs_samplerate_mode,
-            sbr->sample_rate);
-        k2 = qmf_stop_channel(sbr->bs_stop_freq, sbr->sample_rate, sbr->k0);
-
-        /* check k0 and k2 */
-        if (sbr->sample_rate >= 48000)
-        {
-            if ((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 an error occured with the new header values revert to the old ones */
+            if (rt > 0)
+            {
+                calc_sbr_tables(sbr, saved_start_freq, saved_stop_freq,
+                    saved_samplerate_mode, saved_freq_scale,
+                    saved_alter_scale, saved_xover_band);
+            }
         }
 
-        if (sbr->bs_freq_scale == 0)
+        if (result == 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);
+            result = sbr_data(ld, sbr);
+
+            /* sbr_data() returning an error means that there was an error in
+               envelope_time_border_vector().
+               In this case the old time border vector is saved and all the previous
+               data normally read after sbr_grid() is saved.
+            */
+            /* to be on the safe side, calculate old sbr tables in case of error */
+            if ((result > 0) &&
+                (sbr->Reset || (sbr->bs_header_flag && sbr->just_seeked)))
+            {
+                calc_sbr_tables(sbr, saved_start_freq, saved_stop_freq,
+                    saved_samplerate_mode, saved_freq_scale,
+                    saved_alter_scale, saved_xover_band);
+            }
+
+            /* we should be able to safely set result to 0 now */
+            result = 0;
         }
-        if ((result = derived_frequency_table(sbr, sbr->bs_xover_band, k2)) > 0)
-            return result;
+    } else {
+        result = 1;
     }
 
-    if ((result = sbr_data(ld, sbr)) > 0)
-        return result;
+#ifdef DRM
+    if (!sbr->Is_DRM_SBR)
+#endif
+    {
+        num_sbr_bits = (uint16_t)faad_get_processed_bits(ld) - num_sbr_bits;
+
+        /* check if we read more bits then were available for sbr */
+        if (8*cnt < num_sbr_bits)
+            return 1;
 
-    /* no error */
-    return 0;
+        /* -4 does not apply, bs_extension_type is re-read in this function */
+        num_align_bits = 8*cnt /*- 4*/ - num_sbr_bits;
+
+        while (num_align_bits > 7)
+        {
+            faad_getbits(ld, 8
+                DEBUGVAR(1,999,"sbr_bitstream(): num_align_bits"));
+            num_align_bits -= 8;
+        }
+        faad_getbits(ld, num_align_bits
+            DEBUGVAR(1,999,"sbr_bitstream(): num_align_bits"));
+    }
+
+    return result;
 }
 
 /* table 3 */
@@ -204,46 +249,31 @@
 
     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
+    sbr->bs_start_freq = (uint8_t)faad_getbits(ld, 4
         DEBUGVAR(1,204,"sbr_header(): bs_start_freq"));
-    sbr->bs_stop_freq = faad_getbits(ld, 4
+    sbr->bs_stop_freq = (uint8_t)faad_getbits(ld, 4
         DEBUGVAR(1,205,"sbr_header(): bs_stop_freq"));
-    sbr->bs_xover_band = faad_getbits(ld, 3
+    sbr->bs_xover_band = (uint8_t)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
+    bs_header_extra_1 = (uint8_t)faad_get1bit(ld
         DEBUGVAR(1,208,"sbr_header(): bs_header_extra_1"));
-    bs_header_extra_2 = faad_get1bit(ld
+    bs_header_extra_2 = (uint8_t)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
+        sbr->bs_freq_scale = (uint8_t)faad_getbits(ld, 2
             DEBUGVAR(1,211,"sbr_header(): bs_freq_scale"));
-        sbr->bs_alter_scale = faad_get1bit(ld
+        sbr->bs_alter_scale = (uint8_t)faad_get1bit(ld
             DEBUGVAR(1,212,"sbr_header(): bs_alter_scale"));
-        sbr->bs_noise_bands = faad_getbits(ld, 2
+        sbr->bs_noise_bands = (uint8_t)faad_getbits(ld, 2
             DEBUGVAR(1,213,"sbr_header(): bs_noise_bands"));
     } else {
         /* Default values */
@@ -254,19 +284,14 @@
 
     if (bs_header_extra_2)
     {
-        sbr->bs_limiter_bands = faad_getbits(ld, 2
+        sbr->bs_limiter_bands = (uint8_t)faad_getbits(ld, 2
             DEBUGVAR(1,214,"sbr_header(): bs_limiter_bands"));
-        sbr->bs_limiter_gains = faad_getbits(ld, 2
+        sbr->bs_limiter_gains = (uint8_t)faad_getbits(ld, 2
             DEBUGVAR(1,215,"sbr_header(): bs_limiter_gains"));
-        sbr->bs_interpol_freq = faad_get1bit(ld
+        sbr->bs_interpol_freq = (uint8_t)faad_get1bit(ld
             DEBUGVAR(1,216,"sbr_header(): bs_interpol_freq"));
-        sbr->bs_smoothing_mode = faad_get1bit(ld
+        sbr->bs_smoothing_mode = (uint8_t)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;
@@ -309,11 +334,6 @@
 
     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:
@@ -334,83 +354,103 @@
 {
     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")))
     {
-        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"));
-        }
+        faad_getbits(ld, 4
+            DEBUGVAR(1,221,"sbr_single_channel_element(): bs_reserved_bits_data"));
     }
 
+#ifdef DRM
+    /* bs_coupling, from sbr_channel_pair_base_element(bs_amp_res) */
+    if (sbr->Is_DRM_SBR)
+        faad_get1bit(ld);
+#endif
+
     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);
 
+#ifndef FIXED_POINT
     envelope_noise_dequantisation(sbr, 0);
+#endif
 
     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]"));
-    }
+    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
+#if (defined(PS_DEC) || defined(DRM_PS))
+        uint8_t ps_ext_read = 0;
+#endif
+        uint16_t cnt = (uint16_t)faad_getbits(ld, 4
             DEBUGVAR(1,225,"sbr_single_channel_element(): bs_extension_size"));
         if (cnt == 15)
         {
-            cnt += faad_getbits(ld, 8
+            cnt += (uint16_t)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
+            uint16_t tmp_nr_bits = 0;
+
+            sbr->bs_extension_id = (uint8_t)faad_getbits(ld, 2
                 DEBUGVAR(1,227,"sbr_single_channel_element(): bs_extension_id"));
-            nr_bits_left -= 2;
-            /* sbr_extension(ld, sbr, 0, nr_bits_left); */
-#ifdef DRM
-            if (!sbr->Is_DRM_SBR)
+            tmp_nr_bits += 2;
+
+            /* allow only 1 PS extension element per extension data */
+#if (defined(PS_DEC) || defined(DRM_PS))
+#if (defined(PS_DEC) && defined(DRM_PS))
+            if (sbr->bs_extension_id == EXTENSION_ID_PS || sbr->bs_extension_id == DRM_PARAMETRIC_STEREO)
+#else
+#ifdef PS_DEC
+            if (sbr->bs_extension_id == EXTENSION_ID_PS)
+#else
+#ifdef DRM_PS
+            if (sbr->bs_extension_id == DRM_PARAMETRIC_STEREO)
+#endif
+#endif
 #endif
             {
-                sbr->bs_extension_data = faad_getbits(ld, 6
-                    DEBUGVAR(1,279,"sbr_single_channel_element(): bs_extension_data"));
+                if (ps_ext_read == 0)
+                {
+                    ps_ext_read = 1;
+                } else {
+                    /* to be safe make it 3, will switch to "default"
+                     * in sbr_extension() */
+                    sbr->bs_extension_id = 3;
+                }
             }
+#endif
+
+            tmp_nr_bits += sbr_extension(ld, sbr, sbr->bs_extension_id, nr_bits_left);
+
+            /* check if the data read is bigger than the number of available bits */
+            if (tmp_nr_bits > nr_bits_left)
+                return 1;
+
+            nr_bits_left -= tmp_nr_bits;
         }
 
         /* Corrigendum */
-        faad_getbits(ld, nr_bits_left
-            DEBUGVAR(1,280,"sbr_single_channel_element(): nr_bits_left"));
+        if (nr_bits_left > 0)
+        {
+            faad_getbits(ld, nr_bits_left
+                DEBUGVAR(1,280,"sbr_single_channel_element(): nr_bits_left"));
+        }
     }
 
     return 0;
@@ -421,18 +461,13 @@
 {
     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")))
     {
-        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"));
-        }
+        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
@@ -460,16 +495,6 @@
         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++)
@@ -483,49 +508,45 @@
         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]"));
-        }
+        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]"));
-        }
+        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 {
+        uint8_t saved_t_E[6] = {0}, saved_t_Q[3] = {0};
+        uint8_t saved_L_E = sbr->L_E[0];
+        uint8_t saved_L_Q = sbr->L_Q[0];
+        uint8_t saved_frame_class = sbr->bs_frame_class[0];
+
+        for (n = 0; n < saved_L_E; n++)
+            saved_t_E[n] = sbr->t_E[0][n];
+        for (n = 0; n < saved_L_Q; n++)
+            saved_t_Q[n] = sbr->t_Q[0][n];
+
         if ((result = sbr_grid(ld, sbr, 0)) > 0)
             return result;
         if ((result = sbr_grid(ld, sbr, 1)) > 0)
+        {
+            /* restore first channel data as well */
+            sbr->bs_frame_class[0] = saved_frame_class;
+            sbr->L_E[0] = saved_L_E;
+            sbr->L_Q[0] = saved_L_Q;
+            for (n = 0; n < 6; n++)
+                sbr->t_E[0][n] = saved_t_E[n];
+            for (n = 0; n < 3; n++)
+                sbr->t_Q[0][n] = saved_t_Q[n];
+
             return result;
+        }
         sbr_dtdf(ld, sbr, 0);
         sbr_dtdf(ld, sbr, 1);
         invf_mode(ld, sbr, 0);
         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);
@@ -534,92 +555,98 @@
         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]"));
-        }
+        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]"));
-        }
+        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);
     }
+#ifndef FIXED_POINT
     envelope_noise_dequantisation(sbr, 0);
     envelope_noise_dequantisation(sbr, 1);
 
     if (sbr->bs_coupling)
         unmap_envelope_noise(sbr);
+#endif
 
     sbr->bs_extended_data = faad_get1bit(ld
         DEBUGVAR(1,233,"sbr_channel_pair_element(): bs_extended_data[0]"));
     if (sbr->bs_extended_data)
     {
         uint16_t nr_bits_left;
-        uint16_t cnt = faad_getbits(ld, 4
+        uint16_t cnt = (uint16_t)faad_getbits(ld, 4
             DEBUGVAR(1,234,"sbr_channel_pair_element(): bs_extension_size"));
         if (cnt == 15)
         {
-            cnt += faad_getbits(ld, 8
+            cnt += (uint16_t)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
+            uint16_t tmp_nr_bits = 0;
+
+            sbr->bs_extension_id = (uint8_t)faad_getbits(ld, 2
                 DEBUGVAR(1,236,"sbr_channel_pair_element(): bs_extension_id"));
-            nr_bits_left -= 2;
-            /* sbr_extension(ld, sbr, 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"));
-            }
+            tmp_nr_bits += 2;
+            tmp_nr_bits += sbr_extension(ld, sbr, sbr->bs_extension_id, nr_bits_left);
+
+            /* check if the data read is bigger than the number of available bits */
+            if (tmp_nr_bits > nr_bits_left)
+                return 1;
+
+            nr_bits_left -= tmp_nr_bits;
         }
 
         /* Corrigendum */
-        faad_getbits(ld, nr_bits_left
-            DEBUGVAR(1,280,"sbr_channel_pair_element(): nr_bits_left"));
+        if (nr_bits_left > 0)
+        {
+            faad_getbits(ld, nr_bits_left
+                DEBUGVAR(1,280,"sbr_channel_pair_element(): nr_bits_left"));
+        }
     }
 
     return 0;
 }
 
+/* integer log[2](x): input range [0,10) */
+static int8_t sbr_log2(const int8_t val)
+{
+    int8_t log2tab[] = { 0, 0, 1, 2, 2, 3, 3, 3, 3, 4 };
+    if (val < 10 && val >= 0)
+        return log2tab[val];
+    else
+        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;
+    uint8_t bs_num_env = 0;
+    uint8_t saved_L_E = sbr->L_E[ch];
+    uint8_t saved_L_Q = sbr->L_Q[ch];
+    uint8_t saved_frame_class = sbr->bs_frame_class[ch];
 
-    sbr->bs_frame_class[ch] = faad_getbits(ld, 2
+    sbr->bs_frame_class[ch] = (uint8_t)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
+        i = (uint8_t)faad_getbits(ld, 2
             DEBUGVAR(1,249,"sbr_grid(): bs_num_env_raw"));
 
         bs_num_env = min(1 << i, 5);
 
-        i = faad_get1bit(ld
+        i = (uint8_t)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;
@@ -631,32 +658,23 @@
         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
+        bs_abs_bord = (uint8_t)faad_getbits(ld, 2
+            DEBUGVAR(1,251,"sbr_grid(): bs_abs_bord")) + sbr->numTimeSlots;
+        bs_num_env = (uint8_t)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
+            sbr->bs_rel_bord[ch][rel] = 2 * (uint8_t)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
+        i = sbr_log2(bs_num_env + 1);
+        sbr->bs_pointer[ch] = (uint8_t)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
+            sbr->f[ch][bs_num_env - env - 1] = (uint8_t)faad_get1bit(ld
                 DEBUGVAR(1,255,"sbr_grid(): bs_freq_res"));
         }
 
@@ -667,32 +685,23 @@
         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
+        bs_abs_bord = (uint8_t)faad_getbits(ld, 2
+            DEBUGVAR(1,256,"sbr_grid(): bs_abs_bord"));
+        bs_num_env = (uint8_t)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
+            sbr->bs_rel_bord[ch][rel] = 2 * (uint8_t)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
+        i = sbr_log2(bs_num_env + 1);
+        sbr->bs_pointer[ch] = (uint8_t)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
+            sbr->f[ch][env] = (uint8_t)faad_get1bit(ld
                 DEBUGVAR(1,260,"sbr_grid(): bs_freq_res"));
         }
 
@@ -703,46 +712,34 @@
         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
+        bs_abs_bord = (uint8_t)faad_getbits(ld, 2
+            DEBUGVAR(1,261,"sbr_grid(): bs_abs_bord_0"));
+        bs_abs_bord_1 = (uint8_t)faad_getbits(ld, 2
+            DEBUGVAR(1,262,"sbr_grid(): bs_abs_bord_1")) + sbr->numTimeSlots;
+        sbr->bs_num_rel_0[ch] = (uint8_t)faad_getbits(ld, 2
             DEBUGVAR(1,263,"sbr_grid(): bs_num_rel_0"));
-        sbr->bs_num_rel_1[ch] = faad_getbits(ld, 2
+        sbr->bs_num_rel_1[ch] = (uint8_t)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
+            sbr->bs_rel_bord_0[ch][rel] = 2 * (uint8_t)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
+            sbr->bs_rel_bord_1[ch][rel] = 2 * (uint8_t)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
+        i = sbr_log2(sbr->bs_num_rel_0[ch] + sbr->bs_num_rel_1[ch] + 2);
+        sbr->bs_pointer[ch] = (uint8_t)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
+            sbr->f[ch][env] = (uint8_t)faad_get1bit(ld
                 DEBUGVAR(1,268,"sbr_grid(): bs_freq_res"));
         }
 
@@ -758,6 +755,9 @@
     else
         sbr->L_E[ch] = min(bs_num_env, 4);
 
+    if (sbr->L_E[ch] <= 0)
+        return 1;
+
     if (sbr->L_E[ch] > 1)
         sbr->L_Q[ch] = 2;
     else
@@ -765,9 +765,21 @@
 
     /* TODO: this code can probably be integrated into the code above! */
     if ((result = envelope_time_border_vector(sbr, ch)) > 0)
+    {
+        sbr->bs_frame_class[ch] = saved_frame_class;
+        sbr->L_E[ch] = saved_L_E;
+        sbr->L_Q[ch] = saved_L_Q;
         return result;
+    }
     noise_floor_time_border_vector(sbr, ch);
 
+#if 0
+    for (env = 0; env < bs_num_env; env++)
+    {
+        printf("freq_res[ch:%d][env:%d]: %d\n", ch, env, sbr->f[ch][env]);
+    }
+#endif
+
     return 0;
 }
 
@@ -794,23 +806,52 @@
 {
     uint8_t n;
 
-#ifdef DRM
-    if (sbr->Is_DRM_SBR)
+    for (n = 0; n < sbr->N_Q; n++)
     {
-        /* Only one inv_mode in DRM */
-        uint8_t invf_mode;
-        invf_mode = faad_getbits(ld, 2
+        sbr->bs_invf_mode[ch][n] = (uint8_t)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
+    }
+}
+
+static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr,
+                              uint8_t bs_extension_id, uint16_t num_bits_left)
+{
+#ifdef PS_DEC
+    uint8_t header;
+    uint16_t ret;
 #endif
+
+    switch (bs_extension_id)
     {
-        for (n = 0; n < sbr->N_Q; n++)
+#ifdef PS_DEC
+    case EXTENSION_ID_PS:
+        if (!sbr->ps)
+        {
+            sbr->ps = ps_init(get_sr_index(sbr->sample_rate));
+        }
+        ret = ps_data(sbr->ps, ld, &header);
+
+        /* enable PS if and only if: a header has been decoded */
+        if (sbr->ps_used == 0 && header == 1)
         {
-            sbr->bs_invf_mode[ch][n] = faad_getbits(ld, 2
-                DEBUGVAR(1,271,"invf_mode(): bs_invf_mode"));
+            sbr->ps_used = 1;
         }
+
+        return ret;
+#endif
+#ifdef DRM_PS
+    case DRM_PARAMETRIC_STEREO:
+        sbr->ps_used = 1;
+        if (!sbr->drm_ps)
+        {
+            sbr->drm_ps = drm_ps_init();
+        }
+        return drm_ps_data(sbr->drm_ps, ld);
+#endif
+    default:
+        sbr->bs_extension_data = (uint8_t)faad_getbits(ld, 6
+            DEBUGVAR(1,279,"sbr_single_channel_element(): bs_extension_data"));
+        return 6;
     }
 }
 
--- a/Plugins/Input/aac/libfaad2/sbr_syntax.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_syntax.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_syntax.h,v 1.12 2003/11/12 20:47:58 menno Exp $
+** $Id: sbr_syntax.h,v 1.19 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_SYNTAX_H__
@@ -34,10 +34,6 @@
 
 #include "bits.h"
 
-#ifdef DRM
-# define T_HFGEN_DRM 32
-# define T_HFADJ_DRM 0
-#endif
 #define T_HFGEN 8
 #define T_HFADJ 2
 
@@ -56,18 +52,10 @@
 #define NO_TIME_SLOTS     16
 #define RATE              2
 
-#define NOISE_FLOOR_OFFSET 6.0
+#define NOISE_FLOOR_OFFSET 6
 
 
-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);
+uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint16_t cnt);
 
 #ifdef __cplusplus
 }
--- a/Plugins/Input/aac/libfaad2/sbr_tf_grid.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_tf_grid.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_tf_grid.c,v 1.8 2003/11/12 20:47:58 menno Exp $
+** $Id: sbr_tf_grid.c,v 1.15 2004/09/04 14:56:28 menno Exp $
 **/
 
 /* Time/Frequency grid */
@@ -37,17 +37,24 @@
 #include "sbr_syntax.h"
 #include "sbr_tf_grid.h"
 
+
+/* static function declarations */
+#if 0
+static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l);
+static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l);
+#endif
+static uint8_t middleBorder(sbr_info *sbr, uint8_t ch);
+
+
+/* function constructs new time border vector */
+/* first build into temp vector to be able to use previous vector on error */
 uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch)
 {
     uint8_t l, border, temp;
+    uint8_t t_E_temp[6] = {0};
 
-    for (l = 0; l <= sbr->L_E[ch]; l++)
-    {
-        sbr->t_E[ch][l] = 0;
-    }
-
-    sbr->t_E[ch][0] = sbr->rate * sbr->abs_bord_lead[ch];
-    sbr->t_E[ch][sbr->L_E[ch]] = sbr->rate * sbr->abs_bord_trail[ch];
+    t_E_temp[0] = sbr->rate * sbr->abs_bord_lead[ch];
+    t_E_temp[sbr->L_E[ch]] = sbr->rate * sbr->abs_bord_trail[ch];
 
     switch (sbr->bs_frame_class[ch])
     {
@@ -56,12 +63,12 @@
         {
         case 4:
             temp = (int) (sbr->numTimeSlots / 4);
-            sbr->t_E[ch][3] = sbr->rate * 3 * temp;
-            sbr->t_E[ch][2] = sbr->rate * 2 * temp;
-            sbr->t_E[ch][1] = sbr->rate * temp;
+            t_E_temp[3] = sbr->rate * 3 * temp;
+            t_E_temp[2] = sbr->rate * 2 * temp;
+            t_E_temp[1] = sbr->rate * temp;
             break;
         case 2:
-            sbr->t_E[ch][1] = sbr->rate * (int) (sbr->numTimeSlots / 2);
+            t_E_temp[1] = sbr->rate * (int) (sbr->numTimeSlots / 2);
             break;
         default:
             break;
@@ -80,7 +87,7 @@
                     return 1;
 
                 border -= sbr->bs_rel_bord[ch][l];
-                sbr->t_E[ch][--i] = sbr->rate * border;
+                t_E_temp[--i] = sbr->rate * border;
             }
         }
         break;
@@ -98,7 +105,7 @@
                 if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen)
                     return 1;
 
-                sbr->t_E[ch][i++] = sbr->rate * border;
+                t_E_temp[i++] = sbr->rate * border;
             }
         }
         break;
@@ -116,7 +123,7 @@
                 if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen)
                     return 1;
 
-                sbr->t_E[ch][i++] = sbr->rate * border;
+                t_E_temp[i++] = sbr->rate * border;
             }
         }
 
@@ -131,12 +138,18 @@
                     return 1;
 
                 border -= sbr->bs_rel_bord_1[ch][l];
-                sbr->t_E[ch][--i] = sbr->rate * border;
+                t_E_temp[--i] = sbr->rate * border;
             }
         }
         break;
     }
 
+    /* no error occured, we can safely use this t_E vector */
+    for (l = 0; l < 6; l++)
+    {
+        sbr->t_E[ch][l] = t_E_temp[l];
+    }
+
     return 0;
 }
 
@@ -155,6 +168,7 @@
     }
 }
 
+#if 0
 static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l)
 {
     uint8_t i;
@@ -209,10 +223,11 @@
 
     return 0;
 }
+#endif
 
 static uint8_t middleBorder(sbr_info *sbr, uint8_t ch)
 {
-    int8_t retval;
+    int8_t retval = 0;
 
     switch (sbr->bs_frame_class[ch])
     {
--- a/Plugins/Input/aac/libfaad2/sbr_tf_grid.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_tf_grid.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_tf_grid.h,v 1.7 2003/11/12 20:47:59 menno Exp $
+** $Id: sbr_tf_grid.h,v 1.13 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_TF_GRID_H__
@@ -36,10 +36,6 @@
 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
 }
--- a/Plugins/Input/aac/libfaad2/sine_win.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sine_win.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sine_win.h,v 1.9 2003/11/12 20:47:59 menno Exp $
+** $Id: sine_win.h,v 1.15 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SINE_WIN_H__
@@ -37,7 +37,7 @@
 #pragma warning(disable:4244)
 #endif
 
-real_t sine_long_1024[] =
+ALIGN static const real_t sine_long_1024[] =
 {
     FRAC_CONST(0.00076699031874270449),
     FRAC_CONST(0.002300969151425805),
@@ -1066,7 +1066,7 @@
 };
 
 #ifdef ALLOW_SMALL_FRAMELENGTH
-real_t sine_long_960[] =
+ALIGN static const real_t sine_long_960[] =
 {
     FRAC_CONST(0.00081812299560725323),
     FRAC_CONST(0.0024543667964602917),
@@ -2031,7 +2031,7 @@
 };
 #endif
 
-real_t sine_short_128[] =
+ALIGN static const real_t sine_short_128[] =
 {
     FRAC_CONST(0.0061358846491544753),
     FRAC_CONST(0.01840672990580482),
@@ -2164,7 +2164,7 @@
 };
 
 #ifdef ALLOW_SMALL_FRAMELENGTH
-real_t sine_short_120[] =
+ALIGN static const real_t sine_short_120[] =
 {
     FRAC_CONST(0.0065449379673518581),
     FRAC_CONST(0.019633692460628301),
@@ -2290,7 +2290,7 @@
 #endif
 
 #ifdef LD_DEC
-real_t sine_mid_512[] =
+ALIGN static const real_t sine_mid_512[] =
 {
     FRAC_CONST(0.0015339801862847655),
     FRAC_CONST(0.0046019261204485705),
@@ -2807,7 +2807,7 @@
 };
 
 #ifdef ALLOW_SMALL_FRAMELENGTH
-real_t sine_mid_480[] =
+ALIGN static const real_t sine_mid_480[] =
 {
     FRAC_CONST(0.0016362454436240478),
     FRAC_CONST(0.00490871880799799),
@@ -3292,7 +3292,7 @@
 };
 #endif
 
-real_t ld_mid_512[] =
+ALIGN static const real_t ld_mid_512[] =
 {
     FRAC_CONST(0),
     FRAC_CONST(0),
@@ -3809,7 +3809,7 @@
 };
 
 #ifdef ALLOW_SMALL_FRAMELENGTH
-real_t ld_mid_480[] =
+ALIGN static const real_t ld_mid_480[] =
 {
     FRAC_CONST(0),
     FRAC_CONST(0),
--- a/Plugins/Input/aac/libfaad2/specrec.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/specrec.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,19 +1,19 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
-**  
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
+**
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
 ** the Free Software Foundation; either version 2 of the License, or
 ** (at your option) any later version.
-** 
+**
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ** GNU General Public License for more details.
-** 
+**
 ** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software 
+** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
 ** Any non-GPL usage of this software or parts of this software is strictly
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: specrec.c,v 1.33 2003/11/12 20:47:59 menno Exp $
+** $Id: specrec.c,v 1.56 2004/09/08 09:43:11 gcp Exp $
 **/
 
 /*
@@ -36,13 +36,16 @@
 #include "structs.h"
 
 #include <string.h>
+#include <stdlib.h>
 #include "specrec.h"
+#include "filtbank.h"
 #include "syntax.h"
 #include "iq_table.h"
 #include "ms.h"
 #include "is.h"
 #include "pns.h"
 #include "tns.h"
+#include "drc.h"
 #include "lt_predict.h"
 #include "ic_predict.h"
 #ifdef SSR_DEC
@@ -50,45 +53,52 @@
 #include "ssr_fb.h"
 #endif
 
+
+/* static function declarations */
+static uint8_t quant_to_spec(NeAACDecHandle hDecoder,
+                             ic_stream *ics, int16_t *quant_data,
+                             real_t *spec_data, uint16_t frame_len);
+
+
 #ifdef LD_DEC
-static uint8_t num_swb_512_window[] =
+ALIGN static const 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[] =
+ALIGN static const 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[] =
+ALIGN static const 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[] =
+ALIGN static const 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[] =
+ALIGN static const 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[] =
+ALIGN static const 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[] =
+ALIGN static const 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[] =
+ALIGN static const 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,
@@ -96,13 +106,12 @@
     864, 904, 944, 984, 1024
 };
 
-static uint16_t swb_offset_128_64[] =
+ALIGN static const 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[] =
+ALIGN static const 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,
@@ -111,14 +120,14 @@
 };
 
 #ifdef LD_DEC
-static uint16_t swb_offset_512_48[] =
+ALIGN static const 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[] =
+ALIGN static const 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,
@@ -126,12 +135,12 @@
 };
 #endif
 
-static uint16_t swb_offset_128_48[] =
+ALIGN static const 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[] =
+ALIGN static const 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,
@@ -140,14 +149,14 @@
 };
 
 #ifdef LD_DEC
-static uint16_t swb_offset_512_32[] =
+ALIGN static const 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[] =
+ALIGN static const 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,
@@ -155,7 +164,7 @@
 };
 #endif
 
-static uint16_t swb_offset_1024_24[] =
+ALIGN static const 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,
@@ -164,50 +173,50 @@
 };
 
 #ifdef LD_DEC
-static uint16_t swb_offset_512_24[] =
+ALIGN static const 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[] =
+ALIGN static const 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[] =
+ALIGN static const 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[] =
+ALIGN static const 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[] =
+ALIGN static const 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[] =
+ALIGN static const 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[] =
+ALIGN static const 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[] =
+ALIGN static const uint16_t *swb_offset_1024_window[] =
 {
     swb_offset_1024_96,      /* 96000 */
     swb_offset_1024_96,      /* 88200 */
@@ -224,7 +233,7 @@
 };
 
 #ifdef LD_DEC
-static uint16_t *swb_offset_512_window[] =
+ALIGN static const uint16_t *swb_offset_512_window[] =
 {
     0,                       /* 96000 */
     0,                       /* 88200 */
@@ -240,7 +249,7 @@
     0                        /* 8000  */
 };
 
-static uint16_t *swb_offset_480_window[] =
+ALIGN static const uint16_t *swb_offset_480_window[] =
 {
     0,                       /* 96000 */
     0,                       /* 88200 */
@@ -257,7 +266,7 @@
 };
 #endif
 
-static uint16_t *swb_offset_128_window[] =
+ALIGN static const  uint16_t *swb_offset_128_window[] =
 {
     swb_offset_128_96,       /* 96000 */
     swb_offset_128_96,       /* 88200 */
@@ -288,7 +297,7 @@
     in section named section. This offset depends on window_sequence and
     scale_factor_grouping and is needed to decode the spectral_data().
 */
-uint8_t window_grouping_info(faacDecHandle hDecoder, ic_stream *ics)
+uint8_t window_grouping_info(NeAACDecHandle hDecoder, ic_stream *ics)
 {
     uint8_t i, g;
 
@@ -400,6 +409,107 @@
     }
 }
 
+/* iquant() *
+/* output = sign(input)*abs(input)^(4/3) */
+/**/
+static INLINE real_t iquant(int16_t q, const real_t *tab, uint8_t *error)
+{
+#ifdef FIXED_POINT
+/* For FIXED_POINT the iq_table is prescaled by 3 bits (iq_table[]/8) */
+/* BIG_IQ_TABLE allows you to use the full 8192 value table, if this is not
+ * defined a 1026 value table and interpolation will be used
+ */
+#ifndef BIG_IQ_TABLE
+    static const real_t errcorr[] = {
+        REAL_CONST(0), REAL_CONST(1.0/8.0), REAL_CONST(2.0/8.0), REAL_CONST(3.0/8.0),
+        REAL_CONST(4.0/8.0),  REAL_CONST(5.0/8.0), REAL_CONST(6.0/8.0), REAL_CONST(7.0/8.0),
+        REAL_CONST(0)
+    };
+    real_t x1, x2;
+#endif
+    int16_t sgn = 1;
+
+    if (q < 0)
+    {
+        q = -q;
+        sgn = -1;
+    }
+
+    if (q < IQ_TABLE_SIZE)
+    {
+//#define IQUANT_PRINT
+#ifdef IQUANT_PRINT
+        //printf("0x%.8X\n", sgn * tab[q]);
+        printf("%d\n", sgn * tab[q]);
+#endif
+        return sgn * tab[q];
+    }
+
+#ifndef BIG_IQ_TABLE
+    if (q >= 8192)
+    {
+        *error = 17;
+        return 0;
+    }
+
+    /* linear interpolation */
+    x1 = tab[q>>3];
+    x2 = tab[(q>>3) + 1];
+    return sgn * 16 * (MUL_R(errcorr[q&7],(x2-x1)) + x1);
+#else
+    *error = 17;
+    return 0;
+#endif
+
+#else
+    if (q < 0)
+    {
+        /* tab contains a value for all possible q [0,8192] */
+        if (-q < IQ_TABLE_SIZE)
+            return -tab[-q];
+
+        *error = 17;
+        return 0;
+    } else {
+        /* tab contains a value for all possible q [0,8192] */
+        if (q < IQ_TABLE_SIZE)
+            return tab[q];
+
+        *error = 17;
+        return 0;
+    }
+#endif
+}
+
+#ifndef FIXED_POINT
+ALIGN static const real_t pow2sf_tab[] = {
+    2.9802322387695313E-008, 5.9604644775390625E-008, 1.1920928955078125E-007,
+    2.384185791015625E-007, 4.76837158203125E-007, 9.5367431640625E-007,
+    1.9073486328125E-006, 3.814697265625E-006, 7.62939453125E-006,
+    1.52587890625E-005, 3.0517578125E-005, 6.103515625E-005,
+    0.0001220703125, 0.000244140625, 0.00048828125,
+    0.0009765625, 0.001953125, 0.00390625,
+    0.0078125, 0.015625, 0.03125,
+    0.0625, 0.125, 0.25,
+    0.5, 1.0, 2.0,
+    4.0, 8.0, 16.0, 32.0,
+    64.0, 128.0, 256.0,
+    512.0, 1024.0, 2048.0,
+    4096.0, 8192.0, 16384.0,
+    32768.0, 65536.0, 131072.0,
+    262144.0, 524288.0, 1048576.0,
+    2097152.0, 4194304.0, 8388608.0,
+    16777216.0, 33554432.0, 67108864.0,
+    134217728.0, 268435456.0, 536870912.0,
+    1073741824.0, 2147483648.0, 4294967296.0,
+    8589934592.0, 17179869184.0, 34359738368.0,
+    68719476736.0, 137438953472.0, 274877906944.0
+};
+#endif
+
+/* quant_to_spec: perform dequantisation and scaling
+ * and in case of short block it also does the deinterleaving
+ */
 /*
   For ONLY_LONG_SEQUENCE windows (num_window_groups = 1,
   window_group_length[0] = 1) the spectral data is in ascending spectral
@@ -420,12 +530,25 @@
   - 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)
+static uint8_t quant_to_spec(NeAACDecHandle hDecoder,
+                             ic_stream *ics, int16_t *quant_data,
+                             real_t *spec_data, uint16_t frame_len)
 {
+    ALIGN static const real_t pow2_table[] =
+    {
+        COEF_CONST(1.0),
+        COEF_CONST(1.1892071150027210667174999705605), /* 2^0.25 */
+        COEF_CONST(1.4142135623730950488016887242097), /* 2^0.5 */
+        COEF_CONST(1.6817928305074290860622509524664) /* 2^0.75 */
+    };
+    const real_t *tab = iq_table;
+
     uint8_t g, sfb, win;
-    uint16_t width, bin, k, gindex;
-
-    real_t tmp_spec[1024] = {0};
+    uint16_t width, bin, k, gindex, wa, wb;
+    uint8_t error = 0; /* Init error flag */
+#ifndef FIXED_POINT
+    real_t scf;
+#endif
 
     k = 0;
     gindex = 0;
@@ -438,147 +561,25 @@
 
         for (sfb = 0; sfb < ics->num_swb; sfb++)
         {
+            int32_t exp, frac;
+
             width = ics->swb_offset[sfb+1] - ics->swb_offset[sfb];
 
-            for (win = 0; win < ics->window_group_length[g]; win++)
+            /* this could be scalefactor for IS or PNS, those can be negative or bigger then 255 */
+            /* just ignore them */
+            if (ics->scale_factors[g][sfb] < 0 || ics->scale_factors[g][sfb] > 255)
             {
-                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;
-                }
+                exp = 0;
+                frac = 0;
+            } else {
+                /* ics->scale_factors[g][sfb] must be between 0 and 255 */
+                exp = (ics->scale_factors[g][sfb] /* - 100 */) >> 2;
+                /* frac must always be > 0 */
+                frac = (ics->scale_factors[g][sfb] /* - 100 */) & 3;
             }
-            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;
-
+#ifdef FIXED_POINT
+            exp -= 25;
             /* IMDCT pre-scaling */
             if (hDecoder->object_type == LD)
             {
@@ -589,61 +590,314 @@
                 else
                     exp -= 7 /*10*/;
             }
-#if (REAL_BITS == 16)
-            exp--;
+#endif
+
+            wa = gindex + j;
+
+#ifndef FIXED_POINT
+            scf = pow2sf_tab[exp/*+25*/] * pow2_table[frac];
+#endif
+
+            for (win = 0; win < ics->window_group_length[g]; win++)
+            {
+                for (bin = 0; bin < width; bin += 4)
+                {
+#ifndef FIXED_POINT
+                    wb = wa + bin;
+
+                    spec_data[wb+0] = iquant(quant_data[k+0], tab, &error) * scf;
+                    spec_data[wb+1] = iquant(quant_data[k+1], tab, &error) * scf;                        
+                    spec_data[wb+2] = iquant(quant_data[k+2], tab, &error) * scf;                        
+                    spec_data[wb+3] = iquant(quant_data[k+3], tab, &error) * scf;
+                        
+#else
+                    real_t iq0 = iquant(quant_data[k+0], tab, &error);
+                    real_t iq1 = iquant(quant_data[k+1], tab, &error);
+                    real_t iq2 = iquant(quant_data[k+2], tab, &error);
+                    real_t iq3 = iquant(quant_data[k+3], tab, &error);
+
+                    wb = wa + bin;
+
+                    if (exp < 0)
+                    {
+                        spec_data[wb+0] = iq0 >>= -exp;
+                        spec_data[wb+1] = iq1 >>= -exp;
+                        spec_data[wb+2] = iq2 >>= -exp;
+                        spec_data[wb+3] = iq3 >>= -exp;
+                    } else {
+                        spec_data[wb+0] = iq0 <<= exp;
+                        spec_data[wb+1] = iq1 <<= exp;
+                        spec_data[wb+2] = iq2 <<= exp;
+                        spec_data[wb+3] = iq3 <<= exp;
+                    }
+                    if (frac != 0)
+                    {
+                        spec_data[wb+0] = MUL_C(spec_data[wb+0],pow2_table[frac]);
+                        spec_data[wb+1] = MUL_C(spec_data[wb+1],pow2_table[frac]);
+                        spec_data[wb+2] = MUL_C(spec_data[wb+2],pow2_table[frac]);
+                        spec_data[wb+3] = MUL_C(spec_data[wb+3],pow2_table[frac]);
+                    }
+
+//#define SCFS_PRINT
+#ifdef SCFS_PRINT
+                    printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+0]);
+                    printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+1]);
+                    printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+2]);
+                    printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+3]);
+                    //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+0]);
+                    //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+1]);
+                    //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+2]);
+                    //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+3]);
 #endif
 #endif
 
-            /* 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;
+                    gincrease += 4;
+                    k += 4;
                 }
+                wa += win_inc;
+            }
+            j += width;
+        }
+        gindex += gincrease;
+    }
 
-                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]);
-                }
+    return error;
+}
+
+static uint8_t allocate_single_channel(NeAACDecHandle hDecoder, uint8_t channel,
+                                       uint8_t output_channels)
+{
+    uint8_t mul = 1;
+
+#ifdef MAIN_DEC
+    /* MAIN object type prediction */
+    if (hDecoder->object_type == MAIN)
+    {
+        /* allocate the state only when needed */
+        if (hDecoder->pred_stat[channel] == NULL)
+        {
+            hDecoder->pred_stat[channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state));
+            reset_all_predictors(hDecoder->pred_stat[channel], hDecoder->frameLength);
+        }
+    }
+#endif
+
+#ifdef LTP_DEC
+    if (is_ltp_ot(hDecoder->object_type))
+    {
+        /* allocate the state only when needed */
+        if (hDecoder->lt_pred_stat[channel] == NULL)
+        {
+            hDecoder->lt_pred_stat[channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t));
+            memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength*4 * sizeof(int16_t));
+        }
+    }
 #endif
-            }
+
+    if (hDecoder->time_out[channel] == NULL)
+    {
+        mul = 1;
+#ifdef SBR_DEC
+        hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0;
+        if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+        {
+            /* SBR requires 2 times as much output data */
+            mul = 2;
+            hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1;
+        }
+#endif
+        hDecoder->time_out[channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t));
+        memset(hDecoder->time_out[channel], 0, mul*hDecoder->frameLength*sizeof(real_t));
+    }
+#if (defined(PS_DEC) || defined(DRM_PS))
+    if (output_channels == 2)
+    {
+        if (hDecoder->time_out[channel+1] == NULL)
+        {
+            hDecoder->time_out[channel+1] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t));
+            memset(hDecoder->time_out[channel+1], 0, mul*hDecoder->frameLength*sizeof(real_t));
         }
-        groups += ics->window_group_length[g];
+    }
+#endif
+
+    if (hDecoder->fb_intermed[channel] == NULL)
+    {
+        hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t));
+        memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength*sizeof(real_t));
     }
+
+#ifdef SSR_DEC
+    if (hDecoder->object_type == SSR)
+    {
+        if (hDecoder->ssr_overlap[channel] == NULL)
+        {
+            hDecoder->ssr_overlap[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t));
+            memset(hDecoder->ssr_overlap[channel], 0, 2*hDecoder->frameLength*sizeof(real_t));
+        }
+        if (hDecoder->prev_fmd[channel] == NULL)
+        {
+            uint16_t k;
+            hDecoder->prev_fmd[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t));
+            for (k = 0; k < 2*hDecoder->frameLength; k++)
+                hDecoder->prev_fmd[channel][k] = REAL_CONST(-1);
+        }
+    }
+#endif
+
+    return 0;
 }
 
-void reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics,
-                                element *sce, int16_t *spec_data)
+static uint8_t allocate_channel_pair(NeAACDecHandle hDecoder,
+                                     uint8_t channel, uint8_t paired_channel)
 {
-    real_t spec_coef[1024];
+    uint8_t mul = 1;
+
+#ifdef MAIN_DEC
+    /* MAIN object type prediction */
+    if (hDecoder->object_type == MAIN)
+    {
+        /* allocate the state only when needed */
+        if (hDecoder->pred_stat[channel] == NULL)
+        {
+            hDecoder->pred_stat[channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state));
+            reset_all_predictors(hDecoder->pred_stat[channel], hDecoder->frameLength);
+        }
+        if (hDecoder->pred_stat[paired_channel] == NULL)
+        {
+            hDecoder->pred_stat[paired_channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state));
+            reset_all_predictors(hDecoder->pred_stat[paired_channel], hDecoder->frameLength);
+        }
+    }
+#endif
+
+#ifdef LTP_DEC
+    if (is_ltp_ot(hDecoder->object_type))
+    {
+        /* allocate the state only when needed */
+        if (hDecoder->lt_pred_stat[channel] == NULL)
+        {
+            hDecoder->lt_pred_stat[channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t));
+            memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength*4 * sizeof(int16_t));
+        }
+        if (hDecoder->lt_pred_stat[paired_channel] == NULL)
+        {
+            hDecoder->lt_pred_stat[paired_channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t));
+            memset(hDecoder->lt_pred_stat[paired_channel], 0, hDecoder->frameLength*4 * sizeof(int16_t));
+        }
+    }
+#endif
+
+    if (hDecoder->time_out[channel] == NULL)
+    {
+        mul = 1;
+#ifdef SBR_DEC
+        hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0;
+        if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+        {
+            /* SBR requires 2 times as much output data */
+            mul = 2;
+            hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1;
+        }
+#endif
+        hDecoder->time_out[channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t));
+        memset(hDecoder->time_out[channel], 0, mul*hDecoder->frameLength*sizeof(real_t));
+    }
+    if (hDecoder->time_out[paired_channel] == NULL)
+    {
+        hDecoder->time_out[paired_channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t));
+        memset(hDecoder->time_out[paired_channel], 0, mul*hDecoder->frameLength*sizeof(real_t));
+    }
+
+    if (hDecoder->fb_intermed[channel] == NULL)
+    {
+        hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t));
+        memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength*sizeof(real_t));
+    }
+    if (hDecoder->fb_intermed[paired_channel] == NULL)
+    {
+        hDecoder->fb_intermed[paired_channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t));
+        memset(hDecoder->fb_intermed[paired_channel], 0, hDecoder->frameLength*sizeof(real_t));
+    }
 
-    /* inverse quantization */
-    inverse_quantization(spec_coef, spec_data, hDecoder->frameLength);
+#ifdef SSR_DEC
+    if (hDecoder->object_type == SSR)
+    {
+        if (hDecoder->ssr_overlap[cpe->channel] == NULL)
+        {
+            hDecoder->ssr_overlap[cpe->channel] = (real_t*)faad_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*)faad_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*)faad_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*)faad_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);
+        }
+    }
+#endif
+
+    return 0;
+}
+
+uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics,
+                                   element *sce, int16_t *spec_data)
+{
+    uint8_t retval, output_channels;
+    ALIGN real_t spec_coef[1024];
 
-    /* apply scalefactors */
-    apply_scalefactors(hDecoder, ics, spec_coef, hDecoder->frameLength);
+#ifdef PROFILE
+    int64_t count = faad_get_ts();
+#endif
+
+
+    /* always allocate 2 channels, PS can always "suddenly" turn up */
+#if (defined(PS_DEC) || defined(DRM_PS))
+    output_channels = 2;
+#else
+    output_channels = 1;
+#endif
 
-    /* deinterleave short block grouping */
-    if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
-        quant_to_spec(ics, spec_coef, hDecoder->frameLength);
+    if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0)
+    {
+        /* element_output_channels not set yet */
+        hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels;
+    } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != output_channels) {
+        /* element inconsistency */
+        return 21;
+    }
+
+    if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0)
+    {
+        retval = allocate_single_channel(hDecoder, sce->channel, output_channels);
+        if (retval > 0)
+            return retval;
+
+        hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1;
+    }
+
+
+    /* dequantisation and scaling */
+    retval = quant_to_spec(hDecoder, ics, spec_data, spec_coef, hDecoder->frameLength);
+    if (retval > 0)
+        return retval;
+
+#ifdef PROFILE
+    count = faad_get_ts() - count;
+    hDecoder->requant_cycles += count;
+#endif
 
 
     /* pns decoding */
@@ -653,13 +907,6 @@
     /* 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);
@@ -687,13 +934,6 @@
         }
 #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],
@@ -712,12 +952,6 @@
             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)
@@ -725,22 +959,10 @@
 #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);
+            hDecoder->time_out[sce->channel], hDecoder->fb_intermed[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],
@@ -755,30 +977,104 @@
     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);
+            hDecoder->fb_intermed[sce->channel], hDecoder->frameLength, hDecoder->object_type);
     }
 #endif
+
+#ifdef SBR_DEC
+    if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+        && hDecoder->sbr_alloced[hDecoder->fr_ch_ele])
+    {
+        uint8_t ele = hDecoder->fr_ch_ele;
+        uint8_t ch = sce->channel;
+
+        /* following case can happen when forceUpSampling == 1 */
+        if (hDecoder->sbr[ele] == NULL)
+        {
+            hDecoder->sbr[ele] = sbrDecodeInit(hDecoder->frameLength,
+                hDecoder->element_id[ele], 2*get_sample_rate(hDecoder->sf_index),
+                hDecoder->downSampledSBR
+#ifdef DRM
+                , 0
+#endif
+                );
+        }
+
+        if (sce->ics1.window_sequence == EIGHT_SHORT_SEQUENCE)
+            hDecoder->sbr[ele]->maxAACLine = 8*sce->ics1.swb_offset[max(sce->ics1.max_sfb-1, 0)];
+        else
+            hDecoder->sbr[ele]->maxAACLine = sce->ics1.swb_offset[max(sce->ics1.max_sfb-1, 0)];
+
+        /* check if any of the PS tools is used */
+#if (defined(PS_DEC) || defined(DRM_PS))
+        if (hDecoder->ps_used[ele] == 0)
+        {
+#endif
+            retval = sbrDecodeSingleFrame(hDecoder->sbr[ele], hDecoder->time_out[ch],
+                hDecoder->postSeekResetFlag, hDecoder->downSampledSBR);
+#if (defined(PS_DEC) || defined(DRM_PS))
+        } else {
+            retval = sbrDecodeSingleFramePS(hDecoder->sbr[ele], hDecoder->time_out[ch],
+                hDecoder->time_out[ch+1], hDecoder->postSeekResetFlag,
+                hDecoder->downSampledSBR);
+        }
+#endif
+        if (retval > 0)
+            return retval;
+    } else if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+        && !hDecoder->sbr_alloced[hDecoder->fr_ch_ele])
+    {
+        return 23;
+    }
+#endif
+
+    /* copy L to R when no PS is used */
+#if (defined(PS_DEC) || defined(DRM_PS))
+    if ((hDecoder->ps_used[hDecoder->fr_ch_ele] == 0))
+    {
+        uint8_t ele = hDecoder->fr_ch_ele;
+        uint8_t ch = sce->channel;
+        uint16_t frame_size = (hDecoder->sbr_alloced[ele]) ? 2 : 1;
+        frame_size *= hDecoder->frameLength*sizeof(real_t);
+
+        memcpy(hDecoder->time_out[ch+1], hDecoder->time_out[ch], frame_size);
+    }
+#endif
+
+    return 0;
 }
 
-void reconstruct_channel_pair(faacDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2,
-                              element *cpe, int16_t *spec_data1, int16_t *spec_data2)
+uint8_t reconstruct_channel_pair(NeAACDecHandle 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];
+    uint8_t retval;
+    ALIGN real_t spec_coef1[1024];
+    ALIGN real_t spec_coef2[1024];
 
-    /* inverse quantization */
-    inverse_quantization(spec_coef1, spec_data1, hDecoder->frameLength);
-    inverse_quantization(spec_coef2, spec_data2, hDecoder->frameLength);
+#ifdef PROFILE
+    int64_t count = faad_get_ts();
+#endif
+    if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0)
+    {
+        retval = allocate_channel_pair(hDecoder, cpe->channel, (uint8_t)cpe->paired_channel);
+        if (retval > 0)
+            return retval;
 
-    /* apply scalefactors */
-    apply_scalefactors(hDecoder, ics1, spec_coef1, hDecoder->frameLength);
-    apply_scalefactors(hDecoder, ics2, spec_coef2, hDecoder->frameLength);
+        hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1;
+    }
 
-    /* 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);
+    /* dequantisation and scaling */
+    retval = quant_to_spec(hDecoder, ics1, spec_data1, spec_coef1, hDecoder->frameLength);
+    if (retval > 0)
+        return retval;
+    retval = quant_to_spec(hDecoder, ics2, spec_data2, spec_coef2, hDecoder->frameLength);
+    if (retval > 0)
+        return retval;
+
+#ifdef PROFILE
+    count = faad_get_ts() - count;
+    hDecoder->requant_cycles += count;
+#endif
 
 
     /* pns decoding */
@@ -793,25 +1089,45 @@
     /* mid/side decoding */
     ms_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength);
 
+#if 0
+    {
+        int i;
+        for (i = 0; i < 1024; i++)
+        {
+            //printf("%d\n", spec_coef1[i]);
+            printf("0x%.8X\n", spec_coef1[i]);
+        }
+        for (i = 0; i < 1024; i++)
+        {
+            //printf("%d\n", spec_coef2[i]);
+            printf("0x%.8X\n", spec_coef2[i]);
+        }
+    }
+#endif
+
     /* intensity stereo decoding */
     is_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength);
 
+#if 0
+    {
+        int i;
+        for (i = 0; i < 1024; i++)
+        {
+            printf("%d\n", spec_coef1[i]);
+            //printf("0x%.8X\n", spec_coef1[i]);
+        }
+        for (i = 0; i < 1024; i++)
+        {
+            printf("%d\n", spec_coef2[i]);
+            //printf("0x%.8X\n", spec_coef2[i]);
+        }
+    }
+#endif
+
 #ifdef MAIN_DEC
     /* MAIN object type prediction */
     if (hDecoder->object_type == MAIN)
     {
-        /* 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);
@@ -831,7 +1147,7 @@
     if (is_ltp_ot(hDecoder->object_type))
     {
         ltp_info *ltp1 = &(ics1->ltp);
-        ltp_info *ltp2 = (cpe->common_window) ? &(ics2->ltp2) : &(ics2->ltp) ;
+        ltp_info *ltp2 = (cpe->common_window) ? &(ics2->ltp2) : &(ics2->ltp);
 #ifdef LD_DEC
         if (hDecoder->object_type == LD)
         {
@@ -850,18 +1166,6 @@
         }
 #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],
@@ -887,17 +1191,6 @@
             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)
@@ -905,37 +1198,14 @@
 #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);
+            hDecoder->time_out[cpe->channel], hDecoder->fb_intermed[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);
+            hDecoder->time_out[cpe->paired_channel], hDecoder->fb_intermed[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],
@@ -955,10 +1225,48 @@
     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);
+            hDecoder->fb_intermed[cpe->channel], 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);
+            hDecoder->fb_intermed[cpe->paired_channel], hDecoder->frameLength, hDecoder->object_type);
     }
 #endif
+
+#ifdef SBR_DEC
+    if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+        && hDecoder->sbr_alloced[hDecoder->fr_ch_ele])
+    {
+        uint8_t ele = hDecoder->fr_ch_ele;
+        uint8_t ch0 = cpe->channel;
+        uint8_t ch1 = cpe->paired_channel;
+
+        /* following case can happen when forceUpSampling == 1 */
+        if (hDecoder->sbr[ele] == NULL)
+        {
+            hDecoder->sbr[ele] = sbrDecodeInit(hDecoder->frameLength,
+                hDecoder->element_id[ele], 2*get_sample_rate(hDecoder->sf_index),
+                hDecoder->downSampledSBR
+#ifdef DRM
+                , 0
+#endif
+                );
+        }
+
+        if (cpe->ics1.window_sequence == EIGHT_SHORT_SEQUENCE)
+            hDecoder->sbr[ele]->maxAACLine = 8*cpe->ics1.swb_offset[max(cpe->ics1.max_sfb-1, 0)];
+        else
+            hDecoder->sbr[ele]->maxAACLine = cpe->ics1.swb_offset[max(cpe->ics1.max_sfb-1, 0)];
+
+        retval = sbrDecodeCoupleFrame(hDecoder->sbr[ele],
+            hDecoder->time_out[ch0], hDecoder->time_out[ch1],
+            hDecoder->postSeekResetFlag, hDecoder->downSampledSBR);
+        if (retval > 0)
+            return retval;
+    } else if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+        && !hDecoder->sbr_alloced[hDecoder->fr_ch_ele])
+    {
+        return 23;
+    }
+#endif
+
+    return 0;
 }
--- a/Plugins/Input/aac/libfaad2/specrec.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/specrec.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: specrec.h,v 1.20 2003/11/12 20:47:59 menno Exp $
+** $Id: specrec.h,v 1.28 2004/09/04 14:56:29 menno Exp $
 **/
 
 #ifndef __SPECREC_H__
@@ -34,18 +34,10 @@
 
 #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,
+uint8_t window_grouping_info(NeAACDecHandle hDecoder, ic_stream *ics);
+uint8_t reconstruct_channel_pair(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2,
+                                 element *cpe, int16_t *spec_data1, int16_t *spec_data2);
+uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics, element *sce,
                                 int16_t *spec_data);
 
 #ifdef __cplusplus
--- a/Plugins/Input/aac/libfaad2/ssr.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/ssr.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: ssr.c,v 1.10 2003/11/12 20:47:59 menno Exp $
+** $Id: ssr.c,v 1.15 2004/09/04 14:56:29 menno Exp $
 **/
 
 #include "common.h"
--- a/Plugins/Input/aac/libfaad2/ssr.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/ssr.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: ssr.h,v 1.10 2003/11/12 20:47:59 menno Exp $
+** $Id: ssr.h,v 1.15 2004/09/04 14:56:29 menno Exp $
 **/
 
 #ifndef __SSR_H__
--- a/Plugins/Input/aac/libfaad2/ssr_fb.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/ssr_fb.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: ssr_fb.c,v 1.8 2003/11/12 20:47:59 menno Exp $
+** $Id: ssr_fb.c,v 1.13 2004/09/04 14:56:29 menno Exp $
 **/
 
 #include "common.h"
@@ -42,7 +42,7 @@
 {
     uint16_t nshort = frame_len/8;
 
-    fb_info *fb = (fb_info*)malloc(sizeof(fb_info));
+    fb_info *fb = (fb_info*)faad_malloc(sizeof(fb_info));
     memset(fb, 0, sizeof(fb_info));
 
     /* normal */
@@ -62,7 +62,7 @@
     faad_mdct_end(fb->mdct256);
     faad_mdct_end(fb->mdct2048);
 
-    if (fb) free(fb);
+    if (fb) faad_free(fb);
 }
 
 static INLINE void imdct_ssr(fb_info *fb, real_t *in_data,
@@ -102,7 +102,7 @@
 
     uint16_t nflat_ls = (nlong-nshort)/2;
 
-    transf_buf = (real_t*)malloc(2*nlong*sizeof(real_t));
+    transf_buf = (real_t*)faad_malloc(2*nlong*sizeof(real_t));
 
     window_long       = fb->long_window[window_shape];
     window_long_prev  = fb->long_window[window_shape_prev];
@@ -175,7 +175,7 @@
 		break;
     }
 
-    free(transf_buf);
+    faad_free(transf_buf);
 }
 
 
--- a/Plugins/Input/aac/libfaad2/ssr_fb.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/ssr_fb.h	Wed Nov 16 16:21:11 2005 -0800
@@ -16,7 +16,7 @@
 ** along with this program; if not, write to the Free Software 
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
-** $Id: ssr_fb.h,v 1.8 2003/11/12 20:47:59 menno Exp $
+** $Id: ssr_fb.h,v 1.13 2004/09/04 14:56:29 menno Exp $
 **/
 
 #ifndef __SSR_FB_H__
--- a/Plugins/Input/aac/libfaad2/ssr_ipqf.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/ssr_ipqf.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: ssr_ipqf.c,v 1.9 2003/11/12 20:47:59 menno Exp $
+** $Id: ssr_ipqf.c,v 1.14 2004/09/04 14:56:29 menno Exp $
 **/
 
 #include "common.h"
--- a/Plugins/Input/aac/libfaad2/ssr_ipqf.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/ssr_ipqf.h	Wed Nov 16 16:21:11 2005 -0800
@@ -16,7 +16,7 @@
 ** along with this program; if not, write to the Free Software 
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
-** $Id: ssr_ipqf.h,v 1.9 2003/11/12 20:47:59 menno Exp $
+** $Id: ssr_ipqf.h,v 1.14 2004/09/04 14:56:29 menno Exp $
 **/
 
 #ifndef __SSR_IPQF_H__
--- a/Plugins/Input/aac/libfaad2/ssr_win.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/ssr_win.h	Wed Nov 16 16:21:11 2005 -0800
@@ -16,7 +16,7 @@
 ** along with this program; if not, write to the Free Software 
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
-** $Id: ssr_win.h,v 1.8 2003/11/12 20:47:59 menno Exp $
+** $Id: ssr_win.h,v 1.13 2004/09/04 14:56:29 menno Exp $
 **/
 
 #ifndef __SSR_WIN_H__
--- a/Plugins/Input/aac/libfaad2/structs.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/structs.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,19 +1,19 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
-**  
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
+**
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
 ** the Free Software Foundation; either version 2 of the License, or
 ** (at your option) any later version.
-** 
+**
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ** GNU General Public License for more details.
-** 
+**
 ** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software 
+** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
 ** Any non-GPL usage of this software or parts of this software is strictly
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: structs.h,v 1.21 2003/11/12 20:47:59 menno Exp $
+** $Id: structs.h,v 1.42 2004/09/08 09:43:11 gcp Exp $
 **/
 
 #ifndef __STRUCTS_H__
@@ -55,14 +55,18 @@
     uint16_t N;
     cfft_info *cfft;
     complex_t *sincos;
+#ifdef PROFILE
+    int64_t cycles;
+    int64_t fft_cycles;
+#endif
 } mdct_info;
 
 typedef struct
 {
-    real_t *long_window[2];
-    real_t *short_window[2];
+    const real_t *long_window[2];
+    const real_t *short_window[2];
 #ifdef LD_DEC
-    real_t *ld_window[2];
+    const real_t *ld_window[2];
 #endif
 
     mdct_info *mdct256;
@@ -70,6 +74,9 @@
     mdct_info *mdct1024;
 #endif
     mdct_info *mdct2048;
+#ifdef PROFILE
+    int64_t cycles;
+#endif
 } fb_info;
 
 typedef struct
@@ -172,6 +179,7 @@
     program_config pce[16];
 } adif_header;
 
+#ifdef LTP_DEC
 typedef struct
 {
     uint8_t last_band;
@@ -184,7 +192,9 @@
     uint8_t short_lag_present[8];
     uint8_t short_lag[8];
 } ltp_info;
+#endif
 
+#ifdef MAIN_DEC
 typedef struct
 {
     uint8_t limit;
@@ -192,6 +202,7 @@
     uint8_t predictor_reset_group_number;
     uint8_t prediction_used[MAX_SFB];
 } pred_info;
+#endif
 
 typedef struct
 {
@@ -258,9 +269,13 @@
 
     pulse_info pul;
     tns_info tns;
+#ifdef MAIN_DEC
     pred_info pred;
+#endif
+#ifdef LTP_DEC
     ltp_info ltp;
     ltp_info ltp2;
+#endif
 #ifdef SSR_DEC
     ssr_info ssr;
 #endif
@@ -282,8 +297,6 @@
 
 typedef struct
 {
-    uint8_t ele_id;
-
     uint8_t channel;
     int16_t paired_channel;
 
@@ -297,58 +310,63 @@
 typedef struct mp4AudioSpecificConfig
 {
     /* Audio Specific Info */
-    uint8_t objectTypeIndex;
-    uint8_t samplingFrequencyIndex;
-    uint32_t samplingFrequency;
-    uint8_t channelsConfiguration;
+    /*uint8_t*/ unsigned char objectTypeIndex;
+    /*uint8_t*/ unsigned char samplingFrequencyIndex;
+    /*uint32_t*/ unsigned long samplingFrequency;
+    /*uint8_t*/ unsigned char channelsConfiguration;
 
     /* GA Specific Info */
-    uint8_t frameLengthFlag;
-    uint8_t dependsOnCoreCoder;
-    uint16_t coreCoderDelay;
-    uint8_t extensionFlag;
-    uint8_t aacSectionDataResilienceFlag;
-    uint8_t aacScalefactorDataResilienceFlag;
-    uint8_t aacSpectralDataResilienceFlag;
-    uint8_t epConfig;
+    /*uint8_t*/ unsigned char frameLengthFlag;
+    /*uint8_t*/ unsigned char dependsOnCoreCoder;
+    /*uint16_t*/ unsigned short coreCoderDelay;
+    /*uint8_t*/ unsigned char extensionFlag;
+    /*uint8_t*/ unsigned char aacSectionDataResilienceFlag;
+    /*uint8_t*/ unsigned char aacScalefactorDataResilienceFlag;
+    /*uint8_t*/ unsigned char aacSpectralDataResilienceFlag;
+    /*uint8_t*/ unsigned char epConfig;
 
-    int8_t sbr_present_flag;
-    int8_t forceUpSampling;
+    /*uint8_t*/ char sbr_present_flag;
+    /*uint8_t*/ char forceUpSampling;
+    /*uint8_t*/ char downSampledSBR;
 } mp4AudioSpecificConfig;
 
-typedef struct faacDecConfiguration
+typedef struct NeAACDecConfiguration
 {
-    uint8_t defObjectType;
-    uint32_t defSampleRate;
-    uint8_t outputFormat;
-    uint8_t downMatrix;
-    uint8_t useOldADTSFormat;
-} faacDecConfiguration, *faacDecConfigurationPtr;
+    /*uint8_t*/ unsigned char defObjectType;
+    /*uint32_t*/ unsigned long defSampleRate;
+    /*uint8_t*/ unsigned char outputFormat;
+    /*uint8_t*/ unsigned char downMatrix;
+    /*uint8_t*/ unsigned char useOldADTSFormat;
+    /*uint8_t*/ unsigned char dontUpSampleImplicitSBR;
+} NeAACDecConfiguration, *NeAACDecConfigurationPtr;
 
-typedef struct faacDecFrameInfo
+typedef struct NeAACDecFrameInfo
 {
-    uint32_t bytesconsumed;
-    uint32_t samples;
-    uint8_t channels;
-    uint8_t error;
-    uint32_t samplerate;
+    /*uint32_t*/ unsigned long bytesconsumed;
+    /*uint32_t*/ unsigned long samples;
+    /*uint8_t*/ unsigned char channels;
+    /*uint8_t*/ unsigned char error;
+    /*uint32_t*/ unsigned long samplerate;
 
     /* SBR: 0: off, 1: on; normal, 2: on; downsampled */
-    uint8_t sbr;
+    /*uint8_t*/ unsigned char sbr;
 
     /* MPEG-4 ObjectType */
-    uint8_t object_type;
+    /*uint8_t*/ unsigned char object_type;
 
     /* AAC header type; MP4 will be signalled as RAW also */
-    uint8_t header_type;
+    /*uint8_t*/ unsigned char header_type;
 
     /* multichannel configuration */
-    uint8_t num_front_channels;
-    uint8_t num_side_channels;
-    uint8_t num_back_channels;
-    uint8_t num_lfe_channels;
-    uint8_t channel_position[MAX_CHANNELS];
-} faacDecFrameInfo;
+    /*uint8_t*/ unsigned char num_front_channels;
+    /*uint8_t*/ unsigned char num_side_channels;
+    /*uint8_t*/ unsigned char num_back_channels;
+    /*uint8_t*/ unsigned char num_lfe_channels;
+    /*uint8_t*/ unsigned char channel_position[MAX_CHANNELS];
+
+    /* PS: 0: off, 1: on */
+    /*uint8_t*/ unsigned char ps;
+} NeAACDecFrameInfo;
 
 typedef struct
 {
@@ -368,11 +386,28 @@
     uint32_t frame;
 
     uint8_t downMatrix;
+    uint8_t upMatrix;
     uint8_t first_syn_ele;
     uint8_t has_lfe;
+    /* number of channels in current frame */
     uint8_t fr_channels;
+    /* number of elements in current frame */
     uint8_t fr_ch_ele;
 
+    /* element_output_channels:
+       determines the number of channels the element will output
+    */
+    uint8_t element_output_channels[MAX_SYNTAX_ELEMENTS];
+    /* element_alloced:
+       determines whether the data needed for the element is allocated or not
+    */
+    uint8_t element_alloced[MAX_SYNTAX_ELEMENTS];
+    /* alloced_channels:
+       determines the number of channels where output data is allocated for
+    */
+    uint8_t alloced_channels;
+
+    /* output data buffer */
     void *sample_buffer;
 
     uint8_t window_shape_prev[MAX_CHANNELS];
@@ -383,19 +418,20 @@
     drc_info *drc;
 
     real_t *time_out[MAX_CHANNELS];
+    real_t *fb_intermed[MAX_CHANNELS];
 
 #ifdef SBR_DEC
     int8_t sbr_present_flag;
     int8_t forceUpSampling;
-
-    real_t *time_out2[MAX_CHANNELS];
-
-    uint8_t sbr_used[32];
+    int8_t downSampledSBR;
+    /* determines whether SBR data is allocated for the gives element */
+    uint8_t sbr_alloced[MAX_SYNTAX_ELEMENTS];
 
-    sbr_info *sbr[32];
-#ifdef DRM
-    int8_t lcstereo_flag;
+    sbr_info *sbr[MAX_SYNTAX_ELEMENTS];
 #endif
+#if (defined(PS_DEC) || defined(DRM_PS))
+    uint8_t ps_used[MAX_SYNTAX_ELEMENTS];
+    uint8_t ps_used_global;
 #endif
 
 #ifdef SSR_DEC
@@ -411,22 +447,23 @@
     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;
+    NeAACDecConfiguration config;
+
+#ifdef PROFILE
+    int64_t cycles;
+    int64_t spectral_cycles;
+    int64_t output_cycles;
+    int64_t scalefac_cycles;
+    int64_t requant_cycles;
+#endif
+} NeAACDecStruct, *NeAACDecHandle;
 
 
 
--- a/Plugins/Input/aac/libfaad2/syntax.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/syntax.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: syntax.c,v 1.61 2003/11/12 20:47:59 menno Exp $
+** $Id: syntax.c,v 1.82 2004/09/04 14:56:29 menno Exp $
 **/
 
 /*
@@ -51,6 +51,54 @@
 #endif
 
 
+/* static function declarations */
+static void decode_sce_lfe(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld,
+                           uint8_t id_syn_ele);
+static void decode_cpe(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld,
+                       uint8_t id_syn_ele);
+static uint8_t single_lfe_channel_element(NeAACDecHandle hDecoder, bitfile *ld,
+                                          uint8_t channel, uint8_t *tag);
+static uint8_t channel_pair_element(NeAACDecHandle hDecoder, bitfile *ld,
+                                    uint8_t channel, uint8_t *tag);
+#ifdef COUPLING_DEC
+static uint8_t coupling_channel_element(NeAACDecHandle hDecoder, bitfile *ld);
+#endif
+static uint16_t data_stream_element(NeAACDecHandle hDecoder, bitfile *ld);
+static uint8_t program_config_element(program_config *pce, bitfile *ld);
+static uint8_t fill_element(NeAACDecHandle hDecoder, bitfile *ld, drc_info *drc
+#ifdef SBR_DEC
+                            ,uint8_t sbr_ele
+#endif
+                            );
+static uint8_t individual_channel_stream(NeAACDecHandle hDecoder, element *ele,
+                                         bitfile *ld, ic_stream *ics, uint8_t scal_flag,
+                                         int16_t *spec_data);
+static uint8_t ics_info(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld,
+                        uint8_t common_window);
+static uint8_t section_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld);
+static uint8_t scale_factor_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld);
+#ifdef SSR_DEC
+static void gain_control_data(bitfile *ld, ic_stream *ics);
+#endif
+static uint8_t spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld,
+                             int16_t *spectral_data);
+static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count);
+static uint8_t pulse_data(ic_stream *ics, pulse_info *pul, bitfile *ld);
+static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld);
+#ifdef LTP_DEC
+static uint8_t ltp_data(NeAACDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld);
+#endif
+static uint8_t adts_fixed_header(adts_header *adts, bitfile *ld);
+static void adts_variable_header(adts_header *adts, bitfile *ld);
+static void adts_error_check(adts_header *adts, bitfile *ld);
+static uint8_t dynamic_range_info(bitfile *ld, drc_info *drc);
+static uint8_t excluded_channels(bitfile *ld, drc_info *drc);
+#ifdef SCALABLE_DEC
+static int8_t aac_scalable_main_header(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2,
+                                       bitfile *ld, uint8_t this_layer_stereo);
+#endif
+
+
 /* Table 4.4.1 */
 int8_t GASpecificConfig(bitfile *ld, mp4AudioSpecificConfig *mp4ASC,
                         program_config *pce_out)
@@ -76,7 +124,8 @@
     mp4ASC->extensionFlag = faad_get1bit(ld DEBUGVAR(1,141,"GASpecificConfig(): ExtensionFlag"));
     if (mp4ASC->channelsConfiguration == 0)
     {
-        program_config_element(&pce, ld);
+        if (program_config_element(&pce, ld))
+            return -3;
         //mp4ASC->channelsConfiguration = pce.channels;
 
         if (pce_out != NULL)
@@ -116,7 +165,7 @@
    PCEs transmitted in raw data blocks cannot be used to convey decoder
    configuration information.
 */
-uint8_t program_config_element(program_config *pce, bitfile *ld)
+static uint8_t program_config_element(program_config *pce, bitfile *ld)
 {
     uint8_t i;
 
@@ -261,12 +310,15 @@
     }
     pce->comment_field_data[i] = 0;
 
+    if (pce->channels > MAX_CHANNELS)
+        return 22;
+
     return 0;
 }
 
-void decode_sce_lfe(faacDecHandle hDecoder,
-                    faacDecFrameInfo *hInfo, bitfile *ld,
-                    uint8_t id_syn_ele)
+static void decode_sce_lfe(NeAACDecHandle hDecoder,
+                           NeAACDecFrameInfo *hInfo, bitfile *ld,
+                           uint8_t id_syn_ele)
 {
     uint8_t channels = hDecoder->fr_channels;
     uint8_t tag = 0;
@@ -282,25 +334,35 @@
         return;
     }
 
+    /* for SCE hDecoder->element_output_channels[] is not set here because this
+       can become 2 when some form of Parametric Stereo coding is used
+    */
+
+    /* save the syntax element id */
+    hDecoder->element_id[hDecoder->fr_ch_ele] = id_syn_ele;
+
+    /* decode the element */
     hInfo->error = single_lfe_channel_element(hDecoder, ld, channels, &tag);
 
-    if (hDecoder->pce_set)
-        hDecoder->internal_channel[hDecoder->pce.sce_channel[tag]] = channels;
-    else
+    /* map output channels position to internal data channels */
+    if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 2)
+    {
+        /* this might be faulty when pce_set is true */
         hDecoder->internal_channel[channels] = channels;
+        hDecoder->internal_channel[channels+1] = channels+1;
+    } else {
+        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_channels += hDecoder->element_output_channels[hDecoder->fr_ch_ele];
     hDecoder->fr_ch_ele++;
 }
 
-void decode_cpe(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld,
-                uint8_t id_syn_ele)
+static void decode_cpe(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld,
+                       uint8_t id_syn_ele)
 {
     uint8_t channels = hDecoder->fr_channels;
     uint8_t tag = 0;
@@ -316,8 +378,24 @@
         return;
     }
 
+    /* for CPE the number of output channels is always 2 */
+    if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0)
+    {
+        /* element_output_channels not set yet */
+        hDecoder->element_output_channels[hDecoder->fr_ch_ele] = 2;
+    } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != 2) {
+        /* element inconsistency */
+        hInfo->error = 21;
+        return;
+    }
+
+    /* save the syntax element id */
+    hDecoder->element_id[hDecoder->fr_ch_ele] = id_syn_ele;
+
+    /* decode the element */
     hInfo->error = channel_pair_element(hDecoder, ld, channels, &tag);
 
+    /* map output channel position to internal data channels */
     if (hDecoder->pce_set)
     {
         hDecoder->internal_channel[hDecoder->pce.cpe_channel[tag]] = channels;
@@ -327,19 +405,14 @@
         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,
+void raw_data_block(NeAACDecHandle hDecoder, NeAACDecFrameInfo *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;
@@ -352,27 +425,24 @@
 #endif
         /* Table 4.4.3: raw_data_block() */
         while ((id_syn_ele = (uint8_t)faad_getbits(ld, LEN_SE_ID
-            DEBUGVAR(1,4,"faacDecDecode(): id_syn_ele"))) != ID_END)
+            DEBUGVAR(1,4,"NeAACDecDecode(): id_syn_ele"))) != ID_END)
         {
             switch (id_syn_ele) {
             case ID_SCE:
                 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;
@@ -389,26 +459,23 @@
                 data_stream_element(hDecoder, ld);
                 break;
             case ID_PCE:
-                if ((hInfo->error = program_config_element(pce, ld)) > 0)
-                    return;
-                hDecoder->pce_set = 1;
+                /* 14496-4: 5.6.4.1.2.1.3: */
+                /* program_configuration_element()'s in access units shall be ignored */
+                program_config_element(pce, ld);
+                //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 we encounter SBR data here: error */
+                /* SBR data will be read directly in the SCE/LFE/CPE element */
                 if ((hInfo->error = fill_element(hDecoder, ld, drc
 #ifdef SBR_DEC
-                    , (ch_ele-1)
+                    , INVALID_SBR_ELEMENT
 #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;
             }
         }
@@ -419,67 +486,48 @@
         {
         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:
+        case 7: /* 8 channels */
             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);
             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;
@@ -510,18 +558,14 @@
 
 /* Table 4.4.4 and */
 /* Table 4.4.9 */
-static uint8_t single_lfe_channel_element(faacDecHandle hDecoder, bitfile *ld,
+static uint8_t single_lfe_channel_element(NeAACDecHandle hDecoder, bitfile *ld,
                                           uint8_t channel, uint8_t *tag)
 {
     uint8_t retval = 0;
     element sce = {0};
     ic_stream *ics = &(sce.ics1);
-    int16_t spec_data[1024] = {0};
-#ifdef DRM
-    uint8_t result;
+    ALIGN int16_t spec_data[1024] = {0};
 
-    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"));
 
@@ -529,52 +573,39 @@
     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;
+    retval = individual_channel_stream(hDecoder, &sce, ld, ics, 0, spec_data);
+    if (retval > 0)
+        return retval;
 
-        /* pulse coding reconstruction */
-        if (ics->pulse_data_present)
+#ifdef SBR_DEC
+    /* check if next bitstream element is a fill element */
+    /* if so, read it now so SBR decoding can be done in case of a file with SBR */
+    if (faad_showbits(ld, LEN_SE_ID) == ID_FIL)
+    {
+        faad_flushbits(ld, LEN_SE_ID);
+
+        /* one sbr_info describes a channel_element not a channel! */
+        if ((retval = fill_element(hDecoder, ld, hDecoder->drc, hDecoder->fr_ch_ele)) > 0)
         {
-            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 retval;
         }
-    } 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);
+    retval = reconstruct_single_channel(hDecoder, ics, &sce, spec_data);
+    if (retval > 0)
+        return retval;
 
     return 0;
 }
 
 /* Table 4.4.5 */
-static uint8_t channel_pair_element(faacDecHandle hDecoder, bitfile *ld,
+static uint8_t channel_pair_element(NeAACDecHandle hDecoder, bitfile *ld,
                                     uint8_t channels, uint8_t *tag)
 {
-    int16_t spec_data1[1024] = {0};
-    int16_t spec_data2[1024] = {0};
+    ALIGN int16_t spec_data1[1024] = {0};
+    ALIGN int16_t spec_data2[1024] = {0};
     element cpe = {0};
     ic_stream *ics1 = &(cpe.ics1);
     ic_stream *ics2 = &(cpe.ics2);
@@ -583,9 +614,6 @@
     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;
@@ -615,10 +643,20 @@
 #ifdef ERROR_RESILIENCE
         if ((hDecoder->object_type >= ER_OBJECT_START) && (ics1->predictor_data_present))
         {
-            if ((ics1->ltp.data_present = faad_get1bit(ld
-                DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1)
+            if ((
+#ifdef LTP_DEC
+                ics1->ltp.data_present =
+#endif
+                faad_get1bit(ld DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1)
             {
-                ltp_data(hDecoder, ics1, &(ics1->ltp), ld);
+#ifdef LTP_DEC
+                if ((result = ltp_data(hDecoder, ics1, &(ics1->ltp), ld)) > 0)
+                {
+                    return result;
+                }
+#else
+                return 26;
+#endif
             }
         }
 #endif
@@ -638,10 +676,20 @@
     if (cpe.common_window && (hDecoder->object_type >= ER_OBJECT_START) &&
         (ics1->predictor_data_present))
     {
-        if ((ics1->ltp2.data_present = faad_get1bit(ld
-            DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1)
+        if ((
+#ifdef LTP_DEC
+            ics1->ltp2.data_present =
+#endif
+            faad_get1bit(ld DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1)
         {
-            ltp_data(hDecoder, ics1, &(ics1->ltp2), ld);
+#ifdef LTP_DEC
+            if ((result = ltp_data(hDecoder, ics1, &(ics1->ltp2), ld)) > 0)
+            {
+                return result;
+            }
+#else
+            return 26;
+#endif
         }
     }
 #endif
@@ -652,55 +700,33 @@
         return result;
     }
 
-#ifdef DRM
-    if (hDecoder->object_type == DRM_ER_LC)
+#ifdef SBR_DEC
+    /* check if next bitstream element is a fill element */
+    /* if so, read it now so SBR decoding can be done in case of a file with SBR */
+    if (faad_showbits(ld, LEN_SE_ID) == ID_FIL)
     {
-        if (ics1->tns_data_present)
-            tns_data(ics1, &(ics1->tns), ld);
+        faad_flushbits(ld, LEN_SE_ID);
 
-        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)
+        /* one sbr_info describes a channel_element not a channel! */
+        if ((result = fill_element(hDecoder, ld, hDecoder->drc, hDecoder->fr_ch_ele)) > 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);
+    if ((result = reconstruct_channel_pair(hDecoder, ics1, ics2, &cpe,
+        spec_data1, spec_data2)) > 0)
+    {
+        return result;
+    }
 
     return 0;
 }
 
 /* Table 4.4.6 */
-static uint8_t ics_info(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld,
+static uint8_t ics_info(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld,
                         uint8_t common_window)
 {
     uint8_t retval = 0;
@@ -741,19 +767,29 @@
             {
                 uint8_t sfb;
 
-                ics->pred.limit = min(ics->max_sfb, max_pred_sfb(hDecoder->sf_index));
+                uint8_t limit = min(ics->max_sfb, max_pred_sfb(hDecoder->sf_index));
+#ifdef MAIN_DEC
+                ics->pred.limit = limit;
+#endif
 
-                if ((ics->pred.predictor_reset = faad_get1bit(ld
-                    DEBUGVAR(1,53,"ics_info(): pred.predictor_reset"))) & 1)
+                if ((
+#ifdef MAIN_DEC
+                    ics->pred.predictor_reset =
+#endif
+                    faad_get1bit(ld DEBUGVAR(1,53,"ics_info(): pred.predictor_reset"))) & 1)
                 {
-                    ics->pred.predictor_reset_group_number = (uint8_t)faad_getbits(ld, 5
-                        DEBUGVAR(1,54,"ics_info(): pred.predictor_reset_group_number"));
+#ifdef MAIN_DEC
+                    ics->pred.predictor_reset_group_number =
+#endif
+                        (uint8_t)faad_getbits(ld, 5 DEBUGVAR(1,54,"ics_info(): pred.predictor_reset_group_number"));
                 }
 
-                for (sfb = 0; sfb < ics->pred.limit; sfb++)
+                for (sfb = 0; sfb < limit; sfb++)
                 {
-                    ics->pred.prediction_used[sfb] = faad_get1bit(ld
-                        DEBUGVAR(1,55,"ics_info(): pred.prediction_used"));
+#ifdef MAIN_DEC
+                    ics->pred.prediction_used[sfb] =
+#endif
+                        faad_get1bit(ld DEBUGVAR(1,55,"ics_info(): pred.prediction_used"));
                 }
             }
 #ifdef LTP_DEC
@@ -763,14 +799,20 @@
                     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 ((retval = ltp_data(hDecoder, ics, &(ics->ltp), ld)) > 0)
+                        {
+                            return retval;
+                        }
                     }
                     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);
+                            if ((retval = ltp_data(hDecoder, ics, &(ics->ltp2), ld)) > 0)
+                            {
+                                return retval;
+                            }
                         }
                     }
                 }
@@ -810,8 +852,14 @@
     {
         pul->pulse_offset[i] = (uint8_t)faad_getbits(ld, 5
             DEBUGVAR(1,58,"pulse_data(): pulse_offset"));
+#if 0
+        printf("%d\n", pul->pulse_offset[i]);
+#endif
         pul->pulse_amp[i] = (uint8_t)faad_getbits(ld, 4
             DEBUGVAR(1,59,"pulse_data(): pulse_amp"));
+#if 0
+        printf("%d\n", pul->pulse_amp[i]);
+#endif
     }
 
     return 0;
@@ -819,7 +867,7 @@
 
 #ifdef COUPLING_DEC
 /* Table 4.4.8: Currently just for skipping the bits... */
-static uint8_t coupling_channel_element(faacDecHandle hDecoder, bitfile *ld)
+static uint8_t coupling_channel_element(NeAACDecHandle hDecoder, bitfile *ld)
 {
     uint8_t c, result = 0;
     uint8_t ind_sw_cce_flag = 0;
@@ -908,7 +956,7 @@
 #endif
 
 /* Table 4.4.10 */
-static uint16_t data_stream_element(faacDecHandle hDecoder, bitfile *ld)
+static uint16_t data_stream_element(NeAACDecHandle hDecoder, bitfile *ld)
 {
     uint8_t byte_aligned;
     uint16_t i, count;
@@ -929,7 +977,7 @@
 
     for (i = 0; i < count; i++)
     {
-        uint8_t data = faad_getbits(ld, LEN_BYTE
+        faad_getbits(ld, LEN_BYTE
             DEBUGVAR(1,64,"data_stream_element(): data_stream_byte"));
     }
 
@@ -937,7 +985,7 @@
 }
 
 /* Table 4.4.11 */
-static uint8_t fill_element(faacDecHandle hDecoder, bitfile *ld, drc_info *drc
+static uint8_t fill_element(NeAACDecHandle hDecoder, bitfile *ld, drc_info *drc
 #ifdef SBR_DEC
                             ,uint8_t sbr_ele
 #endif
@@ -959,30 +1007,47 @@
     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 (sbr_ele == INVALID_SBR_ELEMENT)
+                return 24;
 
             if (!hDecoder->sbr[sbr_ele])
             {
-                hDecoder->sbr[sbr_ele] = sbrDecodeInit(hDecoder->frameLength
+                hDecoder->sbr[sbr_ele] = sbrDecodeInit(hDecoder->frameLength,
+                    hDecoder->element_id[sbr_ele], 2*get_sample_rate(hDecoder->sf_index),
+                    hDecoder->downSampledSBR
 #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];
+            hDecoder->sbr_present_flag = 1;
+
+            /* parse the SBR data */
+            hDecoder->sbr[sbr_ele]->ret = sbr_extension_data(ld, hDecoder->sbr[sbr_ele], count);
+
+#if 0
+            if (hDecoder->sbr[sbr_ele]->ret > 0)
+            {
+                printf("%s\n", NeAACDecGetErrorMessage(hDecoder->sbr[sbr_ele]->ret));
+            }
+#endif
+
+#if (defined(PS_DEC) || defined(DRM_PS))
+            if (hDecoder->sbr[sbr_ele]->ps_used)
+            {
+                hDecoder->ps_used[sbr_ele] = 1;
+
+                /* set element independent flag to 1 as well */
+                hDecoder->ps_used_global = 1;
+            }
+#endif
         } else {
-            hDecoder->sbr_used[sbr_ele] = 0;
 #endif
             while (count > 0)
             {
@@ -1092,8 +1157,275 @@
 }
 #endif
 
+#ifdef SCALABLE_DEC
+/* Table 4.4.13 ASME */
+void aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
+                               bitfile *ld, program_config *pce, drc_info *drc)
+{
+    uint8_t retval = 0;
+    uint8_t channels = hDecoder->fr_channels = 0;
+    uint8_t ch;
+    uint8_t this_layer_stereo = (hDecoder->channelConfiguration > 1) ? 1 : 0;
+    element cpe = {0};
+    ic_stream *ics1 = &(cpe.ics1);
+    ic_stream *ics2 = &(cpe.ics2);
+    int16_t *spec_data;
+    ALIGN int16_t spec_data1[1024] = {0};
+    ALIGN int16_t spec_data2[1024] = {0};
+
+    hDecoder->fr_ch_ele = 0;
+
+    hInfo->error = aac_scalable_main_header(hDecoder, ics1, ics2, ld, this_layer_stereo);
+    if (hInfo->error > 0)
+        return;
+
+    cpe.common_window = 1;
+    if (this_layer_stereo)
+    {
+        hDecoder->element_id[0] = ID_CPE;
+        if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0)
+            hDecoder->element_output_channels[hDecoder->fr_ch_ele] = 2;
+    } else {
+        hDecoder->element_id[0] = ID_SCE;
+    }
+
+    for (ch = 0; ch < (this_layer_stereo ? 2 : 1); ch++)
+    {
+        ic_stream *ics;
+        if (ch == 0)
+        {
+            ics = ics1;
+            spec_data = spec_data1;
+        } else {
+            ics = ics2;
+            spec_data = spec_data2;
+        }
+
+        hInfo->error = individual_channel_stream(hDecoder, &cpe, ld, ics, 1, spec_data);
+        if (hInfo->error > 0)
+            return;
+    }
+
+#ifdef DRM
+#ifdef SBR_DEC
+    /* In case of DRM we need to read the SBR info before channel reconstruction */
+    if ((hDecoder->sbr_present_flag == 1) && (hDecoder->object_type == DRM_ER_LC))
+    {
+        bitfile ld_sbr = {0};
+        uint32_t i;
+        uint16_t count = 0;
+        uint8_t *revbuffer;
+        uint8_t *prevbufstart;
+        uint8_t *pbufend;
+
+        /* all forward bitreading should be finished at this point */
+        uint32_t bitsconsumed = faad_get_processed_bits(ld);
+        uint32_t buffer_size = faad_origbitbuffer_size(ld);
+        uint8_t *buffer = (uint8_t*)faad_origbitbuffer(ld);
+
+        if (bitsconsumed + 8 > buffer_size*8)
+        {
+            hInfo->error = 14;
+            return;
+        }
+
+        if (!hDecoder->sbr[0])
+        {
+            hDecoder->sbr[0] = sbrDecodeInit(hDecoder->frameLength, hDecoder->element_id[0],
+                2*get_sample_rate(hDecoder->sf_index), 0 /* ds SBR */, 1);
+        }
+
+        /* Reverse bit reading of SBR data in DRM audio frame */
+        revbuffer = (uint8_t*)faad_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 */
+        /* consider 8 bits from AAC-CRC */
+        count = (uint16_t)bit2byte(buffer_size*8 - bitsconsumed);
+        faad_initbits(&ld_sbr, revbuffer, count);
+
+        hDecoder->sbr[0]->sample_rate = get_sample_rate(hDecoder->sf_index);
+        hDecoder->sbr[0]->sample_rate *= 2;
+
+        faad_getbits(&ld_sbr, 8); /* Skip 8-bit CRC */
+
+        hDecoder->sbr[0]->ret = sbr_extension_data(&ld_sbr, hDecoder->sbr[0], count);
+#if (defined(PS_DEC) || defined(DRM_PS))
+        if (hDecoder->sbr[0]->ps_used)
+        {
+            hDecoder->ps_used[0] = 1;
+            hDecoder->ps_used_global = 1;
+        }
+#endif
+
+        /* check CRC */
+        /* no need to check it if there was already an error */
+        if (hDecoder->sbr[0]->ret == 0)
+            hDecoder->sbr[0]->ret = (uint8_t)faad_check_CRC(&ld_sbr, (uint16_t)faad_get_processed_bits(&ld_sbr) - 8);
+
+        /* SBR data was corrupted, disable it until the next header */
+        if (hDecoder->sbr[0]->ret != 0)
+        {
+            hDecoder->sbr[0]->header_count = 0;  
+        }
+
+        faad_endbits(&ld_sbr);
+
+        if (revbuffer)
+            faad_free(revbuffer);
+    }
+#endif
+#endif
+
+    if (this_layer_stereo)
+    {
+        hInfo->error = reconstruct_channel_pair(hDecoder, ics1, ics2, &cpe, spec_data1, spec_data2);
+        if (hInfo->error > 0)
+            return;
+    } else {
+        hInfo->error = reconstruct_single_channel(hDecoder, ics1, &cpe, spec_data1);
+        if (hInfo->error > 0)
+            return;
+    }
+
+    /* map output channels position to internal data channels */
+    if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 2)
+    {
+        /* this might be faulty when pce_set is true */
+        hDecoder->internal_channel[channels] = channels;
+        hDecoder->internal_channel[channels+1] = channels+1;
+    } else {
+        hDecoder->internal_channel[channels] = channels;
+    }
+
+    hDecoder->fr_channels += hDecoder->element_output_channels[hDecoder->fr_ch_ele];
+    hDecoder->fr_ch_ele++;
+
+    return;
+}
+
+/* Table 4.4.15 */
+static int8_t aac_scalable_main_header(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2,
+                                       bitfile *ld, uint8_t this_layer_stereo)
+{
+    uint8_t retval = 0;
+    uint8_t ch;
+    ic_stream *ics;
+
+    /* ics1->ics_reserved_bit = */ faad_get1bit(ld
+        DEBUGVAR(1,300,"aac_scalable_main_header(): ics_reserved_bits"));
+    ics1->window_sequence = (uint8_t)faad_getbits(ld, 2
+        DEBUGVAR(1,301,"aac_scalable_main_header(): window_sequence"));
+    ics1->window_shape = faad_get1bit(ld
+        DEBUGVAR(1,302,"aac_scalable_main_header(): window_shape"));
+
+    if (ics1->window_sequence == EIGHT_SHORT_SEQUENCE)
+    {
+        ics1->max_sfb = (uint8_t)faad_getbits(ld, 4
+            DEBUGVAR(1,303,"aac_scalable_main_header(): max_sfb (short)"));
+        ics1->scale_factor_grouping = (uint8_t)faad_getbits(ld, 7
+            DEBUGVAR(1,304,"aac_scalable_main_header(): scale_factor_grouping"));
+    } else {
+        ics1->max_sfb = (uint8_t)faad_getbits(ld, 6
+            DEBUGVAR(1,305,"aac_scalable_main_header(): max_sfb (long)"));
+    }
+
+    /* get the grouping information */
+    if ((retval = window_grouping_info(hDecoder, ics1)) > 0)
+        return retval;
+
+    /* should be an error */
+    /* check the range of max_sfb */
+    if (ics1->max_sfb > ics1->num_swb)
+        return 16;
+
+    if (this_layer_stereo)
+    {
+        ics1->ms_mask_present = (uint8_t)faad_getbits(ld, 2
+            DEBUGVAR(1,306,"aac_scalable_main_header(): 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,307,"aac_scalable_main_header(): faad_get1bit"));
+                }
+            }
+        }
+
+        memcpy(ics2, ics1, sizeof(ic_stream));
+    } else {
+        ics1->ms_mask_present = 0;
+    }
+
+    if (0)
+    {
+        faad_get1bit(ld
+            DEBUGVAR(1,308,"aac_scalable_main_header(): tns_channel_mono_layer"));
+    }
+
+    for (ch = 0; ch < (this_layer_stereo ? 2 : 1); ch++)
+    {
+        if (ch == 0)
+            ics = ics1;
+        else
+            ics = ics2;
+
+        if ( 1 /*!tvq_layer_pesent || (tns_aac_tvq_en[ch] == 1)*/)
+        {
+            if ((ics->tns_data_present = faad_get1bit(ld
+                DEBUGVAR(1,309,"aac_scalable_main_header(): tns_data_present"))) & 1)
+            {
+#ifdef DRM
+                /* different order of data units in DRM */
+                if (hDecoder->object_type != DRM_ER_LC)
+#endif
+                {
+                    tns_data(ics, &(ics->tns), ld);
+                }
+            }
+        }
+#if 0
+        if (0 /*core_flag || tvq_layer_pesent*/)
+        {
+            if ((ch==0) || ((ch==1) && (core_stereo || tvq_stereo))
+                diff_control_data();
+            if (mono_stereo_flag)
+                diff_control_data_lr();
+        } else {
+#endif
+            if ((
+#ifdef LTP_DEC
+                ics->ltp.data_present =
+#endif
+                faad_get1bit(ld DEBUGVAR(1,310,"aac_scalable_main_header(): ltp.data_present"))) & 1)
+            {
+#ifdef LTP_DEC
+                if ((retval = ltp_data(hDecoder, ics, &(ics->ltp), ld)) > 0)
+                {
+                    return retval;
+                }
+#else
+                return 26;
+#endif
+            }
+#if 0
+        }
+#endif
+    }
+
+    return 0;
+}
+#endif
+
 /* Table 4.4.24 */
-static uint8_t individual_channel_stream(faacDecHandle hDecoder, element *ele,
+static uint8_t individual_channel_stream(NeAACDecHandle hDecoder, element *ele,
                                          bitfile *ld, ic_stream *ics, uint8_t scal_flag,
                                          int16_t *spec_data)
 {
@@ -1182,17 +1514,19 @@
             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);
     }
 
+#ifdef DRM
+    /* CRC check */
+    if (hDecoder->object_type == DRM_ER_LC)
+        if ((result = (uint8_t)faad_check_CRC(ld, (uint16_t)faad_get_processed_bits(ld) - 8)) > 0)
+            return result;
+#endif
+
     if (hDecoder->aacSpectralDataResilienceFlag)
     {
         /* error resilient spectral data decoding */
@@ -1227,7 +1561,7 @@
 }
 
 /* Table 4.4.25 */
-static uint8_t section_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld)
+static uint8_t section_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld)
 {
     uint8_t g;
     uint8_t sect_esc_val, sect_bits;
@@ -1271,6 +1605,10 @@
             ics->sect_cb[g][i] = (uint8_t)faad_getbits(ld, sect_cb_bits
                 DEBUGVAR(1,71,"section_data(): sect_cb"));
 
+#if 0
+            printf("%d\n", ics->sect_cb[g][i]);
+#endif
+
             if (ics->sect_cb[g][i] == NOISE_HCB)
                 ics->noise_used = 1;
 
@@ -1306,13 +1644,25 @@
             ics->sect_start[g][i] = k;
             ics->sect_end[g][i] = k + sect_len;
 
+#if 0
+            printf("%d\n", ics->sect_start[g][i]);
+#endif
+#if 0
+            printf("%d\n", ics->sect_end[g][i]);
+#endif
+
             if (k + sect_len >= 8*15)
                 return 15;
             if (i >= 8*15)
                 return 15;
 
             for (sfb = k; sfb < k + sect_len; sfb++)
+            {
                 ics->sfb_cb[g][sfb] = ics->sect_cb[g][i];
+#if 0
+                printf("%d\n", ics->sfb_cb[g][sfb]);
+#endif
+            }
 
 #if 0
             printf(" %6d %6d %6d\n",
@@ -1325,6 +1675,9 @@
             i++;
         }
         ics->num_sec[g] = i;
+#if 0
+        printf("%d\n", ics->num_sec[g]);
+#endif
     }
 
 #if 0
@@ -1363,16 +1716,21 @@
             {
             case ZERO_HCB: /* zero book */
                 ics->scale_factors[g][sfb] = 0;
+//#define SF_PRINT
+#ifdef SF_PRINT
+                printf("%d\n", ics->scale_factors[g][sfb]);
+#endif
                 break;
             case INTENSITY_HCB: /* intensity books */
             case INTENSITY_HCB2:
 
                 /* decode intensity position */
                 t = huffman_scale_factor(ld);
-                if (t < 0)
-                    return 9;
                 is_position += (t - 60);
                 ics->scale_factors[g][sfb] = is_position;
+#ifdef SF_PRINT
+                printf("%d\n", ics->scale_factors[g][sfb]);
+#endif
 
                 break;
             case NOISE_HCB: /* noise books */
@@ -1385,24 +1743,30 @@
                         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;
+#ifdef SF_PRINT
+                printf("%d\n", ics->scale_factors[g][sfb]);
+#endif
 
                 break;
             default: /* spectral books */
 
+                /* ics->scale_factors[g][sfb] must be between 0 and 255 */
+
+                ics->scale_factors[g][sfb] = 0;
+
                 /* 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;
+#ifdef SF_PRINT
+                printf("%d\n", ics->scale_factors[g][sfb]);
+#endif
 
                 break;
             }
@@ -1413,22 +1777,34 @@
 }
 
 /* Table 4.4.26 */
-static uint8_t scale_factor_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld)
+static uint8_t scale_factor_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld)
 {
+    uint8_t ret = 0;
+#ifdef PROFILE
+    int64_t count = faad_get_ts();
+#endif
+
 #ifdef ERROR_RESILIENCE
     if (!hDecoder->aacScalefactorDataResilienceFlag)
     {
 #endif
-        return decode_scale_factors(ics, ld);
+        ret = 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);
+        ret = rvlc_scale_factor_data(ics, ld);
     }
 #endif
+
+#ifdef PROFILE
+    count = faad_get_ts() - count;
+    hDecoder->scalefac_cycles += count;
+#endif
+
+    return ret;
 }
 
 /* Table 4.4.27 */
@@ -1450,6 +1826,9 @@
     {
         tns->n_filt[w] = (uint8_t)faad_getbits(ld, n_filt_bits
             DEBUGVAR(1,74,"tns_data(): n_filt"));
+#if 0
+        printf("%d\n", tns->n_filt[w]);
+#endif
 
         if (tns->n_filt[w])
         {
@@ -1460,26 +1839,44 @@
             } else {
                 start_coef_bits = 3;
             }
+#if 0
+            printf("%d\n", tns->coef_res[w]);
+#endif
         }
 
         for (filt = 0; filt < tns->n_filt[w]; filt++)
         {
             tns->length[w][filt] = (uint8_t)faad_getbits(ld, length_bits
                 DEBUGVAR(1,76,"tns_data(): length"));
+#if 0
+            printf("%d\n", tns->length[w][filt]);
+#endif
             tns->order[w][filt]  = (uint8_t)faad_getbits(ld, order_bits
                 DEBUGVAR(1,77,"tns_data(): order"));
+#if 0
+            printf("%d\n", tns->order[w][filt]);
+#endif
             if (tns->order[w][filt])
             {
                 tns->direction[w][filt] = faad_get1bit(ld
                     DEBUGVAR(1,78,"tns_data(): direction"));
+#if 0
+                printf("%d\n", tns->direction[w][filt]);
+#endif
                 tns->coef_compress[w][filt] = faad_get1bit(ld
                     DEBUGVAR(1,79,"tns_data(): coef_compress"));
+#if 0
+                printf("%d\n", tns->coef_compress[w][filt]);
+#endif
 
                 coef_bits = start_coef_bits - tns->coef_compress[w][filt];
                 for (i = 0; i < tns->order[w][filt]; i++)
                 {
                     tns->coef[w][filt][i] = (uint8_t)faad_getbits(ld, coef_bits
                         DEBUGVAR(1,80,"tns_data(): coef"));
+#if 0
+                    printf("%d\n", tns->coef[w][filt][i]);
+#endif
                 }
             }
         }
@@ -1488,10 +1885,12 @@
 
 #ifdef LTP_DEC
 /* Table 4.4.28 */
-static void ltp_data(faacDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld)
+static uint8_t ltp_data(NeAACDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld)
 {
     uint8_t sfb, w;
 
+    ltp->lag = 0;
+
 #ifdef LD_DEC
     if (hDecoder->object_type == LD)
     {
@@ -1510,6 +1909,11 @@
 #ifdef LD_DEC
     }
 #endif
+
+    /* Check length of lag */
+    if (ltp->lag > (hDecoder->frameLength << 1))
+        return 18;
+
     ltp->coef = (uint8_t)faad_getbits(ld, 3
         DEBUGVAR(1,82,"ltp_data(): coef"));
 
@@ -1538,24 +1942,26 @@
                 DEBUGVAR(1,86,"ltp_data(): long_used"));
         }
     }
+
+    return 0;
 }
 #endif
 
 /* Table 4.4.29 */
-static uint8_t spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld,
+static uint8_t spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld,
                              int16_t *spectral_data)
 {
     int8_t i;
     uint8_t g;
-    int16_t *sp;
-    uint16_t k, p = 0;
+    uint16_t inc, k, p = 0;
     uint8_t groups = 0;
     uint8_t sect_cb;
     uint8_t result;
     uint16_t nshort = hDecoder->frameLength/8;
 
-    sp = spectral_data;
-    /*memset(sp, 0, hDecoder->frameLength*sizeof(int16_t));*/
+#ifdef PROFILE
+    int64_t count = faad_get_ts();
+#endif
 
     for(g = 0; g < ics->num_window_groups; g++)
     {
@@ -1565,29 +1971,50 @@
         {
             sect_cb = ics->sect_cb[g][i];
 
+            inc = (sect_cb >= FIRST_PAIR_HCB) ? 2 : 4;
+
             switch (sect_cb)
             {
             case ZERO_HCB:
             case NOISE_HCB:
             case INTENSITY_HCB:
             case INTENSITY_HCB2:
+//#define SD_PRINT
+#ifdef SD_PRINT
+                {
+                    int j;
+                    for (j = ics->sect_sfb_offset[g][ics->sect_start[g][i]]; j < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; j++)
+                    {
+                        printf("%d\n", 0);
+                    }
+                }
+#endif
+//#define SFBO_PRINT
+#ifdef SFBO_PRINT
+                printf("%d\n", ics->sect_sfb_offset[g][ics->sect_start[g][i]]);
+#endif
                 p += (ics->sect_sfb_offset[g][ics->sect_end[g][i]] -
                     ics->sect_sfb_offset[g][ics->sect_start[g][i]]);
                 break;
             default:
+#ifdef SFBO_PRINT
+                printf("%d\n", ics->sect_sfb_offset[g][ics->sect_start[g][i]]);
+#endif
                 for (k = ics->sect_sfb_offset[g][ics->sect_start[g][i]];
-                     k < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; k += 4)
+                     k < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; k += inc)
                 {
-                    sp = spectral_data + p;
-
-                    if ((result = huffman_spectral_data(sect_cb, ld, sp)) > 0)
+                    if ((result = huffman_spectral_data(sect_cb, ld, &spectral_data[p])) > 0)
                         return result;
-                    if (sect_cb >= FIRST_PAIR_HCB)
+#ifdef SD_PRINT
                     {
-                        if ((result = huffman_spectral_data(sect_cb, ld, sp+2)) > 0)
-                            return result;
+                        int j;
+                        for (j = p; j < p+inc; j++)
+                        {
+                            printf("%d\n", spectral_data[j]);
+                        }
                     }
-                    p += 4;
+#endif
+                    p += inc;
                 }
                 break;
             }
@@ -1595,6 +2022,11 @@
         groups += ics->window_group_length[g];
     }
 
+#ifdef PROFILE
+    count = faad_get_ts() - count;
+    hDecoder->spectral_cycles += count;
+#endif
+
     return 0;
 }
 
@@ -1624,7 +2056,7 @@
         }
         return count;
     case EXT_DATA_ELEMENT:
-        data_element_version = faad_getbits(ld, 4
+        data_element_version = (uint8_t)faad_getbits(ld, 4
             DEBUGVAR(1,400,"extension_payload(): data_element_version"));
         switch (data_element_version)
         {
@@ -1632,7 +2064,7 @@
             loopCounter = 0;
             dataElementLength = 0;
             do {
-                dataElementLengthPart = faad_getbits(ld, 8
+                dataElementLengthPart = (uint8_t)faad_getbits(ld, 8
                     DEBUGVAR(1,401,"extension_payload(): dataElementLengthPart"));
                 dataElementLength += dataElementLengthPart;
                 loopCounter++;
--- a/Plugins/Input/aac/libfaad2/syntax.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/syntax.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: syntax.h,v 1.42 2003/11/12 20:47:59 menno Exp $
+** $Id: syntax.h,v 1.54 2004/09/04 14:56:29 menno Exp $
 **/
 
 #ifndef __SYNTAX_H__
@@ -33,7 +33,6 @@
 #endif
 
 #include "decoder.h"
-#include "drc.h"
 #include "bits.h"
 
 #define MAIN       1
@@ -61,8 +60,8 @@
 #define DRMCH_MONO          1
 #define DRMCH_STEREO        2
 #define DRMCH_SBR_MONO      3
-#define DRMCH_SBR_LC_STEREO 4
-#define DRMCH_SBR_STEREO    5
+#define DRMCH_SBR_STEREO    4
+#define DRMCH_SBR_PS_STEREO 5
 
 
 /* First object type that has ER */
@@ -104,57 +103,19 @@
 #define INTENSITY_HCB2 14
 #define INTENSITY_HCB  15
 
+#define INVALID_SBR_ELEMENT 255
+
 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,
+void raw_data_block(NeAACDecHandle hDecoder, NeAACDecFrameInfo *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);
+uint8_t reordered_spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld,
+                                int16_t *spectral_data);
+void aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
+                               bitfile *ld, program_config *pce, drc_info *drc);
 
 
 #ifdef __cplusplus
--- a/Plugins/Input/aac/libfaad2/tns.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/tns.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: tns.c,v 1.27 2003/11/12 20:47:59 menno Exp $
+** $Id: tns.c,v 1.35 2004/09/04 14:56:29 menno Exp $
 **/
 
 #include "common.h"
@@ -31,6 +31,16 @@
 #include "syntax.h"
 #include "tns.h"
 
+
+/* static function declarations */
+static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_compress,
+                            uint8_t *coef, real_t *a);
+static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc,
+                          uint8_t order);
+static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc,
+                          uint8_t order);
+
+
 #ifdef _MSC_VER
 #pragma warning(disable:4305)
 #pragma warning(disable:4244)
@@ -229,24 +239,32 @@
 
     uint8_t j;
     uint16_t i;
-    real_t y, state[TNS_MAX_ORDER];
-
-    for (i = 0; i < order; i++)
-        state[i] = 0;
+    real_t y;
+    /* state is stored as a double ringbuffer */
+    real_t state[2*TNS_MAX_ORDER] = {0};
+    int8_t state_index = 0;
 
     for (i = 0; i < size; i++)
     {
         y = *spectrum;
 
         for (j = 0; j < order; j++)
-            y -= MUL_C(state[j], lpc[j+1]);
+            y -= MUL_C(state[state_index+j], lpc[j+1]);
 
-        for (j = order-1; j > 0; j--)
-            state[j] = state[j-1];
+        /* double ringbuffer state */
+        state_index--;
+        if (state_index < 0)
+            state_index = order-1;
+        state[state_index] = state[state_index + order] = y;
 
-        state[0] = y;
         *spectrum = y;
         spectrum += inc;
+
+//#define TNS_PRINT
+#ifdef TNS_PRINT
+        //printf("%d\n", y);
+        printf("0x%.8X\n", y);
+#endif
     }
 }
 
@@ -264,10 +282,10 @@
 
     uint8_t j;
     uint16_t i;
-    real_t y, state[TNS_MAX_ORDER];
-
-    for (i = 0; i < order; i++)
-        state[i] = REAL_CONST(0.0);
+    real_t y;
+    /* state is stored as a double ringbuffer */
+    real_t state[2*TNS_MAX_ORDER] = {0};
+    int8_t state_index = 0;
 
     for (i = 0; i < size; i++)
     {
@@ -276,10 +294,12 @@
         for (j = 0; j < order; j++)
             y += MUL_C(state[j], lpc[j+1]);
 
-        for (j = order-1; j > 0; j--)
-            state[j] = state[j-1];
+        /* double ringbuffer state */
+        state_index--;
+        if (state_index < 0)
+            state_index = order-1;
+        state[state_index] = state[state_index + order] = *spectrum;
 
-        state[0] = *spectrum;
         *spectrum = y;
         spectrum += inc;
     }
--- a/Plugins/Input/aac/libfaad2/tns.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/tns.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
 **  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: tns.h,v 1.14 2003/11/12 20:47:59 menno Exp $
+** $Id: tns.h,v 1.19 2004/09/04 14:56:29 menno Exp $
 **/
 
 #ifndef __TNS_H__
@@ -41,13 +41,6 @@
 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
 }
--- a/Plugins/Input/aac/libmp4v2/INTERNALS	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/INTERNALS	Wed Nov 16 16:21:11 2005 -0800
@@ -50,17 +50,12 @@
 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. Most atoms are covered in
-atom_standard.cpp.  Atoms that have a special read, generation or
-write needs are contained in their subclass contained in file atom_<name>.cpp,
- where <name> is the four letter name of the atom defined in the MP4 
-specification. 
-
-Atoms that only specifies the properties of the atom or the possible child 
-atoms in the case of a container atom are located in atom_standard.cpp.
-
-In more specialized cases the atom specific file provides routines to 
-initialize, read, or write the atom.
+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 
@@ -108,15 +103,6 @@
 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.
 
-To add an atom, first you should see if an existing atom exists that
-can be used.  If not, you need to decide if special read/write or
-generate properties need to be established; for example a property in the atom
-changes other properties (adds, or subtracts).  If there are no
-special cases, add the atom properties to atom_standard.cpp.  If there
-are special properties, add a new file, add a new class to atoms.h, and
-add the class to  MP4Atom::CreateAtom in mp4atom.cpp.
-
-
 
 Generic Tracks
 ==============
--- a/Plugins/Input/aac/libmp4v2/Makefile.am	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/Makefile.am	Wed Nov 16 16:21:11 2005 -0800
@@ -1,6 +1,6 @@
 INCLUDES = -I../include -I.
 
-noinst_LTLIBRARIES = libmp4v2.la 
+noinst_LTLIBRARIES = libmp4v2.la
 
 include_HEADERS = mp4.h
 
@@ -9,42 +9,87 @@
 	atom_amr.cpp \
 	atom_avc1.cpp \
 	atom_avcC.cpp \
+	atom_bitr.cpp \
+	atom_btrt.cpp \
+	atom_co64.cpp \
+	atom_cprt.cpp \
+	atom_ctts.cpp \
 	atom_d263.cpp \
 	atom_damr.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_enca.cpp \
 	atom_encv.cpp \
+	atom_esds.cpp \
 	atom_free.cpp \
+	atom_frma.cpp \
 	atom_ftyp.cpp \
 	atom_hdlr.cpp \
 	atom_hinf.cpp \
+	atom_hmhd.cpp \
 	atom_hnti.cpp \
-	atom_href.cpp \
+	atom_iods.cpp \
+	atom_iKMS.cpp \
+	atom_iSFM.cpp \
+	atom_maxr.cpp \
 	atom_mdat.cpp \
 	atom_mdhd.cpp \
+	atom_mdia.cpp \
 	atom_meta.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_s263.cpp \
+	atom_schi.cpp \
+	atom_schm.cpp \
 	atom_sdp.cpp \
 	atoms.h \
+	atom_sinf.cpp \
+	atom_smhd.cpp \
 	atom_smi.cpp \
+	atom_snro.cpp \
 	atom_sound.cpp \
-	atom_standard.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 \
--- a/Plugins/Input/aac/libmp4v2/README	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/README	Wed Nov 16 16:21:11 2005 -0800
@@ -17,12 +17,14 @@
 The test and util subdirectories contain some simple programs that use 
 this library.
 
-Once make install is run, to use this library, you should:
 To use this library in your application, it should be sufficient to:
 
-1) add the installed library to your final link:
-	e.g. gcc ... -o foo foo.cpp -lmp4v2
+1) add mpeg4ip/include and mpeg4ip/lib/mp4v2 to your INCLUDE path,
+	e.g. gcc -Impeg4ip/include -Impeg4ip/lib/mp4v2 ...
 
-2) include mp4.h into your code,
+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>
 
--- a/Plugins/Input/aac/libmp4v2/atom_free.cpp	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/atom_free.cpp	Wed Nov 16 16:21:11 2005 -0800
@@ -37,13 +37,7 @@
 
 	bool use64 = (GetSize() > (0xFFFFFFFF - 8)); 
 	BeginWrite(use64);
-#if 1
-	for (uint64_t ix = 0; ix < GetSize(); ix++) {
-	  m_pFile->WriteUInt8(0);
-	}
-#else
 	m_pFile->SetPosition(m_pFile->GetPosition() + GetSize());
-#endif
 	FinishWrite(use64);
 }
 
--- a/Plugins/Input/aac/libmp4v2/atom_meta.cpp	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/atom_meta.cpp	Wed Nov 16 16:21:11 2005 -0800
@@ -23,6 +23,15 @@
 
 #include "mp4common.h"
 
+MP4MetaAtom::MP4MetaAtom()
+    : MP4Atom("meta")
+{
+	AddVersionAndFlags(); /* 0, 1 */
+
+    ExpectChildAtom("hdlr", Required, OnlyOne);
+    ExpectChildAtom("ilst", Required, OnlyOne);
+}
+
 MP4MeanAtom::MP4MeanAtom()
     : MP4Atom("mean")
 {
@@ -75,3 +84,114 @@
 	MP4Atom::Read();
 }
 
+MP4IlstAtom::MP4IlstAtom()
+    : MP4Atom("ilst")
+{
+    ExpectChildAtom("\251nam", Optional, OnlyOne); /* name */
+    ExpectChildAtom("\251ART", Optional, OnlyOne); /* artist */
+    ExpectChildAtom("\251wrt", Optional, OnlyOne); /* writer */
+    ExpectChildAtom("\251alb", Optional, OnlyOne); /* album */
+    ExpectChildAtom("\251day", Optional, OnlyOne); /* date */
+    ExpectChildAtom("\251too", Optional, OnlyOne); /* tool */
+    ExpectChildAtom("\251cmt", Optional, OnlyOne); /* comment */
+    ExpectChildAtom("\251gen", Optional, OnlyOne); /* custom genre */
+    ExpectChildAtom("trkn", Optional, OnlyOne); /* tracknumber */
+    ExpectChildAtom("disk", Optional, OnlyOne); /* disknumber */
+    ExpectChildAtom("gnre", Optional, OnlyOne); /* genre (ID3v1 index + 1) */
+    ExpectChildAtom("cpil", Optional, OnlyOne); /* compilation */
+    ExpectChildAtom("tmpo", Optional, OnlyOne); /* BPM */
+    ExpectChildAtom("covr", Optional, OnlyOne); /* cover art */
+    ExpectChildAtom("----", Optional, Many); /* ---- free form */
+}
+
+MP4DashAtom::MP4DashAtom()
+    : MP4Atom("----")
+{
+    ExpectChildAtom("mean", Required, OnlyOne);
+    ExpectChildAtom("name", Required, OnlyOne);
+    ExpectChildAtom("data", Required, OnlyOne);
+}
+
+MP4NamAtom::MP4NamAtom()
+    : MP4Atom("\251nam")
+{
+    ExpectChildAtom("data", Required, OnlyOne);
+}
+
+MP4ArtAtom::MP4ArtAtom()
+    : MP4Atom("\251ART")
+{
+    ExpectChildAtom("data", Required, OnlyOne);
+}
+
+MP4WrtAtom::MP4WrtAtom()
+    : MP4Atom("\251wrt")
+{
+    ExpectChildAtom("data", Required, OnlyOne);
+}
+
+MP4AlbAtom::MP4AlbAtom()
+    : MP4Atom("\251alb")
+{
+    ExpectChildAtom("data", Required, OnlyOne);
+}
+
+MP4CmtAtom::MP4CmtAtom()
+    : MP4Atom("\251cmt")
+{
+    ExpectChildAtom("data", Required, OnlyOne);
+}
+
+MP4TrknAtom::MP4TrknAtom()
+    : MP4Atom("trkn")
+{
+    ExpectChildAtom("data", Required, OnlyOne);
+}
+
+MP4DiskAtom::MP4DiskAtom()
+    : MP4Atom("disk")
+{
+    ExpectChildAtom("data", Required, OnlyOne);
+}
+
+MP4DayAtom::MP4DayAtom()
+    : MP4Atom("\251day")
+{
+    ExpectChildAtom("data", Required, OnlyOne);
+}
+
+MP4GenAtom::MP4GenAtom()
+    : MP4Atom("\251gen")
+{
+    ExpectChildAtom("data", Required, OnlyOne);
+}
+
+MP4TooAtom::MP4TooAtom()
+    : MP4Atom("\251too")
+{
+    ExpectChildAtom("data", Required, OnlyOne);
+}
+
+MP4GnreAtom::MP4GnreAtom()
+    : MP4Atom("gnre")
+{
+    ExpectChildAtom("data", Optional, OnlyOne);
+}
+
+MP4CpilAtom::MP4CpilAtom()
+    : MP4Atom("cpil")
+{
+    ExpectChildAtom("data", Required, OnlyOne);
+}
+
+MP4TmpoAtom::MP4TmpoAtom()
+    : MP4Atom("tmpo")
+{
+    ExpectChildAtom("data", Required, OnlyOne);
+}
+
+MP4CovrAtom::MP4CovrAtom()
+    : MP4Atom("covr")
+{
+    ExpectChildAtom("data", Required, OnlyOne);
+}
--- a/Plugins/Input/aac/libmp4v2/atoms.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/atoms.h	Wed Nov 16 16:21:11 2005 -0800
@@ -13,7 +13,7 @@
  * 
  * The Initial Developer of the Original Code is Cisco Systems Inc.
  * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2001 - 2005.  All Rights Reserved.
+ * Copyright (C) Cisco Systems Inc. 2001 - 2004.  All Rights Reserved.
  *
  * 3GPP features implementation is based on 3GPP's TS26.234-v5.60,
  * and was contributed by Ximpo Group Ltd.
@@ -24,7 +24,6 @@
  * Contributor(s): 
  *		Dave Mackie		dmackie@cisco.com
  *              Ximpo Group Ltd.                mp4v2@ximpo.com
- *              Bill May                wmay@cisco.com
  */
 
 #ifndef __MP4_ATOMS_INCLUDED__
@@ -52,13 +51,56 @@
 	void WriteAtomType(const char* type, bool onlyOne);
 };
 
-/***********************************************************************
- * Common atom classes - standard for anything that just contains atoms
- * and non-maleable properties, treftype and url
- ***********************************************************************/
-class MP4StandardAtom : public MP4Atom {
- public:
-  MP4StandardAtom(const char *name);
+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 {
@@ -67,6 +109,63 @@
 	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(const char *type="url ");
@@ -74,70 +173,22 @@
 	void Write();
 };
 
-/***********************************************************************
- * Sound and Video atoms - use the generic atoms when possible
- * (MP4SoundAtom and MP4VideoAtom)
- ***********************************************************************/
-class MP4SoundAtom : public MP4Atom {
- public:
-  MP4SoundAtom(const char *atomid);
-  void Generate();
-  void Read();
-protected:
-  void AddProperties(u_int8_t version);
-};
-
-class MP4VideoAtom : public MP4Atom {
- public:
-  MP4VideoAtom(const char *atomid);
-  void Generate();
-};
-
-class MP4AmrAtom : public MP4Atom {
- public:
-  MP4AmrAtom(const char *type);
-  void Generate();
+class MP4UrnAtom : public MP4Atom {
+public:
+	MP4UrnAtom();
+	void Read();
 };
 
-// H.264 atoms
-
-class MP4Avc1Atom : public MP4Atom {
- public:
-  MP4Avc1Atom();
-  void Generate();
-};
-
-class MP4AvcCAtom : public MP4Atom {
- public:
-  MP4AvcCAtom();
-  void Generate();
+class MP4StblAtom : public MP4Atom {
+public:
+	MP4StblAtom();
+	void Generate();
 };
 
-
-
-class MP4D263Atom : public MP4Atom {
- public:
-  MP4D263Atom();
-  void Generate();
-  void Write();
-};
- 
-class MP4DamrAtom : public MP4Atom {
- public: 
-  MP4DamrAtom();
-  void Generate();
-};
-
-class MP4EncaAtom : public MP4Atom {
+class MP4StsdAtom : public MP4Atom {
 public:
-        MP4EncaAtom();
-        void Generate();
-};
-
-class MP4EncvAtom : public MP4Atom {
-public:
-        MP4EncvAtom();
-        void Generate();
+	MP4StsdAtom();
+	void Read();
 };
 
 class MP4Mp4aAtom : public MP4Atom {
@@ -158,31 +209,65 @@
 	void Generate();
 };
 
+class MP4EsdsAtom : public MP4Atom {
+public:
+	MP4EsdsAtom();
+};
 
-class MP4S263Atom : public MP4Atom {
- public:
-  MP4S263Atom();
-  void Generate();
+class MP4SttsAtom : public MP4Atom {
+public:
+	MP4SttsAtom();
 };
- 
- 
- 
-/************************************************************************
- * Specialized Atoms
- ************************************************************************/
+
+class MP4CttsAtom : public MP4Atom {
+public:
+	MP4CttsAtom();
+};
 
-class MP4DataAtom : public MP4Atom {
+class MP4StszAtom : public MP4Atom {
 public:
-    MP4DataAtom();
-    void Read();
+	MP4StszAtom();
+	void Read();
+	void Write();
+};
+
+class MP4StscAtom : public MP4Atom {
+public:
+	MP4StscAtom();
+	void Read();
 };
 
-class MP4DrefAtom : public MP4Atom {
+class MP4StcoAtom : public MP4Atom {
+public:
+	MP4StcoAtom();
+};
+
+class MP4Co64Atom : public MP4Atom {
+public:
+	MP4Co64Atom();
+};
+
+class MP4StssAtom : public MP4Atom {
 public:
-	MP4DrefAtom();
+	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();
@@ -192,30 +277,15 @@
 	void AddProperties(u_int8_t version);
 };
 
-class MP4FreeAtom : public MP4Atom {
+class MP4UdtaAtom : public MP4Atom {
 public:
-	MP4FreeAtom();
-	void Read();
-	void Write();
-};
-
-class MP4FtypAtom : public MP4Atom {
-public:
-	MP4FtypAtom();
-	void Generate();
+	MP4UdtaAtom();
 	void Read();
 };
 
-class MP4HdlrAtom : public MP4Atom {
+class MP4CprtAtom : public MP4Atom {
 public:
-	MP4HdlrAtom();
-	void Read();
-};
-
-class MP4HinfAtom : public MP4Atom {
-public:
-	MP4HinfAtom();
-	void Generate();
+	MP4CprtAtom();
 };
 
 class MP4HntiAtom : public MP4Atom {
@@ -224,45 +294,6 @@
 	void Read();
 };
 
-
-class MP4MdatAtom : public MP4Atom {
-public:
-	MP4MdatAtom();
-	void Read();
-	void Write();
-};
-
-class MP4MdhdAtom : public MP4Atom {
-public:
-	MP4MdhdAtom();
-	void Generate();
-	void Read();
-protected:
-	void AddProperties(u_int8_t version);
-};
-
-class MP4MeanAtom : public MP4Atom {
-public:
-    MP4MeanAtom();
-    void Read();
-};
-
-
-class MP4MvhdAtom : public MP4Atom {
-public:
-	MP4MvhdAtom();
-	void Generate();
-	void Read();
-protected:
-	void AddProperties(u_int8_t version);
-};
-
-class MP4NameAtom : public MP4Atom {
-public:
-    MP4NameAtom();
-    void Read();
-};
-
 class MP4RtpAtom : public MP4Atom {
 public:
 	MP4RtpAtom();
@@ -283,6 +314,21 @@
 	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();
@@ -290,41 +336,95 @@
 	void Write();
 };
 
-class MP4SmiAtom : public MP4Atom {
- public:
-  MP4SmiAtom(void);
-  void Read();
-};
-
-class MP4StblAtom : public MP4Atom {
+class MP4HinfAtom : public MP4Atom {
 public:
-	MP4StblAtom();
+	MP4HinfAtom();
 	void Generate();
 };
 
-class MP4StdpAtom : public MP4Atom {
+class MP4TrpyAtom : public MP4Atom {
+public:
+	MP4TrpyAtom();
+};
+
+class MP4NumpAtom : public MP4Atom {
 public:
-	MP4StdpAtom();
-	void Read();
+	MP4NumpAtom();
+};
+
+class MP4TpylAtom : public MP4Atom {
+public:
+	MP4TpylAtom();
 };
 
-class MP4StscAtom : public MP4Atom {
+class MP4MaxrAtom : public MP4Atom {
+public:
+	MP4MaxrAtom();
+};
+
+class MP4DmedAtom : public MP4Atom {
+public:
+	MP4DmedAtom();
+};
+
+class MP4DimmAtom : public MP4Atom {
 public:
-	MP4StscAtom();
-	void Read();
+	MP4DimmAtom();
+};
+
+class MP4DrepAtom : public MP4Atom {
+public:
+	MP4DrepAtom();
+};
+
+class MP4TminAtom : public MP4Atom {
+public:
+	MP4TminAtom();
 };
 
-class MP4StsdAtom : public MP4Atom {
+class MP4TmaxAtom : public MP4Atom {
+public:
+	MP4TmaxAtom();
+};
+
+class MP4PmaxAtom : public MP4Atom {
 public:
-	MP4StsdAtom();
-	void Read();
+	MP4PmaxAtom();
+};
+
+class MP4DmaxAtom : public MP4Atom {
+public:
+	MP4DmaxAtom();
+};
+
+class MP4PaytAtom : public MP4Atom {
+public:
+	MP4PaytAtom();
 };
 
-class MP4StszAtom : public MP4Atom {
+class MP4MvexAtom : public MP4Atom {
+public:
+	MP4MvexAtom();
+};
+
+class MP4TrexAtom : public MP4Atom {
+public:
+	MP4TrexAtom();
+};
+
+class MP4MoofAtom : public MP4Atom {
 public:
-	MP4StszAtom();
-	void Read();
-	void Write();
+	MP4MoofAtom();
+};
+
+class MP4MfhdAtom : public MP4Atom {
+public:
+	MP4MfhdAtom();
+};
+
+class MP4TrafAtom : public MP4Atom {
+public:
+	MP4TrafAtom();
 };
 
 class MP4TfhdAtom : public MP4Atom {
@@ -335,14 +435,6 @@
 	void AddProperties(u_int32_t flags);
 };
 
-class MP4TkhdAtom : public MP4Atom {
-public:
-	MP4TkhdAtom();
-	void Generate();
-	void Read();
-protected:
-	void AddProperties(u_int8_t version);
-};
 class MP4TrunAtom : public MP4Atom {
 public:
 	MP4TrunAtom();
@@ -351,27 +443,226 @@
 	void AddProperties(u_int32_t flags);
 };
 
-class MP4UdtaAtom : public MP4Atom {
+class MP4FreeAtom : public MP4Atom {
+public:
+	MP4FreeAtom();
+	void Read();
+	void Write();
+};
+
+class MP4EncaAtom : public MP4Atom {
+public:
+        MP4EncaAtom();
+        void Generate();
+};
+
+class MP4EncvAtom : public MP4Atom {
+public:
+        MP4EncvAtom();
+        void Generate();
+};
+
+class MP4FrmaAtom : public MP4Atom {
+public:
+        MP4FrmaAtom();
+};
+
+class MP4IKMSAtom : public MP4Atom {
+public:
+        MP4IKMSAtom();
+};
+
+class MP4ISFMAtom : public MP4Atom {
+public:
+        MP4ISFMAtom();
+};
+
+class MP4SchiAtom : public MP4Atom {
+public:
+        MP4SchiAtom();
+};
+
+class MP4SchmAtom : public MP4Atom {
+public:
+        MP4SchmAtom();
+};
+
+class MP4SinfAtom : public MP4Atom {
+public:
+        MP4SinfAtom();
+};
+
+/* iTunes META data atoms */
+class MP4MetaAtom : public MP4Atom {
 public:
-	MP4UdtaAtom();
-	void Read();
+	MP4MetaAtom();
+};
+
+class MP4NameAtom : public MP4Atom {
+public:
+    MP4NameAtom();
+    void Read();
+};
+
+class MP4MeanAtom : public MP4Atom {
+public:
+    MP4MeanAtom();
+    void Read();
+};
+
+class MP4DataAtom : public MP4Atom {
+public:
+    MP4DataAtom();
+    void Read();
+};
+
+class MP4IlstAtom : public MP4Atom {
+public:
+	MP4IlstAtom();
+};
+
+class MP4DashAtom : public MP4Atom {
+public:
+    MP4DashAtom();
+};
+
+class MP4NamAtom : public MP4Atom {
+public:
+	MP4NamAtom();
+};
+
+class MP4ArtAtom : public MP4Atom {
+public:
+	MP4ArtAtom();
+};
+
+class MP4WrtAtom : public MP4Atom {
+public:
+	MP4WrtAtom();
+};
+
+class MP4AlbAtom : public MP4Atom {
+public:
+	MP4AlbAtom();
+};
+
+class MP4TrknAtom : public MP4Atom {
+public:
+	MP4TrknAtom();
 };
 
-class MP4UrnAtom : public MP4Atom {
+class MP4DayAtom : public MP4Atom {
+public:
+	MP4DayAtom();
+};
+
+class MP4GenAtom : public MP4Atom {
 public:
-	MP4UrnAtom();
-	void Read();
+	MP4GenAtom();
+};
+
+class MP4TooAtom : public MP4Atom {
+public:
+	MP4TooAtom();
+};
+
+class MP4GnreAtom : public MP4Atom {
+public:
+	MP4GnreAtom();
 };
-class MP4VmhdAtom : public MP4Atom {
+
+class MP4CpilAtom : public MP4Atom {
+public:
+	MP4CpilAtom();
+};
+
+class MP4TmpoAtom : public MP4Atom {
 public:
-	MP4VmhdAtom();
-	void Generate();
+	MP4TmpoAtom();
+};
+
+class MP4CmtAtom : public MP4Atom {
+public:
+	MP4CmtAtom();
+};
+
+class MP4CovrAtom : public MP4Atom {
+ public:
+  MP4CovrAtom();
+};
+
+class MP4DiskAtom : public MP4Atom {
+public:
+	MP4DiskAtom();
 };
 
-class MP4HrefAtom : public MP4Atom {
+class MP4BitrAtom : public MP4Atom {
+ public:
+  MP4BitrAtom();
+};
+ 
+class MP4D263Atom : public MP4Atom {
  public:
-  MP4HrefAtom();
-  void Generate(void);
+  MP4D263Atom();
+  void Generate();
+  void Write();
+};
+ 
+class MP4DamrAtom : public MP4Atom {
+ public: 
+  MP4DamrAtom();
+  void Generate();
+};
+ 
+class MP4S263Atom : public MP4Atom {
+ public:
+  MP4S263Atom();
+  void Generate();
+};
+ 
+class MP4AmrAtom : public MP4Atom {
+ public:
+  MP4AmrAtom(const char *type);
+  void Generate();
+};
+ 
+// H.264 atoms
+
+class MP4Avc1Atom : public MP4Atom {
+ public:
+  MP4Avc1Atom();
+  void Generate();
 };
 
+class MP4AvcCAtom : public MP4Atom {
+ public:
+  MP4AvcCAtom();
+  void Generate();
+};
+
+class MP4BtrtAtom : public MP4Atom {
+ public:
+  MP4BtrtAtom();
+};
+
+class MP4SoundAtom : public MP4Atom {
+ public:
+  MP4SoundAtom(const char *atomid);
+  void Generate();
+  void Read();
+protected:
+  void AddProperties(u_int8_t version);
+};
+
+class MP4VideoAtom : public MP4Atom {
+ public:
+  MP4VideoAtom(const char *atomid);
+  void Generate();
+};
+
+class MP4SmiAtom : public MP4Atom {
+ public:
+  MP4SmiAtom(void);
+  void Read();
+};
 #endif /* __MP4_ATOMS_INCLUDED__ */
--- a/Plugins/Input/aac/libmp4v2/isma.cpp	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/isma.cpp	Wed Nov 16 16:21:11 2005 -0800
@@ -59,31 +59,25 @@
 	catch (MP4Error* e) {
 		delete e;
 	}
-	if (audioTrackId == MP4_INVALID_TRACK_ID &&
-	    videoTrackId == MP4_INVALID_TRACK_ID) return;
+	const char *audio_media_data_name, *video_media_data_name;
 
-	const char *audio_media_data_name, *video_media_data_name;
-	if (audioTrackId != MP4_INVALID_TRACK_ID) {
-	  audio_media_data_name = MP4GetTrackMediaDataName(this, audioTrackId);
-	  if (!(ATOMID(audio_media_data_name) == ATOMID("mp4a") ||
-		ATOMID(audio_media_data_name) == ATOMID("enca"))) {
-	    VERBOSE_ERROR(m_verbosity,
-			  printf("MakeIsmaCompliant:can't make ISMA compliant when file contains an %s track\n", audio_media_data_name);
-			  );
-	    return;
-	  }
+	audio_media_data_name = MP4GetTrackMediaDataName(this, audioTrackId);
+	if (!(ATOMID(audio_media_data_name) == ATOMID("mp4a") ||
+	      ATOMID(audio_media_data_name) == ATOMID("enca"))) {
+	  VERBOSE_ERROR(m_verbosity,
+			printf("MakeIsmaCompliant:can't make ISMA compliant when file contains an %s track\n", audio_media_data_name);
+			);
+	  return;
 	}
 	//
 	// Note - might have to check for avc1 here...
-	if (videoTrackId != MP4_INVALID_TRACK_ID) {
-	  video_media_data_name = MP4GetTrackMediaDataName(this, videoTrackId);
-	  if (!(ATOMID(video_media_data_name) == ATOMID("mp4v") ||
-		ATOMID(video_media_data_name) == ATOMID("encv"))) {
-	    VERBOSE_ERROR(m_verbosity,
-			  printf("MakeIsmaCompliant:can't make ISMA compliant when file contains an %s track\n", video_media_data_name);
-			  );
-	    return;
-	  }
+	video_media_data_name = MP4GetTrackMediaDataName(this, videoTrackId);
+	if (!(ATOMID(video_media_data_name) == ATOMID("mp4v") ||
+	      ATOMID(video_media_data_name) == ATOMID("encv"))) {
+	  VERBOSE_ERROR(m_verbosity,
+			printf("MakeIsmaCompliant:can't make ISMA compliant when file contains an %s track\n", video_media_data_name);
+			);
+	  return;
 	}
 
 	m_useIsma = true;
@@ -519,7 +513,7 @@
     delete pVideoEsdProperty;
 
 	VERBOSE_ISMA(GetVerbosity(),
-		printf("OD data = %llu bytes\n", numBytes); MP4HexDump(pBytes, numBytes));
+		printf("OD data = "U64" bytes\n", numBytes); MP4HexDump(pBytes, numBytes));
 
 	char* odCmdBase64 = MP4ToBase64(pBytes, numBytes);
 
@@ -782,7 +776,7 @@
 	CreateIsmaODUpdateCommandForStream(
 		pAudioEsd, pVideoEsd, ppBytes, pNumBytes);
 	VERBOSE_ISMA(GetVerbosity(),
-		printf("After CreateImsaODUpdateCommandForStream len %llu =\n", *pNumBytes); MP4HexDump(*ppBytes, *pNumBytes));
+		printf("After CreateImsaODUpdateCommandForStream len "U64" =\n", *pNumBytes); MP4HexDump(*ppBytes, *pNumBytes));
 	// return SL config values to 2 (file)
 	// return ESID values to 0
 	if (pAudioSLConfigPredef) {
--- a/Plugins/Input/aac/libmp4v2/libmp4v260.dsp	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/libmp4v260.dsp	Wed Nov 16 16:21:11 2005 -0800
@@ -90,10 +90,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\atom_amr.cpp
-# End Source File
-# Begin Source File
-
 SOURCE=.\atom_avc1.cpp
 # End Source File
 # Begin Source File
@@ -102,6 +98,26 @@
 # End Source File
 # Begin Source File
 
+SOURCE=.\atom_bitr.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_btrt.cpp
+# End Source File
+# 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_d263.cpp
 # End Source File
 # Begin Source File
@@ -110,10 +126,34 @@
 # 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
@@ -126,10 +166,18 @@
 # 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_frma.cpp
+# End Source File
+# Begin Source File
+
 SOURCE=.\atom_ftyp.cpp
 # End Source File
 # Begin Source File
@@ -142,11 +190,27 @@
 # 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_href.cpp
+SOURCE=.\atom_iKMS.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_iods.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_iSFM.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_maxr.cpp
 # End Source File
 # Begin Source File
 
@@ -158,10 +222,30 @@
 # End Source File
 # Begin Source File
 
+SOURCE=.\atom_mdia.cpp
+# End Source File
+# Begin Source File
+
 SOURCE=.\atom_meta.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
@@ -174,10 +258,30 @@
 # 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
@@ -190,19 +294,27 @@
 # End Source File
 # Begin Source File
 
+SOURCE=.\atom_schi.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_schm.cpp
+# End Source File
+# Begin Source File
+
 SOURCE=.\atom_sdp.cpp
 # End Source File
 # Begin Source File
 
-SOURCE=.\atom_smi.cpp
+SOURCE=.\atom_sinf.cpp
 # End Source File
 # Begin Source File
 
-SOURCE=.\atom_sound.cpp
+SOURCE=.\atom_smhd.cpp
 # End Source File
 # Begin Source File
 
-SOURCE=.\atom_standard.cpp
+SOURCE=.\atom_snro.cpp
 # End Source File
 # Begin Source File
 
@@ -210,6 +322,10 @@
 # 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
@@ -222,26 +338,78 @@
 # 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
@@ -254,10 +422,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\atom_video.cpp
-# End Source File
-# Begin Source File
-
 SOURCE=.\atom_vmhd.cpp
 # End Source File
 # Begin Source File
@@ -397,5 +561,21 @@
 SOURCE=.\rtphint.h
 # End Source File
 # End Group
+# Begin Source File
+
+SOURCE=.\atom_amr.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_smi.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_sound.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_video.cpp
+# End Source File
 # End Target
 # End Project
--- a/Plugins/Input/aac/libmp4v2/libmp4v2_st60.dsp	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/libmp4v2_st60.dsp	Wed Nov 16 16:21:11 2005 -0800
@@ -101,6 +101,26 @@
 # End Source File
 # Begin Source File
 
+SOURCE=.\atom_bitr.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_btrt.cpp
+# End Source File
+# 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_d263.cpp
 # End Source File
 # Begin Source File
@@ -109,19 +129,39 @@
 # 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_enca.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\atom_encv.cpp
+SOURCE=.\atom_esds.cpp
 # End Source File
 # Begin Source File
 
@@ -141,11 +181,19 @@
 # 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_href.cpp
+SOURCE=.\atom_iods.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_maxr.cpp
 # End Source File
 # Begin Source File
 
@@ -157,10 +205,30 @@
 # End Source File
 # Begin Source File
 
+SOURCE=.\atom_mdia.cpp
+# End Source File
+# Begin Source File
+
 SOURCE=.\atom_meta.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
@@ -173,10 +241,30 @@
 # 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
@@ -193,15 +281,11 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\atom_smi.cpp
+SOURCE=.\atom_smhd.cpp
 # End Source File
 # Begin Source File
 
-SOURCE=.\atom_sound.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\atom_standard.cpp
+SOURCE=.\atom_snro.cpp
 # End Source File
 # Begin Source File
 
@@ -209,6 +293,10 @@
 # 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
@@ -221,26 +309,78 @@
 # 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
@@ -293,10 +433,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\mp4info.cpp
-# End Source File
-# Begin Source File
-
 SOURCE=.\mp4meta.cpp
 # End Source File
 # Begin Source File
@@ -396,5 +532,49 @@
 SOURCE=.\rtphint.h
 # End Source File
 # End Group
+# Begin Source File
+
+SOURCE=.\atom_enca.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_encv.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_frma.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_iKMS.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_iSFM.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_schi.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_schm.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_sinf.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_smi.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\atom_sound.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\mp4info.cpp
+# End Source File
 # End Target
 # End Project
--- a/Plugins/Input/aac/libmp4v2/mp4.cpp	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/mp4.cpp	Wed Nov 16 16:21:11 2005 -0800
@@ -13,7 +13,7 @@
  * 
  * The Initial Developer of the Original Code is Cisco Systems Inc.
  * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2001 - 2005.  All Rights Reserved.
+ * Copyright (C) Cisco Systems Inc. 2001 - 2004.  All Rights Reserved.
  *
  * 3GPP features implementation is based on 3GPP's TS26.234-v5.60,
  * and was contributed by Ximpo Group Ltd.
@@ -25,7 +25,6 @@
  *		Dave Mackie			dmackie@cisco.com
  *		Alix Marchandise-Franquet	alix@cisco.com
  *              Ximpo Group Ltd.                mp4v2@ximpo.com
- *              Bill May                        wmay@cisco.com
  */
 
 /* 
@@ -61,20 +60,13 @@
 
 extern "C" MP4FileHandle MP4Create (const char* fileName,
 				    u_int32_t verbosity, 
-				    u_int32_t  flags)
-{
-  return MP4CreateEx(fileName, verbosity, flags);
-}
-
-extern "C" MP4FileHandle MP4CreateEx (const char* fileName,
-				      u_int32_t verbosity, 
-				      u_int32_t  flags,
-				      int add_ftyp,
-				      int add_iods,
-				      char* majorBrand, 
-				      u_int32_t minorVersion,
-				      char** supportedBrands, 
-				      u_int32_t supportedBrandsCount)
+				    u_int32_t  flags,
+				    int add_ftyp,
+				    int add_iods,
+				    char* majorBrand, 
+				    u_int32_t minorVersion,
+				    char** supportedBrands, 
+				    u_int32_t supportedBrandsCount)
 {
 	MP4File* pFile = NULL;
 	try {
@@ -703,24 +695,6 @@
 	return 0;
 }
 
-extern "C" MP4TrackId MP4AddHrefTrack (MP4FileHandle hFile,
-				       uint32_t timeScale,
-				       MP4Duration sampleDuration)
-{
-  if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
-    try {
-      MP4File *pFile = (MP4File *)hFile;
-
-      return pFile->AddHrefTrack(timeScale, 
-				 sampleDuration);
-    }
-    catch (MP4Error* e) {
-      PRINT_ERROR(e);
-      delete e;
-    }
-  }
-  return MP4_INVALID_TRACK_ID;
-}
 
 extern "C" MP4TrackId MP4AddVideoTrack(
 	MP4FileHandle hFile, 
@@ -806,7 +780,7 @@
 
 extern "C" bool MP4AddH264SequenceParameterSet (MP4FileHandle hFile,
 						MP4TrackId trackId,
-						const uint8_t *pSequence,
+						uint8_t *pSequence,
 						uint16_t sequenceLen)
 {
   if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
@@ -826,8 +800,8 @@
 }
 extern "C" bool MP4AddH264PictureParameterSet (MP4FileHandle hFile,
 					       MP4TrackId trackId,
-					       const uint8_t *pPict,
-					       uint16_t pictLen)
+					       uint8_t *pPict,
+						uint16_t pictLen)
 {
   if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
     try {
@@ -1588,7 +1562,7 @@
 						    MP4_MSECS_TIME_SCALE);
 		  MP4Track *pTrack = pFile->GetTrack(trackId);
 		  uint64_t bytes = pTrack->GetTotalOfSampleSizes();
-		  bytes *= (u_int64_t) (8 * 1000);
+		  bytes *= TO_U64(8 * 1000);
 		  bytes /= msDuration;
 		  return (uint32_t)bytes;
 		}
@@ -1763,7 +1737,7 @@
 	return 0;
 }
 
-extern "C" double MP4GetTrackVideoFrameRate(
+extern "C" float MP4GetTrackVideoFrameRate(
 	MP4FileHandle hFile, MP4TrackId trackId)
 {
 	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
@@ -3339,20 +3313,6 @@
   return false;
 }
  
-extern "C" bool MP4DeleteMetadataName(MP4FileHandle hFile)
-{
-  if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
-    try {
-      return ((MP4File*)hFile)->DeleteMetadataName();
-    }
-    catch (MP4Error* e) {
-      PRINT_ERROR(e);
-      delete e;
-    }
-  }
-  return false;
-}
- 
 extern "C" bool MP4SetMetadataWriter(MP4FileHandle hFile,
 				     const char* value)
 {
@@ -3383,20 +3343,6 @@
   return false;
 }
  
-extern "C" bool MP4DeleteMetadataWriter(MP4FileHandle hFile)
-{
-  if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
-    try {
-      return ((MP4File*)hFile)->DeleteMetadataWriter();
-    }
-    catch (MP4Error* e) {
-      PRINT_ERROR(e);
-      delete e;
-    }
-  }
-  return false;
-}
- 
 extern "C" bool MP4SetMetadataAlbum(MP4FileHandle hFile,
 				    const char* value)
 {
@@ -3427,20 +3373,6 @@
   return false;
 }
  
-extern "C" bool MP4DeleteMetadataAlbum(MP4FileHandle hFile)
-{
-  if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
-    try {
-      return ((MP4File*)hFile)->DeleteMetadataAlbum();
-    }
-    catch (MP4Error* e) {
-      PRINT_ERROR(e);
-      delete e;
-    }
-  }
-  return false;
-}
-
 extern "C" bool MP4SetMetadataArtist(MP4FileHandle hFile,
 				     const char* value)
 {
@@ -3471,20 +3403,6 @@
   return false;
 }
  
-extern "C" bool MP4DeleteMetadataArtist(MP4FileHandle hFile)
-{
-  if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
-    try {
-      return ((MP4File*)hFile)->DeleteMetadataArtist();
-    }
-    catch (MP4Error* e) {
-      PRINT_ERROR(e);
-      delete e;
-    }
-  }
-  return false;
-}
-
 extern "C" bool MP4SetMetadataTool(MP4FileHandle hFile,
 				   const char* value)
 {
@@ -3515,20 +3433,6 @@
   return false;
 }
  
-extern "C" bool MP4DeleteMetadataTool(MP4FileHandle hFile)
-{
-  if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
-    try {
-      return ((MP4File*)hFile)->DeleteMetadataTool();
-    }
-    catch (MP4Error* e) {
-      PRINT_ERROR(e);
-      delete e;
-    }
-  }
-  return false;
-}
-
 extern "C" bool MP4SetMetadataComment(MP4FileHandle hFile,
 				      const char* value)
 {
@@ -3559,20 +3463,6 @@
   return false;
 }
  
-extern "C" bool MP4DeleteMetadataComment(MP4FileHandle hFile)
-{
-  if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
-    try {
-      return ((MP4File*)hFile)->DeleteMetadataComment();
-    }
-    catch (MP4Error* e) {
-      PRINT_ERROR(e);
-      delete e;
-    }
-  }
-  return false;
-}
-
 extern "C" bool MP4SetMetadataYear(MP4FileHandle hFile,
 				   const char* value)
 {
@@ -3603,20 +3493,6 @@
   return false;
 }
  
-extern "C" bool MP4DeleteMetadataYear(MP4FileHandle hFile)
-{
-  if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
-    try {
-      return ((MP4File*)hFile)->DeleteMetadataYear();
-    }
-    catch (MP4Error* e) {
-      PRINT_ERROR(e);
-      delete e;
-    }
-  }
-  return false;
-}
-
 extern "C" bool MP4SetMetadataTrack(MP4FileHandle hFile,
 				    u_int16_t track, u_int16_t totalTracks)
 {
@@ -3647,20 +3523,6 @@
   return false;
 }
  
-extern "C" bool MP4DeleteMetadataTrack(MP4FileHandle hFile)
-{
-  if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
-    try {
-      return ((MP4File*)hFile)->DeleteMetadataTrack();
-    }
-    catch (MP4Error* e) {
-      PRINT_ERROR(e);
-      delete e;
-    }
-  }
-  return false;
-}
-
 extern "C" bool MP4SetMetadataDisk(MP4FileHandle hFile,
 				   u_int16_t disk, u_int16_t totalDisks)
 {
@@ -3691,20 +3553,6 @@
   return false;
 }
  
-extern "C" bool MP4DeleteMetadataDisk(MP4FileHandle hFile)
-{
-  if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
-    try {
-      return ((MP4File*)hFile)->DeleteMetadataDisk();
-    }
-    catch (MP4Error* e) {
-      PRINT_ERROR(e);
-      delete e;
-    }
-  }
-  return false;
-}
-
 extern "C" bool MP4SetMetadataGenre(MP4FileHandle hFile, const char *genre)
 {
   if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
@@ -3733,62 +3581,6 @@
   return false;
 }
  
-extern "C" bool MP4DeleteMetadataGenre(MP4FileHandle hFile)
-{
-  if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
-    try {
-      return ((MP4File*)hFile)->DeleteMetadataGenre();
-    }
-    catch (MP4Error* e) {
-      PRINT_ERROR(e);
-      delete e;
-    }
-  }
-  return false;
-}
-
-extern "C" bool MP4SetMetadataGrouping(MP4FileHandle hFile, const char *grouping)
-{
-  if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
-    try {
-      return ((MP4File*)hFile)->SetMetadataGrouping(grouping);
-    }
-    catch (MP4Error* e) {
-      PRINT_ERROR(e);
-      delete e;
-    }
-  }
-  return false;
-}
- 
-extern "C" bool MP4GetMetadataGrouping(MP4FileHandle hFile, char **grouping)
-{
-  if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
-    try {
-      return ((MP4File*)hFile)->GetMetadataGrouping(grouping);
-    }
-    catch (MP4Error* e) {
-      PRINT_ERROR(e);
-      delete e;
-    }
-  }
-  return false;
-}
- 
-extern "C" bool MP4DeleteMetadataGrouping(MP4FileHandle hFile)
-{
-  if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
-    try {
-      return ((MP4File*)hFile)->DeleteMetadataGrouping();
-    }
-    catch (MP4Error* e) {
-      PRINT_ERROR(e);
-      delete e;
-    }
-  }
-  return false;
-}
-
 extern "C" bool MP4SetMetadataTempo(MP4FileHandle hFile, u_int16_t tempo)
 {
   if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
@@ -3817,20 +3609,6 @@
   return false;
 }
  
-extern "C" bool MP4DeleteMetadataTempo(MP4FileHandle hFile)
-{
-  if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
-    try {
-      return ((MP4File*)hFile)->DeleteMetadataTempo();
-    }
-    catch (MP4Error* e) {
-      PRINT_ERROR(e);
-      delete e;
-    }
-  }
-  return false;
-}
-
 extern "C" bool MP4SetMetadataCompilation(MP4FileHandle hFile, u_int8_t cpl)
 {
   if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
@@ -3859,20 +3637,6 @@
   return false;
 }
  
-extern "C" bool MP4DeleteMetadataCompilation(MP4FileHandle hFile)
-{
-  if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
-    try {
-      return ((MP4File*)hFile)->DeleteMetadataCompilation();
-    }
-    catch (MP4Error* e) {
-      PRINT_ERROR(e);
-      delete e;
-    }
-  }
-  return false;
-}
-
 extern "C" bool MP4SetMetadataCoverArt(MP4FileHandle hFile,
 				       u_int8_t *coverArt, u_int32_t size)
 {
@@ -3903,20 +3667,6 @@
   return false;
 }
  
-extern "C" bool MP4DeleteMetadataCoverArt(MP4FileHandle hFile)
-{
-  if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
-    try {
-      return ((MP4File*)hFile)->DeleteMetadataCoverArt();
-    }
-    catch (MP4Error* e) {
-      PRINT_ERROR(e);
-      delete e;
-    }
-  }
-  return false;
-}
-
 extern "C" bool MP4SetMetadataFreeForm(MP4FileHandle hFile, char *name,
 				       u_int8_t* pValue, u_int32_t valueSize)
 {
@@ -3946,18 +3696,3 @@
   }
   return false;
 }
-
-extern "C" bool MP4DeleteMetadataFreeForm(MP4FileHandle hFile, char *name)
-{
-  if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
-    try {
-      return ((MP4File*)hFile)->DeleteMetadataFreeForm(name);
-    }
-    catch (MP4Error* e) {
-      PRINT_ERROR(e);
-      delete e;
-    }
-  }
-  return false;
-}
-
--- a/Plugins/Input/aac/libmp4v2/mp4.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/mp4.h	Wed Nov 16 16:21:11 2005 -0800
@@ -13,7 +13,7 @@
  * 
  * The Initial Developer of the Original Code is Cisco Systems Inc.
  * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2001 - 2005.  All Rights Reserved.
+ * Copyright (C) Cisco Systems Inc. 2001 - 2004.  All Rights Reserved.
  * 
  * 3GPP features implementation is based on 3GPP's TS26.234-v5.60,
  * and was contributed by Ximpo Group Ltd.
@@ -25,7 +25,6 @@
  *		Dave Mackie			dmackie@cisco.com
  *		Alix Marchandise-Franquet	alix@cisco.com
  *              Ximpo Group Ltd.                mp4v2@ximpo.com
- *              Bill May                        wmay@cisco.com
  */
 
 #ifndef __MP4_INCLUDED__
@@ -39,11 +38,6 @@
 #define NAN HUGE_VAL
 #endif
 
-#define X64 "%llx"
-#define U64 "%llu"
-#define D64 "%lld"
-#define UINT64_TO_DOUBLE    (double)
-
 #ifdef __cplusplus
 /* exploit C++ ability of default values for function parameters */
 #define DEFAULT(x)	=x
@@ -104,7 +98,6 @@
 #define MP4_AUDIO_TRACK_TYPE	"soun"
 #define MP4_VIDEO_TRACK_TYPE	"vide"
 #define MP4_HINT_TRACK_TYPE		"hint"
-#define MP4_CNTL_TRACK_TYPE     "cntl"
 /*
  * This second set of track types should be created 
  * via MP4AddSystemsTrack(type)
@@ -121,9 +114,6 @@
 #define MP4_IS_AUDIO_TRACK_TYPE(type) \
 	(!strcasecmp(type, MP4_AUDIO_TRACK_TYPE))
 
-#define MP4_IS_CNTL_TRACK_TYPE(type) \
-        (!strcasecmp(type, MP4_CNTL_TRACK_TYPE))
-
 #define MP4_IS_OD_TRACK_TYPE(type) \
 	(!strcasecmp(type, MP4_OD_TRACK_TYPE))
 
@@ -185,7 +175,7 @@
 
 #define MP4_IS_MPEG4_AAC_AUDIO_TYPE(mpeg4Type) \
 	(((mpeg4Type) >= MP4_MPEG4_AAC_MAIN_AUDIO_TYPE \
-		&& (mpeg4Type) <= MP4_MPEG4_AAC_HE_AUDIO_TYPE) \
+		&& (mpeg4Type) <= MP4_MPEG4_AAC_LTP_AUDIO_TYPE) \
 	  || (mpeg4Type) == MP4_MPEG4_AAC_SCALABLE_AUDIO_TYPE \
           || (mpeg4Type) == 17)
 
@@ -297,10 +287,6 @@
 MP4FileHandle MP4Create(
 	const char* fileName, 
 	u_int32_t verbosity DEFAULT(0),
-	u_int32_t flags DEFAULT(0));
-MP4FileHandle MP4CreateEx(
-        const char *fileName,
-	u_int32_t verbosity DEFAULT(0),
 	u_int32_t flags DEFAULT(0),
 	int add_ftyp DEFAULT(1),
 	int add_iods DEFAULT(1),
@@ -473,10 +459,6 @@
 void MP4SetAmrModeSet(MP4FileHandle hFile, MP4TrackId trakId, uint16_t modeSet);
 uint16_t MP4GetAmrModeSet(MP4FileHandle hFile, MP4TrackId trackId);
 
-MP4TrackId MP4AddHrefTrack(MP4FileHandle hFile, 
-			   uint32_t timeScale, 
-			   MP4Duration sampleDuration);
-
 MP4TrackId MP4AddVideoTrack(
 	MP4FileHandle hFile, 
 	u_int32_t timeScale, 
@@ -506,12 +488,12 @@
 				uint8_t sampleLenFieldSizeMinusOne);
 bool MP4AddH264SequenceParameterSet(MP4FileHandle hFile,
 				    MP4TrackId trackId,
-				    const uint8_t *pSequence,
+				    uint8_t *pSequence,
 				    uint16_t sequenceLen);
 bool MP4AddH264PictureParameterSet(MP4FileHandle hFile,
 				   MP4TrackId trackId,
-				   const uint8_t *pPict,
-				   uint16_t pictLen);
+				   uint8_t *pPict,
+				    uint16_t pictLen);
 void MP4SetH263Vendor(
 		MP4FileHandle hFile,
 		MP4TrackId trackId,
@@ -677,7 +659,7 @@
 	MP4FileHandle hFile, 
 	MP4TrackId trackId);
 
-double MP4GetTrackVideoFrameRate(
+float MP4GetTrackVideoFrameRate(
 	MP4FileHandle hFile, 
 	MP4TrackId trackId);
 
@@ -1095,57 +1077,40 @@
 			   u_int8_t** ppValue, u_int32_t* pValueSize);
 bool MP4SetMetadataName(MP4FileHandle hFile, const char* value);
 bool MP4GetMetadataName(MP4FileHandle hFile, char** value);
-bool MP4DeleteMetadataName(MP4FileHandle hFile);
 bool MP4SetMetadataArtist(MP4FileHandle hFile, const char* value);
 bool MP4GetMetadataArtist(MP4FileHandle hFile, char** value);
-bool MP4DeleteMetadataArtist(MP4FileHandle hFile);
 bool MP4SetMetadataWriter(MP4FileHandle hFile, const char* value);
 bool MP4GetMetadataWriter(MP4FileHandle hFile, char** value);
-bool MP4DeleteMetadataWriter(MP4FileHandle hFile);
 bool MP4SetMetadataComment(MP4FileHandle hFile, const char* value);
 bool MP4GetMetadataComment(MP4FileHandle hFile, char** value);
-bool MP4DeleteMetadataComment(MP4FileHandle hFile);
 bool MP4SetMetadataTool(MP4FileHandle hFile, const char* value);
 bool MP4GetMetadataTool(MP4FileHandle hFile, char** value);
-bool MP4DeleteMetadataTool(MP4FileHandle hFile);
 bool MP4SetMetadataYear(MP4FileHandle hFile, const char* value);
 bool MP4GetMetadataYear(MP4FileHandle hFile, char** value);
-bool MP4DeleteMetadataYear(MP4FileHandle hFile);
 bool MP4SetMetadataAlbum(MP4FileHandle hFile, const char* value);
 bool MP4GetMetadataAlbum(MP4FileHandle hFile, char** value);
-bool MP4DeleteMetadataAlbum(MP4FileHandle hFile);
 bool MP4SetMetadataTrack(MP4FileHandle hFile,
 			 u_int16_t track, u_int16_t totalTracks);
 bool MP4GetMetadataTrack(MP4FileHandle hFile,
 			 u_int16_t* track, u_int16_t* totalTracks);
-bool MP4DeleteMetadataTrack(MP4FileHandle hFile);
 bool MP4SetMetadataDisk(MP4FileHandle hFile,
 			u_int16_t disk, u_int16_t totalDisks);
 bool MP4GetMetadataDisk(MP4FileHandle hFile,
 			u_int16_t* disk, u_int16_t* totalDisks);
-bool MP4DeleteMetadataDisk(MP4FileHandle hFile);
 bool MP4SetMetadataGenre(MP4FileHandle hFile, const char *genre);
 bool MP4GetMetadataGenre(MP4FileHandle hFile, char **genre);
-bool MP4DeleteMetadataGenre(MP4FileHandle hFile);
-bool MP4SetMetadataGrouping(MP4FileHandle hFile, const char *grouping);
-bool MP4GetMetadataGrouping(MP4FileHandle hFile, char **grouping);
-bool MP4DeleteMetadataGrouping(MP4FileHandle hFile);
 bool MP4SetMetadataTempo(MP4FileHandle hFile, u_int16_t tempo);
 bool MP4GetMetadataTempo(MP4FileHandle hFile, u_int16_t* tempo);
-bool MP4DeleteMetadataTempo(MP4FileHandle hFile);
 bool MP4SetMetadataCompilation(MP4FileHandle hFile, u_int8_t cpl);
 bool MP4GetMetadataCompilation(MP4FileHandle hFile, u_int8_t* cpl);
-bool MP4DeleteMetadataCompilation(MP4FileHandle hFile);
 bool MP4SetMetadataCoverArt(MP4FileHandle hFile,
 			    u_int8_t *coverArt, u_int32_t size);
 bool MP4GetMetadataCoverArt(MP4FileHandle hFile,
 			    u_int8_t **coverArt, u_int32_t* size);
-bool MP4DeleteMetadataCoverArt(MP4FileHandle hFile);
 bool MP4SetMetadataFreeForm(MP4FileHandle hFile, char *name,
 			    u_int8_t* pValue, u_int32_t valueSize);
 bool MP4GetMetadataFreeForm(MP4FileHandle hFile, char *name,
 			    u_int8_t** pValue, u_int32_t* valueSize);
-bool MP4DeleteMetadataFreeForm(MP4FileHandle hFile, char *name);
  
 
 /* time conversion utilties */
--- a/Plugins/Input/aac/libmp4v2/mp4atom.cpp	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/mp4atom.cpp	Wed Nov 16 16:21:11 2005 -0800
@@ -84,21 +84,57 @@
 	pAtom = new MP4SoundAtom("alaw");
       }
       break;
+    case 'b':
+      if (ATOMID(type) == ATOMID("bitr")) {
+	pAtom = new MP4BitrAtom();
+      } else if (ATOMID(type) == ATOMID("btrt")) {
+	pAtom = new MP4BtrtAtom();
+      }
+      break;
+    case '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 (ATOMID(type) == ATOMID("cpil")) { /* Apple iTunes */
+	pAtom = new MP4CpilAtom();
+      } else if (ATOMID(type) == ATOMID("covr")) { /* Apple iTunes */
+	pAtom = new MP4CovrAtom();
+      }
+      break;
     case 'd':
       if (ATOMID(type) == ATOMID("d263")) {
 	pAtom = new MP4D263Atom();
       } else if (ATOMID(type) == ATOMID("damr")) {
 	pAtom = new MP4DamrAtom();
+      } else 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 (ATOMID(type) == ATOMID("data")) { /* Apple iTunes */
 	pAtom = new MP4DataAtom();
+      } else if (ATOMID(type) == ATOMID("disk")) { /* Apple iTunes */
+	pAtom = new MP4DiskAtom();
       }
       break;
     case 'e':
-      if (ATOMID(type) == ATOMID("elst")) {
+      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 (ATOMID(type) == ATOMID("enca")) {
 	pAtom = new MP4EncaAtom();
@@ -109,13 +145,22 @@
     case 'f':
       if (ATOMID(type) == ATOMID("free")) {
 	pAtom = new MP4FreeAtom();
+      } else if (ATOMID(type) == ATOMID("frma")) {
+	pAtom = new MP4FrmaAtom();
       } else if (ATOMID(type) == ATOMID("ftyp")) {
 	pAtom = new MP4FtypAtom();
       }
       break;
+    case 'g':
+      if (ATOMID(type) == ATOMID("gnre")) { // Apple iTunes 
+	pAtom = new MP4GnreAtom();
+      }
+      break;
     case '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")) {
@@ -124,13 +169,19 @@
 	pAtom = new MP4HinfAtom();
       } else if (ATOMID(type) == ATOMID("h263")) {
 	pAtom = new MP4VideoAtom("h263");
-      } else if (ATOMID(type) == ATOMID("href")) {
-	pAtom = new MP4HrefAtom();
       }
       break;
     case 'i':
-      if (ATOMID(type) == ATOMID("ipir")) {
+      if (ATOMID(type) == ATOMID("iKMS")) {
+	pAtom = new MP4IKMSAtom();
+      } else if (ATOMID(type) == ATOMID("iSFM")) {
+	pAtom = new MP4ISFMAtom();
+      } else if (ATOMID(type) == ATOMID("iods")) {
+	pAtom = new MP4IodsAtom();
+      } else if (ATOMID(type) == ATOMID("ipir")) {
 	pAtom = new MP4TrefTypeAtom(type);
+      } else if (ATOMID(type) == ATOMID("ilst")) {
+	pAtom = new MP4IlstAtom();
       } else if (ATOMID(type) == ATOMID("ima4")) {
 	pAtom = new MP4SoundAtom("ima4");
       }
@@ -141,12 +192,18 @@
       }
       break;
     case 'm':
-      if (ATOMID(type) == ATOMID("mdhd")) {
+      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("mdat")) {
-	pAtom = new MP4MdatAtom();
       } else if (ATOMID(type) == ATOMID("mpod")) {
 	pAtom = new MP4TrefTypeAtom(type);
       } else if (ATOMID(type) == ATOMID("mp4a")) {
@@ -155,15 +212,36 @@
 	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 (ATOMID(type) == ATOMID("meta")) { // iTunes
+	pAtom = new MP4MetaAtom();
       } else if (ATOMID(type) == ATOMID("mean")) { // iTunes
 	pAtom = new MP4MeanAtom();
       }
       break;
     case 'n':
-      if (ATOMID(type) == ATOMID("name")) { // iTunes
+      if (ATOMID(type) == ATOMID("nmhd")) {
+	pAtom = new MP4NmhdAtom();
+      } else if (ATOMID(type) == ATOMID("nump")) {
+	pAtom = new MP4NumpAtom();
+      } else if (ATOMID(type) == ATOMID("name")) { // iTunes
 	pAtom = new MP4NameAtom();
       }
       break;
+    case 'p':
+      if (ATOMID(type) == ATOMID("pmax")) {
+	pAtom = new MP4PmaxAtom();
+      } else if (ATOMID(type) == ATOMID("payt")) {
+	pAtom = new MP4PaytAtom();
+      }
+      break;
     case 'r':
       if (ATOMID(type) == ATOMID("rtp ")) {
 	pAtom = new MP4RtpAtom();
@@ -178,18 +256,36 @@
 	pAtom = new MP4AmrAtom("samr");
       } else if (ATOMID(type) == ATOMID("sawb")) {
 	pAtom = new MP4AmrAtom("sawb");
+      } else if (ATOMID(type) == ATOMID("schi")) {
+	pAtom = new MP4SchiAtom();
+      } else if (ATOMID(type) == ATOMID("schm")) {
+	pAtom = new MP4SchmAtom();
+      } else if (ATOMID(type) == ATOMID("sinf")) {
+	pAtom = new MP4SinfAtom();
       } else 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")) {
@@ -200,12 +296,36 @@
       }
       break;
     case 't':
-      if (ATOMID(type) == ATOMID("tkhd")) {
+      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 (ATOMID(type) == ATOMID("trkn")) { // iTunes
+	pAtom = new MP4TrknAtom();
+      } else if (ATOMID(type) == ATOMID("tmpo")) { // iTunes
+	pAtom = new MP4TmpoAtom();
       } else if (ATOMID(type) == ATOMID("twos")) {
 	pAtom = new MP4SoundAtom("twos");
       }
@@ -238,12 +358,44 @@
 	pAtom = new MP4SmiAtom();
       }
       break;
+    case 0251: { // copyright symbol 
+static const char name[5]={0251,'n', 'a', 'm', '\0'};
+static const char art[5]={0251,'A', 'R', 'T', '\0'};
+static const char wrt[5]={0251,'w', 'r', 't', '\0'};
+static const char alb[5]={0251,'a', 'l', 'b', '\0'};
+static const char day[5]={0251,'d', 'a', 'y', '\0'};
+static const char too[5]={0251,'t', 'o', 'o', '\0'};
+static const char cmt[5]={0251,'c', 'm', 't', '\0'};
+static const char gen[5]={0251,'g', 'e', 'n', '\0'};
+      if (ATOMID(type) == ATOMID(name)) {
+ 	pAtom = new MP4NamAtom();
+      } else if (ATOMID(type) == ATOMID(art)) { /* Apple iTunes */
+ 	pAtom = new MP4ArtAtom();
+      } else if (ATOMID(type) == ATOMID(wrt)) { /* Apple iTunes */
+ 	pAtom = new MP4WrtAtom();
+      } else if (ATOMID(type) == ATOMID(alb)) { /* Apple iTunes */
+ 	pAtom = new MP4AlbAtom();
+      } else if (ATOMID(type) == ATOMID(day)) { /* Apple iTunes */
+ 	pAtom = new MP4DayAtom();
+      } else if (ATOMID(type) == ATOMID(too)) { /* Apple iTunes */
+ 	pAtom = new MP4TooAtom();
+      } else if (ATOMID(type) == ATOMID(cmt)) { /* Apple iTunes */
+ 	pAtom = new MP4CmtAtom();
+      } else if (ATOMID(type) == ATOMID(gen)) { /* Apple iTunes */
+	pAtom = new MP4GenAtom();
+      }
+      break;
+    }
+    case '-':
+      if (ATOMID(type) == ATOMID("----")) { /* Apple iTunes */
+ 	pAtom = new MP4DashAtom();
+      }
     }
   }
 
   if (pAtom == NULL) {
-    pAtom = new MP4StandardAtom(type);
-    // unknown type is set by StandardAtom type
+    pAtom = new MP4Atom(type);
+    pAtom->SetUnknownType(true);
   }
 
   ASSERT(pAtom);
@@ -287,7 +439,7 @@
 	u_int64_t pos = pFile->GetPosition();
 
 	VERBOSE_READ(pFile->GetVerbosity(), 
-		printf("ReadAtom: pos = 0x%llx\n", pos));
+		printf("ReadAtom: pos = 0x"X64"\n", pos));
 
 	u_int64_t dataSize = pFile->ReadUInt32();
 
@@ -315,17 +467,15 @@
 	dataSize -= hdrSize;
 
 	VERBOSE_READ(pFile->GetVerbosity(), 
-		printf("ReadAtom: type = \"%s\" data-size = %llu (0x%llx) hdr %u\n", 
-		       type, dataSize, dataSize, hdrSize));
+		printf("ReadAtom: type = %s data-size = "U64" (0x"X64")\n", 
+			type, dataSize, dataSize));
 
 	if (pos + hdrSize + dataSize > pParentAtom->GetEnd()) {
 		VERBOSE_ERROR(pFile->GetVerbosity(), 
-			printf("ReadAtom: invalid atom size, extends outside parent atom - skipping to end of \"%s\" \"%s\" %llu vs %llu\n", 
-			       pParentAtom->GetType(), type,
-			       pos + hdrSize + dataSize, 
-			       pParentAtom->GetEnd()));
+			printf("ReadAtom: invalid atom size, extends outside parent atom - skipping to end of %s \"%s\"\n", 
+			       pParentAtom->GetType(), type));
 		VERBOSE_READ(pFile->GetVerbosity(),
-			     printf("parent %s (%llu) pos %llu hdr %d data %llu sum %llu\n",
+			     printf("parent %s ("U64") pos "U64" hdr %d data "U64" sum "U64"\n",
 				    pParentAtom->GetType(),
 				    pParentAtom->GetEnd(),
 				    pos, 
@@ -392,7 +542,7 @@
 
 	if (ATOMID(m_type) != 0 && m_size > 1000000) {
 		VERBOSE_READ(GetVerbosity(), 
-			printf("Warning: %s atom size %llu is suspect\n",
+			printf("Warning: %s atom size "U64" is suspect\n",
 				m_type, m_size));
 	}
 
@@ -410,7 +560,7 @@
 {
 	if (m_pFile->GetPosition() != m_end) {
 		VERBOSE_READ(m_pFile->GetVerbosity(),
-			printf("Skip: %llu bytes\n", m_end - m_pFile->GetPosition()));
+			printf("Skip: "U64" bytes\n", m_end - m_pFile->GetPosition()));
 	}
 	m_pFile->SetPosition(m_end);
 }
@@ -546,7 +696,7 @@
 
 		if (m_pFile->GetPosition() > m_end) {
 			VERBOSE_READ(GetVerbosity(), 
-				printf("ReadProperties: insufficient data for property: %s pos 0x%llx atom end 0x%llx\n",
+				printf("ReadProperties: insufficient data for property: %s pos 0x"X64" atom end 0x"X64"\n",
 					m_pProperties[i]->GetName(), 
 					m_pFile->GetPosition(), m_end)); 
 
@@ -588,7 +738,7 @@
 	    }
 	    // otherwise, output a warning, but don't care
 	    VERBOSE_WARNING(GetVerbosity(),
-			    printf("Error: In %s atom, extra %lld bytes at end of atom\n", 
+			    printf("Error: In %s atom, extra "D64" bytes at end of atom\n", 
 				   m_type, (m_end - position)));
 	    for (uint64_t ix = 0; ix < m_end - position; ix++) {
 	      m_pFile->ReadUInt8();
@@ -700,10 +850,6 @@
 {
 	m_end = m_pFile->GetPosition();
 	m_size = (m_end - m_start);
-  VERBOSE_WRITE(GetVerbosity(), 
-		printf("end: type %s %llu %llu size %llu\n", m_type, 
-		       m_start, m_end,
-		       m_size));
 	//use64 = m_pFile->Use64Bits();
 	if (use64) {
 		m_pFile->SetPosition(m_start + 8);
--- a/Plugins/Input/aac/libmp4v2/mp4atom.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/mp4atom.h	Wed Nov 16 16:21:11 2005 -0800
@@ -96,7 +96,7 @@
 	};
 	void SetType(const char* type) {
 		if (type && *type != '\0') {
-		  // not needed ASSERT(strlen(type) == 4);
+			ASSERT(strlen(type) == 4);
 			memcpy(m_type, type, 4);
 			m_type[4] = '\0';
 		} else {
--- a/Plugins/Input/aac/libmp4v2/mp4descriptor.cpp	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/mp4descriptor.cpp	Wed Nov 16 16:21:11 2005 -0800
@@ -81,7 +81,7 @@
 void MP4Descriptor::ReadHeader(MP4File* pFile)
 {
 	VERBOSE_READ(pFile->GetVerbosity(),
-		printf("ReadDescriptor: pos = 0x%llx\n", 
+		printf("ReadDescriptor: pos = 0x"X64"\n", 
 			pFile->GetPosition()));
 
 	// read tag and length
--- a/Plugins/Input/aac/libmp4v2/mp4file.cpp	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/mp4file.cpp	Wed Nov 16 16:21:11 2005 -0800
@@ -13,7 +13,7 @@
  * 
  * The Initial Developer of the Original Code is Cisco Systems Inc.
  * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2001 - 2005.  All Rights Reserved.
+ * Copyright (C) Cisco Systems Inc. 2001 - 2004.  All Rights Reserved.
  * 
  * 3GPP features implementation is based on 3GPP's TS26.234-v5.60,
  * and was contributed by Ximpo Group Ltd.
@@ -25,7 +25,6 @@
  *		Dave Mackie		  dmackie@cisco.com
  *              Alix Marchandise-Franquet alix@cisco.com
  *              Ximpo Group Ltd.          mp4v2@ximpo.com
- *              Bill May                  wmay@cisco.com
  */
 
 #include "mp4common.h"
@@ -62,11 +61,6 @@
 MP4File::~MP4File()
 {
 	MP4Free(m_fileName);
-	if (m_pFile != NULL) {
-	  // not closed ?
-	  fclose(m_pFile);
-	  m_pFile = NULL;
-	}
 	delete m_pRootAtom;
 	for (u_int32_t i = 0; i < m_pTracks.Size(); i++) {
 		delete m_pTracks[i];
@@ -1431,40 +1425,7 @@
   return trackId;
 }
 
-MP4TrackId MP4File::AddCntlTrackDefault (uint32_t timeScale,
-					 MP4Duration sampleDuration,
-					 const char *type)
-{
-  MP4TrackId trackId = AddTrack(MP4_CNTL_TRACK_TYPE, timeScale);
-
-  InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "nmhd", 0);
-  AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), type);
-
-  // 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.stsz.sampleSize", sampleDuration);
-  
-  m_pTracks[FindTrackIndex(trackId)]->
-    SetFixedSampleDuration(sampleDuration);
-  
-  return trackId;
-}
-
-MP4TrackId MP4File::AddHrefTrack (uint32_t timeScale, 
-				  MP4Duration sampleDuration)
-{
-  MP4TrackId trackId = AddCntlTrackDefault(timeScale, sampleDuration, "href");
-
-  return trackId;
-}
-		  
+
 MP4TrackId MP4File::AddVideoTrackDefault(
 	u_int32_t timeScale, 
 	MP4Duration sampleDuration, 
@@ -1667,7 +1628,7 @@
 }
 
 bool MP4File::AddH264SequenceParameterSet (MP4TrackId trackId,
-					   const uint8_t *pSequence,
+					   uint8_t *pSequence,
 					   uint16_t sequenceLen)
 {
   MP4Atom *avcCAtom = 
@@ -1709,8 +1670,8 @@
   return true;
 }
 bool MP4File::AddH264PictureParameterSet (MP4TrackId trackId,
-					  const uint8_t *pPict,
-					  uint16_t pictLen)
+					   uint8_t *pPict,
+					   uint16_t pictLen)
 {
   MP4Atom *avcCAtom = 
     FindAtom(MakeTrackName(trackId,
@@ -2365,7 +2326,7 @@
 	return m_pTracks[FindTrackIndex(trackId)]->GetFixedSampleDuration();
 }
 
-double MP4File::GetTrackVideoFrameRate(MP4TrackId trackId)
+float MP4File::GetTrackVideoFrameRate(MP4TrackId trackId)
 {
 	MP4SampleId numSamples =
 		GetTrackNumberOfSamples(trackId);
@@ -2378,7 +2339,7 @@
 		return 0.0;
 	}
 
-	return ((double)numSamples / (double) msDuration) * MP4_MSECS_TIME_SCALE;
+	return ((double)numSamples / UINT64_TO_DOUBLE(msDuration)) * MP4_MSECS_TIME_SCALE;
 }
 
 int MP4File::GetTrackAudioChannels (MP4TrackId trackId)
--- a/Plugins/Input/aac/libmp4v2/mp4file.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/mp4file.h	Wed Nov 16 16:21:11 2005 -0800
@@ -13,7 +13,7 @@
  * 
  * The Initial Developer of the Original Code is Cisco Systems Inc.
  * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2001 - 2005.  All Rights Reserved.
+ * Copyright (C) Cisco Systems Inc. 2001 - 2004.  All Rights Reserved.
  * 
  * 3GPP features implementation is based on 3GPP's TS26.234-v5.60,
  * and was contributed by Ximpo Group Ltd.
@@ -234,9 +234,6 @@
 			u_int8_t framesPerSample,
 			bool isAmrWB);
 
-	MP4TrackId AddHrefTrack(uint32_t timeScale,
-				MP4Duration sampleDuration);
-
 	MP4TrackId AddMP4VideoTrack(
 		u_int32_t timeScale, 
 		MP4Duration sampleDuration,
@@ -257,7 +254,6 @@
                 bool      selective_enc,
                 char      *kms_uri);
 
-
 	void SetH263Vendor(
 			MP4TrackId trackId,
 			u_int32_t vendor);
@@ -290,10 +286,10 @@
 				     uint8_t AVCLevelIndication,
 				     uint8_t sampleLenFieldSizeMinusOne);
 	bool AddH264SequenceParameterSet(MP4TrackId trackId,
-					 const uint8_t *pSequence,
+					 uint8_t *pSequence,
 					 uint16_t sequenceLen);
 	bool AddH264PictureParameterSet(MP4TrackId trackId,
-					const uint8_t *pPicture,
+					uint8_t *pPicture,
 					uint16_t pictureLen);
 	MP4TrackId AddHintTrack(MP4TrackId refTrackId);
 
@@ -314,7 +310,7 @@
 
 	MP4Duration GetTrackFixedSampleDuration(MP4TrackId trackId);
 
-	double GetTrackVideoFrameRate(MP4TrackId trackId);
+	float GetTrackVideoFrameRate(MP4TrackId trackId);
 	
 	int GetTrackAudioChannels(MP4TrackId trackId);
 	void GetTrackESConfiguration(MP4TrackId trackId, 
@@ -539,12 +535,7 @@
 		MP4Duration* pDuration = NULL);
 
 	/* iTunes metadata handling */
- protected:
 	bool CreateMetadataAtom(const char* name);
-	bool DeleteMetadataAtom(const char* name);
-	bool GetMetadataString(const char *atom, char **value);
-	bool SetMetadataString(const char *atom, const char *value);
- public:
 	bool MetadataDelete(void);
 	
 	/* set metadata */
@@ -558,7 +549,6 @@
 	bool SetMetadataTrack(u_int16_t track, u_int16_t totalTracks);
 	bool SetMetadataDisk(u_int16_t disk, u_int16_t totalDisks);
 	bool SetMetadataGenre(const char *value);
-	bool SetMetadataGrouping(const char *value);
 	bool SetMetadataTempo(u_int16_t tempo);
 	bool SetMetadataCompilation(u_int8_t compilation);
 	bool SetMetadataCoverArt(u_int8_t *coverArt, u_int32_t size);
@@ -581,31 +571,12 @@
 	bool GetMetadataTrack(u_int16_t* track, u_int16_t* totalTracks);
 	bool GetMetadataDisk(u_int16_t* disk, u_int16_t* totalDisks);
 	bool GetMetadataGenre(char **value);
-	bool GetMetadataGrouping(char **value);
 	bool GetMetadataTempo(u_int16_t* tempo);
 	bool GetMetadataCompilation(u_int8_t* compilation);
 	bool GetMetadataCoverArt(u_int8_t **coverArt, u_int32_t* size);
 	bool GetMetadataFreeForm(char *name, 
 				 u_int8_t** pValue, 
 				 u_int32_t* valueSize);
-
-	/* delete metadata */
-	bool DeleteMetadataName();
-	bool DeleteMetadataWriter();
-	bool DeleteMetadataAlbum();
-	bool DeleteMetadataArtist();
-	bool DeleteMetadataTool();
-	bool DeleteMetadataComment();
-	bool DeleteMetadataYear();
-	bool DeleteMetadataTrack();
-	bool DeleteMetadataDisk();
-	bool DeleteMetadataGenre();
-	bool DeleteMetadataGrouping();
-	bool DeleteMetadataTempo();
-	bool DeleteMetadataCompilation();
-	bool DeleteMetadataCoverArt();
-	bool DeleteMetadataFreeForm(char *name);
-
 	/* end of MP4 API */
 
 	/* "protected" interface to be used only by friends in library */
@@ -728,10 +699,6 @@
 		u_int16_t width, 
 		u_int16_t height, 
 		const char *videoType);
-	MP4TrackId AddCntlTrackDefault(
-		u_int32_t timeScale, 
-		MP4Duration sampleDuration,
-		const char *videoType);
 	void AddTrackToIod(MP4TrackId trackId);
 
 	void RemoveTrackFromIod(MP4TrackId trackId, bool shallHaveIods = true);
--- a/Plugins/Input/aac/libmp4v2/mp4info.cpp	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/mp4info.cpp	Wed Nov 16 16:21:11 2005 -0800
@@ -158,7 +158,7 @@
 		MP4GetTrackDuration(mp4File, trackId);
 
 	double msDuration =
-		(double) (MP4ConvertFromTrackDuration(mp4File, trackId,
+		UINT64_TO_DOUBLE(MP4ConvertFromTrackDuration(mp4File, trackId,
 			trackDuration, MP4_MSECS_TIME_SCALE));
 
 	u_int32_t avgBitRate =
@@ -302,46 +302,14 @@
 
 	const char *media_data_name;
 	uint8_t type = 0;
-	
 	media_data_name = MP4GetTrackMediaDataName(mp4File, trackId);
-	char  typebuffer[80];
+
 	if (media_data_name == NULL) {
 	  typeName = "Unknown - no media data name";
 	  foundTypeName = true;
 	} else if (strcasecmp(media_data_name, "avc1") == 0) {
 	  // avc
-	  uint8_t profile, level;
-	  char profileb[20], levelb[20];
-	  if (MP4GetTrackH264ProfileLevel(mp4File, trackId, &profile, &level)) {
-	    if (profile == 66) {
-	      strcpy(profileb, "Baseline");
-	    } else if (profile == 77) {
-	      strcpy(profileb, "Main");
-	    } else if (profile == 88) {
-	      strcpy(profileb, "Extended");
-	    } else {
-	      sprintf(profileb, "Unknown Profile %x", profile);
-	    } 
-	    switch (level) {
-	    case 10: case 20: case 30: case 40: case 50:
-	      sprintf(levelb, "%u", level / 10);
-	      break;
-	    case 11: case 12: case 13:
-	    case 21: case 22:
-	    case 31: case 32:
-	    case 41: case 42:
-	    case 51:
-	      sprintf(levelb, "%u.%u", level / 10, level % 10);
-	      break;
-	    default:
-	      sprintf(levelb, "unknown level %x", level);
-	      break;
-	    }
-	    sprintf(typebuffer, "H264 %s@%s", profileb, levelb);
-	    typeName = typebuffer;
-	  } else {
-	    typeName = "H.264 - profile/level error";
-	  }
+	  typeName = "H.264";
 	  foundTypeName = true;
 	} else if (strcasecmp(media_data_name, "s263") == 0) {
 	  // 3gp h.263
@@ -377,7 +345,7 @@
 		MP4GetTrackDuration(mp4File, trackId);
 
 	double msDuration =
-		(double) (MP4ConvertFromTrackDuration(mp4File, trackId,
+		UINT64_TO_DOUBLE(MP4ConvertFromTrackDuration(mp4File, trackId,
 			trackDuration, MP4_MSECS_TIME_SCALE));
 
 	u_int32_t avgBitRate =
@@ -389,14 +357,14 @@
 
 	u_int16_t height = MP4GetTrackVideoHeight(mp4File, trackId);
 
-	double fps = MP4GetTrackVideoFrameRate(mp4File, trackId);
+	float fps = MP4GetTrackVideoFrameRate(mp4File, trackId);
 
 	char *sInfo = (char*)MP4Malloc(256);
 
 	// type duration avgBitrate frameSize frameRate
 	if (foundTypeName) {
 	  sprintf(sInfo,
-		  "%u\tvideo\t%s%s, %.3f secs, %u kbps, %ux%u @ %f fps\n",
+		  "%u\tvideo\t%s%s, %.3f secs, %u kbps, %ux%u @ %.2f fps\n",
 		  trackId,
 		  MP4IsIsmaCrypMediaTrack(mp4File, trackId) ? "encv - " : "",
 		  typeName,
@@ -408,7 +376,7 @@
 		  );
 	} else {
 	  sprintf(sInfo,
-		  "%u\tvideo\t%s(%u), %.3f secs, %u kbps, %ux%u @ %f fps\n",
+		  "%u\tvideo\t%s(%u), %.3f secs, %u kbps, %ux%u @ %.2f fps\n",
 		  trackId,
 		  typeName,
 		  type, 
@@ -422,38 +390,7 @@
 
 	return sInfo;
 }
-static char* PrintCntlInfo(
-	MP4FileHandle mp4File,
-	MP4TrackId trackId)
-{
-  const char *media_data_name = MP4GetTrackMediaDataName(mp4File, trackId);
-  const char *typeName = "Unknown";
 
-  if (media_data_name == NULL) {
-    typeName = "Unknown - no media data name";
-  } else if (strcasecmp(media_data_name, "href") == 0) {
-    typeName = "ISMA Href";
-  } else {
-    typeName = media_data_name;
-  }
-
-  MP4Duration trackDuration = 
-    MP4GetTrackDuration(mp4File, trackId);
- 
-  double msDuration = 
-    (double) (MP4ConvertFromTrackDuration(mp4File, trackId, 
-						 trackDuration, MP4_MSECS_TIME_SCALE));
-  char *sInfo = (char *)MP4Malloc(256);
-
-  snprintf(sInfo, 256,
-	   "%u\tcontrol\t%s, %.3f secs\n",
-	   trackId, 
-	   typeName,
-	   msDuration / 1000.0);
-  return sInfo;
-}
-
-	  
 static char* PrintHintInfo(
 	MP4FileHandle mp4File,
 	MP4TrackId trackId)
@@ -492,8 +429,6 @@
 		trackInfo = PrintVideoInfo(mp4File, trackId);
 	} else if (!strcmp(trackType, MP4_HINT_TRACK_TYPE)) {
 		trackInfo = PrintHintInfo(mp4File, trackId);
-	} else if (strcmp(trackType, MP4_CNTL_TRACK_TYPE) == 0) {
-	  trackInfo = PrintCntlInfo(mp4File, trackId);
 	} else {
 		trackInfo = (char*)MP4Malloc(256);
 		if (!strcmp(trackType, MP4_OD_TRACK_TYPE)) {
--- a/Plugins/Input/aac/libmp4v2/mp4meta.cpp	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/mp4meta.cpp	Wed Nov 16 16:21:11 2005 -0800
@@ -35,7 +35,6 @@
  - ©too : Tool(s) used to create the file (string)
  - ©cmt : Comment (string)
  - ©gen : Custom genre (string)
- - ©grp : Grouping (string)
  - trkn : Tracknumber (8 byte string)
            16 bit: empty
            16 bit: tracknumber
@@ -136,64 +135,122 @@
     return true;
 }
 
-bool MP4File::DeleteMetadataAtom(const char* name)
+bool MP4File::SetMetadataName(const char* value)
 {
+    const char *s = "moov.udta.meta.ilst.\251nam.data";
+    MP4BytesProperty *pMetadataProperty = NULL;
     MP4Atom *pMetaAtom = NULL;
-    char s[256];
-
-    sprintf(s, "moov.udta.meta.ilst.%s", name);
+    
     pMetaAtom = m_pRootAtom->FindAtom(s);
 
-    /* if it exists, delete it */
-    if (pMetaAtom)
+    if (!pMetaAtom)
     {
-        MP4Atom *pParent = pMetaAtom->GetParentAtom();
+        if (!CreateMetadataAtom("\251nam"))
+            return false;
 
-        pParent->DeleteChildAtom(pMetaAtom);
-
-        delete pMetaAtom;
-
-        return true;
+        pMetaAtom = m_pRootAtom->FindAtom(s);
     }
 
-    return false;
+    pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty);
+    ASSERT(pMetadataProperty);
+
+    pMetadataProperty->SetValue((u_int8_t*)value, strlen(value));
+
+    return true;
 }
 
-bool MP4File::SetMetadataString (const char *atom, const char *value)
-{
-  char atomstring[40];
-  MP4Atom *pMetaAtom;
-  MP4BytesProperty *pMetadataProperty = NULL;
-  sprintf(atomstring, "moov.udta.meta.ilst.%s.data", atom);
-
-  pMetaAtom = m_pRootAtom->FindAtom(atomstring);
-  
-  if (!pMetaAtom)
-    {
-      if (!CreateMetadataAtom(atom))
-	return false;
-      
-      pMetaAtom = m_pRootAtom->FindAtom(atomstring);
-    }
-
-  pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty);
-  ASSERT(pMetadataProperty);
-  
-  pMetadataProperty->SetValue((u_int8_t*)value, strlen(value));
-  
-  return true;
-}
-
-bool MP4File::GetMetadataString (const char *atom, char **value)
+bool MP4File::GetMetadataName(char** value)
 {
     unsigned char *val = NULL;
     u_int32_t valSize = 0;
-    char atomstring[60];
-    sprintf(atomstring, "moov.udta.meta.ilst.%s.data.metadata", atom);
+    const char *s = "moov.udta.meta.ilst.\251nam.data.metadata";
+    GetBytesProperty(s, (u_int8_t**)&val, &valSize);
+
+    if (valSize > 0)
+    {
+        *value = (char*)malloc((valSize+1)*sizeof(unsigned char));
+        memset(*value, 0, (valSize+1)*sizeof(unsigned char));
+        memcpy(*value, val, valSize*sizeof(unsigned char));
+        return true;
+    } else {
+        *value = NULL;
+        return false;
+    }
+}
+
+bool MP4File::SetMetadataWriter(const char* value)
+{
+    const char *s = "moov.udta.meta.ilst.\251wrt.data";
+    MP4BytesProperty *pMetadataProperty = NULL;
+    MP4Atom *pMetaAtom = NULL;
+    
+    pMetaAtom = m_pRootAtom->FindAtom(s);
+
+    if (!pMetaAtom)
+    {
+        if (!CreateMetadataAtom("\251wrt"))
+            return false;
+
+        pMetaAtom = m_pRootAtom->FindAtom(s);
+    }
+
+    pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty);
+    ASSERT(pMetadataProperty);
+
+    pMetadataProperty->SetValue((u_int8_t*)value, strlen(value));
+
+    return true;
+}
 
-    *value = NULL;
+bool MP4File::GetMetadataWriter(char** value)
+{
+    unsigned char *val = NULL;
+    u_int32_t valSize = 0;
+    const char *s = "moov.udta.meta.ilst.\251wrt.data.metadata";
+    GetBytesProperty(s, (u_int8_t**)&val, &valSize);
+
+    if (valSize > 0)
+    {
+        *value = (char*)malloc((valSize+1)*sizeof(unsigned char));
+        memset(*value, 0, (valSize+1)*sizeof(unsigned char));
+        memcpy(*value, val, valSize*sizeof(unsigned char));
+        return true;
+    } else {
+        *value = NULL;
+        return false;
+    }
+}
 
-    GetBytesProperty(atomstring, (u_int8_t**)&val, &valSize);
+bool MP4File::SetMetadataAlbum(const char* value)
+{
+    const char *s = "moov.udta.meta.ilst.\251alb.data";
+    MP4BytesProperty *pMetadataProperty = NULL;
+    MP4Atom *pMetaAtom = NULL;
+    
+    pMetaAtom = m_pRootAtom->FindAtom(s);
+
+    if (!pMetaAtom)
+    {
+        if (!CreateMetadataAtom("\251alb"))
+            return false;
+
+        pMetaAtom = m_pRootAtom->FindAtom(s);
+    }
+
+    pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty);
+    ASSERT(pMetadataProperty);
+
+    pMetadataProperty->SetValue((u_int8_t*)value, strlen(value));
+
+    return true;
+}
+
+bool MP4File::GetMetadataAlbum(char** value)
+{
+    unsigned char *val = NULL;
+    u_int32_t valSize = 0;
+    const char *s = "moov.udta.meta.ilst.\251alb.data.metadata";
+    GetBytesProperty(s, (u_int8_t**)&val, &valSize);
 
     if (valSize > 0)
     {
@@ -201,115 +258,185 @@
         memset(*value, 0, (valSize+1)*sizeof(unsigned char));
         memcpy(*value, val, valSize*sizeof(unsigned char));
         return true;
-    } 
-    return false;
-}
-
-bool MP4File::SetMetadataName(const char* value)
-{
-  return SetMetadataString("\251nam", value);
-}
-
-bool MP4File::GetMetadataName(char** value)
-{
-  return GetMetadataString("\251nam", value);
-}
-
-bool MP4File::DeleteMetadataName()
-{
-  return DeleteMetadataAtom("\251nam");
-}
-
-bool MP4File::SetMetadataWriter(const char* value)
-{
-  return SetMetadataString("\251wrt", value);
-}
-
-bool MP4File::GetMetadataWriter(char** value)
-{
-  return GetMetadataString("\251wrt", value);
-}
-
-bool MP4File::DeleteMetadataWriter()
-{
-  return DeleteMetadataAtom("\251wrt");
-}
-
-bool MP4File::SetMetadataAlbum(const char* value)
-{
-  return SetMetadataString("\251alb", value);
-}
-
-bool MP4File::GetMetadataAlbum(char** value)
-{
-  return GetMetadataString("\251alb", value);
-}
-
-bool MP4File::DeleteMetadataAlbum()
-{
-  return DeleteMetadataAtom("\251alb");
+    } else {
+        *value = NULL;
+        return false;
+    }
 }
 
 bool MP4File::SetMetadataArtist(const char* value)
 {
-  return SetMetadataString("\251ART", value);
+    const char *s = "moov.udta.meta.ilst.\251ART.data";
+    MP4BytesProperty *pMetadataProperty = NULL;
+    MP4Atom *pMetaAtom = NULL;
+    
+    pMetaAtom = m_pRootAtom->FindAtom(s);
+
+    if (!pMetaAtom)
+    {
+        if (!CreateMetadataAtom("\251ART"))
+            return false;
+
+        pMetaAtom = m_pRootAtom->FindAtom(s);
+    }
+
+    pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty);
+    ASSERT(pMetadataProperty);
+
+    pMetadataProperty->SetValue((u_int8_t*)value, strlen(value));
+
+    return true;
 }
 
 bool MP4File::GetMetadataArtist(char** value)
 {
-  return GetMetadataString("\251ART", value);
-}
+    unsigned char *val = NULL;
+    u_int32_t valSize = 0;
+    const char *s = "moov.udta.meta.ilst.\251ART.data.metadata";
+    GetBytesProperty(s, (u_int8_t**)&val, &valSize);
 
-bool MP4File::DeleteMetadataArtist()
-{
-  return DeleteMetadataAtom("\251ART");
+    if (valSize > 0)
+    {
+        *value = (char*)malloc((valSize+1)*sizeof(unsigned char));
+        memset(*value, 0, (valSize+1)*sizeof(unsigned char));
+        memcpy(*value, val, valSize*sizeof(unsigned char));
+        return true;
+    } else {
+        *value = NULL;
+        return false;
+    }
 }
 
 bool MP4File::SetMetadataTool(const char* value)
 {
-  return SetMetadataString("\251too", value);
+    const char *s = "moov.udta.meta.ilst.\251too.data";
+    MP4BytesProperty *pMetadataProperty = NULL;
+    MP4Atom *pMetaAtom = NULL;
+    
+    pMetaAtom = m_pRootAtom->FindAtom(s);
+
+    if (!pMetaAtom)
+    {
+        if (!CreateMetadataAtom("\251too"))
+            return false;
+
+        pMetaAtom = m_pRootAtom->FindAtom(s);
+    }
+
+    pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty);
+    ASSERT(pMetadataProperty);
+
+    pMetadataProperty->SetValue((u_int8_t*)value, strlen(value));
+
+    return true;
 }
 
 bool MP4File::GetMetadataTool(char** value)
 {
-  return GetMetadataString("\251too", value);
-}
+    unsigned char *val = NULL;
+    u_int32_t valSize = 0;
+    const char *s = "moov.udta.meta.ilst.\251too.data.metadata";
+    GetBytesProperty(s, (u_int8_t**)&val, &valSize);
 
-bool MP4File::DeleteMetadataTool()
-{
-  return DeleteMetadataAtom("\251too");
+    if (valSize > 0)
+    {
+        *value = (char*)malloc((valSize+1)*sizeof(unsigned char));
+        memset(*value, 0, (valSize+1)*sizeof(unsigned char));
+        memcpy(*value, val, valSize*sizeof(unsigned char));
+        return true;
+    } else {
+        *value = NULL;
+        return false;
+    }
 }
 
 bool MP4File::SetMetadataComment(const char* value)
 {
-  return SetMetadataString("\251cmt", value);
+    const char *s = "moov.udta.meta.ilst.\251cmt.data";
+    MP4BytesProperty *pMetadataProperty = NULL;
+    MP4Atom *pMetaAtom = NULL;
+    
+    pMetaAtom = m_pRootAtom->FindAtom(s);
+
+    if (!pMetaAtom)
+    {
+        if (!CreateMetadataAtom("\251cmt"))
+            return false;
+
+        pMetaAtom = m_pRootAtom->FindAtom(s);
+    }
+
+    pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty);
+    ASSERT(pMetadataProperty);
+
+    pMetadataProperty->SetValue((u_int8_t*)value, strlen(value));
+
+    return true;
 }
 
 bool MP4File::GetMetadataComment(char** value)
 {
-  return GetMetadataString("\251cmt", value);
-}
+    unsigned char *val = NULL;
+    u_int32_t valSize = 0;
+    const char *s = "moov.udta.meta.ilst.\251cmt.data.metadata";
+    GetBytesProperty(s, (u_int8_t**)&val, &valSize);
 
-bool MP4File::DeleteMetadataComment()
-{
-  return DeleteMetadataAtom("\251cmt");
+    if (valSize > 0)
+    {
+        *value = (char*)malloc((valSize+1)*sizeof(unsigned char));
+        memset(*value, 0, (valSize+1)*sizeof(unsigned char));
+        memcpy(*value, val, valSize*sizeof(unsigned char));
+        return true;
+    } else {
+        *value = NULL;
+        return false;
+    }
 }
 
 bool MP4File::SetMetadataYear(const char* value)
 {
-  if (strlen(value) != 4) return false;
+    const char *s = "moov.udta.meta.ilst.\251day.data";
+    MP4BytesProperty *pMetadataProperty = NULL;
+    MP4Atom *pMetaAtom = NULL;
+    
+    pMetaAtom = m_pRootAtom->FindAtom(s);
+
+    if (!pMetaAtom)
+    {
+        if (!CreateMetadataAtom("\251day"))
+            return false;
 
-  return SetMetadataString("\251day", value);
+        pMetaAtom = m_pRootAtom->FindAtom(s);
+    }
+
+    pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty);
+    ASSERT(pMetadataProperty);
+
+    if (strlen(value) < 4)
+        return false;
+
+    pMetadataProperty->SetValue((u_int8_t*)value, 4);
+
+    return true;
 }
 
 bool MP4File::GetMetadataYear(char** value)
 {
-  return GetMetadataString("\251day", value);
-}
+    unsigned char *val = NULL;
+    u_int32_t valSize = 0;
+    const char *s = "moov.udta.meta.ilst.\251day.data.metadata";
+    GetBytesProperty(s, (u_int8_t**)&val, &valSize);
 
-bool MP4File::DeleteMetadataYear()
-{
-  return DeleteMetadataAtom("\251day");
+    if (valSize > 0)
+    {
+        *value = (char*)malloc((valSize+1)*sizeof(unsigned char));
+        memset(*value, 0, (valSize+1)*sizeof(unsigned char));
+        memcpy(*value, val, valSize*sizeof(unsigned char));
+        return true;
+    } else {
+        *value = NULL;
+        return false;
+    }
 }
 
 bool MP4File::SetMetadataTrack(u_int16_t track, u_int16_t totalTracks)
@@ -348,12 +475,11 @@
     unsigned char *val = NULL;
     u_int32_t valSize = 0;
     const char *s = "moov.udta.meta.ilst.trkn.data.metadata";
+    GetBytesProperty(s, (u_int8_t**)&val, &valSize);
 
     *track = 0;
     *totalTracks = 0;
 
-    GetBytesProperty(s, (u_int8_t**)&val, &valSize);
-
     if (valSize != 8)
         return false;
 
@@ -365,11 +491,6 @@
     return true;
 }
 
-bool MP4File::DeleteMetadataTrack()
-{
-  return DeleteMetadataAtom("trkn");
-}
-
 bool MP4File::SetMetadataDisk(u_int16_t disk, u_int16_t totalDisks)
 {
     unsigned char t[9];
@@ -406,12 +527,11 @@
     unsigned char *val = NULL;
     u_int32_t valSize = 0;
     const char *s = "moov.udta.meta.ilst.disk.data.metadata";
+    GetBytesProperty(s, (u_int8_t**)&val, &valSize);
 
     *disk = 0;
     *totalDisks = 0;
 
-    GetBytesProperty(s, (u_int8_t**)&val, &valSize);
-
     if (valSize != 8)
         return false;
 
@@ -423,11 +543,6 @@
     return true;
 }
 
-bool MP4File::DeleteMetadataDisk()
-{
-  return DeleteMetadataAtom("disk");
-}
-
 static const char* ID3v1GenreList[] = {
     "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk",
     "Grunge", "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies",
@@ -494,13 +609,11 @@
 
     genreIndex = StringToGenre(value);
 
-    const char *s = "moov.udta.meta.ilst.gnre.data";
-    const char *sroot = "moov.udta.meta.ilst.gnre";
-    const char *s2 = "moov.udta.meta.ilst.\251gen.data";
-    const char *s2root = "moov.udta.meta.ilst.\251gen";
     if (genreIndex != 0)
     {
-      pMetaAtom = m_pRootAtom->FindAtom(s);
+        const char *s = "moov.udta.meta.ilst.gnre.data";
+        pMetaAtom = m_pRootAtom->FindAtom(s);
+
         if (!pMetaAtom)
         {
             if (!CreateMetadataAtom("gnre"))
@@ -517,20 +630,10 @@
         ASSERT(pMetadataProperty);
 
         pMetadataProperty->SetValue((u_int8_t*)t, 2);
-	
-	// remove other style of genre atom, if this one is added
-	pMetaAtom = m_pRootAtom->FindAtom(s2root);
-	if (pMetaAtom != NULL) {
-	  MP4Atom *pParent = pMetaAtom->GetParentAtom();
-	  pParent->DeleteChildAtom(pMetaAtom);
-	  delete pMetaAtom;
-	}
-	  
-
-        (void)DeleteMetadataAtom( "\251gen" );
 
         return true;
     } else {
+        const char *s2 = "moov.udta.meta.ilst.\251gen.data";
         pMetaAtom = m_pRootAtom->FindAtom(s2);
 
         if (!pMetaAtom)
@@ -546,13 +649,6 @@
 
         pMetadataProperty->SetValue((u_int8_t*)value, strlen(value));
 
-	// remove other gnre atom if this one is entered
-	pMetaAtom = m_pRootAtom->FindAtom(sroot);
-      if (pMetaAtom != NULL) {
-	MP4Atom *pParent = pMetaAtom->GetParentAtom();
-	pParent->DeleteChildAtom(pMetaAtom);
-	delete pMetaAtom;
-      }
         return true;
     }
 
@@ -567,8 +663,6 @@
     const char *t = "moov.udta.meta.ilst.gnre";
     const char *s = "moov.udta.meta.ilst.gnre.data.metadata";
 
-    *value = NULL;
-
     MP4Atom *gnre = FindAtom(t);
 
     if (gnre)
@@ -583,8 +677,6 @@
 
         GenreToString(value, genreIndex);
 
-        (void)DeleteMetadataAtom( "gnre" );
-
         return true;
     } else {
         const char *s2 = "moov.udta.meta.ilst.\251gen.data.metadata";
@@ -601,6 +693,7 @@
             memcpy(*value, val, valSize*sizeof(unsigned char));
             return true;
         } else {
+            *value = NULL;
             return false;
         }
     }
@@ -608,28 +701,6 @@
     return false;
 }
 
-bool MP4File::DeleteMetadataGenre()
-{
-  bool val1 = DeleteMetadataAtom("\251gen");
-  bool val2 = DeleteMetadataAtom("gnre");
-  return val1 || val2;
-}
-
-bool MP4File::SetMetadataGrouping(const char* value)
-{
-  return SetMetadataString("\251grp", value);
-}
-
-bool MP4File::GetMetadataGrouping(char** value)
-{
-  return GetMetadataString("\251grp", value);
-}
-
-bool MP4File::DeleteMetadataGrouping()
-{
-  return DeleteMetadataAtom("\251grp");
-}
-
 bool MP4File::SetMetadataTempo(u_int16_t tempo)
 {
     unsigned char t[3];
@@ -664,11 +735,10 @@
     unsigned char *val = NULL;
     u_int32_t valSize = 0;
     const char *s = "moov.udta.meta.ilst.tmpo.data.metadata";
+    GetBytesProperty(s, (u_int8_t**)&val, &valSize);
 
     *tempo = 0;
 
-    GetBytesProperty(s, (u_int8_t**)&val, &valSize);
-
     if (valSize != 2)
         return false;
 
@@ -678,11 +748,6 @@
     return true;
 }
 
-bool MP4File::DeleteMetadataTempo()
-{
-  return DeleteMetadataAtom("tmpo");
-}
-
 bool MP4File::SetMetadataCompilation(u_int8_t compilation)
 {
     const char *s = "moov.udta.meta.ilst.cpil.data";
@@ -713,11 +778,10 @@
     unsigned char *val = NULL;
     u_int32_t valSize = 0;
     const char *s = "moov.udta.meta.ilst.cpil.data.metadata";
+    GetBytesProperty(s, (u_int8_t**)&val, &valSize);
 
     *compilation = 0;
 
-    GetBytesProperty(s, (u_int8_t**)&val, &valSize);
-
     if (valSize != 1)
         return false;
 
@@ -726,11 +790,6 @@
     return true;
 }
 
-bool MP4File::DeleteMetadataCompilation()
-{
-  return DeleteMetadataAtom("cpil");
-}
-
 bool MP4File::SetMetadataCoverArt(u_int8_t *coverArt, u_int32_t size)
 {
     const char *s = "moov.udta.meta.ilst.covr.data";
@@ -758,10 +817,6 @@
 bool MP4File::GetMetadataCoverArt(u_int8_t **coverArt, u_int32_t *size)
 {
     const char *s = "moov.udta.meta.ilst.covr.data.metadata";
-
-    *coverArt = NULL;
-    *size = 0;
-
     GetBytesProperty(s, coverArt, size);
 
     if (size == 0)
@@ -770,11 +825,6 @@
     return true;
 }
 
-bool MP4File::DeleteMetadataCoverArt()
-{
-  return DeleteMetadataAtom("covr");
-}
-
 bool MP4File::SetMetadataFreeForm(char *name, u_int8_t* pValue, u_int32_t valueSize)
 {
     MP4Atom *pMetaAtom = NULL;
@@ -878,9 +928,6 @@
     char s[256];
     int i = 0;
 
-    *ppValue = NULL;
-    *pValueSize = 0;
-
     while (1)
     {
         MP4BytesProperty *pMetadataProperty;
@@ -916,45 +963,6 @@
     }
 }
 
-bool MP4File::DeleteMetadataFreeForm(char *name)
-{
-    char s[256];
-    int i = 0;
-
-    while (1)
-    {
-        MP4BytesProperty *pMetadataProperty;
-
-        sprintf(s, "moov.udta.meta.ilst.----[%u].name", i);
-
-        MP4Atom *pTagAtom = m_pRootAtom->FindAtom(s);
-
-        if (!pTagAtom)
-            return false;
-
-        pTagAtom->FindProperty("name.metadata", (MP4Property**)&pMetadataProperty);
-        if (pMetadataProperty)
-        {
-            u_int8_t* pV;
-            u_int32_t VSize = 0;
-
-            pMetadataProperty->GetValue(&pV, &VSize);
-
-            if (VSize != 0)
-            {
-                if (memcmp(pV, name, VSize) == 0)
-                {
-                    sprintf(s, "----[%u]", i);
-
-                    return DeleteMetadataAtom(s);
-                }
-            }
-        }
-
-        i++;
-    }
-}
-
 bool MP4File::MetadataDelete()
 {
     MP4Atom *pMetaAtom = NULL;
--- a/Plugins/Input/aac/libmp4v2/mp4property.cpp	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/mp4property.cpp	Wed Nov 16 16:21:11 2005 -0800
@@ -215,11 +215,11 @@
 	}
 	Indent(pFile, indent);
 	if (index != 0) 
-	  fprintf(pFile, "%s[%u] = %llu (0x%016llxf)\n", 
+	  fprintf(pFile, "%s[%u] = "U64" (0x%016"X64F")\n", 
 		  m_name, index, m_values[index], m_values[index]);
 	else
 	  fprintf(pFile, 
-		  "%s = %llu (0x%016llxf)\n", 
+		  "%s = "U64" (0x%016"X64F")\n", 
 		  m_name, m_values[index], m_values[index]);
 	fflush(pFile);
 }
@@ -256,11 +256,11 @@
 	}
 	if (index != 0) 
 	fprintf(pFile, 
-		"%s[%u] = %llu (0x%0*llxf) <%u bits>\n", 
+		"%s[%u] = "U64" (0x%0*"X64F") <%u bits>\n", 
 		m_name, index, m_values[index], (int)hexWidth, m_values[index], m_numBits);
 	else 
 	  fprintf(pFile, 
-		  "%s = %llu (0x%0*llxf) <%u bits>\n", 
+		  "%s = "U64" (0x%0*"X64F") <%u bits>\n", 
 		  m_name, m_values[index], (int)hexWidth, m_values[index], m_numBits);
 	fflush(pFile);
 }
--- a/Plugins/Input/aac/libmp4v2/mp4property.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/mp4property.h	Wed Nov 16 16:21:11 2005 -0800
@@ -301,7 +301,7 @@
 
 	void SetValue(const char* value, u_int32_t index = 0);
 
-	void AddValue(const char* value) {
+	void AddValue(char* value) {
 		u_int32_t count = GetCount();
 		SetCount(count + 1); 
 		SetValue(value, count);
@@ -387,7 +387,7 @@
 	void SetValue(const u_int8_t* pValue, u_int32_t valueSize, 
 		u_int32_t index = 0);
 
-	void AddValue(const u_int8_t* pValue, u_int32_t valueSize) {
+	void AddValue(u_int8_t* pValue, u_int32_t valueSize) {
 		u_int32_t count = GetCount();
 		SetCount(count + 1); 
 		SetValue(pValue, valueSize, count);
--- a/Plugins/Input/aac/libmp4v2/mp4track.cpp	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/mp4track.cpp	Wed Nov 16 16:21:11 2005 -0800
@@ -613,13 +613,14 @@
 		return 0;
 	}
 
-	double calc = (double) (GetTotalOfSampleSizes());
-	// this is a bit better - we use the whole duration
-	calc *= 8.0;
-	calc *= GetTimeScale();
-	calc /=	(double) (GetDuration());
-	// we might want to think about rounding to the next 100 or 1000
-	return (uint32_t) ceil(calc);
+	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()
@@ -628,48 +629,32 @@
 	MP4SampleId numSamples = GetNumberOfSamples();
 	u_int32_t maxBytesPerSec = 0;
 	u_int32_t bytesThisSec = 0;
-	MP4Timestamp thisSecStart = 0;
-	MP4Timestamp lastSampleTime = 0;
-	uint32_t lastSampleSize = 0;
+	MP4Timestamp thisSec = 0;
 
-	MP4SampleId thisSecStartSid = 1;
 	for (MP4SampleId sid = 1; sid <= numSamples; sid++) {
-	  uint32_t sampleSize;
-	  MP4Timestamp sampleTime;
+		u_int32_t sampleSize;
+		MP4Timestamp sampleTime;
+
+		sampleSize = GetSampleSize(sid);
+
+		GetSampleTimes(sid, &sampleTime, NULL);
 
-	  sampleSize = GetSampleSize(sid);
-	  GetSampleTimes(sid, &sampleTime, NULL);
-	  
-	  if (sampleTime < thisSecStart + timeScale) {
-	    bytesThisSec += sampleSize;
-	    lastSampleSize = sampleSize;
-	    lastSampleTime = sampleTime;
-	  } else {
-	    // we've already written the last sample and sampleSize.
-	    // this means that we've probably overflowed the last second
-	    // calculate the time we've overflowed
-	    MP4Duration overflow_dur = 
-	      (thisSecStart + timeScale) - lastSampleTime;
-	    // calculate the duration of the last sample
-	    MP4Duration lastSampleDur = sampleTime - lastSampleTime;
-	    uint32_t overflow_bytes;
-	    // now, calculate the number of bytes we overflowed.  Round up.
-	    overflow_bytes = 
-	      ((lastSampleSize * overflow_dur) + (lastSampleDur - 1)) / lastSampleDur;
+		// sample counts for current second
+		if (sampleTime < thisSec + timeScale) {
+			bytesThisSec += sampleSize;
+		} else { // sample is in a future second
+			if (bytesThisSec > maxBytesPerSec) {
+				maxBytesPerSec = bytesThisSec;
+			}
 
-	    if (bytesThisSec - overflow_bytes > maxBytesPerSec) {
-	      maxBytesPerSec = bytesThisSec - overflow_bytes;
-	    }
+			thisSec = sampleTime - (sampleTime % timeScale);
+			bytesThisSec = sampleSize;
+		}
+	}
 
-	    // now adjust the values for this sample.  Remove the bytes
-	    // from the first sample in this time frame
-	    lastSampleTime = sampleTime;
-	    lastSampleSize = sampleSize;
-	    bytesThisSec += sampleSize;
-	    bytesThisSec -= GetSampleSize(thisSecStartSid);
-	    thisSecStartSid++;
-	    GetSampleTimes(thisSecStartSid, &thisSecStart, NULL);
-	  }
+	// last second (or partial second) 
+	if (bytesThisSec > maxBytesPerSec) {
+		maxBytesPerSec = bytesThisSec;
 	}
 
 	return maxBytesPerSec * 8;
--- a/Plugins/Input/aac/libmp4v2/mp4util.cpp	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/mp4util.cpp	Wed Nov 16 16:21:11 2005 -0800
@@ -13,11 +13,10 @@
  * 
  * The Initial Developer of the Original Code is Cisco Systems Inc.
  * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2001-2005.  All Rights Reserved.
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
  * 
  * Contributor(s): 
  *		Dave Mackie		dmackie@cisco.com
- *              Bill May                wmay@cisco.com
  */
 
 #include "mp4common.h"
@@ -335,9 +334,6 @@
 	  || !strcasecmp(type, "od")) {
 		return MP4_OD_TRACK_TYPE;
 	}
-	if (strcasecmp(type, "cntl") == 0) {
-	  return MP4_CNTL_TRACK_TYPE;
-	}
 	VERBOSE_WARNING(verbosity,
 			printf("Attempt to normalize %s did not match\n",
 			       type));
--- a/Plugins/Input/aac/libmp4v2/mp4util.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/mp4util.h	Wed Nov 16 16:21:11 2005 -0800
@@ -22,6 +22,7 @@
 #ifndef __MP4_UTIL_INCLUDED__
 #define __MP4_UTIL_INCLUDED__
 #include <assert.h>
+#include <sys/time.h>
 
 #ifndef ASSERT
 #ifdef NDEBUG
@@ -206,24 +207,12 @@
 }
 
 inline u_int32_t STRTOINT32(const char* s) {
-#ifdef WORDS_BIGENDIAN
-  return (*(u_int32_t *)s);
-#else
-  return htonl(*(uint32_t *)s);
-#endif
-#if 0
 	return (s[0] << 24) | (s[1] << 16) | (s[2] << 8) | s[3];
-#endif
 }
 
 inline void INT32TOSTR(u_int32_t i, char* s) {
-#ifdef WORDS_BIGENDIAN
-  *(uint32_t *)s = i;
-  s[4] = 0;
-#else
 	s[0] = ((i >> 24) & 0xFF); s[1] = ((i >> 16) & 0xFF); 
 	s[2] = ((i >> 8) & 0xFF); s[3] = (i & 0xFF); s[4] = 0;
-#endif
 }
 
 inline MP4Timestamp MP4GetAbsTimestamp() {
--- a/Plugins/Input/aac/libmp4v2/rtphint.cpp	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libmp4v2/rtphint.cpp	Wed Nov 16 16:21:11 2005 -0800
@@ -415,8 +415,6 @@
 		sdpMediaType = "audio";
 	} else if (!strcmp(m_pRefTrack->GetType(), MP4_VIDEO_TRACK_TYPE)) {
 		sdpMediaType = "video";
-	} else if (!strcmp(m_pRefTrack->GetType(), MP4_CNTL_TRACK_TYPE)) {
-	  sdpMediaType = "control";
 	} else {
 		sdpMediaType = "application";
 	}
--- a/Plugins/Input/aac/src/Makefile.am	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/src/Makefile.am	Wed Nov 16 16:21:11 2005 -0800
@@ -4,6 +4,6 @@
 
 libaac_la_LDFLAGS = $(PLUGIN_LDFLAGS) ../libmp4v2/libmp4v2.la ../libfaad2/libfaad.la
 
-libaac_la_SOURCES = aac_utils.c libmp4.c mp4_utils.c
+libaac_la_SOURCES = libmp4.c mp4_utils.c aac_utils.c
 
 INCLUDES = $(GTK_CFLAGS) -I$(top_builddir)/intl -I$(top_srcdir) -I../include -I../libmp4v2 -I../libfaad
--- a/Plugins/Input/aac/src/aac_utils.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/src/aac_utils.c	Wed Nov 16 16:21:11 2005 -0800
@@ -62,7 +62,7 @@
     if(fread(header, 1, ADTS_HEADER_SIZE, fd)!=ADTS_HEADER_SIZE){
       break;
     }
-    if(!strncmp(header, "ID3", 3)){
+    if(!g_strncasecmp(header, "ID3", 3)){
       break;
     }
     if(!((header[0]==0xFF)&&((header[1]& 0xF6)==0xF0))){
--- a/Plugins/Input/aac/src/libmp4.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/src/libmp4.c	Wed Nov 16 16:21:11 2005 -0800
@@ -21,9 +21,9 @@
 #include <libaudacious/configfile.h>
 #include <libaudacious/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_DESCRIPTION	"MP4 & MPEG2/4-AAC for bmp-0.9.7"
+#define MP4_VERSION	"ver.- 15 December 2004"
+#define LIBMP4V2_VERSION "1.2.0"
 #define MP4_ABOUT	"Written by ciberfred"
 #define BUFFER_SIZE	FAAD_MIN_STREAMSIZE*64
 
@@ -80,6 +80,9 @@
 static pthread_mutex_t	mutex = PTHREAD_MUTEX_INITIALIZER;
 static int		seekPosition = -1;
 
+void getMP4info(char*);
+int getAACTrack(MP4FileHandle);
+
 
 InputPlugin *get_iplugin_info(void)
 {
@@ -113,13 +116,14 @@
 
 static int	mp4_isFile(char *filename)
 {
-  char *ext;
+  if(filename){
+    gchar*	extention;
 
-  if(filename){
-    ext = strrchr(filename, '.');
-    if (ext && (!strncasecmp(ext, ".mp4", 4) ||	// official extention
-	!strncasecmp(ext, ".m4a", 4) ||	// Apple mp4 extention
-	!strncasecmp(ext, ".aac", 4)	// old MPEG2/4-AAC 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);
     }
@@ -208,7 +212,7 @@
       guint		bufferSize = 0;
       gulong		samplerate;
       guchar		channels;
-      guint		avgBitrate;
+      //guint		avgBitrate;
       MP4Duration	duration;
       gulong		msDuration;
       MP4SampleId	numSamples;
@@ -249,7 +253,7 @@
       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);
+      g_print("MP4 - %d channels @ %d Hz\n", channels, (int)samplerate);
 
       while(bPlaying){
 	void*			sampleBuffer;
@@ -344,7 +348,7 @@
     faacDecConfigurationPtr config;
 
     if((file = fopen(args, "rb")) == 0){
-      g_print("AAC: can't find file %s\n", args);
+      g_print("AAC: can't find file %s\n", (char*)args);
       bPlaying = FALSE;
       pthread_mutex_unlock(&mutex);
       pthread_exit(NULL);
@@ -377,7 +381,7 @@
       pthread_exit(NULL);
     }
     XMMS_NEW_TITLEINPUT(input);
-    input->file_name = g_basename(temp);
+    input->file_name = (char*)g_basename(temp);
     input->file_ext = ext ? ext+1 : NULL;
     input->file_path = temp;
     if(!strncmp(buffer, "ID3", 3)){
--- a/Plugins/Input/aac/src/mp4_utils.c	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/src/mp4_utils.c	Wed Nov 16 16:21:11 2005 -0800
@@ -1,8 +1,9 @@
 /*
 ** some function for MP4 file based on libmp4v2 from mpeg4ip project
 */
-#include <mp4.h>
-#include <faad.h>
+#include <gtk/gtk.h>
+#include "mp4.h"
+#include "faad.h"
 
 const char *mp4AudioNames[]=
   {
@@ -52,27 +53,14 @@
   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 = MP4GetTrackEsdsObjectTypeId(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++;
-      }
+      u_int8_t audiotype = MP4GetTrackAudioMpeg4Type(file, trackID);
+      g_print("%s\n", mpeg4AudioNames[audiotype]);
+      if(audiotype !=0)
+	return(trackID);
+      else
+	return(-1);
     }
   }
     return(-1);
@@ -111,7 +99,7 @@
 void getMP4info(char* file)
 {
   MP4FileHandle	mp4file;
-  MP4Duration	trackDuration;
+  //MP4Duration	trackDuration;
   int numTracks;
   int i=0;
 
@@ -126,7 +114,7 @@
     printf("Track %d, %s", trackID, trackType);
     if(!strcmp(trackType, MP4_AUDIO_TRACK_TYPE)){//we found audio track !
       int j=0;
-      u_int8_t audiotype = MP4GetTrackEsdsObjectTypeId(mp4file, trackID);
+      u_int8_t audiotype = MP4GetTrackAudioMpeg4Type(mp4file, trackID);
       while(mp4AudioTypes[j]){ // what kind of audio is ?
 	if(mp4AudioTypes[j] == audiotype){
 	  if(mp4AudioTypes[j] == MP4_MPEG4_AUDIO_TYPE){
@@ -134,18 +122,18 @@
 	    g_print(" %s", mpeg4AudioNames[audiotype]);
 	  }
 	  else{
-	    printf(" %s", mp4AudioNames[j]);
+	    g_print(" %s", mp4AudioNames[j]);
 	  }
-	  g_print(" duration :%d",
-		 MP4ConvertFromTrackDuration(mp4file, trackID,
-					     MP4GetTrackDuration(mp4file,
-								 trackID),
-					     MP4_MSECS_TIME_SCALE));
+	  g_print(" duration : %d",
+		  (int)MP4ConvertFromTrackDuration(mp4file, trackID,
+					      MP4GetTrackDuration(mp4file,
+								  trackID),
+					      MP4_MSECS_TIME_SCALE));
 	}
 	j++;
       }
     }
-    printf("\n");
+    g_print("\n");
   }
   MP4Close(mp4file);
 }