FFTFwd

Applies forward Fast Fourier Transform to an image.

Syntax

Case 1: Not-in-place operation on integer data

IppStatus ippiFFTFwd_RToPack_<mod> (const Ipp8u* pSrc, int srcStep, Ipp32s* pDst, int dstStep, const IppiFFTSpec_R_32s* pFFTSpec, int scaleFactor, Ipp8u* pBuffer);

Supported values for mod:

8u32s_C1RSfs

8u32s_C3RSfs

8u32s_C4RSfs

8u32s_AC4RSfs

Case 2: Not-in-place operation on floating-point data

IppStatus ippiFFTFwd_RToPack_<mod> (const Ipp32f* pSrc, int srcStep, Ipp32f* pDst, int dstStep, const IppiFFTSpec_R_32f* pFFTSpec, Ipp8u* pBuffer);

Supported values for mod:

32f_C1R

32f_C3R

32f_C4R

32f_AC4R

Case 3: Not-in-place operation on complex data

IppStatus ippiFFTFwd_CToC_32fc_C1R(const Ipp32fc* pSrc, int srcStep, Ipp32fc* pDst, int dstStep, const IppiFFTSpec_C_32fc* pFFTSpec, Ipp8u* pBuffer);

Case 4: In-place operation on floating-point data

IppStatus ippiFFTFwd_RToPack_<mod>(Ipp32f* pSrcDst, int srcDstStep, const IppiFFTSpec_R_32f* pFFTSpec, Ipp8u* pBuffer);

Supported values for mod:

32f_C1IR

32f_C3IR

32f_C4IR

32f_AC4IR

Case 5: In-place operation on complex data

IppStatus ippiFFTFwd_CToC_32fc_C1IR(Ipp32fc* pSrcDst, int srcDstStep, const IppiFFTSpec_C_32fc* pFFTSpec, Ipp8u* pBuffer);

Parameters

pSrc

Pointer to the source image ROI.

srcStep

Distance in bytes between starts of consecutive lines in the source image.

pDst

Pointer to the destination image ROI.

dstStep

Distance in bytes between starts of consecutive lines in the destination image.

pSrcDst

Pointer to the source and destination image ROI for the in-place operation.

srcDstStep

Distance in bytes between starts of consecutive lines in the source and destination image for the in-place operation.

scaleFactor

Scale factor (see Integer Result Scaling).

pBuffer

Pointer to the external work buffer, can be NULL.

Description

The function ippiFFTFwd is declared in the ippi.h file. It operates with ROI (see Regions of Interest in Intel IPP).

This function performs a forward FFT on each channel of the source image ROI pSrc (pSrcDst for in-place flavors) and writes the Fourier coefficients into the corresponding channel of the destination buffer pDst (pSrcDst for in-place flavors). The size of ROI is N x M, it is specified by the parameters orderX, orderY calling the function ippiFFTInitAlloc.

The function flavor ippiFFTFwd_RToPack that operates on images with real data takes advantage of the symmetry property and stores the output data in RCPack2D format. It supports processing of the 1-, 3-, and 4-channel images. Note that the functions with AC4 descriptor do not process alpha channel.

The function flavor ippiFFTFwd_CToC that operates on images with complex data does not perform any packing of the transform results as no symmetry with respect to frequency domain data is observed in this case. Memory layout of images with complex data follows the same conventions as for real images provided that each pixel value consists of two numbers: imaginary and real part.

The forward FFT functions use the previously initialized pFFTSpec context structure to set the mode of calculations and retrieve support data.

The function may be used with the external work buffer pBuffer to avoid memory allocation within the functions. Once the work buffer is allocated, it can be used for all following calls to the functions computing FFT. As internal allocation of memory is too expensive operation and depends on operating system and/or runtime libraries used - the use of an external buffer improves performance significantly, especially for the small size transforms.

The size of the external buffer must be previously computed by the function ippiFFTGetBufSize. If the external buffer is not specified (pBuffer is set to NULL), the function itself allocates the memory needed for operation.

The Example “Fast Fourier Transform of a Real Image” illustrates the use of the forward FFT function for processing real data. The Example “Fast Fourier Transform of a Complex Image ” explains FFT processing of complex data. Note that input values are the same as in the previous example, but specified in complex domain.

Return Values

ippStsNoErr

Indicates no error. Any other value indicates an error or a warning.

ippStsNullPtrErr

