www.pudn.com > FFTdemo.zip > fft.c
#include#include #include #include "fft.h" /** * Decimation-in-Time Complex FFT Algorithm with Radix-2. * Note: * L : exponent value of 2, N = 2^L. * cin : input complex array. * cout: output complex array. */ void cfftr2(const int L, const Complex cin[], Complex cout[]) { assert(cin); assert(cout); assert(L>0); const int N = 1< >= 1; /* len_sd /= 2 */ len_cl <<= 1; /* len_cl *= 2 */ } } /** * in reverse FFT. see cfftr2(); */ void cifftr2(const int L, const Complex *cin, Complex *cout) { assert(cin); assert(cout); assert(L>0); const int N = 1< 0); /* Loop for each X(k). */ int k; for (k=0; k 0); /* Reconstruct data for output. */ float gmax = 1; int i; for (i=0; i gmax) { gmax = pout[i]; } } /* Normalize data. */ for (i=0; i 0); int ri = 0, i; const int N2 = N/2, N1=N-1; /* copy data to cout */ for (i=0; i