shithub: aacdec

Download patch

ref: e1d8c8ab61ac3b8108516893cc04196fb8628cc7
parent: 31703a27d9c753d0fe8b8aa039a2463742e6df53
author: menno <menno>
date: Thu Feb 26 04:29:29 EST 2004

optimised low power QMF
added downsampled SBR

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,5 @@
-Empty :(
 
-I'll try to rebuild one later
+
+- 26 feb 2004: Added downsampled SBR support
+- 26 feb 2004: Optimised Low Power QMF filterbank
+
--- a/frontend/main.c
+++ b/frontend/main.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: main.c,v 1.70 2004/01/06 11:59:47 menno Exp $
+** $Id: main.c,v 1.71 2004/02/26 09:29:25 menno Exp $
 **/
 
 #ifdef _WIN32
@@ -464,7 +464,7 @@
     config->outputFormat = outputFormat;
     config->downMatrix = downMatrix;
     config->useOldADTSFormat = old_format;
-    config->dontUpSampleImplicitSBR = 1;
+    //config->dontUpSampleImplicitSBR = 1;
     faacDecSetConfiguration(hDecoder, config);
 
     /* get AAC infos for printing */
@@ -736,7 +736,7 @@
     config = faacDecGetCurrentConfiguration(hDecoder);
     config->outputFormat = outputFormat;
     config->downMatrix = downMatrix;
-    config->dontUpSampleImplicitSBR = 1;
+    //config->dontUpSampleImplicitSBR = 1;
     faacDecSetConfiguration(hDecoder, config);
 
     if (adts_out)
--- a/include/faad.h
+++ b/include/faad.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: faad.h,v 1.39 2004/02/06 10:23:28 menno Exp $
+** $Id: faad.h,v 1.40 2004/02/26 09:29:26 menno Exp $
 **/
 
 #ifndef __AACDEC_H__
@@ -129,6 +129,7 @@
 
     char sbr_present_flag;
     char forceUpSampling;
+    char downSampledSBR;
 } mp4AudioSpecificConfig;
 
 typedef struct faacDecConfiguration
--- a/libfaad/analysis.h
+++ b/libfaad/analysis.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: analysis.h,v 1.11 2004/01/05 14:05:11 menno Exp $
+** $Id: analysis.h,v 1.14 2004/09/04 14:56:27 menno Exp $
 **/
 
 #ifndef __ANALYSIS_H__
--- a/libfaad/bits.h
+++ b/libfaad/bits.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: bits.h,v 1.36 2004/02/04 20:07:24 menno Exp $
+** $Id: bits.h,v 1.37 2004/02/26 09:29:26 menno Exp $
 **/
 
 #ifndef __BITS_H__
--- a/libfaad/cfft.c
+++ b/libfaad/cfft.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: cfft.c,v 1.24 2004/01/05 14:47:27 menno Exp $
+** $Id: cfft.c,v 1.25 2004/02/26 09:29:26 menno Exp $
 **/
 
 /*
--- a/libfaad/cfft.h
+++ b/libfaad/cfft.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: cfft.h,v 1.16 2004/01/05 14:05:11 menno Exp $
+** $Id: cfft.h,v 1.19 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __CFFT_H__
--- a/libfaad/cfft_tab.h
+++ b/libfaad/cfft_tab.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: cfft_tab.h,v 1.12 2004/01/05 14:05:11 menno Exp $
+** $Id: cfft_tab.h,v 1.14 2004/05/17 10:18:02 menno Exp $
 **/
 
 #ifndef __CFFT_TAB_H__
--- a/libfaad/common.c
+++ b/libfaad/common.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: common.c,v 1.15 2004/01/05 14:05:11 menno Exp $
+** $Id: common.c,v 1.16 2004/02/26 09:29:26 menno Exp $
 **/
 
 /* just some common functions that could be used anywhere */
--- a/libfaad/common.h
+++ b/libfaad/common.h
@@ -1,19 +1,19 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
 ** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
-**
+**  
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
 ** the Free Software Foundation; either version 2 of the License, or
 ** (at your option) any later version.
-**
+** 
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ** GNU General Public License for more details.
-**
+** 
 ** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software 
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
 ** Any non-GPL usage of this software or parts of this software is strictly
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: common.h,v 1.50 2004/02/06 12:55:24 menno Exp $
+** $Id: common.h,v 1.51 2004/02/26 09:29:26 menno Exp $
 **/
 
 #ifndef __COMMON_H__
@@ -103,17 +103,17 @@
 //#define SBR_LOW_POWER
 //#define PS_DEC
 
-/* FIXED POINT: No MAIN decoding, no SBR decoding */
+/* FIXED POINT: No MAIN decoding, forced SBR Low Power decoder */
 #ifdef FIXED_POINT
 # ifdef MAIN_DEC
 #  undef MAIN_DEC
 # endif
-//# ifndef SBR_LOW_POWER
-//#  define SBR_LOW_POWER
-//# endif
 # ifdef SBR_DEC
 #  undef SBR_DEC
 # endif
+# ifndef SBR_LOW_POWER
+#  define SBR_LOW_POWER
+# endif
 #endif // FIXED_POINT
 
 #ifdef DRM
@@ -268,6 +268,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 */
@@ -284,6 +285,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 */
--- a/libfaad/decoder.c
+++ b/libfaad/decoder.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: decoder.c,v 1.94 2004/02/04 20:07:24 menno Exp $
+** $Id: decoder.c,v 1.95 2004/02/26 09:29:26 menno Exp $
 **/
 
 #include "common.h"
@@ -261,6 +261,8 @@
     {
         *samplerate *= 2;
         hDecoder->forceUpSampling = 1;
+    } else if (*samplerate > 24000 && !(hDecoder->config.dontUpSampleImplicitSBR)) {
+        hDecoder->downSampledSBR = 1;
     }
 #endif
 
@@ -325,6 +327,7 @@
 #endif
 #ifdef SBR_DEC
     hDecoder->sbr_present_flag = mp4ASC.sbr_present_flag;
+    hDecoder->downSampledSBR = mp4ASC.downSampledSBR;
     if (hDecoder->config.dontUpSampleImplicitSBR == 0)
         hDecoder->forceUpSampling = mp4ASC.forceUpSampling;
     else
@@ -331,7 +334,7 @@
         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);
     }
@@ -762,7 +765,7 @@
     if (hDecoder->object_type == DRM_ER_LC)
     {
         /* We do not support stereo right now */
-        if (hDecoder->channelConfiguration == 2)
+        if (0) //(hDecoder->channelConfiguration == 2)
         {
             hInfo->error = 8; // Throw CRC error
             goto error;
@@ -829,7 +832,7 @@
 
     if (!hDecoder->adts_header_present && !hDecoder->adif_header_present)
     {
-        if (channels != hDecoder->channelConfiguration)
+        if (hDecoder->channelConfiguration == 0)
             hDecoder->channelConfiguration = channels;
 
         if (channels == 8) /* 7.1 */
@@ -883,8 +886,10 @@
         };
         uint8_t stride = str[hDecoder->config.outputFormat-1];
 #ifdef SBR_DEC
-        if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+        if (((hDecoder->sbr_present_flag == 1)&&(!hDecoder->downSampledSBR)) || (hDecoder->forceUpSampling == 1))
+        {
             stride = 2 * stride;
+        }
 #endif
         if (hDecoder->sample_buffer)
             faad_free(hDecoder->sample_buffer);
@@ -901,9 +906,12 @@
         uint8_t ele;
 
         /* this data is different when SBR is used or when the data is upsampled */
-        frame_len *= 2;
-        hInfo->samples *= 2;
-        hInfo->samplerate *= 2;
+        if (!hDecoder->downSampledSBR)
+        {
+            frame_len *= 2;
+            hInfo->samples *= 2;
+            hInfo->samplerate *= 2;
+        }
 
         /* check if every element was provided with SBR data */
         for (ele = 0; ele < hDecoder->fr_ch_ele; ele++)
@@ -922,6 +930,10 @@
             hInfo->sbr = SBR_UPSAMPLED;
         } else {
             hInfo->sbr = NO_SBR_UPSAMPLED;
+        }
+        if (hDecoder->downSampledSBR)
+        {
+            hInfo->sbr = SBR_DOWNSAMPLED;
         }
     }
 #endif
--- a/libfaad/decoder.h
+++ b/libfaad/decoder.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: decoder.h,v 1.35 2004/01/05 14:05:11 menno Exp $
+** $Id: decoder.h,v 1.36 2004/02/26 09:29:26 menno Exp $
 **/
 
 #ifndef __DECODER_H__
@@ -42,13 +42,6 @@
     #define FAADAPI
   #endif
 #endif
-
-#include "bits.h"
-#include "syntax.h"
-#include "drc.h"
-#include "specrec.h"
-#include "filtbank.h"
-#include "ic_predict.h"
 
 
 /* library output formats */
--- a/libfaad/drc.c
+++ b/libfaad/drc.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: drc.c,v 1.21 2004/01/05 14:05:11 menno Exp $
+** $Id: drc.c,v 1.24 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
--- a/libfaad/drc.h
+++ b/libfaad/drc.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: drc.h,v 1.15 2004/01/05 14:05:11 menno Exp $
+** $Id: drc.h,v 1.18 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __DRC_H__
--- a/libfaad/error.c
+++ b/libfaad/error.c
@@ -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.c,v 1.21 2004/01/28 19:17:25 menno Exp $
+** $Id: error.c,v 1.22 2004/02/26 09:29:26 menno Exp $
 **/
 
 #include "common.h"
@@ -33,7 +33,7 @@
     "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",
--- a/libfaad/filtbank.c
+++ b/libfaad/filtbank.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: filtbank.c,v 1.35 2004/01/13 14:24:10 menno Exp $
+** $Id: filtbank.c,v 1.36 2004/02/26 09:29:26 menno Exp $
 **/
 
 #include "common.h"
--- a/libfaad/fixed.h
+++ b/libfaad/fixed.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: fixed.h,v 1.18 2004/01/28 19:17:25 menno Exp $
+** $Id: fixed.h,v 1.19 2004/02/26 09:29:26 menno Exp $
 **/
 
 #ifndef __FIXED_H__
@@ -53,6 +53,10 @@
 #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 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)
 
--- a/libfaad/hcr.c
+++ b/libfaad/hcr.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: hcr.c,v 1.13 2004/01/05 14:05:11 menno Exp $
+** $Id: hcr.c,v 1.14 2004/02/26 09:29:27 menno Exp $
 **/
 
 #include "common.h"
--- a/libfaad/huffman.c
+++ b/libfaad/huffman.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: huffman.c,v 1.18 2004/02/04 19:55:02 menno Exp $
+** $Id: huffman.c,v 1.19 2004/02/26 09:29:27 menno Exp $
 **/
 
 #include "common.h"
--- a/libfaad/huffman.h
+++ b/libfaad/huffman.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: huffman.h,v 1.21 2004/01/05 14:05:12 menno Exp $
+** $Id: huffman.h,v 1.24 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __HUFFMAN_H__
--- a/libfaad/ic_predict.c
+++ b/libfaad/ic_predict.c
@@ -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.20 2004/01/05 14:05:12 menno Exp $
+** $Id: ic_predict.c,v 1.23 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
--- a/libfaad/ic_predict.h
+++ b/libfaad/ic_predict.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: ic_predict.h,v 1.16 2004/01/05 14:05:12 menno Exp $
+** $Id: ic_predict.h,v 1.19 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifdef MAIN_DEC
--- a/libfaad/iq_table.h
+++ b/libfaad/iq_table.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: iq_table.h,v 1.12 2004/01/05 14:05:12 menno Exp $
+** $Id: iq_table.h,v 1.13 2004/02/26 09:29:27 menno Exp $
 **/
 
 #ifndef IQ_TABLE_H__
--- a/libfaad/is.h
+++ b/libfaad/is.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: is.h,v 1.13 2004/01/05 14:05:12 menno Exp $
+** $Id: is.h,v 1.16 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __IS_H__
--- a/libfaad/kbd_win.h
+++ b/libfaad/kbd_win.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: kbd_win.h,v 1.13 2004/01/05 14:05:12 menno Exp $
+** $Id: kbd_win.h,v 1.17 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __KBD_WIN_H__
--- a/libfaad/lt_predict.c
+++ b/libfaad/lt_predict.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: lt_predict.c,v 1.20 2004/01/05 14:05:12 menno Exp $
+** $Id: lt_predict.c,v 1.23 2004/09/04 14:56:28 menno Exp $
 **/
 
 
--- a/libfaad/lt_predict.h
+++ b/libfaad/lt_predict.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: lt_predict.h,v 1.13 2004/01/05 14:05:12 menno Exp $
+** $Id: lt_predict.h,v 1.16 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifdef LTP_DEC
--- a/libfaad/mdct.c
+++ b/libfaad/mdct.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: mdct.c,v 1.37 2004/01/05 14:05:12 menno Exp $
+** $Id: mdct.c,v 1.39 2004/03/19 10:37:55 menno Exp $
 **/
 
 /*
--- a/libfaad/mdct.h
+++ b/libfaad/mdct.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: mdct.h,v 1.22 2004/01/05 14:05:12 menno Exp $
+** $Id: mdct.h,v 1.25 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __MDCT_H__
--- a/libfaad/mp4.c
+++ b/libfaad/mp4.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: mp4.c,v 1.26 2004/01/05 14:05:12 menno Exp $
+** $Id: mp4.c,v 1.27 2004/02/26 09:29:27 menno Exp $
 **/
 
 #include "common.h"
