1*84e33947SAndroid Build Coastguard Worker #ifndef KISSFFT_CLASS_HH 2*84e33947SAndroid Build Coastguard Worker #include <complex> 3*84e33947SAndroid Build Coastguard Worker #include <vector> 4*84e33947SAndroid Build Coastguard Worker 5*84e33947SAndroid Build Coastguard Worker namespace kissfft_utils { 6*84e33947SAndroid Build Coastguard Worker 7*84e33947SAndroid Build Coastguard Worker template <typename T_scalar> 8*84e33947SAndroid Build Coastguard Worker struct traits 9*84e33947SAndroid Build Coastguard Worker { 10*84e33947SAndroid Build Coastguard Worker typedef T_scalar scalar_type; 11*84e33947SAndroid Build Coastguard Worker typedef std::complex<scalar_type> cpx_type; fill_twiddleskissfft_utils::traits12*84e33947SAndroid Build Coastguard Worker void fill_twiddles( std::complex<T_scalar> * dst ,int nfft,bool inverse) 13*84e33947SAndroid Build Coastguard Worker { 14*84e33947SAndroid Build Coastguard Worker T_scalar phinc = (inverse?2:-2)* acos( (T_scalar) -1) / nfft; 15*84e33947SAndroid Build Coastguard Worker for (int i=0;i<nfft;++i) 16*84e33947SAndroid Build Coastguard Worker dst[i] = exp( std::complex<T_scalar>(0,i*phinc) ); 17*84e33947SAndroid Build Coastguard Worker } 18*84e33947SAndroid Build Coastguard Worker preparekissfft_utils::traits19*84e33947SAndroid Build Coastguard Worker void prepare( 20*84e33947SAndroid Build Coastguard Worker std::vector< std::complex<T_scalar> > & dst, 21*84e33947SAndroid Build Coastguard Worker int nfft,bool inverse, 22*84e33947SAndroid Build Coastguard Worker std::vector<int> & stageRadix, 23*84e33947SAndroid Build Coastguard Worker std::vector<int> & stageRemainder ) 24*84e33947SAndroid Build Coastguard Worker { 25*84e33947SAndroid Build Coastguard Worker _twiddles.resize(nfft); 26*84e33947SAndroid Build Coastguard Worker fill_twiddles( &_twiddles[0],nfft,inverse); 27*84e33947SAndroid Build Coastguard Worker dst = _twiddles; 28*84e33947SAndroid Build Coastguard Worker 29*84e33947SAndroid Build Coastguard Worker //factorize 30*84e33947SAndroid Build Coastguard Worker //start factoring out 4's, then 2's, then 3,5,7,9,... 31*84e33947SAndroid Build Coastguard Worker int n= nfft; 32*84e33947SAndroid Build Coastguard Worker int p=4; 33*84e33947SAndroid Build Coastguard Worker do { 34*84e33947SAndroid Build Coastguard Worker while (n % p) { 35*84e33947SAndroid Build Coastguard Worker switch (p) { 36*84e33947SAndroid Build Coastguard Worker case 4: p = 2; break; 37*84e33947SAndroid Build Coastguard Worker case 2: p = 3; break; 38*84e33947SAndroid Build Coastguard Worker default: p += 2; break; 39*84e33947SAndroid Build Coastguard Worker } 40*84e33947SAndroid Build Coastguard Worker if (p*p>n) 41*84e33947SAndroid Build Coastguard Worker p=n;// no more factors 42*84e33947SAndroid Build Coastguard Worker } 43*84e33947SAndroid Build Coastguard Worker n /= p; 44*84e33947SAndroid Build Coastguard Worker stageRadix.push_back(p); 45*84e33947SAndroid Build Coastguard Worker stageRemainder.push_back(n); 46*84e33947SAndroid Build Coastguard Worker }while(n>1); 47*84e33947SAndroid Build Coastguard Worker } 48*84e33947SAndroid Build Coastguard Worker std::vector<cpx_type> _twiddles; 49*84e33947SAndroid Build Coastguard Worker 50*84e33947SAndroid Build Coastguard Worker twiddlekissfft_utils::traits51*84e33947SAndroid Build Coastguard Worker const cpx_type twiddle(int i) { return _twiddles[i]; } 52*84e33947SAndroid Build Coastguard Worker }; 53*84e33947SAndroid Build Coastguard Worker 54*84e33947SAndroid Build Coastguard Worker } 55*84e33947SAndroid Build Coastguard Worker 56*84e33947SAndroid Build Coastguard Worker template <typename T_Scalar, 57*84e33947SAndroid Build Coastguard Worker typename T_traits=kissfft_utils::traits<T_Scalar> 58*84e33947SAndroid Build Coastguard Worker > 59*84e33947SAndroid Build Coastguard Worker class kissfft 60*84e33947SAndroid Build Coastguard Worker { 61*84e33947SAndroid Build Coastguard Worker public: 62*84e33947SAndroid Build Coastguard Worker typedef T_traits traits_type; 63*84e33947SAndroid Build Coastguard Worker typedef typename traits_type::scalar_type scalar_type; 64*84e33947SAndroid Build Coastguard Worker typedef typename traits_type::cpx_type cpx_type; 65*84e33947SAndroid Build Coastguard Worker kissfft(int nfft,bool inverse,const traits_type & traits=traits_type ())66*84e33947SAndroid Build Coastguard Worker kissfft(int nfft,bool inverse,const traits_type & traits=traits_type() ) 67*84e33947SAndroid Build Coastguard Worker :_nfft(nfft),_inverse(inverse),_traits(traits) 68*84e33947SAndroid Build Coastguard Worker { 69*84e33947SAndroid Build Coastguard Worker _traits.prepare(_twiddles, _nfft,_inverse ,_stageRadix, _stageRemainder); 70*84e33947SAndroid Build Coastguard Worker } 71*84e33947SAndroid Build Coastguard Worker transform(const cpx_type * src,cpx_type * dst)72*84e33947SAndroid Build Coastguard Worker void transform(const cpx_type * src , cpx_type * dst) 73*84e33947SAndroid Build Coastguard Worker { 74*84e33947SAndroid Build Coastguard Worker kf_work(0, dst, src, 1,1); 75*84e33947SAndroid Build Coastguard Worker } 76*84e33947SAndroid Build Coastguard Worker 77*84e33947SAndroid Build Coastguard Worker private: kf_work(int stage,cpx_type * Fout,const cpx_type * f,size_t fstride,size_t in_stride)78*84e33947SAndroid Build Coastguard Worker void kf_work( int stage,cpx_type * Fout, const cpx_type * f, size_t fstride,size_t in_stride) 79*84e33947SAndroid Build Coastguard Worker { 80*84e33947SAndroid Build Coastguard Worker int p = _stageRadix[stage]; 81*84e33947SAndroid Build Coastguard Worker int m = _stageRemainder[stage]; 82*84e33947SAndroid Build Coastguard Worker cpx_type * Fout_beg = Fout; 83*84e33947SAndroid Build Coastguard Worker cpx_type * Fout_end = Fout + p*m; 84*84e33947SAndroid Build Coastguard Worker 85*84e33947SAndroid Build Coastguard Worker if (m==1) { 86*84e33947SAndroid Build Coastguard Worker do{ 87*84e33947SAndroid Build Coastguard Worker *Fout = *f; 88*84e33947SAndroid Build Coastguard Worker f += fstride*in_stride; 89*84e33947SAndroid Build Coastguard Worker }while(++Fout != Fout_end ); 90*84e33947SAndroid Build Coastguard Worker }else{ 91*84e33947SAndroid Build Coastguard Worker do{ 92*84e33947SAndroid Build Coastguard Worker // recursive call: 93*84e33947SAndroid Build Coastguard Worker // DFT of size m*p performed by doing 94*84e33947SAndroid Build Coastguard Worker // p instances of smaller DFTs of size m, 95*84e33947SAndroid Build Coastguard Worker // each one takes a decimated version of the input 96*84e33947SAndroid Build Coastguard Worker kf_work(stage+1, Fout , f, fstride*p,in_stride); 97*84e33947SAndroid Build Coastguard Worker f += fstride*in_stride; 98*84e33947SAndroid Build Coastguard Worker }while( (Fout += m) != Fout_end ); 99*84e33947SAndroid Build Coastguard Worker } 100*84e33947SAndroid Build Coastguard Worker 101*84e33947SAndroid Build Coastguard Worker Fout=Fout_beg; 102*84e33947SAndroid Build Coastguard Worker 103*84e33947SAndroid Build Coastguard Worker // recombine the p smaller DFTs 104*84e33947SAndroid Build Coastguard Worker switch (p) { 105*84e33947SAndroid Build Coastguard Worker case 2: kf_bfly2(Fout,fstride,m); break; 106*84e33947SAndroid Build Coastguard Worker case 3: kf_bfly3(Fout,fstride,m); break; 107*84e33947SAndroid Build Coastguard Worker case 4: kf_bfly4(Fout,fstride,m); break; 108*84e33947SAndroid Build Coastguard Worker case 5: kf_bfly5(Fout,fstride,m); break; 109*84e33947SAndroid Build Coastguard Worker default: kf_bfly_generic(Fout,fstride,m,p); break; 110*84e33947SAndroid Build Coastguard Worker } 111*84e33947SAndroid Build Coastguard Worker } 112*84e33947SAndroid Build Coastguard Worker 113*84e33947SAndroid Build Coastguard Worker // these were #define macros in the original kiss_fft C_ADD(cpx_type & c,const cpx_type & a,const cpx_type & b)114*84e33947SAndroid Build Coastguard Worker void C_ADD( cpx_type & c,const cpx_type & a,const cpx_type & b) { c=a+b;} C_MUL(cpx_type & c,const cpx_type & a,const cpx_type & b)115*84e33947SAndroid Build Coastguard Worker void C_MUL( cpx_type & c,const cpx_type & a,const cpx_type & b) { c=a*b;} C_SUB(cpx_type & c,const cpx_type & a,const cpx_type & b)116*84e33947SAndroid Build Coastguard Worker void C_SUB( cpx_type & c,const cpx_type & a,const cpx_type & b) { c=a-b;} C_ADDTO(cpx_type & c,const cpx_type & a)117*84e33947SAndroid Build Coastguard Worker void C_ADDTO( cpx_type & c,const cpx_type & a) { c+=a;} C_FIXDIV(cpx_type &,int)118*84e33947SAndroid Build Coastguard Worker void C_FIXDIV( cpx_type & ,int ) {} // NO-OP for float types S_MUL(const scalar_type & a,const scalar_type & b)119*84e33947SAndroid Build Coastguard Worker scalar_type S_MUL( const scalar_type & a,const scalar_type & b) { return a*b;} HALF_OF(const scalar_type & a)120*84e33947SAndroid Build Coastguard Worker scalar_type HALF_OF( const scalar_type & a) { return a*.5;} C_MULBYSCALAR(cpx_type & c,const scalar_type & a)121*84e33947SAndroid Build Coastguard Worker void C_MULBYSCALAR(cpx_type & c,const scalar_type & a) {c*=a;} 122*84e33947SAndroid Build Coastguard Worker kf_bfly2(cpx_type * Fout,const size_t fstride,int m)123*84e33947SAndroid Build Coastguard Worker void kf_bfly2( cpx_type * Fout, const size_t fstride, int m) 124*84e33947SAndroid Build Coastguard Worker { 125*84e33947SAndroid Build Coastguard Worker for (int k=0;k<m;++k) { 126*84e33947SAndroid Build Coastguard Worker cpx_type t = Fout[m+k] * _traits.twiddle(k*fstride); 127*84e33947SAndroid Build Coastguard Worker Fout[m+k] = Fout[k] - t; 128*84e33947SAndroid Build Coastguard Worker Fout[k] += t; 129*84e33947SAndroid Build Coastguard Worker } 130*84e33947SAndroid Build Coastguard Worker } 131*84e33947SAndroid Build Coastguard Worker kf_bfly4(cpx_type * Fout,const size_t fstride,const size_t m)132*84e33947SAndroid Build Coastguard Worker void kf_bfly4( cpx_type * Fout, const size_t fstride, const size_t m) 133*84e33947SAndroid Build Coastguard Worker { 134*84e33947SAndroid Build Coastguard Worker cpx_type scratch[7]; 135*84e33947SAndroid Build Coastguard Worker int negative_if_inverse = _inverse * -2 +1; 136*84e33947SAndroid Build Coastguard Worker for (size_t k=0;k<m;++k) { 137*84e33947SAndroid Build Coastguard Worker scratch[0] = Fout[k+m] * _traits.twiddle(k*fstride); 138*84e33947SAndroid Build Coastguard Worker scratch[1] = Fout[k+2*m] * _traits.twiddle(k*fstride*2); 139*84e33947SAndroid Build Coastguard Worker scratch[2] = Fout[k+3*m] * _traits.twiddle(k*fstride*3); 140*84e33947SAndroid Build Coastguard Worker scratch[5] = Fout[k] - scratch[1]; 141*84e33947SAndroid Build Coastguard Worker 142*84e33947SAndroid Build Coastguard Worker Fout[k] += scratch[1]; 143*84e33947SAndroid Build Coastguard Worker scratch[3] = scratch[0] + scratch[2]; 144*84e33947SAndroid Build Coastguard Worker scratch[4] = scratch[0] - scratch[2]; 145*84e33947SAndroid Build Coastguard Worker scratch[4] = cpx_type( scratch[4].imag()*negative_if_inverse , -scratch[4].real()* negative_if_inverse ); 146*84e33947SAndroid Build Coastguard Worker 147*84e33947SAndroid Build Coastguard Worker Fout[k+2*m] = Fout[k] - scratch[3]; 148*84e33947SAndroid Build Coastguard Worker Fout[k] += scratch[3]; 149*84e33947SAndroid Build Coastguard Worker Fout[k+m] = scratch[5] + scratch[4]; 150*84e33947SAndroid Build Coastguard Worker Fout[k+3*m] = scratch[5] - scratch[4]; 151*84e33947SAndroid Build Coastguard Worker } 152*84e33947SAndroid Build Coastguard Worker } 153*84e33947SAndroid Build Coastguard Worker kf_bfly3(cpx_type * Fout,const size_t fstride,const size_t m)154*84e33947SAndroid Build Coastguard Worker void kf_bfly3( cpx_type * Fout, const size_t fstride, const size_t m) 155*84e33947SAndroid Build Coastguard Worker { 156*84e33947SAndroid Build Coastguard Worker size_t k=m; 157*84e33947SAndroid Build Coastguard Worker const size_t m2 = 2*m; 158*84e33947SAndroid Build Coastguard Worker cpx_type *tw1,*tw2; 159*84e33947SAndroid Build Coastguard Worker cpx_type scratch[5]; 160*84e33947SAndroid Build Coastguard Worker cpx_type epi3; 161*84e33947SAndroid Build Coastguard Worker epi3 = _twiddles[fstride*m]; 162*84e33947SAndroid Build Coastguard Worker 163*84e33947SAndroid Build Coastguard Worker tw1=tw2=&_twiddles[0]; 164*84e33947SAndroid Build Coastguard Worker 165*84e33947SAndroid Build Coastguard Worker do{ 166*84e33947SAndroid Build Coastguard Worker C_FIXDIV(*Fout,3); C_FIXDIV(Fout[m],3); C_FIXDIV(Fout[m2],3); 167*84e33947SAndroid Build Coastguard Worker 168*84e33947SAndroid Build Coastguard Worker C_MUL(scratch[1],Fout[m] , *tw1); 169*84e33947SAndroid Build Coastguard Worker C_MUL(scratch[2],Fout[m2] , *tw2); 170*84e33947SAndroid Build Coastguard Worker 171*84e33947SAndroid Build Coastguard Worker C_ADD(scratch[3],scratch[1],scratch[2]); 172*84e33947SAndroid Build Coastguard Worker C_SUB(scratch[0],scratch[1],scratch[2]); 173*84e33947SAndroid Build Coastguard Worker tw1 += fstride; 174*84e33947SAndroid Build Coastguard Worker tw2 += fstride*2; 175*84e33947SAndroid Build Coastguard Worker 176*84e33947SAndroid Build Coastguard Worker Fout[m] = cpx_type( Fout->real() - HALF_OF(scratch[3].real() ) , Fout->imag() - HALF_OF(scratch[3].imag() ) ); 177*84e33947SAndroid Build Coastguard Worker 178*84e33947SAndroid Build Coastguard Worker C_MULBYSCALAR( scratch[0] , epi3.imag() ); 179*84e33947SAndroid Build Coastguard Worker 180*84e33947SAndroid Build Coastguard Worker C_ADDTO(*Fout,scratch[3]); 181*84e33947SAndroid Build Coastguard Worker 182*84e33947SAndroid Build Coastguard Worker Fout[m2] = cpx_type( Fout[m].real() + scratch[0].imag() , Fout[m].imag() - scratch[0].real() ); 183*84e33947SAndroid Build Coastguard Worker 184*84e33947SAndroid Build Coastguard Worker C_ADDTO( Fout[m] , cpx_type( -scratch[0].imag(),scratch[0].real() ) ); 185*84e33947SAndroid Build Coastguard Worker ++Fout; 186*84e33947SAndroid Build Coastguard Worker }while(--k); 187*84e33947SAndroid Build Coastguard Worker } 188*84e33947SAndroid Build Coastguard Worker kf_bfly5(cpx_type * Fout,const size_t fstride,const size_t m)189*84e33947SAndroid Build Coastguard Worker void kf_bfly5( cpx_type * Fout, const size_t fstride, const size_t m) 190*84e33947SAndroid Build Coastguard Worker { 191*84e33947SAndroid Build Coastguard Worker cpx_type *Fout0,*Fout1,*Fout2,*Fout3,*Fout4; 192*84e33947SAndroid Build Coastguard Worker size_t u; 193*84e33947SAndroid Build Coastguard Worker cpx_type scratch[13]; 194*84e33947SAndroid Build Coastguard Worker cpx_type * twiddles = &_twiddles[0]; 195*84e33947SAndroid Build Coastguard Worker cpx_type *tw; 196*84e33947SAndroid Build Coastguard Worker cpx_type ya,yb; 197*84e33947SAndroid Build Coastguard Worker ya = twiddles[fstride*m]; 198*84e33947SAndroid Build Coastguard Worker yb = twiddles[fstride*2*m]; 199*84e33947SAndroid Build Coastguard Worker 200*84e33947SAndroid Build Coastguard Worker Fout0=Fout; 201*84e33947SAndroid Build Coastguard Worker Fout1=Fout0+m; 202*84e33947SAndroid Build Coastguard Worker Fout2=Fout0+2*m; 203*84e33947SAndroid Build Coastguard Worker Fout3=Fout0+3*m; 204*84e33947SAndroid Build Coastguard Worker Fout4=Fout0+4*m; 205*84e33947SAndroid Build Coastguard Worker 206*84e33947SAndroid Build Coastguard Worker tw=twiddles; 207*84e33947SAndroid Build Coastguard Worker for ( u=0; u<m; ++u ) { 208*84e33947SAndroid Build Coastguard Worker C_FIXDIV( *Fout0,5); C_FIXDIV( *Fout1,5); C_FIXDIV( *Fout2,5); C_FIXDIV( *Fout3,5); C_FIXDIV( *Fout4,5); 209*84e33947SAndroid Build Coastguard Worker scratch[0] = *Fout0; 210*84e33947SAndroid Build Coastguard Worker 211*84e33947SAndroid Build Coastguard Worker C_MUL(scratch[1] ,*Fout1, tw[u*fstride]); 212*84e33947SAndroid Build Coastguard Worker C_MUL(scratch[2] ,*Fout2, tw[2*u*fstride]); 213*84e33947SAndroid Build Coastguard Worker C_MUL(scratch[3] ,*Fout3, tw[3*u*fstride]); 214*84e33947SAndroid Build Coastguard Worker C_MUL(scratch[4] ,*Fout4, tw[4*u*fstride]); 215*84e33947SAndroid Build Coastguard Worker 216*84e33947SAndroid Build Coastguard Worker C_ADD( scratch[7],scratch[1],scratch[4]); 217*84e33947SAndroid Build Coastguard Worker C_SUB( scratch[10],scratch[1],scratch[4]); 218*84e33947SAndroid Build Coastguard Worker C_ADD( scratch[8],scratch[2],scratch[3]); 219*84e33947SAndroid Build Coastguard Worker C_SUB( scratch[9],scratch[2],scratch[3]); 220*84e33947SAndroid Build Coastguard Worker 221*84e33947SAndroid Build Coastguard Worker C_ADDTO( *Fout0, scratch[7]); 222*84e33947SAndroid Build Coastguard Worker C_ADDTO( *Fout0, scratch[8]); 223*84e33947SAndroid Build Coastguard Worker 224*84e33947SAndroid Build Coastguard Worker scratch[5] = scratch[0] + cpx_type( 225*84e33947SAndroid Build Coastguard Worker S_MUL(scratch[7].real(),ya.real() ) + S_MUL(scratch[8].real() ,yb.real() ), 226*84e33947SAndroid Build Coastguard Worker S_MUL(scratch[7].imag(),ya.real()) + S_MUL(scratch[8].imag(),yb.real()) 227*84e33947SAndroid Build Coastguard Worker ); 228*84e33947SAndroid Build Coastguard Worker 229*84e33947SAndroid Build Coastguard Worker scratch[6] = cpx_type( 230*84e33947SAndroid Build Coastguard Worker S_MUL(scratch[10].imag(),ya.imag()) + S_MUL(scratch[9].imag(),yb.imag()), 231*84e33947SAndroid Build Coastguard Worker -S_MUL(scratch[10].real(),ya.imag()) - S_MUL(scratch[9].real(),yb.imag()) 232*84e33947SAndroid Build Coastguard Worker ); 233*84e33947SAndroid Build Coastguard Worker 234*84e33947SAndroid Build Coastguard Worker C_SUB(*Fout1,scratch[5],scratch[6]); 235*84e33947SAndroid Build Coastguard Worker C_ADD(*Fout4,scratch[5],scratch[6]); 236*84e33947SAndroid Build Coastguard Worker 237*84e33947SAndroid Build Coastguard Worker scratch[11] = scratch[0] + 238*84e33947SAndroid Build Coastguard Worker cpx_type( 239*84e33947SAndroid Build Coastguard Worker S_MUL(scratch[7].real(),yb.real()) + S_MUL(scratch[8].real(),ya.real()), 240*84e33947SAndroid Build Coastguard Worker S_MUL(scratch[7].imag(),yb.real()) + S_MUL(scratch[8].imag(),ya.real()) 241*84e33947SAndroid Build Coastguard Worker ); 242*84e33947SAndroid Build Coastguard Worker 243*84e33947SAndroid Build Coastguard Worker scratch[12] = cpx_type( 244*84e33947SAndroid Build Coastguard Worker -S_MUL(scratch[10].imag(),yb.imag()) + S_MUL(scratch[9].imag(),ya.imag()), 245*84e33947SAndroid Build Coastguard Worker S_MUL(scratch[10].real(),yb.imag()) - S_MUL(scratch[9].real(),ya.imag()) 246*84e33947SAndroid Build Coastguard Worker ); 247*84e33947SAndroid Build Coastguard Worker 248*84e33947SAndroid Build Coastguard Worker C_ADD(*Fout2,scratch[11],scratch[12]); 249*84e33947SAndroid Build Coastguard Worker C_SUB(*Fout3,scratch[11],scratch[12]); 250*84e33947SAndroid Build Coastguard Worker 251*84e33947SAndroid Build Coastguard Worker ++Fout0;++Fout1;++Fout2;++Fout3;++Fout4; 252*84e33947SAndroid Build Coastguard Worker } 253*84e33947SAndroid Build Coastguard Worker } 254*84e33947SAndroid Build Coastguard Worker 255*84e33947SAndroid Build Coastguard Worker /* perform the butterfly for one stage of a mixed radix FFT */ kf_bfly_generic(cpx_type * Fout,const size_t fstride,int m,int p)256*84e33947SAndroid Build Coastguard Worker void kf_bfly_generic( 257*84e33947SAndroid Build Coastguard Worker cpx_type * Fout, 258*84e33947SAndroid Build Coastguard Worker const size_t fstride, 259*84e33947SAndroid Build Coastguard Worker int m, 260*84e33947SAndroid Build Coastguard Worker int p 261*84e33947SAndroid Build Coastguard Worker ) 262*84e33947SAndroid Build Coastguard Worker { 263*84e33947SAndroid Build Coastguard Worker int u,k,q1,q; 264*84e33947SAndroid Build Coastguard Worker cpx_type * twiddles = &_twiddles[0]; 265*84e33947SAndroid Build Coastguard Worker cpx_type t; 266*84e33947SAndroid Build Coastguard Worker int Norig = _nfft; 267*84e33947SAndroid Build Coastguard Worker cpx_type scratchbuf[p]; 268*84e33947SAndroid Build Coastguard Worker 269*84e33947SAndroid Build Coastguard Worker for ( u=0; u<m; ++u ) { 270*84e33947SAndroid Build Coastguard Worker k=u; 271*84e33947SAndroid Build Coastguard Worker for ( q1=0 ; q1<p ; ++q1 ) { 272*84e33947SAndroid Build Coastguard Worker scratchbuf[q1] = Fout[ k ]; 273*84e33947SAndroid Build Coastguard Worker C_FIXDIV(scratchbuf[q1],p); 274*84e33947SAndroid Build Coastguard Worker k += m; 275*84e33947SAndroid Build Coastguard Worker } 276*84e33947SAndroid Build Coastguard Worker 277*84e33947SAndroid Build Coastguard Worker k=u; 278*84e33947SAndroid Build Coastguard Worker for ( q1=0 ; q1<p ; ++q1 ) { 279*84e33947SAndroid Build Coastguard Worker int twidx=0; 280*84e33947SAndroid Build Coastguard Worker Fout[ k ] = scratchbuf[0]; 281*84e33947SAndroid Build Coastguard Worker for (q=1;q<p;++q ) { 282*84e33947SAndroid Build Coastguard Worker twidx += fstride * k; 283*84e33947SAndroid Build Coastguard Worker if (twidx>=Norig) twidx-=Norig; 284*84e33947SAndroid Build Coastguard Worker C_MUL(t,scratchbuf[q] , twiddles[twidx] ); 285*84e33947SAndroid Build Coastguard Worker C_ADDTO( Fout[ k ] ,t); 286*84e33947SAndroid Build Coastguard Worker } 287*84e33947SAndroid Build Coastguard Worker k += m; 288*84e33947SAndroid Build Coastguard Worker } 289*84e33947SAndroid Build Coastguard Worker } 290*84e33947SAndroid Build Coastguard Worker } 291*84e33947SAndroid Build Coastguard Worker 292*84e33947SAndroid Build Coastguard Worker int _nfft; 293*84e33947SAndroid Build Coastguard Worker bool _inverse; 294*84e33947SAndroid Build Coastguard Worker std::vector<cpx_type> _twiddles; 295*84e33947SAndroid Build Coastguard Worker std::vector<int> _stageRadix; 296*84e33947SAndroid Build Coastguard Worker std::vector<int> _stageRemainder; 297*84e33947SAndroid Build Coastguard Worker traits_type _traits; 298*84e33947SAndroid Build Coastguard Worker }; 299*84e33947SAndroid Build Coastguard Worker #endif 300