#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define M 256
#define N 256
#define E 8
#define DIRECT 0
#define INVERSE 1
struct compl { double re,im; };
struct compl a[M][N], b[M][N];
int fft(int dir, int e, struct compl *d);
int fft2D(int dir, int e, struct compl aa[M][N])
{
int i,j,k;
struct compl w;
struct compl pufx[M], pufy[N];
for(i=0; i<M; i++)
{
for(j=0; j<N; j++) {
pufy[j].re=aa[i][j].re;
pufy[j].im=aa[i][j].im;
}
fft(dir, e, pufy);
for(j=0; j<N; j++) {
aa[i][j].re=pufy[j].re;
aa[i][j].im=pufy[j].im;
}
}
for(j=0; j<N; j++)
{
for(i=0; i<M; i++) {
pufx[i].re=aa[i][j].re;
pufx[i].im=aa[i][j].im;
}
fft(dir, e, pufx);
for(i=0; i<M; i++) {
aa[i][j].re=pufx[i].re;
aa[i][j].im=pufx[i].im;
}
}
return 1;
}
void main(int argc, char *argv[])
{
fft2D(DIRECT, E, b);
/*fft2D(INVERSE, E, b);*/
}