comparison fft.c @ 10492:63910f7ba293 libavcodec

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.
author reimar
date Wed, 04 Nov 2009 17:30:23 +0000
parents 57acce8b1380
children 74b0c1a0851e
comparison
equal deleted inserted replaced
10491:74e51b86b934 10492:63910f7ba293
43 COSTABLE(16384); 43 COSTABLE(16384);
44 COSTABLE(32768); 44 COSTABLE(32768);
45 COSTABLE(65536); 45 COSTABLE(65536);
46 #endif 46 #endif
47 COSTABLE_CONST FFTSample * const ff_cos_tabs[] = { 47 COSTABLE_CONST FFTSample * const ff_cos_tabs[] = {
48 NULL, NULL, NULL, NULL,
48 ff_cos_16, ff_cos_32, ff_cos_64, ff_cos_128, ff_cos_256, ff_cos_512, ff_cos_1024, 49 ff_cos_16, ff_cos_32, ff_cos_64, ff_cos_128, ff_cos_256, ff_cos_512, ff_cos_1024,
49 ff_cos_2048, ff_cos_4096, ff_cos_8192, ff_cos_16384, ff_cos_32768, ff_cos_65536, 50 ff_cos_2048, ff_cos_4096, ff_cos_8192, ff_cos_16384, ff_cos_32768, ff_cos_65536,
50 }; 51 };
51 52
52 static int split_radix_permutation(int i, int n, int inverse) 53 static int split_radix_permutation(int i, int n, int inverse)
97 if (s->split_radix) { 98 if (s->split_radix) {
98 #if !CONFIG_HARDCODED_TABLES 99 #if !CONFIG_HARDCODED_TABLES
99 for(j=4; j<=nbits; j++) { 100 for(j=4; j<=nbits; j++) {
100 int m = 1<<j; 101 int m = 1<<j;
101 double freq = 2*M_PI/m; 102 double freq = 2*M_PI/m;
102 FFTSample *tab = ff_cos_tabs[j-4]; 103 FFTSample *tab = ff_cos_tabs[j];
103 for(i=0; i<=m/4; i++) 104 for(i=0; i<=m/4; i++)
104 tab[i] = cos(i*freq); 105 tab[i] = cos(i*freq);
105 for(i=1; i<m/4; i++) 106 for(i=1; i<m/4; i++)
106 tab[m/2-i] = tab[i]; 107 tab[m/2-i] = tab[i];
107 } 108 }