Sei sulla pagina 1di 5

DiscreteCosineTransform

LectureandNotesbyProf.BrianL.Evans(UTAustin)
Scribe:ClintSlatton(UTAustin)
BasedonnotesbyProf.RussellMersereau(GeorgiaTech)

Introduction
TheDFTisnottheonlytransformthatiswidelyusedinapplications
Publishedstandardsforimageandvideocoding(compression)makeuseoftheDCT
1. JPEG(1989)
2. MPEG1,2,and4
2.1. MPEG1(1992):videoCDplayers,storageandretrievalofmovingpicturesandaudioonstoragemedia
2.2. MPEG2(1994):HDTV,DVD,standardforDigitalTV(cable)
2.3. MPEG3,originallytargetedforHDTV,wasincorporatedintoMPEG2
2.4. MPEG4(late1998):standardformultimediaapplications,targetedforwirelessvideo
3. H.261,H.263
3.1. H.261(circa1993):videoconferencing
3.2. H.263(circa1995):wirelessvideo
Thesestandardsprovideinstructionsfordecodingthesignal,butthereisoftenconsiderablefreedomfor
encodingthesignal.Formoreinformationgotohttp://drogo.cselt.it/mpeg/.

Compression
Twoclassesofcompressionalgorithmstrytoreducethenumberofbitsrequiredtorepresentasignal.

lossless:compressionratiosaround23:1fordatafiles

lossy:compressionratiosupto1000:1forvideo

Forwirelessvideo,needcompressionratiosupto1000:1.Cangetnearlosslessvideocompressionat8:1with
littledegradation.
Compressionalgorithmsworkbyremovingredundancyinthesignal.Invideosignals,theredundancycanbe
ofthreeforms.

statistical:(e.g.Huffmancodes,arithmetic,LempelZiv)

spatial:(e.g.vectorquantization,DCT,subbandcoders,wavelets)

temporal:(e.g.motioncompensation)

WaveletcompressionisusedinJPEG2000,MPEG4,andH.263+
Transformcodersdecomposeaframeintoblocks,typically8x8.InMPEG2,theyarecalledmacroblocksand
dividetheframeintoluminance(intensity)andchrominance(color)images(YUV).

luminanceimage:one16x16macroblockorfour8x8macroblocks(Y)

chrominanceimage:two8x8blocks(UV)

A2DDCTofeachblockiscomputedandthetransformcoefficientsarequantized.Quantizedcoefficientsare
codedlosslessly.Thechoiceofquantizationaffectsthetransmissionrateanddistortion.
AdvantagesoftheDCT(relativetotheDFT)

realvalued

betterenergycompaction(muchofthesignalenergycanberepresentedbyonlyafewcoefficients)

coefficientsarenearlyuncorrelated

experimentallyobservedtoworkwell

2-D DCT

X c k1 , k2

x n1 , n2

N1 1 N 2 1

n1 0 n2 0

4 x n1 , n2

N1 1 N2 1

N1 N 2

k1 0 k 2 0

2n 1 k
2n 1 k
1
1
2
2

cos
cos

2N
2
N

1
2

C k1 C k 2 X c k1 , k2

2n 1 k
2n 1 k
1
1
2
2
cos
cos

2
N
2N

1
2

1 , k 0
C k 2
1, k 0
1. TheDFTisrelatedtotheFourierSeriescoefficientsofaperiodicallyextendedsequence.

2. TheDCTisrelatedtotheFourierSeriescoefficientsofasymmetricallyextendedsequence.
3. The2DDCTisaseparabletransform.Itcanbeevaluatedusingarowcolumndecomposition.Fora8x8
DCT,weneed161DDCTs.Calling16functionsmayleadtounacceptableoverheadfor8pointDCTs.

1-D DCT
2n 1k

X c k 2 x n cos

n 0

2N

N 1

Definethesymmetricextensionof x n as y n x n x 2 N 1 n for n 0, 1, . . . , N 1.

x n

yn

N 1

Nowconsiderthe2NpointDFTof y n .
Y k

2 N1

y n e

kn

2N

n 0

N 1

x n e

kn

2N

N 1

x n e

kn

2N

x n e

n 0

N 1

1 n e

N1

x n e

2
2N

2
2N

k 2N 1 n

n0

n 0

x 2 N

n N

n 0

2 N 1

2N

2
2N

kn

kn

2N

N 1

n 0

2 N

2 x n cos

2N

2 n

kn

N 1

2N 1

Algorithm #1 for 1-D DCT


1. Set y n x n x 2 N 1 n
2. Calculate Y k usinga2NpointDFT

3. Set X c k exp j

2N

k Y k ,for k 0, 1, . . . , N 1.

ThisrequiresN+Nlog2(2N)complexmultiplies.Anotheralgorithmcanbedevelopedthatrequiresfewer
multipliesbyusingashorterDFT.

Review of 1-D Decimation-in-Time (DIT) FFT


Considerthe1DDFT

Y k

2 N1

y n W 2 N
nk

n 0

Dividethesumintotwocomponents,oneovertheevensamplesandoneovertheoddsamples.

Notethat

G[k]andH[k]areNpointDFTs:
Set

g n y 2n , n 0, 1, . . . , N 1
h n y 2n 1, n 0, 1, . . . , N 1

x[n]

d
c

y[n]

g n aa,bc, d, b

h n b, d, c, a g N 1 n

0
N1
n

Therefore,

d
c

b
a

N1

2N1

Algorithm #2 for 1-D DCT


1. Set

2. CalculatetheNpointDFTof

3. Set

ThecoefficientsinfrontofGreal[k]canbeprecomputedfordifferentvaluesofkforagivenN.
Note:SpecialalgorithmsexistforcomputingDFTsofrealarrays.

Potrebbero piacerti anche