@@ -180,9 +180,15 @@
     mp4ASC->sbr_present_flag = -1;
     if (mp4ASC->objectTypeIndex == 5)
     {
+        uint8_t tmp;
+
         mp4ASC->sbr_present_flag = 1;
-        mp4ASC->samplingFrequencyIndex = (uint8_t)faad_getbits(&ld, 4
+        tmp = (uint8_t)faad_getbits(&ld, 4
             DEBUGVAR(1,5,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
+        /* check for downsampled SBR */
+        if (tmp == mp4ASC->samplingFrequencyIndex)
+            mp4ASC->downSampledSBR = 1;
+        mp4ASC->samplingFrequencyIndex = tmp;
         if (mp4ASC->samplingFrequencyIndex == 15)
         {
             mp4ASC->samplingFrequency = (uint32_t)faad_getbits(&ld, 24
@@ -243,8 +249,15 @@
 
                 if (mp4ASC->sbr_present_flag)
                 {
-                    mp4ASC->samplingFrequencyIndex = (uint8_t)faad_getbits(&ld, 4
+                    uint8_t tmp;
+                    tmp = (uint8_t)faad_getbits(&ld, 4
                         DEBUGVAR(1,12,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
+
+                    /* check for downsampled SBR */
+                    if (tmp == mp4ASC->samplingFrequencyIndex)
+                        mp4ASC->downSampledSBR = 1;
+                    mp4ASC->samplingFrequencyIndex = tmp;
+
                     if (mp4ASC->samplingFrequencyIndex == 15)
                     {
                         mp4ASC->samplingFrequency = (uint32_t)faad_getbits(&ld, 24
@@ -265,6 +278,8 @@
         {
             mp4ASC->samplingFrequency *= 2;
             mp4ASC->forceUpSampling = 1;
+        } else /* > 24000*/ {
+            mp4ASC->downSampledSBR = 1;
         }
     }
 #endif
--- a/libfaad/mp4.h
+++ b/libfaad/mp4.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: mp4.h,v 1.17 2004/01/05 14:05:12 menno Exp $
+** $Id: mp4.h,v 1.18 2004/02/26 09:29:27 menno Exp $
 **/
 
 #ifndef __MP4_H__
--- a/libfaad/ms.c
+++ b/libfaad/ms.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: ms.c,v 1.13 2004/01/05 14:05:12 menno Exp $
+** $Id: ms.c,v 1.17 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
--- a/libfaad/ms.h
+++ b/libfaad/ms.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: ms.h,v 1.12 2004/01/05 14:05:12 menno Exp $
+** $Id: ms.h,v 1.15 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __MS_H__
--- a/libfaad/output.h
+++ b/libfaad/output.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: output.h,v 1.17 2004/01/05 14:05:12 menno Exp $
+** $Id: output.h,v 1.18 2004/02/26 09:29:27 menno Exp $
 **/
 
 #ifndef __OUTPUT_H__
--- a/libfaad/pns.c
+++ b/libfaad/pns.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: pns.c,v 1.29 2004/01/05 14:05:12 menno Exp $
+** $Id: pns.c,v 1.30 2004/02/26 09:29:27 menno Exp $
 **/
 
 #include "common.h"
--- a/libfaad/pns.h
+++ b/libfaad/pns.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: pns.h,v 1.19 2004/01/05 14:05:12 menno Exp $
+** $Id: pns.h,v 1.23 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __PNS_H__
@@ -31,8 +31,6 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-
-#include "common.h"
 
 #include "syntax.h"
 
--- a/libfaad/pulse.c
+++ b/libfaad/pulse.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: pulse.c,v 1.14 2004/01/05 14:05:12 menno Exp $
+** $Id: pulse.c,v 1.17 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -39,7 +39,8 @@
 
     k = ics->swb_offset[pul->pulse_start_sfb];
 
-    for(i = 0; i <= pul->number_pulse; i++) {
+    for (i = 0; i <= pul->number_pulse; i++)
+    {
         k += pul->pulse_offset[i];
 
         if (k >= framelen)
--- a/libfaad/pulse.h
+++ b/libfaad/pulse.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: pulse.h,v 1.13 2004/01/05 14:05:12 menno Exp $
+** $Id: pulse.h,v 1.16 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __PULSE_H__
--- a/libfaad/rvlc.h
+++ b/libfaad/rvlc.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: rvlc.h,v 1.10 2004/01/05 14:05:12 menno Exp $
+** $Id: rvlc.h,v 1.13 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __RVLC_SCF_H__
--- a/libfaad/sbr_dct.c
+++ b/libfaad/sbr_dct.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_dct.c,v 1.10 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_dct.c,v 1.11 2004/02/26 09:29:27 menno Exp $
 **/
 
 #include "common.h"
@@ -37,8 +37,1089 @@
 
 #include "sbr_dct.h"
 
+void DCT4_32(real_t *y, real_t *x)
+{
+    real_t f0;
+    real_t f1;
+    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 f310;
+    real_t f311;
+    real_t f312;
+    real_t f313;
+    real_t f316;
+    real_t f317;
+    real_t f318;
+    real_t f319;
+    real_t f322;
+    real_t f323;
+    real_t f324;
+    real_t f325;
+    real_t f328;
+    real_t f329;
+    real_t f330;
+    real_t f331;
+    real_t f334;
+    real_t f335;
+    real_t f336;
+    real_t f337;
+    real_t f340;
+    real_t f341;
+    real_t f342;
+    real_t f343;
+    real_t f346;
+    real_t f347;
+    real_t f348;
+    real_t f349;
+    real_t f352;
+    real_t f353;
+    real_t f354;
+    real_t f355;
+    real_t f358;
+    real_t f359;
+    real_t f360;
+    real_t f361;
+    real_t f364;
+    real_t f365;
+    real_t f366;
+    real_t f367;
+    real_t f370;
+    real_t f371;
+    real_t f372;
+    real_t f373;
+    real_t f376;
+    real_t f377;
+    real_t f378;
+    real_t f379;
+    real_t f382;
+    real_t f383;
+    real_t f384;
+    real_t f385;
+    real_t f388;
+    real_t f389;
+    real_t f390;
+    real_t f391;
+    real_t f394;
+    real_t f395;
+    real_t f396;
+    real_t f397;
+
+    f0 = x[15] - x[16];
+    f1 = x[15] + x[16];
+    f2 = 0.7071067811865476 * f1;
+    f3 = 0.7071067811865476 * f0;
+    f4 = x[8] - x[23];
+    f5 = x[8] + x[23];
+    f6 = 0.7071067811865476 * f5;
+    f7 = 0.7071067811865476 * f4;
+    f8 = x[12] - x[19];
+    f9 = x[12] + x[19];
+    f10 = 0.7071067811865476 * f9;
+    f11 = 0.7071067811865476 * f8;
+    f12 = x[11] - x[20];
+    f13 = x[11] + x[20];
+    f14 = 0.7071067811865476 * f13;
+    f15 = 0.7071067811865476 * f12;
+    f16 = x[14] - x[17];
+    f17 = x[14] + x[17];
+    f18 = 0.7071067811865476 * f17;
+    f19 = 0.7071067811865476 * f16;
+    f20 = x[9] - x[22];
+    f21 = x[9] + x[22];
+    f22 = 0.7071067811865476 * f21;
+    f23 = 0.7071067811865476 * f20;
+    f24 = x[13] - x[18];
+    f25 = x[13] + x[18];
+    f26 = 0.7071067811865476 * f25;
+    f27 = 0.7071067811865476 * f24;
+    f28 = x[10] - x[21];
+    f29 = x[10] + x[21];
+    f30 = 0.7071067811865476 * f29;
+    f31 = 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 = (-0.5411961001461969) * f39;
+    f66 = 0.9238795325112867 * f64;
+    f67 = 1.3065629648763766 * f37;
+    f68 = f65 + f66;
+    f69 = f67 - f66;
+    f70 = f38 + f36;
+    f71 = 1.3065629648763770 * f38;
+    f72 = (-0.3826834323650904) * f70;
+    f73 = 0.5411961001461961 * f36;
+    f74 = f71 + f72;
+    f75 = f73 - f72;
+    f76 = f47 + f45;
+    f77 = (-0.5411961001461969) * f47;
+    f78 = 0.9238795325112867 * f76;
+    f79 = 1.3065629648763766 * f45;
+    f80 = f77 + f78;
+    f81 = f79 - f78;
+    f82 = f46 + f44;
+    f83 = 1.3065629648763770 * f46;
+    f84 = (-0.3826834323650904) * f82;
+    f85 = 0.5411961001461961 * f44;
+    f86 = f83 + f84;
+    f87 = f85 - f84;
+    f88 = f55 + f53;
+    f89 = (-0.5411961001461969) * f55;
+    f90 = 0.9238795325112867 * f88;
+    f91 = 1.3065629648763766 * f53;
+    f92 = f89 + f90;
+    f93 = f91 - f90;
+    f94 = f54 + f52;
+    f95 = 1.3065629648763770 * f54;
+    f96 = (-0.3826834323650904) * f94;
+    f97 = 0.5411961001461961 * f52;
+    f98 = f95 + f96;
+    f99 = f97 - f96;
+    f100 = f63 + f61;
+    f101 = (-0.5411961001461969) * f63;
+    f102 = 0.9238795325112867 * f100;
+    f103 = 1.3065629648763766 * f61;
+    f104 = f101 + f102;
+    f105 = f103 - f102;
+    f106 = f62 + f60;
+    f107 = 1.3065629648763770 * f62;
+    f108 = (-0.3826834323650904) * f106;
+    f109 = 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 = (-0.7856949583871021) * f123;
+    f146 = 0.9807852804032304 * f144;
+    f147 = 1.1758756024193588 * f121;
+    f148 = f145 + f146;
+    f149 = f147 - f146;
+    f150 = f127 + f125;
+    f151 = 0.2758993792829431 * f127;
+    f152 = 0.5555702330196022 * f150;
+    f153 = 1.3870398453221475 * f125;
+    f154 = f151 + f152;
+    f155 = f153 - f152;
+    f156 = f122 + f120;
+    f157 = 1.1758756024193591 * f122;
+    f158 = (-0.1950903220161287) * f156;
+    f159 = 0.7856949583871016 * f120;
+    f160 = f157 + f158;
+    f161 = f159 - f158;
+    f162 = f126 + f124;
+    f163 = 1.3870398453221473 * f126;
+    f164 = (-0.8314696123025455) * f162;
+    f165 = (-0.2758993792829436) * f124;
+    f166 = f163 + f164;
+    f167 = f165 - f164;
+    f168 = f139 + f137;
+    f169 = (-0.7856949583871021) * f139;
+    f170 = 0.9807852804032304 * f168;
+    f171 = 1.1758756024193588 * f137;
+    f172 = f169 + f170;
+    f173 = f171 - f170;
+    f174 = f143 + f141;
+    f175 = 0.2758993792829431 * f143;
+    f176 = 0.5555702330196022 * f174;
+    f177 = 1.3870398453221475 * f141;
+    f178 = f175 + f176;
+    f179 = f177 - f176;
+    f180 = f138 + f136;
+    f181 = 1.1758756024193591 * f138;
+    f182 = (-0.1950903220161287) * f180;
+    f183 = 0.7856949583871016 * f136;
+    f184 = f181 + f182;
+    f185 = f183 - f182;
+    f186 = f142 + f140;
+    f187 = 1.3870398453221473 * f142;
+    f188 = (-0.8314696123025455) * f186;
+    f189 = (-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 = (-0.8971675863426361) * f211;
+    f226 = 0.9951847266721968 * f224;
+    f227 = 1.0932018670017576 * f209;
+    f228 = f225 + f226;
+    f229 = f227 - f226;
+    f230 = f215 + f213;
+    f231 = (-0.4105245275223571) * f215;
+    f232 = 0.8819212643483549 * f230;
+    f233 = 1.3533180011743529 * f213;
+    f234 = f231 + f232;
+    f235 = f233 - f232;
+    f236 = f219 + f217;
+    f237 = 0.1386171691990915 * f219;
+    f238 = 0.6343932841636455 * f236;
+    f239 = 1.4074037375263826 * f217;
+    f240 = f237 + f238;
+    f241 = f239 - f238;
+    f242 = f223 + f221;
+    f243 = 0.6666556584777466 * f223;
+    f244 = 0.2902846772544623 * f242;
+    f245 = 1.2472250129866711 * f221;
+    f246 = f243 + f244;
+    f247 = f245 - f244;
+    f248 = f210 + f208;
+    f249 = 1.0932018670017574 * f210;
+    f250 = (-0.0980171403295605) * f248;
+    f251 = 0.8971675863426364 * f208;
+    f252 = f249 + f250;
+    f253 = f251 - f250;
+    f254 = f214 + f212;
+    f255 = 1.3533180011743529 * f214;
+    f256 = (-0.4713967368259979) * f254;
+    f257 = 0.4105245275223569 * f212;
+    f258 = f255 + f256;
+    f259 = f257 - f256;
+    f260 = f218 + f216;
+    f261 = 1.4074037375263826 * f218;
+    f262 = (-0.7730104533627369) * f260;
+    f263 = (-0.1386171691990913) * f216;
+    f264 = f261 + f262;
+    f265 = f263 - f262;
+    f266 = f222 + f220;
+    f267 = 1.2472250129866711 * f222;
+    f268 = (-0.9569403357322089) * f266;
+    f269 = (-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 = (-0.9751575901732920) * f275;
+    f306 = 0.9996988186962043 * f304;
+    f307 = 1.0242400472191164 * f273;
+    y[0] = f305 + f306;
+    y[31] = f307 - f306;
+    f310 = f279 + f277;
+    f311 = (-0.8700688593994936) * f279;
+    f312 = 0.9924795345987100 * f310;
+    f313 = 1.1148902097979263 * f277;
+    y[2] = f311 + f312;
+    y[29] = f313 - f312;
+    f316 = f283 + f281;
+    f317 = (-0.7566008898816587) * f283;
+    f318 = 0.9757021300385286 * f316;
+    f319 = 1.1948033701953984 * f281;
+    y[4] = f317 + f318;
+    y[27] = f319 - f318;
+    f322 = f287 + f285;
+    f323 = (-0.6358464401941451) * f287;
+    f324 = 0.9495281805930367 * f322;
+    f325 = 1.2632099209919283 * f285;
+    y[6] = f323 + f324;
+    y[25] = f325 - f324;
+    f328 = f291 + f289;
+    f329 = (-0.5089684416985408) * f291;
+    f330 = 0.9142097557035307 * f328;
+    f331 = 1.3194510697085207 * f289;
+    y[8] = f329 + f330;
+    y[23] = f331 - f330;
+    f334 = f295 + f293;
+    f335 = (-0.3771887988789273) * f295;
+    f336 = 0.8700869911087114 * f334;
+    f337 = 1.3629851833384954 * f293;
+    y[10] = f335 + f336;
+    y[21] = f337 - f336;
+    f340 = f299 + f297;
+    f341 = (-0.2417766217337384) * f299;
+    f342 = 0.8175848131515837 * f340;
+    f343 = 1.3933930045694289 * f297;
+    y[12] = f341 + f342;
+    y[19] = f343 - f342;
+    f346 = f303 + f301;
+    f347 = (-0.1040360035527077) * f303;
+    f348 = 0.7572088465064845 * f346;
+    f349 = 1.4103816894602612 * f301;
+    y[14] = f347 + f348;
+    y[17] = f349 - f348;
+    f352 = f274 + f272;
+    f353 = 0.0347065382144002 * f274;
+    f354 = 0.6895405447370668 * f352;
+    f355 = 1.4137876276885337 * f272;
+    y[16] = f353 + f354;
+    y[15] = f355 - f354;
+    f358 = f278 + f276;
+    f359 = 0.1731148370459795 * f278;
+    f360 = 0.6152315905806268 * f358;
+    f361 = 1.4035780182072330 * f276;
+    y[18] = f359 + f360;
+    y[13] = f361 - f360;
+    f364 = f282 + f280;
+    f365 = 0.3098559453626100 * f282;
+    f366 = 0.5349976198870972 * f364;
+    f367 = 1.3798511851368043 * f280;
+    y[20] = f365 + f366;
+    y[11] = f367 - f366;
+    f370 = f286 + f284;
+    f371 = 0.4436129715409088 * f286;
+    f372 = 0.4496113296546065 * f370;
+    f373 = 1.3428356308501219 * f284;
+    y[22] = f371 + f372;
+    y[9] = f373 - f372;
+    f376 = f290 + f288;
+    f377 = 0.5730977622997509 * f290;
+    f378 = 0.3598950365349881 * f376;
+    f379 = 1.2928878353697271 * f288;
+    y[24] = f377 + f378;
+    y[7] = f379 - f378;
+    f382 = f294 + f292;
+    f383 = 0.6970633083205415 * f294;
+    f384 = 0.2667127574748984 * f382;
+    f385 = 1.2304888232703382 * f292;
+    y[26] = f383 + f384;
+    y[5] = f385 - f384;
+    f388 = f298 + f296;
+    f389 = 0.8143157536286401 * f298;
+    f390 = 0.1709618887603012 * f388;
+    f391 = 1.1562395311492424 * f296;
+    y[28] = f389 + f390;
+    y[3] = f391 - f390;
+    f394 = f302 + f300;
+    f395 = 0.9237258930790228 * f302;
+    f396 = 0.0735645635996674 * f394;
+    f397 = 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 +1151,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 +1165,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 +1193,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 +1222,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 +1234,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 +1265,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 +1329,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 +1369,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 +1410,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,1501 +1458,555 @@
     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 f11, f12, f13, f14, f15, f16, f17, f18, f19, f20;
-    real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30;
-    real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40;
-    real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50;
-    real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60;
-    real_t f61, f62, f65, f66, f67, f68, f71, f72, f73, f74;
-    real_t f75, f76, f77, f78, f79, f80, f81, f82, f83, f85;
-    real_t f87, f88, f91, f92, f93, f94, f95, f96, f97, f98;
-    real_t f99, f100, f101, f102, f103, f104, f105, f106, f107, f108;
-    real_t f109, f110, f111, f112, f113, f114, f115, f116, f117, f118;
-    real_t f119, f120, f121, f122, f123, f124, f125, f126, f129, f130;
-    real_t f131, f132, f135, f136, f137, f138, f141, f142, f143, f144;
-    real_t 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, f212, f213, f214, f215, f216;
-    real_t f217, f218, f219, f220, f221, f222, f223, f224, f225, f226;
-    real_t f227, f228, f229, f230, f231, f232, f233, f234, f235, f236;
-    real_t f237, f238, f239, f240, f241, f242, f243, f244, f245, f246;
-    real_t f247, f248, f249, f250, f251, f252, f253, f254, f255, f256;
-    real_t f257, f258, f259, f260, f261, f262, f265, f266, f267, f268;
-    real_t f271, f272, f273, f274, f277, f278, f279, f280, f283, f284;
-    real_t f285, f286, f289, f290, f291, f292, f295, f296, f297, f298;
-    real_t f301, f302, f303, f304, f307, f308, f309, f310, f311, f312;
-    real_t f313, f314, f315, f316, f317, f318, f319, f320, f321, f322;
-    real_t f323, f324, f325, f326, f327, f328, f329, f330, f331, f332;
-    real_t f333, f334, f335, f336, f337, f338, f339, f340, f341, f342;
-    real_t f343, f344, f345, f346, f347, f348, f349, f350, f351, f352;
-    real_t f353, f354, f355, f356, f357, f358, f359, f360, f361, f362;
-    real_t f363, f364, f365, f366, f367, f368, f369, f370, f371, f372;
-    real_t f373, f374, f375, f376, f377, f378, f379, f380, f381, f382;
-    real_t f383, f384, f385, f386, f387, f388, f389, f390, f391, f392;
-    real_t f393, f394, f395, f396, f397, f398, f399, f400, f401, f402;
-    real_t f403, f404, f405, f406, f407, f408, f409, f410, f411, f412;
-    real_t f413, f414, f415, f416, f417, f418, f419, f420, f421, f422;
-    real_t f423, f424, f425, f426, f427, f428, f429, f430, f431, f433;
-    real_t f434, f435, f436, f437, f438, f439, f440, f441, f442, f443;
-    real_t f444, f445, f446, f447, f448, f449, f450, f451, f452, f453;
-    real_t f454, f455, f456, f457, f458, f459, f460, f461, f462, f463;
-    real_t f464, f465, f466, f467, f468, f469, f470, f471, f472, f473;
-    real_t f474, f475, f476, f477, f478, f479, f480, f481, f482, f483;
-    real_t f484, f485, f486, f487, f488, f489, f490, f491, f492, f493;
-    real_t f494, f495, f496, f497, f498, f499, f500, f501, f502, f503;
-    real_t f504, f505, f506, f507, f508, f509, f510, f511, f512, f513;
-    real_t f514, f515, f516, f517, f518, f519, f520, f521, f522, f523;
-    real_t f524, f525, f526, f527, f528, f529, f530, f531, f532, f533;
-    real_t f534, f535, f536, f537, f538, f539, f540, f541, f542, f543;
-    real_t f544, f546, f547, f548, f549, f550, f551, f552, f553, f554;
-    real_t f555, f556, f557, f558, f559, f560, f561, f562, f563, f564;
-    real_t f565, f566, f567, f568, f569, f570, f571, f572, f573, f574;
-    real_t f575, f576, f577, f578, f579, f580, f581, f582, f583, f584;
-    real_t f585, f586, f587, f588, f589, f590, f591, f592, f593, f594;
-    real_t f595, f596, f597, f598, f599, f600, f601, f602, f603, f604;
-    real_t f605, f606, f607, f608, f609, f610, f611, f612, f613, f614;
-    real_t f615, f616, f617, f618, f619, f620, f621, f622, f623, f624;
-    real_t f625, f626, f627, f628;
-    ALIGN static real_t t2[64];
-
-    for (i0=0; i0<32; i0++)
-    {
-        t2[2*i0+1] = x[i0] - x[-i0+63];
-        t2[2*i0] = x[i0] + x[-i0+63];
-    }
-    f2 = t2[0] - t2[62];
-    f3 = t2[0] + t2[62];
-    f4 = t2[2] - t2[60];
-    f5 = t2[2] + t2[60];
-    f6 = t2[4] - t2[58];
-    f7 = t2[4] + t2[58];
-    f8 = t2[6] - t2[56];
-    f9 = t2[6] + t2[56];
-    f10 = t2[8] - t2[54];
-    f11 = t2[8] + t2[54];
-    f12 = t2[10] - t2[52];
-    f13 = t2[10] + t2[52];
-    f14 = t2[12] - t2[50];
-    f15 = t2[12] + t2[50];
-    f16 = t2[14] - t2[48];
-    f17 = t2[14] + t2[48];
-    f18 = t2[16] - t2[46];
-    f19 = t2[16] + t2[46];
-    f20 = t2[18] - t2[44];
-    f21 = t2[18] + t2[44];
-    f22 = t2[20] - t2[42];
-    f23 = t2[20] + t2[42];
-    f24 = t2[22] - t2[40];
-    f25 = t2[22] + t2[40];
-    f26 = t2[24] - t2[38];
-    f27 = t2[24] + t2[38];
-    f28 = t2[26] - t2[36];
-    f29 = t2[26] + t2[36];
-    f30 = t2[28] - t2[34];
-    f31 = t2[28] + t2[34];
-    f32 = t2[30] - t2[32];
-    f33 = t2[30] + t2[32];
-    f34 = f3 - f33;
-    f35 = f3 + f33;
-    f36 = f5 - f31;
-    f37 = f5 + f31;
-    f38 = f7 - f29;
-    f39 = f7 + f29;
-    f40 = f9 - f27;
-    f41 = f9 + f27;
-    f42 = f11 - f25;
-    f43 = f11 + f25;
-    f44 = f13 - f23;
-    f45 = f13 + f23;
-    f46 = f15 - f21;
-    f47 = f15 + f21;
-    f48 = f17 - f19;
-    f49 = f17 + f19;
-    f50 = f35 - f49;
-    f51 = f35 + f49;
-    f52 = f37 - f47;
-    f53 = f37 + f47;
-    f54 = f39 - f45;
-    f55 = f39 + f45;
-    f56 = f41 - f43;
-    f57 = f41 + f43;
-    f58 = f51 - f57;
-    f59 = f51 + f57;
-    f60 = f53 - f55;
-    f61 = f53 + f55;
-    f62 = f59 - f61;
-    y[0] = f59 + f61;
-    y[32] = MUL_C(COEF_CONST(0.7071067811865476), f62);
-    f65 = f58 + f60;
-    f66 = MUL_C(COEF_CONST(1.3065629648763766), f58);
-    f67 = MUL_C(COEF_CONST((-0.9238795325112866)), f65);
-    f68 = MUL_C(COEF_CONST((-0.5411961001461967)), f60);
-    y[48] = f66 + f67;
-    y[16] = f68 - f67;
-    f71 = f50 + f56;
-    f72 = MUL_C(COEF_CONST(1.1758756024193588), f50);
-    f73 = MUL_C(COEF_CONST((-0.9807852804032304)), f71);
-    f74 = MUL_C(COEF_CONST((-0.7856949583871021)), f56);
-    f75 = f72 + f73;
-    f76 = f74 - f73;
-    f77 = f52 + f54;
-    f78 = MUL_C(COEF_CONST(1.3870398453221473), f52);
-    f79 = MUL_C(COEF_CONST((-0.8314696123025455)), f77);
-    f80 = MUL_C(COEF_CONST((-0.2758993792829436)), f54);
-    f81 = f78 + f79;
-    f82 = f80 - f79;
-    f83 = f76 - f82;
-    y[8] = f76 + f82;
-    f85 = MUL_C(COEF_CONST(0.7071067811865476), f83);
-    y[56] = f75 - f81;
-    f87 = f75 + f81;
-    f88 = MUL_C(COEF_CONST(0.7071067811865476), f87);
-    y[40] = f85 - f88;
-    y[24] = f85 + f88;
-    f91 = f36 - f38;
-    f92 = f36 + f38;
-    f93 = f40 - f42;
-    f94 = f40 + f42;
-    f95 = f44 - f46;
-    f96 = f44 + f46;
-    f97 = MUL_C(COEF_CONST(0.7071067811865476), f94);
-    f98 = f34 - f97;
-    f99 = f34 + f97;
-    f100 = f92 + f96;
-    f101 = MUL_C(COEF_CONST(1.3065629648763766), f92);
-    f102 = MUL_C(COEF_CONST((-0.9238795325112866)), f100);
-    f103 = MUL_C(COEF_CONST((-0.5411961001461967)), f96);
-    f104 = f101 + f102;
-    f105 = f103 - f102;
-    f106 = f99 - f105;
-    f107 = f99 + f105;
-    f108 = f98 - f104;
-    f109 = f98 + f104;
-    f110 = f91 + f95;
-    f111 = MUL_C(COEF_CONST(1.3065629648763770), f91);
-    f112 = MUL_C(COEF_CONST((-0.3826834323650904)), f110);
-    f113 = MUL_C(COEF_CONST(0.5411961001461961), f95);
-    f114 = f111 + f112;
-    f115 = f113 - f112;
-    f116 = MUL_C(COEF_CONST(0.7071067811865476), f93);
-    f117 = f116 - f48;
-    f118 = f116 + f48;
-    f119 = f115 - f118;
-    f120 = f115 + f118;
-    f121 = f114 - f117;
-    f122 = f114 + f117;
-    f123 = f120 + f107;
-    f124 = MUL_C(COEF_CONST((-0.8971675863426361)), f120);
-    f125 = MUL_C(COEF_CONST(0.9951847266721968), f123);
-    f126 = MUL_C(COEF_CONST(1.0932018670017576), f107);
-    y[4] = f124 + f125;
-    y[60] = f126 - f125;
-    f129 = f122 + f109;
-    f130 = MUL_C(COEF_CONST((-0.6666556584777466)), f122);
-    f131 = MUL_C(COEF_CONST(0.9569403357322089), f129);
-    f132 = MUL_C(COEF_CONST(1.2472250129866713), f109);
-    y[12] = f130 + f131;
-    y[52] = f132 - f131;
-    f135 = f121 + f108;
-    f136 = MUL_C(COEF_CONST((-0.4105245275223571)), f121);
-    f137 = MUL_C(COEF_CONST(0.8819212643483549), f135);
-    f138 = MUL_C(COEF_CONST(1.3533180011743529), f108);
-    y[20] = f136 + f137;
-    y[44] = f138 - f137;
-    f141 = f119 + f106;
-    f142 = MUL_C(COEF_CONST((-0.1386171691990915)), f119);
-    f143 = MUL_C(COEF_CONST(0.7730104533627370), f141);
-    f144 = MUL_C(COEF_CONST(1.4074037375263826), f106);
-    y[28] = f142 + f143;
-    y[36] = f144 - f143;
-    f147 = f16 - f18;
-    f148 = f16 + f18;
-    f149 = MUL_C(COEF_CONST(0.7071067811865476), f148);
-    f150 = MUL_C(COEF_CONST(0.7071067811865476), f147);
-    f151 = f10 - f24;
-    f152 = f10 + f24;
-    f153 = MUL_C(COEF_CONST(0.7071067811865476), f152);
-    f154 = MUL_C(COEF_CONST(0.7071067811865476), f151);
-    f155 = f14 - f20;
-    f156 = f14 + f20;
-    f157 = MUL_C(COEF_CONST(0.7071067811865476), f156);
-    f158 = MUL_C(COEF_CONST(0.7071067811865476), f155);
-    f159 = f12 - f22;
-    f160 = f12 + f22;
-    f161 = MUL_C(COEF_CONST(0.7071067811865476), f160);
-    f162 = MUL_C(COEF_CONST(0.7071067811865476), f159);
-    f163 = f2 - f149;
-    f164 = f2 + f149;
-    f165 = f32 - f150;
-    f166 = f32 + f150;
-    f167 = f8 - f153;
-    f168 = f8 + f153;
-    f169 = f26 - f154;
-    f170 = f26 + f154;
-    f171 = f4 - f157;
-    f172 = f4 + f157;
-    f173 = f30 - f158;
-    f174 = f30 + f158;
-    f175 = f6 - f161;
-    f176 = f6 + f161;
-    f177 = f28 - f162;
-    f178 = f28 + f162;
-    f179 = f170 + f168;
-    f180 = MUL_C(COEF_CONST((-0.5411961001461969)), f170);
-    f181 = MUL_C(COEF_CONST(0.9238795325112867), f179);
-    f182 = MUL_C(COEF_CONST(1.3065629648763766), f168);
-    f183 = f180 + f181;
-    f184 = f182 - f181;
-    f185 = f169 + f167;
-    f186 = MUL_C(COEF_CONST(1.3065629648763770), f169);
-    f187 = MUL_C(COEF_CONST((-0.3826834323650904)), f185);
-    f188 = MUL_C(COEF_CONST(0.5411961001461961), f167);
-    f189 = f186 + f187;
-    f190 = f188 - f187;
-    f191 = f178 + f176;
-    f192 = MUL_C(COEF_CONST((-0.5411961001461969)), f178);
-    f193 = MUL_C(COEF_CONST(0.9238795325112867), f191);
-    f194 = MUL_C(COEF_CONST(1.3065629648763766), f176);
-    f195 = f192 + f193;
-    f196 = f194 - f193;
-    f197 = f177 + f175;
-    f198 = MUL_C(COEF_CONST(1.3065629648763770), f177);
-    f199 = MUL_C(COEF_CONST((-0.3826834323650904)), f197);
-    f200 = MUL_C(COEF_CONST(0.5411961001461961), f175);
-    f201 = f198 + f199;
-    f202 = f200 - f199;
-    f203 = f164 - f183;
-    f204 = f164 + f183;
-    f205 = f166 - f184;
-    f206 = f166 + f184;
-    f207 = f163 - f189;
-    f208 = f163 + f189;
-    f209 = f165 - f190;
-    f210 = f165 + f190;
-    f211 = f172 - f195;
-    f212 = f172 + f195;
-    f213 = f174 - f196;
-    f214 = f174 + f196;
-    f215 = f171 - f201;
-    f216 = f171 + f201;
-    f217 = f173 - f202;
-    f218 = f173 + f202;
-    f219 = f214 + f212;
-    f220 = MUL_C(COEF_CONST((-0.7856949583871021)), f214);
-    f221 = MUL_C(COEF_CONST(0.9807852804032304), f219);
-    f222 = MUL_C(COEF_CONST(1.1758756024193588), f212);
-    f223 = f220 + f221;
-    f224 = f222 - f221;
-    f225 = f218 + f216;
-    f226 = MUL_C(COEF_CONST(0.2758993792829431), f218);
-    f227 = MUL_C(COEF_CONST(0.5555702330196022), f225);
-    f228 = MUL_C(COEF_CONST(1.3870398453221475), f216);
-    f229 = f226 + f227;
-    f230 = f228 - f227;
-    f231 = f213 + f211;
-    f232 = MUL_C(COEF_CONST(1.1758756024193591), f213);
-    f233 = MUL_C(COEF_CONST((-0.1950903220161287)), f231);
-    f234 = MUL_C(COEF_CONST(0.7856949583871016), f211);
-    f235 = f232 + f233;
-    f236 = f234 - f233;
-    f237 = f217 + f215;
-    f238 = MUL_C(COEF_CONST(1.3870398453221473), f217);
-    f239 = MUL_C(COEF_CONST((-0.8314696123025455)), f237);
-    f240 = MUL_C(COEF_CONST((-0.2758993792829436)), f215);
-    f241 = f238 + f239;
-    f242 = f240 - f239;
-    f243 = f204 - f223;
-    f244 = f204 + f223;
-    f245 = f206 - f224;
-    f246 = f206 + f224;
-    f247 = f208 - f229;
-    f248 = f208 + f229;
-    f249 = f210 - f230;
-    f250 = f210 + f230;
-    f251 = f203 - f235;
-    f252 = f203 + f235;
-    f253 = f205 - f236;
-    f254 = f205 + f236;
-    f255 = f207 - f241;
-    f256 = f207 + f241;
-    f257 = f209 - f242;
-    f258 = f209 + f242;
-    f259 = f246 + f244;
-    f260 = MUL_C(COEF_CONST((-0.9497277818777543)), f246);
-    f261 = MUL_C(COEF_CONST(0.9987954562051724), f259);
-    f262 = MUL_C(COEF_CONST(1.0478631305325905), f244);
-    y[2] = f260 + f261;
-    y[62] = f262 - f261;
-    f265 = f250 + f248;
-    f266 = MUL_C(COEF_CONST((-0.7270510732912801)), f250);
-    f267 = MUL_C(COEF_CONST(0.9700312531945440), f265);
-    f268 = MUL_C(COEF_CONST(1.2130114330978079), f248);
-    y[10] = f266 + f267;
-    y[54] = f268 - f267;
-    f271 = f254 + f252;
-    f272 = MUL_C(COEF_CONST((-0.4764341996931611)), f254);
-    f273 = MUL_C(COEF_CONST(0.9039892931234433), f271);
-    f274 = MUL_C(COEF_CONST(1.3315443865537255), f252);
-    y[18] = f272 + f273;
-    y[46] = f274 - f273;
-    f277 = f258 + f256;
-    f278 = MUL_C(COEF_CONST((-0.2075082269882114)), f258);
-    f279 = MUL_C(COEF_CONST(0.8032075314806448), f277);
-    f280 = MUL_C(COEF_CONST(1.3989068359730783), f256);
-    y[26] = f278 + f279;
-    y[38] = f280 - f279;
-    f283 = f245 + f243;
-    f284 = MUL_C(COEF_CONST(0.0693921705079408), f245);
-    f285 = MUL_C(COEF_CONST(0.6715589548470183), f283);
-    f286 = MUL_C(COEF_CONST(1.4125100802019774), f243);
-    y[34] = f284 + f285;
-    y[30] = f286 - f285;
-    f289 = f249 + f247;
-    f290 = MUL_C(COEF_CONST(0.3436258658070505), f249);
-    f291 = MUL_C(COEF_CONST(0.5141027441932217), f289);
-    f292 = MUL_C(COEF_CONST(1.3718313541934939), f247);
-    y[42] = f290 + f291;
-    y[22] = f292 - f291;
-    f295 = f253 + f251;
-    f296 = MUL_C(COEF_CONST(0.6046542117908007), f253);
-    f297 = MUL_C(COEF_CONST(0.3368898533922201), f295);
-    f298 = MUL_C(COEF_CONST(1.2784339185752409), f251);
-    y[50] = f296 + f297;
-    y[14] = f298 - f297;
-    f301 = f257 + f255;
-    f302 = MUL_C(COEF_CONST(0.8424460355094192), f257);
-    f303 = MUL_C(COEF_CONST(0.1467304744553618), f301);
-    f304 = MUL_C(COEF_CONST(1.1359069844201428), f255);
-    y[58] = f302 + f303;
-    y[6] = f304 - f303;
-    f307 = t2[1] + t2[63];
-    f308 = MUL_C(COEF_CONST(1.0242400472191162), t2[1]);
-    f309 = MUL_C(COEF_CONST((-0.9996988186962043)), f307);
-    f310 = MUL_C(COEF_CONST((-0.9751575901732922)), t2[63]);
-    f311 = f308 + f309;
-    f312 = f310 - f309;
-    f313 = t2[3] + t2[61];
-    f314 = MUL_C(COEF_CONST(1.0708550202783571),t2[3]);
-    f315 = MUL_C(COEF_CONST((-0.9972904566786902)), f313);
-    f316 = MUL_C(COEF_CONST((-0.9237258930790232)), t2[61]);
-    f317 = f314 + f315;
-    f318 = f316 - f315;
-    f319 = t2[5] + t2[59];
-    f320 = MUL_C(COEF_CONST(1.1148902097979256), t2[5]);
-    f321 = MUL_C(COEF_CONST((-0.9924795345987101)), f319);
-    f322 = MUL_C(COEF_CONST((-0.8700688593994945)), t2[59]);
-    f323 = f320 + f321;
-    f324 = f322 - f321;
-    f325 = t2[7] + t2[57];
-    f326 = MUL_C(COEF_CONST(1.1562395311492426), t2[7]);
-    f327 = MUL_C(COEF_CONST((-0.9852776423889412)), f325);
-    f328 = MUL_C(COEF_CONST((-0.8143157536286398)), t2[57]);
-    f329 = f326 + f327;
-    f330 = f328 - f327;
-    f331 = t2[9] + t2[55];
-    f332 = MUL_C(COEF_CONST(1.1948033701953984), t2[9]);
-    f333 = MUL_C(COEF_CONST((-0.9757021300385286)), f331);
-    f334 = MUL_C(COEF_CONST((-0.7566008898816589)), t2[55]);
-    f335 = f332 + f333;
-    f336 = f334 - f333;
-    f337 = t2[11] + t2[53];
-    f338 = MUL_C(COEF_CONST(1.2304888232703382), t2[11]);
-    f339 = MUL_C(COEF_CONST((-0.9637760657954400)), f337);
-    f340 = MUL_C(COEF_CONST((-0.6970633083205418)), t2[53]);
-    f341 = f338 + f339;
-    f342 = f340 - f339;
-    f343 = t2[13] + t2[51];
-    f344 = MUL_C(COEF_CONST(1.2632099209919279), t2[13]);
-    f345 = MUL_C(COEF_CONST((-0.9495281805930368)), f343);
-    f346 = MUL_C(COEF_CONST((-0.6358464401941457)), t2[51]);
-    f347 = f344 + f345;
-    f348 = f346 - f345;
-    f349 = t2[15] + t2[49];
-    f350 = MUL_C(COEF_CONST(1.2928878353697266), t2[15]);
-    f351 = MUL_C(COEF_CONST((-0.9329927988347391)), f349);
-    f352 = MUL_C(COEF_CONST((-0.5730977622997515)), t2[49]);
-    f353 = f350 + f351;
-    f354 = f352 - f351;
-    f355 = t2[17] + t2[47];
-    f356 = MUL_C(COEF_CONST(1.3194510697085207), t2[17]);
-    f357 = MUL_C(COEF_CONST((-0.9142097557035306)), f355);
-    f358 = MUL_C(COEF_CONST((-0.5089684416985405)), t2[47]);
-    f359 = f356 + f357;
-    f360 = f358 - f357;
-    f361 = t2[19] + t2[45];
-    f362 = MUL_C(COEF_CONST(1.3428356308501219), t2[19]);
-    f363 = MUL_C(COEF_CONST((-0.8932243011955153)), f361);
-    f364 = MUL_C(COEF_CONST((-0.4436129715409087)), t2[45]);
-    f365 = f362 + f363;
-    f366 = f364 - f363;
-    f367 = t2[21] + t2[43];
-    f368 = MUL_C(COEF_CONST(1.3629851833384954), t2[21]);
-    f369 = MUL_C(COEF_CONST((-0.8700869911087115)), f367);
-    f370 = MUL_C(COEF_CONST((-0.3771887988789276)), t2[43]);
-    f371 = f368 + f369;
-    f372 = f370 - f369;
-    f373 = t2[23] + t2[41];
-    f374 = MUL_C(COEF_CONST(1.3798511851368040), t2[23]);
-    f375 = MUL_C(COEF_CONST((-0.8448535652497072)), f373);
-    f376 = MUL_C(COEF_CONST((-0.3098559453626103)), t2[41]);
-    f377 = f374 + f375;
-    f378 = f376 - f375;
-    f379 = t2[25] + t2[39];
-    f380 = MUL_C(COEF_CONST(1.3933930045694289), t2[25]);
-    f381 = MUL_C(COEF_CONST((-0.8175848131515840)), f379);
-    f382 = MUL_C(COEF_CONST((-0.2417766217337392)), t2[39]);
-    f383 = f380 + f381;
-    f384 = f382 - f381;
-    f385 = t2[27] + t2[37];
-    f386 = MUL_C(COEF_CONST(1.4035780182072330), t2[27]);
-    f387 = MUL_C(COEF_CONST((-0.7883464276266061)), f385);
-    f388 = MUL_C(COEF_CONST((-0.1731148370459791)), t2[37]);
-    f389 = f386 + f387;
-    f390 = f388 - f387;
-    f391 = t2[29] + t2[35];
-    f392 = MUL_C(COEF_CONST(1.4103816894602614), t2[29]);
-    f393 = MUL_C(COEF_CONST((-0.7572088465064846)), f391);
-    f394 = MUL_C(COEF_CONST((-0.1040360035527078)), t2[35]);
-    f395 = f392 + f393;
-    f396 = f394 - f393;
-    f397 = t2[31] + t2[33];
-    f398 = MUL_C(COEF_CONST(1.4137876276885337), t2[31]);
-    f399 = MUL_C(COEF_CONST((-0.7242470829514670)), f397);
-    f400 = MUL_C(COEF_CONST((-0.0347065382144002)), t2[33]);
-    f401 = f398 + f399;
-    f402 = f400 - f399;
-    f403 = f312 - f402;
-    f404 = f312 + f402;
-    f405 = f318 - f396;
-    f406 = f318 + f396;
-    f407 = f324 - f390;
-    f408 = f324 + f390;
-    f409 = f330 - f384;
-    f410 = f330 + f384;
-    f411 = f336 - f378;
-    f412 = f336 + f378;
-    f413 = f342 - f372;
-    f414 = f342 + f372;
-    f415 = f348 - f366;
-    f416 = f348 + f366;
-    f417 = f354 - f360;
-    f418 = f354 + f360;
-    f419 = f404 - f418;
-    f420 = f404 + f418;
-    f421 = f406 - f416;
-    f422 = f406 + f416;
-    f423 = f408 - f414;
-    f424 = f408 + f414;
-    f425 = f410 - f412;
-    f426 = f410 + f412;
-    f427 = f420 - f426;
-    f428 = f420 + f426;
-    f429 = f422 - f424;
-    f430 = f422 + f424;
-    f431 = f428 - f430;
-    y[1] = f428 + f430;
-    f433 = MUL_C(COEF_CONST(0.7071067811865476), f431);
-    f434 = f427 + f429;
-    f435 = MUL_C(COEF_CONST(1.3065629648763766), f427);
-    f436 = MUL_C(COEF_CONST((-0.9238795325112866)), f434);
-    f437 = MUL_C(COEF_CONST((-0.5411961001461967)), f429);
-    f438 = f435 + f436;
-    f439 = f437 - f436;
-    f440 = f419 + f425;
-    f441 = MUL_C(COEF_CONST(1.1758756024193588), f419);
-    f442 = MUL_C(COEF_CONST((-0.9807852804032304)), f440);
-    f443 = MUL_C(COEF_CONST((-0.7856949583871021)), f425);
-    f444 = f441 + f442;
-    f445 = f443 - f442;
-    f446 = f421 + f423;
-    f447 = MUL_C(COEF_CONST(1.3870398453221473), f421);
-    f448 = MUL_C(COEF_CONST((-0.8314696123025455)), f446);
-    f449 = MUL_C(COEF_CONST((-0.2758993792829436)), f423);
-    f450 = f447 + f448;
-    f451 = f449 - f448;
-    f452 = f445 - f451;
-    f453 = f445 + f451;
-    f454 = MUL_C(COEF_CONST(0.7071067811865476), f452);
-    f455 = f444 - f450;
-    f456 = f444 + f450;
-    f457 = MUL_C(COEF_CONST(0.7071067811865476), f456);
-    f458 = f454 - f457;
-    f459 = f454 + f457;
-    f460 = f405 - f407;
-    f461 = f405 + f407;
-    f462 = f409 - f411;
-    f463 = f409 + f411;
-    f464 = f413 - f415;
-    f465 = f413 + f415;
-    f466 = MUL_C(COEF_CONST(0.7071067811865476), f463);
-    f467 = f403 - f466;
-    f468 = f403 + f466;
-    f469 = f461 + f465;
-    f470 = MUL_C(COEF_CONST(1.3065629648763766), f461);
-    f471 = MUL_C(COEF_CONST((-0.9238795325112866)), f469);
-    f472 = MUL_C(COEF_CONST((-0.5411961001461967)), f465);
-    f473 = f470 + f471;
-    f474 = f472 - f471;
-    f475 = f468 - f474;
-    f476 = f468 + f474;
-    f477 = f467 - f473;
-    f478 = f467 + f473;
-    f479 = f460 + f464;
-    f480 = MUL_C(COEF_CONST(1.3065629648763770), f460);
-    f481 = MUL_C(COEF_CONST((-0.3826834323650904)), f479);
-    f482 = MUL_C(COEF_CONST(0.5411961001461961), f464);
-    f483 = f480 + f481;
-    f484 = f482 - f481;
-    f485 = MUL_C(COEF_CONST(0.7071067811865476), f462);
-    f486 = f485 - f417;
-    f487 = f485 + f417;
-    f488 = f484 - f487;
-    f489 = f484 + f487;
-    f490 = f483 - f486;
-    f491 = f483 + f486;
-    f492 = f489 + f476;
-    f493 = MUL_C(COEF_CONST((-0.8971675863426361)), f489);
-    f494 = MUL_C(COEF_CONST(0.9951847266721968), f492);
-    f495 = MUL_C(COEF_CONST(1.0932018670017576), f476);
-    f496 = f493 + f494;
-    f497 = f495 - f494;
-    f498 = f491 + f478;
-    f499 = MUL_C(COEF_CONST((-0.6666556584777466)), f491);
-    f500 = MUL_C(COEF_CONST(0.9569403357322089), f498);
-    f501 = MUL_C(COEF_CONST(1.2472250129866713), f478);
-    f502 = f499 + f500;
-    f503 = f501 - f500;
-    f504 = f490 + f477;
-    f505 = MUL_C(COEF_CONST((-0.4105245275223571)), f490);
-    f506 = MUL_C(COEF_CONST(0.8819212643483549), f504);
-    f507 = MUL_C(COEF_CONST(1.3533180011743529), f477);
-    f508 = f505 + f506;
-    f509 = f507 - f506;
-    f510 = f488 + f475;
-    f511 = MUL_C(COEF_CONST((-0.1386171691990915)), f488);
-    f512 = MUL_C(COEF_CONST(0.7730104533627370), f510);
-    f513 = MUL_C(COEF_CONST(1.4074037375263826), f475);
-    f514 = f511 + f512;
-    f515 = f513 - f512;
-    f516 = f311 + f401;
-    f517 = f311 - f401;
-    f518 = f317 + f395;
-    f519 = f395 - f317;
-    f520 = f323 + f389;
-    f521 = f323 - f389;
-    f522 = f329 + f383;
-    f523 = f383 - f329;
-    f524 = f335 + f377;
-    f525 = f335 - f377;
-    f526 = f341 + f371;
-    f527 = f371 - f341;
-    f528 = f347 + f365;
-    f529 = f347 - f365;
-    f530 = f353 + f359;
-    f531 = f359 - f353;
-    f532 = f517 - f531;
-    f533 = f517 + f531;
-    f534 = f519 - f529;
-    f535 = f519 + f529;
-    f536 = f521 - f527;
-    f537 = f521 + f527;
-    f538 = f523 - f525;
-    f539 = f523 + f525;
-    f540 = f533 - f539;
-    f541 = f533 + f539;
-    f542 = f535 - f537;
-    f543 = f535 + f537;
-    f544 = f541 - f543;
-    y[63] = f541 + f543;
-    f546 = MUL_C(COEF_CONST(0.7071067811865476), f544);
-    f547 = f540 + f542;
-    f548 = MUL_C(COEF_CONST(1.3065629648763766), f540);
-    f549 = MUL_C(COEF_CONST((-0.9238795325112866)), f547);
-    f550 = MUL_C(COEF_CONST((-0.5411961001461967)), f542);
-    f551 = f548 + f549;
-    f552 = f550 - f549;
-    f553 = f532 + f538;
-    f554 = MUL_C(COEF_CONST(1.1758756024193588), f532);
-    f555 = MUL_C(COEF_CONST((-0.9807852804032304)), f553);
-    f556 = MUL_C(COEF_CONST((-0.7856949583871021)), f538);
-    f557 = f554 + f555;
-    f558 = f556 - f555;
-    f559 = f534 + f536;
-    f560 = MUL_C(COEF_CONST(1.3870398453221473), f534);
-    f561 = MUL_C(COEF_CONST((-0.8314696123025455)), f559);
-    f562 = MUL_C(COEF_CONST((-0.2758993792829436)), f536);
-    f563 = f560 + f561;
-    f564 = f562 - f561;
-    f565 = f558 - f564;
-    f566 = f558 + f564;
-    f567 = MUL_C(COEF_CONST(0.7071067811865476), f565);
-    f568 = f557 - f563;
-    f569 = f557 + f563;
-    f570 = MUL_C(COEF_CONST(0.7071067811865476), f569);
-    f571 = f567 - f570;
-    f572 = f567 + f570;
-    f573 = MUL_C(COEF_CONST(0.5024192861881557), f516);
-    f574 = MUL_C(COEF_CONST(0.5224986149396889), f518);
-    f575 = MUL_C(COEF_CONST(0.5669440348163577), f520);
-    f576 = MUL_C(COEF_CONST(0.6468217833599901), f522);
-    f577 = MUL_C(COEF_CONST(0.7881546234512502), f524);
-    f578 = MUL_C(COEF_CONST(1.0606776859903471), f526);
-    f579 = MUL_C(COEF_CONST(1.7224470982383342), f528);
-    f580 = MUL_C(COEF_CONST(5.1011486186891553), f530);
-    f581 = f573 + f580;
-    f582 = f573 - f580;
-    f583 = f574 + f579;
-    f584 = f579 - f574;
-    f585 = f575 + f578;
-    f586 = f575 - f578;
-    f587 = f576 + f577;
-    f588 = f577 - f576;
-    f589 = f582 - f588;
-    f590 = f582 + f588;
-    f591 = f584 - f586;
-    f592 = f584 + f586;
-    f593 = f590 - f592;
-    f594 = f590 + f592;
-    f595 = MUL_C(COEF_CONST(0.7071067811865476), f593);
-    f596 = f589 + f591;
-    f597 = MUL_C(COEF_CONST(1.3065629648763766), f589);
-    f598 = MUL_C(COEF_CONST((-0.9238795325112866)), f596);
-    f599 = MUL_C(COEF_CONST((-0.5411961001461967)), f591);
-    f600 = f597 + f598;
-    f601 = f599 - f598;
-    f602 = f583 + f585;
-    f603 = f585 - f583;
-    f604 = MUL_C(COEF_CONST(0.7071067811865476), f603);
-    f605 = MUL_C(COEF_CONST(0.7071067811865476), f602);
-    f606 = f581 - f604;
-    f607 = f581 + f604;
-    f608 = f605 - f587;
-    f609 = f587 + f605;
-    f610 = f607 - f609;
-    f611 = MUL_C(COEF_CONST((-0.7856949583871021)), f609);
-    f612 = MUL_C(COEF_CONST(0.9807852804032304), f610);
-    f613 = MUL_C(COEF_CONST(1.1758756024193588), f607);
-    f614 = f612 - f611;
-    f615 = f613 - f612;
-    f616 = f608 + f606;
-    f617 = MUL_C(COEF_CONST(0.2758993792829431), f608);
-    f618 = MUL_C(COEF_CONST(0.5555702330196022), f616);
-    f619 = MUL_C(COEF_CONST(1.3870398453221475), f606);
-    f620 = f617 + f618;
-    f621 = f619 - f618;
-    f622 = f594 + f614;
-    f623 = f614 + f601;
-    f624 = f601 + f621;
-    f625 = f621 + f595;
-    f626 = f595 + f620;
-    f627 = f620 + f600;
-    f628 = f600 + f615;
-    y[5] = f496 - f615;
-    y[3] = f496 + f615;
-    y[9] = f453 - f568;
-    y[7] = f453 + f568;
-    y[13] = f502 - f628;
-    y[11] = f502 + f628;
-    y[17] = f439 - f551;
-    y[15] = f439 + f551;
-    y[21] = f508 - f627;
-    y[19] = f508 + f627;
-    y[25] = f459 - f571;
-    y[23] = f459 + f571;
-    y[29] = f514 - f626;
-    y[27] = f514 + f626;
-    y[33] = f433 - f546;
-    y[31] = f433 + f546;
-    y[37] = f515 - f625;
-    y[35] = f515 + f625;
-    y[41] = f458 - f572;
-    y[39] = f458 + f572;
-    y[45] = f509 - f624;
-    y[43] = f509 + f624;
-    y[49] = f438 - f552;
-    y[47] = f438 + f552;
-    y[53] = f503 - f623;
-    y[51] = f503 + f623;
-    y[57] = f455 - f566;
-    y[55] = f455 + f566;
-    y[61] = f497 - f622;
-    y[59] = f497 + f622;
-}
-
-void DST2_64_unscaled(real_t *y, real_t *x)
-{
-    int16_t i0;
-    real_t f2, f3, f4, f5, f6, f7;
-    real_t f8, f9, f10, f11, f12, f13;
-    real_t f14, f15, f16, f17, f18, f19;
-    real_t f20, f21, f22, f23, f24, f25;
-    real_t f26, f27, f28, f29, f30, f31;
-    real_t f32, f33, f34, f35, f36, f37;
-    real_t f38, f39, f40, f41, f42, f43;
-    real_t f44, f45, f46, f47, f48, f49;
-    real_t f50, f51, f52, f53, f54, f55;
-    real_t f56, f57, f58, f59, f60, f61;
-    real_t f62, f63, f64, f65, f66, f67;
-    real_t f68, f69, f70, f71, f72, f73;
-    real_t f74, f75, f76, f77, f78, f79;
-    real_t f80, f81, f82, f83, f84, f85;
-    real_t f86, f87, f88, f89, f90, f91;
-    real_t f92, f93, f94, f95, f96, f97;
-    real_t f98, f99, f100, f101, f102, f103;
-    real_t f104, f105, f106, f107, f108, f109;
-    real_t f110, f111, f112, f113, f114, f115;
-    real_t f116, f117, f118, f119, f120, f121;
-    real_t f122, f123, f124, f125, f126, f127;
-    real_t f128, f129, f130, f131, f132, f133;
-    real_t f134, f135, f136, f137, f138, f139;
-    real_t f140, f141, f142, f143, f144, f145;
-    real_t f146, f147, f148, f149, f150, f151;
-    real_t f152, f153, f154, f155, f156, f157;
-    real_t f158, f159, f160, f161, f162, f163;
-    real_t f164, f165, f166, f167, f168, f169;
-    real_t f170, f171, f172, f173, f174, f175;
-    real_t f176, f177, f178, f179, f180, f181;
-    real_t f182, f183, f184, f185, f186, f187;
-    real_t f188, f189, f190, f191, f192, f193;
-    real_t f194, f195, f196, f197, f198, f199;
-    real_t f200, f201, f202, f203, f204, f205;
-    real_t f206, f207, f208, f209, f210, f211;
-    real_t f212, f213, f214, f215, f216, f217;
-    real_t f218, f219, f220, f221, f222, f223;
-    real_t f224, f225, f226, f227, f228, f229;
-    real_t f230, f231, f232, f233, f234, f235;
-    real_t f236, f237, f238, f239, f240, f241;
-    real_t f242, f243, f244, f245, f246, f247;
-    real_t f248, f249, f250, f251, f252, f253;
-    real_t f254, f255, f256, f257, f258, f259;
-    real_t f260, f261, f264, f265, f266, f267;
-    real_t f270, f271, f272, f273, f276, f277;
-    real_t f278, f279, f282, f283, f284, f285;
-    real_t f288, f289, f290, f291, f294, f295;
-    real_t f296, f297, f300, f301, f302, f303;
-    real_t f306, f307, f308, f309, f312, f313;
-    real_t f314, f315, f318, f319, f320, f321;
-    real_t f324, f325, f326, f327, f330, f331;
-    real_t f332, f333, f336, f337, f338, f339;
-    real_t f342, f343, f344, f345, f348, f349;
-    real_t f350, f351, f354, f355, f356, f357;
-    real_t f358, f359, f360, f361, f362, f363;
-    real_t f364, f365, f366, f367, f368, f369;
-    real_t f370, f371, f372, f373, f374, f375;
-    real_t f376, f377, f378, f379, f380, f381;
-    real_t f382, f383, f384, f385, f386, f387;
-    real_t f388, f389, f390, f391, f392, f393;
-    real_t f394, f395, f396, f397, f398, f399;
-    real_t f400, f401, f402, f403, f404, f405;
-    real_t f406, f407, f408, f409, f410, f411;
-    real_t f412, f413, f414, f415, f416, f417;
-    real_t f418, f419, f420, f421, f422, f423;
-    real_t f424, f425, f426, f427, f428, f429;
-    real_t f430, f431, f432, f433, f434, f435;
-    real_t f436, f437, f438, f439, f440, f441;
-    real_t f442, f443, f444, f445, f446, f447;
-    real_t f448, f449, f450, f451, f452, f453;
-    real_t f454, f455, f456, f457, f458, f459;
-    real_t f460, f461, f462, f463, f464, f465;
-    real_t f466, f467, f468, f469, f470, f471;
-    real_t f472, f473, f474, f475, f476, f477;
-    real_t f478, f479, f480, f481, f482, f483;
-    real_t f484, f485, f486, f487, f488, f489;
-    real_t f490, f491, f492, f493, f494, f495;
-    real_t f496, f497, f498, f499, f500, f501;
-    real_t f504, f505, f506, f507, f510, f511;
-    real_t f512, f513, f516, f517, f518, f519;
-    real_t f522, f523, f524, f525, f528, f529;
-    real_t f530, f531, f534, f535, f536, f537;
-    real_t f540, f541, f542, f543, f546, f547;
-    real_t f548, f549, f550, f551, f552, f553;
-    real_t f554, f555, f556, f557, f558, f559;
-    real_t f560, f561, f562, f563, f564, f565;
-    real_t f566, f567, f568, f569, f570, f571;
-    real_t f572, f573, f574, f577, f578, f579;
-    real_t f580, f583, f584, f585, f586, f587;
-    real_t f588, f589, f590, f591, f592, f593;
-    real_t f594, f595, f596, f597, f598, f603;
-    real_t f604, f605, f606, f607, f608, f609;
-    real_t f610, f611, f612, f613, f614, f615;
-    real_t f616, f617, f618, f619, f620, f621;
-    real_t f622, f623, f624, f625, f626, f627;
-    real_t f628, f629, f630, f631, f632, f633;
-    real_t f634, f635, f636, f637, f638, f639;
-    real_t f640, f641, f642, f643, f644, f645;
-    real_t f646, f647, f648, f649, f650;
-    ALIGN static real_t t2[64];
-
-    for (i0=0; i0<32; i0++)
-    {
-        t2[2*i0+1] = x[i0] - x[-i0+63];
-        t2[2*i0] = x[i0] + x[-i0+63];
-    }
-    f2 = t2[2] + t2[4];
-    f3 = t2[4] - t2[2];
-    f4 = t2[6] + t2[8];
-    f5 = t2[8] - t2[6];
-    f6 = t2[10] + t2[12];
-    f7 = t2[12] - t2[10];
-    f8 = t2[14] + t2[16];
-    f9 = t2[16] - t2[14];
-    f10 = t2[18] + t2[20];
-    f11 = t2[20] - t2[18];
-    f12 = t2[22] + t2[24];
-    f13 = t2[24] - t2[22];
-    f14 = t2[26] + t2[28];
-    f15 = t2[28] - t2[26];
-    f16 = t2[30] + t2[32];
-    f17 = t2[32] - t2[30];
-    f18 = t2[34] + t2[36];
-    f19 = t2[36] - t2[34];
-    f20 = t2[38] + t2[40];
-    f21 = t2[40] - t2[38];
-    f22 = t2[42] + t2[44];
-    f23 = t2[44] - t2[42];
-    f24 = t2[46] + t2[48];
-    f25 = t2[48] - t2[46];
-    f26 = t2[50] + t2[52];
-    f27 = t2[52] - t2[50];
-    f28 = t2[54] + t2[56];
-    f29 = t2[56] - t2[54];
-    f30 = t2[58] + t2[60];
-    f31 = t2[60] - t2[58];
-    f32 = MUL_C(COEF_CONST(0.7071067811865476), f17);
-    f33 = t2[0] - f32;
-    f34 = t2[0] + f32;
-    f35 = f9 + f25;
-    f36 = MUL_C(COEF_CONST(1.3065629648763766), f9);
-    f37 = MUL_C(COEF_CONST((-0.9238795325112866)), f35);
-    f38 = MUL_C(COEF_CONST((-0.5411961001461967)), f25);
-    f39 = f36 + f37;
-    f40 = f38 - f37;
-    f41 = f34 - f40;
-    f42 = f34 + f40;
-    f43 = f33 - f39;
-    f44 = f33 + f39;
-    f45 = MUL_C(COEF_CONST(2.5629154477415064), f5);
-    f46 = MUL_C(COEF_CONST(0.8999762231364158), f13);
-    f47 = MUL_C(COEF_CONST(0.5097955791041592), f29);
-    f48 = MUL_C(COEF_CONST(0.6013448869350453), f21);
-    f49 = f45 - f47;
-    f50 = f45 + f47;
-    f51 = f46 - f48;
-    f52 = f46 + f48;
-    f53 = f50 + f52;
-    f54 = MUL_C(COEF_CONST(1.3065629648763770), f50);
-    f55 = MUL_C(COEF_CONST((-0.3826834323650904)), f53);
-    f56 = MUL_C(COEF_CONST(0.5411961001461961), f52);
-    f57 = f54 + f55;
-    f58 = f56 - f55;
-    f59 = f51 - f49;
-    f60 = f49 + f51;
-    f61 = MUL_C(COEF_CONST(0.7071067811865476), f60);
-    f62 = f58 - f61;
-    f63 = f57 - f61;
-    f64 = f59 + f57;
-    f65 = f42 - f58;
-    f66 = f42 + f58;
-    f67 = f44 + f62;
-    f68 = f44 - f62;
-    f69 = f43 - f63;
-    f70 = f43 + f63;
-    f71 = f41 + f64;
-    f72 = f41 - f64;
-    f73 = f7 - f11;
-    f74 = f7 + f11;
-    f75 = f15 - f19;
-    f76 = f15 + f19;
-    f77 = f23 - f27;
-    f78 = f23 + f27;
-    f79 = MUL_C(COEF_CONST(0.7071067811865476), f76);
-    f80 = f3 - f79;
-    f81 = f3 + f79;
-    f82 = f74 + f78;
-    f83 = MUL_C(COEF_CONST(1.3065629648763766), f74);
-    f84 = MUL_C(COEF_CONST((-0.9238795325112866)), f82);
-    f85 = MUL_C(COEF_CONST((-0.5411961001461967)), f78);
-    f86 = f83 + f84;
-    f87 = f85 - f84;
-    f88 = f81 - f87;
-    f89 = f81 + f87;
-    f90 = f80 - f86;
-    f91 = f80 + f86;
-    f92 = MUL_C(COEF_CONST(0.7071067811865476), f75);
-    f93 = f31 - f92;
-    f94 = f31 + f92;
-    f95 = f77 + f73;
-    f96 = MUL_C(COEF_CONST(1.3065629648763766), f77);
-    f97 = MUL_C(COEF_CONST((-0.9238795325112866)), f95);
-    f98 = MUL_C(COEF_CONST((-0.5411961001461967)), f73);
-    f99 = f96 + f97;
-    f100 = f98 - f97;
-    f101 = f94 - f100;
-    f102 = f94 + f100;
-    f103 = f93 - f99;
-    f104 = f93 + f99;
-    f105 = f102 + f89;
-    f106 = MUL_C(COEF_CONST((-0.8971675863426361)), f102);
-    f107 = MUL_C(COEF_CONST(0.9951847266721968), f105);
-    f108 = MUL_C(COEF_CONST(1.0932018670017576), f89);
-    f109 = f106 + f107;
-    f110 = f108 - f107;
-    f111 = f91 - f104;
-    f112 = MUL_C(COEF_CONST((-0.6666556584777466)), f104);
-    f113 = MUL_C(COEF_CONST(0.9569403357322089), f111);
-    f114 = MUL_C(COEF_CONST(1.2472250129866713), f91);
-    f115 = f113 - f112;
+    real_t f0;
+    real_t f1;
+    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 f63;
+    real_t f64;
+    real_t f65;
+    real_t f66;
+    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 f83;
+    real_t f85;
+    real_t f86;
+    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 f127;
+    real_t f128;
+    real_t f129;
+    real_t f130;
+    real_t f133;
+    real_t f134;
+    real_t f135;
+    real_t f136;
+    real_t f139;
+    real_t f140;
+    real_t f141;
+    real_t f142;
+    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 f247;
+    real_t f248;
+    real_t f249;
+    real_t f250;
+    real_t f253;
+    real_t f254;
+    real_t f255;
+    real_t f256;
+    real_t f259;
+    real_t f260;
+    real_t f261;
+    real_t f262;
+    real_t f265;
+    real_t f266;
+    real_t f267;
+    real_t f268;
+    real_t f271;
+    real_t f272;
+    real_t f273;
+    real_t f274;
+    real_t f277;
+    real_t f278;
+    real_t f279;
+    real_t f280;
+    real_t f283;
+    real_t f284;
+    real_t f285;
+    real_t f286;
+    
+    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] = 0.7071067811865476 * f60;
+    f63 = f56 + f58;
+    f64 = 1.3065629648763766 * f56;
+    f65 = (-0.9238795325112866) * f63;
+    f66 = (-0.5411961001461967) * f58;
+    y[24] = f64 + f65;
+    y[8] = f66 - f65;
+    f69 = f48 + f54;
+    f70 = 1.1758756024193588 * f48;
+    f71 = (-0.9807852804032304) * f69;
+    f72 = (-0.7856949583871021) * f54;
+    f73 = f70 + f71;
+    f74 = f72 - f71;
+    f75 = f50 + f52;
+    f76 = 1.3870398453221473 * f50;
+    f77 = (-0.8314696123025455) * f75;
+    f78 = (-0.2758993792829436) * f52;
+    f79 = f76 + f77;
+    f80 = f78 - f77;
+    f81 = f74 - f80;
+    y[4] = f74 + f80;
+    f83 = 0.7071067811865476 * f81;
+    y[28] = f73 - f79;
+    f85 = f73 + f79;
+    f86 = 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 = 0.7071067811865476 * f92;
+    f96 = f32 - f95;
+    f97 = f32 + f95;
+    f98 = f90 + f94;
+    f99 = 1.3065629648763766 * f90;
+    f100 = (-0.9238795325112866) * f98;
+    f101 = (-0.5411961001461967) * f94;
+    f102 = f99 + f100;
+    f103 = f101 - f100;
+    f104 = f97 - f103;
+    f105 = f97 + f103;
+    f106 = f96 - f102;
+    f107 = f96 + f102;
+    f108 = 0.7071067811865476 * f91;
+    f109 = f46 - f108;
+    f110 = f46 + f108;
+    f111 = f93 + f89;
+    f112 = 1.3065629648763766 * f93;
+    f113 = (-0.9238795325112866) * f111;
+    f114 = (-0.5411961001461967) * f89;
+    f115 = f112 + f113;
     f116 = f114 - f113;
-    f117 = f103 + f90;
-    f118 = MUL_C(COEF_CONST((-0.4105245275223571)), f103);
-    f119 = MUL_C(COEF_CONST(0.8819212643483549), f117);
-    f120 = MUL_C(COEF_CONST(1.3533180011743529), f90);
-    f121 = f118 + f119;
-    f122 = f120 - f119;
-    f123 = f88 - f101;
-    f124 = MUL_C(COEF_CONST((-0.1386171691990915)), f101);
-    f125 = MUL_C(COEF_CONST(0.7730104533627370), f123);
-    f126 = MUL_C(COEF_CONST(1.4074037375263826), f88);
-    f127 = f125 - f124;
-    f128 = f126 - f125;
-    f129 = f66 - f109;
-    f130 = f66 + f109;
-    f131 = f68 - f115;
-    f132 = f68 + f115;
-    f133 = f70 - f121;
-    f134 = f70 + f121;
-    f135 = f72 - f127;
-    f136 = f72 + f127;
-    f137 = f71 - f128;
-    f138 = f71 + f128;
-    f139 = f69 - f122;
-    f140 = f69 + f122;
-    f141 = f67 - f116;
-    f142 = f67 + f116;
-    f143 = f65 - f110;
-    f144 = f65 + f110;
-    f145 = f26 + f30;
-    f146 = f22 + f26;
-    f147 = f18 + f22;
-    f148 = f14 + f18;
-    f149 = f10 + f14;
-    f150 = f6 + f10;
-    f151 = f2 + f6;
-    f152 = MUL_C(COEF_CONST(0.7071067811865476), f148);
-    f153 = f152 - f30;
-    f154 = f30 + f152;
-    f155 = f146 + f150;
-    f156 = MUL_C(COEF_CONST(1.3065629648763766), f146);
-    f157 = MUL_C(COEF_CONST((-0.9238795325112866)), f155);
-    f158 = MUL_C(COEF_CONST((-0.5411961001461967)), f150);
-    f159 = f156 + f157;
-    f160 = f157 - f158;
-    f161 = f154 + f160;
-    f162 = f160 - f154;
-    f163 = f153 + f159;
-    f164 = f153 - f159;
-    f165 = f147 + f145;
-    f166 = f149 + f147;
-    f167 = f151 + f149;
-    f168 = MUL_C(COEF_CONST(0.7071067811865476), f166);
-    f169 = f168 - f145;
-    f170 = f145 + f168;
-    f171 = f165 + f167;
-    f172 = MUL_C(COEF_CONST(1.3065629648763766), f165);
-    f173 = MUL_C(COEF_CONST((-0.9238795325112866)), f171);
-    f174 = MUL_C(COEF_CONST((-0.5411961001461967)), f167);
-    f175 = f172 + f173;
-    f176 = f173 - f174;
-    f177 = f170 + f176;
-    f178 = f176 - f170;
-    f179 = f169 + f175;
-    f180 = f169 - f175;
-    f181 = MUL_C(COEF_CONST(0.5097955791041592), f178);
-    f182 = MUL_C(COEF_CONST(0.6013448869350453), f180);
-    f183 = MUL_C(COEF_CONST(0.8999762231364156), f179);
-    f184 = MUL_C(COEF_CONST(2.5629154477415055), f177);
-    f185 = f162 - f181;
-    f186 = f162 + f181;
-    f187 = f164 - f182;
-    f188 = f164 + f182;
-    f189 = f163 - f183;
-    f190 = f163 + f183;
-    f191 = f184 - f161;
-    f192 = f161 + f184;
-    f193 = MUL_C(COEF_CONST(0.5024192861881557), f186);
-    f194 = MUL_C(COEF_CONST(0.5224986149396889), f188);
-    f195 = MUL_C(COEF_CONST(0.5669440348163577), f190);
-    f196 = MUL_C(COEF_CONST(0.6468217833599901), f192);
-    f197 = MUL_C(COEF_CONST(0.7881546234512502), f191);
-    f198 = MUL_C(COEF_CONST(1.0606776859903471), f189);
-    f199 = MUL_C(COEF_CONST(1.7224470982383342), f187);
-    f200 = MUL_C(COEF_CONST(5.1011486186891553), f185);
-    f201 = MUL_C(COEF_CONST(0.7071067811865476), f16);
-    f202 = f201 - t2[62];
-    f203 = t2[62] + f201;
-    f204 = f24 + f8;
-    f205 = MUL_C(COEF_CONST(1.3065629648763766), f24);
-    f206 = MUL_C(COEF_CONST((-0.9238795325112866)), f204);
-    f207 = MUL_C(COEF_CONST((-0.5411961001461967)), f8);
-    f208 = f205 + f206;
-    f209 = f206 - f207;
-    f210 = f203 + f209;
-    f211 = f209 - f203;
-    f212 = f202 + f208;
-    f213 = f202 - f208;
-    f214 = f20 + f28;
-    f215 = f12 + f20;
-    f216 = f4 + f12;
-    f217 = MUL_C(COEF_CONST(0.7071067811865476), f215);
-    f218 = f217 - f28;
-    f219 = f28 + f217;
-    f220 = f214 + f216;
-    f221 = MUL_C(COEF_CONST(1.3065629648763766), f214);
-    f222 = MUL_C(COEF_CONST((-0.9238795325112866)), f220);
-    f223 = MUL_C(COEF_CONST((-0.5411961001461967)), f216);
-    f224 = f221 + f222;
-    f225 = f222 - f223;
-    f226 = f219 + f225;
-    f227 = f225 - f219;
-    f228 = f218 + f224;
-    f229 = f218 - f224;
-    f230 = MUL_C(COEF_CONST(0.5097955791041592), f227);
-    f231 = MUL_C(COEF_CONST(0.6013448869350453), f229);
-    f232 = MUL_C(COEF_CONST(0.8999762231364156), f228);
-    f233 = MUL_C(COEF_CONST(2.5629154477415055), f226);
-    f234 = f211 - f230;
-    f235 = f211 + f230;
-    f236 = f213 - f231;
-    f237 = f213 + f231;
-    f238 = f212 - f232;
-    f239 = f212 + f232;
-    f240 = f233 - f210;
-    f241 = f210 + f233;
-    f242 = f193 - f235;
-    f243 = f193 + f235;
-    f244 = f237 - f194;
-    f245 = f194 + f237;
-    f246 = f195 - f239;
-    f247 = f195 + f239;
-    f248 = f196 - f241;
-    f249 = f196 + f241;
-    f250 = f197 - f240;
-    f251 = f197 + f240;
-    f252 = f238 - f198;
-    f253 = f198 + f238;
-    f254 = f199 - f236;
-    f255 = f199 + f236;
-    f256 = f234 - f200;
-    f257 = f200 + f234;
-    f258 = f243 + f130;
-    f259 = MUL_C(COEF_CONST((-0.9751575901732920)), f243);
-    f260 = MUL_C(COEF_CONST(0.9996988186962043), f258);
-    f261 = MUL_C(COEF_CONST(1.0242400472191164), f130);
-    y[62] = f259 + f260;
-    y[0] = f261 - f260;
-    f264 = f132 - f245;
-    f265 = MUL_C(COEF_CONST((-0.9237258930790228)), f245);
-    f266 = MUL_C(COEF_CONST(0.9972904566786902), f264);
-    f267 = MUL_C(COEF_CONST(1.0708550202783576), f132);
-    y[60] = f266 - f265;
-    y[2] = f267 - f266;
-    f270 = f247 + f134;
-    f271 = MUL_C(COEF_CONST((-0.8700688593994936)), f247);
-    f272 = MUL_C(COEF_CONST(0.9924795345987100), f270);
-    f273 = MUL_C(COEF_CONST(1.1148902097979263), f134);
-    y[58] = f271 + f272;
-    y[4] = f273 - f272;
-    f276 = f249 + f136;
-    f277 = MUL_C(COEF_CONST((-0.8143157536286398)), f249);
-    f278 = MUL_C(COEF_CONST(0.9852776423889412), f276);
-    f279 = MUL_C(COEF_CONST(1.1562395311492426), f136);
-    y[56] = f277 + f278;
-    y[6] = f279 - f278;
-    f282 = f251 + f138;
-    f283 = MUL_C(COEF_CONST((-0.7566008898816587)), f251);
-    f284 = MUL_C(COEF_CONST(0.9757021300385286), f282);
-    f285 = MUL_C(COEF_CONST(1.1948033701953984), f138);
-    y[54] = f283 + f284;
-    y[8] = f285 - f284;
-    f288 = f140 - f253;
-    f289 = MUL_C(COEF_CONST((-0.6970633083205414)), f253);
-    f290 = MUL_C(COEF_CONST(0.9637760657954398), f288);
-    f291 = MUL_C(COEF_CONST(1.2304888232703384), f140);
-    y[52] = f290 - f289;
-    y[10] = f291 - f290;
-    f294 = f255 + f142;
-    f295 = MUL_C(COEF_CONST((-0.6358464401941451)), f255);
-    f296 = MUL_C(COEF_CONST(0.9495281805930367), f294);
-    f297 = MUL_C(COEF_CONST(1.2632099209919283), f142);
-    y[50] = f295 + f296;
-    y[12] = f297 - f296;
-    f300 = f144 - f257;
-    f301 = MUL_C(COEF_CONST((-0.5730977622997506)), f257);
-    f302 = MUL_C(COEF_CONST(0.9329927988347389), f300);
-    f303 = MUL_C(COEF_CONST(1.2928878353697271), f144);
-    y[48] = f302 - f301;
-    y[14] = f303 - f302;
-    f306 = f256 + f143;
-    f307 = MUL_C(COEF_CONST((-0.5089684416985408)), f256);
-    f308 = MUL_C(COEF_CONST(0.9142097557035307), f306);
-    f309 = MUL_C(COEF_CONST(1.3194510697085207), f143);
-    y[46] = f307 + f308;
-    y[16] = f309 - f308;
-    f312 = f254 + f141;
-    f313 = MUL_C(COEF_CONST((-0.4436129715409087)), f254);
-    f314 = MUL_C(COEF_CONST(0.8932243011955153), f312);
-    f315 = MUL_C(COEF_CONST(1.3428356308501219), f141);
-    y[44] = f313 + f314;
-    y[18] = f315 - f314;
-    f318 = f252 + f139;
-    f319 = MUL_C(COEF_CONST((-0.3771887988789273)), f252);
-    f320 = MUL_C(COEF_CONST(0.8700869911087114), f318);
-    f321 = MUL_C(COEF_CONST(1.3629851833384954), f139);
-    y[42] = f319 + f320;
-    y[20] = f321 - f320;
-    f324 = f250 + f137;
-    f325 = MUL_C(COEF_CONST((-0.3098559453626097)), f250);
-    f326 = MUL_C(COEF_CONST(0.8448535652497070), f324);
-    f327 = MUL_C(COEF_CONST(1.3798511851368043), f137);
-    y[40] = f325 + f326;
-    y[22] = f327 - f326;
-    f330 = f248 + f135;
-    f331 = MUL_C(COEF_CONST((-0.2417766217337384)), f248);
-    f332 = MUL_C(COEF_CONST(0.8175848131515837), f330);
-    f333 = MUL_C(COEF_CONST(1.3933930045694289), f135);
-    y[38] = f331 + f332;
-    y[24] = f333 - f332;
-    f336 = f246 + f133;
-    f337 = MUL_C(COEF_CONST((-0.1731148370459794)), f246);
-    f338 = MUL_C(COEF_CONST(0.7883464276266062), f336);
-    f339 = MUL_C(COEF_CONST(1.4035780182072330), f133);
-    y[36] = f337 + f338;
-    y[26] = f339 - f338;
-    f342 = f244 + f131;
-    f343 = MUL_C(COEF_CONST((-0.1040360035527077)), f244);
-    f344 = MUL_C(COEF_CONST(0.7572088465064845), f342);
-    f345 = MUL_C(COEF_CONST(1.4103816894602612), f131);
-    y[34] = f343 + f344;
-    y[28] = f345 - f344;
-    f348 = f242 + f129;
-    f349 = MUL_C(COEF_CONST((-0.0347065382144000)), f242);
-    f350 = MUL_C(COEF_CONST(0.7242470829514669), f348);
-    f351 = MUL_C(COEF_CONST(1.4137876276885337), f129);
-    y[32] = f349 + f350;
-    y[30] = f351 - f350;
-    f354 = t2[1] - t2[63];
-    f355 = t2[1] + t2[63];
-    f356 = t2[3] - t2[61];
-    f357 = t2[3] + t2[61];
-    f358 = t2[5] - t2[59];
-    f359 = t2[5] + t2[59];
-    f360 = t2[7] - t2[57];
-    f361 = t2[7] + t2[57];
-    f362 = t2[9] - t2[55];
-    f363 = t2[9] + t2[55];
-    f364 = t2[11] - t2[53];
-    f365 = t2[11] + t2[53];
-    f366 = t2[13] - t2[51];
-    f367 = t2[13] + t2[51];
-    f368 = t2[15] - t2[49];
-    f369 = t2[15] + t2[49];
-    f370 = t2[17] - t2[47];
-    f371 = t2[17] + t2[47];
-    f372 = t2[19] - t2[45];
-    f373 = t2[19] + t2[45];
-    f374 = t2[21] - t2[43];
-    f375 = t2[21] + t2[43];
-    f376 = t2[23] - t2[41];
-    f377 = t2[23] + t2[41];
-    f378 = t2[25] - t2[39];
-    f379 = t2[25] + t2[39];
-    f380 = t2[27] - t2[37];
-    f381 = t2[27] + t2[37];
-    f382 = t2[29] - t2[35];
-    f383 = t2[29] + t2[35];
-    f384 = t2[31] - t2[33];
-    f385 = t2[31] + t2[33];
-    f386 = f369 + f371;
-    f387 = f371 - f369;
-    f388 = MUL_C(COEF_CONST(0.7071067811865476), f387);
-    f389 = MUL_C(COEF_CONST(0.7071067811865476), f386);
-    f390 = f363 + f377;
-    f391 = f363 - f377;
-    f392 = MUL_C(COEF_CONST(0.7071067811865476), f391);
-    f393 = MUL_C(COEF_CONST(0.7071067811865476), f390);
-    f394 = f367 + f373;
-    f395 = f367 - f373;
-    f396 = MUL_C(COEF_CONST(0.7071067811865476), f395);
-    f397 = MUL_C(COEF_CONST(0.7071067811865476), f394);
-    f398 = f365 + f375;
-    f399 = f375 - f365;
-    f400 = MUL_C(COEF_CONST(0.7071067811865476), f399);
-    f401 = MUL_C(COEF_CONST(0.7071067811865476), f398);
-    f402 = f355 - f388;
-    f403 = f355 + f388;
-    f404 = f389 - f385;
-    f405 = f385 + f389;
-    f406 = f361 + f392;
-    f407 = f392 - f361;
-    f408 = f379 - f393;
-    f409 = f379 + f393;
-    f410 = f357 + f396;
-    f411 = f396 - f357;
-    f412 = f383 - f397;
-    f413 = f383 + f397;
-    f414 = f359 - f400;
-    f415 = f359 + f400;
-    f416 = f401 - f381;
-    f417 = f381 + f401;
-    f418 = f409 + f407;
-    f419 = MUL_C(COEF_CONST((-0.5411961001461969)), f409);
-    f420 = MUL_C(COEF_CONST(0.9238795325112867), f418);
-    f421 = MUL_C(COEF_CONST(1.3065629648763766), f407);
-    f422 = f419 + f420;
-    f423 = f421 - f420;
-    f424 = f408 - f406;
-    f425 = MUL_C(COEF_CONST(1.3065629648763770), f408);
-    f426 = MUL_C(COEF_CONST((-0.3826834323650904)), f424);
-    f427 = MUL_C(COEF_CONST(0.5411961001461961), f406);
-    f428 = f425 + f426;
-    f429 = f426 + f427;
-    f430 = f415 - f417;
-    f431 = MUL_C(COEF_CONST((-0.5411961001461969)), f417);
-    f432 = MUL_C(COEF_CONST(0.9238795325112867), f430);
-    f433 = MUL_C(COEF_CONST(1.3065629648763766), f415);
-    f434 = f432 - f431;
-    f435 = f433 - f432;
-    f436 = f416 + f414;
-    f437 = MUL_C(COEF_CONST(1.3065629648763770), f416);
-    f438 = MUL_C(COEF_CONST((-0.3826834323650904)), f436);
-    f439 = MUL_C(COEF_CONST(0.5411961001461961), f414);
-    f440 = f437 + f438;
-    f441 = f439 - f438;
-    f442 = f403 - f422;
-    f443 = f403 + f422;
-    f444 = f405 + f423;
-    f445 = f423 - f405;
-    f446 = f402 - f428;
-    f447 = f402 + f428;
-    f448 = f404 + f429;
-    f449 = f404 - f429;
-    f450 = f411 - f434;
-    f451 = f411 + f434;
-    f452 = f413 - f435;
-    f453 = f413 + f435;
-    f454 = f410 + f440;
-    f455 = f440 - f410;
-    f456 = f412 - f441;
-    f457 = f412 + f441;
-    f458 = f453 + f451;
-    f459 = MUL_C(COEF_CONST((-0.7856949583871021)), f453);
-    f460 = MUL_C(COEF_CONST(0.9807852804032304), f458);
-    f461 = MUL_C(COEF_CONST(1.1758756024193588), f451);
-    f462 = f459 + f460;
-    f463 = f461 - f460;
-    f464 = f457 + f455;
-    f465 = MUL_C(COEF_CONST(0.2758993792829431), f457);
-    f466 = MUL_C(COEF_CONST(0.5555702330196022), f464);
-    f467 = MUL_C(COEF_CONST(1.3870398453221475), f455);
-    f468 = f465 + f466;
-    f469 = f467 - f466;
-    f470 = f452 + f450;
-    f471 = MUL_C(COEF_CONST(1.1758756024193591), f452);
-    f472 = MUL_C(COEF_CONST((-0.1950903220161287)), f470);
-    f473 = MUL_C(COEF_CONST(0.7856949583871016), f450);
-    f474 = f471 + f472;
-    f475 = f473 - f472;
-    f476 = f456 - f454;
-    f477 = MUL_C(COEF_CONST(1.3870398453221473), f456);
-    f478 = MUL_C(COEF_CONST((-0.8314696123025455)), f476);
-    f479 = MUL_C(COEF_CONST((-0.2758993792829436)), f454);
-    f480 = f477 + f478;
-    f481 = f478 + f479;
-    f482 = f443 - f462;
-    f483 = f443 + f462;
-    f484 = f445 - f463;
-    f485 = f445 + f463;
-    f486 = f447 - f468;
-    f487 = f447 + f468;
-    f488 = f449 - f469;
-    f489 = f449 + f469;
-    f490 = f442 - f474;
-    f491 = f442 + f474;
-    f492 = f444 + f475;
-    f493 = f475 - f444;
-    f494 = f446 - f480;
-    f495 = f446 + f480;
-    f496 = f448 + f481;
-    f497 = f448 - f481;
-    f498 = f485 + f483;
-    f499 = MUL_C(COEF_CONST((-0.9497277818777543)), f485);
-    f500 = MUL_C(COEF_CONST(0.9987954562051724), f498);
-    f501 = MUL_C(COEF_CONST(1.0478631305325905), f483);
-    y[61] = f499 + f500;
-    y[1] = f501 - f500;
-    f504 = f489 + f487;
-    f505 = MUL_C(COEF_CONST((-0.7270510732912801)), f489);
-    f506 = MUL_C(COEF_CONST(0.9700312531945440), f504);
-    f507 = MUL_C(COEF_CONST(1.2130114330978079), f487);
-    y[53] = f505 + f506;
-    y[9] = f507 - f506;
-    f510 = f493 + f491;
-    f511 = MUL_C(COEF_CONST((-0.4764341996931611)), f493);
-    f512 = MUL_C(COEF_CONST(0.9039892931234433), f510);
-    f513 = MUL_C(COEF_CONST(1.3315443865537255), f491);
-    y[45] = f511 + f512;
-    y[17] = f513 - f512;
-    f516 = f497 + f495;
-    f517 = MUL_C(COEF_CONST((-0.2075082269882114)), f497);
-    f518 = MUL_C(COEF_CONST(0.8032075314806448), f516);
-    f519 = MUL_C(COEF_CONST(1.3989068359730783), f495);
-    y[37] = f517 + f518;
-    y[25] = f519 - f518;
-    f522 = f484 + f482;
-    f523 = MUL_C(COEF_CONST(0.0693921705079408), f484);
-    f524 = MUL_C(COEF_CONST(0.6715589548470183), f522);
-    f525 = MUL_C(COEF_CONST(1.4125100802019774), f482);
-    y[29] = f523 + f524;
-    y[33] = f525 - f524;
-    f528 = f488 + f486;
-    f529 = MUL_C(COEF_CONST(0.3436258658070505), f488);
-    f530 = MUL_C(COEF_CONST(0.5141027441932217), f528);
-    f531 = MUL_C(COEF_CONST(1.3718313541934939), f486);
-    y[21] = f529 + f530;
-    y[41] = f531 - f530;
-    f534 = f490 - f492;
-    f535 = MUL_C(COEF_CONST(0.6046542117908007), f492);
-    f536 = MUL_C(COEF_CONST(0.3368898533922201), f534);
-    f537 = MUL_C(COEF_CONST(1.2784339185752409), f490);
-    y[13] = f536 - f535;
-    y[49] = f537 - f536;
-    f540 = f496 + f494;
-    f541 = MUL_C(COEF_CONST(0.8424460355094192), f496);
-    f542 = MUL_C(COEF_CONST(0.1467304744553618), f540);
-    f543 = MUL_C(COEF_CONST(1.1359069844201428), f494);
-    y[5] = f541 + f542;
-    y[57] = f543 - f542;
-    f546 = f354 + f384;
-    f547 = f354 - f384;
-    f548 = f356 + f382;
-    f549 = f382 - f356;
-    f550 = f358 + f380;
-    f551 = f358 - f380;
-    f552 = f360 + f378;
-    f553 = f378 - f360;
-    f554 = f362 + f376;
-    f555 = f362 - f376;
-    f556 = f364 + f374;
-    f557 = f374 - f364;
-    f558 = f366 + f372;
-    f559 = f366 - f372;
-    f560 = f368 + f370;
-    f561 = f370 - f368;
-    f562 = f547 - f561;
-    f563 = f547 + f561;
-    f564 = f549 - f559;
-    f565 = f549 + f559;
-    f566 = f551 - f557;
-    f567 = f551 + f557;
-    f568 = f553 - f555;
-    f569 = f553 + f555;
-    f570 = f563 - f569;
-    f571 = f563 + f569;
-    f572 = f565 - f567;
-    f573 = f565 + f567;
-    f574 = f571 - f573;
-    y[63] = f571 + f573;
-    y[31] = MUL_C(COEF_CONST(0.7071067811865476), f574);
-    f577 = f570 + f572;
-    f578 = MUL_C(COEF_CONST(1.3065629648763766), f570);
-    f579 = MUL_C(COEF_CONST((-0.9238795325112866)), f577);
-    f580 = MUL_C(COEF_CONST((-0.5411961001461967)), f572);
-    y[15] = f578 + f579;
-    y[47] = f580 - f579;
-    f583 = f564 + f562;
-    f584 = f566 + f564;
-    f585 = f568 + f566;
-    f586 = MUL_C(COEF_CONST(0.7071067811865476), f584);
-    f587 = f562 - f586;
-    f588 = f562 + f586;
-    f589 = f583 + f585;
-    f590 = MUL_C(COEF_CONST(1.3065629648763766), f583);
-    f591 = MUL_C(COEF_CONST((-0.9238795325112866)), f589);
-    f592 = MUL_C(COEF_CONST((-0.5411961001461967)), f585);
-    f593 = f590 + f591;
-    f594 = f592 - f591;
-    f595 = f588 - f594;
-    f596 = f588 + f594;
-    f597 = f587 - f593;
-    f598 = f587 + f593;
-    y[55] = MUL_C(COEF_CONST(0.5097955791041592), f596);
-    y[39] = MUL_C(COEF_CONST(0.6013448869350453), f598);
-    y[23] = MUL_C(COEF_CONST(0.8999762231364156), f597);
-    y[7] = MUL_C(COEF_CONST(2.5629154477415055), f595);
-    f603 = MUL_C(COEF_CONST(0.5024192861881557), f546);
-    f604 = MUL_C(COEF_CONST(0.5224986149396889), f548);
-    f605 = MUL_C(COEF_CONST(0.5669440348163577), f550);
-    f606 = MUL_C(COEF_CONST(0.6468217833599901), f552);
-    f607 = MUL_C(COEF_CONST(0.7881546234512502), f554);
-    f608 = MUL_C(COEF_CONST(1.0606776859903471), f556);
-    f609 = MUL_C(COEF_CONST(1.7224470982383342), f558);
-    f610 = MUL_C(COEF_CONST(5.1011486186891553), f560);
-    f611 = f603 + f610;
-    f612 = f603 - f610;
-    f613 = f604 + f609;
-    f614 = f609 - f604;
-    f615 = f605 + f608;
-    f616 = f605 - f608;
-    f617 = f606 + f607;
-    f618 = f607 - f606;
-    f619 = f612 - f618;
-    f620 = f612 + f618;
-    f621 = f614 - f616;
-    f622 = f614 + f616;
-    f623 = f620 - f622;
-    f624 = f620 + f622;
-    f625 = MUL_C(COEF_CONST(0.7071067811865476), f623);
-    f626 = f619 + f621;
-    f627 = MUL_C(COEF_CONST(1.3065629648763766), f619);
-    f628 = MUL_C(COEF_CONST((-0.9238795325112866)), f626);
-    f629 = MUL_C(COEF_CONST((-0.5411961001461967)), f621);
-    f630 = f627 + f628;
-    f631 = f629 - f628;
-    f632 = f611 - f613;
-    f633 = f615 - f613;
-    f634 = f615 - f617;
-    f635 = MUL_C(COEF_CONST(0.7071067811865476), f633);
-    f636 = f611 - f635;
-    f637 = f611 + f635;
-    f638 = f632 + f634;
-    f639 = MUL_C(COEF_CONST(1.3065629648763766), f632);
-    f640 = MUL_C(COEF_CONST((-0.9238795325112866)), f638);
-    f641 = MUL_C(COEF_CONST((-0.5411961001461967)), f634);
-    f642 = f639 + f640;
-    f643 = f641 - f640;
-    f644 = f637 - f643;
-    f645 = f637 + f643;
-    f646 = f636 - f642;
-    f647 = f636 + f642;
-    f648 = MUL_C(COEF_CONST(0.5097955791041592), f645);
-    f649 = MUL_C(COEF_CONST(0.6013448869350453), f647);
-    f650 = MUL_C(COEF_CONST(0.8999762231364156), f646);
-    y[3] = MUL_C(COEF_CONST(2.5629154477415055), f644);
-    y[59] = f624 + f648;
-    y[51] = f648 + f631;
-    y[43] = f631 + f649;
-    y[35] = f649 + f625;
-    y[27] = f625 + f650;
-    y[19] = f650 + f630;
-    y[11] = f630 + y[3];
+    f117 = f110 - f116;
+    f118 = f110 + f116;
+    f119 = f109 - f115;
+    f120 = f109 + f115;
+    f121 = f118 + f105;
+    f122 = (-0.8971675863426361) * f118;
+    f123 = 0.9951847266721968 * f121;
+    f124 = 1.0932018670017576 * f105;
+    y[2] = f122 + f123;
+    y[30] = f124 - f123;
+    f127 = f107 - f120;
+    f128 = (-0.6666556584777466) * f120;
+    f129 = 0.9569403357322089 * f127;
+    f130 = 1.2472250129866713 * f107;
+    y[6] = f129 - f128;
+    y[26] = f130 - f129;
+    f133 = f119 + f106;
+    f134 = (-0.4105245275223571) * f119;
+    f135 = 0.8819212643483549 * f133;
+    f136 = 1.3533180011743529 * f106;
+    y[10] = f134 + f135;
+    y[22] = f136 - f135;
+    f139 = f104 - f117;
+    f140 = (-0.1386171691990915) * f117;
+    f141 = 0.7730104533627370 * f139;
+    f142 = 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 = 0.7071067811865476 * f152;
+    f160 = f0 - f159;
+    f161 = f0 + f159;
+    f162 = f148 + f156;
+    f163 = 1.3065629648763766 * f148;
+    f164 = (-0.9238795325112866) * f162;
+    f165 = (-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 = 1.1758756024193588 * f146;
+    f174 = (-0.9807852804032304) * f172;
+    f175 = (-0.7856949583871021) * f158;
+    f176 = f173 + f174;
+    f177 = f175 - f174;
+    f178 = f150 + f154;
+    f179 = 1.3870398453221473 * f150;
+    f180 = (-0.8314696123025455) * f178;
+    f181 = (-0.2758993792829436) * f154;
+    f182 = f179 + f180;
+    f183 = f181 - f180;
+    f184 = f177 - f183;
+    f185 = f177 + f183;
+    f186 = 0.7071067811865476 * f184;
+    f187 = f176 - f182;
+    f188 = f176 + f182;
+    f189 = 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 = 0.7071067811865476 * f151;
+    f201 = f30 - f200;
+    f202 = f30 + f200;
+    f203 = f155 + f147;
+    f204 = 1.3065629648763766 * f155;
+    f205 = (-0.9238795325112866) * f203;
+    f206 = (-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 = 1.1758756024193588 * f157;
+    f215 = (-0.9807852804032304) * f213;
+    f216 = (-0.7856949583871021) * f145;
+    f217 = f214 + f215;
+    f218 = f216 - f215;
+    f219 = f153 + f149;
+    f220 = 1.3870398453221473 * f153;
+    f221 = (-0.8314696123025455) * f219;
+    f222 = (-0.2758993792829436) * f149;
+    f223 = f220 + f221;
+    f224 = f222 - f221;
+    f225 = f218 - f224;
+    f226 = f218 + f224;
+    f227 = 0.7071067811865476 * f225;
+    f228 = f217 - f223;
+    f229 = f217 + f223;
+    f230 = 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 = (-0.9497277818777543) * f234;
+    f243 = 0.9987954562051724 * f241;
+    f244 = 1.0478631305325905 * f193;
+    y[1] = f242 + f243;
+    y[31] = f244 - f243;
+    f247 = f195 - f236;
+    f248 = (-0.8424460355094192) * f236;
+    f249 = 0.9891765099647810 * f247;
+    f250 = 1.1359069844201428 * f195;
+    y[3] = f249 - f248;
+    y[29] = f250 - f249;
+    f253 = f238 + f197;
+    f254 = (-0.7270510732912801) * f238;
+    f255 = 0.9700312531945440 * f253;
+    f256 = 1.2130114330978079 * f197;
+    y[5] = f254 + f255;
+    y[27] = f256 - f255;
+    f259 = f199 - f240;
+    f260 = (-0.6046542117908007) * f240;
+    f261 = 0.9415440651830208 * f259;
+    f262 = 1.2784339185752409 * f199;
+    y[7] = f261 - f260;
+    y[25] = f262 - f261;
+    f265 = f239 + f198;
+    f266 = (-0.4764341996931611) * f239;
+    f267 = 0.9039892931234433 * f265;
+    f268 = 1.3315443865537255 * f198;
+    y[9] = f266 + f267;
+    y[23] = f268 - f267;
+    f271 = f196 - f237;
+    f272 = (-0.3436258658070505) * f237;
+    f273 = 0.8577286100002721 * f271;
+    f274 = 1.3718313541934939 * f196;
+    y[11] = f273 - f272;
+    y[21] = f274 - f273;
+    f277 = f235 + f194;
+    f278 = (-0.2075082269882114) * f235;
+    f279 = 0.8032075314806448 * f277;
+    f280 = 1.3989068359730783 * f194;
+    y[13] = f278 + f279;
+    y[19] = f280 - f279;
+    f283 = f192 - f233;
+    f284 = (-0.0693921705079408) * f233;
+    f285 = 0.7409511253549591 * f283;
+    f286 = 1.4125100802019774 * f192;
+    y[15] = f285 - f284;
+    y[17] = f286 - f285;
 }
 
 #else
@@ -2805,7 +2940,715 @@
     y[32] = f801 - f800;
 }
 
-#endif
+void DST4_32(real_t *y, real_t *x)
+{
+    real_t f0;
+    real_t f1;
+    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;
 
+    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 = 0.7071067811865476 * f15;
+    f32 = x[0] - f31;
+    f33 = x[0] + f31;
+    f34 = f7 + f23;
+    f35 = 1.3065629648763766 * f7;
+    f36 = (-0.9238795325112866) * f34;
+    f37 = (-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 = 0.7071067811865476 * f45;
+    f47 = f3 - f46;
+    f48 = f3 + f46;
+    f49 = 0.7071067811865476 * f44;
+    f50 = f49 - f27;
+    f51 = f49 + f27;
+    f52 = f51 + f48;
+    f53 = (-0.7856949583871021) * f51;
+    f54 = 0.9807852804032304 * f52;
+    f55 = 1.1758756024193588 * f48;
+    f56 = f53 + f54;
+    f57 = f55 - f54;
+    f58 = f50 + f47;
+    f59 = (-0.2758993792829430) * f50;
+    f60 = 0.8314696123025452 * f58;
+    f61 = 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 = 0.7071067811865476 * f75;
+    f79 = f1 - f78;
+    f80 = f1 + f78;
+    f81 = f73 + f77;
+    f82 = 1.3065629648763766 * f73;
+    f83 = (-0.9238795325112866) * f81;
+    f84 = (-0.5411961001461967) * f77;
+    f85 = f82 + f83;
+    f86 = f84 - f83;
+    f87 = f80 - f86;
+    f88 = f80 + f86;
+    f89 = f79 - f85;
+    f90 = f79 + f85;
+    f91 = 0.7071067811865476 * f74;
+    f92 = f29 - f91;
+    f93 = f29 + f91;
+    f94 = f76 + f72;
+    f95 = 1.3065629648763766 * f76;
+    f96 = (-0.9238795325112866) * f94;
+    f97 = (-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 = (-0.8971675863426361) * f101;
+    f106 = 0.9951847266721968 * f104;
+    f107 = 1.0932018670017576 * f88;
+    f108 = f105 + f106;
+    f109 = f107 - f106;
+    f110 = f90 - f103;
+    f111 = (-0.6666556584777466) * f103;
+    f112 = 0.9569403357322089 * f110;
+    f113 = 1.2472250129866713 * f90;
+    f114 = f112 - f111;
+    f115 = f113 - f112;
+    f116 = f102 + f89;
+    f117 = (-0.4105245275223571) * f102;
+    f118 = 0.8819212643483549 * f116;
+    f119 = 1.3533180011743529 * f89;
+    f120 = f117 + f118;
+    f121 = f119 - f118;
+    f122 = f87 - f100;
+    f123 = (-0.1386171691990915) * f100;
+    f124 = 0.7730104533627370 * f122;
+    f125 = 1.4074037375263826 * f87;
+    f126 = f124 - f123;
+    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 = 1.0478631305325901 * f0;
+    f146 = (-0.9987954562051724) * f144;
+    f147 = (-0.9497277818777548) * f30;
+    f148 = f145 + f146;
+    f149 = f147 - f146;
+    f150 = f4 + f26;
+    f151 = 1.2130114330978077 * f4;
+    f152 = (-0.9700312531945440) * f150;
+    f153 = (-0.7270510732912803) * f26;
+    f154 = f151 + f152;
+    f155 = f153 - f152;
+    f156 = f8 + f22;
+    f157 = 1.3315443865537255 * f8;
+    f158 = (-0.9039892931234433) * f156;
+    f159 = (-0.4764341996931612) * f22;
+    f160 = f157 + f158;
+    f161 = f159 - f158;
+    f162 = f12 + f18;
+    f163 = 1.3989068359730781 * f12;
+    f164 = (-0.8032075314806453) * f162;
+    f165 = (-0.2075082269882124) * f18;
+    f166 = f163 + f164;
+    f167 = f165 - f164;
+    f168 = f16 + f14;
+    f169 = 1.4125100802019777 * f16;
+    f170 = (-0.6715589548470187) * f168;
+    f171 = 0.0693921705079402 * f14;
+    f172 = f169 + f170;
+    f173 = f171 - f170;
+    f174 = f20 + f10;
+    f175 = 1.3718313541934939 * f20;
+    f176 = (-0.5141027441932219) * f174;
+    f177 = 0.3436258658070501 * f10;
+    f178 = f175 + f176;
+    f179 = f177 - f176;
+    f180 = f24 + f6;
+    f181 = 1.2784339185752409 * f24;
+    f182 = (-0.3368898533922200) * f180;
+    f183 = 0.6046542117908008 * f6;
+    f184 = f181 + f182;
+    f185 = f183 - f182;
+    f186 = f28 + f2;
+    f187 = 1.1359069844201433 * f28;
+    f188 = (-0.1467304744553624) * f186;
+    f189 = 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 = 1.1758756024193588 * f192;
+    f210 = (-0.9807852804032304) * f208;
+    f211 = (-0.7856949583871021) * f194;
+    f212 = f209 + f210;
+    f213 = f211 - f210;
+    f214 = f196 + f198;
+    f215 = 1.3870398453221475 * f196;
+    f216 = (-0.5555702330196022) * f214;
+    f217 = 0.2758993792829431 * f198;
+    f218 = f215 + f216;
+    f219 = f217 - f216;
+    f220 = f200 + f202;
+    f221 = 0.7856949583871022 * f200;
+    f222 = 0.1950903220161283 * f220;
+    f223 = 1.1758756024193586 * f202;
+    f224 = f221 + f222;
+    f225 = f223 - f222;
+    f226 = f204 + f206;
+    f227 = (-0.2758993792829430) * f204;
+    f228 = 0.8314696123025452 * f226;
+    f229 = 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 = 1.3065629648763766 * f232;
+    f250 = (-0.9238795325112866) * f248;
+    f251 = (-0.5411961001461967) * f234;
+    f252 = f249 + f250;
+    f253 = f251 - f250;
+    f254 = f236 + f238;
+    f255 = 0.5411961001461969 * f236;
+    f256 = 0.3826834323650898 * f254;
+    f257 = 1.3065629648763766 * f238;
+    f258 = f255 + f256;
+    f259 = f257 - f256;
+    f260 = f240 + f242;
+    f261 = 1.3065629648763766 * f240;
+    f262 = (-0.9238795325112866) * f260;
+    f263 = (-0.5411961001461967) * f242;
+    f264 = f261 + f262;
+    f265 = f263 - f262;
+    f266 = f244 + f246;
+    f267 = 0.5411961001461969 * f244;
+    f268 = 0.3826834323650898 * f266;
+    f269 = 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 = 0.7071067811865474 * f288;
+    f291 = 0.7071067811865474 * f289;
+    f292 = f276 - f278;
+    f293 = f276 + f278;
+    f294 = 0.7071067811865474 * f292;
+    f295 = 0.7071067811865474 * f293;
+    f296 = f280 - f282;
+    f297 = f280 + f282;
+    f298 = 0.7071067811865474 * f296;
+    f299 = 0.7071067811865474 * f297;
+    f300 = f284 - f286;
+    f301 = f284 + f286;
+    f302 = 0.7071067811865474 * f300;
+    f303 = 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] = 0.5001506360206510 * f305;
+    y[30] = 0.5013584524464084 * f307;
+    y[29] = 0.5037887256810443 * f309;
+    y[28] = 0.5074711720725553 * f311;
+    y[27] = 0.5124514794082247 * f313;
+    y[26] = 0.5187927131053328 * f315;
+    y[25] = 0.5265773151542700 * f317;
+    y[24] = 0.5359098169079920 * f319;
+    y[23] = 0.5469204379855088 * f321;
+    y[22] = 0.5597698129470802 * f323;
+    y[21] = 0.5746551840326600 * f325;
+    y[20] = 0.5918185358574165 * f327;
+    y[19] = 0.6115573478825099 * f329;
+    y[18] = 0.6342389366884031 * f331;
+    y[17] = 0.6603198078137061 * f333;
+    y[16] = 0.6903721282002123 * f335;
+    y[15] = 0.7251205223771985 * f334;
+    y[14] = 0.7654941649730891 * f332;
+    y[13] = 0.8127020908144905 * f330;
+    y[12] = 0.8683447152233481 * f328;
+    y[11] = 0.9345835970364075 * f326;
+    y[10] = 1.0144082649970547 * f324;
+    y[9] = 1.1120716205797176 * f322;
+    y[8] = 1.2338327379765710 * f320;
+    y[7] = 1.3892939586328277 * f318;
+    y[6] = 1.5939722833856311 * f316;
+    y[5] = 1.8746759800084078 * f314;
+    y[4] = 2.2820500680051619 * f312;
+    y[3] = 2.9246284281582162 * f310;
+    y[2] = 4.0846110781292477 * f308;
+    y[1] = 6.7967507116736332 * f306;
+    y[0] = 20.3738781672314530 * f304;
+}
+
 #endif
 
+#endif
--- a/libfaad/sbr_dct.h
+++ b/libfaad/sbr_dct.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_dct.h,v 1.10 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_dct.h,v 1.12 2004/03/10 19:45:41 menno Exp $
 **/
 
 #ifndef __SBR_DCT_H__
@@ -33,10 +33,13 @@
 #endif
 
 void DCT3_32_unscaled(real_t *y, real_t *x);
-void DCT2_64_unscaled(real_t *y, real_t *x);
-void DST2_64_unscaled(real_t *y, real_t *x);
 void DCT4_64(real_t *y, real_t *x);
 void DCT4_64_kernel(real_t *y, real_t *t2);
+void DCT4_32(real_t *y, real_t *x);
+void DST4_32(real_t *y, real_t *x);
+void DCT2_32_unscaled(real_t *y, real_t *x);
+void DCT4_16(real_t *y, real_t *x);
+void DCT2_16_unscaled(real_t *y, real_t *x);
 
 
 #ifdef __cplusplus
--- a/libfaad/sbr_dec.c
+++ b/libfaad/sbr_dec.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_dec.c,v 1.26 2004/01/29 11:31:11 menno Exp $
+** $Id: sbr_dec.c,v 1.27 2004/02/26 09:29:28 menno Exp $
 **/
 
 
@@ -155,7 +155,8 @@
 }
 
 static void sbr_process_channel(sbr_info *sbr, real_t *channel_buf, qmf_t X[MAX_NTSR][64],
-                                uint8_t ch, uint8_t dont_process)
+                                uint8_t ch, uint8_t dont_process,
+                                const uint8_t downSampledSBR)
 {
     int16_t i, k, l;
 
@@ -167,7 +168,7 @@
     {
         uint8_t j;
         sbr->qmfa[ch] = qmfa_init(32);
-        sbr->qmfs[ch] = qmfs_init(64);
+        sbr->qmfs[ch] = qmfs_init((downSampledSBR)?32:64);
 
         for (j = 0; j < 5; j++)
         {
@@ -274,7 +275,7 @@
 }
 
 uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan,
-                             const uint8_t just_seeked, const uint8_t upsample_only)
+                             const uint8_t just_seeked, const uint8_t downSampledSBR)
 {
     uint8_t dont_process = 0;
     uint8_t ret = 0;
@@ -304,21 +305,31 @@
         sbr->just_seeked = 0;
     }
 
-    sbr_process_channel(sbr, left_chan, X, 0, dont_process);
+    sbr_process_channel(sbr, left_chan, X, 0, dont_process, downSampledSBR);
     /* subband synthesis */
+    if (downSampledSBR)
+    {
+        sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X, left_chan);
+    } else {
 #ifndef USE_SSE
-    sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, left_chan);
+        sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, left_chan);
 #else
-    sbr->qmfs[ch]->qmf_func(sbr, sbr->qmfs[0], X, left_chan);
+        sbr->qmfs[ch]->qmf_func(sbr, sbr->qmfs[0], X, left_chan);
 #endif
+    }
 
-    sbr_process_channel(sbr, right_chan, X, 1, dont_process);
+    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 {
 #ifndef USE_SSE
-    sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X, right_chan);
+        sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X, right_chan);
 #else
-    sbr->qmfs[ch]->qmf_func(sbr, sbr->qmfs[1], X, right_chan);
+        sbr->qmfs[ch]->qmf_func(sbr, sbr->qmfs[1], X, right_chan);
 #endif
+    }
 
     if (sbr->bs_header_flag)
         sbr->just_seeked = 0;
@@ -337,7 +348,7 @@
 }
 
 uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel,
-                             const uint8_t just_seeked, const uint8_t upsample_only)
+                             const uint8_t just_seeked, const uint8_t downSampledSBR)
 {
     uint8_t dont_process = 0;
     uint8_t ret = 0;
@@ -367,13 +378,18 @@
         sbr->just_seeked = 0;
     }
 
-    sbr_process_channel(sbr, channel, X, 0, dont_process);
+    sbr_process_channel(sbr, channel, X, 0, dont_process, downSampledSBR);
     /* subband synthesis */
+    if (downSampledSBR)
+    {
+        sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X, channel);
+    } else {
 #ifndef USE_SSE
-    sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, channel);
+        sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, channel);
 #else
-    sbr->qmfs[ch]->qmf_func(sbr, sbr->qmfs[0], X, channel);
+        sbr->qmfs[ch]->qmf_func(sbr, sbr->qmfs[0], X, channel);
 #endif
+    }
 
     if (sbr->bs_header_flag)
         sbr->just_seeked = 0;
@@ -389,34 +405,15 @@
     return 0;
 }
 
-static void ps_dummy_function(qmf_t X_mono[MAX_NTSR][64],
-                              qmf_t X_left[MAX_NTSR][64], qmf_t X_right[MAX_NTSR][64])
-{
-    uint8_t i, j;
-
-    for (i = 0; i < MAX_NTSR; i++)
-    {
-        for (j = 0; j < 64; j++)
-        {
-            QMF_RE(X_left[i][j]) = QMF_RE(X_mono[i][j]);
-            QMF_RE(X_right[i][j]) = QMF_RE(X_mono[i][j]);
-#ifndef SBR_LOW_POWER
-            QMF_IM(X_left[i][j]) = QMF_IM(X_mono[i][j]);
-            QMF_IM(X_right[i][j]) = QMF_IM(X_mono[i][j]);
-#endif
-        }
-    }
-}
-
 #if (defined(PS_DEC) || defined(DRM_PS))
 uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel,
-                               const uint8_t just_seeked, const uint8_t upsample_only)
+                               const uint8_t just_seeked, const uint8_t downSampledSBR)
 {
+    uint8_t l, k;
     uint8_t dont_process = 0;
     uint8_t ret = 0;
-    ALIGN qmf_t X_mono[MAX_NTSR][64];
-    ALIGN qmf_t X_left[MAX_NTSR][64];
-    ALIGN qmf_t X_right[MAX_NTSR][64];
+    ALIGN qmf_t X_left[38][64];
+    ALIGN qmf_t X_right[38][64];
 
     if (sbr == NULL)
         return 20;
@@ -447,19 +444,46 @@
         sbr->qmfs[1] = qmfs_init(64);
     }
 
