#include "TRACK.H" /*------------------------------------------------------------------------- This computes an in-place complex-to-complex FFT x and y are the real and imaginary arrays of 2^m points. dir = 1 gives forward transform dir = -1 gives reverse transform Formula: forward N-1 --- 1 \ - j k 2 pi n / N X(n) = --- > x(k) e = forward transform N / n=0..N-1 --- k=0 Formula: reverse N-1 --- \ j k 2 pi n / N X(n) = > x(k) e = forward transform / n=0..N-1 --- k=0 */ int FFT2D(FFT_Complex **c,int nx,int ny,int dir); int FFT(int dir,int m,TYPE_Of_PREC *x,TYPE_Of_PREC *y); int FFT(int dir,int m,TYPE_Of_PREC *x,TYPE_Of_PREC *y) { long nn,i,i1,j,k,i2,l,l1,l2; TYPE_Of_PREC c1,c2,tx,ty,t1,t2,u1,u2,z; /* Calculate the number of points */ nn = 1; for (i=0;i> 1; j = 0; for (i=0;i>= 1; } j += k; } /* Compute the FFT */ c1 = -1.0; c2 = 0.0; l2 = 1; for (l=0;l>1;i++) { for (j=0;j>1)]; c[(j*nx)+i+(nx>>1)] = SWAP; } } /* Switch the rows */ for (i=0;i>1;j++) { FFT_Complex SWAP; SWAP = c[(j*nx)+i]; c[(j*nx)+i] = c[((j+(ny>>1))*nx)+i]; c[((j+(ny>>1))*nx)+i] = SWAP; } } return(TRUE); }