RFFT

Computes the forward or inverse fast Fourier transform (FFT) of a real signal.

Syntax

Intel IPP style:

IppStatus ippsqFFTFwd_RToCCS_Direct_32f (const Ipp32f* pSrc, Ipp32f* pDst, Ipp32u length, Ipp8u bitReverseFlag);

IppStatus ippsqFFTFwd_RToCCS_Direct_16s (const Ipp16s* pSrc, Ipp16s* pDst, Ipp32u length, Ipp8u bitReverseFlag);

IppStatus ippsqFFTFwd_RToCCS_Direct_32s (const Ipp32s* pSrc, Ipp32s* pDst, Ipp32u length, Ipp8u bitReverseFlag);

IppStatus ippsqFFTInv_CCSToR_Direct_32f (const Ipp32f* pSrc, Ipp32f* pDst, Ipp32u length, Ipp8u bitReverseFlag);

IppStatus ippsqFFTInv_CCSToR_Direct_16s (const Ipp16s* pSrc, Ipp16s* pDst, Ipp32u length, Ipp8u bitReverseFlag);

IppStatus ippsqFFTInv_CCSToR_Direct_32s (const Ipp32s* pSrc, Ipp32s* pDst, Ipp32u length, Ipp8u bitReverseFlag);

typedef struct {
    Ipp16u        fftLen;
    const Ipp32f *pTwiddle;
    const Ipp16u *pBitRevTable;
    Ipp16u        bitRevLength;
} IppsqFFTSpec_32f;

IppStatus ippsqFFTInit_32f (IppsqFFTSpec_32f* pSpec, Ipp32u length, Ipp8u* pBuffer);

IppStatus ippsqFFTFwd_RToCCS_32f (const Ipp32f* pSrc, Ipp32f* pDst, Ipp8u bitReverseFlag, IppsqFFTSpec_32f *pSpec);

IppStatus ippsqFFTInv_CCSToR_32f (const Ipp32f* pSrc, Ipp32f* pDst, Ipp8u bitReverseFlag, IppsqFFTSpec_32f *pSpec);

typedef struct {
    Ipp16u        fftLen;
    const Ipp16s *pTwiddle;
    const Ipp16u *pBitRevTable;
    Ipp16u        bitRevLength;
} IppsqFFTSpec_16s;

IppStatus ippsqFFTInit_16s (IppsqFFTSpec_16s* pSpec, Ipp32u length, Ipp8u* pBuffer);

IppStatus ippsqFFTFwd_RToCCS_16s (const Ipp16s* pSrc, Ipp16s* pDst, Ipp8u bitReverseFlag, IppsqFFTSpec_16s *pSpec);

IppStatus ippsqFFTInv_CCSToR_16s (const Ipp16s* pSrc, Ipp16s* pDst, Ipp8u bitReverseFlag, IppsqFFTSpec_16s *pSpec);

typedef struct {
    Ipp16u        fftLen;
    const Ipp32s *pTwiddle;
    const Ipp16u *pBitRevTable;
    Ipp16u        bitRevLength;
} IppsqFFTSpec_32s;

IppStatus ippsqFFTInit_32s (IppsqFFTSpec_32s* pSpec, Ipp32u length, Ipp8u* pBuffer);

IppStatus ippsqFFTFwd_RToCCS_32s (const Ipp32s* pSrc, Ipp32s* pDst, Ipp8u bitReverseFlag, IppsqFFTSpec_32s *pSpec);

IppStatus ippsqFFTInv_CCSToR_32s (const Ipp32s* pSrc, Ipp32s* pDst, Ipp8u bitReverseFlag, IppsqFFTSpec_32s *pSpec);

DSP style:

typedef struct {
    ippsq_cfft_instance_f32 Sint;
    Ipp16u  fftLenRFFT;
    Ipp32f *pTwiddleRFFT;
} ippsq_rfft_fast_instance_f32;

ippsq_status ippsq_rfft_fast_init_f32 (ippsq_rfft_fast_instance_f32 *S, uint16_t fftLen, uint8_t* pBuffer);

void ippsq_rfft_fast_f32 (ippsq_rfft_fast_instance_f32 *S, float32_t *pSrc, float32_t *pDst, uint8_t ifftFlag);

typedef struct {
    Ipp32u  fftLenReal;
    Ipp16u  fftLenBy2;
    Ipp8u   ifftFlagR;
    Ipp8u   bitReverseFlagR;
    Ipp32u  twidCoefRModifier;
    Ipp32f *pTwiddleAReal;
    Ipp32f *pTwiddleBReal;
    ippsq_cfft_instance_q15 *pCfft;
} ippsq_rfft_instance_q15;

ippsq_status ippsq_rfft_init_q15 (ippsq_rfft_instance_q15 *S, uint32_t fftLenReal, uint32_t ifftFlagR, uint32_t bitReverseFlag, uint8_t* pBuffer);

