summaryrefslogtreecommitdiff
path: root/libavcodec/fft.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-11-04 17:30:23 +0000
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-11-04 17:30:23 +0000
commit223217746c5beaa6110ce9ade2a582fc10d3d630 (patch)
treeefe7304981746185c85f16c977cca8691f381e74 /libavcodec/fft.c
parent981b8fd777f8ea273c53a055cbbb45ad9fe872aa (diff)
Pad ff_cos_tabs and ff_sin_tabs so that index n points to the table for n bits.
While this "wastes" up to 2x32 bytes it makes the code slightly simpler and less confusing. Originally committed as revision 20449 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/fft.c')
-rw-r--r--libavcodec/fft.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/fft.c b/libavcodec/fft.c
index e01005f501..958913b62c 100644
--- a/libavcodec/fft.c
+++ b/libavcodec/fft.c
@@ -45,6 +45,7 @@ COSTABLE(32768);
COSTABLE(65536);
#endif
COSTABLE_CONST FFTSample * const ff_cos_tabs[] = {
+ NULL, NULL, NULL, NULL,
ff_cos_16, ff_cos_32, ff_cos_64, ff_cos_128, ff_cos_256, ff_cos_512, ff_cos_1024,
ff_cos_2048, ff_cos_4096, ff_cos_8192, ff_cos_16384, ff_cos_32768, ff_cos_65536,
};
@@ -99,7 +100,7 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
for(j=4; j<=nbits; j++) {
int m = 1<<j;
double freq = 2*M_PI/m;
- FFTSample *tab = ff_cos_tabs[j-4];
+ FFTSample *tab = ff_cos_tabs[j];
for(i=0; i<=m/4; i++)
tab[i] = cos(i*freq);
for(i=1; i<m/4; i++)