-    sbr_process_channel(sbr, left_channel, X_mono, 0, dont_process);
+    sbr_process_channel(sbr, left_channel, X_left, 0, dont_process, downSampledSBR);
 
+    /* copy some extra data for PS */
+    for (l = 32; l < 38; l++)
+    {
+        for (k = 0; k < 5; k++)
+        {
+            QMF_RE(X_left[l][k]) = QMF_RE(sbr->Xcodec[0][sbr->tHFAdj+l][k]);
+            QMF_IM(X_left[l][k]) = QMF_IM(sbr->Xcodec[0][sbr->tHFAdj+l][k]);
+        }
+    }
+
     /* perform parametric stereo */
-    ps_dummy_function(X_mono, X_left, X_right);
+#ifdef DRM
+    if (sbr->Is_DRM_SBR)
+    {
+        drm_ps_decode(sbr->drm_ps, X_left, X_right);
+    } else {
+#endif
+#ifdef PS_DEC
+        ps_decode(sbr->ps, X_left, X_right);
+#endif
+#ifdef DRM
+    }
+#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 {
 #ifndef USE_SSE
-    sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X_left, left_channel);
-    sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X_right, right_channel);
+        sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X_left, left_channel);
+        sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X_right, right_channel);
 #else
-    sbr->qmfs[ch]->qmf_func(sbr, sbr->qmfs[0], X_left, left_channel);
-    sbr->qmfs[ch]->qmf_func(sbr, sbr->qmfs[1], X_right, right_channel);
+        sbr->qmfs[ch]->qmf_func(sbr, sbr->qmfs[0], X_left, left_channel);
+        sbr->qmfs[ch]->qmf_func(sbr, sbr->qmfs[1], X_right, right_channel);
 #endif
