shithub: aacdec

Download patch

ref: 52186c2ec7365c630bd5362fdc6d40e8e491189f
parent: 1f051ca7ef55783d09c16c012334a52897d855c3
author: menno <menno>
date: Wed Mar 10 14:45:42 EST 2004

Fixed point SBR
initial PS version

--- a/include/neaacdec.h
+++ b/include/neaacdec.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: neaacdec.h,v 1.1 2004/03/04 19:06:01 menno Exp $
+** $Id: neaacdec.h,v 1.2 2004/03/10 19:45:40 menno Exp $
 **/
 
 #ifndef __NEAACDEC_H__
--- a/libfaad/common.h
+++ b/libfaad/common.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: common.h,v 1.52 2004/03/04 19:06:01 menno Exp $
+** $Id: common.h,v 1.53 2004/03/10 19:45:40 menno Exp $
 **/
 
 #ifndef __COMMON_H__
@@ -101,7 +101,7 @@
 
 #define SBR_DEC
 //#define SBR_LOW_POWER
-//#define PS_DEC
+#define PS_DEC
 
 /* FIXED POINT: No MAIN decoding, forced SBR Low Power decoder */
 #ifdef FIXED_POINT
@@ -108,8 +108,8 @@
 # ifdef MAIN_DEC
 #  undef MAIN_DEC
 # endif
-# ifdef SBR_DEC
-#  undef SBR_DEC
+# ifdef PS_DEC
+#  undef PS_DEC
 # endif
 #endif // FIXED_POINT
 
--- 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.98 2004/03/04 19:06:01 menno Exp $
+** $Id: decoder.c,v 1.99 2004/03/10 19:45:40 menno Exp $
 **/
 
 #include "common.h"
@@ -843,6 +843,17 @@
     } else {
         output_channels = channels;
     }
+
+#if (defined(PS_DEC) || defined(DRM_PS))
+    hDecoder->upMatrix = 0;
+    /* check if we have a mono file */
+    if (output_channels == 1)
+    {
+        /* upMatrix to 2 channels for implicit signalling of PS */
+        hDecoder->upMatrix = 1;
+        output_channels = 2;
+    }
+#endif
 
     /* Make a channel configuration based on either a PCE or a channelConfiguration */
     create_channel_config(hDecoder, hInfo);
--- 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.19 2004/02/26 09:29:26 menno Exp $
+** $Id: fixed.h,v 1.21 2004/03/19 10:37:55 menno Exp $
 **/
 
 #ifndef __FIXED_H__
@@ -80,6 +80,33 @@
     }
 }
 
+static INLINE real_t MUL_Q2(real_t A, real_t B)
+{
+    _asm {
+        mov eax,A
+        imul B
+        shrd eax,edx,Q2_BITS
+    }
+}
+
+static INLINE real_t MUL_SHIFT6(real_t A, real_t B)
+{
+    _asm {
+        mov eax,A
+        imul B
+        shrd eax,edx,6
+    }
+}
+
+static INLINE real_t MUL_SHIFT23(real_t A, real_t B)
+{
+    _asm {
+        mov eax,A
+        imul B
+        shrd eax,edx,23
+    }
+}
+
 static INLINE real_t _MulHigh(real_t A, real_t B)
 {
     _asm {
@@ -131,6 +158,21 @@
     return arm_mul(A, B, COEF_BITS);
 }
 
+static INLINE real_t MUL_Q2(real_t A, real_t B)
+{
+    return arm_mul(A, B, Q2_BITS);
+}
+
+static INLINE real_t MUL_SHIFT6(real_t A, real_t B)
+{
+    return arm_mul(A, B, 6);
+}
+
+static INLINE real_t MUL_SHIFT23(real_t A, real_t B)
+{
+    return arm_mul(A, B, 23);
+}
+
 static INLINE real_t _MulHigh(real_t x, real_t y)
 {
     uint32_t __lo;
@@ -181,6 +223,9 @@
       return _MulHigh(A,B) << (32-FRAC_BITS);
   }
 #endif
+  #define MUL_Q2(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (Q2_BITS-1))) >> Q2_BITS)
+  #define MUL_SHIFT6(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (6-1))) >> 6)
+  #define MUL_SHIFT23(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (23-1))) >> 23)
 
 /* Complex multiplication */
 static INLINE void ComplexMult(real_t *y1, real_t *y2,
--- a/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.19 2004/02/26 09:29:27 menno Exp $
+** $Id: huffman.c,v 1.20 2004/03/10 19:45:41 menno Exp $
 **/
 
 #include "common.h"
@@ -120,8 +120,8 @@
 static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp)
 {
     uint8_t neg, i;
-    int32_t j;
-	int32_t off;
+    int16_t j;
+	int16_t off;
 
     if (sp < 0)
     {
@@ -143,7 +143,7 @@
         }
     }
 
-    off = faad_getbits(ld, i
+    off = (int16_t)faad_getbits(ld, i
         DEBUGVAR(1,9,"huffman_getescape(): escape"));
 
     j = off | (1<<i);
--- a/libfaad/output.c
+++ b/libfaad/output.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: output.c,v 1.36 2004/03/02 20:09:58 menno Exp $
+** $Id: output.c,v 1.37 2004/03/10 19:45:41 menno Exp $
 **/
 
 #include "common.h"
@@ -105,18 +105,32 @@
         }
         break;
     case CONV(2,0):
-        ch  = hDecoder->internal_channel[0];
-        ch1 = hDecoder->internal_channel[1];
-        for(i = 0; i < frame_len; i++)
+        if (hDecoder->upMatrix)
         {
-            real_t inp0 = input[ch ][i];
-            real_t inp1 = input[ch1][i];
+            ch  = hDecoder->internal_channel[0];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch][i];
 
-            CLIP(inp0, 32767.0f, -32768.0f);
-            CLIP(inp1, 32767.0f, -32768.0f);
+                CLIP(inp0, 32767.0f, -32768.0f);
 
-            (*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0);
-            (*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp1);
+                (*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp0);
+            }
+        } else {
+            ch  = hDecoder->internal_channel[0];
+            ch1 = hDecoder->internal_channel[1];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch ][i];
+                real_t inp1 = input[ch1][i];
+
+                CLIP(inp0, 32767.0f, -32768.0f);
+                CLIP(inp1, 32767.0f, -32768.0f);
+
+                (*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp1);
+            }
         }
         break;
     default:
@@ -157,20 +171,35 @@
         }
         break;
     case CONV(2,0):
-        ch  = hDecoder->internal_channel[0];
-        ch1 = hDecoder->internal_channel[1];
-        for(i = 0; i < frame_len; i++)
+        if (hDecoder->upMatrix)
         {
-            real_t inp0 = input[ch ][i];
-            real_t inp1 = input[ch1][i];
+            ch = hDecoder->internal_channel[0];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch][i];
 
-            inp0 *= 256.0f;
-            inp1 *= 256.0f;
-            CLIP(inp0, 8388607.0f, -8388608.0f);
-            CLIP(inp1, 8388607.0f, -8388608.0f);
+                inp0 *= 256.0f;
+                CLIP(inp0, 8388607.0f, -8388608.0f);
 
-            (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
-            (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1);
+                (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0);
+            }
+        } else {
+            ch  = hDecoder->internal_channel[0];
+            ch1 = hDecoder->internal_channel[1];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch ][i];
+                real_t inp1 = input[ch1][i];
+
+                inp0 *= 256.0f;
+                inp1 *= 256.0f;
+                CLIP(inp0, 8388607.0f, -8388608.0f);
+                CLIP(inp1, 8388607.0f, -8388608.0f);
+
+                (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1);
+            }
         }
         break;
     default:
@@ -212,20 +241,35 @@
         }
         break;
     case CONV(2,0):
-        ch  = hDecoder->internal_channel[0];
-        ch1 = hDecoder->internal_channel[1];
-        for(i = 0; i < frame_len; i++)
+        if (hDecoder->upMatrix)
         {
-            real_t inp0 = input[ch ][i];
-            real_t inp1 = input[ch1][i];
+            ch = hDecoder->internal_channel[0];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch][i];
 
-            inp0 *= 65536.0f;
-            inp1 *= 65536.0f;
-            CLIP(inp0, 2147483647.0f, -2147483648.0f);
-            CLIP(inp1, 2147483647.0f, -2147483648.0f);
+                inp0 *= 65536.0f;
+                CLIP(inp0, 2147483647.0f, -2147483648.0f);
 
-            (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
-            (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1);
+                (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0);
+            }
+        } else {
+            ch  = hDecoder->internal_channel[0];
+            ch1 = hDecoder->internal_channel[1];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch ][i];
+                real_t inp1 = input[ch1][i];
+
+                inp0 *= 65536.0f;
+                inp1 *= 65536.0f;
+                CLIP(inp0, 2147483647.0f, -2147483648.0f);
+                CLIP(inp1, 2147483647.0f, -2147483648.0f);
+
+                (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
+                (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1);
+            }
         }
         break;
     default:
@@ -263,14 +307,25 @@
         }
         break;
     case CONV(2,0):
-        ch  = hDecoder->internal_channel[0];
-        ch1 = hDecoder->internal_channel[1];
-        for(i = 0; i < frame_len; i++)
+        if (hDecoder->upMatrix)
         {
-            real_t inp0 = input[ch ][i];
-            real_t inp1 = input[ch1][i];
-            (*sample_buffer)[(i*2)+0] = inp0*FLOAT_SCALE;
-            (*sample_buffer)[(i*2)+1] = inp1*FLOAT_SCALE;
+            ch = hDecoder->internal_channel[0];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch][i];
+                (*sample_buffer)[(i*2)+0] = inp0*FLOAT_SCALE;
+                (*sample_buffer)[(i*2)+1] = inp0*FLOAT_SCALE;
+            }
+        } else {
+            ch  = hDecoder->internal_channel[0];
+            ch1 = hDecoder->internal_channel[1];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch ][i];
+                real_t inp1 = input[ch1][i];
+                (*sample_buffer)[(i*2)+0] = inp0*FLOAT_SCALE;
+                (*sample_buffer)[(i*2)+1] = inp1*FLOAT_SCALE;
+            }
         }
         break;
     default:
@@ -304,14 +359,25 @@
         }
         break;
     case CONV(2,0):
