From 223217746c5beaa6110ce9ade2a582fc10d3d630 Mon Sep 17 00:00:00 2001 From: Reimar Döffinger Date: Wed, 4 Nov 2009 17:30:23 +0000 Subject: 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 --- libavcodec/dsputil.h | 2 +- libavcodec/fft.c | 3 ++- libavcodec/rdft.c | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index c097461c4a..d64ef939ac 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -767,7 +767,7 @@ extern COSTABLE(8192); extern COSTABLE(16384); extern COSTABLE(32768); extern COSTABLE(65536); -extern COSTABLE_CONST FFTSample* const ff_cos_tabs[13]; +extern COSTABLE_CONST FFTSample* const ff_cos_tabs[17]; extern SINTABLE(16); extern SINTABLE(32); 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<fft, nbits-1, trans == IRDFT || trans == RIDFT) < 0) return -1; - s->tcos = ff_cos_tabs[nbits-4]; - s->tsin = ff_sin_tabs[nbits-4]+(trans == RDFT || trans == IRIDFT)*(n>>2); + s->tcos = ff_cos_tabs[nbits]; + s->tsin = ff_sin_tabs[nbits]+(trans == RDFT || trans == IRIDFT)*(n>>2); #if !CONFIG_HARDCODED_TABLES for (i = 0; i < (n>>2); i++) { s->tsin[i] = sin(i*theta); -- cgit v1.2.3