+    }
 
     if (sbr->bs_header_flag)
         sbr->just_seeked = 0;
--- a/libfaad/sbr_dec.h
+++ b/libfaad/sbr_dec.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_dec.h,v 1.23 2004/02/04 20:07:24 menno Exp $
+** $Id: sbr_dec.h,v 1.24 2004/02/26 09:29:28 menno Exp $
 **/
 
 #ifndef __SBR_DEC_H__
@@ -53,6 +53,7 @@
     real_t *v[2];
     uint8_t v_index;
     uint8_t channels;
+    complex_t *pre_twiddle;
 #ifdef USE_SSE
     void (*qmf_func)(void *a, void *b, void *c, void *d);
 #endif
@@ -111,8 +112,9 @@
     real_t E_orig[2][64][5];
     real_t E_curr[2][64][5];
     int32_t Q[2][64][2];
+    real_t Q_div[2][64][2];
+    real_t Q_div2[2][64][2];
     int32_t Q_prev[2][64];
-    real_t Q_orig[2][64][2];
 
     int8_t l_A[2];
     int8_t l_A_prev[2];
@@ -159,7 +161,7 @@
 	uint8_t bs_dataextra;
     uint8_t Is_DRM_SBR;
 #ifdef DRM_PS
-    drm_ps_info drm_ps;
+    drm_ps_info *drm_ps;
 #endif
 #endif
 
