comparison fft.c @ 1879:dd63cb7e5080 libavcodec

fft_*() renamed into ff_fft_*() patch by (Gildas Bazin <gbazin at altern dot org>)
author michael
date Sat, 13 Mar 2004 21:43:24 +0000
parents 1e39f273ecd6
children ef2149182f1c
comparison
equal deleted inserted replaced
1878:838c18d1e7fc 1879:dd63cb7e5080
26 26
27 /** 27 /**
28 * The size of the FFT is 2^nbits. If inverse is TRUE, inverse FFT is 28 * The size of the FFT is 2^nbits. If inverse is TRUE, inverse FFT is
29 * done 29 * done
30 */ 30 */
31 int fft_init(FFTContext *s, int nbits, int inverse) 31 int ff_fft_init(FFTContext *s, int nbits, int inverse)
32 { 32 {
33 int i, j, m, n; 33 int i, j, m, n;
34 float alpha, c1, s1, s2; 34 float alpha, c1, s1, s2;
35 35
36 s->nbits = nbits; 36 s->nbits = nbits;
51 c1 = cos(alpha); 51 c1 = cos(alpha);
52 s1 = sin(alpha) * s2; 52 s1 = sin(alpha) * s2;
53 s->exptab[i].re = c1; 53 s->exptab[i].re = c1;
54 s->exptab[i].im = s1; 54 s->exptab[i].im = s1;
55 } 55 }
56 s->fft_calc = fft_calc_c; 56 s->fft_calc = ff_fft_calc_c;
57 s->exptab1 = NULL; 57 s->exptab1 = NULL;
58 58
59 /* compute constant table for HAVE_SSE version */ 59 /* compute constant table for HAVE_SSE version */
60 #if (defined(HAVE_MMX) && defined(HAVE_BUILTIN_VECTOR)) || defined(HAVE_ALTIVEC) 60 #if (defined(HAVE_MMX) && defined(HAVE_BUILTIN_VECTOR)) || defined(HAVE_ALTIVEC)
61 { 61 {
92 } 92 }
93 nblocks = nblocks >> 1; 93 nblocks = nblocks >> 1;
94 } while (nblocks != 0); 94 } while (nblocks != 0);
95 av_freep(&s->exptab); 95 av_freep(&s->exptab);
96 #if defined(HAVE_MMX) 96 #if defined(HAVE_MMX)
97 s->fft_calc = fft_calc_sse; 97 s->fft_calc = ff_fft_calc_sse;
98 #else 98 #else
99 s->fft_calc = fft_calc_altivec; 99 s->fft_calc = ff_fft_calc_altivec;
100 #endif 100 #endif
101 } 101 }
102 } 102 }
103 #endif 103 #endif
104 104
140 pre = (MUL16(are, bre) - MUL16(aim, bim));\ 140 pre = (MUL16(are, bre) - MUL16(aim, bim));\
141 pim = (MUL16(are, bim) + MUL16(bre, aim));\ 141 pim = (MUL16(are, bim) + MUL16(bre, aim));\
142 } 142 }
143 143
144 /** 144 /**
145 * Do a complex FFT with the parameters defined in fft_init(). The 145 * Do a complex FFT with the parameters defined in ff_fft_init(). The
146 * input data must be permuted before with s->revtab table. No 146 * input data must be permuted before with s->revtab table. No
147 * 1.0/sqrt(n) normalization is done. 147 * 1.0/sqrt(n) normalization is done.
148 */ 148 */
149 void fft_calc_c(FFTContext *s, FFTComplex *z) 149 void ff_fft_calc_c(FFTContext *s, FFTComplex *z)
150 { 150 {
151 int ln = s->nbits; 151 int ln = s->nbits;
152 int j, np, np2; 152 int j, np, np2;
153 int nblocks, nloops; 153 int nblocks, nloops;
154 register FFTComplex *p, *q; 154 register FFTComplex *p, *q;
219 nloops = nloops << 1; 219 nloops = nloops << 1;
220 } while (nblocks != 0); 220 } while (nblocks != 0);
221 } 221 }
222 222
223 /** 223 /**
224 * Do the permutation needed BEFORE calling fft_calc() 224 * Do the permutation needed BEFORE calling ff_fft_calc()
225 */ 225 */
226 void fft_permute(FFTContext *s, FFTComplex *z) 226 void ff_fft_permute(FFTContext *s, FFTComplex *z)
227 { 227 {
228 int j, k, np; 228 int j, k, np;
229 FFTComplex tmp; 229 FFTComplex tmp;
230 const uint16_t *revtab = s->revtab; 230 const uint16_t *revtab = s->revtab;
231 231
239 z[j] = tmp; 239 z[j] = tmp;
240 } 240 }
241 } 241 }
242 } 242 }
243 243
244 void fft_end(FFTContext *s) 244 void ff_fft_end(FFTContext *s)
245 { 245 {
246 av_freep(&s->revtab); 246 av_freep(&s->revtab);
247 av_freep(&s->exptab); 247 av_freep(&s->exptab);
248 av_freep(&s->exptab1); 248 av_freep(&s->exptab1);
249 } 249 }