Mercurial > libavcodec.hg
comparison rdft.c @ 11512:1382cfff33bb libavcodec
Call rdft by function pointer
Call the RDFT by a function pointer like other FFT related transforms.
This makes instruction set optimized versions possible.
Based on patch by Alex Converse.
author | mru |
---|---|
date | Sat, 20 Mar 2010 21:27:03 +0000 |
parents | 6f1697664bf2 |
children | 66da6ffd7ed5 |
comparison
equal
deleted
inserted
replaced
11511:6bf21de8e6eb | 11512:1382cfff33bb |
---|---|
48 NULL, NULL, NULL, NULL, | 48 NULL, NULL, NULL, NULL, |
49 ff_sin_16, ff_sin_32, ff_sin_64, ff_sin_128, ff_sin_256, ff_sin_512, ff_sin_1024, | 49 ff_sin_16, ff_sin_32, ff_sin_64, ff_sin_128, ff_sin_256, ff_sin_512, ff_sin_1024, |
50 ff_sin_2048, ff_sin_4096, ff_sin_8192, ff_sin_16384, ff_sin_32768, ff_sin_65536, | 50 ff_sin_2048, ff_sin_4096, ff_sin_8192, ff_sin_16384, ff_sin_32768, ff_sin_65536, |
51 }; | 51 }; |
52 | 52 |
53 static void ff_rdft_calc_c(RDFTContext* s, FFTSample* data); | |
54 | |
53 av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans) | 55 av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans) |
54 { | 56 { |
55 int n = 1 << nbits; | 57 int n = 1 << nbits; |
56 int i; | 58 int i; |
57 const double theta = (trans == DFT_R2C || trans == DFT_C2R ? -1 : 1)*2*M_PI/n; | 59 const double theta = (trans == DFT_R2C || trans == DFT_C2R ? -1 : 1)*2*M_PI/n; |
72 #if !CONFIG_HARDCODED_TABLES | 74 #if !CONFIG_HARDCODED_TABLES |
73 for (i = 0; i < (n>>2); i++) { | 75 for (i = 0; i < (n>>2); i++) { |
74 s->tsin[i] = sin(i*theta); | 76 s->tsin[i] = sin(i*theta); |
75 } | 77 } |
76 #endif | 78 #endif |
79 s->rdft_calc = ff_rdft_calc_c; | |
77 return 0; | 80 return 0; |
78 } | 81 } |
79 | 82 |
80 /** Map one real FFT into two parallel real even and odd FFTs. Then interleave | 83 /** Map one real FFT into two parallel real even and odd FFTs. Then interleave |
81 * the two real FFTs into one complex FFT. Unmangle the results. | 84 * the two real FFTs into one complex FFT. Unmangle the results. |
121 ff_fft_permute(&s->fft, (FFTComplex*)data); | 124 ff_fft_permute(&s->fft, (FFTComplex*)data); |
122 ff_fft_calc(&s->fft, (FFTComplex*)data); | 125 ff_fft_calc(&s->fft, (FFTComplex*)data); |
123 } | 126 } |
124 } | 127 } |
125 | 128 |
126 void ff_rdft_calc(RDFTContext *s, FFTSample *data) | |
127 { | |
128 ff_rdft_calc_c(s, data); | |
129 } | |
130 | |
131 av_cold void ff_rdft_end(RDFTContext *s) | 129 av_cold void ff_rdft_end(RDFTContext *s) |
132 { | 130 { |
133 ff_fft_end(&s->fft); | 131 ff_fft_end(&s->fft); |
134 } | 132 } |