@@ -169,7 +171,7 @@
 	uint8_t tHFAdj;
 
 #ifdef PS_DEC
-    ps_info ps;
+    ps_info *ps;
 #endif
 #if (defined(PS_DEC) || defined(DRM_PS))
     uint8_t ps_used;
@@ -223,12 +225,12 @@
 void sbrDecodeEnd(sbr_info *sbr);
 
 uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan,
-                             const uint8_t just_seeked, const uint8_t upsample_only);
+                             const uint8_t just_seeked, const uint8_t downSampledSBR);
 uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel,
-                             const uint8_t just_seeked, const uint8_t upsample_only);
+                             const uint8_t just_seeked, const uint8_t downSampledSBR);
 #if (defined(PS_DEC) || defined(DRM_PS))
 uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel,
-                               const uint8_t just_seeked, const uint8_t upsample_only);
+                               const uint8_t just_seeked, const uint8_t downSampledSBR);
 #endif
 
 
--- a/libfaad/sbr_e_nf.c
+++ b/libfaad/sbr_e_nf.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_e_nf.c,v 1.11 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_e_nf.c,v 1.12 2004/02/26 09:29:28 menno Exp $
 **/
 
 #include "common.h"
@@ -35,110 +35,6 @@
 #include "sbr_syntax.h"
 #include "sbr_e_nf.h"
 