-        ch  = hDecoder->internal_channel[0];
-        ch1 = hDecoder->internal_channel[1];
-        for(i = 0; i < frame_len; i++)
+        if (hDecoder->upMatrix)
         {
-            real_t inp0 = input[ch ][i];
-            real_t inp1 = input[ch1][i];
-            (*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE;
-            (*sample_buffer)[(i*2)+1] = (double)inp1*FLOAT_SCALE;
+            ch = hDecoder->internal_channel[0];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch][i];
+                (*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE;
+                (*sample_buffer)[(i*2)+1] = (double)inp0*FLOAT_SCALE;
+            }
+        } else {
+            ch  = hDecoder->internal_channel[0];
+            ch1 = hDecoder->internal_channel[1];
+            for(i = 0; i < frame_len; i++)
+            {
+                real_t inp0 = input[ch ][i];
+                real_t inp1 = input[ch1][i];
+                (*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE;
+                (*sample_buffer)[(i*2)+1] = (double)inp1*FLOAT_SCALE;
+            }
         }
         break;
     default:
@@ -374,8 +440,12 @@
 #define RSQRT2 FRAC_CONST(0.7071067811865475244) // 1/sqrt(2)
 
 static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample,
-                                uint8_t down_matrix, uint8_t *internal_channel)
+                                uint8_t down_matrix, uint8_t down_matrix,
+                                uint8_t *internal_channel)
 {
+    if (up_matrix == 1)
+        return  input[internal_channel[0]][sample];
+
     if (!down_matrix)
         return input[internal_channel[channel]][sample];
 
@@ -410,8 +480,8 @@
         case FAAD_FMT_16BIT:
             for(i = 0; i < frame_len; i++)
             {
-                //int32_t tmp = input[ch][i];
-                int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
+                int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
+                    hDecoder->internal_channel);
                 if (tmp >= 0)
                 {
                     tmp += (1 << (REAL_BITS-1));
@@ -433,8 +503,8 @@
         case FAAD_FMT_24BIT:
             for(i = 0; i < frame_len; i++)
             {
-                //int32_t tmp = input[ch][i];
-                int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
+                int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
+                    hDecoder->internal_channel);
                 if (tmp >= 0)
                 {
                     tmp += (1 << (REAL_BITS-9));
@@ -457,8 +527,8 @@
         case FAAD_FMT_32BIT:
             for(i = 0; i < frame_len; i++)
             {
-                //int32_t tmp = input[ch][i];
-                int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
+                int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
+                    hDecoder->internal_channel);
                 if (tmp >= 0)
                 {
                     tmp += (1 << (16-REAL_BITS-1));
--- 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.11 2004/02/26 09:29:27 menno Exp $
+** $Id: sbr_dct.c,v 1.12 2004/03/10 19:45:41 menno Exp $
 **/
 
 #include "common.h"
@@ -39,407 +39,76 @@
 
 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;
+    real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
+    real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20;
+    real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30;
+    real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40;
+    real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50;
+    real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60;
+    real_t f61, f62, f63, f64, f65, f66, f67, f68, f69, f70;
+    real_t f71, f72, f73, f74, f75, f76, f77, f78, f79, f80;
+    real_t f81, f82, f83, f84, f85, f86, f87, f88, f89, f90;
+    real_t f91, f92, f93, f94, f95, f96, f97, f98, f99, f100;
+    real_t f101, f102, f103, f104, f105, f106, f107, f108, f109, f110;
+    real_t f111, f112, f113, f114, f115, f116, f117, f118, f119, f120;
+    real_t f121, f122, f123, f124, f125, f126, f127, f128, f129, f130;
+    real_t f131, f132, f133, f134, f135, f136, f137, f138, f139, f140;
+    real_t f141, f142, f143, f144, f145, f146, f147, f148, f149, f150;
+    real_t f151, f152, f153, f154, f155, f156, f157, f158, f159, f160;
+    real_t f161, f162, f163, f164, f165, f166, f167, f168, f169, f170;
+    real_t f171, f172, f173, f174, f175, f176, f177, f178, f179, f180;
+    real_t f181, f182, f183, f184, f185, f186, f187, f188, f189, f190;
+    real_t f191, f192, f193, f194, f195, f196, f197, f198, f199, f200;
+    real_t f201, f202, f203, f204, f205, f206, f207, f208, f209, f210;
+    real_t f211, f212, f213, f214, f215, f216, f217, f218, f219, f220;
+    real_t f221, f222, f223, f224, f225, f226, f227, f228, f229, f230;
+    real_t f231, f232, f233, f234, f235, f236, f237, f238, f239, f240;
+    real_t f241, f242, f243, f244, f245, f246, f247, f248, f249, f250;
+    real_t f251, f252, f253, f254, f255, f256, f257, f258, f259, f260;
+    real_t f261, f262, f263, f264, f265, f266, f267, f268, f269, f270;
+    real_t f271, f272, f273, f274, f275, f276, f277, f278, f279, f280;
+    real_t f281, f282, f283, f284, f285, f286, f287, f288, f289, f290;
+    real_t f291, f292, f293, f294, f295, f296, f297, f298, f299, f300;
+    real_t f301, f302, f303, f304, f305, f306, f307, f310, f311, f312;
+    real_t f313, f316, f317, f318, f319, f322, f323, f324, f325, f328;
+    real_t f329, f330, f331, f334, f335, f336, f337, f340, f341, f342;
+    real_t f343, f346, f347, f348, f349, f352, f353, f354, f355, f358;
+    real_t f359, f360, f361, f364, f365, f366, f367, f370, f371, f372;
+    real_t f373, f376, f377, f378, f379, f382, f383, f384, f385, f388;
+    real_t f389, f390, f391, f394, f395, f396, f397;
 
     f0 = x[15] - x[16];
     f1 = x[15] + x[16];
-    f2 = 0.7071067811865476 * f1;
-    f3 = 0.7071067811865476 * f0;
+    f2 = MUL_F(FRAC_CONST(0.7071067811865476), f1);
+    f3 = MUL_F(FRAC_CONST(0.7071067811865476), f0);
     f4 = x[8] - x[23];
     f5 = x[8] + x[23];
-    f6 = 0.7071067811865476 * f5;
-    f7 = 0.7071067811865476 * f4;
+    f6 = MUL_F(FRAC_CONST(0.7071067811865476), f5);
+    f7 = MUL_F(FRAC_CONST(0.7071067811865476), f4);
     f8 = x[12] - x[19];
     f9 = x[12] + x[19];
-    f10 = 0.7071067811865476 * f9;
-    f11 = 0.7071067811865476 * f8;
+    f10 = MUL_F(FRAC_CONST(0.7071067811865476), f9);
+    f11 = MUL_F(FRAC_CONST(0.7071067811865476), f8);
     f12 = x[11] - x[20];
     f13 = x[11] + x[20];
-    f14 = 0.7071067811865476 * f13;
-    f15 = 0.7071067811865476 * f12;
+    f14 = MUL_F(FRAC_CONST(0.7071067811865476), f13);
+    f15 = MUL_F(FRAC_CONST(0.7071067811865476), f12);
     f16 = x[14] - x[17];
     f17 = x[14] + x[17];
-    f18 = 0.7071067811865476 * f17;
-    f19 = 0.7071067811865476 * f16;
+    f18 = MUL_F(FRAC_CONST(0.7071067811865476), f17);
+    f19 = MUL_F(FRAC_CONST(0.7071067811865476), f16);
     f20 = x[9] - x[22];
     f21 = x[9] + x[22];
-    f22 = 0.7071067811865476 * f21;
-    f23 = 0.7071067811865476 * f20;
+    f22 = MUL_F(FRAC_CONST(0.7071067811865476), f21);
+    f23 = MUL_F(FRAC_CONST(0.7071067811865476), f20);
     f24 = x[13] - x[18];
     f25 = x[13] + x[18];
-    f26 = 0.7071067811865476 * f25;
-    f27 = 0.7071067811865476 * f24;
+    f26 = MUL_F(FRAC_CONST(0.7071067811865476), f25);
+    f27 = MUL_F(FRAC_CONST(0.7071067811865476), f24);
     f28 = x[10] - x[21];
     f29 = x[10] + x[21];
-    f30 = 0.7071067811865476 * f29;
-    f31 = 0.7071067811865476 * f28;
+    f30 = MUL_F(FRAC_CONST(0.7071067811865476), f29);
+    f31 = MUL_F(FRAC_CONST(0.7071067811865476), f28);
     f32 = x[0] - f2;
     f33 = x[0] + f2;
     f34 = x[31] - f3;
@@ -473,51 +142,51 @@
     f62 = x[26] - f31;
     f63 = x[26] + f31;
     f64 = f39 + f37;
-    f65 = (-0.5411961001461969) * f39;
-    f66 = 0.9238795325112867 * f64;
-    f67 = 1.3065629648763766 * f37;
+    f65 = MUL_F(FRAC_CONST(-0.5411961001461969), f39);
+    f66 = MUL_F(FRAC_CONST(0.9238795325112867), f64);
+    f67 = MUL_C(COEF_CONST(1.3065629648763766), f37);
     f68 = f65 + f66;
     f69 = f67 - f66;
     f70 = f38 + f36;
-    f71 = 1.3065629648763770 * f38;
-    f72 = (-0.3826834323650904) * f70;
-    f73 = 0.5411961001461961 * f36;
+    f71 = MUL_C(COEF_CONST(1.3065629648763770), f38);
+    f72 = MUL_F(FRAC_CONST(-0.3826834323650904), f70);
+    f73 = MUL_F(FRAC_CONST(0.5411961001461961), f36);
     f74 = f71 + f72;
     f75 = f73 - f72;
     f76 = f47 + f45;
-    f77 = (-0.5411961001461969) * f47;
-    f78 = 0.9238795325112867 * f76;
-    f79 = 1.3065629648763766 * f45;
+    f77 = MUL_F(FRAC_CONST(-0.5411961001461969), f47);
+    f78 = MUL_F(FRAC_CONST(0.9238795325112867), f76);
+    f79 = MUL_C(COEF_CONST(1.3065629648763766), f45);
     f80 = f77 + f78;
     f81 = f79 - f78;
     f82 = f46 + f44;
-    f83 = 1.3065629648763770 * f46;
-    f84 = (-0.3826834323650904) * f82;
-    f85 = 0.5411961001461961 * f44;
+    f83 = MUL_C(COEF_CONST(1.3065629648763770), f46);
+    f84 = MUL_F(FRAC_CONST(-0.3826834323650904), f82);
+    f85 = MUL_F(FRAC_CONST(0.5411961001461961), f44);
     f86 = f83 + f84;
     f87 = f85 - f84;
     f88 = f55 + f53;
-    f89 = (-0.5411961001461969) * f55;
-    f90 = 0.9238795325112867 * f88;
-    f91 = 1.3065629648763766 * f53;
+    f89 = MUL_F(FRAC_CONST(-0.5411961001461969), f55);
+    f90 = MUL_F(FRAC_CONST(0.9238795325112867), f88);
+    f91 = MUL_C(COEF_CONST(1.3065629648763766), f53);
     f92 = f89 + f90;
     f93 = f91 - f90;
     f94 = f54 + f52;
-    f95 = 1.3065629648763770 * f54;
-    f96 = (-0.3826834323650904) * f94;
-    f97 = 0.5411961001461961 * f52;
+    f95 = MUL_C(COEF_CONST(1.3065629648763770), f54);
+    f96 = MUL_F(FRAC_CONST(-0.3826834323650904), f94);
+    f97 = MUL_F(FRAC_CONST(0.5411961001461961), f52);
     f98 = f95 + f96;
     f99 = f97 - f96;
     f100 = f63 + f61;
-    f101 = (-0.5411961001461969) * f63;
-    f102 = 0.9238795325112867 * f100;
-    f103 = 1.3065629648763766 * f61;
+    f101 = MUL_F(FRAC_CONST(-0.5411961001461969), f63);
+    f102 = MUL_F(FRAC_CONST(0.9238795325112867), f100);
+    f103 = MUL_C(COEF_CONST(1.3065629648763766), f61);
     f104 = f101 + f102;
     f105 = f103 - f102;
     f106 = f62 + f60;
-    f107 = 1.3065629648763770 * f62;
-    f108 = (-0.3826834323650904) * f106;
-    f109 = 0.5411961001461961 * f60;
+    f107 = MUL_C(COEF_CONST(1.3065629648763770), f62);
+    f108 = MUL_F(FRAC_CONST(-0.3826834323650904), f106);
+    f109 = MUL_F(FRAC_CONST(0.5411961001461961), f60);
     f110 = f107 + f108;
     f111 = f109 - f108;
     f112 = f33 - f68;
@@ -553,51 +222,51 @@
     f142 = f58 - f111;
     f143 = f58 + f111;
     f144 = f123 + f121;
-    f145 = (-0.7856949583871021) * f123;
-    f146 = 0.9807852804032304 * f144;
-    f147 = 1.1758756024193588 * f121;
+    f145 = MUL_F(FRAC_CONST(-0.7856949583871021), f123);
+    f146 = MUL_F(FRAC_CONST(0.9807852804032304), f144);
+    f147 = MUL_C(COEF_CONST(1.1758756024193588), f121);
     f148 = f145 + f146;
     f149 = f147 - f146;
     f150 = f127 + f125;
-    f151 = 0.2758993792829431 * f127;
-    f152 = 0.5555702330196022 * f150;
-    f153 = 1.3870398453221475 * f125;
+    f151 = MUL_F(FRAC_CONST(0.2758993792829431), f127);
+    f152 = MUL_F(FRAC_CONST(0.5555702330196022), f150);
+    f153 = MUL_C(COEF_CONST(1.3870398453221475), f125);
     f154 = f151 + f152;
     f155 = f153 - f152;
     f156 = f122 + f120;
-    f157 = 1.1758756024193591 * f122;
-    f158 = (-0.1950903220161287) * f156;
-    f159 = 0.7856949583871016 * f120;
+    f157 = MUL_C(COEF_CONST(1.1758756024193591), f122);
+    f158 = MUL_F(FRAC_CONST(-0.1950903220161287), f156);
+    f159 = MUL_F(FRAC_CONST(0.7856949583871016), f120);
     f160 = f157 + f158;
     f161 = f159 - f158;
     f162 = f126 + f124;
-    f163 = 1.3870398453221473 * f126;
-    f164 = (-0.8314696123025455) * f162;
-    f165 = (-0.2758993792829436) * f124;
+    f163 = MUL_C(COEF_CONST(1.3870398453221473), f126);
+    f164 = MUL_F(FRAC_CONST(-0.8314696123025455), f162);
+    f165 = MUL_F(FRAC_CONST(-0.2758993792829436), f124);
     f166 = f163 + f164;
     f167 = f165 - f164;
     f168 = f139 + f137;
-    f169 = (-0.7856949583871021) * f139;
-    f170 = 0.9807852804032304 * f168;
-    f171 = 1.1758756024193588 * f137;
+    f169 = MUL_F(FRAC_CONST(-0.7856949583871021), f139);
+    f170 = MUL_F(FRAC_CONST(0.9807852804032304), f168);
+    f171 = MUL_C(COEF_CONST(1.1758756024193588), f137);
     f172 = f169 + f170;
     f173 = f171 - f170;
     f174 = f143 + f141;
-    f175 = 0.2758993792829431 * f143;
-    f176 = 0.5555702330196022 * f174;
-    f177 = 1.3870398453221475 * f141;
+    f175 = MUL_F(FRAC_CONST(0.2758993792829431), f143);
+    f176 = MUL_F(FRAC_CONST(0.5555702330196022), f174);
+    f177 = MUL_C(COEF_CONST(1.3870398453221475), f141);
     f178 = f175 + f176;
     f179 = f177 - f176;
     f180 = f138 + f136;
-    f181 = 1.1758756024193591 * f138;
-    f182 = (-0.1950903220161287) * f180;
-    f183 = 0.7856949583871016 * f136;
+    f181 = MUL_C(COEF_CONST(1.1758756024193591), f138);
+    f182 = MUL_F(FRAC_CONST(-0.1950903220161287), f180);
+    f183 = MUL_F(FRAC_CONST(0.7856949583871016), f136);
     f184 = f181 + f182;
     f185 = f183 - f182;
     f186 = f142 + f140;
-    f187 = 1.3870398453221473 * f142;
-    f188 = (-0.8314696123025455) * f186;
-    f189 = (-0.2758993792829436) * f140;
+    f187 = MUL_C(COEF_CONST(1.3870398453221473), f142);
+    f188 = MUL_F(FRAC_CONST(-0.8314696123025455), f186);
+    f189 = MUL_F(FRAC_CONST(-0.2758993792829436), f140);
     f190 = f187 + f188;
     f191 = f189 - f188;
     f192 = f113 - f148;
@@ -633,51 +302,51 @@
     f222 = f134 - f191;
     f223 = f134 + f191;
     f224 = f211 + f209;
-    f225 = (-0.8971675863426361) * f211;
-    f226 = 0.9951847266721968 * f224;
-    f227 = 1.0932018670017576 * f209;
+    f225 = MUL_F(FRAC_CONST(-0.8971675863426361), f211);
+    f226 = MUL_F(FRAC_CONST(0.9951847266721968), f224);
+    f227 = MUL_C(COEF_CONST(1.0932018670017576), f209);
     f228 = f225 + f226;
     f229 = f227 - f226;
     f230 = f215 + f213;
-    f231 = (-0.4105245275223571) * f215;
-    f232 = 0.8819212643483549 * f230;
-    f233 = 1.3533180011743529 * f213;
+    f231 = MUL_F(FRAC_CONST(-0.4105245275223571), f215);
+    f232 = MUL_F(FRAC_CONST(0.8819212643483549), f230);
+    f233 = MUL_C(COEF_CONST(1.3533180011743529), f213);
     f234 = f231 + f232;
     f235 = f233 - f232;
     f236 = f219 + f217;
-    f237 = 0.1386171691990915 * f219;
-    f238 = 0.6343932841636455 * f236;
-    f239 = 1.4074037375263826 * f217;
+    f237 = MUL_F(FRAC_CONST(0.1386171691990915), f219);
+    f238 = MUL_F(FRAC_CONST(0.6343932841636455), f236);
+    f239 = MUL_C(COEF_CONST(1.4074037375263826), f217);
     f240 = f237 + f238;
     f241 = f239 - f238;
     f242 = f223 + f221;
-    f243 = 0.6666556584777466 * f223;
-    f244 = 0.2902846772544623 * f242;
-    f245 = 1.2472250129866711 * f221;
+    f243 = MUL_F(FRAC_CONST(0.6666556584777466), f223);
+    f244 = MUL_F(FRAC_CONST(0.2902846772544623), f242);
+    f245 = MUL_C(COEF_CONST(1.2472250129866711), f221);
     f246 = f243 + f244;
     f247 = f245 - f244;
     f248 = f210 + f208;
-    f249 = 1.0932018670017574 * f210;
-    f250 = (-0.0980171403295605) * f248;
-    f251 = 0.8971675863426364 * f208;
+    f249 = MUL_C(COEF_CONST(1.0932018670017574), f210);
+    f250 = MUL_F(FRAC_CONST(-0.0980171403295605), f248);
+    f251 = MUL_F(FRAC_CONST(0.8971675863426364), f208);
     f252 = f249 + f250;
     f253 = f251 - f250;
     f254 = f214 + f212;
-    f255 = 1.3533180011743529 * f214;
-    f256 = (-0.4713967368259979) * f254;
-    f257 = 0.4105245275223569 * f212;
+    f255 = MUL_C(COEF_CONST(1.3533180011743529), f214);
+    f256 = MUL_F(FRAC_CONST(-0.4713967368259979), f254);
+    f257 = MUL_F(FRAC_CONST(0.4105245275223569), f212);
     f258 = f255 + f256;
     f259 = f257 - f256;
     f260 = f218 + f216;
-    f261 = 1.4074037375263826 * f218;
-    f262 = (-0.7730104533627369) * f260;
-    f263 = (-0.1386171691990913) * f216;
+    f261 = MUL_C(COEF_CONST(1.4074037375263826), f218);
+    f262 = MUL_F(FRAC_CONST(-0.7730104533627369), f260);
+    f263 = MUL_F(FRAC_CONST(-0.1386171691990913), f216);
     f264 = f261 + f262;
     f265 = f263 - f262;
     f266 = f222 + f220;
-    f267 = 1.2472250129866711 * f222;
-    f268 = (-0.9569403357322089) * f266;
-    f269 = (-0.6666556584777469) * f220;
+    f267 = MUL_C(COEF_CONST(1.2472250129866711), f222);
+    f268 = MUL_F(FRAC_CONST(-0.9569403357322089), f266);
+    f269 = MUL_F(FRAC_CONST(-0.6666556584777469), f220);
     f270 = f267 + f268;
     f271 = f269 - f268;
     f272 = f193 - f228;
@@ -713,99 +382,99 @@
     f302 = f206 - f271;
     f303 = f206 + f271;
     f304 = f275 + f273;
-    f305 = (-0.9751575901732920) * f275;
-    f306 = 0.9996988186962043 * f304;
-    f307 = 1.0242400472191164 * f273;
+    f305 = MUL_F(FRAC_CONST(-0.9751575901732920), f275);
+    f306 = MUL_F(FRAC_CONST(0.9996988186962043), f304);
+    f307 = MUL_C(COEF_CONST(1.0242400472191164), f273);
     y[0] = f305 + f306;
     y[31] = f307 - f306;
     f310 = f279 + f277;
-    f311 = (-0.8700688593994936) * f279;
-    f312 = 0.9924795345987100 * f310;
-    f313 = 1.1148902097979263 * f277;
+    f311 = MUL_F(FRAC_CONST(-0.8700688593994936), f279);
+    f312 = MUL_F(FRAC_CONST(0.9924795345987100), f310);
+    f313 = MUL_C(COEF_CONST(1.1148902097979263), f277);
     y[2] = f311 + f312;
     y[29] = f313 - f312;
     f316 = f283 + f281;
-    f317 = (-0.7566008898816587) * f283;
-    f318 = 0.9757021300385286 * f316;
-    f319 = 1.1948033701953984 * f281;
+    f317 = MUL_F(FRAC_CONST(-0.7566008898816587), f283);
+    f318 = MUL_F(FRAC_CONST(0.9757021300385286), f316);
+    f319 = MUL_C(COEF_CONST(1.1948033701953984), f281);
     y[4] = f317 + f318;
     y[27] = f319 - f318;
     f322 = f287 + f285;
-    f323 = (-0.6358464401941451) * f287;
-    f324 = 0.9495281805930367 * f322;
-    f325 = 1.2632099209919283 * f285;
+    f323 = MUL_F(FRAC_CONST(-0.6358464401941451), f287);
+    f324 = MUL_F(FRAC_CONST(0.9495281805930367), f322);
+    f325 = MUL_C(COEF_CONST(1.2632099209919283), f285);
     y[6] = f323 + f324;
     y[25] = f325 - f324;
     f328 = f291 + f289;
-    f329 = (-0.5089684416985408) * f291;
-    f330 = 0.9142097557035307 * f328;
-    f331 = 1.3194510697085207 * f289;
+    f329 = MUL_F(FRAC_CONST(-0.5089684416985408), f291);
+    f330 = MUL_F(FRAC_CONST(0.9142097557035307), f328);
+    f331 = MUL_C(COEF_CONST(1.3194510697085207), f289);
     y[8] = f329 + f330;
     y[23] = f331 - f330;
     f334 = f295 + f293;
-    f335 = (-0.3771887988789273) * f295;
-    f336 = 0.8700869911087114 * f334;
-    f337 = 1.3629851833384954 * f293;
+    f335 = MUL_F(FRAC_CONST(-0.3771887988789273), f295);
+    f336 = MUL_F(FRAC_CONST(0.8700869911087114), f334);
+    f337 = MUL_C(COEF_CONST(1.3629851833384954), f293);
     y[10] = f335 + f336;
     y[21] = f337 - f336;
     f340 = f299 + f297;
-    f341 = (-0.2417766217337384) * f299;
-    f342 = 0.8175848131515837 * f340;
-    f343 = 1.3933930045694289 * f297;
+    f341 = MUL_F(FRAC_CONST(-0.2417766217337384), f299);
+    f342 = MUL_F(FRAC_CONST(0.8175848131515837), f340);
+    f343 = MUL_C(COEF_CONST(1.3933930045694289), f297);
     y[12] = f341 + f342;
     y[19] = f343 - f342;
     f346 = f303 + f301;
-    f347 = (-0.1040360035527077) * f303;
-    f348 = 0.7572088465064845 * f346;
-    f349 = 1.4103816894602612 * f301;
+    f347 = MUL_F(FRAC_CONST(-0.1040360035527077), f303);
+    f348 = MUL_F(FRAC_CONST(0.7572088465064845), f346);
+    f349 = MUL_C(COEF_CONST(1.4103816894602612), f301);
     y[14] = f347 + f348;
     y[17] = f349 - f348;
     f352 = f274 + f272;
-    f353 = 0.0347065382144002 * f274;
-    f354 = 0.6895405447370668 * f352;
-    f355 = 1.4137876276885337 * f272;
+    f353 = MUL_F(FRAC_CONST(0.0347065382144002), f274);
+    f354 = MUL_F(FRAC_CONST(0.6895405447370668), f352);
+    f355 = MUL_C(COEF_CONST(1.4137876276885337), f272);
     y[16] = f353 + f354;
     y[15] = f355 - f354;
     f358 = f278 + f276;
-    f359 = 0.1731148370459795 * f278;
-    f360 = 0.6152315905806268 * f358;
-    f361 = 1.4035780182072330 * f276;
+    f359 = MUL_F(FRAC_CONST(0.1731148370459795), f278);
+    f360 = MUL_F(FRAC_CONST(0.6152315905806268), f358);
+    f361 = MUL_C(COEF_CONST(1.4035780182072330), f276);
     y[18] = f359 + f360;
     y[13] = f361 - f360;
     f364 = f282 + f280;
-    f365 = 0.3098559453626100 * f282;
-    f366 = 0.5349976198870972 * f364;
-    f367 = 1.3798511851368043 * f280;
+    f365 = MUL_F(FRAC_CONST(0.3098559453626100), f282);
+    f366 = MUL_F(FRAC_CONST(0.5349976198870972), f364);
+    f367 = MUL_C(COEF_CONST(1.3798511851368043), f280);
     y[20] = f365 + f366;
     y[11] = f367 - f366;
     f370 = f286 + f284;
-    f371 = 0.4436129715409088 * f286;
-    f372 = 0.4496113296546065 * f370;
-    f373 = 1.3428356308501219 * f284;
+    f371 = MUL_F(FRAC_CONST(0.4436129715409088), f286);
+    f372 = MUL_F(FRAC_CONST(0.4496113296546065), f370);
+    f373 = MUL_C(COEF_CONST(1.3428356308501219), f284);
     y[22] = f371 + f372;
     y[9] = f373 - f372;
     f376 = f290 + f288;
-    f377 = 0.5730977622997509 * f290;
-    f378 = 0.3598950365349881 * f376;
-    f379 = 1.2928878353697271 * f288;
+    f377 = MUL_F(FRAC_CONST(0.5730977622997509), f290);
+    f378 = MUL_F(FRAC_CONST(0.3598950365349881), f376);
+    f379 = MUL_C(COEF_CONST(1.2928878353697271), f288);
     y[24] = f377 + f378;
     y[7] = f379 - f378;
     f382 = f294 + f292;
-    f383 = 0.6970633083205415 * f294;
-    f384 = 0.2667127574748984 * f382;
-    f385 = 1.2304888232703382 * f292;
+    f383 = MUL_F(FRAC_CONST(0.6970633083205415), f294);
+    f384 = MUL_F(FRAC_CONST(0.2667127574748984), f382);
+    f385 = MUL_C(COEF_CONST(1.2304888232703382), f292);
     y[26] = f383 + f384;
     y[5] = f385 - f384;
     f388 = f298 + f296;
-    f389 = 0.8143157536286401 * f298;
-    f390 = 0.1709618887603012 * f388;
-    f391 = 1.1562395311492424 * f296;
+    f389 = MUL_F(FRAC_CONST(0.8143157536286401), f298);
+    f390 = MUL_F(FRAC_CONST(0.1709618887603012), f388);
+    f391 = MUL_C(COEF_CONST(1.1562395311492424), f296);
     y[28] = f389 + f390;
     y[3] = f391 - f390;
     f394 = f302 + f300;
-    f395 = 0.9237258930790228 * f302;
-    f396 = 0.0735645635996674 * f394;
-    f397 = 1.0708550202783576 * f300;
+    f395 = MUL_F(FRAC_CONST(0.9237258930790228), f302);
+    f396 = MUL_F(FRAC_CONST(0.0735645635996674), f394);
+    f397 = MUL_C(COEF_CONST(1.0708550202783576), f300);
     y[30] = f395 + f396;
     y[1] = f397 - f396;
 }
@@ -824,7 +493,7 @@
     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];
@@ -957,7 +626,7 @@
     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);
@@ -1460,264 +1129,33 @@
 
 void DCT2_32_unscaled(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 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;
-    
+    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 f63, f64, f65, f66, f69, f70, f71, f72, f73, f74;
+    real_t f75, f76, f77, f78, f79, f80, f81, f83, f85, f86;
+    real_t f89, f90, f91, f92, f93, f94, f95, f96, f97, f98;
+    real_t f99, f100, f101, f102, f103, f104, f105, f106, f107, f108;
+    real_t f109, f110, f111, f112, f113, f114, f115, f116, f117, f118;
+    real_t f119, f120, f121, f122, f123, f124, f127, f128, f129, f130;
+    real_t f133, f134, f135, f136, f139, f140, f141, f142, f145, f146;
+    real_t f147, f148, f149, f150, f151, f152, f153, f154, f155, f156;
+    real_t f157, f158, f159, f160, f161, f162, f163, f164, f165, f166;
+    real_t f167, f168, f169, f170, f171, f172, f173, f174, f175, f176;
+    real_t f177, f178, f179, f180, f181, f182, f183, f184, f185, f186;
+    real_t f187, f188, f189, f190, f191, f192, f193, f194, f195, f196;
+    real_t f197, f198, f199, f200, f201, f202, f203, f204, f205, f206;
+    real_t f207, f208, f209, f210, f211, f212, f213, f214, f215, f216;
+    real_t f217, f218, f219, f220, f221, f222, f223, f224, f225, f226;
+    real_t f227, f228, f229, f230, f231, f232, f233, f234, f235, f236;
+    real_t f237, f238, f239, f240, f241, f242, f243, f244, f247, f248;
+    real_t f249, f250, f253, f254, f255, f256, f259, f260, f261, f262;
+    real_t f265, f266, f267, f268, f271, f272, f273, f274, f277, f278;
+    real_t f279, f280, f283, f284, f285, f286;
+
     f0 = x[0] - x[31];
     f1 = x[0] + x[31];
     f2 = x[1] - x[30];
@@ -1780,31 +1218,31 @@
     f59 = f51 + f53;
     f60 = f57 - f59;
     y[0] = f57 + f59;
-    y[16] = 0.7071067811865476 * f60;
+    y[16] = MUL_F(FRAC_CONST(0.7071067811865476), f60);
     f63 = f56 + f58;
-    f64 = 1.3065629648763766 * f56;
-    f65 = (-0.9238795325112866) * f63;
-    f66 = (-0.5411961001461967) * f58;
+    f64 = MUL_C(COEF_CONST(1.3065629648763766), f56);
+    f65 = MUL_F(FRAC_CONST(-0.9238795325112866), f63);
+    f66 = MUL_F(FRAC_CONST(-0.5411961001461967), f58);
     y[24] = f64 + f65;
     y[8] = f66 - f65;
     f69 = f48 + f54;
-    f70 = 1.1758756024193588 * f48;
-    f71 = (-0.9807852804032304) * f69;
-    f72 = (-0.7856949583871021) * f54;
+    f70 = MUL_C(COEF_CONST(1.1758756024193588), f48);
+    f71 = MUL_F(FRAC_CONST(-0.9807852804032304), f69);
+    f72 = MUL_F(FRAC_CONST(-0.7856949583871021), f54);
     f73 = f70 + f71;
     f74 = f72 - f71;
     f75 = f50 + f52;
-    f76 = 1.3870398453221473 * f50;
-    f77 = (-0.8314696123025455) * f75;
-    f78 = (-0.2758993792829436) * f52;
+    f76 = MUL_C(COEF_CONST(1.3870398453221473), f50);
+    f77 = MUL_F(FRAC_CONST(-0.8314696123025455), f75);
+    f78 = MUL_F(FRAC_CONST(-0.2758993792829436), f52);
     f79 = f76 + f77;
     f80 = f78 - f77;
     f81 = f74 - f80;
     y[4] = f74 + f80;
-    f83 = 0.7071067811865476 * f81;
+    f83 = MUL_F(FRAC_CONST(0.7071067811865476), f81);
     y[28] = f73 - f79;
     f85 = f73 + f79;
-    f86 = 0.7071067811865476 * f85;
+    f86 = MUL_F(FRAC_CONST(0.7071067811865476), f85);
     y[20] = f83 - f86;
     y[12] = f83 + f86;
     f89 = f34 - f36;
@@ -1813,13 +1251,13 @@
     f92 = f38 + f40;
     f93 = f42 - f44;
     f94 = f42 + f44;
-    f95 = 0.7071067811865476 * f92;
+    f95 = MUL_F(FRAC_CONST(0.7071067811865476), f92);
     f96 = f32 - f95;
     f97 = f32 + f95;
     f98 = f90 + f94;
-    f99 = 1.3065629648763766 * f90;
-    f100 = (-0.9238795325112866) * f98;
-    f101 = (-0.5411961001461967) * f94;
+    f99 = MUL_C(COEF_CONST(1.3065629648763766), f90);
+    f100 = MUL_F(FRAC_CONST(-0.9238795325112866), f98);
+    f101 = MUL_F(FRAC_CONST(-0.5411961001461967), f94);
     f102 = f99 + f100;
     f103 = f101 - f100;
     f104 = f97 - f103;
@@ -1826,13 +1264,13 @@
     f105 = f97 + f103;
     f106 = f96 - f102;
     f107 = f96 + f102;
-    f108 = 0.7071067811865476 * f91;
+    f108 = MUL_F(FRAC_CONST(0.7071067811865476), f91);
     f109 = f46 - f108;
     f110 = f46 + f108;
     f111 = f93 + f89;
-    f112 = 1.3065629648763766 * f93;
-    f113 = (-0.9238795325112866) * f111;
-    f114 = (-0.5411961001461967) * f89;
+    f112 = MUL_C(COEF_CONST(1.3065629648763766), f93);
+    f113 = MUL_F(FRAC_CONST(-0.9238795325112866), f111);
+    f114 = MUL_F(FRAC_CONST(-0.5411961001461967), f89);
     f115 = f112 + f113;
     f116 = f114 - f113;
     f117 = f110 - f116;
@@ -1840,27 +1278,27 @@
     f119 = f109 - f115;
     f120 = f109 + f115;
     f121 = f118 + f105;
-    f122 = (-0.8971675863426361) * f118;
-    f123 = 0.9951847266721968 * f121;
-    f124 = 1.0932018670017576 * f105;
+    f122 = MUL_F(FRAC_CONST(-0.8971675863426361), f118);
+    f123 = MUL_F(FRAC_CONST(0.9951847266721968), f121);
+    f124 = MUL_C(COEF_CONST(1.0932018670017576), f105);
     y[2] = f122 + f123;
     y[30] = f124 - f123;
     f127 = f107 - f120;
-    f128 = (-0.6666556584777466) * f120;
-    f129 = 0.9569403357322089 * f127;
-    f130 = 1.2472250129866713 * f107;
+    f128 = MUL_F(FRAC_CONST(-0.6666556584777466), f120);
+    f129 = MUL_F(FRAC_CONST(0.9569403357322089), f127);
+    f130 = MUL_C(COEF_CONST(1.2472250129866713), f107);
     y[6] = f129 - f128;
     y[26] = f130 - f129;
     f133 = f119 + f106;
-    f134 = (-0.4105245275223571) * f119;
-    f135 = 0.8819212643483549 * f133;
-    f136 = 1.3533180011743529 * f106;
+    f134 = MUL_F(FRAC_CONST(-0.4105245275223571), f119);
+    f135 = MUL_F(FRAC_CONST(0.8819212643483549), f133);
+    f136 = MUL_C(COEF_CONST(1.3533180011743529), f106);
     y[10] = f134 + f135;
     y[22] = f136 - f135;
     f139 = f104 - f117;
-    f140 = (-0.1386171691990915) * f117;
-    f141 = 0.7730104533627370 * f139;
-    f142 = 1.4074037375263826 * f104;
+    f140 = MUL_F(FRAC_CONST(-0.1386171691990915), f117);
+    f141 = MUL_F(FRAC_CONST(0.7730104533627370), f139);
+    f142 = MUL_C(COEF_CONST(1.4074037375263826), f104);
     y[14] = f141 - f140;
     y[18] = f142 - f141;
     f145 = f2 - f4;
@@ -1877,13 +1315,13 @@
     f156 = f22 + f24;
     f157 = f26 - f28;
     f158 = f26 + f28;
-    f159 = 0.7071067811865476 * f152;
+    f159 = MUL_F(FRAC_CONST(0.7071067811865476), f152);
     f160 = f0 - f159;
     f161 = f0 + f159;
     f162 = f148 + f156;
-    f163 = 1.3065629648763766 * f148;
-    f164 = (-0.9238795325112866) * f162;
-    f165 = (-0.5411961001461967) * f156;
+    f163 = MUL_C(COEF_CONST(1.3065629648763766), f148);
+    f164 = MUL_F(FRAC_CONST(-0.9238795325112866), f162);
+    f165 = MUL_F(FRAC_CONST(-0.5411961001461967), f156);
     f166 = f163 + f164;
     f167 = f165 - f164;
     f168 = f161 - f167;
@@ -1891,23 +1329,23 @@
     f170 = f160 - f166;
     f171 = f160 + f166;
     f172 = f146 + f158;
-    f173 = 1.1758756024193588 * f146;
-    f174 = (-0.9807852804032304) * f172;
-    f175 = (-0.7856949583871021) * f158;
+    f173 = MUL_C(COEF_CONST(1.1758756024193588), f146);
+    f174 = MUL_F(FRAC_CONST(-0.9807852804032304), f172);
+    f175 = MUL_F(FRAC_CONST(-0.7856949583871021), f158);
     f176 = f173 + f174;
     f177 = f175 - f174;
     f178 = f150 + f154;
-    f179 = 1.3870398453221473 * f150;
-    f180 = (-0.8314696123025455) * f178;
-    f181 = (-0.2758993792829436) * f154;
+    f179 = MUL_C(COEF_CONST(1.3870398453221473), f150);
+    f180 = MUL_F(FRAC_CONST(-0.8314696123025455), f178);
+    f181 = MUL_F(FRAC_CONST(-0.2758993792829436), f154);
     f182 = f179 + f180;
     f183 = f181 - f180;
     f184 = f177 - f183;
     f185 = f177 + f183;
-    f186 = 0.7071067811865476 * f184;
+    f186 = MUL_F(FRAC_CONST(0.7071067811865476), f184);
     f187 = f176 - f182;
     f188 = f176 + f182;
-    f189 = 0.7071067811865476 * f188;
+    f189 = MUL_F(FRAC_CONST(0.7071067811865476), f188);
     f190 = f186 - f189;
     f191 = f186 + f189;
     f192 = f169 - f185;
@@ -1918,13 +1356,13 @@
     f197 = f170 + f190;
     f198 = f168 - f187;
     f199 = f168 + f187;
-    f200 = 0.7071067811865476 * f151;
+    f200 = MUL_F(FRAC_CONST(0.7071067811865476), f151);
     f201 = f30 - f200;
     f202 = f30 + f200;
     f203 = f155 + f147;
-    f204 = 1.3065629648763766 * f155;
-    f205 = (-0.9238795325112866) * f203;
-    f206 = (-0.5411961001461967) * f147;
+    f204 = MUL_C(COEF_CONST(1.3065629648763766), f155);
+    f205 = MUL_F(FRAC_CONST(-0.9238795325112866), f203);
+    f206 = MUL_F(FRAC_CONST(-0.5411961001461967), f147);
     f207 = f204 + f205;
     f208 = f206 - f205;
     f209 = f202 - f208;
@@ -1932,23 +1370,23 @@
     f211 = f201 - f207;
     f212 = f201 + f207;
     f213 = f157 + f145;
-    f214 = 1.1758756024193588 * f157;
-    f215 = (-0.9807852804032304) * f213;
-    f216 = (-0.7856949583871021) * f145;
+    f214 = MUL_C(COEF_CONST(1.1758756024193588), f157);
+    f215 = MUL_F(FRAC_CONST(-0.9807852804032304), f213);
+    f216 = MUL_F(FRAC_CONST(-0.7856949583871021), f145);
     f217 = f214 + f215;
     f218 = f216 - f215;
     f219 = f153 + f149;
-    f220 = 1.3870398453221473 * f153;
-    f221 = (-0.8314696123025455) * f219;
-    f222 = (-0.2758993792829436) * f149;
+    f220 = MUL_C(COEF_CONST(1.3870398453221473), f153);
+    f221 = MUL_F(FRAC_CONST(-0.8314696123025455), f219);
+    f222 = MUL_F(FRAC_CONST(-0.2758993792829436), f149);
     f223 = f220 + f221;
     f224 = f222 - f221;
     f225 = f218 - f224;
     f226 = f218 + f224;
-    f227 = 0.7071067811865476 * f225;
+    f227 = MUL_F(FRAC_CONST(0.7071067811865476), f225);
     f228 = f217 - f223;
     f229 = f217 + f223;
-    f230 = 0.7071067811865476 * f229;
+    f230 = MUL_F(FRAC_CONST(0.7071067811865476), f229);
     f231 = f227 - f230;
     f232 = f227 + f230;
     f233 = f210 - f226;
@@ -1960,51 +1398,51 @@
     f239 = f209 - f228;
     f240 = f209 + f228;
     f241 = f234 + f193;
-    f242 = (-0.9497277818777543) * f234;
-    f243 = 0.9987954562051724 * f241;
-    f244 = 1.0478631305325905 * f193;
+    f242 = MUL_F(FRAC_CONST(-0.9497277818777543), f234);
+    f243 = MUL_F(FRAC_CONST(0.9987954562051724), f241);
+    f244 = MUL_C(COEF_CONST(1.0478631305325905), f193);
     y[1] = f242 + f243;
     y[31] = f244 - f243;
     f247 = f195 - f236;
-    f248 = (-0.8424460355094192) * f236;
-    f249 = 0.9891765099647810 * f247;
-    f250 = 1.1359069844201428 * f195;
+    f248 = MUL_F(FRAC_CONST(-0.8424460355094192), f236);
+    f249 = MUL_F(FRAC_CONST(0.9891765099647810), f247);
+    f250 = MUL_C(COEF_CONST(1.1359069844201428), f195);
     y[3] = f249 - f248;
     y[29] = f250 - f249;
     f253 = f238 + f197;
-    f254 = (-0.7270510732912801) * f238;
-    f255 = 0.9700312531945440 * f253;
-    f256 = 1.2130114330978079 * f197;
+    f254 = MUL_F(FRAC_CONST(-0.7270510732912801), f238);
+    f255 = MUL_F(FRAC_CONST(0.9700312531945440), f253);
+    f256 = MUL_C(COEF_CONST(1.2130114330978079), f197);
     y[5] = f254 + f255;
     y[27] = f256 - f255;
     f259 = f199 - f240;
-    f260 = (-0.6046542117908007) * f240;
-    f261 = 0.9415440651830208 * f259;
-    f262 = 1.2784339185752409 * f199;
+    f260 = MUL_F(FRAC_CONST(-0.6046542117908007), f240);
+    f261 = MUL_F(FRAC_CONST(0.9415440651830208), f259);
+    f262 = MUL_C(COEF_CONST(1.2784339185752409), f199);
     y[7] = f261 - f260;
     y[25] = f262 - f261;
     f265 = f239 + f198;
-    f266 = (-0.4764341996931611) * f239;
-    f267 = 0.9039892931234433 * f265;
-    f268 = 1.3315443865537255 * f198;
+    f266 = MUL_F(FRAC_CONST(-0.4764341996931611), f239);
+    f267 = MUL_F(FRAC_CONST(0.9039892931234433), f265);
+    f268 = MUL_C(COEF_CONST(1.3315443865537255), f198);
     y[9] = f266 + f267;
     y[23] = f268 - f267;
     f271 = f196 - f237;
-    f272 = (-0.3436258658070505) * f237;
-    f273 = 0.8577286100002721 * f271;
-    f274 = 1.3718313541934939 * f196;
+    f272 = MUL_F(FRAC_CONST(-0.3436258658070505), f237);
+    f273 = MUL_F(FRAC_CONST(0.8577286100002721), f271);
+    f274 = MUL_C(COEF_CONST(1.3718313541934939), f196);
     y[11] = f273 - f272;
     y[21] = f274 - f273;
     f277 = f235 + f194;
-    f278 = (-0.2075082269882114) * f235;
-    f279 = 0.8032075314806448 * f277;
-    f280 = 1.3989068359730783 * f194;
+    f278 = MUL_F(FRAC_CONST(-0.2075082269882114), f235);
+    f279 = MUL_F(FRAC_CONST(0.8032075314806448), f277);
+    f280 = MUL_C(COEF_CONST(1.3989068359730783), f194);
     y[13] = f278 + f279;
     y[19] = f280 - f279;
     f283 = f192 - f233;
-    f284 = (-0.0693921705079408) * f233;
-    f285 = 0.7409511253549591 * f283;
-    f286 = 1.4125100802019774 * f192;
+    f284 = MUL_F(FRAC_CONST(-0.0693921705079408), f233);
+    f285 = MUL_F(FRAC_CONST(0.7409511253549591), f283);
+    f286 = MUL_C(COEF_CONST(1.4125100802019774), f192);
     y[15] = f285 - f284;
     y[17] = f286 - f285;
 }
@@ -2136,13 +1574,13 @@
     real_t f788, f789, f792, f793, f794, f795, f798;
     real_t f799, f800, f801;
 
-    f2 = 0.7071067811865476 * t2[32];
+    f2 = MUL_F(FRAC_CONST(0.7071067811865476), t2[32]);
     f3 = t2[0] - f2;
     f4 = t2[0] + f2;
     f5 = t2[16] + t2[48];
-    f6 = 1.3065629648763766 * t2[16];
-    f7 = (-0.9238795325112866) * f5;
-    f8 = (-0.5411961001461967) * t2[48];
+    f6 = MUL_C(COEF_CONST(1.3065629648763766), t2[16]);
+    f7 = MUL_F(FRAC_CONST(-0.9238795325112866), f5);
+    f8 = MUL_F(FRAC_CONST(-0.5411961001461967), t2[48]);
     f9 = f6 + f7;
     f10 = f8 - f7;
     f11 = f4 - f10;
@@ -2150,23 +1588,23 @@
     f13 = f3 - f9;
     f14 = f3 + f9;
     f15 = t2[8] + t2[56];
-    f16 = 1.1758756024193588 * t2[8];
-    f17 = (-0.9807852804032304) * f15;
-    f18 = (-0.7856949583871021) * t2[56];
+    f16 = MUL_C(COEF_CONST(1.1758756024193588), t2[8]);
+    f17 = MUL_F(FRAC_CONST(-0.9807852804032304), f15);
+    f18 = MUL_F(FRAC_CONST(-0.7856949583871021), t2[56]);
     f19 = f16 + f17;
     f20 = f18 - f17;
     f21 = t2[24] + t2[40];
-    f22 = 1.3870398453221473 * t2[24];
-    f23 = (-0.8314696123025455) * f21;
-    f24 = (-0.2758993792829436) * t2[40];
+    f22 = MUL_C(COEF_CONST(1.3870398453221473), t2[24]);
+    f23 = MUL_F(FRAC_CONST(-0.8314696123025455), f21);
+    f24 = MUL_F(FRAC_CONST(-0.2758993792829436), t2[40]);
     f25 = f22 + f23;
     f26 = f24 - f23;
     f27 = f20 - f26;
     f28 = f20 + f26;
-    f29 = 0.7071067811865476 * f27;
+    f29 = MUL_F(FRAC_CONST(0.7071067811865476), f27);
     f30 = f19 - f25;
     f31 = f19 + f25;
-    f32 = 0.7071067811865476 * f31;
+    f32 = MUL_F(FRAC_CONST(0.7071067811865476), f31);
     f33 = f29 - f32;
     f34 = f29 + f32;
     f35 = f12 - f28;
@@ -2178,27 +1616,27 @@
     f41 = f11 - f30;
     f42 = f11 + f30;
     f43 = t2[4] + t2[60];
-    f44 = 1.0932018670017569 * t2[4];
-    f45 = (-0.9951847266721969) * f43;
-    f46 = (-0.8971675863426368) * t2[60];
+    f44 = MUL_C(COEF_CONST(1.0932018670017569), t2[4]);
+    f45 = MUL_F(FRAC_CONST(-0.9951847266721969), f43);
+    f46 = MUL_F(FRAC_CONST(-0.8971675863426368), t2[60]);
     f47 = f44 + f45;
     f48 = f46 - f45;
     f49 = t2[12] + t2[52];
-    f50 = 1.2472250129866711 * t2[12];
-    f51 = (-0.9569403357322089) * f49;
-    f52 = (-0.6666556584777469) * t2[52];
+    f50 = MUL_C(COEF_CONST(1.2472250129866711), t2[12]);
+    f51 = MUL_F(FRAC_CONST(-0.9569403357322089), f49);
+    f52 = MUL_F(FRAC_CONST(-0.6666556584777469), t2[52]);
     f53 = f50 + f51;
     f54 = f52 - f51;
     f55 = t2[20] + t2[44];
-    f56 = 1.3533180011743526 * t2[20];
-    f57 = (-0.8819212643483551) * f55;
-    f58 = (-0.4105245275223575) * t2[44];
+    f56 = MUL_C(COEF_CONST(1.3533180011743526), t2[20]);
+    f57 = MUL_F(FRAC_CONST(-0.8819212643483551), f55);
+    f58 = MUL_F(FRAC_CONST(-0.4105245275223575), t2[44]);
     f59 = f56 + f57;
     f60 = f58 - f57;
     f61 = t2[28] + t2[36];
-    f62 = 1.4074037375263826 * t2[28];
-    f63 = (-0.7730104533627369) * f61;
-    f64 = (-0.1386171691990913) * t2[36];
+    f62 = MUL_C(COEF_CONST(1.4074037375263826), t2[28]);
+    f63 = MUL_F(FRAC_CONST(-0.7730104533627369), f61);
+    f64 = MUL_F(FRAC_CONST(-0.1386171691990913), t2[36]);
     f65 = f62 + f63;
     f66 = f64 - f63;
     f67 = f48 - f66;
@@ -2207,11 +1645,11 @@
     f70 = f54 + f60;
     f71 = f68 - f70;
     f72 = f68 + f70;
-    f73 = 0.7071067811865476 * f71;
+    f73 = MUL_F(FRAC_CONST(0.7071067811865476), f71);
     f74 = f67 + f69;
-    f75 = 1.3065629648763766 * f67;
-    f76 = (-0.9238795325112866) * f74;
-    f77 = (-0.5411961001461967) * f69;
+    f75 = MUL_C(COEF_CONST(1.3065629648763766), f67);
+    f76 = MUL_F(FRAC_CONST(-0.9238795325112866), f74);
+    f77 = MUL_F(FRAC_CONST(-0.5411961001461967), f69);
     f78 = f75 + f76;
     f79 = f77 - f76;
     f80 = f47 - f65;
@@ -2219,14 +1657,14 @@
     f82 = f53 - f59;
     f83 = f53 + f59;
     f84 = f81 + f83;
-    f85 = 1.3065629648763770 * f81;
-    f86 = (-0.3826834323650904) * f84;
-    f87 = 0.5411961001461961 * f83;
+    f85 = MUL_C(COEF_CONST(1.3065629648763770), f81);
+    f86 = MUL_F(FRAC_CONST(-0.3826834323650904), f84);
+    f87 = MUL_F(FRAC_CONST(0.5411961001461961), f83);
     f88 = f85 + f86;
     f89 = f87 - f86;
     f90 = f80 - f82;
     f91 = f80 + f82;
-    f92 = 0.7071067811865476 * f91;
+    f92 = MUL_F(FRAC_CONST(0.7071067811865476), f91);
     f93 = f79 - f89;
     f94 = f79 + f89;
     f95 = f73 - f92;
@@ -2250,51 +1688,51 @@
     f113 = f35 - f90;
     f114 = f35 + f90;
     f115 = t2[2] + t2[62];
-    f116 = 1.0478631305325901 * t2[2];
-    f117 = (-0.9987954562051724) * f115;
-    f118 = (-0.9497277818777548) * t2[62];
+    f116 = MUL_C(COEF_CONST(1.0478631305325901), t2[2]);
+    f117 = MUL_F(FRAC_CONST(-0.9987954562051724), f115);
+    f118 = MUL_F(FRAC_CONST(-0.9497277818777548), t2[62]);
     f119 = f116 + f117;
     f120 = f118 - f117;
     f121 = t2[10] + t2[54];
-    f122 = 1.2130114330978077 * t2[10];
-    f123 = (-0.9700312531945440) * f121;
-    f124 = (-0.7270510732912803) * t2[54];
+    f122 = MUL_C(COEF_CONST(1.2130114330978077), t2[10]);
+    f123 = MUL_F(FRAC_CONST(-0.9700312531945440), f121);
+    f124 = MUL_F(FRAC_CONST(-0.7270510732912803), t2[54]);
     f125 = f122 + f123;
     f126 = f124 - f123;
     f127 = t2[18] + t2[46];
-    f128 = 1.3315443865537255 * t2[18];
-    f129 = (-0.9039892931234433) * f127;
-    f130 = (-0.4764341996931612) * t2[46];
+    f128 = MUL_C(COEF_CONST(1.3315443865537255), t2[18]);
+    f129 = MUL_F(FRAC_CONST(-0.9039892931234433), f127);
+    f130 = MUL_F(FRAC_CONST(-0.4764341996931612), t2[46]);
     f131 = f128 + f129;
     f132 = f130 - f129;
     f133 = t2[26] + t2[38];
-    f134 = 1.3989068359730781 * t2[26];
-    f135 = (-0.8032075314806453) * f133;
-    f136 = (-0.2075082269882124) * t2[38];
+    f134 = MUL_C(COEF_CONST(1.3989068359730781), t2[26]);
+    f135 = MUL_F(FRAC_CONST(-0.8032075314806453), f133);
+    f136 = MUL_F(FRAC_CONST(-0.2075082269882124), t2[38]);
     f137 = f134 + f135;
     f138 = f136 - f135;
     f139 = t2[34] + t2[30];
-    f140 = 1.4125100802019777 * t2[34];
-    f141 = (-0.6715589548470187) * f139;
-    f142 = 0.0693921705079402 * t2[30];
+    f140 = MUL_C(COEF_CONST(1.4125100802019777), t2[34]);
+    f141 = MUL_F(FRAC_CONST(-0.6715589548470187), f139);
+    f142 = MUL_F(FRAC_CONST(0.0693921705079402), t2[30]);
     f143 = f140 + f141;
     f144 = f142 - f141;
     f145 = t2[42] + t2[22];
-    f146 = 1.3718313541934939 * t2[42];
-    f147 = (-0.5141027441932219) * f145;
-    f148 = 0.3436258658070501 * t2[22];
+    f146 = MUL_C(COEF_CONST(1.3718313541934939), t2[42]);
+    f147 = MUL_F(FRAC_CONST(-0.5141027441932219), f145);
+    f148 = MUL_F(FRAC_CONST(0.3436258658070501), t2[22]);
     f149 = f146 + f147;
     f150 = f148 - f147;
     f151 = t2[50] + t2[14];
-    f152 = 1.2784339185752409 * t2[50];
-    f153 = (-0.3368898533922200) * f151;
-    f154 = 0.6046542117908008 * t2[14];
+    f152 = MUL_C(COEF_CONST(1.2784339185752409), t2[50]);
+    f153 = MUL_F(FRAC_CONST(-0.3368898533922200), f151);
+    f154 = MUL_F(FRAC_CONST(0.6046542117908008), t2[14]);
     f155 = f152 + f153;
     f156 = f154 - f153;
     f157 = t2[58] + t2[6];
-    f158 = 1.1359069844201433 * t2[58];
-    f159 = (-0.1467304744553624) * f157;
-    f160 = 0.8424460355094185 * t2[6];
+    f158 = MUL_C(COEF_CONST(1.1359069844201433), t2[58]);
+    f159 = MUL_F(FRAC_CONST(-0.1467304744553624), f157);
+    f160 = MUL_F(FRAC_CONST(0.8424460355094185), t2[6]);
     f161 = f158 + f159;
     f162 = f160 - f159;
     f163 = f120 - f144;
@@ -2314,27 +1752,27 @@
     f177 = f137 - f161;
     f178 = f137 + f161;
     f179 = f163 + f165;
-    f180 = 1.1758756024193588 * f163;
-    f181 = (-0.9807852804032304) * f179;
-    f182 = (-0.7856949583871021) * f165;
+    f180 = MUL_C(COEF_CONST(1.1758756024193588), f163);
+    f181 = MUL_F(FRAC_CONST(-0.9807852804032304), f179);
+    f182 = MUL_F(FRAC_CONST(-0.7856949583871021), f165);
     f183 = f180 + f181;
     f184 = f182 - f181;
     f185 = f167 + f169;
-    f186 = 1.3870398453221475 * f167;
-    f187 = (-0.5555702330196022) * f185;
-    f188 = 0.2758993792829431 * f169;
+    f186 = MUL_C(COEF_CONST(1.3870398453221475), f167);
+    f187 = MUL_F(FRAC_CONST(-0.5555702330196022), f185);
+    f188 = MUL_F(FRAC_CONST(0.2758993792829431), f169);
     f189 = f186 + f187;
     f190 = f188 - f187;
     f191 = f171 + f173;
-    f192 = 0.7856949583871022 * f171;
-    f193 = 0.1950903220161283 * f191;
-    f194 = 1.1758756024193586 * f173;
+    f192 = MUL_F(FRAC_CONST(0.7856949583871022), f171);
+    f193 = MUL_F(FRAC_CONST(0.1950903220161283), f191);
+    f194 = MUL_C(COEF_CONST(1.1758756024193586), f173);
     f195 = f192 + f193;
     f196 = f194 - f193;
     f197 = f175 + f177;
-    f198 = (-0.2758993792829430) * f175;
-    f199 = 0.8314696123025452 * f197;
-    f200 = 1.3870398453221475 * f177;
+    f198 = MUL_F(FRAC_CONST(-0.2758993792829430), f175);
+    f199 = MUL_F(FRAC_CONST(0.8314696123025452), f197);
+    f200 = MUL_C(COEF_CONST(1.3870398453221475), f177);
     f201 = f198 + f199;
     f202 = f200 - f199;
     f203 = f164 - f172;
@@ -2354,27 +1792,27 @@
     f217 = f189 - f201;
     f218 = f189 + f201;
     f219 = f203 + f205;
-    f220 = 1.3065629648763766 * f203;
-    f221 = (-0.9238795325112866) * f219;
-    f222 = (-0.5411961001461967) * f205;
+    f220 = MUL_C(COEF_CONST(1.3065629648763766), f203);
+    f221 = MUL_F(FRAC_CONST(-0.9238795325112866), f219);
+    f222 = MUL_F(FRAC_CONST(-0.5411961001461967), f205);
     f223 = f220 + f221;
     f224 = f222 - f221;
     f225 = f207 + f209;
-    f226 = 0.5411961001461969 * f207;
-    f227 = 0.3826834323650898 * f225;
-    f228 = 1.3065629648763766 * f209;
+    f226 = MUL_F(FRAC_CONST(0.5411961001461969), f207);
+    f227 = MUL_F(FRAC_CONST(0.3826834323650898), f225);
+    f228 = MUL_C(COEF_CONST(1.3065629648763766), f209);
     f229 = f226 + f227;
     f230 = f228 - f227;
     f231 = f211 + f213;
-    f232 = 1.3065629648763766 * f211;
-    f233 = (-0.9238795325112866) * f231;
-    f234 = (-0.5411961001461967) * f213;
+    f232 = MUL_C(COEF_CONST(1.3065629648763766), f211);
+    f233 = MUL_F(FRAC_CONST(-0.9238795325112866), f231);
+    f234 = MUL_F(FRAC_CONST(-0.5411961001461967), f213);
     f235 = f232 + f233;
     f236 = f234 - f233;
     f237 = f215 + f217;
-    f238 = 0.5411961001461969 * f215;
-    f239 = 0.3826834323650898 * f237;
-    f240 = 1.3065629648763766 * f217;
+    f238 = MUL_F(FRAC_CONST(0.5411961001461969), f215);
+    f239 = MUL_F(FRAC_CONST(0.3826834323650898), f237);
+    f240 = MUL_C(COEF_CONST(1.3065629648763766), f217);
     f241 = f238 + f239;
     f242 = f240 - f239;
     f243 = f204 - f208;
@@ -2395,20 +1833,20 @@
     f258 = f235 + f241;
     f259 = f243 - f245;
     f260 = f243 + f245;
-    f261 = 0.7071067811865474 * f259;
-    f262 = 0.7071067811865474 * f260;
+    f261 = MUL_F(FRAC_CONST(0.7071067811865474), f259);
+    f262 = MUL_F(FRAC_CONST(0.7071067811865474), f260);
     f263 = f247 - f249;
     f264 = f247 + f249;
-    f265 = 0.7071067811865474 * f263;
-    f266 = 0.7071067811865474 * f264;
+    f265 = MUL_F(FRAC_CONST(0.7071067811865474), f263);
+    f266 = MUL_F(FRAC_CONST(0.7071067811865474), f264);
     f267 = f251 - f253;
     f268 = f251 + f253;
-    f269 = 0.7071067811865474 * f267;
-    f270 = 0.7071067811865474 * f268;
+    f269 = MUL_F(FRAC_CONST(0.7071067811865474), f267);
+    f270 = MUL_F(FRAC_CONST(0.7071067811865474), f268);
     f271 = f255 - f257;
     f272 = f255 + f257;
-    f273 = 0.7071067811865474 * f271;
-    f274 = 0.7071067811865474 * f272;
+    f273 = MUL_F(FRAC_CONST(0.7071067811865474), f271);
+    f274 = MUL_F(FRAC_CONST(0.7071067811865474), f272);
     f275 = f100 - f244;
     f276 = f100 + f244;
     f277 = f102 - f252;
@@ -2442,51 +1880,51 @@
     f305 = f99 - f246;
     f306 = f99 + f246;
     f307 = t2[1] - t2[61];
-    f308 = 1.0478631305325901 * t2[1];
-    f309 = (-0.9987954562051724) * f307;
-    f310 = (-0.9497277818777548) * t2[61];
+    f308 = MUL_C(COEF_CONST(1.0478631305325901), t2[1]);
+    f309 = MUL_F(FRAC_CONST(-0.9987954562051724), f307);
+    f310 = MUL_F(FRAC_CONST(-0.9497277818777548), t2[61]);
     f311 = f308 + f309;
     f312 = f309 + f310;
     f313 = t2[9] - t2[53];
-    f314 = 1.2130114330978077 * t2[9];
-    f315 = (-0.9700312531945440) * f313;
-    f316 = (-0.7270510732912803) * t2[53];
+    f314 = MUL_C(COEF_CONST(1.2130114330978077), t2[9]);
+    f315 = MUL_F(FRAC_CONST(-0.9700312531945440), f313);
+    f316 = MUL_F(FRAC_CONST(-0.7270510732912803), t2[53]);
     f317 = f314 + f315;
     f318 = f315 + f316;
     f319 = t2[17] - t2[45];
-    f320 = 1.3315443865537255 * t2[17];
-    f321 = (-0.9039892931234433) * f319;
-    f322 = (-0.4764341996931612) * t2[45];
+    f320 = MUL_C(COEF_CONST(1.3315443865537255), t2[17]);
+    f321 = MUL_F(FRAC_CONST(-0.9039892931234433), f319);
+    f322 = MUL_F(FRAC_CONST(-0.4764341996931612), t2[45]);
     f323 = f320 + f321;
     f324 = f321 + f322;
     f325 = t2[25] - t2[37];
-    f326 = 1.3989068359730781 * t2[25];
-    f327 = (-0.8032075314806453) * f325;
-    f328 = (-0.2075082269882124) * t2[37];
+    f326 = MUL_C(COEF_CONST(1.3989068359730781), t2[25]);
+    f327 = MUL_F(FRAC_CONST(-0.8032075314806453), f325);
+    f328 = MUL_F(FRAC_CONST(-0.2075082269882124), t2[37]);
     f329 = f326 + f327;
     f330 = f327 + f328;
     f331 = t2[33] - t2[29];
-    f332 = 1.4125100802019777 * t2[33];
-    f333 = (-0.6715589548470187) * f331;
-    f334 = 0.0693921705079402 * t2[29];
+    f332 = MUL_C(COEF_CONST(1.4125100802019777), t2[33]);
+    f333 = MUL_F(FRAC_CONST(-0.6715589548470187), f331);
+    f334 = MUL_F(FRAC_CONST(0.0693921705079402), t2[29]);
     f335 = f332 + f333;
     f336 = f333 + f334;
     f337 = t2[41] - t2[21];
-    f338 = 1.3718313541934939 * t2[41];
-    f339 = (-0.5141027441932219) * f337;
-    f340 = 0.3436258658070501 * t2[21];
+    f338 = MUL_C(COEF_CONST(1.3718313541934939), t2[41]);
+    f339 = MUL_F(FRAC_CONST(-0.5141027441932219), f337);
+    f340 = MUL_F(FRAC_CONST(0.3436258658070501), t2[21]);
     f341 = f338 + f339;
     f342 = f339 + f340;
     f343 = t2[49] - t2[13];
-    f344 = 1.2784339185752409 * t2[49];
-    f345 = (-0.3368898533922200) * f343;
-    f346 = 0.6046542117908008 * t2[13];
+    f344 = MUL_C(COEF_CONST(1.2784339185752409), t2[49]);
+    f345 = MUL_F(FRAC_CONST(-0.3368898533922200), f343);
+    f346 = MUL_F(FRAC_CONST(0.6046542117908008), t2[13]);
     f347 = f344 + f345;
     f348 = f345 + f346;
     f349 = t2[57] - t2[5];
-    f350 = 1.1359069844201433 * t2[57];
-    f351 = (-0.1467304744553624) * f349;
-    f352 = 0.8424460355094185 * t2[5];
+    f350 = MUL_C(COEF_CONST(1.1359069844201433), t2[57]);
+    f351 = MUL_F(FRAC_CONST(-0.1467304744553624), f349);
+    f352 = MUL_F(FRAC_CONST(0.8424460355094185), t2[5]);
     f353 = f350 + f351;
     f354 = f351 + f352;
     f355 = f336 - f312;
@@ -2506,27 +1944,27 @@
     f369 = f329 - f353;
     f370 = f329 + f353;
     f371 = f355 + f357;
-    f372 = 1.1758756024193588 * f355;
-    f373 = (-0.9807852804032304) * f371;
-    f374 = (-0.7856949583871021) * f357;
+    f372 = MUL_C(COEF_CONST(1.1758756024193588), f355);
+    f373 = MUL_F(FRAC_CONST(-0.9807852804032304), f371);
+    f374 = MUL_F(FRAC_CONST(-0.7856949583871021), f357);
     f375 = f372 + f373;
     f376 = f374 - f373;
     f377 = f359 + f361;
-    f378 = 1.3870398453221475 * f359;
-    f379 = (-0.5555702330196022) * f377;
-    f380 = 0.2758993792829431 * f361;
+    f378 = MUL_C(COEF_CONST(1.3870398453221475), f359);
+    f379 = MUL_F(FRAC_CONST(-0.5555702330196022), f377);
+    f380 = MUL_F(FRAC_CONST(0.2758993792829431), f361);
     f381 = f378 + f379;
     f382 = f380 - f379;
     f383 = f363 + f365;
-    f384 = 0.7856949583871022 * f363;
-    f385 = 0.1950903220161283 * f383;
-    f386 = 1.1758756024193586 * f365;
+    f384 = MUL_F(FRAC_CONST(0.7856949583871022), f363);
+    f385 = MUL_F(FRAC_CONST(0.1950903220161283), f383);
+    f386 = MUL_C(COEF_CONST(1.1758756024193586), f365);
     f387 = f384 + f385;
     f388 = f386 - f385;
     f389 = f367 + f369;
-    f390 = (-0.2758993792829430) * f367;
-    f391 = 0.8314696123025452 * f389;
-    f392 = 1.3870398453221475 * f369;
+    f390 = MUL_F(FRAC_CONST(-0.2758993792829430), f367);
+    f391 = MUL_F(FRAC_CONST(0.8314696123025452), f389);
+    f392 = MUL_C(COEF_CONST(1.3870398453221475), f369);
     f393 = f390 + f391;
     f394 = f392 - f391;
     f395 = f364 - f356;
@@ -2546,27 +1984,27 @@
     f409 = f381 - f393;
     f410 = f381 + f393;
     f411 = f395 + f397;
-    f412 = 1.3065629648763766 * f395;
-    f413 = (-0.9238795325112866) * f411;
-    f414 = (-0.5411961001461967) * f397;
+    f412 = MUL_C(COEF_CONST(1.3065629648763766), f395);
+    f413 = MUL_F(FRAC_CONST(-0.9238795325112866), f411);
+    f414 = MUL_F(FRAC_CONST(-0.5411961001461967), f397);
     f415 = f412 + f413;
     f416 = f414 - f413;
     f417 = f399 + f401;
-    f418 = 0.5411961001461969 * f399;
-    f419 = 0.3826834323650898 * f417;
-    f420 = 1.3065629648763766 * f401;
+    f418 = MUL_F(FRAC_CONST(0.5411961001461969), f399);
+    f419 = MUL_F(FRAC_CONST(0.3826834323650898), f417);
+    f420 = MUL_C(COEF_CONST(1.3065629648763766), f401);
     f421 = f418 + f419;
     f422 = f420 - f419;
     f423 = f403 + f405;
-    f424 = 1.3065629648763766 * f403;
-    f425 = (-0.9238795325112866) * f423;
-    f426 = (-0.5411961001461967) * f405;
+    f424 = MUL_C(COEF_CONST(1.3065629648763766), f403);
+    f425 = MUL_F(FRAC_CONST(-0.9238795325112866), f423);
+    f426 = MUL_F(FRAC_CONST(-0.5411961001461967), f405);
     f427 = f424 + f425;
     f428 = f426 - f425;
     f429 = f407 + f409;
-    f430 = 0.5411961001461969 * f407;
-    f431 = 0.3826834323650898 * f429;
-    f432 = 1.3065629648763766 * f409;
+    f430 = MUL_F(FRAC_CONST(0.5411961001461969), f407);
+    f431 = MUL_F(FRAC_CONST(0.3826834323650898), f429);
+    f432 = MUL_C(COEF_CONST(1.3065629648763766), f409);
     f433 = f430 + f431;
     f434 = f432 - f431;
     f435 = f400 - f396;
@@ -2587,27 +2025,27 @@
     f450 = f427 + f433;
     f451 = f435 - f437;
     f452 = f435 + f437;
-    f453 = 0.7071067811865474 * f451;
-    f454 = 0.7071067811865474 * f452;
+    f453 = MUL_F(FRAC_CONST(0.7071067811865474), f451);
+    f454 = MUL_F(FRAC_CONST(0.7071067811865474), f452);
     f455 = f439 - f441;
     f456 = f439 + f441;
-    f457 = 0.7071067811865474 * f455;
-    f458 = 0.7071067811865474 * f456;
+    f457 = MUL_F(FRAC_CONST(0.7071067811865474), f455);
+    f458 = MUL_F(FRAC_CONST(0.7071067811865474), f456);
     f459 = f443 - f445;
     f460 = f443 + f445;
-    f461 = 0.7071067811865474 * f459;
-    f462 = 0.7071067811865474 * f460;
+    f461 = MUL_F(FRAC_CONST(0.7071067811865474), f459);
+    f462 = MUL_F(FRAC_CONST(0.7071067811865474), f460);
     f463 = f447 - f449;
     f464 = f447 + f449;
-    f465 = 0.7071067811865474 * f463;
-    f466 = 0.7071067811865474 * f464;
-    f467 = 0.7071067811865476 * t2[31];
+    f465 = MUL_F(FRAC_CONST(0.7071067811865474), f463);
+    f466 = MUL_F(FRAC_CONST(0.7071067811865474), f464);
+    f467 = MUL_F(FRAC_CONST(0.7071067811865476), t2[31]);
     f468 = t2[63] - f467;
     f469 = t2[63] + f467;
     f470 = t2[47] + t2[15];
-    f471 = 1.3065629648763766 * t2[47];
-    f472 = (-0.9238795325112866) * f470;
-    f473 = (-0.5411961001461967) * t2[15];
+    f471 = MUL_C(COEF_CONST(1.3065629648763766), t2[47]);
+    f472 = MUL_F(FRAC_CONST(-0.9238795325112866), f470);
+    f473 = MUL_F(FRAC_CONST(-0.5411961001461967), t2[15]);
     f474 = f471 + f472;
     f475 = f473 - f472;
     f476 = f469 - f475;
@@ -2615,23 +2053,23 @@
     f478 = f468 - f474;
     f479 = f468 + f474;
     f480 = t2[55] + t2[7];
-    f481 = 1.1758756024193588 * t2[55];
-    f482 = (-0.9807852804032304) * f480;
-    f483 = (-0.7856949583871021) * t2[7];
+    f481 = MUL_C(COEF_CONST(1.1758756024193588), t2[55]);
+    f482 = MUL_F(FRAC_CONST(-0.9807852804032304), f480);
+    f483 = MUL_F(FRAC_CONST(-0.7856949583871021), t2[7]);
     f484 = f481 + f482;
     f485 = f483 - f482;
     f486 = t2[39] + t2[23];
-    f487 = 1.3870398453221473 * t2[39];
-    f488 = (-0.8314696123025455) * f486;
-    f489 = (-0.2758993792829436) * t2[23];
+    f487 = MUL_C(COEF_CONST(1.3870398453221473), t2[39]);
+    f488 = MUL_F(FRAC_CONST(-0.8314696123025455), f486);
+    f489 = MUL_F(FRAC_CONST(-0.2758993792829436), t2[23]);
     f490 = f487 + f488;
     f491 = f489 - f488;
     f492 = f485 - f491;
     f493 = f485 + f491;
-    f494 = 0.7071067811865476 * f492;
+    f494 = MUL_F(FRAC_CONST(0.7071067811865476), f492);
     f495 = f484 - f490;
     f496 = f484 + f490;
-    f497 = 0.7071067811865476 * f496;
+    f497 = MUL_F(FRAC_CONST(0.7071067811865476), f496);
     f498 = f494 - f497;
     f499 = f494 + f497;
     f500 = f477 - f493;
@@ -2643,27 +2081,27 @@
     f506 = f476 - f495;
     f507 = f476 + f495;
     f508 = t2[59] + t2[3];
-    f509 = 1.0932018670017569 * t2[59];
-    f510 = (-0.9951847266721969) * f508;
-    f511 = (-0.8971675863426368) * t2[3];
+    f509 = MUL_C(COEF_CONST(1.0932018670017569), t2[59]);
+    f510 = MUL_F(FRAC_CONST(-0.9951847266721969), f508);
+    f511 = MUL_F(FRAC_CONST(-0.8971675863426368), t2[3]);
     f512 = f509 + f510;
     f513 = f511 - f510;
     f514 = t2[51] + t2[11];
-    f515 = 1.2472250129866711 * t2[51];
-    f516 = (-0.9569403357322089) * f514;
-    f517 = (-0.6666556584777469) * t2[11];
+    f515 = MUL_C(COEF_CONST(1.2472250129866711), t2[51]);
+    f516 = MUL_F(FRAC_CONST(-0.9569403357322089), f514);
+    f517 = MUL_F(FRAC_CONST(-0.6666556584777469), t2[11]);
     f518 = f515 + f516;
     f519 = f517 - f516;
     f520 = t2[43] + t2[19];
-    f521 = 1.3533180011743526 * t2[43];
-    f522 = (-0.8819212643483551) * f520;
-    f523 = (-0.4105245275223575) * t2[19];
+    f521 = MUL_C(COEF_CONST(1.3533180011743526), t2[43]);
+    f522 = MUL_F(FRAC_CONST(-0.8819212643483551), f520);
+    f523 = MUL_F(FRAC_CONST(-0.4105245275223575), t2[19]);
     f524 = f521 + f522;
     f525 = f523 - f522;
     f526 = t2[35] + t2[27];
-    f527 = 1.4074037375263826 * t2[35];
-    f528 = (-0.7730104533627369) * f526;
-    f529 = (-0.1386171691990913) * t2[27];
+    f527 = MUL_C(COEF_CONST(1.4074037375263826), t2[35]);
+    f528 = MUL_F(FRAC_CONST(-0.7730104533627369), f526);
+    f529 = MUL_F(FRAC_CONST(-0.1386171691990913), t2[27]);
     f530 = f527 + f528;
     f531 = f529 - f528;
     f532 = f513 - f531;
@@ -2672,11 +2110,11 @@
     f535 = f519 + f525;
     f536 = f533 - f535;
     f537 = f533 + f535;
-    f538 = 0.7071067811865476 * f536;
+    f538 = MUL_F(FRAC_CONST(0.7071067811865476), f536);
     f539 = f532 + f534;
-    f540 = 1.3065629648763766 * f532;
-    f541 = (-0.9238795325112866) * f539;
-    f542 = (-0.5411961001461967) * f534;
+    f540 = MUL_C(COEF_CONST(1.3065629648763766), f532);
+    f541 = MUL_F(FRAC_CONST(-0.9238795325112866), f539);
+    f542 = MUL_F(FRAC_CONST(-0.5411961001461967), f534);
     f543 = f540 + f541;
     f544 = f542 - f541;
     f545 = f512 - f530;
@@ -2684,14 +2122,14 @@
     f547 = f518 - f524;
     f548 = f518 + f524;
     f549 = f546 + f548;
-    f550 = 1.3065629648763770 * f546;
-    f551 = (-0.3826834323650904) * f549;
-    f552 = 0.5411961001461961 * f548;
+    f550 = MUL_C(COEF_CONST(1.3065629648763770), f546);
+    f551 = MUL_F(FRAC_CONST(-0.3826834323650904), f549);
+    f552 = MUL_F(FRAC_CONST(0.5411961001461961), f548);
     f553 = f550 + f551;
     f554 = f552 - f551;
     f555 = f545 - f547;
     f556 = f545 + f547;
-    f557 = 0.7071067811865476 * f556;
+    f557 = MUL_F(FRAC_CONST(0.7071067811865476), f556);
     f558 = f544 - f554;
     f559 = f544 + f554;
     f560 = f538 - f557;
@@ -2747,195 +2185,195 @@
     f610 = f564 - f436;
     f611 = f436 + f564;
     f612 = f581 + f276;
-    f613 = (-0.9876531635534246) * f581;
-    f614 = 0.9999247018391445 * f612;
-    f615 = 1.0121962401248645 * f276;
+    f613 = MUL_F(FRAC_CONST(-0.9876531635534246), f581);
+    f614 = MUL_F(FRAC_CONST(0.9999247018391445), f612);
+    f615 = MUL_C(COEF_CONST(1.0121962401248645), f276);
     y[0] = f613 + f614;
     y[63] = f615 - f614;
     f618 = f583 + f278;
-    f619 = (-0.9625151616469906) * f583;
-    f620 = 0.9993223845883495 * f618;
-    f621 = 1.0361296075297086 * f278;
+    f619 = MUL_F(FRAC_CONST(-0.9625151616469906), f583);
+    f620 = MUL_F(FRAC_CONST(0.9993223845883495), f618);
+    f621 = MUL_C(COEF_CONST(1.0361296075297086), f278);
     y[1] = f619 + f620;
     y[62] = f621 - f620;
     f624 = f585 + f280;
-    f625 = (-0.9367973765979405) * f585;
-    f626 = 0.9981181129001492 * f624;
-    f627 = 1.0594388492023579 * f280;
+    f625 = MUL_F(FRAC_CONST(-0.9367973765979405), f585);
+    f626 = MUL_F(FRAC_CONST(0.9981181129001492), f624);
+    f627 = MUL_C(COEF_CONST(1.0594388492023579), f280);
     y[2] = f625 + f626;
     y[61] = f627 - f626;
     f630 = f587 + f282;
-    f631 = (-0.9105152998383381) * f587;
-    f632 = 0.9963126121827780 * f630;
-    f633 = 1.0821099245272179 * f282;
+    f631 = MUL_F(FRAC_CONST(-0.9105152998383381), f587);
+    f632 = MUL_F(FRAC_CONST(0.9963126121827780), f630);
+    f633 = MUL_C(COEF_CONST(1.0821099245272179), f282);
     y[3] = f631 + f632;
     y[60] = f633 - f632;
     f636 = f589 + f284;
-    f637 = (-0.8836847627084729) * f589;
-    f638 = 0.9939069700023561 * f636;
-    f639 = 1.1041291772962392 * f284;
+    f637 = MUL_F(FRAC_CONST(-0.8836847627084729), f589);
+    f638 = MUL_F(FRAC_CONST(0.9939069700023561), f636);
+    f639 = MUL_C(COEF_CONST(1.1041291772962392), f284);
     y[4] = f637 + f638;
     y[59] = f639 - f638;
     f642 = f591 + f286;
-    f643 = (-0.8563219269206538) * f591;
-    f644 = 0.9909026354277800 * f642;
-    f645 = 1.1254833439349063 * f286;
+    f643 = MUL_F(FRAC_CONST(-0.8563219269206538), f591);
+    f644 = MUL_F(FRAC_CONST(0.9909026354277800), f642);
+    f645 = MUL_C(COEF_CONST(1.1254833439349063), f286);
     y[5] = f643 + f644;
     y[58] = f645 - f644;
     f648 = f593 + f288;
-    f649 = (-0.8284432748239970) * f593;
-    f650 = 0.9873014181578584 * f648;
-    f651 = 1.1461595614917197 * f288;
+    f649 = MUL_F(FRAC_CONST(-0.8284432748239970), f593);
+    f650 = MUL_F(FRAC_CONST(0.9873014181578584), f648);
+    f651 = MUL_C(COEF_CONST(1.1461595614917197), f288);
     y[6] = f649 + f650;
     y[57] = f651 - f650;
     f654 = f595 + f290;
-    f655 = (-0.8000655994760753) * f595;
-    f656 = 0.9831054874312163 * f654;
-    f657 = 1.1661453753863573 * f290;
+    f655 = MUL_F(FRAC_CONST(-0.8000655994760753), f595);
+    f656 = MUL_F(FRAC_CONST(0.9831054874312163), f654);
+    f657 = MUL_C(COEF_CONST(1.1661453753863573), f290);
     y[7] = f655 + f656;
     y[56] = f657 - f656;
     f660 = f597 + f292;
-    f661 = (-0.7712059945274091) * f597;
-    f662 = 0.9783173707196277 * f660;
-    f663 = 1.1854287469118463 * f292;
+    f661 = MUL_F(FRAC_CONST(-0.7712059945274091), f597);
+    f662 = MUL_F(FRAC_CONST(0.9783173707196277), f660);
+    f663 = MUL_C(COEF_CONST(1.1854287469118463), f292);
     y[8] = f661 + f662;
     y[55] = f663 - f662;
     f666 = f599 + f294;
-    f667 = (-0.7418818439248888) * f599;
-    f668 = 0.9729399522055601 * f666;
-    f669 = 1.2039980604862313 * f294;
+    f667 = MUL_F(FRAC_CONST(-0.7418818439248888), f599);
+    f668 = MUL_F(FRAC_CONST(0.9729399522055601), f666);
+    f669 = MUL_C(COEF_CONST(1.2039980604862313), f294);
     y[9] = f667 + f668;
     y[54] = f669 - f668;
     f672 = f601 + f296;
-    f673 = (-0.7121108114403374) * f601;
-    f674 = 0.9669764710448521 * f672;
-    f675 = 1.2218421306493668 * f296;
+    f673 = MUL_F(FRAC_CONST(-0.7121108114403374), f601);
+    f674 = MUL_F(FRAC_CONST(0.9669764710448521), f672);
+    f675 = MUL_C(COEF_CONST(1.2218421306493668), f296);
     y[10] = f673 + f674;
     y[53] = f675 - f674;
     f678 = f603 + f298;
-    f679 = (-0.6819108300305128) * f603;
-    f680 = 0.9604305194155658 * f678;
-    f681 = 1.2389502088006188 * f298;
+    f679 = MUL_F(FRAC_CONST(-0.6819108300305128), f603);
+    f680 = MUL_F(FRAC_CONST(0.9604305194155658), f678);
+    f681 = MUL_C(COEF_CONST(1.2389502088006188), f298);
     y[11] = f679 + f680;
     y[52] = f681 - f680;
     f684 = f605 + f300;
-    f685 = (-0.6513000910349656) * f605;
-    f686 = 0.9533060403541938 * f684;
-    f687 = 1.2553119896734219 * f300;
+    f685 = MUL_F(FRAC_CONST(-0.6513000910349656), f605);
+    f686 = MUL_F(FRAC_CONST(0.9533060403541938), f684);
+    f687 = MUL_C(COEF_CONST(1.2553119896734219), f300);
     y[12] = f685 + f686;
     y[51] = f687 - f686;
     f690 = f607 + f302;
-    f691 = (-0.6202970332182582) * f607;
-    f692 = 0.9456073253805213 * f690;
-    f693 = 1.2709176175427843 * f302;
+    f691 = MUL_F(FRAC_CONST(-0.6202970332182582), f607);
+    f692 = MUL_F(FRAC_CONST(0.9456073253805213), f690);
+    f693 = MUL_C(COEF_CONST(1.2709176175427843), f302);
     y[13] = f691 + f692;
     y[50] = f693 - f692;
     f696 = f609 + f304;
-    f697 = (-0.5889203316631404) * f609;
-    f698 = 0.9373390119125750 * f696;
-    f699 = 1.2857576921620095 * f304;
+    f697 = MUL_F(FRAC_CONST(-0.5889203316631404), f609);
+    f698 = MUL_F(FRAC_CONST(0.9373390119125750), f696);
+    f699 = MUL_C(COEF_CONST(1.2857576921620095), f304);
     y[14] = f697 + f698;
     y[49] = f699 - f698;
     f702 = f306 - f611;
-    f703 = (-0.5571888865213779) * f611;
-    f704 = 0.9285060804732155 * f702;
-    f705 = 1.2998232744250531 * f306;
+    f703 = MUL_F(FRAC_CONST(-0.5571888865213779), f611);
+    f704 = MUL_F(FRAC_CONST(0.9285060804732155), f702);
+    f705 = MUL_C(COEF_CONST(1.2998232744250531), f306);
     y[15] = f704 - f703;
     y[48] = f705 - f704;
     f708 = f610 + f305;
-    f709 = (-0.5251218116290097) * f610;
-    f710 = 0.9191138516900578 * f708;
-    f711 = 1.3131058917511058 * f305;
+    f709 = MUL_F(FRAC_CONST(-0.5251218116290097), f610);
+    f710 = MUL_F(FRAC_CONST(0.9191138516900578), f708);
+    f711 = MUL_C(COEF_CONST(1.3131058917511058), f305);
     y[16] = f709 + f710;
     y[47] = f711 - f710;
     f714 = f608 + f303;
-    f715 = (-0.4927384229928850) * f608;
-    f716 = 0.9091679830905223 * f714;
-    f717 = 1.3255975431881595 * f303;
+    f715 = MUL_F(FRAC_CONST(-0.4927384229928850), f608);
+    f716 = MUL_F(FRAC_CONST(0.9091679830905223), f714);
+    f717 = MUL_C(COEF_CONST(1.3255975431881595), f303);
     y[17] = f715 + f716;
     y[46] = f717 - f716;
     f720 = f606 + f301;
-    f721 = (-0.4600582271554261) * f606;
-    f722 = 0.8986744656939538 * f720;
-    f723 = 1.3372907042324815 * f301;
+    f721 = MUL_F(FRAC_CONST(-0.4600582271554261), f606);
+    f722 = MUL_F(FRAC_CONST(0.8986744656939538), f720);
+    f723 = MUL_C(COEF_CONST(1.3372907042324815), f301);
     y[18] = f721 + f722;
     y[45] = f723 - f722;
     f726 = f604 + f299;
-    f727 = (-0.4271009094446139) * f604;
-    f728 = 0.8876396204028539 * f726;
-    f729 = 1.3481783313610940 * f299;
+    f727 = MUL_F(FRAC_CONST(-0.4271009094446139), f604);
+    f728 = MUL_F(FRAC_CONST(0.8876396204028539), f726);
+    f729 = MUL_C(COEF_CONST(1.3481783313610940), f299);
     y[19] = f727 + f728;
     y[44] = f729 - f728;
     f732 = f602 + f297;
-    f733 = (-0.3938863221162838) * f602;
-    f734 = 0.8760700941954066 * f732;
-    f735 = 1.3582538662745294 * f297;
+    f733 = MUL_F(FRAC_CONST(-0.3938863221162838), f602);
+    f734 = MUL_F(FRAC_CONST(0.8760700941954066), f732);
+    f735 = MUL_C(COEF_CONST(1.3582538662745294), f297);
     y[20] = f733 + f734;
     y[43] = f735 - f734;
     f738 = f600 + f295;
-    f739 = (-0.3604344723958691) * f600;
-    f740 = 0.8639728561215867 * f738;
-    f741 = 1.3675112398473042 * f295;
+    f739 = MUL_F(FRAC_CONST(-0.3604344723958691), f600);
+    f740 = MUL_F(FRAC_CONST(0.8639728561215867), f738);
+    f741 = MUL_C(COEF_CONST(1.3675112398473042), f295);
     y[21] = f739 + f740;
     y[42] = f741 - f740;
     f744 = f598 + f293;
-    f745 = (-0.3267655104267964) * f598;
-    f746 = 0.8513551931052652 * f744;
-    f747 = 1.3759448757837340 * f293;
+    f745 = MUL_F(FRAC_CONST(-0.3267655104267964), f598);
+    f746 = MUL_F(FRAC_CONST(0.8513551931052652), f744);
+    f747 = MUL_C(COEF_CONST(1.3759448757837340), f293);
     y[22] = f745 + f746;
     y[41] = f747 - f746;
     f750 = f596 + f291;
-    f751 = (-0.2928997171327915) * f596;
-    f752 = 0.8382247055548380 * f750;
-    f753 = 1.3835496939768843 * f291;
+    f751 = MUL_F(FRAC_CONST(-0.2928997171327915), f596);
+    f752 = MUL_F(FRAC_CONST(0.8382247055548380), f750);
+    f753 = MUL_C(COEF_CONST(1.3835496939768843), f291);
     y[23] = f751 + f752;
     y[40] = f753 - f752;
     f756 = f594 + f289;
-    f757 = (-0.2588574920014121) * f594;
-    f758 = 0.8245893027850253 * f756;
-    f759 = 1.3903211135686386 * f289;
+    f757 = MUL_F(FRAC_CONST(-0.2588574920014121), f594);
+    f758 = MUL_F(FRAC_CONST(0.8245893027850253), f756);
+    f759 = MUL_C(COEF_CONST(1.3903211135686386), f289);
     y[24] = f757 + f758;
     y[39] = f759 - f758;
     f762 = f592 + f287;
-    f763 = (-0.2246593407961559) * f592;
-    f764 = 0.8104571982525948 * f762;
-    f765 = 1.3962550557090336 * f287;
+    f763 = MUL_F(FRAC_CONST(-0.2246593407961559), f592);
+    f764 = MUL_F(FRAC_CONST(0.8104571982525948), f762);
+    f765 = MUL_C(COEF_CONST(1.3962550557090336), f287);
     y[25] = f763 + f764;
     y[38] = f765 - f764;
     f768 = f590 + f285;
-    f769 = (-0.1903258632045579) * f590;
-    f770 = 0.7958369046088835 * f768;
-    f771 = 1.4013479460132090 * f285;
+    f769 = MUL_F(FRAC_CONST(-0.1903258632045579), f590);
+    f770 = MUL_F(FRAC_CONST(0.7958369046088835), f768);
+    f771 = MUL_C(COEF_CONST(1.4013479460132090), f285);
     y[26] = f769 + f770;
     y[37] = f771 - f770;
     f774 = f588 + f283;
-    f775 = (-0.1558777404297079) * f588;
-    f776 = 0.7807372285720944 * f774;
-    f777 = 1.4055967167144807 * f283;
+    f775 = MUL_F(FRAC_CONST(-0.1558777404297079), f588);
+    f776 = MUL_F(FRAC_CONST(0.7807372285720944), f774);
+    f777 = MUL_C(COEF_CONST(1.4055967167144807), f283);
     y[27] = f775 + f776;
     y[36] = f777 - f776;
     f780 = f586 + f281;
-    f781 = (-0.1213357227326675) * f586;
-    f782 = 0.7651672656224590 * f780;
-    f783 = 1.4089988085122505 * f281;
+    f781 = MUL_F(FRAC_CONST(-0.1213357227326675), f586);
+    f782 = MUL_F(FRAC_CONST(0.7651672656224590), f780);
+    f783 = MUL_C(COEF_CONST(1.4089988085122505), f281);
     y[28] = f781 + f782;
     y[35] = f783 - f782;
     f786 = f584 + f279;
-    f787 = (-0.0867206169332875) * f584;
-    f788 = 0.7491363945234593 * f786;
-    f789 = 1.4115521721136310 * f279;
+    f787 = MUL_F(FRAC_CONST(-0.0867206169332875), f584);
+    f788 = MUL_F(FRAC_CONST(0.7491363945234593), f786);
+    f789 = MUL_C(COEF_CONST(1.4115521721136310), f279);
     y[29] = f787 + f788;
     y[34] = f789 - f788;
     f792 = f582 + f277;
-    f793 = (-0.0520532738769597) * f582;
-    f794 = 0.7326542716724128 * f792;
-    f795 = 1.4132552694678659 * f277;
+    f793 = MUL_F(FRAC_CONST(-0.0520532738769597), f582);
+    f794 = MUL_F(FRAC_CONST(0.7326542716724128), f792);
+    f795 = MUL_C(COEF_CONST(1.4132552694678659), f277);
     y[30] = f793 + f794;
     y[33] = f795 - f794;
     f798 = f580 + f275;
-    f799 = (-0.0173545758748457) * f580;
-    f800 = 0.7157308252838186 * f798;
-    f801 = 1.4141070746927915 * f275;
+    f799 = MUL_F(FRAC_CONST(-0.0173545758748457), f580);
+    f800 = MUL_F(FRAC_CONST(0.7157308252838186), f798);
+    f801 = MUL_C(COEF_CONST(1.4141070746927915), f275);
     y[31] = f799 + f800;
     y[32] = f801 - f800;
 }