Indicates an error condition if pSrc, pDst, or pFFTSpec pointer is NULL.

ippStsStepErr

Indicates an error condition if srcStep or dstStep value is zero or negative.

ippStsContextMatchErr

Indicates an error condition if a pointer to an invalid pFFTSpec structure is passed.

ippStsMemAllocErr

Indicates an error condition if memory allocation fails.

Fast Fourier Transform of a Real Image

IppStatus fft( void )
{
   Ipp32f src[64] = {0}, dst[64];
   IppiFFTSpec_R_32f *spec;
   IppStatus status;
   src[0] = -3; src[9] = 1;
   ippiFFTInitAlloc_R_32f(&spec, 3, 3, IPP_FFT_DIV_INV_BY_N, ippAlgHintAccurate);
   status = ippiFFTFwd_RToPack_32f_C1R( src, 8*sizeof(Ipp32f), dst,
                                        8*sizeof(Ipp32f), spec, 0 );
   ippiFFTFree_R_32f( spec );
   return status;
}
On exit from the ippiFFTFwd_RToPack function, the destination buffer contains the following data in RCPack2D format:
-2.00  -2.29  -0.71  -3.00  -1.00  -3.71  -0.71  -4.00  
-2.29  -3.00  -1.00  -3.71  -0.71  -4.00  +0.00  -3.71  
-0.71  -3.71  -0.71  -4.00  +0.00  -3.71  +0.71  +0.71  
-3.00  -4.00  +0.00  -3.71  +0.71  -3.00  +1.00  -3.00  
-1.00  -3.71  +0.71  -3.00  +1.00  -2.29  +0.71  +1.00  
-3.71  -3.00  +1.00  -2.29  +0.71  -2.00  +0.00  -2.29  
-0.71  -2.29  +0.71  -2.00  +0.00  -2.29  -0.71  +0.71  
-4.00  -2.00  +0.00  -2.29  -0.71  -3.00  -1.00  -2.00  
 

Fast Fourier Transform of a Complex Image

IppStatus fft_cplx( void ) {
   Ipp32fc src[64] = {0}, dst[64], m3 = {-3,0}, one = {1,0};
   IppiFFTSpec_C_32fc *spec;
   IppStatus status;
   src[0] = m3; src[9] = one;
   ippiFFTInitAlloc_C_32fc( &spec, 3, 3, IPP_FFT_DIV_INV_BY_N, ippAlgHintAccurate);
   status = ippiFFTFwd_CToC_32fc_C1R( src, 8*sizeof(Ipp32fc), dst,
                                      8*sizeof(Ipp32fc), spec, 0 );
   ippiFFTFree_C_32fc( spec );
   return status;
}
On exit from the ippiFFTFwd_CToC function, the destination buffer contains the following data (real and imaginary part of complex numbers are given in comma-delimited format):

-2.0, 0.0 -2.3,-0.7 -3.0,-1.0 -3.7,-0.7 -4.0, 0.0 -3.7, 0.7 -3.0, 1.0 -2.3, 0.7
-2.3,-0.7 -3.0,-1.0 -3.7,-0.7 -4.0,-0.0 -3.7, 0.7 -3.0, 1.0 -2.3, 0.7 -2.0, 0.0
-3.0,-1.0 -3.7,-0.7 -4.0, 0.0 -3.7, 0.7 -3.0, 1.0 -2.3, 0.7 -2.0,-0.0 -2.3,-0.7
-3.7,-0.7 -4.0, 0.0 -3.7, 0.7 -3.0, 1.0 -2.3, 0.7 -2.0,-0.0 -2.3,-0.7 -3.0,-1.0
-4.0, 0.0 -3.7, 0.7 -3.0, 1.0 -2.3, 0.7 -2.0, 0.0 -2.3,-0.7 -3.0,-1.0 -3.7,-0.7
-3.7, 0.7 -3.0, 1.0 -2.3, 0.7 -2.0, 0.0 -2.3,-0.7 -3.0,-1.0 -3.7,-0.7 -4.0,-0.0
-3.0, 1.0 -2.3, 0.7 -2.0, 0.0 -2.3,-0.7 -3.0,-1.0 -3.7,-0.7 -4.0,-0.0 -3.7, 0.7
-2.3, 0.7 -2.0,-0.0 -2.3,-0.7 -3.0,-1.0 -3.7,-0.7 -4.0, 0.0 -3.7, 0.7 -3.0, 1.0
 

Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.