Top Banner
3: Discrete Cosine Transform 3: Discrete Cosine Transform DFT Problems DCT + Basis Functions DCT of sine wave DCT Properties Energy Conservation Energy Compaction Frame-based coding Lapped Transform + MDCT (Modified DCT) MDCT Basis Elements Summary MATLAB routines DSP and Digital Filters (2017-10120) Transforms: 3 – 1 / 14
95

Discrete Cosine Transform

Sep 11, 2021

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Discrete Cosine Transform

3: Discrete Cosine Transform

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 1 / 14

Page 2: Discrete Cosine Transform

DFT Problems

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 2 / 14

For processing 1-D or 2-D signals (especially coding), a common method isto divide the signal into “frames” and then apply an invertible transform toeach frame that compresses the information into few coefficients.

The DFT has some problems when used for this purpose:

Page 3: Discrete Cosine Transform

DFT Problems

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 2 / 14

For processing 1-D or 2-D signals (especially coding), a common method isto divide the signal into “frames” and then apply an invertible transform toeach frame that compresses the information into few coefficients.

The DFT has some problems when used for this purpose:

• N real x[n]↔N complex X[k] : 2 real, N2 − 1 conjugate pairs

Page 4: Discrete Cosine Transform

DFT Problems

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 2 / 14

For processing 1-D or 2-D signals (especially coding), a common method isto divide the signal into “frames” and then apply an invertible transform toeach frame that compresses the information into few coefficients.

The DFT has some problems when used for this purpose:

• N real x[n]↔N complex X[k] : 2 real, N2 − 1 conjugate pairs

• DFT ∝ the DTFT of a periodic signal formed by replicating x[n] .

Page 5: Discrete Cosine Transform

DFT Problems

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 2 / 14

For processing 1-D or 2-D signals (especially coding), a common method isto divide the signal into “frames” and then apply an invertible transform toeach frame that compresses the information into few coefficients.

The DFT has some problems when used for this purpose:

• N real x[n]↔N complex X[k] : 2 real, N2 − 1 conjugate pairs

• DFT ∝ the DTFT of a periodic signal formed by replicating x[n] .⇒ Spurious frequency components from boundary discontinuity.

N=20f=0.08

Page 6: Discrete Cosine Transform

DFT Problems

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 2 / 14

For processing 1-D or 2-D signals (especially coding), a common method isto divide the signal into “frames” and then apply an invertible transform toeach frame that compresses the information into few coefficients.

The DFT has some problems when used for this purpose:

• N real x[n]↔N complex X[k] : 2 real, N2 − 1 conjugate pairs

• DFT ∝ the DTFT of a periodic signal formed by replicating x[n] .⇒ Spurious frequency components from boundary discontinuity.

N=20f=0.08

The Discrete Cosine Transform (DCT) overcomes these problems.

Page 7: Discrete Cosine Transform

DCT +

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 3 / 14

To form the Discrete Cosine Transform (DCT), replicate x[0 : N − 1] but inreverse order and insert a zero between each pair of samples:

0 12 23

y[r]

Take the DFT of length 4N real, symmetric, odd-sample-only sequence.

Page 8: Discrete Cosine Transform

DCT +

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 3 / 14

To form the Discrete Cosine Transform (DCT), replicate x[0 : N − 1] but inreverse order and insert a zero between each pair of samples:

0 12 23

y[r]

Take the DFT of length 4N real, symmetric, odd-sample-only sequence.Result is real, symmetric and anti-periodic:

012

23

Y[k]

Page 9: Discrete Cosine Transform

DCT +

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 3 / 14

To form the Discrete Cosine Transform (DCT), replicate x[0 : N − 1] but inreverse order and insert a zero between each pair of samples:

0 12 23

y[r]

Take the DFT of length 4N real, symmetric, odd-sample-only sequence.Result is real, symmetric and anti-periodic: only need first N values

012

23

Y[k]

÷2−→

Page 10: Discrete Cosine Transform

DCT +

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 3 / 14

To form the Discrete Cosine Transform (DCT), replicate x[0 : N − 1] but inreverse order and insert a zero between each pair of samples:

0 12 23

y[r]

Take the DFT of length 4N real, symmetric, odd-sample-only sequence.Result is real, symmetric and anti-periodic: only need first N values

012

23

Y[k]

÷2−→

