Sie sind auf Seite 1von 4

The DCT is conceptually similar to the DFT, except:

• The DCT does a better job of concentrating energy into lower


order coefficients than does the DFT for image data.

• The DCT is purely real, the DFT is complex (magnitude and


phase).

• A DCT operation on a block of pixels produces coefficients that


are similar to the frequency domain coefficients produced by a
DFT operation.

• An N-point DCT has the same frequency resolution as and is


closely related to a 2N-point DFT. The N frequencies of a 2N
point DFT correspond to N points on the upper half of the unit
circle in the complex frequency plane.

• Assuming a periodic input, the magnitude of the DFT


Relationship between DCT and FFT
coefficients is spatially invariant (phase of the input does not
matter). This is not true for the DCT.
• DCT (Discrete Cosine Transform) is
actually a cut-down version of the FFT:
• For most images, after transformation the majority of
signal energy is carried by just a few of the low order • Only the real part of FFT
DCT coefficients. These coefficients can be more • Computationally simpler than FFT
finely quantized than the higher order coefficients.
Many higher order coefficients may be quantized to 0 • DCT -- Effective for Multimedia
(this allows for very efficient run level coding) Compression
• DCT MUCH more commonly used.

DCT Encoding The basic operation of the DCT is as follows:


The general equation for a 1D (N data items) DCT is
defined by the following equation: • The input image is N by M;
• f(i,j) is the intensity of the pixel in row i and column j;
N −1
⎛ π k (2n + 1) ⎞ • F(u,v) is the DCT coefficient in row k1 and column k2 of
X DCT [ k ] = ∑ 2 x[n] cos ⎜ ⎟, 0 ≤ k ≤ N − 1. the DCT matrix.
n =0 ⎝ 2N ⎠
• For most images, much of the signal energy lies at low
frequencies; these appear in the upper left corner of the
DCT.
• and the corresponding inverse 1D DCT transform is
• Compression is achieved since the lower right values
simple F-1(u), i.e.: represent higher frequencies, and are often small - small
enough to be neglected with little visible distortion.
1 N −1
⎛ π k (2n + 1) ⎞
x[ n] =
N
∑ α [k ] X
n =0
DCT [k ] cos ⎜
⎝ 2N
⎟,

0 ≤ n ≤ N − 1. • The DCT input is an 8 by 8 array of integers. This array
contains each pixel's gray scale level;
• 8 bit pixels have levels from 0 to 255.

1
It is computationally easier to implement and more Why DCT not FFT?
efficient to regard the DCT as a set of basis functions • DCT is similar to the Fast Fourier Transform (FFT), but
which given a known input array size (8 x 8) can be can approximate lines well with fewer coefficients.
precomputed and stored.
This involves simply
computing values for a
convolution mask (8 x8
window) that get applied.
The values as simply
calculated from the DCT
formula. The 64 (8 x 8)
DCT basis functions are
illustrated in Fig.

• The N- point DFT X [k ] of a length-N real sequence is a • It is of interest to have orthogonal transform that represent
complex sequence satisfying the symmetry condition a real time-domain sequence X[k].
X [k ] = X *[( k ) N ]. • Several such orthogonal transforms have been developed
with each having certain attractive properties.
• For N even, the DFT samples X(0) and X[(N-2)/2] are real Definition
and distinct. The remaining N-2 DFT samples are complex,
and only half of these samples are distinct as the rest are • DFT of a real symmetric or antisymmetric finite length
complex conjugates of these samples. sequence is a product of a linear-phase term and a real
amplitude function.
• For N odd, the DFT sample X[0] is real, and the remaining • One class of real orthogonal transforms is based on
N-1 DFT samples are complex, of which only half of these converting an arbitrary sequence into either a symmetric or
samples are distinct as the rest are complex conjugates of an antisymmetric sequence and then extracting the real
these samples. orthogonal transform coefficients from the DFT of the
generated sequence with geometric symmetry.
• As a result, there is a redundancy in the DFT-based
frequency-domain representation of a discrete time sequence.

• The transforms developed via this approach are called • To develop a symmetric or antisymmetric sequence by
Discrete Cosine Transform, often abbreviated as DCT and periodic extension from a specified finite length sequence,
discrete sine transforms often abbreviated as DST. the above type of symmetry or antisymmetry can be
applied at each end of the given sequence.
• There are four types of finite length sequences exhibiting
geometric symmetry, depending on the location of the • This results in 16 distinct types of periodic extensions, of
point of symmetry or antisymmetry : which 8 extensions will be symmetric-periodic leading to 8
different types of DCTs, and 8 extensions will be
antisymmetric-periodic, leading to 8 different types of
• 1) whole sample symmetry (WS) DSTs.
2) whole sample antisymmetry (WA)
3) half-sample symmetry (HS) • Here we consider only the symmetric periodic extensions.
4) Half sample antisymmetry (HA)

2
x[n]