@@ -2942,342 +2380,40 @@
 
 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;
+    real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9;
+    real_t f10, f11, f12, f13, f14, f15, f16, f17, f18, f19;
+    real_t f20, f21, f22, f23, f24, f25, f26, f27, f28, f29;
+    real_t f30, f31, f32, f33, f34, f35, f36, f37, f38, f39;
+    real_t f40, f41, f42, f43, f44, f45, f46, f47, f48, f49;
+    real_t f50, f51, f52, f53, f54, f55, f56, f57, f58, f59;
+    real_t f60, f61, f62, f63, f64, f65, f66, f67, f68, f69;
+    real_t f70, f71, f72, f73, f74, f75, f76, f77, f78, f79;
+    real_t f80, f81, f82, f83, f84, f85, f86, f87, f88, f89;
+    real_t f90, f91, f92, f93, f94, f95, f96, f97, f98, f99;
+    real_t f100, f101, f102, f103, f104, f105, f106, f107, f108, f109;
+    real_t f110, f111, f112, f113, f114, f115, f116, f117, f118, f119;
+    real_t f120, f121, f122, f123, f124, f125, f126, f127, f128, f129;
+    real_t f130, f131, f132, f133, f134, f135, f136, f137, f138, f139;
+    real_t f140, f141, f142, f143, f144, f145, f146, f147, f148, f149;
+    real_t f150, f151, f152, f153, f154, f155, f156, f157, f158, f159;
+    real_t f160, f161, f162, f163, f164, f165, f166, f167, f168, f169;
+    real_t f170, f171, f172, f173, f174, f175, f176, f177, f178, f179;
+    real_t f180, f181, f182, f183, f184, f185, f186, f187, f188, f189;
+    real_t f190, f191, f192, f193, f194, f195, f196, f197, f198, f199;
+    real_t f200, f201, f202, f203, f204, f205, f206, f207, f208, f209;
+    real_t f210, f211, f212, f213, f214, f215, f216, f217, f218, f219;
+    real_t f220, f221, f222, f223, f224, f225, f226, f227, f228, f229;
+    real_t f230, f231, f232, f233, f234, f235, f236, f237, f238, f239;
+    real_t f240, f241, f242, f243, f244, f245, f246, f247, f248, f249;
+    real_t f250, f251, f252, f253, f254, f255, f256, f257, f258, f259;
+    real_t f260, f261, f262, f263, f264, f265, f266, f267, f268, f269;
+    real_t f270, f271, f272, f273, f274, f275, f276, f277, f278, f279;
+    real_t f280, f281, f282, f283, f284, f285, f286, f287, f288, f289;
+    real_t f290, f291, f292, f293, f294, f295, f296, f297, f298, f299;
+    real_t f300, f301, f302, f303, f304, f305, f306, f307, f308, f309;
+    real_t f310, f311, f312, f313, f314, f315, f316, f317, f318, f319;
+    real_t f320, f321, f322, f323, f324, f325, f326, f327, f328, f329;
+    real_t f330, f331, f332, f333, f334, f335;
 
     f0 = x[0] - x[1];
     f1 = x[2] - x[1];
