0% found this document useful (0 votes)
81 views

2.8 DCT Notes

The document discusses the discrete cosine transform (DCT), which is related to but different from the discrete Fourier transform (DFT). The DCT is widely used in image and video compression applications like JPEG and MPEG. It describes how the 2D DCT can be understood as applying 1D DCTs along rows and then columns of an image. The 1D DCT is shown to be equivalent to taking the DFT of a symmetrically extended signal. Properties of the DCT like linearity and energy conservation are also covered.

Uploaded by

Aysha Arsha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views

2.8 DCT Notes

The document discusses the discrete cosine transform (DCT), which is related to but different from the discrete Fourier transform (DFT). The DCT is widely used in image and video compression applications like JPEG and MPEG. It describes how the 2D DCT can be understood as applying 1D DCTs along rows and then columns of an image. The 1D DCT is shown to be equivalent to taking the DFT of a symmetrically extended signal. Properties of the DCT like linearity and energy conservation are also covered.

Uploaded by

Aysha Arsha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

17/09/2020 Digital image processing

Module 4.3: Discrete Cosine Transform

2-D Discrete cosine transforms


One disadvantage of the DFT for some applications is that the transform is complex valued, even for real data. A
related transform, the discrete cosine transform (DCT), does not have this problem. The DCT is a separate transform
and not the real part of the DFT. It is widely used in image and video compression applications, e.g., JPEG and MPEG.
It is also possible to use DCT for filtering using a slightly different form of convolution called symmetric convolution.

Definition (2-D DCT)

Assume that the data array has finite rectangular support on then the 2-D DCT is given as

for

(4.3.1)

The DCT basis functions for size 8 x 8 are shown in Figure ( ). The mapping between the mathematical values and the
colors (gray levels) is the same as in the DFT case. Each basis function occupies a small square; the squares are then
arranged into as 8 x 8 mosaic. Note that unlike the DFT, where the highest frequencies occur near , the
, the highest frequencies of the DCT occur at the highest indices .

The inverse DCT exists and is given for as,

(4.3.2)

where the weighting function w(k) is given just as in the case of 1-D DCT by

(4.3.3)

From eqn (4.3.1), we see that the 2-D DCT is a separable operator. As such it can be applied to the rows and then the
columns, or vice versa. Thus the 2-D theory can be developed by repeated application of the 1-D theory. In the
following subsections we relate the 1-D DCT to 1-D DFT of a symmetrically extended sequence. This not only provides
an understanding of the DCT but also enables its fast calculation. We also present a fast DCT calculation that can
avoid the use of complex arithmetic in the usual case where x is a real-valued signal, e.g., an image. (Note: the next
two subsections can be skipped by the reader familiar with the 1-D DCT)

https://nptel.ac.in/content/storage2/courses/117104069/chapter_7/7_17.html 1/1
17/09/2020 Digital image processing

Module 4.3: Discrete Cosine Transform

Review of 1- D DCT
In the 1-D case the DCT is defined as

(4.3.4)

for every N point signal having support The corresponding inverse transform, or IDCT, can be written
as

(4.3.5)

It turns out that this 1-D DCT can be understood in terms of the DFT of a symmetrically extended sequence,

(4.3.6)

This is not the only way to symmetrically extend x , but this method results in the most widely used DCT sometimes
called DCT-2 with support In fact, on defining the 2N point DFT we will show that
the DCT can be alternatively expressed as

(4.3.7)

Thus the DCT is just the DFT analysis of the symmetrically extended signal defined in (4.3.6):

Looking at this equation, we see that there is no overlap in its two components, which fit together without a gap. We can
see that right after comes at position , which is then followed by the rest of the nonzero part
of x in reverse order, upto , where sits .We can see a point of symmetry midway between

and N, i.e., at .

If we consider its periodic extension we will also see a symmetry about the point . We thus expect that

the 2N point will be real valued except for the phase factor . So the phase factor in eqn (4.3.7) is just what
is needed to cancel out the phase term in Y and make the DCT real , as it must if the two equations, (4.3.1) and (4.3.7),
are to agree for real valued inputs x.

