SPfDCT


Routine

void SPfDCT (float x[], int N, int Ifn)

Purpose

Calculate the discrete cosine transform

Description

This routine calculates the discrete cosine transform (DCT) or the inverse DCT of N data values using a complex N/2 point fast Fourier transform algorithm. This routine performs the calculation in place, that is the output data replaces the input data. The DCT is defined as,

              N-1            pi (2n+1) k
  X(k) = C(k) SUM x(n) * cos(-----------) ,
              n=0               2N

  where C(k) = 1       for k=0,
             = sqrt(2) for k=1,2,...,N-1.

The inverse DCT is defined as,

         1  N-1                 pi (2n+1) k
  x(n) = -  SUM C(k)*X(k) * cos(-----------) .
         N  k=0                     2N

Reference:
M. J. Narasimha and A. M. Peterson, "On the computation of the Discrete Cosine Transform", IEEE Trans. Communications, vol. COM-26, June 1978, pp. 934-936.

Parameters

<-> float x[]
For the forward transform, this is an array of data samples on input and the array of DCT coefficients on output. For the inverse transform, this is an array of DCT coefficients on input and the data samples on output.
-> int N
Number of points in the transform (a power of 2)
-> int Ifn
Input parameter, equal to +1 for the DCT, equal to -1 for the inverse DCT

Author / revision

P. Kabal / Revision 1.13 2003/05/09

See Also

SPfRFFT, SPfCFFT


Main Index libtsp