@@ -3310,13 +2446,13 @@
     f28 = x[28] - x[29];
     f29 = x[30] - x[29];
     f30 = x[30] - x[31];
-    f31 = 0.7071067811865476 * f15;
+    f31 = MUL_F(FRAC_CONST(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;
+    f35 = MUL_C(COEF_CONST(1.3065629648763766), f7);
+    f36 = MUL_F(FRAC_CONST(-0.9238795325112866), f34);
+    f37 = MUL_F(FRAC_CONST(-0.5411961001461967), f23);
     f38 = f35 + f36;
     f39 = f37 - f36;
     f40 = f33 - f39;
@@ -3325,22 +2461,22 @@
     f43 = f32 + f38;
     f44 = f11 - f19;
     f45 = f11 + f19;
-    f46 = 0.7071067811865476 * f45;
+    f46 = MUL_F(FRAC_CONST(0.7071067811865476), f45);
     f47 = f3 - f46;
     f48 = f3 + f46;
-    f49 = 0.7071067811865476 * f44;
+    f49 = MUL_F(FRAC_CONST(0.7071067811865476), f44);
     f50 = f49 - f27;
     f51 = f49 + f27;
     f52 = f51 + f48;
-    f53 = (-0.7856949583871021) * f51;
-    f54 = 0.9807852804032304 * f52;
-    f55 = 1.1758756024193588 * f48;
+    f53 = MUL_F(FRAC_CONST(-0.7856949583871021), f51);
+    f54 = MUL_F(FRAC_CONST(0.9807852804032304), f52);
+    f55 = MUL_C(COEF_CONST(1.1758756024193588), f48);
     f56 = f53 + f54;
     f57 = f55 - f54;
     f58 = f50 + f47;
-    f59 = (-0.2758993792829430) * f50;
-    f60 = 0.8314696123025452 * f58;
-    f61 = 1.3870398453221475 * f47;
+    f59 = MUL_F(FRAC_CONST(-0.2758993792829430), f50);
+    f60 = MUL_F(FRAC_CONST(0.8314696123025452), f58);
+    f61 = MUL_C(COEF_CONST(1.3870398453221475), f47);
     f62 = f59 + f60;
     f63 = f61 - f60;
     f64 = f41 - f56;
@@ -3357,13 +2493,13 @@
     f75 = f13 + f17;
     f76 = f21 - f25;
     f77 = f21 + f25;
-    f78 = 0.7071067811865476 * f75;
+    f78 = MUL_F(FRAC_CONST(0.7071067811865476), f75);
     f79 = f1 - f78;
     f80 = f1 + f78;
     f81 = f73 + f77;
-    f82 = 1.3065629648763766 * f73;
-    f83 = (-0.9238795325112866) * f81;
-    f84 = (-0.5411961001461967) * f77;
+    f82 = MUL_C(COEF_CONST(1.3065629648763766), f73);
+    f83 = MUL_F(FRAC_CONST(-0.9238795325112866), f81);
+    f84 = MUL_F(FRAC_CONST(-0.5411961001461967), f77);
     f85 = f82 + f83;
     f86 = f84 - f83;
     f87 = f80 - f86;
@@ -3370,13 +2506,13 @@
     f88 = f80 + f86;
     f89 = f79 - f85;
     f90 = f79 + f85;
-    f91 = 0.7071067811865476 * f74;
+    f91 = MUL_F(FRAC_CONST(0.7071067811865476), f74);
     f92 = f29 - f91;
     f93 = f29 + f91;
     f94 = f76 + f72;
-    f95 = 1.3065629648763766 * f76;
-    f96 = (-0.9238795325112866) * f94;
-    f97 = (-0.5411961001461967) * f72;
+    f95 = MUL_C(COEF_CONST(1.3065629648763766), f76);
+    f96 = MUL_F(FRAC_CONST(-0.9238795325112866), f94);
+    f97 = MUL_F(FRAC_CONST(-0.5411961001461967), f72);
     f98 = f95 + f96;
     f99 = f97 - f96;
     f100 = f93 - f99;
@@ -3384,27 +2520,27 @@
     f102 = f92 - f98;
     f103 = f92 + f98;
     f104 = f101 + f88;
-    f105 = (-0.8971675863426361) * f101;
-    f106 = 0.9951847266721968 * f104;
-    f107 = 1.0932018670017576 * f88;
+    f105 = MUL_F(FRAC_CONST(-0.8971675863426361), f101);
+    f106 = MUL_F(FRAC_CONST(0.9951847266721968), f104);
+    f107 = MUL_C(COEF_CONST(1.0932018670017576), f88);
     f108 = f105 + f106;
     f109 = f107 - f106;
     f110 = f90 - f103;
-    f111 = (-0.6666556584777466) * f103;
-    f112 = 0.9569403357322089 * f110;
-    f113 = 1.2472250129866713 * f90;
+    f111 = MUL_F(FRAC_CONST(-0.6666556584777466), f103);
+    f112 = MUL_F(FRAC_CONST(0.9569403357322089), f110);
+    f113 = MUL_C(COEF_CONST(1.2472250129866713), f90);
     f114 = f112 - f111;
     f115 = f113 - f112;
     f116 = f102 + f89;
-    f117 = (-0.4105245275223571) * f102;
-    f118 = 0.8819212643483549 * f116;
-    f119 = 1.3533180011743529 * f89;
+    f117 = MUL_F(FRAC_CONST(-0.4105245275223571), f102);
+    f118 = MUL_F(FRAC_CONST(0.8819212643483549), f116);
+    f119 = MUL_C(COEF_CONST(1.3533180011743529), f89);
     f120 = f117 + f118;
     f121 = f119 - f118;
     f122 = f87 - f100;
-    f123 = (-0.1386171691990915) * f100;
-    f124 = 0.7730104533627370 * f122;
-    f125 = 1.4074037375263826 * f87;
+    f123 = MUL_F(FRAC_CONST(-0.1386171691990915), f100);
+    f124 = MUL_F(FRAC_CONST(0.7730104533627370), f122);
+    f125 = MUL_C(COEF_CONST(1.4074037375263826), f87);
     f126 = f124 - f123;
     f127 = f125 - f124;
     f128 = f65 - f108;
@@ -3424,51 +2560,51 @@
     f142 = f64 - f109;
     f143 = f64 + f109;
     f144 = f0 + f30;
-    f145 = 1.0478631305325901 * f0;
-    f146 = (-0.9987954562051724) * f144;
-    f147 = (-0.9497277818777548) * f30;
+    f145 = MUL_C(COEF_CONST(1.0478631305325901), f0);
+    f146 = MUL_F(FRAC_CONST(-0.9987954562051724), f144);
+    f147 = MUL_F(FRAC_CONST(-0.9497277818777548), f30);
     f148 = f145 + f146;
     f149 = f147 - f146;
     f150 = f4 + f26;
-    f151 = 1.2130114330978077 * f4;
-    f152 = (-0.9700312531945440) * f150;
-    f153 = (-0.7270510732912803) * f26;
+    f151 = MUL_F(FRAC_CONST(1.2130114330978077), f4);
+    f152 = MUL_F(FRAC_CONST(-0.9700312531945440), f150);
+    f153 = MUL_F(FRAC_CONST(-0.7270510732912803), f26);
     f154 = f151 + f152;
     f155 = f153 - f152;
     f156 = f8 + f22;
-    f157 = 1.3315443865537255 * f8;
-    f158 = (-0.9039892931234433) * f156;
-    f159 = (-0.4764341996931612) * f22;
+    f157 = MUL_C(COEF_CONST(1.3315443865537255), f8);
+    f158 = MUL_F(FRAC_CONST(-0.9039892931234433), f156);
+    f159 = MUL_F(FRAC_CONST(-0.4764341996931612), f22);
     f160 = f157 + f158;
     f161 = f159 - f158;
     f162 = f12 + f18;
-    f163 = 1.3989068359730781 * f12;
-    f164 = (-0.8032075314806453) * f162;
-    f165 = (-0.2075082269882124) * f18;
+    f163 = MUL_C(COEF_CONST(1.3989068359730781), f12);
+    f164 = MUL_F(FRAC_CONST(-0.8032075314806453), f162);
+    f165 = MUL_F(FRAC_CONST(-0.2075082269882124), f18);
     f166 = f163 + f164;
     f167 = f165 - f164;
     f168 = f16 + f14;
-    f169 = 1.4125100802019777 * f16;
-    f170 = (-0.6715589548470187) * f168;
-    f171 = 0.0693921705079402 * f14;
+    f169 = MUL_C(COEF_CONST(1.4125100802019777), f16);
+    f170 = MUL_F(FRAC_CONST(-0.6715589548470187), f168);
+    f171 = MUL_F(FRAC_CONST(0.0693921705079402), f14);
     f172 = f169 + f170;
     f173 = f171 - f170;
     f174 = f20 + f10;
-    f175 = 1.3718313541934939 * f20;
-    f176 = (-0.5141027441932219) * f174;
-    f177 = 0.3436258658070501 * f10;
+    f175 = MUL_C(COEF_CONST(1.3718313541934939), f20);
+    f176 = MUL_F(FRAC_CONST(-0.5141027441932219), f174);
+    f177 = MUL_F(FRAC_CONST(0.3436258658070501), f10);
     f178 = f175 + f176;
     f179 = f177 - f176;
     f180 = f24 + f6;
-    f181 = 1.2784339185752409 * f24;
-    f182 = (-0.3368898533922200) * f180;
-    f183 = 0.6046542117908008 * f6;
+    f181 = MUL_C(COEF_CONST(1.2784339185752409), f24);
+    f182 = MUL_F(FRAC_CONST(-0.3368898533922200), f180);
+    f183 = MUL_F(FRAC_CONST(0.6046542117908008), f6);
     f184 = f181 + f182;
     f185 = f183 - f182;
     f186 = f28 + f2;
-    f187 = 1.1359069844201433 * f28;
-    f188 = (-0.1467304744553624) * f186;
-    f189 = 0.8424460355094185 * f2;
+    f187 = MUL_C(COEF_CONST(1.1359069844201433), f28);
+    f188 = MUL_F(FRAC_CONST(-0.1467304744553624), f186);
+    f189 = MUL_F(FRAC_CONST(0.8424460355094185), f2);
     f190 = f187 + f188;
     f191 = f189 - f188;
     f192 = f149 - f173;
@@ -3488,27 +2624,27 @@
     f206 = f166 - f190;
     f207 = f166 + f190;
     f208 = f192 + f194;
-    f209 = 1.1758756024193588 * f192;
-    f210 = (-0.9807852804032304) * f208;
-    f211 = (-0.7856949583871021) * f194;
+    f209 = MUL_C(COEF_CONST(1.1758756024193588), f192);
+    f210 = MUL_F(FRAC_CONST(-0.9807852804032304), f208);
+    f211 = MUL_F(FRAC_CONST(-0.7856949583871021), f194);
     f212 = f209 + f210;
     f213 = f211 - f210;
     f214 = f196 + f198;
-    f215 = 1.3870398453221475 * f196;
-    f216 = (-0.5555702330196022) * f214;
-    f217 = 0.2758993792829431 * f198;
+    f215 = MUL_C(COEF_CONST(1.3870398453221475), f196);
+    f216 = MUL_F(FRAC_CONST(-0.5555702330196022), f214);
+    f217 = MUL_F(FRAC_CONST(0.2758993792829431), f198);
     f218 = f215 + f216;
     f219 = f217 - f216;
     f220 = f200 + f202;
-    f221 = 0.7856949583871022 * f200;
-    f222 = 0.1950903220161283 * f220;
-    f223 = 1.1758756024193586 * f202;
+    f221 = MUL_F(FRAC_CONST(0.7856949583871022), f200);
+    f222 = MUL_F(FRAC_CONST(0.1950903220161283), f220);
+    f223 = MUL_C(COEF_CONST(1.1758756024193586), f202);
     f224 = f221 + f222;
     f225 = f223 - f222;
     f226 = f204 + f206;
-    f227 = (-0.2758993792829430) * f204;
-    f228 = 0.8314696123025452 * f226;
-    f229 = 1.3870398453221475 * f206;
+    f227 = MUL_F(FRAC_CONST(-0.2758993792829430), f204);
+    f228 = MUL_F(FRAC_CONST(0.8314696123025452), f226);
+    f229 = MUL_C(COEF_CONST(1.3870398453221475), f206);
     f230 = f227 + f228;
     f231 = f229 - f228;
     f232 = f193 - f201;
@@ -3528,27 +2664,27 @@
     f246 = f218 - f230;
     f247 = f218 + f230;
     f248 = f232 + f234;
-    f249 = 1.3065629648763766 * f232;
-    f250 = (-0.9238795325112866) * f248;
-    f251 = (-0.5411961001461967) * f234;
+    f249 = MUL_C(COEF_CONST(1.3065629648763766), f232);
+    f250 = MUL_F(FRAC_CONST(-0.9238795325112866), f248);
+    f251 = MUL_F(FRAC_CONST(-0.5411961001461967), f234);
     f252 = f249 + f250;
     f253 = f251 - f250;
     f254 = f236 + f238;
-    f255 = 0.5411961001461969 * f236;
-    f256 = 0.3826834323650898 * f254;
-    f257 = 1.3065629648763766 * f238;
+    f255 = MUL_F(FRAC_CONST(0.5411961001461969), f236);
+    f256 = MUL_F(FRAC_CONST(0.3826834323650898), f254);
+    f257 = MUL_C(COEF_CONST(1.3065629648763766), f238);
     f258 = f255 + f256;
     f259 = f257 - f256;
     f260 = f240 + f242;
-    f261 = 1.3065629648763766 * f240;
-    f262 = (-0.9238795325112866) * f260;
-    f263 = (-0.5411961001461967) * f242;
+    f261 = MUL_C(COEF_CONST(1.3065629648763766), f240);
+    f262 = MUL_F(FRAC_CONST(-0.9238795325112866), f260);
+    f263 = MUL_F(FRAC_CONST(-0.5411961001461967), f242);
     f264 = f261 + f262;
     f265 = f263 - f262;
     f266 = f244 + f246;
-    f267 = 0.5411961001461969 * f244;
-    f268 = 0.3826834323650898 * f266;
-    f269 = 1.3065629648763766 * f246;
+    f267 = MUL_F(FRAC_CONST(0.5411961001461969), f244);
+    f268 = MUL_F(FRAC_CONST(0.3826834323650898), f266);
+    f269 = MUL_C(COEF_CONST(1.3065629648763766), f246);
     f270 = f267 + f268;
     f271 = f269 - f268;
     f272 = f233 - f237;
@@ -3569,20 +2705,20 @@
     f287 = f264 + f270;
     f288 = f272 - f274;
     f289 = f272 + f274;
-    f290 = 0.7071067811865474 * f288;
-    f291 = 0.7071067811865474 * f289;
+    f290 = MUL_F(FRAC_CONST(0.7071067811865474), f288);
+    f291 = MUL_F(FRAC_CONST(0.7071067811865474), f289);
     f292 = f276 - f278;
     f293 = f276 + f278;
-    f294 = 0.7071067811865474 * f292;
-    f295 = 0.7071067811865474 * f293;
+    f294 = MUL_F(FRAC_CONST(0.7071067811865474), f292);
+    f295 = MUL_F(FRAC_CONST(0.7071067811865474), f293);
     f296 = f280 - f282;
     f297 = f280 + f282;
-    f298 = 0.7071067811865474 * f296;
-    f299 = 0.7071067811865474 * f297;
+    f298 = MUL_F(FRAC_CONST(0.7071067811865474), f296);
+    f299 = MUL_F(FRAC_CONST(0.7071067811865474), f297);
     f300 = f284 - f286;
     f301 = f284 + f286;
-    f302 = 0.7071067811865474 * f300;
-    f303 = 0.7071067811865474 * f301;
+    f302 = MUL_F(FRAC_CONST(0.7071067811865474), f300);
+    f303 = MUL_F(FRAC_CONST(0.7071067811865474), f301);
     f304 = f129 - f273;
     f305 = f129 + f273;
     f306 = f131 - f281;
@@ -3615,38 +2751,38 @@
     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;
+    y[31] = MUL_F(FRAC_CONST(0.5001506360206510), f305);
+    y[30] = MUL_F(FRAC_CONST(0.5013584524464084), f307);
+    y[29] = MUL_F(FRAC_CONST(0.5037887256810443), f309);
+    y[28] = MUL_F(FRAC_CONST(0.5074711720725553), f311);
+    y[27] = MUL_F(FRAC_CONST(0.5124514794082247), f313);
+    y[26] = MUL_F(FRAC_CONST(0.5187927131053328), f315);
+    y[25] = MUL_F(FRAC_CONST(0.5265773151542700), f317);
+    y[24] = MUL_F(FRAC_CONST(0.5359098169079920), f319);
+    y[23] = MUL_F(FRAC_CONST(0.5469204379855088), f321);
+    y[22] = MUL_F(FRAC_CONST(0.5597698129470802), f323);
+    y[21] = MUL_F(FRAC_CONST(0.5746551840326600), f325);
+    y[20] = MUL_F(FRAC_CONST(0.5918185358574165), f327);
+    y[19] = MUL_F(FRAC_CONST(0.6115573478825099), f329);
+    y[18] = MUL_F(FRAC_CONST(0.6342389366884031), f331);
+    y[17] = MUL_F(FRAC_CONST(0.6603198078137061), f333);
+    y[16] = MUL_F(FRAC_CONST(0.6903721282002123), f335);
+    y[15] = MUL_F(FRAC_CONST(0.7251205223771985), f334);
+    y[14] = MUL_F(FRAC_CONST(0.7654941649730891), f332);
+    y[13] = MUL_F(FRAC_CONST(0.8127020908144905), f330);
+    y[12] = MUL_F(FRAC_CONST(0.8683447152233481), f328);
+    y[11] = MUL_F(FRAC_CONST(0.9345835970364075), f326);
+    y[10] = MUL_C(COEF_CONST(1.0144082649970547), f324);
+    y[9] = MUL_C(COEF_CONST(1.1120716205797176), f322);
+    y[8] = MUL_C(COEF_CONST(1.2338327379765710), f320);
+    y[7] = MUL_C(COEF_CONST(1.3892939586328277), f318);
+    y[6] = MUL_C(COEF_CONST(1.5939722833856311), f316);
+    y[5] = MUL_C(COEF_CONST(1.8746759800084078), f314);
+    y[4] = MUL_C(COEF_CONST(2.2820500680051619), f312);
+    y[3] = MUL_C(COEF_CONST(2.9246284281582162), f310);
+    y[2] = MUL_C(COEF_CONST(4.0846110781292477), f308);
+    y[1] = MUL_C(COEF_CONST(6.7967507116736332), f306);
+    y[0] = MUL_R(REAL_CONST(20.3738781672314530), f304);
 }
 
 #endif
--- 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.26 2004/03/04 19:06:01 menno Exp $
+** $Id: sbr_dec.h,v 1.27 2004/03/10 19:45:41 menno Exp $
 **/
 
 #ifndef __SBR_DEC_H__
@@ -111,9 +111,6 @@
     int16_t E_prev[2][64];
     real_t E_orig[2][64][5];
     real_t E_curr[2][64][5];
-#ifdef FIXED_POINT
-    uint8_t E_curr_is_coef[2][64][5];
-#endif
     int32_t Q[2][64][2];
     real_t Q_div[2][64][2];
     real_t Q_div2[2][64][2];
--- 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.12 2004/02/26 09:29:28 menno Exp $
+** $Id: sbr_e_nf.c,v 1.13 2004/03/10 19:45:41 menno Exp $
 **/
 
 #include "common.h"
--- 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.10 2004/02/26 09:29:28 menno Exp $
+** $Id: sbr_e_nf.h,v 1.11 2004/03/10 19:45:41 menno Exp $
 **/
 
 #ifndef __SBR_E_NF_H__
--- 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.11 2004/02/26 09:29:28 menno Exp $
+** $Id: sbr_fbt.c,v 1.12 2004/03/10 19:45:41 menno Exp $
 **/
 
 /* Calculate frequency band tables */
@@ -224,7 +224,7 @@
     if (k2Diff)
     {
         incr = (k2Diff > 0) ? -1 : 1;
-        k = (k2Diff > 0) ? (nrBands-1) : 0;
+        k = (uint8_t) ((k2Diff > 0) ? (nrBands-1) : 0);
 
         while (k2Diff != 0)
         {
@@ -236,10 +236,10 @@
 
     sbr->f_master[0] = k0;
     for (k = 1; k <= nrBands; k++)
-        sbr->f_master[k] = sbr->f_master[k-1] + vDk[k-1];
+        sbr->f_master[k] = (uint8_t)(sbr->f_master[k-1] + vDk[k-1]);
 
-    sbr->N_master = nrBands;
-    sbr->N_master = min(sbr->N_master, 64);
+    sbr->N_master = (uint8_t)nrBands;
+    sbr->N_master = (min(sbr->N_master, 64));
 
 #if 0
     printf("f_master[%d]: ", nrBands);
@@ -259,15 +259,86 @@
 */
 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
 }
 
 /*
@@ -294,7 +365,11 @@
 
     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;
@@ -303,7 +378,7 @@
         k1 = k2;
     }
 
-    nrBand0 = 2 * find_bands(0, bands, k0, k1);
+    nrBand0 = (uint8_t)(2 * find_bands(0, bands, k0, k1));
     nrBand0 = min(nrBand0, 63);
     if (nrBand0 <= 0)
         return 1;
@@ -310,12 +385,21 @@
 
     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;
     }
 
@@ -333,7 +417,7 @@
     if (!twoRegions)
     {
         for (k = 0; k <= nrBand0; k++)
-            sbr->f_master[k] = vk0[k];
+            sbr->f_master[k] = (uint8_t) vk0[k];
 
         sbr->N_master = nrBand0;
         sbr->N_master = min(sbr->N_master, 64);
@@ -340,17 +424,26 @@
         return 0;
     }
 
-    nrBand1 = 2 * find_bands(1 /* warped */, bands, k1, k2);
+    nrBand1 = (uint8_t)(2 * find_bands(1 /* warped */, bands, k1, k2));
     nrBand1 = min(nrBand1, 63);
 
     q = find_initial_power(nrBand1, k1, k2);
     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;
     }
 
