DCT4

Computes the DCT-IV of a signal

Syntax

Intel IPP style:

IppStatus ippsqDCT4_32f (const Ipp32f* pSrc , Ipp32f* pDst , Ipp32u len );

IppStatus ippsqDCT4Q15_16s_Rms (const Ipp16s* pSrc , Ipp16s* pDst , Ipp32u len , int scaleFactor );

IppStatus ippsqDCT4Q31_32s_Rms (const Ipp32s* pSrc , Ipp32s* pDst , Ipp32u len , int scaleFactor );

DSP style:

typedef struct {
    Ipp16u  fftLen;
    Ipp8u   ifftFlag;
    Ipp8u   bitReverseFlag;
    Ipp32f *pTwiddle;
    Ipp16u *pBitRevTable;
    Ipp16u  twidCoefModifier;
    Ipp16u  bitRevFactor;
    Ipp32f  onebyfftLen;
} ippsq_cfft_radix4_instance_f32;

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

typedef struct {
    Ipp16u  N;
    Ipp16u  Nby2;
    Ipp32f  normalize;
    Ipp32f *pTwiddle;
    Ipp32f *pCosFactor;
    ippsq_rfft_instance_f32 *pRfft;
    ippsq_cfft_radix4_instance_f32 *pCfft;
} ippsq_dct4_instance_f32;

ippsq_status ippsq_dct4_init_f32 (ippsq_dct4_instance_f32 *S , ippsq_rfft_instance_f32 *S_RFFT , ippsq_cfft_radix4_instance_f32 *S_CFFT , uint16_t N , uint16_t Nby2 , float32_t normalize );

void ippsq_dct4_f32 (const ippsq_dct4_instance_f32 *S , float32_t *pState , float32_t *pInlineBuffer );

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

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;

typedef struct {
    Ipp16u  N;
    Ipp16u  Nby2;
    Ipp16s  normalize;
    Ipp16s *pTwiddle;
    Ipp16s *pCosFactor;
    ippsq_rfft_instance_q15 *pRfft;
    ippsq_cfft_radix4_instance_q15 *pCfft;
} ippsq_dct4_instance_q15;

ippsq_status ippsq_dct4_init_q15 (ippsq_dct4_instance_q15 *S , ippsq_rfft_instance_q15 *S_RFFT , ippsq_cfft_radix4_instance_q15 *S_CFFT , uint16_t N , uint16_t Nby2 , q15_t normalize );

void ippsq_dct4_q15 (const ippsq_dct4_instance_q15 *S , q15_t *pState , q15_t *pInlineBuffer );

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

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

typedef struct {
    Ipp16u  N;
    Ipp16u  Nby2;
    Ipp32s  normalize;
    Ipp32s *pTwiddle;
    Ipp32s *pCosFactor;
    ippsq_rfft_instance_q31 *pRfft;
    ippsq_cfft_radix4_instance_q31 *pCfft;
} ippsq_dct4_instance_q31;

ippsq_status ippsq_dct4_init_q31 (ippsq_dct4_instance_q31 *S , ippsq_rfft_instance_q31 *S_RFFT , ippsq_cfft_radix4_instance_q31 *S_CFFT , uint16_t N , uint16_t Nby2 , q31_t normalize );

void ippsq_dct4_q31 (const ippsq_dct4_instance_q31 *S , q31_t *pState , q31_t *pInlineBuffer );

Include Files

ippsq.h

dsp.h

Parameters

pSrc

Pointer to the source array.

pDst

Pointer to the destination array.

pInlineBuffer

Pointer to the source and destination array.

len, N

Number of the source, destination, and pState vector elements.

scaleFactor

Value by which the accumulated result might be shifted.

normalize

Normalization factor;normalize= sqrt(2/len).

pState

Pointer to the state buffer. The number of elements in the array is N.

S_RFFT, S_CFFT

Unused pointers, may be set to NULL.

Description

This function computes the IV-type discrete cosine transform (DCT-IV) of the source signal pSrc and stores the result in pDst. The DCT-IV transform is its own inverse, so it is an involutary transform.

The DCT-IV is defined by the formula:



where

  • N = len

  • x(n) is pSrc[n]

  • y(k) is pDst[k]

Scaling is performed by the following formula:

Q15: y(k) = sum[k]*215-scaleFactor

Q31: y(k) = sum[k]*221-scaleFactor

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

Intel IPP-style APIs do not perform normalization to sqrt(2/len). To perform normalization, use the ippsqMulC function.

Function flavors with the _Rms suffix round down the resulting value and perform saturation if the resulting value exceeds the data range.

DSP style: Each function type (f32, q15, and q31) has its own state structure, which must be initialized with the corresponding initialization function. The initialization function copies N and normalize to the state structure. Pointers S_RFFT and S_CFFT are unused and reserved for future optimization. You can set unused pointers to NULL.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr, IPPSQ_MATH_ARGUMENT_ERROR

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

See Also

For more complete information about compiler optimizations, see our Optimization Notice.