You are here: Symbol Reference > MtxExpr Namespace > Classes > Vector Record > public > DCT Method > Vector.DCT Method (TMtxVec, integer, integer, integer)
MtxVec VCL
ContentsIndex
PreviousUpNext
Vector.DCT Method (TMtxVec, integer, integer, integer)

The forward discrete cosine transform (DCT).

Pascal
function DCT(const Vec: TMtxVec; VecIndex: integer; Index: integer; Len: integer): TMtxVec; overload;

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: 

 

var a,b: Vector; begin a.SetIt(False,[1,-2,3,4]); b.DCT(a); end;
Examples on GitHub
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!