@@ -379,11 +472,11 @@
     sbr->N_master = min(sbr->N_master, 64);
     for (k = 0; k <= nrBand0; k++)
     {
-        sbr->f_master[k] = vk0[k];
+        sbr->f_master[k] =  (uint8_t) vk0[k];
     }
     for (k = nrBand0 + 1; k <= sbr->N_master; k++)
     {
-        sbr->f_master[k] = vk1[k - nrBand0];
+        sbr->f_master[k] = (uint8_t) vk1[k - nrBand0];
     }
 
 #if 0
@@ -434,7 +527,7 @@
         if (k == 0)
             i = 0;
         else
-            i = 2*k - minus;
+            i = (uint8_t)(2*k - minus);
         sbr->f_table_res[LO_RES][k] = sbr->f_table_res[HI_RES][i];
     }
 
@@ -465,7 +558,7 @@
 #if 0
         sbr->N_Q = max(1, (int32_t)(sbr->bs_noise_bands*(log(k2/(float)sbr->kx)/log(2.0)) + 0.5));
 #else
-        sbr->N_Q = max(1, find_bands(0, sbr->bs_noise_bands, sbr->kx, k2));
+        sbr->N_Q = (uint8_t)(max(1, find_bands(0, sbr->bs_noise_bands, sbr->kx, k2)));
 #endif
         sbr->N_Q = min(5, sbr->N_Q);
     }
