Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

FFT of a non square image

userumr
Beginner
451 Views
Hi,

I want to compute FFT and inverse FFT of a 511x640 image. If I pad it to 1024x1024 I can get correct results for FFT and inverse FFT, but when I try to pad it to 512x1024, my inverse image does not come out right??

Here's what I am doing...

my source image is 511x640 so I copy it to a 512x1024 image and call it input image

----------------------- Begin code Snippet ----------------------------
int inputImageStep;
Ipp32f *inputImage = ippiMalloc_32f_C1(1024, 512, &inputImageStep);

IppiFFTSpec_R_32f *spec;
ippiFFTInitAlloc_R_32f (&spec, 10, 9, IPP_FFT_DIV_INV_BY_N, ippAlgHintAccurate);

int bufSize;
ippiFFTGetBufSize_R_32f(spec, &bufSize);
Ipp8u buff[bufSize];
Ipp8u *buffer = buff;

/** Display the inputImage **/

ippiFFTFwd_RToPack_32f_C1IR(inputImage, imageStep, spec, buffer);
ippiFFTInv_PackToR_32f_C1IR(inputImage, imageStep, spec, buffer);

/** Display the inputImage after FFTFwd and FFTInv **/

----------------------- End of code Snippet ----------------------------


What am I doing wrong? can't IPP FFT functions process non square images??

Thanks for the help.
0 Kudos
1 Reply
Vladimir_Dudnik
Employee
451 Views

Hello,

we do test similar case and were not able to reproduce problem. Please check if you use step parameter correctly (it is not obvious from code snipped you provide). Would be nice if you can provide test case andspecify version of IPP you use and what platform it is running on.

There is piece of code which we use as a test case

/* ------------------------------------------------------------------------ */

#include

#include

#include

#include

#include "ippi.h"

#include "ipps.h"

/* ------------------------------------------------------------------------ */

#define ordX 10

#define ordY 9

/* ------------------------------------------------------------------------ */

int main(int argC,char **argV)

{

int lenX, lenY, bufSize, ImageStep, i, j;

IppiFFTSpec_R_32f *spec;

Ipp32f *Image, *Img;

double diff, maxdiff;

Ipp8u *buffer;

ippiFFTInitAlloc_R_32f ( &spec, ordX, ordY,

IPP_FFT_DIV_INV_BY_N, ippAlgHintAccurate );

ippiFFTGetBufSize_R_32f ( spec, &bufSize );

lenX = (1<

lenY = (1<

Image = ippiMalloc_32f_C1 ( lenX, lenY, &ImageStep );

buffer = (Ipp8u*) ippsMalloc_8u ( bufSize );

for (j=0; j

Img = (Ipp32f*) ((Ipp8u*) Image + j*ImageStep);

for (i=0; i

Img = (Ipp32f)i;

}

}

ippiFFTFwd_RToPack_32f_C1IR ( Image, ImageStep, spec, buffer );

ippiFFTInv_PackToR_32f_C1IR ( Image, ImageStep, spec, buffer );

maxdiff = 0.0;

for (j=0; j

Img = (Ipp32f*) ((Ipp8u*) Image + j*ImageStep);

for (i=0; i

diff = fabs(Img-(Ipp32f)i);

if (maxdiff < diff) maxdiff = diff;

}

}

printf ( "maxdiff %g ", maxdiff );

ippiFree ( Image );

ippsFree ( buffer );

ippiFFTFree_R_32f ( spec );

return 1;

}

/* ------------------------------------------------------------------------ */

Regards,
Vladimir

0 Kudos
Reply