To reconcile these two definitions, we start out with eqn (4.3.7), and proceed as follows:

https://nptel.ac.in/content/storage2/courses/117104069/chapter_7/7_18.html 1/2
17/09/2020 Digital image processing

the last line following from and Euler's relation, which agrees with the original
definition, eqn (4.3.4).

The formula for the inverse DCT, can be established similarly, starting out from

https://nptel.ac.in/content/storage2/courses/117104069/chapter_7/7_18.html 2/2
17/09/2020 Digital image processing

Module 4.3: Discrete Cosine Transform

Some 1-D DCT Properties


1) Linearity:

2) Energy conservations:

(4.3.8)

3) Symmetry:

(a) General case:

(b) Real-valued case:

4) Eigenvectors of unitary DCT: Define the column vector

and define the matrix C with elements:

Then the vector contains the unitary DCT, whose elements are given as

A unitary matrix is one whose inverse is the same as the transpose . For the unitary DCT, we have

and energy balance equation,

which is a slight modification on the DCT Parseval relation (4.3.8). So the unitary DCT preserves the energy of the
signal x.

(continued in the next slide)

https://nptel.ac.in/content/storage2/courses/117104069/chapter_7/7_19.html 1/2
17/09/2020 Digital image processing

https://nptel.ac.in/content/storage2/courses/117104069/chapter_7/7_19.html 2/2
17/09/2020 Power System Analysis

Module 4.3: Discrete Cosine Transform

Some 1-D DCT Properties (contd.)


It turns out that eigenvectors of the unitary DCT are the same as those of the symmetric tridiagonal matrix,

and this holds true for arbitrary values of the parameter . We can relate this matrix Q to the inverse covariance
matrix of a 1-D first-order stationary Markov random sequence, with correlation coefficient necessarily satisfying

where and . The actual covariance matrix of the Markov random sequence
is

with corresponding, first-order difference equation,

It can further be shown that when , , so that eigenvectors approximate each other too. Because the
eigenvectors of a matrix and its inverse are the same, we then have the fact that the unitary DCT basis vectors
approximate the Karhunen-Loeve expansion, with basis vectors given as the solution to the matrix-vector equation,

And corresponding Karhunen-Loeve transform (KLT) given by

https://nptel.ac.in/content/storage2/courses/117104069/chapter_7/7_20.html 1/2
17/09/2020 Power System Analysis

Thus the 1-D DCT of a first-order Markov random vector of dimension N should be close to the KLT of x when its
correlation coefficient This ends the review of the 1-D DCT.

https://nptel.ac.in/content/storage2/courses/117104069/chapter_7/7_20.html 2/2
17/09/2020 Digital image processing

Module 4.3: Discrete Cosine Transform

Symmetric Extension in 2-D DCT


Since the 2-D DCT

is just the separable operator resulting from application of the 1-D DCT along first one dimension and then the other,
the order being immaterial, we can easily extend the 1-D DCT properties to the 2-D case. In terms of the connection of
the 2-D DCT with the 2-DFT, we thus see that we must symmetrically extend in, say, the horizontal direction and then
symmetrically extend that result in the vertical direction. The resulting symmetric function (extension) becomes

The symmetry is about the lines and then from (4.3.7), it follows that the 2-D DCT is given in terms of

the point DFT as

Comments

• We see that both the 1-D and 2-D DCTs involve only real arithmetic for real-valued data, and this may be important in
some applications.

• The symmetric extension property can be expected to result in fewer high frequency coefficients in DCT with respect
to DFT. Such would be expected for lowpass data, since there would often be a jump at the four edges of the
period of the corresponding periodic sequence which is not consistent with small high- frequency
coefficients in the DFS or DFT. Thus the DCT is attractive for lossy data storage applications, where the exact value of
the data is not of paramount importance.

• The DCT can be used for a symmetrical type of filtering with a symmetrical filter.

• 2-D DCT properties are easy generalizations of 1-D DCT properties.

https://nptel.ac.in/content/storage2/courses/117104069/chapter_7/7_21.html 1/1

You might also like