@@ -574,7 +667,11 @@
 #if 0
                 nOctaves = REAL_CONST(log((float)limTable[k]/(float)limTable[k-1])/log(2.0));
 #else
+#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
 #endif
             else
                 nOctaves = 0;
--- 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.11 2004/02/26 09:29:28 menno Exp $
+** $Id: sbr_hfadj.c,v 1.13 2004/03/19 10:37:55 menno Exp $
 **/
 
 /* High Frequency adjustment */
@@ -227,17 +227,30 @@
 
                 for (i = l_i + sbr->tHFAdj; i < u_i + sbr->tHFAdj; i++)
                 {
+#ifdef FIXED_POINT
+#ifdef SBR_LOW_POWER
+                    nrg += ((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS);
+#else
+                    nrg += ((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS) +
+                        ((QMF_IM(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_IM(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS);
+#endif
+#else
                     nrg += MUL_R(QMF_RE(Xsbr[i][m + sbr->kx]), QMF_RE(Xsbr[i][m + sbr->kx]))
 #ifndef SBR_LOW_POWER
                         + MUL_R(QMF_IM(Xsbr[i][m + sbr->kx]), QMF_IM(Xsbr[i][m + sbr->kx]))
 #endif
                         ;
+#endif
                 }
 
                 sbr->E_curr[ch][m][l] = nrg / div;
 #ifdef SBR_LOW_POWER
+#ifdef FIXED_POINT
+                sbr->E_curr[ch][m][l] <<= 1;
+#else
                 sbr->E_curr[ch][m][l] *= 2;
 #endif
+#endif
             }
         }
     } else {
@@ -251,7 +264,7 @@
                 for (k = k_l; k < k_h; k++)
                 {
                     uint8_t i, l_i, u_i;
-                    nrg = 0.0;
+                    nrg = 0;
 
                     l_i = sbr->t_E[ch][l];
                     u_i = sbr->t_E[ch][l+1];
@@ -262,18 +275,31 @@
                     {
                         for (j = k_l; j < k_h; j++)
                         {
+#ifdef FIXED_POINT
+#ifdef SBR_LOW_POWER
+                            nrg += ((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS);
+#else
+                            nrg += ((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS) +
+                                ((QMF_IM(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_IM(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS);
+#endif
+#else
                             nrg += MUL_R(QMF_RE(Xsbr[i][j]), QMF_RE(Xsbr[i][j]))
 #ifndef SBR_LOW_POWER
                                 + MUL_R(QMF_IM(Xsbr[i][j]), QMF_IM(Xsbr[i][j]))
 #endif
                                 ;
+#endif
                         }
                     }
 
                     sbr->E_curr[ch][k - sbr->kx][l] = nrg / div;
 #ifdef SBR_LOW_POWER
+#ifdef FIXED_POINT
+                    sbr->E_curr[ch][k - sbr->kx][l] <<= 1;
+#else
                     sbr->E_curr[ch][k - sbr->kx][l] *= 2;
 #endif
+#endif
                 }
             }
         }
@@ -280,12 +306,441 @@
     }
 }
 
+#ifdef FIXED_POINT
+#define step(shift) \
+    if ((0x40000000l >> shift) + root <= value)       \
+    {                                                 \
+        value -= (0x40000000l >> shift) + root;       \
+        root = (root >> 1) | (0x40000000l >> shift);  \
+    } else {                                          \
+        root = root >> 1;                             \
+    }
+
+/* fixed point square root approximation */
+real_t sbr_sqrt(real_t value)
+{
+    real_t root = 0;
+
+    step( 0); step( 2); step( 4); step( 6);
+    step( 8); step(10); step(12); step(14);
+    step(16); step(18); step(20); step(22);
+    step(24); step(26); step(28); step(30);
+
+    if (root < value)
+        ++root;
+
+    root <<= (REAL_BITS/2);
+
+    return root;
+}
+
+real_t SBR_SQRT_Q2(real_t value)
+{
+    real_t root = 0;
+
+    step( 0); step( 2); step( 4); step( 6);
+    step( 8); step(10); step(12); step(14);
+    step(16); step(18); step(20); step(22);
+    step(24); step(26); step(28); step(30);
+
+    if (root < value)
+        ++root;
+
+    root <<= (Q2_BITS/2);
+
+    return root;
+}
+
+real_t sbr_sqrt_int(real_t value)
+{
+    real_t root = 0;
+
+    step( 0); step( 2); step( 4); step( 6);
+    step( 8); step(10); step(12); step(14);
+    step(16); step(18); step(20); step(22);
+    step(24); step(26); step(28); step(30);
+
+    if (root < value)
+        ++root;
+
+    return root;
+}
+#define SBR_SQRT_FIX(A) sbr_sqrt(A)
+#define SBR_SQRT_INT(A) sbr_sqrt_int(A)
+#endif
+
+#ifdef FIXED_POINT
+#define EPS (1) /* smallest number available in fixed point */
+#else
 #define EPS (1e-12)
+#endif
 
+#ifdef FIXED_POINT
+#define ONE (REAL_CONST(1)>>10)
+#else
 #define ONE (1)
+#endif
 
+
+#ifdef FIXED_POINT
+
+uint8_t G_max_is_biggest(real_t G, real_t G_max,
+                         uint8_t G_is_frac, uint8_t G_max_is_frac)
+{
+    if ((G_is_frac == 1 && G_max_is_frac == 1) || ((G_is_frac == 0 && G_max_is_frac == 0)))
+    {
+        if (G_max > G)
+            return 1;
+    } else if (G_is_frac) {
+        if (G_max > REAL_CONST(1))
+        {
+            return 1;
+        } else if (G_max > (G << (FRAC_BITS-REAL_BITS))) {
+            return 1;
+        }
+    } else if (G_max_is_frac) {
+        if (G > REAL_CONST(1))
+        {
+            return 0;
+        } else if (G > (G_max >> (FRAC_BITS-REAL_BITS))) {
+            return 0;
+        } else {
+            return 1;
+        }
+    }
+
+    return 0;
+}
+
+/* frac */
+real_t div_G_max_G(real_t G, real_t G_max,
+                   uint8_t G_is_frac, uint8_t G_max_is_frac, uint8_t *is_real)
+{
+    *is_real = 0;
+
+    if (G_is_frac == 1)
+    {
+        /* divide by a frac */
+        return ((int64_t)G_max << FRAC_BITS)/G;
+    } else {
+        /* divide by a real but answer is a frac */
+        if (G_max_is_frac == 1)
+        {
+            /* G_max is already a frac */
+            if (G < REAL_CONST(1))
+            {
+                *is_real = 1;
+                return ((int64_t)G_max >> 3)/G;
+            } else {
+                return ((int64_t)G_max << REAL_BITS)/G;
+            }
+        } else {
+            /* turn G_max into a frac before dividing */
+            return ((int64_t)G_max << REAL_BITS+(FRAC_BITS-REAL_BITS))/G;
+        }
+    }
+}
+
 static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
 {
+    uint8_t m, l, k, i;
+
+    ALIGN real_t Q_M_lim[64];
+    ALIGN real_t G_lim[64];
+    ALIGN real_t G_boost;
+    ALIGN real_t S_M[64];
+    ALIGN uint8_t table_map_res_to_m[64];
+    ALIGN uint8_t G_is_frac[64];
+    ALIGN uint8_t Q_M_is_real[64];
+
+
+    for (l = 0; l < sbr->L_E[ch]; l++)
+    {
+        real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1;
+
+        for (i = 0; i < sbr->n[sbr->f[ch][l]]; i++)
+        {
+            for (m = sbr->f_table_res[sbr->f[ch][l]][i]; m < sbr->f_table_res[sbr->f[ch][l]][i+1]; m++)
+            {
+                table_map_res_to_m[m - sbr->kx] = i;
+            }
+        }
+
+        for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++)
+        {
+            real_t G_max;
+            real_t den = 0;
+            real_t den_int = 0;
+            real_t den_real = 0;
+            real_t acc1 = 0;
+            real_t acc1_coef = 0;
+            real_t acct = 0;
+            real_t acc2 = 0;
+            uint8_t G_max_infinite = 0;
+            uint8_t min_pow = 0;
+            uint8_t G_max_is_frac = 0;
+
+            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++)
+            {
+                /* E_orig: integer */
+                if (sbr->E_orig[ch][table_map_res_to_m[m]][l] > (1<<4))
+                {
+                    acc1 += (sbr->E_orig[ch][table_map_res_to_m[m]][l]>>4);
+                } else {
+                    acc1_coef += (sbr->E_orig[ch][table_map_res_to_m[m]][l] << (COEF_BITS-4));
+                    if (acc1_coef > COEF_CONST(3))
+                    {
+                        acc1 += (acc1_coef+(1<<(COEF_BITS-1)))>>COEF_BITS;
+                        acc1_coef = 0;
+                    }
+                }
+                /* E_curr: integer */
+                acc2 += sbr->E_curr[ch][m][l];
+            }
+
+            acc1 += (acc1_coef+(1<<(COEF_BITS-1)))>>COEF_BITS;
+
+
+            /* G_max: fixed point */
+            if ((acc2 == 0) && (acc1 > 3)) /* chosen 3 here, kind of arbitrary but it works (0 doesn't) */
+            {
+                G_max = 0xFFFFFFF;
+                G_max_infinite = 1;
+            } else if (acc2 == 0) {
+                G_max = 0;
+                G_max_infinite = 0;
+            } else {
+                G_max_infinite = 0;
+                switch (sbr->bs_limiter_gains)
+                {
+                case 0: acct = acc1 >> 1; break;
+                case 2: acct = acc1 << 1; break;
+                case 3: acct = acc1; G_max_infinite = 1; break;
+                default: acct = acc1; break;
+                }
+
+                if (acc2 > acct)
+                {
+                    G_max_is_frac = 1;
+                    G_max = (((int64_t)acct)<<FRAC_BITS) / acc2;
+                } else {
+                    G_max_is_frac = 0;
+                    G_max = (((int64_t)acct)<<REAL_BITS) / acc2;
+                }
+            }
+
+            for (m = ml1; m < ml2; m++)
+            {
+                real_t Q_M, G;
+                real_t Q_div1, Q_div2;
+                real_t E_orig;
+                /* set to 1 to start with */
+                uint8_t G_max_biggest = 1;
+
+
+                /* Q_mapped: fixed point */
+
+                /* Q_div1: [0..1] FRAC_CONST */
+                Q_div1 = adj->Q_div_mapped[m][l];
+                /* Q_div2: [0..1] FRAC_CONST */
+                Q_div2 = adj->Q_div2_mapped[m][l];
+
+                /* E_orig: integer */
+                E_orig = sbr->E_orig[ch][table_map_res_to_m[m]][l];
+
+                /* Q_M: REAL */
+                /* S_M: integer */
+                if ((E_orig > (1<<22)) && (Q_div2 > FRAC_CONST(0.8)))
+                {
+                    /* Q_M will not fit in a real */
+                    Q_M = ((int64_t)(E_orig>>4) * Q_div2) >> FRAC_BITS;
+                    Q_M_is_real[m] = 0;
+
+                    S_M[m] = adj->S_index_mapped[m][l] * MUL_F((E_orig>>4), Q_div1);
+                } else if (E_orig > (1<<4)) {
+                    Q_M = ((int64_t)(E_orig>>4) * Q_div2) >> (FRAC_BITS-REAL_BITS);
+                    Q_M_is_real[m] = 1;
+
+                    S_M[m] = adj->S_index_mapped[m][l] * MUL_F((E_orig>>4), Q_div1);
+                } else {
+                    Q_M = ((int64_t)E_orig * Q_div2) >> (FRAC_BITS-REAL_BITS);
+                    Q_M >>= 4;
+                    Q_M_is_real[m] = 1;
+
+                    S_M[m] = adj->S_index_mapped[m][l] * MUL_F(E_orig, Q_div1);
+                    S_M[m] >>= 4;
+                }
+
+
+                /* G: fixed point */
+                if (sbr->E_curr[ch][m][l] != 0)
+                {
+                    /* E_curr = INT */
+                    if (sbr->E_curr[ch][m][l] > (E_orig>>4))
+                    {
+                        /*frac*/
+                        G = (((int64_t)E_orig)<<(FRAC_BITS-4)) / sbr->E_curr[ch][m][l];
+
+                        G_is_frac[m] = 1;
+                    } else {
+                        /*real*/
+                        G = (((int64_t)E_orig)<<(REAL_BITS-4)) / sbr->E_curr[ch][m][l];
+
+                        G_is_frac[m] = 0;
+                    }
+                } else {
+                    /* E_curr == 0, check if E_orig happens to be really big */
+                    if (G_max_is_frac == 0)
+                    {
+                        if ((E_orig<<4) > (G_max>>REAL_BITS))
+                        {
+                            G_max_biggest = 0;
+                        }
+                    } else {
+                        /* G_max is fractional type */
+                        if (E_orig != 0)
+                        {
+                            G_max_biggest = 0;
+                        }
+                    }
+
+                    G = (E_orig << (REAL_BITS-4+10));
+
+                    G_is_frac[m] = 0;
+                }
+
+                if (adj->S_mapped[m][l] == 1)
+                {
+                    G = MUL_F(G, Q_div2);
+                } else if (delta == 1) {
+                    G = MUL_F(G, Q_div1);
+                }
+
+                /* limit the additional noise energy level */
+                /* and apply the limiter */
+
+                /* if we still have the default value for G_max_biggest -> compute */
+                if (G_max_biggest != 0)
+                    G_max_biggest = G_max_is_biggest(G, G_max, G_is_frac[m], G_max_is_frac);
+
+                /* G_lim: fixed point */
+                /* Q_M_lim: REAL/INT */
+                if (G_max_infinite || G_max_biggest)
+                {
+                    Q_M_lim[m] = Q_M;
+                    G_lim[m] = G;
+                } else {
+                    real_t tmp;
+                    uint8_t is_real = 0;
+                    if (G == 0)
+                        tmp = 0xFFF;
+                    else
+                        tmp = div_G_max_G(G, G_max, G_is_frac[m], G_max_is_frac, &is_real);
+
+                    if (is_real == 0)
+                        Q_M_lim[m] = MUL_F(Q_M, tmp);
+                    else
+                        Q_M_lim[m] = MUL_R(Q_M, tmp);
+
+                    G_lim[m] = G_max;
+                    G_is_frac[m] = G_max_is_frac;
+                }
+
+
+                /* E_curr: integer/coef */
+                if (G_is_frac[m] == 0)
+                {
+                    if (sbr->E_curr[ch][m][l] < (1<<(25-REAL_BITS)))
+                    {
+                        den_real += sbr->E_curr[ch][m][l] * G_lim[m];
+                    } else {
+                        den_int += MUL_R(sbr->E_curr[ch][m][l], G_lim[m]);
+                    }
+                } else {
+                    den_int += MUL_F(sbr->E_curr[ch][m][l], G_lim[m]);
+                }
+                den_int += S_M[m];
+                if ((!adj->S_index_mapped[m][l]) && (l != sbr->l_A[ch]))
+                {
+                    if (Q_M_is_real[m] == 1)
+                    {
+                        if (Q_M_lim[m] > REAL_CONST(100))
+                            den_int += (Q_M_lim[m]>>REAL_BITS);
+                        else
+                            den_real += Q_M_lim[m];
+                    } else {
+                        den_int += Q_M_lim[m];
+                    }
+                }
+            }
+
+            den = den_int + ((den_real+(1<<(REAL_BITS-1)))>>REAL_BITS);
+
+            /* G_boost: fixed point */
+            if ((den + EPS) == 0 || den == 0)
+                G_boost = REAL_CONST(1);//REAL_CONST(2.51188643);
+            else if (acc1 > (den<<1)+(den>>1))
+                G_boost = REAL_CONST(2.51188643);
+            else
+                G_boost = (((int64_t)(acc1 + EPS))<<REAL_BITS)/(den + EPS);
+            G_boost = min(G_boost, REAL_CONST(2.51188643) /* 1.584893192 ^ 2 */);
+
+            for (m = ml1; m < ml2; m++)
+            {
+                /* apply compensation to gain, noise floor sf's and sinusoid levels */
+#ifndef SBR_LOW_POWER
+                /* G_lim_boost: fixed point */
+                if (G_is_frac[m] == 0)
+                {
+                    adj->G_lim_boost[l][m] = SBR_SQRT_Q2(MUL_SHIFT6(G_lim[m], G_boost));
+                } else {
+                    adj->G_lim_boost[l][m] = SBR_SQRT_Q2(MUL_SHIFT23(G_lim[m], G_boost));
+                }
+#else
+                /* sqrt() will be done after the aliasing reduction to save a
+                 * few multiplies
+                 */
+                /* G_lim_boost: fixed point */
+                if (G_is_frac[m] == 0)
+                {
+                    adj->G_lim_boost[l][m] = MUL_SHIFT6(G_lim[m], G_boost);
+                } else {
+                    adj->G_lim_boost[l][m] = MUL_SHIFT23(G_lim[m], G_boost);
+                }
+#endif
+                /* Q_M_lim_boost: integer */
+                /* Q_M_lim_boost: REAL */
+                if (Q_M_is_real[m])
+                {
+                    adj->Q_M_lim_boost[l][m] = SBR_SQRT_FIX(MUL_R(Q_M_lim[m], G_boost));
+                } else {
+                    adj->Q_M_lim_boost[l][m] = SBR_SQRT_INT(MUL_R(Q_M_lim[m], G_boost));
+                    adj->Q_M_lim_boost[l][m] <<= REAL_BITS;
+                }
+
+                /* S_M_boost: integer */
+                if (adj->S_index_mapped[m][l])
+                {
+                    adj->S_M_boost[l][m] = SBR_SQRT_INT(MUL_R(S_M[m], G_boost));
+                } else {
+                    adj->S_M_boost[l][m] = 0;
+                }
+            }
+        }
+    }
+}
+#else
+
+static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
+{
     static real_t limGain[] = { 0.5, 1.0, 2.0, 1e10 };
     uint8_t m, l, k, i;
 
@@ -381,10 +836,6 @@
             G_boost = (acc1 + EPS) / (den + EPS);
             G_boost = min(G_boost, 2.51188643 /* 1.584893192 ^ 2 */);
 
-            //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 */
@@ -408,6 +859,7 @@
         }
     }
 }