• To illustrate the periodic extension process, xWSWS [n] n xHSHS [n]

consider a length-4 sequence x[n], shown in


figure below.

• The 8 symmetric periodic extensions xWSWA [n] x HSHA [n]

generated from {x[n]} are also shown in


figure.

Four symmetric periodic extensions of x[n].


(a) Periodic extension for DCT-1 (b) Periodic extension for DCT-2
(c) Periodic extension for DCT-3 (d) Periodic extension for DCT-4

xWSHS [n]
xHSWS [n]
• To develop the expression for the Discrete Cosine
Transform, for each of the above symmetric periodic
sequences, we first extract one period from each.

• For example to develop the Type-I Discrete Cosine


Transform, we extract one period y[n] of the symmetric
xWSHA [n]
xHSWA [n] periodic sequence xwsws [ n]. Thus if

{x[n]} = {a b c d},

then, the extracted period is given by,

Four anti-symmetric periodic extensions of x[n]. {y[n]} = {a b c d c b}.


(a) Periodic extension for DCT-5 (b) Periodic extension for DCT-6
(c) Periodic extension for DCT-7 (d) Periodic extension for DCT-8

• Likewise to develop the Type-2 Discrete Cosine Transform, • Let x[n] be a length-N sequence defined for 0 ≤ n ≤ N − 1.
we extract one period y[n] of the symmetric periodic • First x[n] is extended to a length 2N sequence by zero
sequence padding:
x HSHS [n].
⎧ x[ n], 0 ≤ n ≤ N −1
• For the length-4 sequence given above, the extracted period is xe [n] = ⎨
given by, ⎩0 N ≤ n ≤ 2 N − 1.
{y[n]} = {a b c d d c b a}
• Next a Type-2 symmetric sequence y[n] of length 2N is
• The DCT is then determined from the DFT of y[n]. formed from xe [n] according to
y[n] = xe [ n] + xe [2 N − 1 − n]. 0 ≤ n ≤ 2 N − 1.
• As the Type-2 DCT has been employed in a in a number of ⎧ x[n], 0 ≤ n ≤ N − 1,
international standards for image and video compression, such =⎨
as JPEG, MPEG and H.261, because of its better energy ⎩ x[2n − 1 − n]. N ≤ n ≤ 2 N − 1. .....(1)
compaction property, we consider here only this type of DCT,
Also called the even symmetrical discrete cosine transform.

3
• Note from (1), that the generated sequence y[n] satisfies • By making a change of variables, the DFT Y[k] can be
the symmetry property expressed as..
y[n] = y[2n –1 – n]. N −1 N −1

• The 2N point DFT Y[k] of the length-2N sequence y[n] is Y [k ] = ∑ x[n] W2knN + ∑ x[n] W − kn
2N W2kN(2 N −1)
n =0 n =0
thus … N −1
2 N −1 = W2−Nk / 2 ∑ x[n] (W2knNW2kN/ 2 + W2−NknW2−Nk / 2 )
Y [k ] = ∑ y[n] W kn
2N , 0 ≤ k ≤ 2 N − 1. n =0
n =0 N −1
⎛ π k (2n + 1) ⎞
• We can rewrite the above eqn. As…. X DCT [k ] = ∑ 2 x[n] cos ⎜ ⎟, 0 ≤ k ≤ 2 N − 1.
N −1 2 N −1
n =0 ⎝ 2N ⎠
Y [k ] = ∑ y[n] W2knN + ∑ y[n] W kn
2N
n =0 n= N • The Type 2N-point discrete cosine transform (DCT), X DCT [k ]
N −1
= W2−Nk / 2 ∑ x[n] (W2knNW2kN/2 + W2−NknW2−Nk /2 ) of the length-N sequence x[n] is obtained from the above
k /2
n=0 expression by extractingWthe : N samples of Y[k] and
2 N first

multiplying them with

N −1
⎛ π k (2n + 1) ⎞
X DCT [k ] = ∑ 2 x[n] cos ⎜ ⎟, 0 ≤ k ≤ N − 1. • Above eqns. Constitute a discrete cosine transform pair for
n=0 ⎝ 2N ⎠ the sequence x[n], where the first one is the Analysis eqn.
And the second one is the Synthesis eqn.
• Note that the samples of X DCT [k ] are real for a real
sequence x[n]. • A DCT pair may often be denoted as …
• The inverse discrete cosine transform (IDCT) of an N- DCT
point X DCT [k ] is given by … x[n] ↔ X DCT [k ].

1 N −1 ⎛ π k (2n + 1) ⎞
x[n] = ∑ α [k ] X DCT [k ] cos ⎜⎝ 2 N ⎟⎠ ,
N n =0
0 ≤ n ≤ N − 1.

• Where…
⎧1
⎪ , k = 0,
α [k ] = ⎨ 2
⎪⎩1, 1 ≤ k ≤ N − 1.

THANK YOU

Das könnte Ihnen auch gefallen