Forward DCT: XC [k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N for k = 0 : N − 1

Page 11: Discrete Cosine Transform

DCT +

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 3 / 14

To form the Discrete Cosine Transform (DCT), replicate x[0 : N − 1] but inreverse order and insert a zero between each pair of samples:

0 12 23

y[r]

Take the DFT of length 4N real, symmetric, odd-sample-only sequence.Result is real, symmetric and anti-periodic: only need first N values

012

23

Y[k]

÷2−→

Forward DCT: XC [k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N for k = 0 : N − 1

Inverse DCT: x[n] = 1NX[0] + 2

N

∑N−1k=1 X[k] cos 2π(2n+1)k

4N

Page 12: Discrete Cosine Transform

Basis Functions

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14

DFT basis functions: x[n] = 1N

∑N−1k=0 X[k]ej2π

kn

N

Page 13: Discrete Cosine Transform

Basis Functions

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14

DFT basis functions: x[n] = 1N

∑N−1k=0 X[k]ej2π

kn

N

Page 14: Discrete Cosine Transform

Basis Functions

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14

DFT basis functions: x[n] = 1N

∑N−1k=0 X[k]ej2π

kn

N

Page 15: Discrete Cosine Transform

Basis Functions

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14

DFT basis functions: x[n] = 1N

∑N−1k=0 X[k]ej2π

kn

N

Page 16: Discrete Cosine Transform

Basis Functions

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14

DFT basis functions: x[n] = 1N

∑N−1k=0 X[k]ej2π

kn

N

Page 17: Discrete Cosine Transform

Basis Functions

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14

DFT basis functions: x[n] = 1N

∑N−1k=0 X[k]ej2π

kn

N

Page 18: Discrete Cosine Transform

Basis Functions

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14

DFT basis functions: x[n] = 1N

∑N−1k=0 X[k]ej2π

kn

N

DCT basis functions: x[n] = 1NX[0] + 2

N

∑N−1k=1 X[k] cos 2π(2n+1)k

4N

Page 19: Discrete Cosine Transform

Basis Functions

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14

DFT basis functions: x[n] = 1N

∑N−1k=0 X[k]ej2π

kn

N

DCT basis functions: x[n] = 1NX[0] + 2

N

∑N−1k=1 X[k] cos 2π(2n+1)k

4N

Page 20: Discrete Cosine Transform

Basis Functions

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14

DFT basis functions: x[n] = 1N

∑N−1k=0 X[k]ej2π

kn

N

DCT basis functions: x[n] = 1NX[0] + 2

N

∑N−1k=1 X[k] cos 2π(2n+1)k

4N

Page 21: Discrete Cosine Transform

Basis Functions

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14

DFT basis functions: x[n] = 1N

∑N−1k=0 X[k]ej2π

kn

N

DCT basis functions: x[n] = 1NX[0] + 2

N

∑N−1k=1 X[k] cos 2π(2n+1)k

4N

Page 22: Discrete Cosine Transform

Basis Functions

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14

DFT basis functions: x[n] = 1N

∑N−1k=0 X[k]ej2π

kn

N

DCT basis functions: x[n] = 1NX[0] + 2

N

∑N−1k=1 X[k] cos 2π(2n+1)k

4N

Page 23: Discrete Cosine Transform

Basis Functions

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14

DFT basis functions: x[n] = 1N

∑N−1k=0 X[k]ej2π

kn

N

DCT basis functions: x[n] = 1NX[0] + 2

N

∑N−1k=1 X[k] cos 2π(2n+1)k

4N

Page 24: Discrete Cosine Transform

Basis Functions

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 4 / 14

DFT basis functions: x[n] = 1N

∑N−1k=0 X[k]ej2π

kn

N

DCT basis functions: x[n] = 1NX[0] + 2

N

∑N−1k=1 X[k] cos 2π(2n+1)k

4N

Page 25: Discrete Cosine Transform

DCT of sine wave

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 5 / 14

DCT: XC [k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

Page 26: Discrete Cosine Transform

DCT of sine wave

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 5 / 14

DCT: XC [k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

f = mN

x[n]N=20f=0.10

Page 27: Discrete Cosine Transform

DCT of sine wave

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 5 / 14

DCT: XC [k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

f = mN

x[n]N=20f=0.10

|XF [k]|

Page 28: Discrete Cosine Transform

DCT of sine wave

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 5 / 14

DCT: XC [k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

f = mN

f 6= mN

x[n]N=20f=0.10

N=20f=0.08

|XF [k]|

Page 29: Discrete Cosine Transform

DCT of sine wave

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 5 / 14

DCT: XC [k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

f = mN

f 6= mN

x[n]N=20f=0.10

N=20f=0.08

|XF [k]|

Page 30: Discrete Cosine Transform

DCT of sine wave

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 5 / 14

DCT: XC [k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

f = mN

f 6= mN

x[n]N=20f=0.10

N=20f=0.08

|XF [k]|

DFT: Real→Complex; Freq range [0, 1]; Poorly localized unlessf = m

N; |XF [k]| ∝ k−1 for Nf < k ≪ N

2

Page 31: Discrete Cosine Transform

DCT of sine wave

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 5 / 14

DCT: XC [k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

f = mN

f 6= mN

x[n]N=20f=0.10

N=20f=0.08

|XF [k]|

|XC [k]|

DFT: Real→Complex; Freq range [0, 1]; Poorly localized unlessf = m

N; |XF [k]| ∝ k−1 for Nf < k ≪ N

2

Page 32: Discrete Cosine Transform

DCT of sine wave

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 5 / 14

DCT: XC [k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

f = mN

f 6= mN

x[n]N=20f=0.10

N=20f=0.08

|XF [k]|

|XC [k]|

DFT: Real→Complex; Freq range [0, 1]; Poorly localized unlessf = m

N; |XF [k]| ∝ k−1 for Nf < k ≪ N

2DCT: Real→Real; Freq range [0, 0.5]; Well localized ∀f ;

|XC [k]| ∝ k−2 for 2Nf < k < N

Page 33: Discrete Cosine Transform

DCT Properties

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 6 / 14

Definition: X[k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

Page 34: Discrete Cosine Transform

DCT Properties

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 6 / 14

Definition: X[k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

• Linear: αx[n] + βy[n]→ αX[k] + βY [k]

Page 35: Discrete Cosine Transform

DCT Properties

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 6 / 14

Definition: X[k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

• Linear: αx[n] + βy[n]→ αX[k] + βY [k]

• “Convolution←→Multiplication” property of DFT does not hold /

Page 36: Discrete Cosine Transform

DCT Properties

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 6 / 14

Definition: X[k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

• Linear: αx[n] + βy[n]→ αX[k] + βY [k]

• “Convolution←→Multiplication” property of DFT does not hold /

• Symmetric: X[−k] = X[k] since cos−αk = cos+αk

Page 37: Discrete Cosine Transform

DCT Properties

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 6 / 14

Definition: X[k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

• Linear: αx[n] + βy[n]→ αX[k] + βY [k]

• “Convolution←→Multiplication” property of DFT does not hold /

• Symmetric: X[−k] = X[k] since cos−αk = cos+αk

• Anti-periodic: X[k + 2N ] = −X[k]

Page 38: Discrete Cosine Transform

DCT Properties

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 6 / 14

Definition: X[k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

• Linear: αx[n] + βy[n]→ αX[k] + βY [k]

• “Convolution←→Multiplication” property of DFT does not hold /

• Symmetric: X[−k] = X[k] since cos−αk = cos+αk

• Anti-periodic: X[k + 2N ] = −X[k] because:◦ 2π(2n+ 1)(k + 2N) = 2π(2n+ 1)k + 8πNn+ 4Nπ

◦ cos (θ + π) = − cos θ

Page 39: Discrete Cosine Transform

DCT Properties

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 6 / 14

Definition: X[k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

• Linear: αx[n] + βy[n]→ αX[k] + βY [k]

• “Convolution←→Multiplication” property of DFT does not hold /

• Symmetric: X[−k] = X[k] since cos−αk = cos+αk

• Anti-periodic: X[k + 2N ] = −X[k] because:◦ 2π(2n+ 1)(k + 2N) = 2π(2n+ 1)k + 8πNn+ 4Nπ

◦ cos (θ + π) = − cos θ

⇒X[N ] = 0 since X[N ] = X[−N ] = −X[−N + 2N ]

Page 40: Discrete Cosine Transform

DCT Properties

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 6 / 14

Definition: X[k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

• Linear: αx[n] + βy[n]→ αX[k] + βY [k]

• “Convolution←→Multiplication” property of DFT does not hold /

• Symmetric: X[−k] = X[k] since cos−αk = cos+αk

• Anti-periodic: X[k + 2N ] = −X[k] because:◦ 2π(2n+ 1)(k + 2N) = 2π(2n+ 1)k + 8πNn+ 4Nπ

◦ cos (θ + π) = − cos θ

⇒X[N ] = 0 since X[N ] = X[−N ] = −X[−N + 2N ]

• Periodic: X[k + 4N ] = −X[k + 2N ] = X[k]

Page 41: Discrete Cosine Transform

Energy Conservation

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 7 / 14

DCT: X[k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

IDCT: x[n] = 1NX[0] + 2

N

∑N−1k=1 X[k] cos 2π(2n+1)k

4N

rep→

0 12 23

y[r]

DFT→ 0

1223

Y[k]

÷2→

Page 42: Discrete Cosine Transform

Energy Conservation

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 7 / 14

DCT: X[k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

IDCT: x[n] = 1NX[0] + 2

N

∑N−1k=1 X[k] cos 2π(2n+1)k

4N

rep→

0 12 23

y[r]

DFT→ 0

1223

Y[k]

÷2→

Energy: E =∑N−1

n=0 |x[n]|2

Page 43: Discrete Cosine Transform

Energy Conservation

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 7 / 14

DCT: X[k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

IDCT: x[n] = 1NX[0] + 2

N

∑N−1k=1 X[k] cos 2π(2n+1)k

4N

rep→

0 12 23

y[r]

DFT→ 0

1223

Y[k]

÷2→

Energy: E =∑N−1

n=0 |x[n]|2= 1

N|X[0]|

2+ 2

N

∑N−1n=1 |X[n]|

2

Page 44: Discrete Cosine Transform

Energy Conservation

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 7 / 14

DCT: X[k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

IDCT: x[n] = 1NX[0] + 2

N

∑N−1k=1 X[k] cos 2π(2n+1)k

4N

rep→

0 12 23

y[r]

DFT→ 0

1223

Y[k]

÷2→

Energy: E =∑N−1

n=0 |x[n]|2= 1

N|X[0]|

2+ 2

N

∑N−1n=1 |X[n]|

2

In diagram above: E → 2E→ 8NE→≈ 0.5NE

Page 45: Discrete Cosine Transform

Energy Conservation

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 7 / 14

DCT: X[k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

IDCT: x[n] = 1NX[0] + 2

N

∑N−1k=1 X[k] cos 2π(2n+1)k

4N

rep→

0 12 23

y[r]

DFT→ 0

1223

Y[k]

÷2→

Energy: E =∑N−1

n=0 |x[n]|2= 1

N|X[0]|

2+ 2

N

∑N−1n=1 |X[n]|

2

In diagram above: E → 2E→ 8NE→≈ 0.5NE

Orthogonal DCT (preserves energy:∑

|x[n]|2 =∑

|X[n]|2)

Note: MATLAB dct() calculates the ODCT

Page 46: Discrete Cosine Transform

Energy Conservation

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 7 / 14

DCT: X[k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

IDCT: x[n] = 1NX[0] + 2

N

∑N−1k=1 X[k] cos 2π(2n+1)k

4N

rep→

0 12 23

y[r]

DFT→ 0

1223

Y[k]

÷2→

Energy: E =∑N−1

n=0 |x[n]|2= 1

N|X[0]|

2+ 2

N

∑N−1n=1 |X[n]|

2

In diagram above: E → 2E→ 8NE→≈ 0.5NE

Orthogonal DCT (preserves energy:∑

|x[n]|2 =∑

|X[n]|2)

ODCT: X[k] =

1N

∑N−1n=0 x[n] k = 0

2N

∑N−1n=0 x[n] cos 2π(2n+1)k

4N k 6= 0

Note: MATLAB dct() calculates the ODCT

Page 47: Discrete Cosine Transform

Energy Conservation

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 7 / 14

DCT: X[k] =∑N−1

n=0 x[n] cos 2π(2n+1)k4N

IDCT: x[n] = 1NX[0] + 2

N

∑N−1k=1 X[k] cos 2π(2n+1)k

4N

rep→

0 12 23

y[r]

DFT→ 0

1223

Y[k]

÷2→

Energy: E =∑N−1

n=0 |x[n]|2= 1

N|X[0]|

2+ 2

N

∑N−1n=1 |X[n]|

2

In diagram above: E → 2E→ 8NE→≈ 0.5NE

Orthogonal DCT (preserves energy:∑

|x[n]|2 =∑

|X[n]|2)

ODCT: X[k] =

1N

∑N−1n=0 x[n] k = 0

2N

∑N−1n=0 x[n] cos 2π(2n+1)k

4N k 6= 0

IODCT: x[n] =√

1NX[0] +

2N

∑N−1k=1 X[k] cos 2π(2n+1)k

4N

Note: MATLAB dct() calculates the ODCT

Page 48: Discrete Cosine Transform

Energy Compaction

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 8 / 14

If consecutive x[n] are positively correlated, DCT concentrates energy in afew X[k] and decorrelates them.

Page 49: Discrete Cosine Transform

Energy Compaction

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 8 / 14

If consecutive x[n] are positively correlated, DCT concentrates energy in afew X[k] and decorrelates them.

Example: Markov Process: x[n] = ρx[n− 1] +√

1− ρ2u[n]where u[n] is i.i.d. unit Gaussian.Then

x2[n]⟩

= 1 and 〈x[n]x[n− 1]〉 = ρ.

Covariance of vector x is Si,j =⟨

xxH⟩

i,j= ρ|i−j|.

Page 50: Discrete Cosine Transform

Energy Compaction

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 8 / 14

If consecutive x[n] are positively correlated, DCT concentrates energy in afew X[k] and decorrelates them.

Example: Markov Process: x[n] = ρx[n− 1] +√

1− ρ2u[n]where u[n] is i.i.d. unit Gaussian.Then

x2[n]⟩

= 1 and 〈x[n]x[n− 1]〉 = ρ.

Covariance of vector x is Si,j =⟨

xxH⟩

i,j= ρ|i−j|.

Suppose ODCT of x is Cx and DFT is Fx.

Covariance of Cx is⟨

CxxHCH⟩

= CSCH (similarly FSFH )

Diagonal elements give mean coefficient energy.

Page 51: Discrete Cosine Transform

Energy Compaction

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 8 / 14

If consecutive x[n] are positively correlated, DCT concentrates energy in afew X[k] and decorrelates them.

Example: Markov Process: x[n] = ρx[n− 1] +√

1− ρ2u[n]where u[n] is i.i.d. unit Gaussian.Then

x2[n]⟩

= 1 and 〈x[n]x[n− 1]〉 = ρ.

Covariance of vector x is Si,j =⟨

xxH⟩

i,j= ρ|i−j|.

Suppose ODCT of x is Cx and DFT is Fx.

Covariance of Cx is⟨

CxxHCH⟩

= CSCH (similarly FSFH )

Diagonal elements give mean coefficient energy.

Page 52: Discrete Cosine Transform

Energy Compaction

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 8 / 14

If consecutive x[n] are positively correlated, DCT concentrates energy in afew X[k] and decorrelates them.

Example: Markov Process: x[n] = ρx[n− 1] +√

1− ρ2u[n]where u[n] is i.i.d. unit Gaussian.Then

x2[n]⟩

= 1 and 〈x[n]x[n− 1]〉 = ρ.

Covariance of vector x is Si,j =⟨

xxH⟩

i,j= ρ|i−j|.

Suppose ODCT of x is Cx and DFT is Fx.

Covariance of Cx is⟨

CxxHCH⟩

= CSCH (similarly FSFH )

Diagonal elements give mean coefficient energy.

• Used in MPEG and JPEG (superseded byJPEG2000 using wavelets)

• Used in speech recognition to decorrelatespectral coeficients: DCT of log spectrum

Page 53: Discrete Cosine Transform

Energy Compaction

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 8 / 14

If consecutive x[n] are positively correlated, DCT concentrates energy in afew X[k] and decorrelates them.

Example: Markov Process: x[n] = ρx[n− 1] +√

1− ρ2u[n]where u[n] is i.i.d. unit Gaussian.Then

x2[n]⟩

= 1 and 〈x[n]x[n− 1]〉 = ρ.

Covariance of vector x is Si,j =⟨

xxH⟩

i,j= ρ|i−j|.

Suppose ODCT of x is Cx and DFT is Fx.

Covariance of Cx is⟨

CxxHCH⟩

= CSCH (similarly FSFH )

Diagonal elements give mean coefficient energy.

• Used in MPEG and JPEG (superseded byJPEG2000 using wavelets)

• Used in speech recognition to decorrelatespectral coeficients: DCT of log spectrum

Energy compaction good for coding (low-valued coefficients can be set to 0)Decorrelation good for coding and for probability modelling

Page 54: Discrete Cosine Transform

Frame-based coding

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 9 / 14

• Divide continuous signalinto frames x[n]

X[k] k=30/220

y[n]

y[n]-x[n]

Page 55: Discrete Cosine Transform

Frame-based coding

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 9 / 14

• Divide continuous signalinto frames

• Apply DCT to each frame

x[n]

X[k] k=30/220

y[n]

y[n]-x[n]

Page 56: Discrete Cosine Transform

Frame-based coding

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 9 / 14

• Divide continuous signalinto frames

• Apply DCT to each frame

• Encode DCT

◦ e.g. keep only 30 X[k]

x[n]

X[k] k=30/220

y[n]

y[n]-x[n]

Page 57: Discrete Cosine Transform

Frame-based coding

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 9 / 14

• Divide continuous signalinto frames

• Apply DCT to each frame

• Encode DCT

◦ e.g. keep only 30 X[k]

• Apply IDCT→ y[n]

x[n]

X[k] k=30/220

y[n]

y[n]-x[n]

Page 58: Discrete Cosine Transform

Frame-based coding

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 9 / 14

• Divide continuous signalinto frames

• Apply DCT to each frame

• Encode DCT

◦ e.g. keep only 30 X[k]

• Apply IDCT→ y[n]

x[n]

X[k] k=30/220

y[n]

y[n]-x[n]

Problem: Coding may create discontinuities at frame boundaries

Page 59: Discrete Cosine Transform

Frame-based coding

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 9 / 14

• Divide continuous signalinto frames

• Apply DCT to each frame

• Encode DCT

◦ e.g. keep only 30 X[k]

• Apply IDCT→ y[n]

x[n]

X[k] k=30/220

y[n]

y[n]-x[n]

Problem: Coding may create discontinuities at frame boundariese.g. JPEG, MPEG use 8× 8 pixel blocks

8.3 kB (PNG) 1.6 kB (JPEG) 0.5 kB (JPEG)

Page 60: Discrete Cosine Transform

Lapped Transform +

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 10 / 14

Modified Discrete Cosine Transform (MDCT): overlapping frames 2N long

x[0 : 2N − 1]

X0[k]

y0[n]

x[n]

0 N

N

2N

2N

3N

3N

4N

4N

Page 61: Discrete Cosine Transform

Lapped Transform +

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 10 / 14

Modified Discrete Cosine Transform (MDCT): overlapping frames 2N long

x[0 : 2N − 1]MDCT→ X0[0 : N − 1]

X0[k]

y0[n]

x[n]

0 N

N

2N

2N

3N

3N

4N

4N

MDCT: 2N → N coefficients

Page 62: Discrete Cosine Transform

Lapped Transform +

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 10 / 14

Modified Discrete Cosine Transform (MDCT): overlapping frames 2N long

x[0 : 2N − 1]MDCT→ X0[0 : N − 1]

IMDCT→ y0[0 : 2N − 1]

X0[k]

y0[n]

x[n]

0 N

N

2N

2N

3N

3N

4N

4N

MDCT: 2N → N coefficients, IMDCT: N → 2N samples

Page 63: Discrete Cosine Transform

Lapped Transform +

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 10 / 14

Modified Discrete Cosine Transform (MDCT): overlapping frames 2N long

x[0 : 2N − 1]MDCT→ X0[0 : N − 1]

IMDCT→ y0[0 : 2N − 1]

x[N : 3N − 1]MDCT→ X1[N : 2N − 1]

X0[k]

y0[n]

X1[k]

y1[n]

x[n]

0 N

N

2N

2N

3N

3N

4N

4N

MDCT: 2N → N coefficients, IMDCT: N → 2N samples

Page 64: Discrete Cosine Transform

Lapped Transform +

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 10 / 14

Modified Discrete Cosine Transform (MDCT): overlapping frames 2N long

x[0 : 2N − 1]MDCT→ X0[0 : N − 1]

IMDCT→ y0[0 : 2N − 1]

x[N : 3N − 1]MDCT→ X1[N : 2N − 1]

IMDCT→ y1[N : 3N − 1]

X0[k]

y0[n]

X1[k]

y1[n]

x[n]

0 N

N

2N

2N

3N

3N

4N

4N

MDCT: 2N → N coefficients, IMDCT: N → 2N samples

Page 65: Discrete Cosine Transform

Lapped Transform +

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 10 / 14

Modified Discrete Cosine Transform (MDCT): overlapping frames 2N long

x[0 : 2N − 1]MDCT→ X0[0 : N − 1]

IMDCT→ y0[0 : 2N − 1]

x[N : 3N − 1]MDCT→ X1[N : 2N − 1]

IMDCT→ y1[N : 3N − 1]

x[2N : 4N − 1]MDCT→ X2[2N : 3N − 1]

X0[k]

y0[n]

X1[k]

y1[n]

X2[k]

y2[n]

x[n]

0 N

N

2N

2N

3N

3N

4N

4N

MDCT: 2N → N coefficients, IMDCT: N → 2N samples

Page 66: Discrete Cosine Transform

Lapped Transform +

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 10 / 14

Modified Discrete Cosine Transform (MDCT): overlapping frames 2N long

x[0 : 2N − 1]MDCT→ X0[0 : N − 1]

IMDCT→ y0[0 : 2N − 1]

x[N : 3N − 1]MDCT→ X1[N : 2N − 1]

IMDCT→ y1[N : 3N − 1]

x[2N : 4N − 1]MDCT→ X2[2N : 3N − 1]

IMDCT→ y2[2N : 4N − 1]

X0[k]

y0[n]

X1[k]

y1[n]

X2[k]

y2[n]

x[n]

0 N

N

2N

2N

3N

3N

4N

4N

MDCT: 2N → N coefficients, IMDCT: N → 2N samples

Page 67: Discrete Cosine Transform

Lapped Transform +

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 10 / 14

Modified Discrete Cosine Transform (MDCT): overlapping frames 2N long

x[0 : 2N − 1]MDCT→ X0[0 : N − 1]

IMDCT→ y0[0 : 2N − 1]

x[N : 3N − 1]MDCT→ X1[N : 2N − 1]

IMDCT→ y1[N : 3N − 1]

x[2N : 4N − 1]MDCT→ X2[2N : 3N − 1]

IMDCT→ y2[2N : 4N − 1]

y[n] = y0[n]+ y1[n]+ y2[n]

X0[k]

y0[n]

X1[k]

y1[n]

X2[k]

y2[n]

y[n]

x[n]

0 N

N

2N

2N

3N

3N

4N

4N

MDCT: 2N → N coefficients, IMDCT: N → 2N samplesAdd yi[n] together to get y[n]. Only two non-zero terms far any n.

Page 68: Discrete Cosine Transform

Lapped Transform +

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 10 / 14

Modified Discrete Cosine Transform (MDCT): overlapping frames 2N long

x[0 : 2N − 1]MDCT→ X0[0 : N − 1]

IMDCT→ y0[0 : 2N − 1]

x[N : 3N − 1]MDCT→ X1[N : 2N − 1]

IMDCT→ y1[N : 3N − 1]

x[2N : 4N − 1]MDCT→ X2[2N : 3N − 1]

IMDCT→ y2[2N : 4N − 1]

y[n] = y0[n]+ y1[n]+ y2[n]

X0[k]

y0[n]

X1[k]

y1[n]

X2[k]

y2[n]

y[n]

y[n]-x[n] = error

x[n]

0 N

N

2N

2N

3N

3N

4N

4N

MDCT: 2N → N coefficients, IMDCT: N → 2N samplesAdd yi[n] together to get y[n]. Only two non-zero terms far any n.Errors cancel exactly: Time-domain alias cancellation (TDAC)

Page 69: Discrete Cosine Transform

MDCT (Modified DCT)

DSP and Digital Filters (2017-10120) Transforms: 3 – 11 / 14

MDCT: X[k] =∑2N−1

n=0 x[n] cos 2π(2n+1+N)(2k+1)8N 0 ≤ k < N

Page 70: Discrete Cosine Transform

MDCT (Modified DCT)

DSP and Digital Filters (2017-10120) Transforms: 3 – 11 / 14

MDCT: X[k] =∑2N−1

n=0 x[n] cos 2π(2n+1+N)(2k+1)8N 0 ≤ k < N

If x and X are column vectors, then X = Mx

where M is an N × 2N matrix with mk,n = cos 2π(2n+1+N)(2k+1)8N .

Page 71: Discrete Cosine Transform

MDCT (Modified DCT)

DSP and Digital Filters (2017-10120) Transforms: 3 – 11 / 14

MDCT: X[k] =∑2N−1

n=0 x[n] cos 2π(2n+1+N)(2k+1)8N 0 ≤ k < N

IMDCT: y[n] = 1N

∑N−1k=0 X[k] cos 2π(2n+1+N)(2k+1)

8N 0 ≤ n < 2N

If x and X are column vectors, then X = Mx

where M is an N × 2N matrix with mk,n = cos 2π(2n+1+N)(2k+1)8N .

Page 72: Discrete Cosine Transform

MDCT (Modified DCT)

DSP and Digital Filters (2017-10120) Transforms: 3 – 11 / 14

MDCT: X[k] =∑2N−1

n=0 x[n] cos 2π(2n+1+N)(2k+1)8N 0 ≤ k < N

IMDCT: y[n] = 1N

∑N−1k=0 X[k] cos 2π(2n+1+N)(2k+1)

8N 0 ≤ n < 2N

If x, X and y are column vectors, then X = Mx and y = 1NMTX

where M is an N × 2N matrix with mk,n = cos 2π(2n+1+N)(2k+1)8N .

Page 73: Discrete Cosine Transform

MDCT (Modified DCT)

DSP and Digital Filters (2017-10120) Transforms: 3 – 11 / 14

MDCT: X[k] =∑2N−1

n=0 x[n] cos 2π(2n+1+N)(2k+1)8N 0 ≤ k < N

IMDCT: y[n] = 1N

∑N−1k=0 X[k] cos 2π(2n+1+N)(2k+1)

8N 0 ≤ n < 2N

If x, X and y are column vectors, then X = Mx and y = 1NMTX = 1

NMTMx

where M is an N × 2N matrix with mk,n = cos 2π(2n+1+N)(2k+1)8N .

Page 74: Discrete Cosine Transform

MDCT (Modified DCT)

DSP and Digital Filters (2017-10120) Transforms: 3 – 11 / 14

MDCT: X[k] =∑2N−1

n=0 x[n] cos 2π(2n+1+N)(2k+1)8N 0 ≤ k < N

IMDCT: y[n] = 1N

∑N−1k=0 X[k] cos 2π(2n+1+N)(2k+1)

8N 0 ≤ n < 2N

If x, X and y are column vectors, then X = Mx and y = 1NMTX = 1

NMTMx

where M is an N × 2N matrix with mk,n = cos 2π(2n+1+N)(2k+1)8N .

Quasi-Orthogonality: The 2N × 2Nmatrix, 1NMTM, is almost the identity:

1NMTM = 1

2

[

I− J 0

0 I+ J

]

with I =

1 · · · 0...

. . ....

0 · · · 1

, J =

0 · · · 1... . .

. ...

1 · · · 0

Page 75: Discrete Cosine Transform

MDCT (Modified DCT)

DSP and Digital Filters (2017-10120) Transforms: 3 – 11 / 14

MDCT: X[k] =∑2N−1

n=0 x[n] cos 2π(2n+1+N)(2k+1)8N 0 ≤ k < N

IMDCT: y[n] = 1N

∑N−1k=0 X[k] cos 2π(2n+1+N)(2k+1)

8N 0 ≤ n < 2N

If x, X and y are column vectors, then X = Mx and y = 1NMTX = 1

NMTMx

where M is an N × 2N matrix with mk,n = cos 2π(2n+1+N)(2k+1)8N .

Quasi-Orthogonality: The 2N × 2Nmatrix, 1NMTM, is almost the identity:

1NMTM = 1

2

[

I− J 0

0 I+ J

]

with I =

1 · · · 0...

. . ....

0 · · · 1

, J =

0 · · · 1... . .

. ...

1 · · · 0

When two consective y frames are overlapped by N samples, the second half of thefirst frame has thus been multiplied by 1

2 (I+ J) and the first half of the second frameby 1

2 (I− J). When these y frames are added together, the corresponding x sampleshave been multiplied by 1

2 (I+ J) + 12 (I− J) = I giving perfect reconstruction.

Page 76: Discrete Cosine Transform

MDCT (Modified DCT)

DSP and Digital Filters (2017-10120) Transforms: 3 – 11 / 14

MDCT: X[k] =∑2N−1

n=0 x[n] cos 2π(2n+1+N)(2k+1)8N 0 ≤ k < N

IMDCT: y[n] = 1N

∑N−1k=0 X[k] cos 2π(2n+1+N)(2k+1)

8N 0 ≤ n < 2N

If x, X and y are column vectors, then X = Mx and y = 1NMTX = 1

NMTMx

where M is an N × 2N matrix with mk,n = cos 2π(2n+1+N)(2k+1)8N .

Quasi-Orthogonality: The 2N × 2Nmatrix, 1NMTM, is almost the identity:

1NMTM = 1

2

[

I− J 0

0 I+ J

]

with I =

1 · · · 0...

. . ....

0 · · · 1

, J =

0 · · · 1... . .

. ...

1 · · · 0

When two consective y frames are overlapped by N samples, the second half of thefirst frame has thus been multiplied by 1

2 (I+ J) and the first half of the second frameby 1

2 (I− J). When these y frames are added together, the corresponding x sampleshave been multiplied by 1

2 (I+ J) + 12 (I− J) = I giving perfect reconstruction.

Normally the 2N -long x and y frames are windowed before the MDCT and again afterthe IMDCT to avoid any discontinuities; if the window is symmetric and satisfiesw2[i] + w2[i+N ] = 2 the perfect reconstruction property is still true.

Page 77: Discrete Cosine Transform

MDCT Basis Elements

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 12 / 14

MDCT: X[k] =∑2N−1

n=0 x[n] cos 2π(2n+1+N)(2k+1)8N 0 ≤ k < N

IMDCT: y[n] = 1N

∑N−1k=0 X[k] cos 2π(2n+1+N)(2k+1)

8N 0 ≤ n < 2N

Page 78: Discrete Cosine Transform

MDCT Basis Elements

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 12 / 14

MDCT: X[k] =∑2N−1

n=0 x[n] cos 2π(2n+1+N)(2k+1)8N 0 ≤ k < N

IMDCT: y[n] = 1N

∑N−1k=0 X[k] cos 2π(2n+1+N)(2k+1)

8N 0 ≤ n < 2N

In vector notation: X = Mx and y = 1NMTX = 1

NMTMx

Page 79: Discrete Cosine Transform

MDCT Basis Elements

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 12 / 14

MDCT: X[k] =∑2N−1

n=0 x[n] cos 2π(2n+1+N)(2k+1)8N 0 ≤ k < N

IMDCT: y[n] = 1N

∑N−1k=0 X[k] cos 2π(2n+1+N)(2k+1)

8N 0 ≤ n < 2N

In vector notation: X = Mx and y = 1NMTX = 1

NMTMx

The rows of M form theMDCT basis elements.

Page 80: Discrete Cosine Transform

MDCT Basis Elements

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 12 / 14

MDCT: X[k] =∑2N−1

n=0 x[n] cos 2π(2n+1+N)(2k+1)8N 0 ≤ k < N

IMDCT: y[n] = 1N

∑N−1k=0 X[k] cos 2π(2n+1+N)(2k+1)

8N 0 ≤ n < 2N

In vector notation: X = Mx and y = 1NMTX = 1

NMTMx

The rows of M form theMDCT basis elements.

Example (N = 4):

M =

0.56 0.20 −0.20 −0.56 −0.83 −0.98 −0.98 −0.83

−0.98 −0.56 0.56 0.98 0.20 −0.83 −0.83 0.20

0.20 0.83 −0.83 −0.20 0.98 −0.56 −0.56 0.98

0.83 −0.98 0.98 −0.83 0.56 −0.20 −0.20 0.56

Page 81: Discrete Cosine Transform

MDCT Basis Elements

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 12 / 14

MDCT: X[k] =∑2N−1

n=0 x[n] cos 2π(2n+1+N)(2k+1)8N 0 ≤ k < N

IMDCT: y[n] = 1N

∑N−1k=0 X[k] cos 2π(2n+1+N)(2k+1)

8N 0 ≤ n < 2N

In vector notation: X = Mx and y = 1NMTX = 1

NMTMx

The rows of M form theMDCT basis elements.

Example (N = 4):

M =

0.56 0.20 −0.20 −0.56 −0.83 −0.98 −0.98 −0.83

−0.98 −0.56 0.56 0.98 0.20 −0.83 −0.83 0.20

0.20 0.83 −0.83 −0.20 0.98 −0.56 −0.56 0.98

0.83 −0.98 0.98 −0.83 0.56 −0.20 −0.20 0.56

Page 82: Discrete Cosine Transform

MDCT Basis Elements

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 12 / 14

MDCT: X[k] =∑2N−1

n=0 x[n] cos 2π(2n+1+N)(2k+1)8N 0 ≤ k < N

IMDCT: y[n] = 1N

∑N−1k=0 X[k] cos 2π(2n+1+N)(2k+1)

8N 0 ≤ n < 2N

In vector notation: X = Mx and y = 1NMTX = 1

NMTMx

The rows of M form theMDCT basis elements.

Example (N = 4):

M =

0.56 0.20 −0.20 −0.56 −0.83 −0.98 −0.98 −0.83

−0.98 −0.56 0.56 0.98 0.20 −0.83 −0.83 0.20

0.20 0.83 −0.83 −0.20 0.98 −0.56 −0.56 0.98

0.83 −0.98 0.98 −0.83 0.56 −0.20 −0.20 0.56

The basis frequencies are {0.5, 1.5, 2.5, 3.5} times the fundamental.

Page 83: Discrete Cosine Transform

Summary

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14

DCT: Discrete Cosine Transform• Equivalent to a DFT of time-shifted double-length

[

x ←−x]

Page 84: Discrete Cosine Transform

Summary

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14

DCT: Discrete Cosine Transform• Equivalent to a DFT of time-shifted double-length

[

x ←−x]

• Often scaled to make an orthogonal transform (ODCT)

Page 85: Discrete Cosine Transform

Summary

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14

DCT: Discrete Cosine Transform• Equivalent to a DFT of time-shifted double-length

[

x ←−x]

• Often scaled to make an orthogonal transform (ODCT)• Better than DFT for energy compaction and decorrelation ,

Page 86: Discrete Cosine Transform

Summary

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14

DCT: Discrete Cosine Transform• Equivalent to a DFT of time-shifted double-length

[

x ←−x]

• Often scaled to make an orthogonal transform (ODCT)• Better than DFT for energy compaction and decorrelation ,

◦ Energy Compaction: Most energy is in only a few coefficients

Page 87: Discrete Cosine Transform

Summary

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14

DCT: Discrete Cosine Transform• Equivalent to a DFT of time-shifted double-length

[

x ←−x]

• Often scaled to make an orthogonal transform (ODCT)• Better than DFT for energy compaction and decorrelation ,

◦ Energy Compaction: Most energy is in only a few coefficients◦ Decorrelation: The coefficients are uncorrelated with each other

Page 88: Discrete Cosine Transform

Summary

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14

DCT: Discrete Cosine Transform• Equivalent to a DFT of time-shifted double-length

[

x ←−x]

• Often scaled to make an orthogonal transform (ODCT)• Better than DFT for energy compaction and decorrelation ,

◦ Energy Compaction: Most energy is in only a few coefficients◦ Decorrelation: The coefficients are uncorrelated with each other

• Nice convolution property of DFT is lost /

Page 89: Discrete Cosine Transform

Summary

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14

DCT: Discrete Cosine Transform• Equivalent to a DFT of time-shifted double-length

[

x ←−x]

• Often scaled to make an orthogonal transform (ODCT)• Better than DFT for energy compaction and decorrelation ,

◦ Energy Compaction: Most energy is in only a few coefficients◦ Decorrelation: The coefficients are uncorrelated with each other

• Nice convolution property of DFT is lost /

MDCT: Modified Discrete Cosine Transform• Lapped transform: 2N → N → 2N

Page 90: Discrete Cosine Transform

Summary

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14

DCT: Discrete Cosine Transform• Equivalent to a DFT of time-shifted double-length

[

x ←−x]

• Often scaled to make an orthogonal transform (ODCT)• Better than DFT for energy compaction and decorrelation ,

◦ Energy Compaction: Most energy is in only a few coefficients◦ Decorrelation: The coefficients are uncorrelated with each other

• Nice convolution property of DFT is lost /

MDCT: Modified Discrete Cosine Transform• Lapped transform: 2N → N → 2N• Aliasing errors cancel out when overlapping output frames are added

Page 91: Discrete Cosine Transform

Summary

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14

DCT: Discrete Cosine Transform• Equivalent to a DFT of time-shifted double-length

[

x ←−x]

• Often scaled to make an orthogonal transform (ODCT)• Better than DFT for energy compaction and decorrelation ,

◦ Energy Compaction: Most energy is in only a few coefficients◦ Decorrelation: The coefficients are uncorrelated with each other

• Nice convolution property of DFT is lost /

MDCT: Modified Discrete Cosine Transform• Lapped transform: 2N → N → 2N• Aliasing errors cancel out when overlapping output frames are added• Similar to DCT for energy compaction and decorrelation ,

Page 92: Discrete Cosine Transform

Summary

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14

DCT: Discrete Cosine Transform• Equivalent to a DFT of time-shifted double-length

[

x ←−x]

• Often scaled to make an orthogonal transform (ODCT)• Better than DFT for energy compaction and decorrelation ,

◦ Energy Compaction: Most energy is in only a few coefficients◦ Decorrelation: The coefficients are uncorrelated with each other

• Nice convolution property of DFT is lost /

MDCT: Modified Discrete Cosine Transform• Lapped transform: 2N → N → 2N• Aliasing errors cancel out when overlapping output frames are added• Similar to DCT for energy compaction and decorrelation ,

• Overlapping windowed frames can avoid edge discontinuities ,

Page 93: Discrete Cosine Transform

Summary

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14

DCT: Discrete Cosine Transform• Equivalent to a DFT of time-shifted double-length

[

x ←−x]

• Often scaled to make an orthogonal transform (ODCT)• Better than DFT for energy compaction and decorrelation ,

◦ Energy Compaction: Most energy is in only a few coefficients◦ Decorrelation: The coefficients are uncorrelated with each other

• Nice convolution property of DFT is lost /

MDCT: Modified Discrete Cosine Transform• Lapped transform: 2N → N → 2N• Aliasing errors cancel out when overlapping output frames are added• Similar to DCT for energy compaction and decorrelation ,

• Overlapping windowed frames can avoid edge discontinuities ,

• Used in audio coding: MP3, WMA, AC-3, AAC, Vorbis, ATRAC

Page 94: Discrete Cosine Transform

Summary

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 13 / 14

DCT: Discrete Cosine Transform• Equivalent to a DFT of time-shifted double-length

[

x ←−x]

• Often scaled to make an orthogonal transform (ODCT)• Better than DFT for energy compaction and decorrelation ,

◦ Energy Compaction: Most energy is in only a few coefficients◦ Decorrelation: The coefficients are uncorrelated with each other

• Nice convolution property of DFT is lost /

MDCT: Modified Discrete Cosine Transform• Lapped transform: 2N → N → 2N• Aliasing errors cancel out when overlapping output frames are added• Similar to DCT for energy compaction and decorrelation ,

• Overlapping windowed frames can avoid edge discontinuities ,

• Used in audio coding: MP3, WMA, AC-3, AAC, Vorbis, ATRAC

For further details see Mitra: 5.

Page 95: Discrete Cosine Transform

MATLAB routines

3: Discrete Cosine Transform

• DFT Problems

• DCT +

• Basis Functions

• DCT of sine wave

• DCT Properties

• Energy Conservation

• Energy Compaction

• Frame-based coding

• Lapped Transform +

• MDCT (Modified DCT)

• MDCT Basis Elements

• Summary

• MATLAB routines

DSP and Digital Filters (2017-10120) Transforms: 3 – 14 / 14

dct, idct ODCT with optional zero-padding