DCTInv

Computes the inverse discrete cosine transform of a signal.

Syntax

Case 1: Not-in-place operation

IppStatus ippsDCTInv_16s_Sfs(const Ipp16s* pSrc, Ipp16s* pDst, const IppsDCTInvSpec_16s* pDCTSpec, int scaleFactor, Ipp8u* pBuffer);

IppStatus ippsDCTInv_32f(const Ipp32f* pSrc, Ipp32f* pDst, const IppsDCTInvSpec_32f* pDCTSpec, Ipp8u* pBuffer);

IppStatus ippsDCTInv_64f(const Ipp64f* pSrc, Ipp64f* pDst, const IppsDCTInvSpec_64f* pDCTSpec, Ipp8u* pBuffer);

Case 2: In-place operation

IppStatus ippsDCTInv_16s_ISfs(Ipp16s* pSrcDst, const IppsDCTInvSpec_16s* pDCTSpec, int scaleFactor, Ipp8u* pBuffer);

IppStatus ippsDCTInv_32f_I(Ipp32f* pSrcDst, const IppsDCTInvSpec_32f* pDCTSpec, Ipp8u* pBuffer);

IppStatus ippsDCTInv_64f_I(Ipp64f* pSrcDst, const IppsDCTInvSpec_64f* pDCTSpec, Ipp8u* pBuffer);

Parameters

pDCTSpec

Pointer to the inverse DCT specification structure.

pSrc

Pointer to the source vector.

pDst

Pointer to the destination vector.

pSrcDst

Pointer to the source and destination vector for in-place operations.

pBuffer

Pointer to the external work buffer, may be NULL.

scaleFactor

Scale factor, refer to Integer Scaling.

Description

The function ippsDCTInv is declared in the ipps.h file. This function computes the inverse discrete cosine transform (DCT) of the source signal pSrc (pSrcDst for in-place operations) in accordance with the specification structure pDCTSpec that must be initialized by calling the functions ippsDCTInvInitAlloc or ippsDCTInvInit beforehand. The result in stored in the pDst (pSrcDst for in-place operations).

If len is a power of 2, the functions use an efficient algorithm that is significantly faster than the direct computation of DCT. For other values of len, these functions use the direct formulas given below; however, the symmetry of the cosine function is taken into account, which allows to perform about half of the multiplication operations in the formulas.

In the following definition of DCT, N = len,



x(n) is pDst[n] and y(k) is pSrc[k].

The inverse DCT is defined by the formula:



For integer data types the output result is scaled according to the scaleFactor value, thus the output signal range and precision are retained.

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 DCT. 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 this buffer must be computed previously using the functions ippsDCTInvGetBufSize or ippsDCTInvGetSize.

If the external buffer is not specified (pBuffer is set to NULL), then the function itself allocates the memory needed for operation.

Example below shows how to use the functions ippsDCTFwd_32f and ippsDCTInv_32f to compress and reconstruct a signal.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error if one of the pDCTSpec, pSrc, pDst, pSrcDst pointers is NULL.

ippStsContextMatchErr

Indicates an error when the specification identifier pDCTSpec is incorrect.

ippStsMemAllocErr

Indicates an error if memory allocation fails.

Using ippsDCTFwd and ippsDCTInv to Compress and Reconstruct a Signal

void dct( void ) {
#define LEN 256
     Ipp32f x[LEN], y[LEN];
     int n;
     IppsDCTFwdSpec_32f* fspec;
     IppsDCTInvSpec_32f* ispec;
     IppStatus status;
     /// data: Gaussian function, magn =1 and sigma=N/3 
     for(n=0; n<LEN; ++n) 
         x[n] = (float)(exp(-0.5*(LEN/2-n)*(LEN/2-n)/(LEN/3.0)));
     /// get cosine transform coefficients
     status = ippsDCTFwdInitAlloc_32f( &fspec, LEN, ippAlgHintNone );
     status = ippsDCTFwd_32f( x, y, fspec, NULL );
     ippsDCTFwdFree_32f( fspec );
     /// Set 3/4 of these coefficients to zero
     for(n=LEN/4; n<LEN; ++n) y[n] = 0.0f;
     /// restore signal using len/4 values
     status = ippsDCTInvInitAlloc_32f( &ispec, LEN, ippAlgHintNone );
     status = ippsDCTInv_32f( y, x, ispec, NULL );
     ippsDCTInvFree_32f( ispec );
}

	

Submit feedback on this help topic

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