+#endif
 
 #ifdef SBR_LOW_POWER
 static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch)
@@ -420,18 +872,8 @@
         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)
@@ -472,8 +914,6 @@
 
     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;
@@ -485,7 +925,11 @@
                 /* E_total_est: integer */
                 /* E_total: integer */
                 E_total_est += sbr->E_curr[ch][m-sbr->kx][l];
+#ifdef FIXED_POINT
+                E_total += MUL_Q2(sbr->E_curr[ch][m-sbr->kx][l], adj->G_lim_boost[l][m-sbr->kx]);
+#else
                 E_total += sbr->E_curr[ch][m-sbr->kx][l] * adj->G_lim_boost[l][m-sbr->kx];
+#endif
             }
 
             /* G_target: fixed point */
@@ -493,7 +937,11 @@
             {
                 G_target = 0;
             } else {
+#ifdef FIXED_POINT
+                G_target = (((int64_t)(E_total))<<Q2_BITS)/(E_total_est + EPS);
+#else
                 G_target = E_total / (E_total_est + EPS);
+#endif
             }
             acc = 0;
 
@@ -513,7 +961,11 @@
                     MUL_C((COEF_CONST(1)-alpha), adj->G_lim_boost[l][m-sbr->kx]);
 
                 /* acc: integer */
+#ifdef FIXED_POINT
+                acc += MUL_Q2(adj->G_lim_boost[l][m-sbr->kx], sbr->E_curr[ch][m-sbr->kx][l]);
+#else
                 acc += adj->G_lim_boost[l][m-sbr->kx] * sbr->E_curr[ch][m-sbr->kx][l];
+#endif
             }
 
             /* acc: fixed point */
@@ -521,11 +973,19 @@
             {
                 acc = 0;
             } else {
+#ifdef FIXED_POINT
+                acc = (((int64_t)(E_total))<<Q2_BITS)/(acc + EPS);
+#else
                 acc = E_total / (acc + EPS);
+#endif
             }
             for(m = sbr->f_group[l][(k<<1)]; m < sbr->f_group[l][(k<<1) + 1]; m++)
             {
+#ifdef FIXED_POINT
+                adj->G_lim_boost[l][m-sbr->kx] = MUL_Q2(acc, adj->G_lim_boost[l][m-sbr->kx]);
+#else
                 adj->G_lim_boost[l][m-sbr->kx] = acc * adj->G_lim_boost[l][m-sbr->kx];
+#endif
             }
         }
     }
@@ -537,7 +997,11 @@
             for (m = sbr->f_table_lim[sbr->bs_limiter_bands][k];
                  m < sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; m++)
             {
+#ifdef FIXED_POINT
+                 adj->G_lim_boost[l][m] = SBR_SQRT_Q2(adj->G_lim_boost[l][m]);
+#else
                  adj->G_lim_boost[l][m] = sqrt(adj->G_lim_boost[l][m]);
+#endif
             }
         }
     }
@@ -632,46 +1096,52 @@
 
                 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 */
+#ifndef FIXED_POINT
                 QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = G_filt * QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx])
                     + MUL_F(Q_filt, RE(V[fIndexNoise]));
+#else
+                QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_Q2(G_filt, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]))
+                    + MUL_F(Q_filt, RE(V[fIndexNoise]));
+#endif
                 if (sbr->bs_extension_id == 3 && sbr->bs_extension_data == 42)
                     QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = 16428320;
 #ifndef SBR_LOW_POWER
+#ifndef FIXED_POINT
                 QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = G_filt * QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx])
                     + MUL_F(Q_filt, IM(V[fIndexNoise]));
+#else
+                QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_Q2(G_filt, QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]))
+                    + MUL_F(Q_filt, IM(V[fIndexNoise]));
 #endif
+#endif
 
-                //if (adj->S_index_mapped[m][l])
                 {
                     int8_t rev = (((m + sbr->kx) & 1) ? -1 : 1);
                     QMF_RE(psi) = adj->S_M_boost[l][m] * phi_re[fIndexSine];
+#ifdef FIXED_POINT
+                    QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += (QMF_RE(psi) << REAL_BITS);
+#else
                     QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += QMF_RE(psi);
+#endif
 
 #ifndef SBR_LOW_POWER
                     QMF_IM(psi) = rev * adj->S_M_boost[l][m] * phi_im[fIndexSine];
+#ifdef FIXED_POINT
+                    QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += (QMF_IM(psi) << REAL_BITS);
+#else
                     QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += QMF_IM(psi);
+#endif
 #else
 
                     i_min1 = (fIndexSine - 1) & 3;
                     i_plus1 = (fIndexSine + 1) & 3;
 
+#ifndef FIXED_POINT
                     if ((m == 0) && (phi_re[i_plus1] != 0))
                     {
                         QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) +=
@@ -705,6 +1175,41 @@
                                 (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m], FRAC_CONST(0.00815)));
                         }
                     }
+#else
+                    if ((m == 0) && (phi_re[i_plus1] != 0))
+                    {
+                        QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) +=
+                            (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][0]<<REAL_BITS), FRAC_CONST(0.00815)));
+                        if (sbr->M != 0)
+                        {
+                            QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+                                (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][1]<<REAL_BITS), FRAC_CONST(0.00815)));
+                        }
+                    }
+                    if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
+                    {
+                        QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+                            (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m - 1]<<REAL_BITS), FRAC_CONST(0.00815)));
+                    }
+                    if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0))
+                    {
+                        QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+                            (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][m + 1]<<REAL_BITS), FRAC_CONST(0.00815)));
+                    }
+                    if ((m == sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
+                    {
+                        if (m > 0)
+                        {
+                            QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+                                (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m - 1]<<REAL_BITS), FRAC_CONST(0.00815)));
+                        }
+                        if (m + sbr->kx < 64)
+                        {
+                            QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) +=
+                                (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m]<<REAL_BITS), FRAC_CONST(0.00815)));
+                        }
+                    }
+#endif
 
                     if (adj->S_M_boost[l][m] != 0)
                         sinusoids++;