-ALIGN static const real_t pow2deq[] = {
-    REAL_CONST(2.9103830456733704E-011), REAL_CONST(5.8207660913467407E-011),
-    REAL_CONST(1.1641532182693481E-010), REAL_CONST(2.3283064365386963E-010),
-    REAL_CONST(4.6566128730773926E-010), REAL_CONST(9.3132257461547852E-010),
-    REAL_CONST(1.862645149230957E-009), REAL_CONST(3.7252902984619141E-009),
-    REAL_CONST(7.4505805969238281E-009), REAL_CONST(1.4901161193847656E-008),
-    REAL_CONST(2.9802322387695313E-008), REAL_CONST(5.9604644775390625E-008),
-    REAL_CONST(1.1920928955078125E-007), REAL_CONST(2.384185791015625E-007),
-    REAL_CONST(4.76837158203125E-007), REAL_CONST(9.5367431640625E-007),
-    REAL_CONST(1.9073486328125E-006), REAL_CONST(3.814697265625E-006),
-    REAL_CONST(7.62939453125E-006), REAL_CONST(1.52587890625E-005),
-    REAL_CONST(3.0517578125E-005), REAL_CONST(6.103515625E-005),
-    REAL_CONST(0.0001220703125), REAL_CONST(0.000244140625),
-    REAL_CONST(0.00048828125), REAL_CONST(0.0009765625),
-    REAL_CONST(0.001953125), REAL_CONST(0.00390625),
-    REAL_CONST(0.0078125), REAL_CONST(0.015625),
-    REAL_CONST(0.03125), REAL_CONST(0.0625),
-    REAL_CONST(0.125), REAL_CONST(0.25),
-    REAL_CONST(0.5), REAL_CONST(1.0),
-    REAL_CONST(2.0), REAL_CONST(4.0),
-    REAL_CONST(8.0), REAL_CONST(16.0),
-    REAL_CONST(32.0), REAL_CONST(64.0),
-    REAL_CONST(128.0), REAL_CONST(256.0),
-    REAL_CONST(512.0), REAL_CONST(1024.0),
-    REAL_CONST(2048.0), REAL_CONST(4096.0),
-    REAL_CONST(8192.0), REAL_CONST(16384.0),
-    REAL_CONST(32768.0), REAL_CONST(65536.0),
-    REAL_CONST(131072.0), REAL_CONST(262144.0),
-    REAL_CONST(524288.0), REAL_CONST(1048576.0),
-    REAL_CONST(2097152.0), REAL_CONST(4194304.0),
-    REAL_CONST(8388608.0), REAL_CONST(16777216.0),
-    REAL_CONST(33554432.0), REAL_CONST(67108864.0),
-    REAL_CONST(134217728.0), REAL_CONST(268435456.0),
-    REAL_CONST(536870912.0), REAL_CONST(1073741824.0),
-    REAL_CONST(2147483648.0), REAL_CONST(4294967296.0),
-    REAL_CONST(8589934592.0), REAL_CONST(17179869184.0),
-    REAL_CONST(34359738368.0), REAL_CONST(68719476736.0),
-    REAL_CONST(137438953472.0), REAL_CONST(274877906944.0),
-    REAL_CONST(549755813888.0), REAL_CONST(1099511627776.0),
-    REAL_CONST(2199023255552.0), REAL_CONST(4398046511104.0),
-    REAL_CONST(8796093022208.0), REAL_CONST(17592186044416.0),
-    REAL_CONST(35184372088832.0), REAL_CONST(70368744177664.0),
-    REAL_CONST(140737488355328.0), REAL_CONST(281474976710656.0),
-    REAL_CONST(562949953421312.0), REAL_CONST(1125899906842624.0),
-    REAL_CONST(2251799813685248.0), REAL_CONST(4503599627370496.0),
-    REAL_CONST(9007199254740992.0), REAL_CONST(18014398509481984.0),
-    REAL_CONST(36028797018963968.0), REAL_CONST(72057594037927936.0),
-    REAL_CONST(144115188075855870.0), REAL_CONST(288230376151711740.0),
-    REAL_CONST(576460752303423490.0), REAL_CONST(1152921504606847000.0),
-    REAL_CONST(2305843009213694000.0), REAL_CONST(4611686018427387900.0),
-    REAL_CONST(9223372036854775800.0), REAL_CONST(1.8446744073709552E+019),
-    REAL_CONST(3.6893488147419103E+019), REAL_CONST(7.3786976294838206E+019),
-    REAL_CONST(1.4757395258967641E+020), REAL_CONST(2.9514790517935283E+020),
-    REAL_CONST(5.9029581035870565E+020), REAL_CONST(1.1805916207174113E+021),
-    REAL_CONST(2.3611832414348226E+021), REAL_CONST(4.7223664828696452E+021),
-    REAL_CONST(9.4447329657392904E+021), REAL_CONST(1.8889465931478581E+022),
-    REAL_CONST(3.7778931862957162E+022), REAL_CONST(7.5557863725914323E+022),
-    REAL_CONST(1.5111572745182865E+023), REAL_CONST(3.0223145490365729E+023),
-    REAL_CONST(6.0446290980731459E+023), REAL_CONST(1.2089258196146292E+024),
-    REAL_CONST(2.4178516392292583E+024), REAL_CONST(4.8357032784585167E+024),
-    REAL_CONST(9.6714065569170334E+024), REAL_CONST(1.9342813113834067E+025),
-    REAL_CONST(3.8685626227668134E+025), REAL_CONST(7.7371252455336267E+025),
-    REAL_CONST(1.5474250491067253E+026), REAL_CONST(3.0948500982134507E+026),
-    REAL_CONST(6.1897001964269014E+026), REAL_CONST(1.2379400392853803E+027),
-    REAL_CONST(2.4758800785707605E+027)
-};
-
-/* 1.0 / (1.0 + pow(2.0, x - 12) */
-ALIGN static const real_t pow2deq_rcp[] = {
-    FRAC_CONST(0.99975591896509641),
-    FRAC_CONST(0.99951195705222062),
-    FRAC_CONST(0.99902439024390244),
-    FRAC_CONST(0.99805068226120852),
-    FRAC_CONST(0.99610894941634243),
-    FRAC_CONST(0.99224806201550386),
-    FRAC_CONST(0.98461538461538467),
-    FRAC_CONST(0.96969696969696972),
-    FRAC_CONST(0.94117647058823528),
-    FRAC_CONST(0.88888888888888884),
-    FRAC_CONST(0.80000000000000004),
-    FRAC_CONST(0.66666666666666663),
-    FRAC_CONST(0.5),
-    FRAC_CONST(0.33333333333333331),
-    FRAC_CONST(0.20000000000000001),
-    FRAC_CONST(0.1111111111111111),
-    FRAC_CONST(0.058823529411764705),
-    FRAC_CONST(0.030303030303030304),
-    FRAC_CONST(0.015384615384615385),
-    FRAC_CONST(0.0077519379844961239),
-    FRAC_CONST(0.0038910505836575876),
-    FRAC_CONST(0.0019493177387914229),
-    FRAC_CONST(0.00097560975609756097),
-    FRAC_CONST(0.0004880429477794046),
-    FRAC_CONST(0.00024408103490358799),
-    FRAC_CONST(0.00012205541315757354),
-    FRAC_CONST(6.1031431187061336E-005),
-    FRAC_CONST(3.0516646830846227E-005),
-    FRAC_CONST(1.5258556235409006E-005),
-    FRAC_CONST(7.6293363240331724E-006),
-    FRAC_CONST(3.8146827137652828E-006),
-    FRAC_CONST(1.9073449948406318E-006),
-    FRAC_CONST(9.5367340691241559E-007)
-};
-
 void extract_envelope_data(sbr_info *sbr, uint8_t ch)
 {
     uint8_t l, k;
@@ -241,6 +137,263 @@
     }
 }
 
+/* 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]];
+        }
+    }
+}
+
+#ifndef FIXED_POINT
+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
+};
+#else
+static const int32_t E_deq_tab[31] = {
+    1, 2, 4, 8, 16, 32, 64, 128,
+    256, 512, 1024, 2048, 4096, 8192, 16384, 32768,
+    65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608,
+    16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824
+};
+#endif
+
 void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch)
 {
     if (sbr->bs_coupling == 0)
@@ -253,22 +406,28 @@
         {
             for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
             {
-                /* +6 for the *64 and -10 for the /32 in the synthesis QMF
+                /* +6 for the *64 and -10 for the /32 in the synthesis QMF (fixed)
                  * since this is a energy value: (x/32)^2 = (x^2)/1024
                  */
-                exp = (sbr->E[ch][k][l] >> amp) + 6;
+                /* exp = (sbr->E[ch][k][l] >> amp) + 6 - 10; */
+                exp = (sbr->E[ch][k][l] >> amp);
 
-                if ((exp < -P2_TABLE_OFFSET) || (exp > P2_TABLE_MAX))
+                if ((exp < 0) ||
+#ifndef FIXED_POINT
+                    (exp >= 64)
+#else
+                    (exp >= 32)
+#endif
+                    )
                 {
                     sbr->E_orig[ch][k][l] = 0;
                 } else {
-                    /* FIXED POINT TODO: E_orig: INTEGER!! */
-                    sbr->E_orig[ch][k][l] = pow2deq[exp + P2_TABLE_OFFSET];
+                    sbr->E_orig[ch][k][l] = E_deq_tab[exp];
 
                     /* save half the table size at the cost of 1 multiply */
                     if (amp && (sbr->E[ch][k][l] & 1))
                     {
-                        sbr->E_orig[ch][k][l] = MUL_R(sbr->E_orig[ch][k][l], REAL_CONST(1.414213562));
+                        sbr->E_orig[ch][k][l] = MUL_C(sbr->E_orig[ch][k][l], COEF_CONST(1.414213562));
                     }
                 }
             }
@@ -278,18 +437,29 @@
         {
             for (k = 0; k < sbr->N_Q; k++)
             {
-                if (sbr->Q[ch][k][l] < 0 || sbr->Q[ch][k][l] > 30)
-                {
-                    sbr->Q_orig[ch][k][l] = 0;
-                } else {
-                    exp = NOISE_FLOOR_OFFSET - sbr->Q[ch][k][l];
-                    sbr->Q_orig[ch][k][l] = pow2deq[exp + P2_TABLE_OFFSET];
-                }
+                sbr->Q_div[ch][k][l] = calc_Q_div(sbr, ch, k, l);
+                sbr->Q_div2[ch][k][l] = calc_Q_div2(sbr, ch, k, l);
             }
         }
     }
 }
 
+static const real_t E_pan_tab[25] = {
+    FRAC_CONST(0.000244081), FRAC_CONST(0.000488043),
+    FRAC_CONST(0.00097561),  FRAC_CONST(0.00194932),
+    FRAC_CONST(0.00389105),  FRAC_CONST(0.00775194),
+    FRAC_CONST(0.0153846),   FRAC_CONST(0.030303),
+    FRAC_CONST(0.0588235),   FRAC_CONST(0.111111),
+    FRAC_CONST(0.2),         FRAC_CONST(0.333333),
+    FRAC_CONST(0.5),         FRAC_CONST(0.666667),
+    FRAC_CONST(0.8),         FRAC_CONST(0.888889),
+    FRAC_CONST(0.941176),    FRAC_CONST(0.969697),
+    FRAC_CONST(0.984615),    FRAC_CONST(0.992248),
+    FRAC_CONST(0.996109),    FRAC_CONST(0.998051),
+    FRAC_CONST(0.999024),    FRAC_CONST(0.999512),
+    FRAC_CONST(0.999756)
+};
+
 void unmap_envelope_noise(sbr_info *sbr)
 {
     real_t tmp;
@@ -302,47 +472,49 @@
     {
         for (k = 0; k < sbr->n[sbr->f[0][l]]; k++)
         {
-            /* +6: * 64 ; +1: * 2 ; -10: /1024 QMF */
-            exp0 = (sbr->E[0][k][l] >> amp0) + 7;
+            /* +6: * 64 ; +1: * 2 ; -10: /1024 QMF (fixed) */
+            /* exp0 = (sbr->E[0][k][l] >> amp0) + 7 - 10 */
+            exp0 = (sbr->E[0][k][l] >> amp0) + 1;
 
             /* UN_MAP removed: (x / 4096) same as (x >> 12) */
             /* E[1] is always even so no need for compensating the divide by 2 with
              * an extra multiplication
              */
-            exp1 = (sbr->E[1][k][l] >> amp1) - 12;
+            /* exp1 = (sbr->E[1][k][l] >> amp1) - 12; */
+            exp1 = (sbr->E[1][k][l] >> amp1);
 
-            if ((exp0 < -P2_TABLE_OFFSET) || (exp0 > P2_TABLE_MAX) ||
-                (exp1 < -P2_TABLE_RCP_OFFSET) || (exp1 > P2_TABLE_RCP_MAX))
+            if ((exp0 < 0) ||
+#ifndef FIXED_POINT
+                (exp0 >= 64) ||
+#else
+                (exp0 >= 32) ||
+#endif
+                (exp1 < 0) || (exp1 > 24))
             {
                 sbr->E_orig[1][k][l] = 0;
                 sbr->E_orig[0][k][l] = 0;
             } else {
-                tmp = pow2deq[exp0 + P2_TABLE_OFFSET];
+                tmp = E_deq_tab[exp0];
                 if (amp0 && (sbr->E[0][k][l] & 1))
-                    tmp = MUL_R(tmp, REAL_CONST(1.414213562));
+                {
+                    tmp = MUL_C(tmp, COEF_CONST(1.414213562));
+                }
 
-                /* FIXED POINT TODO: E_orig: INTEGER!! */
-                sbr->E_orig[1][k][l] = MUL_F(tmp, pow2deq_rcp[exp1 + P2_TABLE_RCP_OFFSET]);
-                sbr->E_orig[0][k][l] = MUL_R(sbr->E_orig[1][k][l], pow2deq[exp1 + P2_TABLE_OFFSET]);
+                /* panning */
+                sbr->E_orig[0][k][l] = MUL_F(tmp, E_pan_tab[exp1]);
+                sbr->E_orig[1][k][l] = MUL_F(tmp, E_pan_tab[24 - exp1]);
             }
         }
     }
+
     for (l = 0; l < sbr->L_Q[0]; l++)
     {
         for (k = 0; k < sbr->N_Q; k++)
         {
-            if ((sbr->Q[0][k][l] < 0 || sbr->Q[0][k][l] > 30) ||
-                (sbr->Q[1][k][l] < 0 || sbr->Q[1][k][l] > 24 /* 2*panOffset(1) */))
-            {
-                sbr->Q_orig[0][k][l] = 0;
-                sbr->Q_orig[1][k][l] = 0;
-            } else {
-                exp0 = NOISE_FLOOR_OFFSET - sbr->Q[0][k][l] + 1;
-                exp1 = sbr->Q[1][k][l] - 12;
-
-                sbr->Q_orig[1][k][l] = MUL_F(pow2deq[exp0 + P2_TABLE_OFFSET], pow2deq_rcp[exp1 + P2_TABLE_RCP_OFFSET]);
-                sbr->Q_orig[0][k][l] = MUL_R(sbr->Q_orig[1][k][l], pow2deq[exp1 + P2_TABLE_OFFSET]);
-            }
+            sbr->Q_div[0][k][l] = calc_Q_div(sbr, 0, k, l);
+            sbr->Q_div[1][k][l] = calc_Q_div(sbr, 1, k, l);
+            sbr->Q_div2[0][k][l] = calc_Q_div2(sbr, 0, k, l);
+            sbr->Q_div2[1][k][l] = calc_Q_div2(sbr, 1, k, l);
         }
     }
 }
