Commit 22321774 authored by Reimar Döffinger's avatar Reimar Döffinger

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
parent 981b8fd7
...@@ -767,7 +767,7 @@ extern COSTABLE(8192); ...@@ -767,7 +767,7 @@ extern COSTABLE(8192);
extern COSTABLE(16384); extern COSTABLE(16384);
extern COSTABLE(32768); extern COSTABLE(32768);
extern COSTABLE(65536); 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(16);
extern SINTABLE(32); extern SINTABLE(32);
......
...@@ -45,6 +45,7 @@ COSTABLE(32768); ...@@ -45,6 +45,7 @@ COSTABLE(32768);
COSTABLE(65536); COSTABLE(65536);
#endif #endif
COSTABLE_CONST FFTSample * const ff_cos_tabs[] = { 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_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, 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) ...@@ -99,7 +100,7 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
for(j=4; j<=nbits; j++) { for(j=4; j<=nbits; j++) {
int m = 1<<j; int m = 1<<j;
double freq = 2*M_PI/m; 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++) for(i=0; i<=m/4; i++)
tab[i] = cos(i*freq); tab[i] = cos(i*freq);
for(i=1; i<m/4; i++) for(i=1; i<m/4; i++)
......
...@@ -43,6 +43,7 @@ SINTABLE(32768); ...@@ -43,6 +43,7 @@ SINTABLE(32768);
SINTABLE(65536); SINTABLE(65536);
#endif #endif
SINTABLE_CONST FFTSample * const ff_sin_tabs[] = { SINTABLE_CONST FFTSample * const ff_sin_tabs[] = {
NULL, NULL, NULL, NULL,
ff_sin_16, ff_sin_32, ff_sin_64, ff_sin_128, ff_sin_256, ff_sin_512, ff_sin_1024, ff_sin_16, ff_sin_32, ff_sin_64, ff_sin_128, ff_sin_256, ff_sin_512, ff_sin_1024,
ff_sin_2048, ff_sin_4096, ff_sin_8192, ff_sin_16384, ff_sin_32768, ff_sin_65536, ff_sin_2048, ff_sin_4096, ff_sin_8192, ff_sin_16384, ff_sin_32768, ff_sin_65536,
}; };
...@@ -63,8 +64,8 @@ av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans) ...@@ -63,8 +64,8 @@ av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans)
if (ff_fft_init(&s->fft, nbits-1, trans == IRDFT || trans == RIDFT) < 0) if (ff_fft_init(&s->fft, nbits-1, trans == IRDFT || trans == RIDFT) < 0)
return -1; return -1;
s->tcos = ff_cos_tabs[nbits-4]; s->tcos = ff_cos_tabs[nbits];
s->tsin = ff_sin_tabs[nbits-4]+(trans == RDFT || trans == IRIDFT)*(n>>2); s->tsin = ff_sin_tabs[nbits]+(trans == RDFT || trans == IRIDFT)*(n>>2);
#if !CONFIG_HARDCODED_TABLES #if !CONFIG_HARDCODED_TABLES
for (i = 0; i < (n>>2); i++) { for (i = 0; i < (n>>2); i++) {
s->tsin[i] = sin(i*theta); s->tsin[i] = sin(i*theta);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment