[FFmpeg-soc] [soc]: r2690 - aacenc/aacenc.c

kostya subversion at mplayerhq.hu
Sat Jul 5 17:17:07 CEST 2008


Author: kostya
Date: Sat Jul  5 17:17:06 2008
New Revision: 2690

Log:
3.14159e3l of cola: dividing by integer constant resulted in precision loss

Modified:
   aacenc/aacenc.c

Modified: aacenc/aacenc.c
==============================================================================
--- aacenc/aacenc.c	(original)
+++ aacenc/aacenc.c	Sat Jul  5 17:17:06 2008
@@ -249,19 +249,17 @@ static void analyze(AVCodecContext *avct
         memcpy(s->output, cpe->ch[channel].saved, sizeof(float)*1024);
         j = channel;
         for (i = 0; i < 1024; i++, j += avctx->channels){
-            s->output[i+1024]         = audio[j] * s->kbd_long_1024[1024 - i - 1];
-            cpe->ch[channel].saved[i] = audio[j] * s->kbd_long_1024[i];
+            s->output[i+1024]         = audio[j] / 512.0 * s->kbd_long_1024[1024 - i - 1];
+            cpe->ch[channel].saved[i] = audio[j] / 512.0 * s->kbd_long_1024[i];
         }
         ff_mdct_calc(&s->mdct1024, cpe->ch[channel].coeffs, s->output, s->tmp);
-        //XXX: unelegant hack but it makes output spectrum more like other implementations
-        for(i = 0; i < 1024; i++) cpe->ch[channel].coeffs[i] /= 512;
     }else{
         for (k = 0; k < 1024; k += 128) {
             memcpy(s->output, cpe->ch[channel].saved + k + !k*1024 - 128, sizeof(float)*128);
             j = channel + k * avctx->channels;
             for (i = 0; i < 128; i++, j += avctx->channels){
-                s->output[i+128]          = audio[j] / 512 * s->kbd_short_128[128 - i - 1];
-                cpe->ch[channel].saved[i+k] = audio[j] / 512 * s->kbd_short_128[i];
+                s->output[i+128]          = audio[j] / 512.0 * s->kbd_short_128[128 - i - 1];
+                cpe->ch[channel].saved[i+k] = audio[j] / 512.0 * s->kbd_short_128[i];
             }
             ff_mdct_calc(&s->mdct128, cpe->ch[channel].coeffs + k, s->output, s->tmp);
         }



More information about the FFmpeg-soc mailing list