comparison peck_fft.c @ 5:c7237a7544eb

cleanup
author Peter Meerwald <p.meerwald@bct-electronic.com>
date Fri, 16 Sep 2011 15:08:29 +0200
parents 2d6c49fcafcb
children fee54f1878f7
comparison
equal deleted inserted replaced
4:2d6c49fcafcb 5:c7237a7544eb
17 /* The guts header contains all the multiplication and addition macros that are defined for 17 /* The guts header contains all the multiplication and addition macros that are defined for
18 * fixed or floating point complex numbers. It also delares the kf_ internal functions. 18 * fixed or floating point complex numbers. It also delares the kf_ internal functions.
19 */ 19 */
20 20
21 static void kf_bfly2( 21 static void kf_bfly2(
22 peck_fft_cpx * Fout, 22 peck_fft_cpx *Fout,
23 const size_t fstride, 23 const size_t fstride,
24 const peck_fft_cfg st, 24 const peck_fft_cfg st,
25 int m) { 25 int m) {
26 26
27 //printf("kf_bfly2\n"); 27 //printf("kf_bfly2\n");
28 28
29 peck_fft_cpx * Fout2; 29 peck_fft_cpx *Fout2;
30 peck_fft_cpx * tw1 = st->twiddles; 30 peck_fft_cpx *tw1 = st->twiddles;
31 peck_fft_cpx t; 31 peck_fft_cpx t;
32 Fout2 = Fout + m; 32 Fout2 = Fout + m;
33 do { 33 do {
34 C_FIXDIV(*Fout, 2); 34 C_FIXDIV(*Fout, 2);
35 C_FIXDIV(*Fout2, 2); 35 C_FIXDIV(*Fout2, 2);
107 peck_fft_cpx epi3; 107 peck_fft_cpx epi3;
108 epi3 = st->twiddles[fstride*m]; 108 epi3 = st->twiddles[fstride*m];
109 109
110 printf("kf_bfly3\n"); 110 printf("kf_bfly3\n");
111 111
112 tw1=tw2=st->twiddles; 112 tw1 = tw2 = st->twiddles;
113 113
114 do { 114 do {
115 C_FIXDIV(*Fout,3); C_FIXDIV(Fout[m],3); C_FIXDIV(Fout[m2],3); 115 C_FIXDIV(*Fout,3); C_FIXDIV(Fout[m],3); C_FIXDIV(Fout[m2],3);
116 116
117 C_MUL(scratch[1],Fout[m] , *tw1); 117 C_MUL(scratch[1],Fout[m] , *tw1);
154 ya = twiddles[fstride*m]; 154 ya = twiddles[fstride*m];
155 yb = twiddles[fstride*2*m]; 155 yb = twiddles[fstride*2*m];
156 156
157 printf("kf_bfly5\n"); 157 printf("kf_bfly5\n");
158 158
159 Fout0=Fout; 159 Fout0 = Fout;
160 Fout1=Fout0+m; 160 Fout1 = Fout0 + m;
161 Fout2=Fout0+2*m; 161 Fout2 = Fout0 + 2*m;
162 Fout3=Fout0+3*m; 162 Fout3 = Fout0 + 3*m;
163 Fout4=Fout0+4*m; 163 Fout4 = Fout0 + 4*m;
164 164
165 tw=st->twiddles; 165 tw=st->twiddles;
166 for (u = 0; u < m; ++u) { 166 for (u = 0; u < m; ++u) {
167 C_FIXDIV( *Fout0,5); C_FIXDIV( *Fout1,5); C_FIXDIV( *Fout2,5); C_FIXDIV( *Fout3,5); C_FIXDIV( *Fout4,5); 167 C_FIXDIV( *Fout0,5); C_FIXDIV( *Fout1,5); C_FIXDIV( *Fout2,5); C_FIXDIV( *Fout3,5); C_FIXDIV( *Fout4,5);
168 scratch[0] = *Fout0; 168 scratch[0] = *Fout0;
246 peck_fft_cpx * Fout, 246 peck_fft_cpx * Fout,
247 const peck_fft_cpx * f, 247 const peck_fft_cpx * f,
248 const size_t fstride, 248 const size_t fstride,
249 int *factors, 249 int *factors,
250 const peck_fft_cfg st) { 250 const peck_fft_cfg st) {
251
251 peck_fft_cpx *Fout_beg = Fout; 252 peck_fft_cpx *Fout_beg = Fout;
252 const int p = *factors++; /* the radix */ 253 const int p = *factors++; /* the radix */
253 const int m = *factors++; /* stage's FFT length / p */ 254 const int m = *factors++; /* stage's FFT length / p */
254 const peck_fft_cpx *Fout_end = Fout + p*m; 255 const peck_fft_cpx *Fout_end = Fout + p*m;
255 256
269 kf_work(Fout, f, fstride*p, factors, st); 270 kf_work(Fout, f, fstride*p, factors, st);
270 f += fstride; 271 f += fstride;
271 } while ((Fout += m) != Fout_end); 272 } while ((Fout += m) != Fout_end);
272 } 273 }
273 274
274 Fout=Fout_beg; 275 Fout = Fout_beg;
275 276
276 // recombine the p smaller DFTs 277 // recombine the p smaller DFTs
277 switch (p) { 278 switch (p) {
278 case 2: kf_bfly2(Fout, fstride, st, m); break; 279 case 2: kf_bfly2(Fout, fstride, st, m); break;
279 case 3: kf_bfly3(Fout, fstride, st, m); break; 280 case 3: kf_bfly3(Fout, fstride, st, m); break;

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.