comparison fft.c @ 8636:9766c268bc9f libavcodec

Clean up FFT related comments.
author alexc
date Thu, 22 Jan 2009 19:46:23 +0000
parents 04423b2f6e0b
children 3f72756b0c5c
comparison
equal deleted inserted replaced
8635:6b164adb1907 8636:9766c268bc9f
56 m >>= 1; 56 m >>= 1;
57 if(inverse == !(i&m)) return split_radix_permutation(i, m, inverse)*4 + 1; 57 if(inverse == !(i&m)) return split_radix_permutation(i, m, inverse)*4 + 1;
58 else return split_radix_permutation(i, m, inverse)*4 - 1; 58 else return split_radix_permutation(i, m, inverse)*4 - 1;
59 } 59 }
60 60
61 /**
62 * The size of the FFT is 2^nbits. If inverse is TRUE, inverse FFT is
63 * done
64 */
65 int ff_fft_init(FFTContext *s, int nbits, int inverse) 61 int ff_fft_init(FFTContext *s, int nbits, int inverse)
66 { 62 {
67 int i, j, m, n; 63 int i, j, m, n;
68 float alpha, c1, s1, s2; 64 float alpha, c1, s1, s2;
69 int split_radix = 1; 65 int split_radix = 1;
183 av_freep(&s->exptab1); 179 av_freep(&s->exptab1);
184 av_freep(&s->tmp_buf); 180 av_freep(&s->tmp_buf);
185 return -1; 181 return -1;
186 } 182 }
187 183
188 /**
189 * Do the permutation needed BEFORE calling ff_fft_calc()
190 */
191 void ff_fft_permute_c(FFTContext *s, FFTComplex *z) 184 void ff_fft_permute_c(FFTContext *s, FFTComplex *z)
192 { 185 {
193 int j, k, np; 186 int j, k, np;
194 FFTComplex tmp; 187 FFTComplex tmp;
195 const uint16_t *revtab = s->revtab; 188 const uint16_t *revtab = s->revtab;
372 static void (*fft_dispatch[])(FFTComplex*) = { 365 static void (*fft_dispatch[])(FFTComplex*) = {
373 fft4, fft8, fft16, fft32, fft64, fft128, fft256, fft512, fft1024, 366 fft4, fft8, fft16, fft32, fft64, fft128, fft256, fft512, fft1024,
374 fft2048, fft4096, fft8192, fft16384, fft32768, fft65536, 367 fft2048, fft4096, fft8192, fft16384, fft32768, fft65536,
375 }; 368 };
376 369
377 /**
378 * Do a complex FFT with the parameters defined in ff_fft_init(). The
379 * input data must be permuted before with s->revtab table. No
380 * 1.0/sqrt(n) normalization is done.
381 */
382 void ff_fft_calc_c(FFTContext *s, FFTComplex *z) 370 void ff_fft_calc_c(FFTContext *s, FFTComplex *z)
383 { 371 {
384 fft_dispatch[s->nbits-2](z); 372 fft_dispatch[s->nbits-2](z);
385 } 373 }
386 374