--- a/libfaad/sbr_e_nf.h
+++ b/libfaad/sbr_e_nf.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_e_nf.h,v 1.9 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_e_nf.h,v 1.10 2004/02/26 09:29:28 menno Exp $
 **/
 
 #ifndef __SBR_E_NF_H__
@@ -31,19 +31,6 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-
-
-#ifndef FIXED_POINT
-#define P2_TABLE_OFFSET 35
-#define P2_TABLE_MAX 91
-#else
-#define P2Q_TABLE_OFFSET 24
-#define P2Q_TABLE_MAX 7
-#define P2_TABLE_OFFSET 0
-#define P2_TABLE_MAX 31
-#endif
-#define P2_TABLE_RCP_OFFSET 12
-#define P2_TABLE_RCP_MAX 21
 
 
 void extract_envelope_data(sbr_info *sbr, uint8_t ch);
--- a/libfaad/sbr_fbt.c
+++ b/libfaad/sbr_fbt.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_fbt.c,v 1.10 2004/01/16 20:20:32 menno Exp $
+** $Id: sbr_fbt.c,v 1.11 2004/02/26 09:29:28 menno Exp $
 **/
 
 /* Calculate frequency band tables */
@@ -259,86 +259,15 @@
 */
 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)
 {
-#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
 }
 
 /*
@@ -365,11 +294,7 @@
 
     bands = temp1[bs_freq_scale-1];
 
-#ifdef FIXED_POINT
-    if (REAL_CONST(k2) > MUL_R(REAL_CONST(k0),REAL_CONST(2.2449)))
-#else
     if ((float)k2/(float)k0 > 2.2449)
-#endif
     {
         twoRegions = 1;
         k1 = k0 << 1;
@@ -385,21 +310,12 @@
 
     q = find_initial_power(nrBand0, k0, k1);
     qk = REAL_CONST(k0);
-#ifdef FIXED_POINT
-    A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS);
-#else
     A_1 = (int32_t)(qk + .5);
-#endif
     for (k = 0; k <= nrBand0; k++)
     {
         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;
     }
 
@@ -429,21 +345,12 @@
 
     q = find_initial_power(nrBand1, k1, k2);
     qk = REAL_CONST(k1);
-#ifdef FIXED_POINT
-    A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS);
-#else
     A_1 = (int32_t)(qk + .5);
-#endif
     for (k = 0; k <= nrBand1 - 1; k++)
     {
         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;
     }
 
@@ -532,6 +439,8 @@
     }
 
 #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++)
     {
@@ -611,8 +520,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;
@@ -664,9 +573,6 @@
             if (limTable[k-1] != 0)
 #if 0
                 nOctaves = REAL_CONST(log((float)limTable[k]/(float)limTable[k-1])/log(2.0));
-#endif
-#ifdef FIXED_POINT
-                nOctaves = SBR_DIV(REAL_CONST(limTable[k]),REAL_CONST(limTable[k-1]));
 #else
                 nOctaves = (real_t)limTable[k]/(real_t)limTable[k-1];
 #endif
@@ -674,7 +580,7 @@
                 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/libfaad/sbr_fbt.h
+++ b/libfaad/sbr_fbt.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_fbt.h,v 1.10 2004/01/16 20:20:32 menno Exp $
+** $Id: sbr_fbt.h,v 1.14 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_FBT_H__
--- a/libfaad/sbr_hfadj.c
+++ b/libfaad/sbr_hfadj.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_hfadj.c,v 1.10 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_hfadj.c,v 1.11 2004/02/26 09:29:28 menno Exp $
 **/
 
 /* High Frequency adjustment */
@@ -38,7 +38,7 @@
 #include "sbr_noise.h"
 
 
-/* static function delcarations */
+/* static function declarations */
 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,
@@ -87,7 +87,8 @@
             {
                 uint8_t k;
 
-                adj->Q_mapped[m - sbr->kx][l] = 0;
+                adj->Q_div_mapped[m - sbr->kx][l] = 0;
+                adj->Q_div2_mapped[m - sbr->kx][l] = 0;
 
                 for (k = 0; k < 2; k++)
                 {
@@ -94,8 +95,11 @@
                     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];
+                        adj->Q_div_mapped[m - sbr->kx][l] =
+                            sbr->Q_div[ch][i][k];
+
+                        adj->Q_div2_mapped[m - sbr->kx][l] =
+                            sbr->Q_div2[ch][i][k];
                     }
                 }
             }
@@ -276,12 +280,10 @@
     }
 }
 
-
 #define EPS (1e-12)
 
 #define ONE (1)
 
-
 static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
 {
     static real_t limGain[] = { 0.5, 1.0, 2.0, 1e10 };
@@ -293,7 +295,6 @@
     ALIGN real_t S_M[64];
     ALIGN uint8_t table_map_res_to_m[64];
 
-
     for (l = 0; l < sbr->L_E[ch]; l++)
     {
         real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1;
@@ -313,8 +314,14 @@
             real_t acc1 = 0;
             real_t acc2 = 0;
 
-            for (m = sbr->f_table_lim[sbr->bs_limiter_bands][k];
-                 m < sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; m++)
+            uint8_t ml1, ml2;
+
+            ml1 = sbr->f_table_lim[sbr->bs_limiter_bands][k];
+            ml2 = sbr->f_table_lim[sbr->bs_limiter_bands][k+1];
+
+
+            /* calculate the accumulated E_orig and E_curr over the limiter band */
+            for (m = ml1; m < ml2; m++)
             {
                 acc1 += sbr->E_orig[ch][table_map_res_to_m[m]][l];
                 acc2 += sbr->E_curr[ch][m][l];
@@ -323,34 +330,35 @@
             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;
 
-                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;
+                /* Q_div: [0..1] (1/(1+Q_mapped)) */
+                Q_div = adj->Q_div_mapped[m][l];
 
+                /* Q_div2: [0..1] (Q_mapped/(1+Q_mapped)) */
+                Q_div2 = adj->Q_div2_mapped[m][l];
+
+                Q_M = sbr->E_orig[ch][table_map_res_to_m[m]][l] * Q_div2;
+
                 /* 12-Nov: Changed S_mapped to S_index_mapped */
                 if (adj->S_index_mapped[m][l] == 0)
                 {
                     S_M[m] = 0;
                 } else {
-                    real_t div;
-
-                    div = adj->S_index_mapped[m][l] / (1. + adj->Q_mapped[m][l]);
-                    S_M[m] = sbr->E_orig[ch][table_map_res_to_m[m]][l] * div;
+                    S_M[m] = sbr->E_orig[ch][table_map_res_to_m[m]][l] * Q_div;
                 }
 
-                if (adj->S_mapped[m][l] == 0)
-                {
-                    d = (1 + sbr->E_curr[ch][m][l]) * (1 + delta*adj->Q_mapped[m][l]);
-                    G = sbr->E_orig[ch][table_map_res_to_m[m]][l] / d;
-                } else {
-                    G = (sbr->E_orig[ch][table_map_res_to_m[m]][l] / (1. + sbr->E_curr[ch][m][l])) * div2;
-                }
+                G = sbr->E_orig[ch][table_map_res_to_m[m]][l] / (1.0 + sbr->E_curr[ch][m][l]);
 
+                if ((adj->S_mapped[m][l] == 0) && (delta == 1))
+                    G *= Q_div;
+                else if (adj->S_mapped[m][l] == 1)
+                    G *= Q_div2;
+
+
                 /* limit the additional noise energy level */
                 /* and apply the limiter */
                 if (G_max > G)
@@ -358,7 +366,7 @@
                     Q_M_lim[m] = Q_M;
                     G_lim[m] = G;
                 } else {
-                    Q_M_lim[m] = Q_M * G_max / G;
+                    Q_M_lim[m] = Q_M * G_max / G; /* equivalent to code below */
                     G_lim[m] = G_max;
                 }
 
@@ -369,11 +377,15 @@
                     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++)
+            //printf("%d %d\n", ml1, ml2);
+            //printf("%f %f\n", acc1, den);
+            //printf("%f\n", G_boost);
+
+            for (m = ml1; m < ml2; m++)
             {
                 /* apply compensation to gain, noise floor sf's and sinusoid levels */
 #ifndef SBR_LOW_POWER
@@ -387,9 +399,11 @@
                 adj->Q_M_lim_boost[l][m] = sqrt(Q_M_lim[m] * G_boost);
 
                 if (adj->S_index_mapped[m][l])
+                {
                     adj->S_M_boost[l][m] = sqrt(S_M[m] * G_boost);
-                else
+                } else {
                     adj->S_M_boost[l][m] = 0;
+                }
             }
         }
     }
@@ -406,8 +420,18 @@
         i = 0;
         grouping = 0;
 
+//        printf("%d\n", sbr->M);
+
         for (k = sbr->kx; k < sbr->kx + sbr->M - 1; k++)
         {
+            //printf("%f\n", deg[k+1]/(float)(COEF_PRECISION));
+#if 0
+            if (deg[k+1])
+                printf("1\n");
+            else
+                printf("0\n");
+#endif
+
             if (deg[k + 1] && adj->S_mapped[k-sbr->kx][l] == 0)
             {
                 if (grouping == 0)
@@ -420,9 +444,11 @@
                 if (grouping)
                 {
                     if (adj->S_mapped[k-sbr->kx][l])
+                    {
                         sbr->f_group[l][i] = k;
-                    else
+                    } else {
                         sbr->f_group[l][i] = k + 1;
+                    }
                     grouping = 0;
                     i++;
                 }
@@ -446,6 +472,8 @@
 
     for (l = 0; l < sbr->L_E[ch]; l++)
     {
+        //printf("%d: %d\n", l, sbr->N_G[l]);
+
         for (k = 0; k < sbr->N_G[l]; k++)
         {
             E_total_est = E_total = 0;
@@ -457,14 +485,16 @@
                 /* 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]);
+                E_total += sbr->E_curr[ch][m-sbr->kx][l] * adj->G_lim_boost[l][m-sbr->kx];
             }
 
             /* G_target: fixed point */
             if ((E_total_est + EPS) == 0)
+            {
                 G_target = 0;
-            else
+            } else {
                 G_target = E_total / (E_total_est + EPS);
+            }
             acc = 0;
 
             for (m = sbr->f_group[l][(k<<1)]; m < sbr->f_group[l][(k<<1) + 1]; m++)
@@ -471,7 +501,7 @@
             {
                 real_t alpha;
 
-                /* alpha: fixed point */
+                /* alpha: (COEF) fixed point */
                 if (m < sbr->kx + sbr->M - 1)
                 {
                     alpha = max(deg[m], deg[m + 1]);
@@ -479,21 +509,23 @@
                     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]);
+                acc += adj->G_lim_boost[l][m-sbr->kx] * sbr->E_curr[ch][m-sbr->kx][l];
             }
 
             /* acc: fixed point */
             if (acc + EPS == 0)
+            {
                 acc = 0;
-            else
+            } else {
                 acc = E_total / (acc + EPS);
+            }
             for(m = sbr->f_group[l][(k<<1)]; m < sbr->f_group[l][(k<<1) + 1]; m++)
             {
-                adj->G_lim_boost[l][m-sbr->kx] = MUL_R(acc, adj->G_lim_boost[l][m-sbr->kx]);
+                adj->G_lim_boost[l][m-sbr->kx] = acc * adj->G_lim_boost[l][m-sbr->kx];
             }
         }
     }
@@ -516,9 +548,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 };
@@ -577,40 +609,52 @@
 
             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)
                 {
                     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++;
+                        G_filt += MUL_F(sbr->G_temp_prev[ch][n][m], h_smooth[n]);
+                        Q_filt += MUL_F(sbr->Q_temp_prev[ch][n][m], h_smooth[n]);
                     }
                 } else {
+#endif
                     G_filt = sbr->G_temp_prev[ch][4][m];
                     Q_filt = sbr->Q_temp_prev[ch][4][m];
+#ifndef SBR_LOW_POWER
                 }
+#endif
 
                 Q_filt = (adj->S_M_boost[l][m] != 0 || no_noise) ? 0 : Q_filt;
 
+//                printf("%d %d\n", i, m);
+//                printf("%f\n", G_filt);
+#if 0
+                if (sbr->frame == 600)
+                {
+                    printf("%d %d: %f\n", i + sbr->tHFAdj, m+sbr->kx, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]));
+                    printf("%f\n", G_filt);
+                    printf("%f\n", Q_filt);
+                    printf("%f\n", adj->S_M_boost[l][m]);
+                }
+#endif
+
                 /* add noise to the output */
                 fIndexNoise = (fIndexNoise + 1) & 511;
 
                 /* the smoothed gain values are applied to Xsbr */
                 /* V is defined, not calculated */
-                QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]))
+                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]));
                 if (sbr->bs_extension_id == 3 && sbr->bs_extension_data == 42)
                     QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = 16428320;
 #ifndef SBR_LOW_POWER
-                QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]))
+                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]));
 #endif
 
@@ -617,44 +661,48 @@
                 //if (adj->S_index_mapped[m][l])
                 {
                     int8_t rev = (((m + sbr->kx) & 1) ? -1 : 1);
-                    QMF_RE(psi) = MUL_R(adj->S_M_boost[l][m], phi_re[fIndexSine]);
+                    QMF_RE(psi) = adj->S_M_boost[l][m] * phi_re[fIndexSine];
                     QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += QMF_RE(psi);
 
 #ifndef SBR_LOW_POWER
-                    QMF_IM(psi) = rev * MUL_R(adj->S_M_boost[l][m], phi_im[fIndexSine]);
+                    QMF_IM(psi) = rev * adj->S_M_boost[l][m] * phi_im[fIndexSine];
                     QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += QMF_IM(psi);
 #else
+
                     i_min1 = (fIndexSine - 1) & 3;
                     i_plus1 = (fIndexSine + 1) & 3;
 
-                    if (m == 0)
+                    if ((m == 0) && (phi_re[i_plus1] != 0))
                     {
-                        QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) -=
-                            (-1*rev * MUL_C(MUL_R(adj->S_M_boost[l][0], phi_re[i_plus1]), COEF_CONST(0.00815)));
-                        if(m < sbr->M - 1)
+                        QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) +=
+                            (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][0], FRAC_CONST(0.00815)));
+                        if (sbr->M != 0)
                         {
                             QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
-                                (rev * MUL_C(MUL_R(adj->S_M_boost[l][1], phi_re[i_plus1]), COEF_CONST(0.00815)));
+                                (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][1], FRAC_CONST(0.00815)));
                         }
                     }
-                    if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16))
+                    if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
                     {
                         QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
-                            (rev * MUL_C(MUL_R(adj->S_M_boost[l][m - 1], phi_re[i_min1]), COEF_CONST(0.00815)));
+                            (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m - 1], FRAC_CONST(0.00815)));
+                    }
+                    if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0))
+                    {
                         QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
-                            (rev * MUL_C(MUL_R(adj->S_M_boost[l][m + 1], phi_re[i_plus1]), COEF_CONST(0.00815)));
+                            (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][m + 1], FRAC_CONST(0.00815)));
                     }
-                    if ((m == sbr->M - 1) && (sinusoids < 16))
+                    if ((m == sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
                     {
                         if (m > 0)
                         {
                             QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
-                                (rev * MUL_C(MUL_R(adj->S_M_boost[l][m - 1], phi_re[i_min1]), COEF_CONST(0.00815)));
+                                (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m - 1], FRAC_CONST(0.00815)));
                         }
                         if (m + sbr->kx < 64)
                         {
-                            QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) -=
-                                (-1*rev * MUL_C(MUL_R(adj->S_M_boost[l][m], phi_re[i_min1]), COEF_CONST(0.00815)));
+                            QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) +=
+                                (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m], FRAC_CONST(0.00815)));
                         }
                     }
 
--- a/libfaad/sbr_hfadj.h
+++ b/libfaad/sbr_hfadj.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_hfadj.h,v 1.9 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_hfadj.h,v 1.11 2004/03/10 19:45:42 menno Exp $
 **/
 
 #ifndef __SBR_HFADJ_H__
@@ -32,9 +32,10 @@
 extern "C" {
 #endif
 
-typedef struct {
-
-    real_t Q_mapped[64][5];
+typedef struct
+{
+    real_t Q_div_mapped[64][5];
+    real_t Q_div2_mapped[64][5];
 
     uint8_t S_index_mapped[64][5];
     uint8_t S_mapped[64][5];
--- a/libfaad/sbr_hfgen.c
+++ b/libfaad/sbr_hfgen.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_hfgen.c,v 1.12 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_hfgen.c,v 1.13 2004/02/26 09:29:28 menno Exp $
 **/
 
 /* High Frequency generation */
@@ -76,6 +76,9 @@
     {
         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);
@@ -212,7 +215,7 @@
     RE(ac->r02) = r02;
     RE(ac->r11) = r11;
 
-    ac->det = MUL_R(RE(ac->r11), RE(ac->r22)) - MUL_C(MUL_R(RE(ac->r12), RE(ac->r12)), rel);
+    ac->det = MUL_R(RE(ac->r11), RE(ac->r22)) - MUL_F(MUL_R(RE(ac->r12), RE(ac->r12)), rel);
 }
 #else
 static void auto_correlation(sbr_info *sbr, acorr_coef *ac, qmf_t buffer[MAX_NTSRHFG][32],
@@ -291,6 +294,8 @@
             RE(alpha_0[k]) = -SBR_DIV(tmp, RE(ac.r11));
         }
 
+        //printf("%G\n", RE(alpha_0[k])/(float)(REAL_PRECISION));
+
         if ((RE(alpha_0[k]) >= REAL_CONST(4)) || (RE(alpha_1[k]) >= REAL_CONST(4)))
         {
             RE(alpha_0[k]) = REAL_CONST(0);
@@ -300,11 +305,12 @@
         /* reflection coefficient */
         if (RE(ac.r11) == 0)
         {
-            rxx[k] = REAL_CONST(0.0);
+            rxx[k] = COEF_CONST(0.0);
         } else {
-            rxx[k] = -SBR_DIV(RE(ac.r01), RE(ac.r11));
-            if (rxx[k] > REAL_CONST(1.0)) rxx[k] = REAL_CONST(1.0);
-            if (rxx[k] < REAL_CONST(-1.0)) rxx[k] = REAL_CONST(-1.0);
+            rxx[k] = 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);
         }
 #else
         if (ac.det == 0)
@@ -344,40 +350,40 @@
 {
     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]);
             }
         }
     }
--- a/libfaad/sbr_hfgen.h
+++ b/libfaad/sbr_hfgen.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_hfgen.h,v 1.10 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_hfgen.h,v 1.12 2004/03/10 19:45:42 menno Exp $
 **/
 
 #ifndef __SBR_HFGEN_H__
--- a/libfaad/sbr_huff.c
+++ b/libfaad/sbr_huff.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_huff.c,v 1.13 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_huff.c,v 1.17 2004/09/04 14:56:28 menno Exp $
 **/
 
 #include "common.h"
@@ -190,7 +190,6 @@
     { -57, -56 },    {  22,  23 },    { -55, -54 },    { -53, -52 }
 };
 
