Intel® Integrated Performance Primitives (Intel® IPP) Developer Guide and Reference

ID 790148
Date 10/31/2024
Public
Document Table of Contents

FFTInit

Initializes the context structure for the image FFT functions.

Syntax

IppStatus ippiFFTInit_R_32f (int orderX, int orderY, int flag, IppHintAlgorithm hint, IppiFFTSpec_R_32f* pFFTSpec, Ipp8u* pMemInit);

IppStatus ippiFFTInit_C_32fc (int orderX, int orderY, int flag, IppHintAlgorithm hint, IppiFFTSpec_C_32fc* pFFTSpec, Ipp8u* pMemInit);

Include Files

ippi.h

Domain Dependencies

Headers: ippcore.h, ippvm.h, ipps.h

Libraries: ippcore.lib, ippvm.lib, ipps.lib

Parameters

orderX, orderY

Order of the FFT in x- and y- directions, respectively.

flag

Flag to choose the option for results normalization.

hint

This parameter is deprecated. Set the value to ippAlgHintNone.

pFFTSpec

Pointer to the FFT context structure.

pMemInit

Pointer to the temporary work buffer.

Description

This function initializes the pFFTSpec context structure needed to compute the forward and inverse FFT of a two-dimensional image data.

Before calling this function, you need to allocate memory for the FFT context structure and temporary work buffer (if it is required). To compute the size of the FFT context structure and temporary work buffer, use the ippiFFTGetSize function.

The pMemInit parameter can be NULL only if the work buffer is not used. After initialization is done, you can free the temporary work buffer.

The ippiFFTFwd and ippiFFTInv functions called with the pointer to the initialized pFFTSpec structure, compute the fast Fourier transform with the following characteristics:

The suffix after the function name indicates the type of the context structure to be initialized: ippiFFTInit_C is for the complex FFT context structure and ippiFFTInit_R is for the real FFT context structure.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when one of the specified pointers is NULL.

ippStsFftOrderErr

Indicates an error condition when the FFT order value is illegal.

ippStsFFTFlagErr

Indicates an error condition when the flag value is illegal.

Example

The code example below demonstrates how to use the ippiFFTGetSize and ippiFFTInit functions.

/// get sizes for required buffers
    ippiFFTGetSize_R_32f( orderX, orderY, IPP_FFT_DIV_INV_BY_N, ippAlgHintNone, &sizeSpec, &sizeInit, &sizeBuffer );

    /// allocate memory for required buffers
    pMemSpec = (IppiFFTSpec_R_32f*) ippMalloc ( sizeSpec );

    if ( sizeInit > 0 )
    {
        pMemInit = ippMalloc ( sizeInit );
    }

    if ( sizeBuffer > 0 )
    {
        pMemBuffer = ippMalloc ( sizeBuffer );
    }

    /// initialize FFT specification structure
    ippiFFTInit_R_32f( orderX, orderY, IPP_FFT_DIV_INV_BY_N, ippAlgHintNone, pMemSpec, pMemInit );

    /// free initialization buffer
    if ( sizeInit > 0 )
    {
        ippFree( pMemInit );
    }

    /// perform forward FFT to put source data to frequency domain
    ippiFFTFwd_RToPack_32f_C1R( pSrc, srcStep, pDst, dstStep, pMemSpec, pMemBuffer );

    /// ...

    /// free buffers
    if ( sizeBuffer > 0 )
    {
        ippFree( pMemBuffer );
    }

    ippFree( pMemSpec );

See Also