[FFmpeg-devel] [PATCH] remove duplicate initialization of ff_cos_tabs in rdft.c

Reimar Döffinger Reimar.Doeffinger
Thu Oct 15 12:03:39 CEST 2009


Hello,
ff_rdft_init initializes the ff_cos_tabs already initialized by
ff_fft_init (which it already calls).
Even worse, it will initialize it with possibly slightly different
values (fft.c uses tab[m/2-i] = tab[i]; which IMO is a rather good idea,
and would be an even better on for sin, since sin() is far more precise
close to 0).
This also means it will crash when compiled with hardcoded tables (what
things use rdft.c? Nothing that is used by make test it seems?).
Either way, as a first step I propose this:
Index: rdft.c
===================================================================
--- rdft.c      (revision 20233)
+++ rdft.c      (working copy)
@@ -64,7 +64,6 @@
@@ -64,7 +64,6 @@
     s->tcos = ff_cos_tabs[nbits-4];
     s->tsin = ff_sin_tabs[nbits-4]+(trans == RDFT || trans == IRIDFT)*(n>>2);
     for (i = 0; i < (n>>2); i++) {
-        s->tcos[i] = cos(i*theta);
         s->tsin[i] = sin(i*theta);
     }
     return 0;




More information about the ffmpeg-devel mailing list