-
 static const int8_t t_huffman_noise_3_0dB[62][2] = {
     { -64,   1 },    { -63,   2 },    { -65,   3 },    { -66,   4 },
     { -62,   5 },    { -67,   6 },    {   7,   8 },    { -61, -68 },
@@ -227,7 +226,7 @@
 
     while (index >= 0)
     {
-        bit = (uint8_t)faad_getbits(ld, 1);
+        bit = (uint8_t)faad_get1bit(ld);
         index = t_huff[index][bit];
     }
 
--- a/libfaad/sbr_huff.h
+++ b/libfaad/sbr_huff.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_huff.h,v 1.13 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_huff.h,v 1.17 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_HUFF_H__
--- a/libfaad/sbr_noise.h
+++ b/libfaad/sbr_noise.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_noise.h,v 1.9 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_noise.h,v 1.13 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_NOISE_H__
--- a/libfaad/sbr_qmf.c
+++ b/libfaad/sbr_qmf.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_qmf.c,v 1.19 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_qmf.c,v 1.20 2004/02/26 09:29:28 menno Exp $
 **/
 
 #include "common.h"
@@ -83,7 +83,7 @@
         for (n = 32 - 1; n >= 0; n--)
         {
 #ifdef FIXED_POINT
-            qmfa->x[n] = (input[in++]) >> 5;
+            qmfa->x[n] = (input[in++]) >> 4;
 #else
             qmfa->x[n] = input[in++];
 #endif
@@ -114,7 +114,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
@@ -138,8 +138,8 @@
             if (n < kx)
             {
 #ifdef FIXED_POINT
-                QMF_RE(X[l + offset][n]) = y[n] << 1;
-                QMF_IM(X[l + offset][n]) = -y[63-n] << 1;
+                QMF_RE(X[l + offset][n]) = y[n] /*<< 1*/;
+                QMF_IM(X[l + offset][n]) = -y[63-n] /*<< 1*/;
 #else
                 QMF_RE(X[l + offset][n]) = 2. * y[n];
                 QMF_IM(X[l + offset][n]) = -2. * y[63-n];
@@ -162,6 +162,20 @@
     memset(qmfs->v[0], 0, channels * 10 * sizeof(real_t));
     qmfs->v[1] = (real_t*)faad_malloc(channels * 10 * sizeof(real_t));
     memset(qmfs->v[1], 0, channels * 10 * sizeof(real_t));
+
+    if (channels == 32)
+    {
+        /* downsampled filterbank */
+        uint8_t k;
+
+        qmfs->pre_twiddle = (complex_t*)faad_malloc(channels * sizeof(complex_t));
+        /* calculate pre-twiddle factors */
+        for (k = 0; k < channels; k++)
+        {
+            RE(qmfs->pre_twiddle[k]) = cos(-M_PI*(0.5*k + 0.25)/64.);
+            IM(qmfs->pre_twiddle[k]) = sin(-M_PI*(0.5*k + 0.25)/64.);
+        }
+    }
 #else
     qmfs->v[0] = (real_t*)faad_malloc(channels * 20 * sizeof(real_t));
     memset(qmfs->v[0], 0, channels * 20 * sizeof(real_t));
@@ -188,6 +202,10 @@
 {
     if (qmfs)
     {
+        if (qmfs->channels == 32)
+        {
+            if (qmfs->pre_twiddle) faad_free(qmfs->pre_twiddle);
+        }
         if (qmfs->v[0]) faad_free(qmfs->v[0]);
 #ifndef SBR_LOW_POWER
         if (qmfs->v[1]) faad_free(qmfs->v[1]);
@@ -197,15 +215,15 @@
 }
 
 #ifdef SBR_LOW_POWER
-void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
+
+void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
                           real_t *output)
 {
-    ALIGN real_t x[64];
-    ALIGN real_t y[64];
+    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++)
     {
@@ -214,84 +232,83 @@
         /* shift buffers */
         //memmove(qmfs->v[0] + 64, qmfs->v[0], (640-64)*sizeof(real_t));
         //memmove(qmfs->v[1] + 64, qmfs->v[1], (640-64)*sizeof(real_t));
-        memmove(qmfs->v[0] + 128, qmfs->v[0], (1280-128)*sizeof(real_t));
+        memmove(qmfs->v[0] + 64, qmfs->v[0], (640-64)*sizeof(real_t));
 
         //v0 = qmfs->v[qmfs->v_index];
         //v1 = qmfs->v[(qmfs->v_index + 1) & 0x1];
         //qmfs->v_index = (qmfs->v_index + 1) & 0x1;
 
-        /* calculate 128 samples */
-        for (k = 0; k < 64; k++)
+        /* calculate 64 samples */
+        for (k = 0; k < 16; k++)
         {
 #ifdef FIXED_POINT
-            x[k] = QMF_RE(X[l][k]);
+            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
-            x[k] = QMF_RE(X[l][k]) / 32.;
+            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
         }
 
-        for (n = 0; n < 32; n++)
-        {
-            y[2*n]   = -x[2*n];
-            y[2*n+1] =  x[2*n+1];
-        }
+        /* even n samples */
+        DCT2_16_unscaled(x, x);
+        /* uneven n samples */
+        DCT4_16(y, y);
 
-        DCT2_64_unscaled(x, x);
-
-        for (n = 0; n < 64; n++)
+        for (n = 8; n < 24; n++)
         {
-            qmfs->v[0][n+32] = x[n];
+            qmfs->v[0][n*2] = x[n-8];
+            qmfs->v[0][n*2+1] = y[n-8];
         }
-        for (n = 0; n < 32; n++)
+        for (n = 0; n < 16; n++)
         {
-            qmfs->v[0][31 - n] = x[n + 1];
+            qmfs->v[0][n] = qmfs->v[0][32-n];
         }
-        DST2_64_unscaled(x, y);
-        qmfs->v[0][96] = 0;
-        for (n = 1; n < 32; n++)
+        qmfs->v[0][48] = 0;
+        for (n = 1; n < 16; n++)
         {
-            qmfs->v[0][n + 96] = x[n-1];
+            qmfs->v[0][48+n] = -qmfs->v[0][48-n];
         }
 
-        /* calculate 64 output samples and window */
-        for (k = 0; k < 64; k++)
+        /* calculate 32 output samples and window */
+        for (k = 0; k < 32; k++)
         {
 #if 1
-             output[out++] = MUL_F(qmfs->v[0][k], qmf_c[k]) +
-                 MUL_F(qmfs->v[0][192 + k], qmf_c[64 + k]) +
-                 MUL_F(qmfs->v[0][256 + k], qmf_c[128 + k]) +
-                 MUL_F(qmfs->v[0][256 + 192 + k], qmf_c[128 + 64 + k]) +
-                 MUL_F(qmfs->v[0][512 + k], qmf_c[256 + k]) +
-                 MUL_F(qmfs->v[0][512 + 192 + k], qmf_c[256 + 64 + k]) +
-                 MUL_F(qmfs->v[0][768 + k], qmf_c[384 + k]) +
-                 MUL_F(qmfs->v[0][768 + 192 + k], qmf_c[384 + 64 + k]) +
-                 MUL_F(qmfs->v[0][1024 + k], qmf_c[512 + k]) +
-                 MUL_F(qmfs->v[0][1024 + 192 + k], qmf_c[512 + 64 + k]);
+            output[out++] = MUL_F(qmfs->v[0][k], qmf_c[2*k]) +
+                MUL_F(qmfs->v[0][96 + k], qmf_c[64 + 2*k]) +
+                MUL_F(qmfs->v[0][128 + k], qmf_c[128 + 2*k]) +
+                MUL_F(qmfs->v[0][224 + k], qmf_c[192 + 2*k]) +
+                MUL_F(qmfs->v[0][256 + k], qmf_c[256 + 2*k]) +
+                MUL_F(qmfs->v[0][352 + k], qmf_c[320 + 2*k]) +
+                MUL_F(qmfs->v[0][384 + k], qmf_c[384 + 2*k]) +
+                MUL_F(qmfs->v[0][480 + k], qmf_c[448 + 2*k]) +
+                MUL_F(qmfs->v[0][512 + k], qmf_c[512 + 2*k]) +
+                MUL_F(qmfs->v[0][608 + k], qmf_c[576 + 2*k]);
 #else
-            output[out++] = MUL_F(v0[k], qmf_c[k]) +
-                MUL_F(v0[64 + k], qmf_c[64 + k]) +
-                MUL_F(v0[128 + k], qmf_c[128 + k]) +
-                MUL_F(v0[192 + k], qmf_c[192 + k]) +
-                MUL_F(v0[256 + k], qmf_c[256 + k]) +
-                MUL_F(v0[320 + k], qmf_c[320 + k]) +
-                MUL_F(v0[384 + k], qmf_c[384 + k]) +
-                MUL_F(v0[448 + k], qmf_c[448 + k]) +
-                MUL_F(v0[512 + k], qmf_c[512 + k]) +
-                MUL_F(v0[576 + k], qmf_c[576 + k]);
+            output[out++] = MUL_F(v0[k], qmf_c[2*k]) +
+                MUL_F(v0[32 + k], qmf_c[64 + 2*k]) +
+                MUL_F(v0[64 + k], qmf_c[128 + 2*k]) +
+                MUL_F(v0[96 + k], qmf_c[192 + 2*k]) +
+                MUL_F(v0[128 + k], qmf_c[256 + 2*k]) +
+                MUL_F(v0[160 + k], qmf_c[320 + 2*k]) +
+                MUL_F(v0[192 + k], qmf_c[384 + 2*k]) +
+                MUL_F(v0[224 + k], qmf_c[448 + 2*k]) +
+                MUL_F(v0[256 + k], qmf_c[512 + 2*k]) +
+                MUL_F(v0[288 + k], qmf_c[576 + 2*k]);
 #endif
         }
     }
 }
 
-void sbr_qmf_synthesis_64_sse(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
-                              real_t *output)
+void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
+                          real_t *output)
 {
     ALIGN real_t x[64];
     ALIGN real_t y[64];
-    ALIGN real_t y2[64];
     int16_t n, k, out = 0;
     uint8_t l;
 
+
     /* qmf subsample l */
     for (l = 0; l < sbr->numTimeSlotsRate; l++)
     {
@@ -307,37 +324,35 @@
         //qmfs->v_index = (qmfs->v_index + 1) & 0x1;
 
         /* calculate 128 samples */
-        for (k = 0; k < 64; k++)
+        for (k = 0; k < 32; k++)
         {
 #ifdef FIXED_POINT
-            x[k] = QMF_RE(X[l][k]);
+            y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][63 - k]));
+            x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][63 - k]));
 #else
-            x[k] = QMF_RE(X[l][k]) / 32.;
+            y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][63 - k])) / 32.0;
+            x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][63 - k])) / 32.0;
 #endif
         }
 
-        for (n = 0; n < 32; n++)
-        {
-            y[2*n]   = -x[2*n];
-            y[2*n+1] =  x[2*n+1];
-        }
+        /* even n samples */
+        DCT2_32_unscaled(x, x);
+        /* uneven n samples */
+        DCT4_32(y, y);
 
-        DCT2_64_unscaled(x, x);
-
-        for (n = 0; n < 64; n++)
+        for (n = 16; n < 48; n++)
         {
-            qmfs->v[0][n+32] = x[n];
+            qmfs->v[0][n*2] = x[n-16];
+            qmfs->v[0][n*2+1] = y[n-16];
         }
         for (n = 0; n < 32; n++)
         {
-            qmfs->v[0][31 - n] = x[n + 1];
+            qmfs->v[0][n] = qmfs->v[0][64-n];
         }
-
-        DST2_64_unscaled(x, y);
         qmfs->v[0][96] = 0;
         for (n = 1; n < 32; n++)
         {
-            qmfs->v[0][n + 96] = x[n-1];
+            qmfs->v[0][96+n] = -qmfs->v[0][96-n];
         }
 
         /* calculate 64 output samples and window */
@@ -344,16 +359,16 @@
         for (k = 0; k < 64; k++)
         {
 #if 1
-             output[out++] = MUL_F(qmfs->v[0][k], qmf_c[k]) +
-                 MUL_F(qmfs->v[0][192 + k], qmf_c[64 + k]) +
-                 MUL_F(qmfs->v[0][256 + k], qmf_c[128 + k]) +
-                 MUL_F(qmfs->v[0][256 + 192 + k], qmf_c[128 + 64 + k]) +
-                 MUL_F(qmfs->v[0][512 + k], qmf_c[256 + k]) +
-                 MUL_F(qmfs->v[0][512 + 192 + k], qmf_c[256 + 64 + k]) +
-                 MUL_F(qmfs->v[0][768 + k], qmf_c[384 + k]) +
-                 MUL_F(qmfs->v[0][768 + 192 + k], qmf_c[384 + 64 + k]) +
-                 MUL_F(qmfs->v[0][1024 + k], qmf_c[512 + k]) +
-                 MUL_F(qmfs->v[0][1024 + 192 + k], qmf_c[512 + 64 + k]);
+            output[out++] = MUL_F(qmfs->v[0][k], qmf_c[k]) +
+                MUL_F(qmfs->v[0][192 + k], qmf_c[64 + k]) +
+                MUL_F(qmfs->v[0][256 + k], qmf_c[128 + k]) +
+                MUL_F(qmfs->v[0][256 + 192 + k], qmf_c[128 + 64 + k]) +
+                MUL_F(qmfs->v[0][512 + k], qmf_c[256 + k]) +
+                MUL_F(qmfs->v[0][512 + 192 + k], qmf_c[256 + 64 + k]) +
+                MUL_F(qmfs->v[0][768 + k], qmf_c[384 + k]) +
+                MUL_F(qmfs->v[0][768 + 192 + k], qmf_c[384 + 64 + k]) +
+                MUL_F(qmfs->v[0][1024 + k], qmf_c[512 + k]) +
+                MUL_F(qmfs->v[0][1024 + 192 + k], qmf_c[512 + 64 + k]);
 #else
             output[out++] = MUL_F(v0[k], qmf_c[k]) +
                 MUL_F(v0[64 + k], qmf_c[64 + k]) +
@@ -370,6 +385,66 @@
     }
 }
 #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];
+    real_t scale = 1.f/64.f;
+    int16_t n, k, out = 0;
+    uint8_t l;
+
+
+    /* qmf subsample l */
+    for (l = 0; l < sbr->numTimeSlotsRate; l++)
+    {
+        real_t *v0, *v1;
+
+        /* shift buffers */
+        memmove(qmfs->v[0] + 32, qmfs->v[0], (320-32)*sizeof(real_t));
+        memmove(qmfs->v[1] + 32, qmfs->v[1], (320-32)*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] = QMF_RE(X[l][k]) * RE(qmfs->pre_twiddle[k]) - QMF_IM(X[l][k]) * IM(qmfs->pre_twiddle[k]);
+            x2[k] = QMF_IM(X[l][k]) * RE(qmfs->pre_twiddle[k]) + QMF_RE(X[l][k]) * IM(qmfs->pre_twiddle[k]);
+
+            x1[k] *= scale;
+            x2[k] *= scale;
+        }
+
+        /* transform */
+        DCT4_32(x1, x1);
+        DST4_32(x2, x2);
+
+        for (n = 0; n < 32; n++)
+        {
+            v0[n]    = -x1[n] + x2[n];
+            v1[31-n] =  x1[n] + x2[n];
+        }
+
+        /* calculate 32 output samples and window */
+        for (k = 0; k < 32; k++)
+        {
+            output[out++] = MUL_F(v0[k], qmf_c[2*k]) +
+                MUL_F(v0[32 + k], qmf_c[64 + 2*k]) +
+                MUL_F(v0[64 + k], qmf_c[128 + 2*k]) +
+                MUL_F(v0[96 + k], qmf_c[192 + 2*k]) +
+                MUL_F(v0[128 + k], qmf_c[256 + 2*k]) +
+                MUL_F(v0[160 + k], qmf_c[320 + 2*k]) +
+                MUL_F(v0[192 + k], qmf_c[384 + 2*k]) +
+                MUL_F(v0[224 + k], qmf_c[448 + 2*k]) +
+                MUL_F(v0[256 + k], qmf_c[512 + 2*k]) +
+                MUL_F(v0[288 + k], qmf_c[576 + 2*k]);
+        }
+    }
+}
+
 void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
                           real_t *output)
 {
--- a/libfaad/sbr_qmf.h
+++ b/libfaad/sbr_qmf.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_qmf.h,v 1.14 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_qmf.h,v 1.16 2004/03/10 19:45:42 menno Exp $
 **/
 
 #ifndef __SBR_QMF_H__
@@ -39,6 +39,8 @@
 
 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(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
+                          real_t *output);
 void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
                           real_t *output);
 #ifdef USE_SSE
--- a/libfaad/sbr_qmf_c.h
+++ b/libfaad/sbr_qmf_c.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_qmf_c.h,v 1.9 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_qmf_c.h,v 1.13 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_QMF_C_H__
@@ -199,7 +199,7 @@
     FRAC_CONST(0.84803157770763), FRAC_CONST(0.84978051984268),
     FRAC_CONST(0.85119715249343), FRAC_CONST(0.85230470352147),
     FRAC_CONST(0.85310209497017), FRAC_CONST(0.85357205739107),
-    FRAC_CONST(0.85373856005937), FRAC_CONST(0.85357205739107),
+    FRAC_CONST(0.85373856005937 /*max*/), FRAC_CONST(0.85357205739107),
     FRAC_CONST(0.85310209497017), FRAC_CONST(0.85230470352147),
     FRAC_CONST(0.85119715249343), FRAC_CONST(0.84978051984268),
     FRAC_CONST(0.84803157770763), FRAC_CONST(0.84598184698206),
--- a/libfaad/sbr_syntax.c
+++ b/libfaad/sbr_syntax.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_syntax.c,v 1.25 2004/01/29 11:31:11 menno Exp $
+** $Id: sbr_syntax.c,v 1.26 2004/02/26 09:29:28 menno Exp $
 **/
 
 #include "common.h"
@@ -488,7 +488,7 @@
             sbr->bs_extension_id = (uint8_t)faad_getbits(ld, 2
                 DEBUGVAR(1,236,"sbr_channel_pair_element(): bs_extension_id"));
             nr_bits_left -= 2;
-            sbr_extension(ld, sbr, sbr->bs_extension_id, nr_bits_left);
+            nr_bits_left -= sbr_extension(ld, sbr, sbr->bs_extension_id, nr_bits_left);
         }
 
         /* Corrigendum */
@@ -653,6 +653,13 @@
         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;
 }
 
@@ -694,12 +701,20 @@
 #ifdef PS_DEC
     case EXTENSION_ID_PS:
         sbr->ps_used = 1;
-        return ps_data(&(sbr->ps), ld);
+        if (!sbr->ps)
+        {
+            sbr->ps = ps_init();
+        }
+        return ps_data(sbr->ps, ld);
 #endif
 #ifdef DRM_PS
     case DRM_PARAMETRIC_STEREO:
         sbr->ps_used = 1;
-        return drm_ps_data(&(sbr->drm_ps), ld);
+        if (!sbr->drm_ps)
+        {
+            sbr->drm_ps = drm_ps_init();
+        }
+        return drm_ps_data(sbr->drm_ps, ld);
 #endif
     default:
         sbr->bs_extension_data = (uint8_t)faad_getbits(ld, 6
--- a/libfaad/sbr_syntax.h
+++ b/libfaad/sbr_syntax.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_syntax.h,v 1.15 2004/01/10 18:52:47 menno Exp $
+** $Id: sbr_syntax.h,v 1.19 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_SYNTAX_H__
--- a/libfaad/sbr_tf_grid.c
+++ b/libfaad/sbr_tf_grid.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_tf_grid.c,v 1.10 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_tf_grid.c,v 1.12 2004/03/10 19:45:42 menno Exp $
 **/
 
 /* Time/Frequency grid */
--- a/libfaad/sbr_tf_grid.h
+++ b/libfaad/sbr_tf_grid.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sbr_tf_grid.h,v 1.9 2004/01/05 14:05:12 menno Exp $
+** $Id: sbr_tf_grid.h,v 1.13 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_TF_GRID_H__
--- a/libfaad/sine_win.h
+++ b/libfaad/sine_win.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: sine_win.h,v 1.11 2004/01/05 14:05:12 menno Exp $
+** $Id: sine_win.h,v 1.15 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SINE_WIN_H__
--- a/libfaad/specrec.c
+++ b/libfaad/specrec.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: specrec.c,v 1.43 2004/01/29 11:31:11 menno Exp $
+** $Id: specrec.c,v 1.44 2004/02/26 09:29:28 menno Exp $
 **/
 
 /*
@@ -467,6 +467,9 @@
     memcpy(spec_data, tmp_spec, frame_len*sizeof(real_t));
 }
 
+/* iquant() *
+/* output = sign(input)*abs(input)^(4/3) */
+/**/
 static INLINE real_t iquant(int16_t q, const real_t *tab, uint8_t *error)
 {
 #ifdef FIXED_POINT
@@ -554,22 +557,16 @@
 };
 #endif
 
-ALIGN static real_t pow2_table[] =
-{
-#if 0
-    COEF_CONST(0.59460355750136053335874998528024), /* 2^-0.75 */
-    COEF_CONST(0.70710678118654752440084436210485), /* 2^-0.5 */
-    COEF_CONST(0.84089641525371454303112547623321), /* 2^-0.25 */
-#endif
-    COEF_CONST(1.0),
-    COEF_CONST(1.1892071150027210667174999705605), /* 2^0.25 */
-    COEF_CONST(1.4142135623730950488016887242097), /* 2^0.5 */
-    COEF_CONST(1.6817928305074290860622509524664) /* 2^0.75 */
-};
-
 void apply_scalefactors(faacDecHandle hDecoder, ic_stream *ics,
                         real_t *x_invquant, uint16_t frame_len)
 {
+    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 */
+    };
     uint8_t g, sfb;
     uint16_t top;
     int32_t exp, frac;
@@ -597,6 +594,7 @@
             } else {
                 /* ics->scale_factors[g][sfb] must be between 0 and 255 */
                 exp = (ics->scale_factors[g][sfb] /* - 100 */) >> 2;
+                /* frac must always be > 0 */
                 frac = (ics->scale_factors[g][sfb] /* - 100 */) & 3;
             }
 
@@ -637,10 +635,10 @@
                 x_invquant[k+(groups*nshort)+3] = x_invquant[k+(groups*nshort)+3] * pow2sf_tab[exp/*+25*/];
 #endif
 
-                x_invquant[k+(groups*nshort)]   = MUL_C(x_invquant[k+(groups*nshort)],pow2_table[frac /* + 3*/]);
-                x_invquant[k+(groups*nshort)+1] = MUL_C(x_invquant[k+(groups*nshort)+1],pow2_table[frac /* + 3*/]);
-                x_invquant[k+(groups*nshort)+2] = MUL_C(x_invquant[k+(groups*nshort)+2],pow2_table[frac /* + 3*/]);
-                x_invquant[k+(groups*nshort)+3] = MUL_C(x_invquant[k+(groups*nshort)+3],pow2_table[frac /* + 3*/]);
+                x_invquant[k+(groups*nshort)]   = MUL_C(x_invquant[k+(groups*nshort)],pow2_table[frac]);
+                x_invquant[k+(groups*nshort)+1] = MUL_C(x_invquant[k+(groups*nshort)+1],pow2_table[frac]);
+                x_invquant[k+(groups*nshort)+2] = MUL_C(x_invquant[k+(groups*nshort)+2],pow2_table[frac]);
+                x_invquant[k+(groups*nshort)+3] = MUL_C(x_invquant[k+(groups*nshort)+3],pow2_table[frac]);
             }
         }
         groups += ics->window_group_length[g];
@@ -1047,12 +1045,12 @@
         {
 #endif
             retval = sbrDecodeSingleFrame(hDecoder->sbr[ele], hDecoder->time_out[ch],
-                hDecoder->postSeekResetFlag, hDecoder->forceUpSampling);
+                hDecoder->postSeekResetFlag, hDecoder->downSampledSBR);
 #if (defined(PS_DEC) || defined(DRM_PS))
         } else {
             retval = sbrDecodeSingleFramePS(hDecoder->sbr[ele], hDecoder->time_out[ch],
                 hDecoder->time_out[ch+1], hDecoder->postSeekResetFlag,
-                hDecoder->forceUpSampling);
+                hDecoder->downSampledSBR);
         }
 #endif
         if (retval > 0)
@@ -1268,7 +1266,7 @@
 
         retval = sbrDecodeCoupleFrame(hDecoder->sbr[ele],
             hDecoder->time_out[ch0], hDecoder->time_out[ch1],
-            hDecoder->postSeekResetFlag, hDecoder->forceUpSampling);
+            hDecoder->postSeekResetFlag, hDecoder->downSampledSBR);
         if (retval > 0)
             return retval;
     } else if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
--- a/libfaad/specrec.h
+++ b/libfaad/specrec.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: specrec.h,v 1.23 2004/01/05 14:05:12 menno Exp $
+** $Id: specrec.h,v 1.24 2004/02/26 09:29:28 menno Exp $
 **/
 
 #ifndef __SPECREC_H__
--- a/libfaad/ssr.c
+++ b/libfaad/ssr.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: ssr.c,v 1.12 2004/01/05 14:05:12 menno Exp $
+** $Id: ssr.c,v 1.15 2004/09/04 14:56:29 menno Exp $
 **/
 
 #include "common.h"
--- a/libfaad/ssr.h
+++ b/libfaad/ssr.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: ssr.h,v 1.12 2004/01/05 14:05:12 menno Exp $
+** $Id: ssr.h,v 1.15 2004/09/04 14:56:29 menno Exp $
 **/
 
 #ifndef __SSR_H__
--- a/libfaad/ssr_fb.c
+++ b/libfaad/ssr_fb.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: ssr_fb.c,v 1.10 2004/01/05 14:05:12 menno Exp $
+** $Id: ssr_fb.c,v 1.13 2004/09/04 14:56:29 menno Exp $
 **/
 
 #include "common.h"
--- a/libfaad/ssr_ipqf.c
+++ b/libfaad/ssr_ipqf.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: ssr_ipqf.c,v 1.11 2004/01/05 14:05:12 menno Exp $
+** $Id: ssr_ipqf.c,v 1.14 2004/09/04 14:56:29 menno Exp $
 **/
 
 #include "common.h"
--- a/libfaad/structs.h
+++ b/libfaad/structs.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: structs.h,v 1.31 2004/01/29 11:31:11 menno Exp $
+** $Id: structs.h,v 1.32 2004/02/26 09:29:28 menno Exp $
 **/
 
 #ifndef __STRUCTS_H__
@@ -324,6 +324,7 @@
 
     int8_t sbr_present_flag;
     int8_t forceUpSampling;
+    int8_t downSampledSBR;
 } mp4AudioSpecificConfig;
 
 typedef struct faacDecConfiguration
@@ -415,6 +416,7 @@
 #ifdef SBR_DEC
     int8_t sbr_present_flag;
     int8_t forceUpSampling;
+    int8_t downSampledSBR;
     /* determines whether SBR data is allocated for the gives element */
     uint8_t sbr_alloced[MAX_SYNTAX_ELEMENTS];
 
--- a/libfaad/syntax.c
+++ b/libfaad/syntax.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: syntax.c,v 1.71 2004/02/04 19:55:03 menno Exp $
+** $Id: syntax.c,v 1.72 2004/02/26 09:29:28 menno Exp $
 **/
 
 /*
@@ -997,6 +997,14 @@
 
             /* 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", faacDecGetErrorMessage(hDecoder->sbr[sbr_ele]->ret));
+            }
+#endif
+
 #if (defined(PS_DEC) || defined(DRM_PS))
             if (hDecoder->sbr[sbr_ele]->ps_used)
             {
--- a/libfaad/syntax.h
+++ b/libfaad/syntax.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: syntax.h,v 1.48 2004/01/29 11:31:11 menno Exp $
+** $Id: syntax.h,v 1.49 2004/02/26 09:29:28 menno Exp $
 **/
 
 #ifndef __SYNTAX_H__
--- a/libfaad/tns.c
+++ b/libfaad/tns.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: tns.c,v 1.29 2004/01/05 14:05:12 menno Exp $
+** $Id: tns.c,v 1.30 2004/02/26 09:29:28 menno Exp $
 **/
 
 #include "common.h"
--- a/libfaad/tns.h
+++ b/libfaad/tns.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: tns.h,v 1.16 2004/01/05 14:05:12 menno Exp $
+** $Id: tns.h,v 1.19 2004/09/04 14:56:29 menno Exp $
 **/
 
 #ifndef __TNS_H__