TVec::DCT Method

Overload List

#SignatureDescription
1TMtxVec *DCT(TMtxVec *Vec, int VecIndex, int Index, int Len);The forward discrete cosine transform (DCT).
2TVec *DCT();The forward discrete cosine transform (DCT).
3TVec *DCT(TVec *Vec);Calculates the forward discrete cosine transform (DCT) of the Vec.

Overload 1: TMtxVec *DCT(TMtxVec *Vec, int VecIndex, int Index, int Len);

The forward discrete cosine transform (DCT).

#NameTypeDescription
1VecTMtxVec *
2VecIndexint
3Indexint
4Lenint
Remarks:

Calculates the forward discrete cosine transform (DCT) of the Vec and writes the result in the calling vector. If Vec.Length is a power of 2, the function uses an efficient algorithm that is significantly faster than the direct computation of DCT. For other values of Vec Length, this function uses the direct formulas given below; however, the symmetry of 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=Vec.Length and V is the calling vector:

C(k)={1Nk=02Nk>0V[k]=C(k)n=0N1Vec[n]cos((2n+1)kπ2N)\begin{aligned} C(k) &= \begin{cases} \sqrt{\frac{1}{N}} & k=0 \\ \sqrt{\frac{2}{N}} & k > 0 \end{cases} \\ \text{V}[k] &= C(k)\cdot \sum _{n=0} ^{N-1} \text{Vec}[n]\cdot \cos \left( \frac{(2n+1)k\pi}{2N}\right) \end{aligned}
See Also: TVec::IDCT, TVec::FFT
Declared in Dew::Math::TDenseMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler

Overload 2: TVec *DCT();

The forward discrete cosine transform (DCT).

Remarks:

Calculates the forward discrete cosine transform (DCT) of all calling vector elements in-place. If vector TVec::Length is a power of 2, the function uses an efficient algorithm that is significantly faster than the direct computation of DCT. For different lengths this function uses the direct formulas given below; however, the symmetry of 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=Vec.Length and V is the calling vector:

C(k)={1Nk=02Nk>0V[k]=C(k)n=0N1Vec[n]cos((2n+1)kπ2N)\begin{aligned} C(k) &= \begin{cases} \sqrt{\frac{1}{N}} & k=0 \\ \sqrt{\frac{2}{N}} & k > 0 \end{cases} \\ \text{V}[k] &= C(k)\cdot \sum _{n=0} ^{N-1} \text{Vec}[n]\cdot \cos \left( \frac{(2n+1)k\pi}{2N}\right) \end{aligned}
See Also: TVec::IDCT, TVec::FFT, TVec::IDCT, TVec::IDCT, TVec::FFT
Declared in Dew::Math::TVec · Dew.Math/MtxVec.h · Cross-compiler

Overload 3: TVec *DCT(TVec *Vec);

Calculates the forward discrete cosine transform (DCT) of the Vec.

#NameTypeDescription
1VecTVec *
Remarks:

Writes the result in the calling vector. If Vec.Length is a power of 2, the function uses an efficient algorithm that is significantly faster than the direct computation of DCT. For other values of Vec Length, this function uses the direct formulas.

Declared in Dew::Math::TVec · Dew.Math/MtxVec.h · Cross-compiler