Intel® Integrated Performance Primitives Developer Guide and Reference

ID 790148
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

DFTInit

Initializes the context structure for the image DFT functions.

Syntax

IppStatus ippiDFTInit_R_32f (IppiSize roiSize, int flag, IppHintAlgorithm hint, IppiDFTSpec_R_32f* pDFTSpec, Ipp8u* pMemInit);

IppStatus ippiDFTInit_C_32fc (IppiSize roiSize, int flag, IppHintAlgorithm hint, IppiDFTSpec_C_32fc* pDFTSpec, Ipp8u* pMemInit);

Include Files

ippi.h

Domain Dependencies

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

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

Parameters

roiSize

Size of the source and destination ROI in pixels.

flag

Flag to choose the option for results normalization.

hint

This parameter is deprecated. Set the value to ippAlgHintNone.

pDFTSpec

Pointer to the DFT context structure.

pMemInit

Pointer to the temporary work buffer.

Description

This function initializes the pDFTSpec context structure needed to compute the forward and inverse DFT 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 ippiDFTGetSize 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 ippiDFTFwd and ippiDFTInv functions called with the pointer to the initialized pDFTSpec structure compute the discrete Fourier transform with the following characteristics:

The suffix after the function name indicates the type of the context structure to be initialized: ippiDFTInit_C is for the complex DFT context structure and ippiDFTInit_R is for the real DFT context structure.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

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

ippStsFftFlagErr

Indicates an error condition when the flag value is illegal.

ippStsFftOrderErr

Indicates an error when the amount of memory needed to compute the DFT for points in the ROI of size roiSize exceeds the limit.

ippStsSizeErr

Indicates an error condition when the roiSize has a field with a zero or negative value.

Example

The code example below demonstrates how to use the ippiDFTGetSize and ippiDFTInit functions.

    /// get sizes for required buffers
    ippiDFTGetSize_R_32f( roiSize, IPP_FFT_DIV_INV_BY_N, ippAlgHintNone, &sizeSpec, &sizeInit, &sizeBuffer );

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

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

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

    /// initialize DFT specification structure
    ippiDFTInit_R_32f( roiSize, IPP_FFT_DIV_INV_BY_N, ippAlgHintNone, pMemSpec, pMemInit );

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

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

    /// ...

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

    ippFree( pMemSpec );

See Also