Computes forward or inverse modified discrete cosine transform (MDCT) of a signal.
IppStatus ippsMDCTFwd_32f(const Ipp32f* pSrc, Ipp32f* pDst, const IppsMDCTFwdSpec_32f* pMDCTSpec, Ipp8u* pBuffer);
IppStatus ippsMDCTInv_32f(const Ipp32f* pSrc, Ipp32f* pDst, const IppsMDCTInvSpec_32f* pMDCTSpec, Ipp8u* pBuffer);
IppStatus ippsMDCTFwd_32f_I(Ipp32f* pSrcDst, const IppsMDCTFwdSpec_32f* pMDCTSpec, Ipp8u* pBuffer);
IppStatus ippsMDCTInv_32f_I(Ipp32f* pSrcDst, const IppsMDCTInvSpec_32f* pMDCTSpec, Ipp8u* pBuffer);
IppStatus ippsMDCTFwd_16s_Sfs(const Ipp16s* pSrc, Ipp16s* pDst, const IppsMDCTFwdSpec_32f* pMDCTSpec, int scaleFactor, Ipp8u* pBuffer);
pSrc |
Pointer to the input data array. |
pDst |
Pointer to the output data array. |
pSrcDst |
Pointer to the input and output data array for the in-place operations. |
pMDCTSpec |
Pointer to the MDCT specification structure. |
pBuffer |
Pointer to the MDCT work buffer. |
scaleFactor |
Scalefactor value. |
These functions are declared in the ippac.h header file. The functions ippsMDCTFwd and ippsMDCTInv compute the forward and inverse modified discrete cosine transform (MDCT), respectively.
In the following definition of MDCT, N denotes the length and n0 = (N/2+1)/2.
For the forward MDCT, x(n ) is pSrc[n] and y(k) is pDst[k], whereas for the inverse MDCT x(n) is pDst[n] and y(k) is pSrc[k].
The forward MDCT is defined by the formula:
for
0 ≤ k < N/2.
The inverse MDCT is defined as
for
0 ≤ k < N.
The pBuffer argument provides the MDCT functions with the necessary work memory and helps to avoid memory allocation within the functions. The buffer may also increase the performance if the MDCT functions use the result of the previous operation stored in cache as an input array.
See code example below of using ippsMDCTFwd_32f.
ippsMDCTFwd_32f is used in the float-point versions of AAC decoder, AAC and MP3 encoders, ippsMDCTInv_32f is used in the float-point versions of AC3, AAC, and MP3 decoders, ippsMDCTFwd_16s_Sfs is used in the fixed version of AAC encoder included into IPP Samples. See introduction to this section.
ippStsNoErr |
Indicates no error. |
ippStsNullPtrErr |
Indicates an error when at least one of the specified pointers is NULL. |
ippStsContextMatchErr |
Indicates an error when the specification structure pMDCTSpec is invalid. |
ippStsMisalignedBuf |
Indicates misaligned data. Supply aligned data for better performance. |
IppStatus mdct(void)
{
Ipp32f pSrc[32];
Ipp32f pDst[16];
Ipp8u* pBuffer;
IppsMDCTFwdSpec_32f* pMDCTSpec;
IppStatus st;
int size, i;
for (i = 0; i < 32; i++)
pSrc[i] = (float)cos(IPP_2PI * i / 32);
st = ippsMDCTFwdInitAlloc_32f(&pMDCTSpec, 32);
if (st != ippStsOk) return st;
st = ippsMDCTFwdGetBufSize_32f(pMDCTSpec, &size);
if (st != ippStsOk) return st;
if (size != 0) pBuffer = ippsMalloc_8u(size);
st = ippsMDCTFwd_32f(pSrc, pDst, pMDCTSpec, pBuffer);
printf("\n pDst = ");
for (i = 0; i < 16; i++)
printf("%f ", pDst[i]);
printf("\n");
return st;
}
//Output:
// pDst = 11.430438 -16.110317 7.151322 4.418863
// -3.528530 -2.781422 2.448268 2.108223
// -1.940894 -1.757418 1.664175 1.560623
// -1.509103 -1.455249 1.432051 1.415278
Copyright © 2000 - 2011, Intel Corporation. All rights reserved.