c 1999 Society for Industrial and Applied Mathematics
The Discrete Cosine Transform∗
Gilbert Strang†
Abstract. Each discrete cosine transform (DCT) uses N real basis vectors whose components are π cosines. In the DCT-4, for example, the jth component of vk is cos(j + 1 )(k + 1 ) N . These 2 2 basis vectors are orthogonal and the transform is extremely useful in image processing. If the vector x gives the intensities along a row of pixels, its cosine series ck vk has the coefficients ck = (x, vk )/N . They are quickly computed from a Fast Fourier Transform. But a direct proof of orthogonality, by calculating inner products, does not reveal how natural these cosine vectors are. We prove orthogonality in a different way. Each DCT basis contains the eigenvectors of a symmetric “second difference” matrix. By varying the boundary conditions we get the established transforms DCT-1 through DCT-4. Other combinations lead to four additional cosine transforms. The type of boundary condition (Dirichlet or Neumann, centered at a meshpoint or a midpoint) determines the applications that are appropriate for each transform. The centering also determines the period: N − 1 or N in the established transforms, N − 1 or N + 1 in the other four. The key point is that all these “eigenvectors 2 2 of cosines” come from simple and familiar matrices. Key words. cosine transform, orthogonality, signal processing AMS subject classifications. 42, 15 PII. S0036144598336745
Introduction. Just as the Fourier series is the starting point in transforming and analyzing periodic functions, the basic step for vectors is the Discrete Fourier Transform (DFT). It maps the “time domain” to the “frequency domain.” A vector with N components is written as a combination of N special basis vectors vk . Those are constructed from powers of the complex number w = e2πi/N : vk = 1, wk , w2k , . . . , w(N −1)k , k = 0, 1, . . . , N − 1 .
The vectors vk are the
References: [1] N. Ahmed, T. Natarajan, and K. R. Rao, Discrete cosine transform, IEEE Trans. Comput., C-23 (1974), pp. 90–93. [2] R. Coifman and Y. Meyer, Remarques sur l’analyse de Fourier a fenˆtre, C. R. Acad. Sci. ` e Paris, 312 (1991), pp. 259–261. [3] N. J. Jayant and P. Noll, Digital Coding of Waveforms, Prentice-Hall, Englewood Cliffs, NJ, 1984. [4] H. S. Malvar, Signal Processing with Lapped Transforms, Artech House, Norwood, MA, 1992. [5] S. Martucci, Symmetric convolution and the discrete sine and cosine transforms, IEEE Trans. Signal Processing, 42 (1994), pp. 1038–1051. [6] K. R. Rao and P. Yip, Discrete Cosine Transforms, Academic Press, New York, 1990. [7] V. Sanchez, P. Garcia, A. Peinado, J. Segura, and A. Rubio, Diagonalizing properties of the discrete cosine transforms, IEEE Trans. Signal Processing, 43 (1995), pp. 2631–2641. [8] G. Strang, The search for a good basis, in Numerical Analysis 1997, D. Griffiths, D. Higham, and A. Watson, eds., Pitman Res. Notes Math. Ser., Addison Wesley Longman, Harlow, UK, 1997. [9] G. Strang and T. Nguyen, Wavelets and Filter Banks, Wellesley-Cambridge Press, Wellesley, MA, 1996. [10] Z. Wang and B. Hunt, The discrete W-transform, Appl. Math. Comput., 16 (1985), pp. 19–48. [11] M. V. Wickerhauser, Adapted Wavelet Analysis from Theory to Software, AK Peters, Natick, MA, 1994. [12] D. Zachmann, Eigenvalues and Eigenvectors of Finite Difference Matrices, unpublished manuscript, 1987, http://epubs.siam.org/sirev/zachmann/. .