#include #include #include #ifdef WIN32 #include #else #include #endif #define PI 3.14159265359 #define MAXPOW 24 struct complex { double r; double i; }; int pow_2[MAXPOW]; int pow_4[MAXPOW]; void twiddle(struct complex *W, int N, double stuff) { W->r=cos(stuff*2.0*PI/(double)N); W->i=-sin(stuff*2.0*PI/(double)N); } void bit_reverse_reorder(struct complex *W, int N) { int bits, i, j, k; double tempr, tempi; for (i=0; ii) /** Only make "up" swaps */ { tempr=W[i].r; tempi=W[i].i; W[i].r=W[j].r; W[i].i=W[j].i; W[j].r=tempr; W[j].i=tempi; } } } void bit_r4_reorder(struct complex *W, int N) { int bits, i, j, k; double tempr, tempi; for (i=0; ii) /** Only make "up" swaps */ { tempr=W[i].r; tempi=W[i].i; W[i].r=W[j].r; W[i].i=W[j].i; W[j].r=tempr; W[j].i=tempi; } } } /** RADIX-4 FFT ALGORITHM */ void radix4(struct complex *x, int N) { int n2, k1, N1, N2; struct complex W, bfly[4]; N1=4; N2=N/4; /** Do 4 Point DFT */ for (n2=0; n2