void ippsq_rfft_q15 (const ippsq_rfft_instance_q15 *S, q15_t *pSrc, q15_t *pDst);

typedef struct {
    Ipp32u  fftLenReal;
    Ipp8u   ifftFlagR;
    Ipp8u   bitReverseFlagR;
    Ipp32u  twidCoefRModifier;
    Ipp32s *pTwiddleAReal;
    Ipp32s *pTwiddleBReal;
    ippsq_cfft_instance_q31 *pCfft;
} ippsq_rfft_instance_q31;

ippsq_status ippsq_rfft_init_q31 (ippsq_rfft_instance_q31 *S, uint32_t fftLenReal, uint32_t ifftFlagR, uint32_t bitReverseFlag, uint8_t* pBuffer);

void ippsq_rfft_q31 (const ippsq_rfft_instance_q31 *S, q31_t *pSrc, q31_t *pDst);

Include Files

ippsq.h

dsp.h

Parameters

pSrc

Pointer to the source array.

pDst

Pointer to the destination array.

length, fftLenReal

Number of the source vector elements. The value must be a power of 2.

ifftFlag, ifftFlagR

Inverse RFFT flag. To compute the inverse RFFT, set this parameter to any value not equal to zero.

bitReverseFlag, bitReverseFlagR

Bit reverse flag. To perform the bit reverse operation, set this parameter to any value not equal to zero.

pBuffer

External buffer to store initialization data.

Sint

Unused structure.

pTwiddleAReal, pTwiddleBReal, pCfft

Unused pointers.

twidCoefRModifier, fftLenBy2

Unused value.

Description

Forward FFT functions compute the forward FFT of a real signal and store the result in the CCS packed format. Inverse FFT functions compute the inverse FFT of data stored in the CCS packed format and store the result as a real signal.

The CCS format stores the values of the first half of the output complex signal resulted from the forward FFT. The following figure shows the order of the forward FFT result and inverse FFT source in packed formats:

Before using the ippsqFFTFwd_RToCCS_32f, ippsqFFTInv_CCSToR_32f, ippsqFFTFwd_RToCCS_16s, ippsqFFTInv_CCSToR_16s, ippsqFFTFwd_RToCCS_32s, ippsqFFTInv_CCSToR_32s, ippsq_rfft_f32, ippsq_rfft_q15, and ippsq_rfft_q31 functions, you need to perform initialization. These functions are faster than the corresponding functions with the _Direct suffix, and require additional external buffer to store sine table. The following table provides required buffer size for each function:

Function Buffer Size

ippsqFFTFwd_RToCCS_32f

ippsqFFTInv_CCSToR_32f

ippsq_rfft_f32

sizeof(Ipp32f) * fftLen / 4

ippsqFFTFwd_RToCCS_16s

ippsqFFTInv_CCSToR_16s

ippsq_rfft_q15

sizeof(Ipp16s) * fftLen / 4

ippsqFFTFwd_RToCCS_32s

ippsqFFTInv_CCSToR_32s

ippsq_rfft_q31

sizeof(Ipp32s) * fftLen / 4

Intel IPP style: The ippsqFFTFwd_RToCCS functions compute the forward FFT of a real signal and store the result in the CCS packed format. The ippsqFFTInv_CCSToR functions compute the inverse FFT of data stored in the CCS packed format and store the result as a real signal.

For the ippsqFFTFwd_RToCCS functions, the numbers of elements in pSrc is length, the number of elements in pDst is length+2. For the ippsqFFTInv_CCSToR functions, the numbers of elements in pSrc is length+2, the number of elements in pDst islength.

Each function performs the bit reverse operation by default. The length of the FFT must be a power of 2.

When using Intel IPP-style APIs with the _Direct suffix, you do not need to call any initialization functions. Intel IPP-style functions directly get all necessary parameters as arguments.

DSP style: Each function type (f32, q15, and q31) has its own state structure, which must be initialized with the corresponding initialization function. Initialize the fftLen field of the structure with the corresponding FFT length value, which must be a power of 2. Another required initialization parameter is ifftFlagR, set this parameter to any value not equal to zero to perform inverse FFT. Each function performs the bit reverse operation by default, it means that internally bitReverseFlag is equal to 1.

To perform forward FFT, set the ifftFlag value to 0. For forward FFT, the number of elements in pSrc is length, the number of elements in pDst is length+2. The output is stored in the CCS format.

To perform inverse FFT, set the ifftFlag parameter to any value not equal to zero. For inverse FFT, the number of elements in pSrc is length+2, the number of elements in pDst is length. The source is stored in the CCS format.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when any of the specified pointers is NULL.
For more complete information about compiler optimizations, see our Optimization Notice.