tags:

views:

41

answers:

0

I am trying to do a batch FFT on 50 images using the following snippet:

pix3 = n*pix1*pix2;
fftwf_complex *in2, *f2h; //input for FFT2
in2 = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex) * pix3);
f2h = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex) * pix3);

for (i = 0; i < pix3; i++)
{
in2[i][0] = ref20[i]; //ref20 is an array of real values 
in2[i][1] = 0;
}    

for(i = 0; i < n; ++i)
{
  plan_forward2 = fftwf_plan_dft_2d (pix1, pix2, in2, f2h, FFTW_FORWARD, FFTW_ESTIMATE);
  fftwf_execute (plan_forward2);
  in2 += pix1*pix2;
  f2h += pix1*pix2;
}

However, I am only able to get the FFT of the 1st image (i.e. first pix1*pix2 elements). Any suggestions on how to get this right?

Thanks in advance