comparison peck_fft.c @ 6:fee54f1878f7

kill FIXED_POINT stuff, simplify
author Peter Meerwald <p.meerwald@bct-electronic.com>
date Fri, 16 Sep 2011 15:18:28 +0200
parents c7237a7544eb
children 707be088ccc3
comparison
equal deleted inserted replaced
5:c7237a7544eb 6:fee54f1878f7
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);
35 C_FIXDIV(*Fout2, 2);
36
37 C_MUL(t, *Fout2, *tw1); 34 C_MUL(t, *Fout2, *tw1);
38 tw1 += fstride; 35 tw1 += fstride;
39 C_SUB(*Fout2, *Fout, t); 36 C_SUB(*Fout2, *Fout, t);
40 C_ADDTO(*Fout, t); 37 C_ADDTO(*Fout, t);
41 ++Fout2; 38 ++Fout2;
58 //printf("kf_bfly4\n"); 55 //printf("kf_bfly4\n");
59 56
60 tw3 = tw2 = tw1 = st->twiddles; 57 tw3 = tw2 = tw1 = st->twiddles;
61 58
62 do { 59 do {
63 C_FIXDIV(*Fout, 4);
64 C_FIXDIV(Fout[m], 4);
65 C_FIXDIV(Fout[m2], 4);
66 C_FIXDIV(Fout[m3], 4);
67
68 C_MUL(scratch[0], Fout[m], *tw1); 60 C_MUL(scratch[0], Fout[m], *tw1);
69 C_MUL(scratch[1], Fout[m2], *tw2); 61 C_MUL(scratch[1], Fout[m2], *tw2);
70 C_MUL(scratch[2], Fout[m3], *tw3); 62 C_MUL(scratch[2], Fout[m3], *tw3);
71 63
72 C_SUB(scratch[5], *Fout, scratch[1]); 64 C_SUB(scratch[5], *Fout, scratch[1]);
110 printf("kf_bfly3\n"); 102 printf("kf_bfly3\n");
111 103
112 tw1 = tw2 = st->twiddles; 104 tw1 = tw2 = st->twiddles;
113 105
114 do { 106 do {
115 C_FIXDIV(*Fout,3); C_FIXDIV(Fout[m],3); C_FIXDIV(Fout[m2],3);
116
117 C_MUL(scratch[1],Fout[m] , *tw1); 107 C_MUL(scratch[1],Fout[m] , *tw1);
118 C_MUL(scratch[2],Fout[m2] , *tw2); 108 C_MUL(scratch[2],Fout[m2] , *tw2);
119 109
120 C_ADD(scratch[3],scratch[1],scratch[2]); 110 C_ADD(scratch[3],scratch[1],scratch[2]);
121 C_SUB(scratch[0],scratch[1],scratch[2]); 111 C_SUB(scratch[0],scratch[1],scratch[2]);
162 Fout3 = Fout0 + 3*m; 152 Fout3 = Fout0 + 3*m;
163 Fout4 = Fout0 + 4*m; 153 Fout4 = Fout0 + 4*m;
164 154
165 tw=st->twiddles; 155 tw=st->twiddles;
166 for (u = 0; u < m; ++u) { 156 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);
168 scratch[0] = *Fout0; 157 scratch[0] = *Fout0;
169 158
170 C_MUL(scratch[1] ,*Fout1, tw[u*fstride]); 159 C_MUL(scratch[1], *Fout1, tw[u*fstride]);
171 C_MUL(scratch[2] ,*Fout2, tw[2*u*fstride]); 160 C_MUL(scratch[2], *Fout2, tw[2*u*fstride]);
172 C_MUL(scratch[3] ,*Fout3, tw[3*u*fstride]); 161 C_MUL(scratch[3], *Fout3, tw[3*u*fstride]);
173 C_MUL(scratch[4] ,*Fout4, tw[4*u*fstride]); 162 C_MUL(scratch[4], *Fout4, tw[4*u*fstride]);
174 163
175 C_ADD( scratch[7],scratch[1],scratch[4]); 164 C_ADD(scratch[7], scratch[1], scratch[4]);
176 C_SUB( scratch[10],scratch[1],scratch[4]); 165 C_SUB(scratch[10], scratch[1], scratch[4]);
177 C_ADD( scratch[8],scratch[2],scratch[3]); 166 C_ADD(scratch[8], scratch[2], scratch[3]);
178 C_SUB( scratch[9],scratch[2],scratch[3]); 167 C_SUB(scratch[9], scratch[2], scratch[3]);
179 168
180 Fout0->r += scratch[7].r + scratch[8].r; 169 Fout0->r += scratch[7].r + scratch[8].r;
181 Fout0->i += scratch[7].i + scratch[8].i; 170 Fout0->i += scratch[7].i + scratch[8].i;
182 171
183 scratch[5].r = scratch[0].r + S_MUL(scratch[7].r,ya.r) + S_MUL(scratch[8].r,yb.r); 172 scratch[5].r = scratch[0].r + S_MUL(scratch[7].r,ya.r) + S_MUL(scratch[8].r,yb.r);
220 209
221 for ( u=0; u<m; ++u ) { 210 for ( u=0; u<m; ++u ) {
222 k=u; 211 k=u;
223 for (q1 = 0; q1 < p; ++q1) { 212 for (q1 = 0; q1 < p; ++q1) {
224 scratch[q1] = Fout[k]; 213 scratch[q1] = Fout[k];
225 C_FIXDIV(scratch[q1], p);
226 k += m; 214 k += m;
227 } 215 }
228 216
229 k=u; 217 k=u;
230 for ( q1=0 ; q1<p ; ++q1 ) { 218 for ( q1=0 ; q1<p ; ++q1 ) {

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