--- 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.13 2004/02/26 09:29:28 menno Exp $
+** $Id: sbr_hfgen.c,v 1.15 2004/03/19 10:37:55 menno Exp $
 **/
 
 /* High Frequency generation */
@@ -38,14 +38,13 @@
 
 
 /* static function declarations */
-static void calc_prediction_coef(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][32],
-                                 complex_t *alpha_0, complex_t *alpha_1
 #ifdef SBR_LOW_POWER
-                                 , real_t *rxx
-#endif
-                                 );
-#ifdef SBR_LOW_POWER
+static void calc_prediction_coef_lp(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][32],
+                                    complex_t *alpha_0, complex_t *alpha_1, real_t *rxx);
 static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg);
+#else
+static void calc_prediction_coef(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][32],
+                                 complex_t *alpha_0, complex_t *alpha_1, uint8_t k);
 #endif
 static void calc_chirp_factors(sbr_info *sbr, uint8_t ch);
 static void patch_construction(sbr_info *sbr);
@@ -68,7 +67,6 @@
     uint8_t first = sbr->t_E[ch][0];
     uint8_t last = sbr->t_E[ch][sbr->L_E[ch]];
 
-//    printf("%d %d\n", first, last);
 
     calc_chirp_factors(sbr, ch);
 
@@ -84,14 +82,11 @@
         patch_construction(sbr);
 
     /* calculate the prediction coefficients */
-    calc_prediction_coef(sbr, Xlow, alpha_0, alpha_1
 #ifdef SBR_LOW_POWER
-        , rxx
-#endif
-        );
-
-#ifdef SBR_LOW_POWER
+    calc_prediction_coef_lp(sbr, Xlow, alpha_0, alpha_1, rxx);
     calc_aliasing_degree(sbr, rxx, deg);
+#else
+    //calc_prediction_coef(sbr, Xlow, alpha_0, alpha_1);
 #endif
 
     /* actual HF generation */
@@ -127,6 +122,10 @@
             /* with or without filtering */
             if (bw2 > 0)
             {
+#ifndef SBR_LOW_POWER
+                calc_prediction_coef(sbr, Xlow, alpha_0, alpha_1, p);
+#endif
+
                 RE(a0) = MUL_C(RE(alpha_0[p]), bw);
                 RE(a1) = MUL_C(RE(alpha_1[p]), bw2);
 #ifndef SBR_LOW_POWER
@@ -147,15 +146,15 @@
                         MUL_R(RE(a1), QMF_RE(Xlow[l - 2 + offset][p])));
 #else
                     QMF_RE(Xhigh[l + offset][k]) += (
-                        RE(a0) * QMF_RE(Xlow[l - 1 + offset][p]) -
-                        IM(a0) * QMF_IM(Xlow[l - 1 + offset][p]) +
-                        RE(a1) * QMF_RE(Xlow[l - 2 + offset][p]) -
-                        IM(a1) * QMF_IM(Xlow[l - 2 + offset][p]));
+                        MUL_R(RE(a0), QMF_RE(Xlow[l - 1 + offset][p])) -
+                        MUL_R(IM(a0), QMF_IM(Xlow[l - 1 + offset][p])) +
+                        MUL_R(RE(a1), QMF_RE(Xlow[l - 2 + offset][p])) -
+                        MUL_R(IM(a1), QMF_IM(Xlow[l - 2 + offset][p])));
                     QMF_IM(Xhigh[l + offset][k]) += (
-                        IM(a0) * QMF_RE(Xlow[l - 1 + offset][p]) +
-                        RE(a0) * QMF_IM(Xlow[l - 1 + offset][p]) +
-                        IM(a1) * QMF_RE(Xlow[l - 2 + offset][p]) +
-                        RE(a1) * QMF_IM(Xlow[l - 2 + offset][p]));
+                        MUL_R(IM(a0), QMF_RE(Xlow[l - 1 + offset][p])) +
+                        MUL_R(RE(a0), QMF_IM(Xlow[l - 1 + offset][p])) +
+                        MUL_R(IM(a1), QMF_RE(Xlow[l - 2 + offset][p])) +
+                        MUL_R(RE(a1), QMF_IM(Xlow[l - 2 + offset][p])));
 #endif
                 }
             } else {
@@ -196,11 +195,58 @@
     real_t r01 = 0, r02 = 0, r11 = 0;
     int8_t j;
     uint8_t offset = sbr->tHFAdj;
+#ifdef FIXED_POINT
+    const real_t rel = FRAC_CONST(0.999999); // 1 / (1 + 1e-6f);
+    uint32_t maxi = 0;
+    uint32_t pow2, exp;
+#else
     const real_t rel = 1 / (1 + 1e-6f);
+#endif
 
 
+#ifdef FIXED_POINT
+    /*
+     *  For computing the covariance matrix and the filter coefficients
+     *  in fixed point, all values are normalised so that the fixed point
+     *  values don't overflow.
+     */
+    for (j = offset-2; j < len + offset; j++)
+    {
+        maxi = max(SBR_ABS(QMF_RE(buffer[j][bd])>>REAL_BITS), maxi);
+    }
+
+    /* find the first power of 2 bigger than max to avoid division */
+    pow2 = 1;
+    exp = 0;
+    while (maxi > pow2)
+    {
+        pow2 <<= 1;
+        exp++;
+    }
+
+    /* improves accuracy */
+    exp -= 1;
+
     for (j = offset; j < len + offset; j++)
     {
+        real_t buf_j = ((QMF_RE(buffer[j][bd])+(1<<(exp-1)))>>exp);
+        real_t buf_j_1 = ((QMF_RE(buffer[j-1][bd])+(1<<(exp-1)))>>exp);
+        real_t buf_j_2 = ((QMF_RE(buffer[j-2][bd])+(1<<(exp-1)))>>exp);
+
+        /* normalisation with rounding */
+        r01 += MUL_R(buf_j, buf_j_1);
+        r02 += MUL_R(buf_j, buf_j_2);
+        r11 += MUL_R(buf_j_1, buf_j_1);
+    }
+    RE(ac->r12) = r01 -
+        MUL_R(((QMF_RE(buffer[len+offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp)) +
+        MUL_R(((QMF_RE(buffer[offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp));
+    RE(ac->r22) = r11 -
+        MUL_R(((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp)) +
+        MUL_R(((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp));
+#else
+    for (j = offset; j < len + offset; j++)
+    {
         r01 += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-1][bd]);
         r02 += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-2][bd]);
         r11 += QMF_RE(buffer[j-1][bd]) * QMF_RE(buffer[j-1][bd]);
@@ -211,6 +257,7 @@
     RE(ac->r22) = r11 -
         QMF_RE(buffer[len+offset-2][bd]) * QMF_RE(buffer[len+offset-2][bd]) +
         QMF_RE(buffer[offset-2][bd]) * QMF_RE(buffer[offset-2][bd]);
+#endif
     RE(ac->r01) = r01;
     RE(ac->r02) = r02;
     RE(ac->r11) = r11;
@@ -222,13 +269,73 @@
                              uint8_t bd, uint8_t len)
 {
     real_t r01r = 0, r01i = 0, r02r = 0, r02i = 0, r11r = 0;
+#ifdef FIXED_POINT
+    const real_t rel = FRAC_CONST(0.999999); // 1 / (1 + 1e-6f);
+    uint32_t maxi = 0;
+    uint32_t pow2, exp;
+#else
     const real_t rel = 1 / (1 + 1e-6f);
+#endif
     int8_t j;
     uint8_t offset = sbr->tHFAdj;
 
+#ifdef FIXED_POINT
+    /*
+     *  For computing the covariance matrix and the filter coefficients
+     *  in fixed point, all values are normalised so that the fixed point
+     *  values don't overflow.
+     */
+    for (j = offset-2; j < len + offset; j++)
+    {
+        maxi = max(SBR_ABS(QMF_RE(buffer[j][bd])>>REAL_BITS), maxi);
+        maxi = max(SBR_ABS(QMF_IM(buffer[j][bd])>>REAL_BITS), maxi);
+    }
 
+    /* find the first power of 2 bigger than max to avoid division */
+    pow2 = 1;
+    exp = 0;
+    while (maxi > pow2)
+    {
+        pow2 <<= 1;
+        exp++;
+    }
+
+    /* improves accuracy */
+    exp -= 1;
+
     for (j = offset; j < len + offset; j++)
     {
+        real_t rbuf_j = ((QMF_RE(buffer[j][bd])+(1<<(exp-1)))>>exp);
+        real_t ibuf_j = ((QMF_IM(buffer[j][bd])+(1<<(exp-1)))>>exp);
+        real_t rbuf_j_1 = ((QMF_RE(buffer[j-1][bd])+(1<<(exp-1)))>>exp);
+        real_t ibuf_j_1 = ((QMF_IM(buffer[j-1][bd])+(1<<(exp-1)))>>exp);
+        real_t rbuf_j_2 = ((QMF_RE(buffer[j-2][bd])+(1<<(exp-1)))>>exp);
+        real_t ibuf_j_2 = ((QMF_IM(buffer[j-2][bd])+(1<<(exp-1)))>>exp);
+
+        r01r += MUL_R(rbuf_j, rbuf_j_1) + MUL_R(ibuf_j, ibuf_j_1);
+        r01i += MUL_R(ibuf_j, rbuf_j_1) - MUL_R(rbuf_j, ibuf_j_1);
+        r02r += MUL_R(rbuf_j, rbuf_j_2) + MUL_R(ibuf_j, ibuf_j_2);
+        r02i += MUL_R(ibuf_j, rbuf_j_2) - MUL_R(rbuf_j, ibuf_j_2);
+        r11r += MUL_R(rbuf_j_1, rbuf_j_1) + MUL_R(ibuf_j_1, ibuf_j_1);
+    }
+    RE(ac->r12) = r01r -
+        (MUL_R(((QMF_RE(buffer[len+offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp)) +
+        MUL_R(((QMF_IM(buffer[len+offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_IM(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp))) +
+        (MUL_R(((QMF_RE(buffer[offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp)) +
+        MUL_R(((QMF_IM(buffer[offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_IM(buffer[offset-2][bd])+(1<<(exp-1)))>>exp)));
+    IM(ac->r12) = r01i -
+        (MUL_R(((QMF_IM(buffer[len+offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp)) -
+        MUL_R(((QMF_RE(buffer[len+offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_IM(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp))) +
+        (MUL_R(((QMF_IM(buffer[offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp)) -
+        MUL_R(((QMF_RE(buffer[offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_IM(buffer[offset-2][bd])+(1<<(exp-1)))>>exp)));
+    RE(ac->r22) = r11r -
+        (MUL_R(((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp)) +
+        MUL_R(((QMF_IM(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp), ((QMF_IM(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp))) +
+        (MUL_R(((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp)) +
+        MUL_R(((QMF_IM(buffer[offset-2][bd])+(1<<(exp-1)))>>exp), ((QMF_IM(buffer[offset-2][bd])+(1<<(exp-1)))>>exp)));
+#else
+    for (j = offset; j < len + offset; j++)
+    {
         r01r += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-1][bd]) +
             QMF_IM(buffer[j][bd]) * QMF_IM(buffer[j-1][bd]);
         r01i += QMF_IM(buffer[j][bd]) * QMF_RE(buffer[j-1][bd]) -
@@ -240,13 +347,6 @@
         r11r += QMF_RE(buffer[j-1][bd]) * QMF_RE(buffer[j-1][bd]) +
             QMF_IM(buffer[j-1][bd]) * QMF_IM(buffer[j-1][bd]);
     }
-
-    RE(ac->r01) = r01r;
-    IM(ac->r01) = r01i;
-    RE(ac->r02) = r02r;
-    IM(ac->r02) = r02i;
-    RE(ac->r11) = r11r;
-
     RE(ac->r12) = r01r -
         (QMF_RE(buffer[len+offset-1][bd]) * QMF_RE(buffer[len+offset-2][bd]) + QMF_IM(buffer[len+offset-1][bd]) * QMF_IM(buffer[len+offset-2][bd])) +
         (QMF_RE(buffer[offset-1][bd]) * QMF_RE(buffer[offset-2][bd]) + QMF_IM(buffer[offset-1][bd]) * QMF_IM(buffer[offset-2][bd]));
@@ -256,18 +356,74 @@
     RE(ac->r22) = r11r -
         (QMF_RE(buffer[len+offset-2][bd]) * QMF_RE(buffer[len+offset-2][bd]) + QMF_IM(buffer[len+offset-2][bd]) * QMF_IM(buffer[len+offset-2][bd])) +
         (QMF_RE(buffer[offset-2][bd]) * QMF_RE(buffer[offset-2][bd]) + QMF_IM(buffer[offset-2][bd]) * QMF_IM(buffer[offset-2][bd]));
+#endif
 
-    ac->det = RE(ac->r11) * RE(ac->r22) - rel * (RE(ac->r12) * RE(ac->r12) + IM(ac->r12) * IM(ac->r12));
+    RE(ac->r01) = r01r;
+    IM(ac->r01) = r01i;
+    RE(ac->r02) = r02r;
+    IM(ac->r02) = r02i;
+    RE(ac->r11) = r11r;
+
+    ac->det = MUL_R(RE(ac->r11), RE(ac->r22)) - MUL_F(rel, (MUL_R(RE(ac->r12), RE(ac->r12)) + MUL_R(IM(ac->r12), IM(ac->r12))));
 }
 #endif
 
 /* calculate linear prediction coefficients using the covariance method */
+#ifndef SBR_LOW_POWER
 static void calc_prediction_coef(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][32],
-                                 complex_t *alpha_0, complex_t *alpha_1
-#ifdef SBR_LOW_POWER
-                                 , real_t *rxx
+                                 complex_t *alpha_0, complex_t *alpha_1, uint8_t k)
+{
+    real_t tmp;
+    acorr_coef ac;
+
+    auto_correlation(sbr, &ac, Xlow, k, sbr->numTimeSlotsRate + 6);
+
+    if (ac.det == 0)
+    {
+        RE(alpha_1[k]) = 0;
+        IM(alpha_1[k]) = 0;
+    } else {
+#ifdef FIXED_POINT
+        tmp = (MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(IM(ac.r01), IM(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11)));
+        RE(alpha_1[k]) = SBR_DIV(tmp, ac.det);
+        tmp = (MUL_R(IM(ac.r01), RE(ac.r12)) + MUL_R(RE(ac.r01), IM(ac.r12)) - MUL_R(IM(ac.r02), RE(ac.r11)));
+        IM(alpha_1[k]) = SBR_DIV(tmp, ac.det);
+#else
+        tmp = REAL_CONST(1.0) / ac.det;
+        RE(alpha_1[k]) = (MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(IM(ac.r01), IM(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11))) * tmp;
+        IM(alpha_1[k]) = (MUL_R(IM(ac.r01), RE(ac.r12)) + MUL_R(RE(ac.r01), IM(ac.r12)) - MUL_R(IM(ac.r02), RE(ac.r11))) * tmp;
 #endif
-                                 )
+    }
+
+    if (RE(ac.r11) == 0)
+    {
+        RE(alpha_0[k]) = 0;
+        IM(alpha_0[k]) = 0;
+    } else {
+#ifdef FIXED_POINT
+        tmp = -(RE(ac.r01) + MUL_R(RE(alpha_1[k]), RE(ac.r12)) + MUL_R(IM(alpha_1[k]), IM(ac.r12)));
+        RE(alpha_0[k]) = SBR_DIV(tmp, RE(ac.r11));
+        tmp = -(IM(ac.r01) + MUL_R(IM(alpha_1[k]), RE(ac.r12)) - MUL_R(RE(alpha_1[k]), IM(ac.r12)));
+        IM(alpha_0[k]) = SBR_DIV(tmp, RE(ac.r11));
+#else
+        tmp = 1.0f / RE(ac.r11);
+        RE(alpha_0[k]) = -(RE(ac.r01) + MUL_R(RE(alpha_1[k]), RE(ac.r12)) + MUL_R(IM(alpha_1[k]), IM(ac.r12))) * tmp;
+        IM(alpha_0[k]) = -(IM(ac.r01) + MUL_R(IM(alpha_1[k]), RE(ac.r12)) - MUL_R(RE(alpha_1[k]), IM(ac.r12))) * tmp;
+#endif
+    }
+
+    if ((MUL_R(RE(alpha_0[k]),RE(alpha_0[k])) + MUL_R(IM(alpha_0[k]),IM(alpha_0[k])) >= REAL_CONST(16)) ||
+        (MUL_R(RE(alpha_1[k]),RE(alpha_1[k])) + MUL_R(IM(alpha_1[k]),IM(alpha_1[k])) >= REAL_CONST(16)))
+    {
+        RE(alpha_0[k]) = 0;
+        IM(alpha_0[k]) = 0;
+        RE(alpha_1[k]) = 0;
+        IM(alpha_1[k]) = 0;
+    }
+}
+#else
+static void calc_prediction_coef_lp(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][32],
+                                    complex_t *alpha_0, complex_t *alpha_1, real_t *rxx)
 {
     uint8_t k;
     real_t tmp;
@@ -277,25 +433,18 @@
     {
         auto_correlation(sbr, &ac, Xlow, k, sbr->numTimeSlotsRate + 6);
 
-#ifdef SBR_LOW_POWER
         if (ac.det == 0)
         {
+            RE(alpha_0[k]) = 0;
             RE(alpha_1[k]) = 0;
         } else {
+            tmp = MUL_R(RE(ac.r01), RE(ac.r22)) - MUL_R(RE(ac.r12), RE(ac.r02));
+            RE(alpha_0[k]) = SBR_DIV(tmp, (-ac.det));
+
             tmp = MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11));
             RE(alpha_1[k]) = SBR_DIV(tmp, ac.det);
         }
 
-        if (RE(ac.r11) == 0)
-        {
-            RE(alpha_0[k]) = 0;
-        } else {
-            tmp = RE(ac.r01) + MUL_R(RE(alpha_1[k]), RE(ac.r12));
-            RE(alpha_0[k]) = -SBR_DIV(tmp, RE(ac.r11));
-        }
-
-        //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);
@@ -307,45 +456,18 @@
         {
             rxx[k] = COEF_CONST(0.0);
         } else {
+#ifdef FIXED_POINT
+            rxx[k] = ((int64_t)RE(ac.r01) << COEF_BITS) / RE(ac.r11);
+#else
             rxx[k] = RE(ac.r01) / RE(ac.r11);
+#endif
             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)
-        {
-            RE(alpha_1[k]) = 0;
-            IM(alpha_1[k]) = 0;
-        } else {
-            tmp = REAL_CONST(1.0) / ac.det;
-            RE(alpha_1[k]) = (RE(ac.r01) * RE(ac.r12) - IM(ac.r01) * IM(ac.r12) - RE(ac.r02) * RE(ac.r11)) * tmp;
-            IM(alpha_1[k]) = (IM(ac.r01) * RE(ac.r12) + RE(ac.r01) * IM(ac.r12) - IM(ac.r02) * RE(ac.r11)) * tmp;
-        }
-
-        if (RE(ac.r11) == 0)
-        {
-            RE(alpha_0[k]) = 0;
-            IM(alpha_0[k]) = 0;
-        } else {
-            tmp = 1.0f / RE(ac.r11);
-            RE(alpha_0[k]) = -(RE(ac.r01) + RE(alpha_1[k]) * RE(ac.r12) + IM(alpha_1[k]) * IM(ac.r12)) * tmp;
-            IM(alpha_0[k]) = -(IM(ac.r01) + IM(alpha_1[k]) * RE(ac.r12) - RE(alpha_1[k]) * IM(ac.r12)) * tmp;
-        }
-
-        if ((RE(alpha_0[k])*RE(alpha_0[k]) + IM(alpha_0[k])*IM(alpha_0[k]) >= 16) ||
-            (RE(alpha_1[k])*RE(alpha_1[k]) + IM(alpha_1[k])*IM(alpha_1[k]) >= 16))
-        {
-            RE(alpha_0[k]) = 0;
-            IM(alpha_0[k]) = 0;
-            RE(alpha_1[k]) = 0;
-            IM(alpha_1[k]) = 0;
-        }
-#endif
     }
 }
 
-#ifdef SBR_LOW_POWER
 static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg)
 {
     uint8_t k;
--- 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.34 2004/03/02 20:09:58 menno Exp $
+** $Id: structs.h,v 1.35 2004/03/10 19:45:42 menno Exp $
 **/
 
 #ifndef __STRUCTS_H__
@@ -380,6 +380,7 @@
     uint32_t frame;
 
     uint8_t downMatrix;
+    uint8_t upMatrix;
     uint8_t first_syn_ele;
     uint8_t has_lfe;
     /* number of channels in current frame */
--- 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.74 2004/03/02 20:09:58 menno Exp $
+** $Id: syntax.c,v 1.75 2004/03/10 19:45:42 menno Exp $
 **/
 
 /*
@@ -1228,7 +1228,7 @@
         /* check CRC */
         /* no need to check it if there was already an error */
         if (hDecoder->sbr[0]->ret == 0)
-            hDecoder->sbr[0]->ret = faad_check_CRC(&ld_sbr, faad_get_processed_bits(&ld_sbr) - 8);
+            hDecoder->sbr[0]->ret = (uint8_t)faad_check_CRC(&ld_sbr, (uint16_t)faad_get_processed_bits(&ld_sbr) - 8);
 
         faad_endbits(&ld_sbr);
 
@@ -1476,7 +1476,7 @@
 #ifdef DRM
     /* CRC check */
     if (hDecoder->object_type == DRM_ER_LC)
-        if ((result = faad_check_CRC(ld, faad_get_processed_bits(ld) - 8)) > 0)
+        if ((result = (uint8_t)faad_check_CRC(ld, (uint16_t)faad_get_processed_bits(ld) - 8)) > 0)
             return result;
 #endif
 
--- 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.51 2004/03/02 20:09:58 menno Exp $
+** $Id: syntax.h,v 1.54 2004/09/04 14:56:29 menno Exp $
 **/
 
 #ifndef __SYNTAX_H__
@@ -114,6 +114,8 @@
                     bitfile *ld, program_config *pce, drc_info *drc);
 uint8_t reordered_spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld,
                                 int16_t *spectral_data);
+void aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
+                               bitfile *ld, program_config *pce, drc_info *drc);
 
 
 #ifdef __cplusplus