Function

vDSP_DCT_Execute(_:_:_:)

Calculates the discrete single-precision cosine transform for a vector.

Declaration

func vDSP_DCT_Execute(_ __Setup: OpaquePointer, _ __Input: UnsafePointer<Float>, _ __Output: UnsafeMutablePointer<Float>)

Parameters

__Setup

A DCT setup object returned by a call to vDSP_DCT_CreateSetup(_:_:_:)

__A

Single-precision input vector

__C

Single-precision output vector

Discussion

For type II transformation, the calculation is

  • For 0 <= k < Length,

  • C[k] = sum(A[j] * cos(k * (j+1/2) * pi / Length, 0 <= j < Length)

For type III transformation, the calculation is

  • For 0 <= k < Length

  • C[k] = A[0]/2 + sum(A[j] * cos((k+1/2) * j * pi / Length), 1 <= j < Length)

For type IV transformation, the calculation is

  • For 0 <= k < Length,

  • C[k] = sum(A[j] * cos(k * (j+1/2) * pi / Length, 0 <= j < Length)

See Also

Discrete Cosine Transforms

func vDSP_DCT_CreateSetup(vDSP_DFT_Setup?, vDSP_Length, vDSP_DCT_Type) -> vDSP_DFT_Setup?

Creates a data structure for use with vDSP_DCT_Execute(_:_:_:) to perform a single-precision, discrete cosine transform.