comparison rdft.c @ 10408:8fd8f6c1cdcc libavcodec

Add support for hardcoded ff_sin_* tables.
author reimar
date Thu, 15 Oct 2009 18:04:55 +0000
parents 57acce8b1380
children 63910f7ba293
comparison
equal deleted inserted replaced
10407:57acce8b1380 10408:8fd8f6c1cdcc
25 * @file libavcodec/rdft.c 25 * @file libavcodec/rdft.c
26 * (Inverse) Real Discrete Fourier Transforms. 26 * (Inverse) Real Discrete Fourier Transforms.
27 */ 27 */
28 28
29 /* sin(2*pi*x/n) for 0<=x<n/4, followed by n/2<=x<3n/4 */ 29 /* sin(2*pi*x/n) for 0<=x<n/4, followed by n/2<=x<3n/4 */
30 #if !CONFIG_HARDCODED_TABLES
30 SINTABLE(16); 31 SINTABLE(16);
31 SINTABLE(32); 32 SINTABLE(32);
32 SINTABLE(64); 33 SINTABLE(64);
33 SINTABLE(128); 34 SINTABLE(128);
34 SINTABLE(256); 35 SINTABLE(256);
38 SINTABLE(4096); 39 SINTABLE(4096);
39 SINTABLE(8192); 40 SINTABLE(8192);
40 SINTABLE(16384); 41 SINTABLE(16384);
41 SINTABLE(32768); 42 SINTABLE(32768);
42 SINTABLE(65536); 43 SINTABLE(65536);
43 FFTSample * const ff_sin_tabs[] = { 44 #endif
45 SINTABLE_CONST FFTSample * const ff_sin_tabs[] = {
44 ff_sin_16, ff_sin_32, ff_sin_64, ff_sin_128, ff_sin_256, ff_sin_512, ff_sin_1024, 46 ff_sin_16, ff_sin_32, ff_sin_64, ff_sin_128, ff_sin_256, ff_sin_512, ff_sin_1024,
45 ff_sin_2048, ff_sin_4096, ff_sin_8192, ff_sin_16384, ff_sin_32768, ff_sin_65536, 47 ff_sin_2048, ff_sin_4096, ff_sin_8192, ff_sin_16384, ff_sin_32768, ff_sin_65536,
46 }; 48 };
47 49
48 av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans) 50 av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans)
61 if (ff_fft_init(&s->fft, nbits-1, trans == IRDFT || trans == RIDFT) < 0) 63 if (ff_fft_init(&s->fft, nbits-1, trans == IRDFT || trans == RIDFT) < 0)
62 return -1; 64 return -1;
63 65
64 s->tcos = ff_cos_tabs[nbits-4]; 66 s->tcos = ff_cos_tabs[nbits-4];
65 s->tsin = ff_sin_tabs[nbits-4]+(trans == RDFT || trans == IRIDFT)*(n>>2); 67 s->tsin = ff_sin_tabs[nbits-4]+(trans == RDFT || trans == IRIDFT)*(n>>2);
68 #if !CONFIG_HARDCODED_TABLES
66 for (i = 0; i < (n>>2); i++) { 69 for (i = 0; i < (n>>2); i++) {
67 s->tsin[i] = sin(i*theta); 70 s->tsin[i] = sin(i*theta);
68 } 71 }
72 #endif
69 return 0; 73 return 0;
70 } 74 }
71 75
72 /** Map one real FFT into two parallel real even and odd FFTs. Then interleave 76 /** Map one real FFT into two parallel real even and odd FFTs. Then interleave
73 * the two real FFTs into one complex FFT. Unmangle the results. 77 * the two real FFTs into one complex FFT. Unmangle the results.