Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf ·...

219
Transform Coding in Practice

Transcript of Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf ·...

Page 1: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice

Page 2: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Last Lecture

Last Lectures: Basic Concept Transform Coding

Transform reduces linear dependencies (correlation) between samples before scalar quantizationFor correlated sources: Scalar quantization in transform domain is more efficient

encoder

α0

α1...

αN−1

forwardtransform

A

entropycoding

γ

u0

u1

uN−1

q0

q1

qN−1

s

decoder

β0

β1...

βN−1

entropydecoding

γ−1

inversetransform

A−1

q0

q1

qN−1

u′0

u′1

u′N−1

s ′b

Encoder (block-wise)Forward transform: u = A · sScalar quantization: qk = αk(uk)

Entropy coding: b = γ( {qk} )

Decoder (block-wise)Entropy decoding: {qk} = γ−1(b)

Inverse quantization: u′k = βk(qk)

Inverse transform: s′ = A−1 · u′

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 2 / 50

Page 3: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Last Lecture

Last Lectures: Orthogonal Block Transforms

Transform matrix has property: A−1 = AT (special case of unitary matrix: A−1 = (A∗)T)

A =

b0

b1

b2...

bN−1

A−1 = AT =

b0 b1 b2 · · · bN−1

Basis vectors bk (rows of A, columns of A−1 = AT) form an orthonormal basisGeometric interpretation: Rotation (and potential reflection) in N-dimensional signal space

Why Orthogonal Transforms ?Same MSE distortion in sample and transform space: ||u′ − u||22 = ||s′ − s||22Minimum MSE in signal space can be achieved byminimization of MSE for each individual transform coefficient

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 3 / 50

Page 4: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Last Lecture

Last Lectures: Orthogonal Block Transforms

Transform matrix has property: A−1 = AT (special case of unitary matrix: A−1 = (A∗)T)

A =

b0

b1

b2...

bN−1

A−1 = AT =

b0 b1 b2 · · · bN−1

Basis vectors bk (rows of A, columns of A−1 = AT) form an orthonormal basisGeometric interpretation: Rotation (and potential reflection) in N-dimensional signal space

Why Orthogonal Transforms ?Same MSE distortion in sample and transform space: ||u′ − u||22 = ||s′ − s||22Minimum MSE in signal space can be achieved byminimization of MSE for each individual transform coefficient

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 3 / 50

Page 5: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Last Lecture

Last Lectures: Bit Allocation and High-Rate Approximations

Bit Allocation of Transform CoefficientsOptimal bit allocation: Pareto condition

∂RkDk(Rk) = −λ = const =⇒ high rates: Dk(Rk) = const

High-Rate ApproximationHigh-rate distortion rate function for transform coding with optimal bit allocation

D(R) = ε̃2 · σ̃2 · 2−2R with ε̃2 =(∏

kε2k

)1N

, σ̃2 =(∏

kσ2k

)1N

High-rate transform coding gain GT and energy compaction measure GEC

GT =DSQ(R)

DTC (R)=ε2S · σ2

S

ε̃2 · σ̃2 , GEC =σ2S

σ̃2 =1N

∑N−1k=0 σ

2k

N

√∏N−1k=0 σ

2k

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 4 / 50

Page 6: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Last Lecture

Last Lectures: Bit Allocation and High-Rate Approximations

Bit Allocation of Transform CoefficientsOptimal bit allocation: Pareto condition

∂RkDk(Rk) = −λ = const =⇒ high rates: Dk(Rk) = const

High-Rate ApproximationHigh-rate distortion rate function for transform coding with optimal bit allocation

D(R) = ε̃2 · σ̃2 · 2−2R with ε̃2 =(∏

kε2k

)1N

, σ̃2 =(∏

kσ2k

)1N

High-rate transform coding gain GT and energy compaction measure GEC

GT =DSQ(R)

DTC (R)=ε2S · σ2

S

ε̃2 · σ̃2 , GEC =σ2S

σ̃2 =1N

∑N−1k=0 σ

2k

N

√∏N−1k=0 σ

2k

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 4 / 50

Page 7: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Last Lecture

Last Lectures: Bit Allocation and High-Rate Approximations

Bit Allocation of Transform CoefficientsOptimal bit allocation: Pareto condition

∂RkDk(Rk) = −λ = const =⇒ high rates: Dk(Rk) = const

High-Rate ApproximationHigh-rate distortion rate function for transform coding with optimal bit allocation

D(R) = ε̃2 · σ̃2 · 2−2R with ε̃2 =(∏

kε2k

)1N

, σ̃2 =(∏

kσ2k

)1N

High-rate transform coding gain GT and energy compaction measure GEC

GT =DSQ(R)

DTC (R)=ε2S · σ2

S

ε̃2 · σ̃2 , GEC =σ2S

σ̃2 =1N

∑N−1k=0 σ

2k

N

√∏N−1k=0 σ

2k

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 4 / 50

Page 8: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Last Lecture

Last Lectures: Karhunen Loève Transform (KLT)

Design criterion: Orthogonal transform A that yields uncorrelated transform coefficients

CUU = A · CSS · AT =

σ2

0 0 · · · 00 σ2

1 · · · 0...

.... . .

...0 0 · · · σ2

N−1

=⇒ CSS · bk = σ2k · bk

Eigenvector equation for all basis vectors bk (rows of transform matrix A)

Rows of KLT matrix A are the unit-norm eigenvectors of CSS

Transform coefficient variances σ2k are the eigenvalues of CSS

A =

b0

b1

...bN−1

CUU =

σ2

0 0 · · · 00 σ2

1 · · · 0...

.... . .

...0 0 · · · σ2

N−1

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 5 / 50

Page 9: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Last Lecture

Last Lectures: Karhunen Loève Transform (KLT)

Design criterion: Orthogonal transform A that yields uncorrelated transform coefficients

CUU = A · CSS · AT =

σ2

0 0 · · · 00 σ2

1 · · · 0...

.... . .

...0 0 · · · σ2

N−1

=⇒ CSS · bk = σ2k · bk

Eigenvector equation for all basis vectors bk (rows of transform matrix A)

Rows of KLT matrix A are the unit-norm eigenvectors of CSS

Transform coefficient variances σ2k are the eigenvalues of CSS

A =

b0

b1

...bN−1

CUU =

σ2

0 0 · · · 00 σ2

1 · · · 0...

.... . .

...0 0 · · · σ2

N−1

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 5 / 50

Page 10: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Last Lecture

Last Lectures: Karhunen Loève Transform (KLT)

Design criterion: Orthogonal transform A that yields uncorrelated transform coefficients

CUU = A · CSS · AT =

σ2

0 0 · · · 00 σ2

1 · · · 0...

.... . .

...0 0 · · · σ2

N−1

=⇒ CSS · bk = σ2k · bk

Eigenvector equation for all basis vectors bk (rows of transform matrix A)

Rows of KLT matrix A are the unit-norm eigenvectors of CSS

Transform coefficient variances σ2k are the eigenvalues of CSS

A =

b0

b1

...bN−1

CUU =

σ2

0 0 · · · 00 σ2

1 · · · 0...

.... . .

...0 0 · · · σ2

N−1

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 5 / 50

Page 11: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Last Lecture

Last Lectures: Maximum Energy Compaction and Optimality

High-Rate Approximation for KLT and Gauss-MarkovHigh-rate operational distortion-rate function

DN(R) = ε2 · σ2S · (1− %2)

N−1N · 2−2R

High-rate transform coding gain: Increases with transform size N

GNT = GN

EC = (1− %2)1−NN =⇒ G∞T =

11− %2

For N →∞, gap to fundamental lower bound reduces to space-filling gain (1.53 dB)

On Optimality of KLTKLT yields uncorrelated transform coefficients and maximizes energy compaction GEC

KLT is the optimal transform for stationary Gaussian sourcesOther sources: Optimal transform is hard to find (iterative algorithm)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 6 / 50

Page 12: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Last Lecture

Last Lectures: Maximum Energy Compaction and Optimality

High-Rate Approximation for KLT and Gauss-MarkovHigh-rate operational distortion-rate function

DN(R) = ε2 · σ2S · (1− %2)

N−1N · 2−2R

High-rate transform coding gain: Increases with transform size N

GNT = GN

EC = (1− %2)1−NN =⇒ G∞T =

11− %2

For N →∞, gap to fundamental lower bound reduces to space-filling gain (1.53 dB)

On Optimality of KLTKLT yields uncorrelated transform coefficients and maximizes energy compaction GEC

KLT is the optimal transform for stationary Gaussian sourcesOther sources: Optimal transform is hard to find (iterative algorithm)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 6 / 50

Page 13: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms

Transform Selection in Practice

Optimal Unitary TransformStationary Gaussian sources: KLTGeneral sources: Not straightforward to determine (typically KLT close to optimal)Signal dependent (may change due to signal instationarities)

Adaptive Transform SelectionDetermine transform in encoder, include transform specification in bitstream

Increased side information may lead to sub-optimal overall coding efficiencySimple variant: Switched transforms (e.g., in H.266/VVC)

Signal-Independent TransformsChoose transform that provides good performance for variety of signals

Not optimal, but often close to optimal for typical signalMost often used design in practice

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 7 / 50

Page 14: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms

Transform Selection in Practice

Optimal Unitary TransformStationary Gaussian sources: KLTGeneral sources: Not straightforward to determine (typically KLT close to optimal)Signal dependent (may change due to signal instationarities)

Adaptive Transform SelectionDetermine transform in encoder, include transform specification in bitstream

Increased side information may lead to sub-optimal overall coding efficiencySimple variant: Switched transforms (e.g., in H.266/VVC)

Signal-Independent TransformsChoose transform that provides good performance for variety of signals

Not optimal, but often close to optimal for typical signalMost often used design in practice

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 7 / 50

Page 15: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms

Transform Selection in Practice

Optimal Unitary TransformStationary Gaussian sources: KLTGeneral sources: Not straightforward to determine (typically KLT close to optimal)Signal dependent (may change due to signal instationarities)

Adaptive Transform SelectionDetermine transform in encoder, include transform specification in bitstreamIncreased side information may lead to sub-optimal overall coding efficiency

Simple variant: Switched transforms (e.g., in H.266/VVC)

Signal-Independent TransformsChoose transform that provides good performance for variety of signals

Not optimal, but often close to optimal for typical signalMost often used design in practice

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 7 / 50

Page 16: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms

Transform Selection in Practice

Optimal Unitary TransformStationary Gaussian sources: KLTGeneral sources: Not straightforward to determine (typically KLT close to optimal)Signal dependent (may change due to signal instationarities)

Adaptive Transform SelectionDetermine transform in encoder, include transform specification in bitstreamIncreased side information may lead to sub-optimal overall coding efficiencySimple variant: Switched transforms (e.g., in H.266/VVC)

Signal-Independent TransformsChoose transform that provides good performance for variety of signals

Not optimal, but often close to optimal for typical signalMost often used design in practice

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 7 / 50

Page 17: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms

Transform Selection in Practice

Optimal Unitary TransformStationary Gaussian sources: KLTGeneral sources: Not straightforward to determine (typically KLT close to optimal)Signal dependent (may change due to signal instationarities)

Adaptive Transform SelectionDetermine transform in encoder, include transform specification in bitstreamIncreased side information may lead to sub-optimal overall coding efficiencySimple variant: Switched transforms (e.g., in H.266/VVC)

Signal-Independent TransformsChoose transform that provides good performance for variety of signals

Not optimal, but often close to optimal for typical signalMost often used design in practice

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 7 / 50

Page 18: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms

Transform Selection in Practice

Optimal Unitary TransformStationary Gaussian sources: KLTGeneral sources: Not straightforward to determine (typically KLT close to optimal)Signal dependent (may change due to signal instationarities)

Adaptive Transform SelectionDetermine transform in encoder, include transform specification in bitstreamIncreased side information may lead to sub-optimal overall coding efficiencySimple variant: Switched transforms (e.g., in H.266/VVC)

Signal-Independent TransformsChoose transform that provides good performance for variety of signalsNot optimal, but often close to optimal for typical signalMost often used design in practice

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 7 / 50

Page 19: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Walsh-Hadamard Transform

Walsh-Hadamard Transform

For transform sizes N that are positive integer powers of 2

AN =1√2

[AN/2 AN/2AN/2 −AN/2

]with A1 =

[1].

Examples: Transform matrices for N = 2, N = 4, and N = 8

A2 =1√2

[1 11 −1

]

A4 =1√4

1 1 1 11 −1 1 −11 1 −1 −11 −1 −1 1

A8 =

1√8

1 1 1 1 1 1 1 11 −1 1 −1 1 −1 1 −11 1 −1 −1 1 1 −1 −11 −1 −1 1 1 −1 −1 11 1 1 1 −1 −1 −1 −11 −1 1 −1 −1 1 −1 11 1 −1 −1 −1 −1 1 11 −1 −1 1 −1 1 1 −1

Very simple orthogonal transform (only additions, subtractions, and final scaling)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 8 / 50

Page 20: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Walsh-Hadamard Transform

Walsh-Hadamard Transform

For transform sizes N that are positive integer powers of 2

AN =1√2

[AN/2 AN/2AN/2 −AN/2

]with A1 =

[1].

Examples: Transform matrices for N = 2, N = 4, and N = 8

A2 =1√2

[1 11 −1

]

A4 =1√4

1 1 1 11 −1 1 −11 1 −1 −11 −1 −1 1

A8 =

1√8

1 1 1 1 1 1 1 11 −1 1 −1 1 −1 1 −11 1 −1 −1 1 1 −1 −11 −1 −1 1 1 −1 −1 11 1 1 1 −1 −1 −1 −11 −1 1 −1 −1 1 −1 11 1 −1 −1 −1 −1 1 11 −1 −1 1 −1 1 1 −1

Very simple orthogonal transform (only additions, subtractions, and final scaling)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 8 / 50

Page 21: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Walsh-Hadamard Transform

Walsh-Hadamard Transform

For transform sizes N that are positive integer powers of 2

AN =1√2

[AN/2 AN/2AN/2 −AN/2

]with A1 =

[1].

Examples: Transform matrices for N = 2, N = 4, and N = 8

A2 =1√2

[1 11 −1

]

A4 =1√4

1 1 1 11 −1 1 −11 1 −1 −11 −1 −1 1

A8 =1√8

1 1 1 1 1 1 1 11 −1 1 −1 1 −1 1 −11 1 −1 −1 1 1 −1 −11 −1 −1 1 1 −1 −1 11 1 1 1 −1 −1 −1 −11 −1 1 −1 −1 1 −1 11 1 −1 −1 −1 −1 1 11 −1 −1 1 −1 1 1 −1

Very simple orthogonal transform (only additions, subtractions, and final scaling)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 8 / 50

Page 22: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Walsh-Hadamard Transform

Walsh-Hadamard Transform

For transform sizes N that are positive integer powers of 2

AN =1√2

[AN/2 AN/2AN/2 −AN/2

]with A1 =

[1].

Examples: Transform matrices for N = 2, N = 4, and N = 8

A2 =1√2

[1 11 −1

]

A4 =1√4

1 1 1 11 −1 1 −11 1 −1 −11 −1 −1 1

A8 =

1√8

1 1 1 1 1 1 1 11 −1 1 −1 1 −1 1 −11 1 −1 −1 1 1 −1 −11 −1 −1 1 1 −1 −1 11 1 1 1 −1 −1 −1 −11 −1 1 −1 −1 1 −1 11 1 −1 −1 −1 −1 1 11 −1 −1 1 −1 1 1 −1

Very simple orthogonal transform (only additions, subtractions, and final scaling)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 8 / 50

Page 23: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Walsh-Hadamard Transform

Walsh-Hadamard Transform

For transform sizes N that are positive integer powers of 2

AN =1√2

[AN/2 AN/2AN/2 −AN/2

]with A1 =

[1].

Examples: Transform matrices for N = 2, N = 4, and N = 8

A2 =1√2

[1 11 −1

]

A4 =1√4

1 1 1 11 −1 1 −11 1 −1 −11 −1 −1 1

A8 =

1√8

1 1 1 1 1 1 1 11 −1 1 −1 1 −1 1 −11 1 −1 −1 1 1 −1 −11 −1 −1 1 1 −1 −1 11 1 1 1 −1 −1 −1 −11 −1 1 −1 −1 1 −1 11 1 −1 −1 −1 −1 1 11 −1 −1 1 −1 1 1 −1

Very simple orthogonal transform (only additions, subtractions, and final scaling)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 8 / 50

Page 24: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Walsh-Hadamard Transform

Basis Functions of the WHT (Example for N = 8)

b0

b1

b2

b3

b4

b5

b6

b7

Media coding: Walsh-Hadamard transform with strong quantizationPiece-wise constant basis vectors yield subjectively disturbing artifacts

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 9 / 50

Page 25: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Walsh-Hadamard Transform

Basis Functions of the WHT (Example for N = 8)

b0

b1

b2

b3

b4

b5

b6

b7

Media coding: Walsh-Hadamard transform with strong quantizationPiece-wise constant basis vectors yield subjectively disturbing artifacts

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 9 / 50

Page 26: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

Discrete Version of the Fourier Transform

The Fourier TransformFundamental transform used in mathematics, physics, signal processing, communications, ...

Integral transform representing signal as integral of frequency componentsForward and inverse transform are given by

X (f ) = F{x(t)

}=

∞∫−∞

x(t) · e−2πift dt ⇐⇒ x(t) = F−1{x(t)}

=

∞∫−∞

X (f ) · e2πift df

Basis functions are complex exponentials bf (t) = e2πift

Discrete Version of the Fourier TransformFourier transform for finite discrete signals

Could also be useful for coding of discrete signalsCan be derived using sampling and windowing

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 10 / 50

Page 27: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

Discrete Version of the Fourier Transform

The Fourier TransformFundamental transform used in mathematics, physics, signal processing, communications, ...Integral transform representing signal as integral of frequency components

Forward and inverse transform are given by

X (f ) = F{x(t)

}=

∞∫−∞

x(t) · e−2πift dt ⇐⇒ x(t) = F−1{x(t)}

=

∞∫−∞

X (f ) · e2πift df

Basis functions are complex exponentials bf (t) = e2πift

Discrete Version of the Fourier TransformFourier transform for finite discrete signals

Could also be useful for coding of discrete signalsCan be derived using sampling and windowing

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 10 / 50

Page 28: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

Discrete Version of the Fourier Transform

The Fourier TransformFundamental transform used in mathematics, physics, signal processing, communications, ...Integral transform representing signal as integral of frequency componentsForward and inverse transform are given by

X (f ) = F{x(t)

}=

∞∫−∞

x(t) · e−2πift dt ⇐⇒ x(t) = F−1{x(t)}

=

∞∫−∞

X (f ) · e2πift df

Basis functions are complex exponentials bf (t) = e2πift

Discrete Version of the Fourier TransformFourier transform for finite discrete signals

Could also be useful for coding of discrete signalsCan be derived using sampling and windowing

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 10 / 50

Page 29: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

Discrete Version of the Fourier Transform

The Fourier TransformFundamental transform used in mathematics, physics, signal processing, communications, ...Integral transform representing signal as integral of frequency componentsForward and inverse transform are given by

X (f ) = F{x(t)

}=

∞∫−∞

x(t) · e−2πift dt ⇐⇒ x(t) = F−1{x(t)}

=

∞∫−∞

X (f ) · e2πift df

Basis functions are complex exponentials bf (t) = e2πift

Discrete Version of the Fourier TransformFourier transform for finite discrete signals

Could also be useful for coding of discrete signalsCan be derived using sampling and windowing

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 10 / 50

Page 30: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

Discrete Version of the Fourier Transform

The Fourier TransformFundamental transform used in mathematics, physics, signal processing, communications, ...Integral transform representing signal as integral of frequency componentsForward and inverse transform are given by

X (f ) = F{x(t)

}=

∞∫−∞

x(t) · e−2πift dt ⇐⇒ x(t) = F−1{x(t)}

=

∞∫−∞

X (f ) · e2πift df

Basis functions are complex exponentials bf (t) = e2πift

Discrete Version of the Fourier TransformFourier transform for finite discrete signals

Could also be useful for coding of discrete signalsCan be derived using sampling and windowing

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 10 / 50

Page 31: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

Discrete Version of the Fourier Transform

The Fourier TransformFundamental transform used in mathematics, physics, signal processing, communications, ...Integral transform representing signal as integral of frequency componentsForward and inverse transform are given by

X (f ) = F{x(t)

}=

∞∫−∞

x(t) · e−2πift dt ⇐⇒ x(t) = F−1{x(t)}

=

∞∫−∞

X (f ) · e2πift df

Basis functions are complex exponentials bf (t) = e2πift

Discrete Version of the Fourier TransformFourier transform for finite discrete signalsCould also be useful for coding of discrete signals

Can be derived using sampling and windowing

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 10 / 50

Page 32: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

Discrete Version of the Fourier Transform

The Fourier TransformFundamental transform used in mathematics, physics, signal processing, communications, ...Integral transform representing signal as integral of frequency componentsForward and inverse transform are given by

X (f ) = F{x(t)

}=

∞∫−∞

x(t) · e−2πift dt ⇐⇒ x(t) = F−1{x(t)}

=

∞∫−∞

X (f ) · e2πift df

Basis functions are complex exponentials bf (t) = e2πift

Discrete Version of the Fourier TransformFourier transform for finite discrete signalsCould also be useful for coding of discrete signalsCan be derived using sampling and windowing

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 10 / 50

Page 33: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

Important Properties of the Fourier Transform

Linearity: F{a · h(t) + b · g(t)

}= a · H(f ) + b · G (f )

Scaling: F{h(a · t)

}=

1|a|· H(f

a

)Translation: F

{h(t − t0)

}= e−2πit0f · H(f )

Modulation: F{e2πitf0 · h(t)

}= H(f − f0)

Duality: F{H(t)

}= h(−f )

Convolution: F{h(t) ∗ g(t)

}= F

{∫ ∞−∞

g(τ) h(t − τ) dτ}

= H(f ) · G (f )

Multiplication: F{h(t) · g(t)

}= H(f ) ∗ G (f )

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 11 / 50

Page 34: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

Important Properties of the Fourier Transform

Linearity: F{a · h(t) + b · g(t)

}= a · H(f ) + b · G (f )

Scaling: F{h(a · t)

}=

1|a|· H(f

a

)

Translation: F{h(t − t0)

}= e−2πit0f · H(f )

Modulation: F{e2πitf0 · h(t)

}= H(f − f0)

Duality: F{H(t)

}= h(−f )

Convolution: F{h(t) ∗ g(t)

}= F

{∫ ∞−∞

g(τ) h(t − τ) dτ}

= H(f ) · G (f )

Multiplication: F{h(t) · g(t)

}= H(f ) ∗ G (f )

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 11 / 50

Page 35: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

Important Properties of the Fourier Transform

Linearity: F{a · h(t) + b · g(t)

}= a · H(f ) + b · G (f )

Scaling: F{h(a · t)

}=

1|a|· H(f

a

)Translation: F

{h(t − t0)

}= e−2πit0f · H(f )

Modulation: F{e2πitf0 · h(t)

}= H(f − f0)

Duality: F{H(t)

}= h(−f )

Convolution: F{h(t) ∗ g(t)

}= F

{∫ ∞−∞

g(τ) h(t − τ) dτ}

= H(f ) · G (f )

Multiplication: F{h(t) · g(t)

}= H(f ) ∗ G (f )

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 11 / 50

Page 36: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

Important Properties of the Fourier Transform

Linearity: F{a · h(t) + b · g(t)

}= a · H(f ) + b · G (f )

Scaling: F{h(a · t)

}=

1|a|· H(f

a

)Translation: F

{h(t − t0)

}= e−2πit0f · H(f )

Modulation: F{e2πitf0 · h(t)

}= H(f − f0)

Duality: F{H(t)

}= h(−f )

Convolution: F{h(t) ∗ g(t)

}= F

{∫ ∞−∞

g(τ) h(t − τ) dτ}

= H(f ) · G (f )

Multiplication: F{h(t) · g(t)

}= H(f ) ∗ G (f )

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 11 / 50

Page 37: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

Important Properties of the Fourier Transform

Linearity: F{a · h(t) + b · g(t)

}= a · H(f ) + b · G (f )

Scaling: F{h(a · t)

}=

1|a|· H(f

a

)Translation: F

{h(t − t0)

}= e−2πit0f · H(f )

Modulation: F{e2πitf0 · h(t)

}= H(f − f0)

Duality: F{H(t)

}= h(−f )

Convolution: F{h(t) ∗ g(t)

}= F

{∫ ∞−∞

g(τ) h(t − τ) dτ}

= H(f ) · G (f )

Multiplication: F{h(t) · g(t)

}= H(f ) ∗ G (f )

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 11 / 50

Page 38: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

Important Properties of the Fourier Transform

Linearity: F{a · h(t) + b · g(t)

}= a · H(f ) + b · G (f )

Scaling: F{h(a · t)

}=

1|a|· H(f

a

)Translation: F

{h(t − t0)

}= e−2πit0f · H(f )

Modulation: F{e2πitf0 · h(t)

}= H(f − f0)

Duality: F{H(t)

}= h(−f )

Convolution: F{h(t) ∗ g(t)

}= F

{∫ ∞−∞

g(τ) h(t − τ) dτ}

= H(f ) · G (f )

Multiplication: F{h(t) · g(t)

}= H(f ) ∗ G (f )

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 11 / 50

Page 39: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

Important Properties of the Fourier Transform

Linearity: F{a · h(t) + b · g(t)

}= a · H(f ) + b · G (f )

Scaling: F{h(a · t)

}=

1|a|· H(f

a

)Translation: F

{h(t − t0)

}= e−2πit0f · H(f )

Modulation: F{e2πitf0 · h(t)

}= H(f − f0)

Duality: F{H(t)

}= h(−f )

Convolution: F{h(t) ∗ g(t)

}= F

{∫ ∞−∞

g(τ) h(t − τ) dτ}

= H(f ) · G (f )

Multiplication: F{h(t) · g(t)

}= H(f ) ∗ G (f )

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 11 / 50

Page 40: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

The Dirac Delta Function

Dirac Delta FunctionNot a function in traditional sense Dirac delta distributionCan be thought of function with the following properties

δ(x) =

{+∞ : x = 00 : x 6= 0 and

∞∫−∞

δ(x) dx = 1

Important Properties

Sifting:∫ ∞−∞

h(t) δ(t − t0) dt = h(t0)

Convolution: h(t) ∗ δ(t − t0) =

∫ ∞−∞

h(τ) δ(t − t0 − τ) dτ = h(t − t0)

Sampling:∫ ∞−∞

h(t)

( ∞∑k=−∞

δ(t − k · t0)

)dt =

∞∑k=−∞

h(k · t0)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 12 / 50

Page 41: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

The Dirac Delta Function

Dirac Delta FunctionNot a function in traditional sense Dirac delta distributionCan be thought of function with the following properties

δ(x) =

{+∞ : x = 00 : x 6= 0 and

∞∫−∞

δ(x) dx = 1

Important Properties

Sifting:∫ ∞−∞

h(t) δ(t − t0) dt = h(t0)

Convolution: h(t) ∗ δ(t − t0) =

∫ ∞−∞

h(τ) δ(t − t0 − τ) dτ = h(t − t0)

Sampling:∫ ∞−∞

h(t)

( ∞∑k=−∞

δ(t − k · t0)

)dt =

∞∑k=−∞

h(k · t0)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 12 / 50

Page 42: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

The Dirac Delta Function

Dirac Delta FunctionNot a function in traditional sense Dirac delta distributionCan be thought of function with the following properties

δ(x) =

{+∞ : x = 00 : x 6= 0 and

∞∫−∞

δ(x) dx = 1

Important Properties

Sifting:∫ ∞−∞

h(t) δ(t − t0) dt = h(t0)

Convolution: h(t) ∗ δ(t − t0) =

∫ ∞−∞

h(τ) δ(t − t0 − τ) dτ = h(t − t0)

Sampling:∫ ∞−∞

h(t)

( ∞∑k=−∞

δ(t − k · t0)

)dt =

∞∑k=−∞

h(k · t0)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 12 / 50

Page 43: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

The Dirac Delta Function

Dirac Delta FunctionNot a function in traditional sense Dirac delta distributionCan be thought of function with the following properties

δ(x) =

{+∞ : x = 00 : x 6= 0 and

∞∫−∞

δ(x) dx = 1

Important Properties

Sifting:∫ ∞−∞

h(t) δ(t − t0) dt = h(t0)

Convolution: h(t) ∗ δ(t − t0) =

∫ ∞−∞

h(τ) δ(t − t0 − τ) dτ = h(t − t0)

Sampling:∫ ∞−∞

h(t)

( ∞∑k=−∞

δ(t − k · t0)

)dt =

∞∑k=−∞

h(k · t0)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 12 / 50

Page 44: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

Selected Fourier Transform Pairs

x(t) = δ(t − T ) X (f ) = e−2πifT = cos(2πfT ) + i sin(2πfT )

Dirac delta function

T

t

δ(t − T ) complex exponential

f

∣∣F{δ(t − T )}∣∣

шT (t) =∞∑

k=−∞

δ(t − kT ) ШT (f ) =∞∑

k=−∞

δ(f − k/T )

Dirac comb

T

t

шT (t) Dirac comb1T

f

∣∣ШT (f )∣∣

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 13 / 50

Page 45: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

Selected Fourier Transform Pairs

x(t) = δ(t − T ) X (f ) = e−2πifT = cos(2πfT ) + i sin(2πfT )

Dirac delta function

T

t

δ(t − T ) complex exponential

f

∣∣F{δ(t − T )}∣∣

шT (t) =∞∑

k=−∞

δ(t − kT ) ШT (f ) =∞∑

k=−∞

δ(f − k/T )

Dirac comb

T

t

шT (t) Dirac comb1T

f

∣∣ШT (f )∣∣

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 13 / 50

Page 46: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

Selected Fourier Transform Pairs

x(t) = δ(t − T ) X (f ) = e−2πifT = cos(2πfT ) + i sin(2πfT )

Dirac delta function

T

t

δ(t − T ) complex exponential

f

∣∣F{δ(t − T )}∣∣

шT (t) =∞∑

k=−∞

δ(t − kT ) ШT (f ) =∞∑

k=−∞

δ(f − k/T )

Dirac comb

T

t

шT (t) Dirac comb1T

f

∣∣ШT (f )∣∣

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 13 / 50

Page 47: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

Selected Fourier Transform Pairs

x(t) = δ(t − T ) X (f ) = e−2πifT = cos(2πfT ) + i sin(2πfT )

Dirac delta function

T

t

δ(t − T ) complex exponential

f

∣∣F{δ(t − T )}∣∣

шT (t) =∞∑

k=−∞

δ(t − kT ) ШT (f ) =∞∑

k=−∞

δ(f − k/T )

Dirac comb

T

t

шT (t) Dirac comb1T

f

∣∣ШT (f )∣∣

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 13 / 50

Page 48: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

Selected Fourier Transform Pairs

rectT (t) =

{1 : |t| ≤ T/20 : |t| > T/2

F{rectT (f )

}=

1πf

sin(πfT ) = T sinc(fT )

rectangular window

T

t

rectT (t) Sinc filter

2T

f

∣∣F{rectT (f )}∣∣

g(t) = e−π·t2

with σ2t =

12π

G (f ) = e−π·f2

= g(f )

Gaussian

t

g(t) Gaussian

f

∣∣G(f )∣∣

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 14 / 50

Page 49: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

Selected Fourier Transform Pairs

rectT (t) =

{1 : |t| ≤ T/20 : |t| > T/2

F{rectT (f )

}=

1πf

sin(πfT ) = T sinc(fT )

rectangular window

T

t

rectT (t) Sinc filter

2T

f

∣∣F{rectT (f )}∣∣

g(t) = e−π·t2

with σ2t =

12π

G (f ) = e−π·f2

= g(f )

Gaussian

t

g(t) Gaussian

f

∣∣G(f )∣∣

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 14 / 50

Page 50: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

Selected Fourier Transform Pairs

rectT (t) =

{1 : |t| ≤ T/20 : |t| > T/2

F{rectT (f )

}=

1πf

sin(πfT ) = T sinc(fT )

rectangular window

T

t

rectT (t) Sinc filter

2T

f

∣∣F{rectT (f )}∣∣

g(t) = e−π·t2

with σ2t =

12π

G (f ) = e−π·f2

= g(f )

Gaussian

t

g(t) Gaussian

f

∣∣G(f )∣∣

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 14 / 50

Page 51: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Fourier Transform

Selected Fourier Transform Pairs

rectT (t) =

{1 : |t| ≤ T/20 : |t| > T/2

F{rectT (f )

}=

1πf

sin(πfT ) = T sinc(fT )

rectangular window

T

t

rectT (t) Sinc filter

2T

f

∣∣F{rectT (f )}∣∣

g(t) = e−π·t2

with σ2t =

12π

G (f ) = e−π·f2

= g(f )

Gaussian

t

g(t) Gaussian

f

∣∣G(f )∣∣

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 14 / 50

Page 52: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Derivation of Discrete Fourier Transform: (1) Sampling of Signal

continuous signal

t

s(t) Fourier transform

f

∣∣S(f )∣∣

Dirac comb

t

ш0(t) Dirac comb

f

∣∣Ш0(f )∣∣

sampled signal

t

s(t) ш0(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∣∣

× (multiplication) ∗ (convolution)

= =

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 15 / 50

Page 53: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Derivation of Discrete Fourier Transform: (1) Sampling of Signal

continuous signal

t

s(t) Fourier transform

f

∣∣S(f )∣∣

Dirac comb

t

ш0(t) Dirac comb

f

∣∣Ш0(f )∣∣

sampled signal

t

s(t) ш0(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∣∣

× (multiplication) ∗ (convolution)

= =

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 15 / 50

Page 54: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Derivation of Discrete Fourier Transform: (1) Sampling of Signal

continuous signal

t

s(t) Fourier transform

f

∣∣S(f )∣∣

Dirac comb

t

ш0(t) Dirac comb

f

∣∣Ш0(f )∣∣

sampled signal

t

s(t) ш0(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∣∣

× (multiplication) ∗ (convolution)

= =

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 15 / 50

Page 55: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Derivation of Discrete Fourier Transform: (1) Sampling of Signal

continuous signal

t

s(t) Fourier transform

f

∣∣S(f )∣∣

Dirac comb

t

ш0(t) Dirac comb

f

∣∣Ш0(f )∣∣

sampled signal

t

s(t) ш0(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∣∣

× (multiplication) ∗ (convolution)

= =

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 15 / 50

Page 56: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Derivation of Discrete Fourier Transform: (1) Sampling of Signal

continuous signal

t

s(t) Fourier transform

f

∣∣S(f )∣∣

Dirac comb

t

ш0(t) Dirac comb

f

∣∣Ш0(f )∣∣

sampled signal

t

s(t) ш0(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∣∣

× (multiplication) ∗ (convolution)

= =

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 15 / 50

Page 57: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Derivation of Discrete Fourier Transform: (1) Sampling of Signal

continuous signal

t

s(t) Fourier transform

f

∣∣S(f )∣∣

Dirac comb

t

ш0(t) Dirac comb

f

∣∣Ш0(f )∣∣

sampled signal

t

s(t) ш0(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∣∣

× (multiplication) ∗ (convolution)

= =

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 15 / 50

Page 58: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Derivation of Discrete Fourier Transform: (1) Sampling of Signal

continuous signal

t

s(t) Fourier transform

f

∣∣S(f )∣∣

Dirac comb

t

ш0(t) Dirac comb

f

∣∣Ш0(f )∣∣

sampled signal

t

s(t) ш0(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∣∣

× (multiplication) ∗ (convolution)

= =

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 15 / 50

Page 59: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Derivation of Discrete Fourier Transform: (2) Time Restriction

sampled signal

t

s(t) ш0(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∣∣

rectangular window

t

r(t) Sinc filter

f

∣∣R(f )∣∣

finite sampled signal

t

s(t)ш0(t) r(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∗R(f )∣∣

× (multiplication) ∗ (convolution)

= =

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 16 / 50

Page 60: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Derivation of Discrete Fourier Transform: (2) Time Restriction

sampled signal

t

s(t) ш0(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∣∣

rectangular window

t

r(t) Sinc filter

f

∣∣R(f )∣∣

finite sampled signal

t

s(t)ш0(t) r(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∗R(f )∣∣

× (multiplication) ∗ (convolution)

= =

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 16 / 50

Page 61: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Derivation of Discrete Fourier Transform: (2) Time Restriction

sampled signal

t

s(t) ш0(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∣∣

rectangular window

t

r(t) Sinc filter

f

∣∣R(f )∣∣

finite sampled signal

t

s(t)ш0(t) r(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∗R(f )∣∣

× (multiplication) ∗ (convolution)

= =

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 16 / 50

Page 62: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Derivation of Discrete Fourier Transform: (2) Time Restriction

sampled signal

t

s(t) ш0(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∣∣

rectangular window

t

r(t) Sinc filter

f

∣∣R(f )∣∣

finite sampled signal

t

s(t)ш0(t) r(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∗R(f )∣∣

× (multiplication) ∗ (convolution)

= =

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 16 / 50

Page 63: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Derivation of Discrete Fourier Transform: (2) Time Restriction

sampled signal

t

s(t) ш0(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∣∣

rectangular window

t

r(t) Sinc filter

f

∣∣R(f )∣∣

finite sampled signal

t

s(t)ш0(t) r(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∗R(f )∣∣

× (multiplication) ∗ (convolution)

= =

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 16 / 50

Page 64: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Derivation of Discrete Fourier Transform: (2) Time Restriction

sampled signal

t

s(t) ш0(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∣∣

rectangular window

t

r(t) Sinc filter

f

∣∣R(f )∣∣

finite sampled signal

t

s(t)ш0(t) r(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∗R(f )∣∣

× (multiplication) ∗ (convolution)

= =

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 16 / 50

Page 65: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Derivation of Discrete Fourier Transform: (3) Sampling of Spectrum

finite sampled signal

t

s(t)ш0(t) r(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∗R(f )∣∣

Dirac comb

t

ш1(t) Dirac comb

f

∣∣Ш1(f )∣∣

periodic sampled signal

t

[s(t)ш0(t) r(t)

]∗ш1(t) Fourier transform

f

∣∣[S(f )∗Ш0(f )∗R(f )]Ш1(f )∣∣

∗ (convolution) × (multiplication)

= =

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 17 / 50

Page 66: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Derivation of Discrete Fourier Transform: (3) Sampling of Spectrum

finite sampled signal

t

s(t)ш0(t) r(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∗R(f )∣∣

Dirac comb

t

ш1(t) Dirac comb

f

∣∣Ш1(f )∣∣

periodic sampled signal

t

[s(t)ш0(t) r(t)

]∗ш1(t) Fourier transform

f

∣∣[S(f )∗Ш0(f )∗R(f )]Ш1(f )∣∣

∗ (convolution) × (multiplication)

= =

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 17 / 50

Page 67: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Derivation of Discrete Fourier Transform: (3) Sampling of Spectrum

finite sampled signal

t

s(t)ш0(t) r(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∗R(f )∣∣

Dirac comb

t

ш1(t) Dirac comb

f

∣∣Ш1(f )∣∣

periodic sampled signal

t

[s(t)ш0(t) r(t)

]∗ш1(t) Fourier transform

f

∣∣[S(f )∗Ш0(f )∗R(f )]Ш1(f )∣∣

∗ (convolution) × (multiplication)

= =

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 17 / 50

Page 68: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Derivation of Discrete Fourier Transform: (3) Sampling of Spectrum

finite sampled signal

t

s(t)ш0(t) r(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∗R(f )∣∣

Dirac comb

t

ш1(t) Dirac comb

f

∣∣Ш1(f )∣∣

periodic sampled signal

t

[s(t)ш0(t) r(t)

]∗ш1(t) Fourier transform

f

∣∣[S(f )∗Ш0(f )∗R(f )]Ш1(f )∣∣

∗ (convolution) × (multiplication)

= =

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 17 / 50

Page 69: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Derivation of Discrete Fourier Transform: (3) Sampling of Spectrum

finite sampled signal

t

s(t)ш0(t) r(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∗R(f )∣∣

Dirac comb

t

ш1(t) Dirac comb

f

∣∣Ш1(f )∣∣

periodic sampled signal

t

[s(t)ш0(t) r(t)

]∗ш1(t) Fourier transform

f

∣∣[S(f )∗Ш0(f )∗R(f )]Ш1(f )∣∣

∗ (convolution) × (multiplication)

= =

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 17 / 50

Page 70: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Derivation of Discrete Fourier Transform: (3) Sampling of Spectrum

finite sampled signal

t

s(t)ш0(t) r(t) Fourier transform

f

∣∣S(f )∗Ш0(f )∗R(f )∣∣

Dirac comb

t

ш1(t) Dirac comb

f

∣∣Ш1(f )∣∣

periodic sampled signal

t

[s(t)ш0(t) r(t)

]∗ш1(t) Fourier transform

f

∣∣[S(f )∗Ш0(f )∗R(f )]Ш1(f )∣∣

∗ (convolution) × (multiplication)

= =

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 17 / 50

Page 71: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

The Discrete Fourier Transform

periodic sampled signal

t

sper(t) Fourier transform

f

∣∣Sper(f )∣∣

N samples are represented by N complex Fourier coefficients

Discrete Fourier TransformForward and inverse transform are given by

u[k] =1√N

N−1∑n=0

s[n] · e−i 2πknN and s[n] =

1√N

N−1∑k=0

u[k] · ei 2πknN

Unitary transform that produces complex transform coefficientsBasis vectors are sampled complex exponentials

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 18 / 50

Page 72: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

The Discrete Fourier Transform

periodic sampled signal

t

sper(t) Fourier transform

f

∣∣Sper(f )∣∣

N samples are represented by N complex Fourier coefficients

Discrete Fourier TransformForward and inverse transform are given by

u[k] =1√N

N−1∑n=0

s[n] · e−i 2πknN and s[n] =

1√N

N−1∑k=0

u[k] · ei 2πknN

Unitary transform that produces complex transform coefficientsBasis vectors are sampled complex exponentials

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 18 / 50

Page 73: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

The Discrete Fourier Transform

periodic sampled signal

t

sper(t) Fourier transform

f

∣∣Sper(f )∣∣

N samples are represented by N complex Fourier coefficients

Discrete Fourier TransformForward and inverse transform are given by

u[k] =1√N

N−1∑n=0

s[n] · e−i 2πknN and s[n] =

1√N

N−1∑k=0

u[k] · ei 2πknN

Unitary transform that produces complex transform coefficientsBasis vectors are sampled complex exponentials

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 18 / 50

Page 74: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

The Discrete Fourier Transform

periodic sampled signal

t

sper(t) Fourier transform

f

∣∣Sper(f )∣∣

N samples are represented by N complex Fourier coefficients

Discrete Fourier TransformForward and inverse transform are given by

u[k] =1√N

N−1∑n=0

s[n] · e−i 2πknN and s[n] =

1√N

N−1∑k=0

u[k] · ei 2πknN

Unitary transform that produces complex transform coefficientsBasis vectors are sampled complex exponentials

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 18 / 50

Page 75: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

The Discrete Fourier Transform

periodic sampled signal

t

sper(t) Fourier transform

f

∣∣Sper(f )∣∣

N samples are represented by N complex Fourier coefficients

Discrete Fourier TransformForward and inverse transform are given by

u[k] =1√N

N−1∑n=0

s[n] · e−i 2πknN and s[n] =

1√N

N−1∑k=0

u[k] · ei 2πknN

Unitary transform that produces complex transform coefficients

Basis vectors are sampled complex exponentials

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 18 / 50

Page 76: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

The Discrete Fourier Transform

periodic sampled signal

t

sper(t) Fourier transform

f

∣∣Sper(f )∣∣

N samples are represented by N complex Fourier coefficients

Discrete Fourier TransformForward and inverse transform are given by

u[k] =1√N

N−1∑n=0

s[n] · e−i 2πknN and s[n] =

1√N

N−1∑k=0

u[k] · ei 2πknN

Unitary transform that produces complex transform coefficientsBasis vectors are sampled complex exponentials

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 18 / 50

Page 77: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Complex Basis Functions of the DFT (Example for N = 8)

bk [n] =1√N

ei 2πkN

n

=1√N

cos

(2πkN

n

)+ i · 1√

Nsin

(2πkN

n

)= rk [n] + i · ik [n]

r0 i0

=(b0) = 0

r1 i1

r2 i2

r3 i3

r4 i4

=(b4) = 0

r5 i5b5 = b3

r6 i6b6 = b2

r7 i7b7 = b1

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 19 / 50

Page 78: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Complex Basis Functions of the DFT (Example for N = 8)

bk [n] =1√N

ei 2πkN

n =1√N

cos

(2πkN

n

)+ i · 1√

Nsin

(2πkN

n

)

= rk [n] + i · ik [n]

r0 i0

=(b0) = 0

r1 i1

r2 i2

r3 i3

r4 i4

=(b4) = 0

r5 i5b5 = b3

r6 i6b6 = b2

r7 i7b7 = b1

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 19 / 50

Page 79: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Complex Basis Functions of the DFT (Example for N = 8)

bk [n] =1√N

ei 2πkN

n =1√N

cos

(2πkN

n

)+ i · 1√

Nsin

(2πkN

n

)= rk [n] + i · ik [n]

r0 i0

=(b0) = 0

r1 i1

r2 i2

r3 i3

r4 i4

=(b4) = 0

r5 i5b5 = b3

r6 i6b6 = b2

r7 i7b7 = b1

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 19 / 50

Page 80: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Complex Basis Functions of the DFT (Example for N = 8)

bk [n] =1√N

ei 2πkN

n =1√N

cos

(2πkN

n

)+ i · 1√

Nsin

(2πkN

n

)= rk [n] + i · ik [n]

r0 i0

=(b0) = 0

r1 i1

r2 i2

r3 i3

r4 i4

=(b4) = 0

r5 i5b5 = b3

r6 i6b6 = b2

r7 i7b7 = b1

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 19 / 50

Page 81: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Complex Basis Functions of the DFT (Example for N = 8)

bk [n] =1√N

ei 2πkN

n =1√N

cos

(2πkN

n

)+ i · 1√

Nsin

(2πkN

n

)= rk [n] + i · ik [n]

r0 i0

=(b0) = 0

r1 i1

r2 i2

r3 i3

r4 i4

=(b4) = 0

r5 i5b5 = b3

r6 i6b6 = b2

r7 i7b7 = b1

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 19 / 50

Page 82: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Complex Basis Functions of the DFT (Example for N = 8)

bk [n] =1√N

ei 2πkN

n =1√N

cos

(2πkN

n

)+ i · 1√

Nsin

(2πkN

n

)= rk [n] + i · ik [n]

r0 i0

=(b0) = 0

r1 i1

r2 i2

r3 i3

r4 i4

=(b4) = 0

r5 i5b5 = b3

r6 i6b6 = b2

r7 i7b7 = b1

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 19 / 50

Page 83: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Complex Basis Functions of the DFT (Example for N = 8)

bk [n] =1√N

ei 2πkN

n =1√N

cos

(2πkN

n

)+ i · 1√

Nsin

(2πkN

n

)= rk [n] + i · ik [n]

r0 i0

=(b0) = 0

r1 i1

r2 i2

r3 i3

r4 i4

=(b4) = 0

r5 i5b5 = b3

r6 i6b6 = b2

r7 i7b7 = b1

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 19 / 50

Page 84: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Complex Basis Functions of the DFT (Example for N = 8)

bk [n] =1√N

ei 2πkN

n =1√N

cos

(2πkN

n

)+ i · 1√

Nsin

(2πkN

n

)= rk [n] + i · ik [n]

r0 i0

=(b0) = 0

r1 i1

r2 i2

r3 i3

r4 i4

=(b4) = 0

r5 i5b5 = b3

r6 i6b6 = b2

r7 i7b7 = b1

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 19 / 50

Page 85: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Complex Basis Functions of the DFT (Example for N = 8)

bk [n] =1√N

ei 2πkN

n =1√N

cos

(2πkN

n

)+ i · 1√

Nsin

(2πkN

n

)= rk [n] + i · ik [n]

r0 i0

=(b0) = 0

r1 i1

r2 i2

r3 i3

r4 i4

=(b4) = 0

r5 i5b5 = b3

r6 i6b6 = b2

r7 i7b7 = b1

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 19 / 50

Page 86: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Complex Basis Functions of the DFT (Example for N = 8)

bk [n] =1√N

ei 2πkN

n =1√N

cos

(2πkN

n

)+ i · 1√

Nsin

(2πkN

n

)= rk [n] + i · ik [n]

r0 i0

=(b0) = 0

r1 i1

r2 i2

r3 i3

r4 i4

=(b4) = 0

r5 i5b5 = b3

r6 i6b6 = b2

r7 i7b7 = b1

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 19 / 50

Page 87: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Complex Basis Functions of the DFT (Example for N = 8)

bk [n] =1√N

ei 2πkN

n =1√N

cos

(2πkN

n

)+ i · 1√

Nsin

(2πkN

n

)= rk [n] + i · ik [n]

r0 i0

=(b0) = 0

r1 i1

r2 i2

r3 i3

r4 i4

=(b4) = 0

r5 i5b5 = b3

r6 i6b6 = b2

r7 i7b7 = b1

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 19 / 50

Page 88: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Complex Basis Functions of the DFT (Example for N = 8)

bk [n] =1√N

ei 2πkN

n =1√N

cos

(2πkN

n

)+ i · 1√

Nsin

(2πkN

n

)= rk [n] + i · ik [n]

r0 i0

=(b0) = 0

r1 i1

r2 i2

r3 i3

r4 i4

=(b4) = 0

r5 i5b5 = b3

r6 i6b6 = b2

r7 i7b7 = b1

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 19 / 50

Page 89: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Complex Basis Functions of the DFT (Example for N = 8)

bk [n] =1√N

ei 2πkN

n =1√N

cos

(2πkN

n

)+ i · 1√

Nsin

(2πkN

n

)= rk [n] + i · ik [n]

r0 r4

r1 i1

r2 i2

r3 i3

DFT for Real SignalsSymmetry of complex coefficients

u[k] = u∗[N − k]

Vanishing imaginary parts

k ∈{0, N2

}: =

{u[k]

}= 0

N real samples are mapped toN real coefficients

Fast algorithm:Fast Fourier transform (FFT)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 20 / 50

Page 90: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Complex Basis Functions of the DFT (Example for N = 8)

bk [n] =1√N

ei 2πkN

n =1√N

cos

(2πkN

n

)+ i · 1√

Nsin

(2πkN

n

)= rk [n] + i · ik [n]

r0 r4

r1 i1

r2 i2

r3 i3

DFT for Real SignalsSymmetry of complex coefficients

u[k] = u∗[N − k]

Vanishing imaginary parts

k ∈{0, N2

}: =

{u[k]

}= 0

N real samples are mapped toN real coefficients

Fast algorithm:Fast Fourier transform (FFT)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 20 / 50

Page 91: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Complex Basis Functions of the DFT (Example for N = 8)

bk [n] =1√N

ei 2πkN

n =1√N

cos

(2πkN

n

)+ i · 1√

Nsin

(2πkN

n

)= rk [n] + i · ik [n]

r0 r4

r1 i1

r2 i2

r3 i3

DFT for Real SignalsSymmetry of complex coefficients

u[k] = u∗[N − k]

Vanishing imaginary parts

k ∈{0, N2

}: =

{u[k]

}= 0

N real samples are mapped toN real coefficients

Fast algorithm:Fast Fourier transform (FFT)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 20 / 50

Page 92: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Disadvantage of DFT for Transform Coding

discrete signal

t

sper(t)

N samples

transform coefficients

f

∣∣Sper(f )∣∣

N coefficients

Sampling of frequency spectrum causes implicit periodic signal extension

Often: Large differences between left and right signal boundary

Large difference reduces rate of convergence of Fourier series

Strong quantization yields significant high-frequency artefacts

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 21 / 50

Page 93: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Disadvantage of DFT for Transform Coding

discrete signal

t

sper(t)

N samples

transform coefficients

f

∣∣Sper(f )∣∣

N coefficients

Sampling of frequency spectrum causes implicit periodic signal extension

Often: Large differences between left and right signal boundary

Large difference reduces rate of convergence of Fourier series

Strong quantization yields significant high-frequency artefacts

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 21 / 50

Page 94: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Disadvantage of DFT for Transform Coding

discrete signal

t

sper(t)

N samples

transform coefficients

f

∣∣Sper(f )∣∣

N coefficients

Sampling of frequency spectrum causes implicit periodic signal extension

Often: Large differences between left and right signal boundary

Large difference reduces rate of convergence of Fourier series

Strong quantization yields significant high-frequency artefacts

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 21 / 50

Page 95: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Fourier Transform

Disadvantage of DFT for Transform Coding

discrete signal

t

sper(t)

N samples

transform coefficients

f

∣∣Sper(f )∣∣

N coefficients

Sampling of frequency spectrum causes implicit periodic signal extension

Often: Large differences between left and right signal boundary

Large difference reduces rate of convergence of Fourier series

Strong quantization yields significant high-frequency artefacts

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 21 / 50

Page 96: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Trigonometric Transforms

Overcome DFT Disadvantage: Discrete Cosine Transform

signal

DFT:

implicit signal replicaimplicit signal replica

signal

DCT:

mirrored signal

DFT

implicit signal replicaimplicit signal replica

Idea of Discrete Cosine Transform (DCT)Introduce mirror symmetry (different possibilities)

Apply DFT of approximately double size (or four times the size)No discontinuities in periodic signal extensionEnsure symmetry around zero: Only cosine terms

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 22 / 50

Page 97: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Trigonometric Transforms

Overcome DFT Disadvantage: Discrete Cosine Transform

signal

DFT:

implicit signal replicaimplicit signal replica

signal

DCT:

mirrored signal

DFT

implicit signal replicaimplicit signal replica

Idea of Discrete Cosine Transform (DCT)Introduce mirror symmetry (different possibilities)

Apply DFT of approximately double size (or four times the size)No discontinuities in periodic signal extensionEnsure symmetry around zero: Only cosine terms

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 22 / 50

Page 98: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Trigonometric Transforms

Overcome DFT Disadvantage: Discrete Cosine Transform

signal

DFT:

implicit signal replicaimplicit signal replica

signal

DCT:

mirrored signal

DFT

implicit signal replicaimplicit signal replica

Idea of Discrete Cosine Transform (DCT)Introduce mirror symmetry (different possibilities)

Apply DFT of approximately double size (or four times the size)No discontinuities in periodic signal extensionEnsure symmetry around zero: Only cosine terms

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 22 / 50

Page 99: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Trigonometric Transforms

Overcome DFT Disadvantage: Discrete Cosine Transform

signal

DFT:

implicit signal replicaimplicit signal replica

signal

DCT:

mirrored signal

DFT

implicit signal replicaimplicit signal replica

Idea of Discrete Cosine Transform (DCT)Introduce mirror symmetry (different possibilities)

Apply DFT of approximately double size (or four times the size)No discontinuities in periodic signal extensionEnsure symmetry around zero: Only cosine terms

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 22 / 50

Page 100: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Trigonometric Transforms

Overcome DFT Disadvantage: Discrete Cosine Transform

signal

DFT:

implicit signal replicaimplicit signal replica

signal

DCT:

mirrored signal

DFT

implicit signal replicaimplicit signal replica

Idea of Discrete Cosine Transform (DCT)Introduce mirror symmetry (different possibilities)Apply DFT of approximately double size (or four times the size)

No discontinuities in periodic signal extensionEnsure symmetry around zero: Only cosine terms

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 22 / 50

Page 101: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Trigonometric Transforms

Overcome DFT Disadvantage: Discrete Cosine Transform

signal

DFT:

implicit signal replicaimplicit signal replica

signal

DCT:

mirrored signal

DFT

implicit signal replicaimplicit signal replica

Idea of Discrete Cosine Transform (DCT)Introduce mirror symmetry (different possibilities)Apply DFT of approximately double size (or four times the size)No discontinuities in periodic signal extension

Ensure symmetry around zero: Only cosine terms

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 22 / 50

Page 102: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Trigonometric Transforms

Overcome DFT Disadvantage: Discrete Cosine Transform

signal

DFT:

implicit signal replicaimplicit signal replica

signal

DCT:

mirrored signal

DFT

implicit signal replicaimplicit signal replica

Idea of Discrete Cosine Transform (DCT)Introduce mirror symmetry (different possibilities)Apply DFT of approximately double size (or four times the size)No discontinuities in periodic signal extensionEnsure symmetry around zero: Only cosine terms

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 22 / 50

Page 103: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Trigonometric Transforms

Discrete Trigonometric Transforms (DTTs)

Discrete Cosine Transforms (DCTs)Introduce mirror symmetry around zero and apply DFT of larger size

Imaginary sine terms get eliminatedOnly cosine terms remain

8 possibilities: DCT-I to DCT-VIII2 cases for left side: Whole sample or half-sample symmetry4 cases for right side: Whole sample or half-sample symmetry or anti-symmetry

Most relevant case: DCT-II (half-sample symmetry at both sides)

Discrete Sine Transforms (DSTs)

Introduce anti-symmetry around zero and apply DFT of larger size

Real cosine terms get eliminatedOnly imaginary sine terms remain

Similarly as for DCT: 8 possibilities (DST-I to DST-VIII)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 23 / 50

Page 104: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Trigonometric Transforms

Discrete Trigonometric Transforms (DTTs)

Discrete Cosine Transforms (DCTs)Introduce mirror symmetry around zero and apply DFT of larger size

Imaginary sine terms get eliminatedOnly cosine terms remain

8 possibilities: DCT-I to DCT-VIII2 cases for left side: Whole sample or half-sample symmetry4 cases for right side: Whole sample or half-sample symmetry or anti-symmetry

Most relevant case: DCT-II (half-sample symmetry at both sides)

Discrete Sine Transforms (DSTs)

Introduce anti-symmetry around zero and apply DFT of larger size

Real cosine terms get eliminatedOnly imaginary sine terms remain

Similarly as for DCT: 8 possibilities (DST-I to DST-VIII)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 23 / 50

Page 105: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Trigonometric Transforms

Discrete Trigonometric Transforms (DTTs)

Discrete Cosine Transforms (DCTs)Introduce mirror symmetry around zero and apply DFT of larger size

Imaginary sine terms get eliminatedOnly cosine terms remain

8 possibilities: DCT-I to DCT-VIII2 cases for left side: Whole sample or half-sample symmetry4 cases for right side: Whole sample or half-sample symmetry or anti-symmetry

Most relevant case: DCT-II (half-sample symmetry at both sides)

Discrete Sine Transforms (DSTs)

Introduce anti-symmetry around zero and apply DFT of larger size

Real cosine terms get eliminatedOnly imaginary sine terms remain

Similarly as for DCT: 8 possibilities (DST-I to DST-VIII)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 23 / 50

Page 106: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Trigonometric Transforms

Discrete Trigonometric Transforms (DTTs)

Discrete Cosine Transforms (DCTs)Introduce mirror symmetry around zero and apply DFT of larger size

Imaginary sine terms get eliminatedOnly cosine terms remain

8 possibilities: DCT-I to DCT-VIII2 cases for left side: Whole sample or half-sample symmetry4 cases for right side: Whole sample or half-sample symmetry or anti-symmetry

Most relevant case: DCT-II (half-sample symmetry at both sides)

Discrete Sine Transforms (DSTs)

Introduce anti-symmetry around zero and apply DFT of larger size

Real cosine terms get eliminatedOnly imaginary sine terms remain

Similarly as for DCT: 8 possibilities (DST-I to DST-VIII)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 23 / 50

Page 107: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Trigonometric Transforms

Discrete Trigonometric Transforms (DTTs)

Discrete Cosine Transforms (DCTs)Introduce mirror symmetry around zero and apply DFT of larger size

Imaginary sine terms get eliminatedOnly cosine terms remain

8 possibilities: DCT-I to DCT-VIII2 cases for left side: Whole sample or half-sample symmetry4 cases for right side: Whole sample or half-sample symmetry or anti-symmetry

Most relevant case: DCT-II (half-sample symmetry at both sides)

Discrete Sine Transforms (DSTs)Introduce anti-symmetry around zero and apply DFT of larger size

Real cosine terms get eliminatedOnly imaginary sine terms remain

Similarly as for DCT: 8 possibilities (DST-I to DST-VIII)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 23 / 50

Page 108: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Trigonometric Transforms

Discrete Trigonometric Transforms (DTTs)

Discrete Cosine Transforms (DCTs)Introduce mirror symmetry around zero and apply DFT of larger size

Imaginary sine terms get eliminatedOnly cosine terms remain

8 possibilities: DCT-I to DCT-VIII2 cases for left side: Whole sample or half-sample symmetry4 cases for right side: Whole sample or half-sample symmetry or anti-symmetry

Most relevant case: DCT-II (half-sample symmetry at both sides)

Discrete Sine Transforms (DSTs)Introduce anti-symmetry around zero and apply DFT of larger size

Real cosine terms get eliminatedOnly imaginary sine terms remain

Similarly as for DCT: 8 possibilities (DST-I to DST-VIII)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 23 / 50

Page 109: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Trigonometric Transforms

The Discrete Cosine Transform (DCT) Family

DCT-I DFT of size 2N − 2

DCT-II DFT of size 2N

DCT-III DFT of size 4N

DCT-IV DFT of size 4N

DCT-V DFT of size 2N − 1

DCT-VI DFT of size 2N − 1

DCT-VII DFT of size 4N − 2

DCT-VIII DFT of size 4N + 2

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 24 / 50

Page 110: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Trigonometric Transforms

The Discrete Sine Transform (DST) FamilyDST-I DFT of size 2N + 2

DST-II DFT of size 2N

DST-III DFT of size 4N

DST-IV DFT of size 4N

DST-V DFT of size 2N + 1

DST-VI DFT of size 2N + 1

DST-VII DFT of size 4N + 2

DST-VIII DFT of size 4N − 2

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 25 / 50

Page 111: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Derivation of the Discrete Cosine Transform of Type II (DCT-II)

signal mirrored signal implicit signal replicaimplicit signal replica

DFT

Signal for applying the DFTGiven: Discrete signal s[n] of size N (i.e., 0 ≤ n < N)

Mirror signal with sample repetition at both sides (size 2N)

sm[n] =

{s[n] : 0 ≤ n < N

s[2N − n − 1] : N ≤ n < 2N

Ensure symmetry around zero by adding half-sample shift

s+[n] = sm[n − 1/2] =

{s[n − 1/2] : 0 ≤ n < N

s[2N − n − 3/2] : N ≤ n < 2N

Apply DFT of size 2N to new signal s+[n]

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 26 / 50

Page 112: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Derivation of the Discrete Cosine Transform of Type II (DCT-II)

signal mirrored signal implicit signal replicaimplicit signal replica

DFT

Signal for applying the DFTGiven: Discrete signal s[n] of size N (i.e., 0 ≤ n < N)Mirror signal with sample repetition at both sides (size 2N)

sm[n] =

{s[n] : 0 ≤ n < N

s[2N − n − 1] : N ≤ n < 2N

Ensure symmetry around zero by adding half-sample shift

s+[n] = sm[n − 1/2] =

{s[n − 1/2] : 0 ≤ n < N

s[2N − n − 3/2] : N ≤ n < 2N

Apply DFT of size 2N to new signal s+[n]

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 26 / 50

Page 113: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Derivation of the Discrete Cosine Transform of Type II (DCT-II)

signal mirrored signal implicit signal replicaimplicit signal replica

DFT

Signal for applying the DFTGiven: Discrete signal s[n] of size N (i.e., 0 ≤ n < N)Mirror signal with sample repetition at both sides (size 2N)

sm[n] =

{s[n] : 0 ≤ n < N

s[2N − n − 1] : N ≤ n < 2N

Ensure symmetry around zero by adding half-sample shift

s+[n] = sm[n − 1/2] =

{s[n − 1/2] : 0 ≤ n < N

s[2N − n − 3/2] : N ≤ n < 2N

Apply DFT of size 2N to new signal s+[n]

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 26 / 50

Page 114: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Derivation of the Discrete Cosine Transform of Type II (DCT-II)

signal mirrored signal implicit signal replicaimplicit signal replica

DFT

Signal for applying the DFTGiven: Discrete signal s[n] of size N (i.e., 0 ≤ n < N)Mirror signal with sample repetition at both sides (size 2N)

sm[n] =

{s[n] : 0 ≤ n < N

s[2N − n − 1] : N ≤ n < 2N

Ensure symmetry around zero by adding half-sample shift

s+[n] = sm[n − 1/2] =

{s[n − 1/2] : 0 ≤ n < N

s[2N − n − 3/2] : N ≤ n < 2N

Apply DFT of size 2N to new signal s+[n]

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 26 / 50

Page 115: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Derivation of the Discrete Cosine Transform of Type II (DCT-II)

signal mirrored signal implicit signal replicaimplicit signal replica

DFT

Signal for applying the DFTGiven: Discrete signal s[n] of size N (i.e., 0 ≤ n < N)Mirror signal with sample repetition at both sides (size 2N)

sm[n] =

{s[n] : 0 ≤ n < N

s[2N − n − 1] : N ≤ n < 2N

Ensure symmetry around zero by adding half-sample shift

s+[n] = sm[n − 1/2] =

{s[n − 1/2] : 0 ≤ n < N

s[2N − n − 3/2] : N ≤ n < 2N

Apply DFT of size 2N to new signal s+[n]

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 26 / 50

Page 116: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Derivation of the Discrete Cosine Transform of Type II (DCT-II)

s+[n] =

{s[n − 1/2] : 0 ≤ n < N

s[2N − n − 3/2] : N ≤ n < 2N

DFT of size 2N : u+[k] =1√

(2N)

(2N)−1∑n=0

s+[n] · e−i 2πkn(2N)

(s+ only known at half-samplepositions → use m = n − 1/2

)

=1√2N

2N−1∑m=0

s+[m +

12

]· e−iπk

N (m+ 12 )

=1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +2N−1∑m=N

s[2N −m − 1] · e−iπkN (m+ 1

2 )

)yn=2N−m−1

=1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +N−1∑n=0

s[n] · e−iπkN (2N−n− 1

2 )

)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 27 / 50

Page 117: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Derivation of the Discrete Cosine Transform of Type II (DCT-II)

s+[n] =

{s[n − 1/2] : 0 ≤ n < N

s[2N − n − 3/2] : N ≤ n < 2N

DFT of size 2N : u+[k] =1√

(2N)

(2N)−1∑n=0

s+[n] · e−i 2πkn(2N)

(s+ only known at half-samplepositions → use m = n − 1/2

)

=1√2N

2N−1∑m=0

s+[m +

12

]· e−iπk

N (m+ 12 )

=1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +2N−1∑m=N

s[2N −m − 1] · e−iπkN (m+ 1

2 )

)yn=2N−m−1

=1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +N−1∑n=0

s[n] · e−iπkN (2N−n− 1

2 )

)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 27 / 50

Page 118: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Derivation of the Discrete Cosine Transform of Type II (DCT-II)

s+[n] =

{s[n − 1/2] : 0 ≤ n < N

s[2N − n − 3/2] : N ≤ n < 2N

DFT of size 2N : u+[k] =1√

(2N)

(2N)−1∑n=0

s+[n] · e−i 2πkn(2N)

(s+ only known at half-samplepositions → use m = n − 1/2

)

=1√2N

2N−1∑m=0

s+[m +

12

]· e−iπk

N (m+ 12 )

=1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +2N−1∑m=N

s[2N −m − 1] · e−iπkN (m+ 1

2 )

)yn=2N−m−1

=1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +N−1∑n=0

s[n] · e−iπkN (2N−n− 1

2 )

)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 27 / 50

Page 119: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Derivation of the Discrete Cosine Transform of Type II (DCT-II)

s+[n] =

{s[n − 1/2] : 0 ≤ n < N

s[2N − n − 3/2] : N ≤ n < 2N

DFT of size 2N : u+[k] =1√

(2N)

(2N)−1∑n=0

s+[n] · e−i 2πkn(2N)

(s+ only known at half-samplepositions → use m = n − 1/2

)

=1√2N

2N−1∑m=0

s+[m +

12

]· e−iπk

N (m+ 12 )

=1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +2N−1∑m=N

s[2N −m − 1] · e−iπkN (m+ 1

2 )

)yn=2N−m−1

=1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +N−1∑n=0

s[n] · e−iπkN (2N−n− 1

2 )

)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 27 / 50

Page 120: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Derivation of the Discrete Cosine Transform of Type II (DCT-II)

s+[n] =

{s[n − 1/2] : 0 ≤ n < N

s[2N − n − 3/2] : N ≤ n < 2N

DFT of size 2N : u+[k] =1√

(2N)

(2N)−1∑n=0

s+[n] · e−i 2πkn(2N)

(s+ only known at half-samplepositions → use m = n − 1/2

)

=1√2N

2N−1∑m=0

s+[m +

12

]· e−iπk

N (m+ 12 )

=1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +2N−1∑m=N

s[2N −m − 1] · e−iπkN (m+ 1

2 )

)

yn=2N−m−1

=1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +N−1∑n=0

s[n] · e−iπkN (2N−n− 1

2 )

)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 27 / 50

Page 121: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Derivation of the Discrete Cosine Transform of Type II (DCT-II)

s+[n] =

{s[n − 1/2] : 0 ≤ n < N

s[2N − n − 3/2] : N ≤ n < 2N

DFT of size 2N : u+[k] =1√

(2N)

(2N)−1∑n=0

s+[n] · e−i 2πkn(2N)

(s+ only known at half-samplepositions → use m = n − 1/2

)

=1√2N

2N−1∑m=0

s+[m +

12

]· e−iπk

N (m+ 12 )

=1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +2N−1∑m=N

s[2N −m − 1] · e−iπkN (m+ 1

2 )

)yn=2N−m−1

=1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +N−1∑n=0

s[n] · e−iπkN (2N−n− 1

2 )

)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 27 / 50

Page 122: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Derivation of the Discrete Cosine Transform of Type II (DCT-II)

s+[n] =

{s[n − 1/2] : 0 ≤ n < N

s[2N − n − 3/2] : N ≤ n < 2N

DFT of size 2N : u+[k] =1√

(2N)

(2N)−1∑n=0

s+[n] · e−i 2πkn(2N)

(s+ only known at half-samplepositions → use m = n − 1/2

)

=1√2N

2N−1∑m=0

s+[m +

12

]· e−iπk

N (m+ 12 )

=1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +2N−1∑m=N

s[2N −m − 1] · e−iπkN (m+ 1

2 )

)yn=2N−m−1

=1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +N−1∑n=0

s[n] · e−iπkN (2N−n− 1

2 )

)Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 27 / 50

Page 123: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Derivation of the Discrete Cosine Transform of Type II (DCT-II)

Continue derivation

u+[k] =1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +N−1∑n=0

s[n] · e−iπkN (2N−n− 1

2 )

)

=1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +N−1∑n=0

s[n] ·

e−i2πk︸ ︷︷ ︸1

· eiπkN (n+ 1

2 )

)

=1√2N

N−1∑n=0

s[n] ·(e−iπk

N (n+ 12 ) + eiπk

N (n+ 12 ))

︸ ︷︷ ︸2 cos(πk

N (n+ 12 ))

DFT of extended signal

u+[k] =

√2N·N−1∑n=0

s[n] · cos

Nk

(n +

12

))

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 28 / 50

Page 124: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Derivation of the Discrete Cosine Transform of Type II (DCT-II)

Continue derivation

u+[k] =1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +N−1∑n=0

s[n] · e−iπkN (2N−n− 1

2 )

)

=1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +N−1∑n=0

s[n] · e−i2πk

︸ ︷︷ ︸1

· eiπkN (n+ 1

2 )

)

=1√2N

N−1∑n=0

s[n] ·

(e−iπk

N (n+ 12 ) + eiπk

N (n+ 12 ))

︸ ︷︷ ︸2 cos(πk

N (n+ 12 ))

DFT of extended signal

u+[k] =

√2N·N−1∑n=0

s[n] · cos

Nk

(n +

12

))

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 28 / 50

Page 125: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Derivation of the Discrete Cosine Transform of Type II (DCT-II)

Continue derivation

u+[k] =1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +N−1∑n=0

s[n] · e−iπkN (2N−n− 1

2 )

)

=1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +N−1∑n=0

s[n] · e−i2πk︸ ︷︷ ︸1

· eiπkN (n+ 1

2 )

)

=1√2N

N−1∑n=0

s[n] ·

(e−iπk

N (n+ 12 ) + eiπk

N (n+ 12 ))

︸ ︷︷ ︸2 cos(πk

N (n+ 12 ))

DFT of extended signal

u+[k] =

√2N·N−1∑n=0

s[n] · cos

Nk

(n +

12

))

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 28 / 50

Page 126: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Derivation of the Discrete Cosine Transform of Type II (DCT-II)

Continue derivation

u+[k] =1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +N−1∑n=0

s[n] · e−iπkN (2N−n− 1

2 )

)

=1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +N−1∑n=0

s[n] · e−i2πk︸ ︷︷ ︸1

· eiπkN (n+ 1

2 )

)

=1√2N

N−1∑n=0

s[n] ·(e−iπk

N (n+ 12 ) + eiπk

N (n+ 12 ))

︸ ︷︷ ︸2 cos(πk

N (n+ 12 ))

DFT of extended signal

u+[k] =

√2N·N−1∑n=0

s[n] · cos

Nk

(n +

12

))

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 28 / 50

Page 127: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Derivation of the Discrete Cosine Transform of Type II (DCT-II)

Continue derivation

u+[k] =1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +N−1∑n=0

s[n] · e−iπkN (2N−n− 1

2 )

)

=1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +N−1∑n=0

s[n] · e−i2πk︸ ︷︷ ︸1

· eiπkN (n+ 1

2 )

)

=1√2N

N−1∑n=0

s[n] ·(e−iπk

N (n+ 12 ) + eiπk

N (n+ 12 ))

︸ ︷︷ ︸2 cos(πk

N (n+ 12 ))

DFT of extended signal

u+[k] =

√2N·N−1∑n=0

s[n] · cos

Nk

(n +

12

))

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 28 / 50

Page 128: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Derivation of the Discrete Cosine Transform of Type II (DCT-II)

Continue derivation

u+[k] =1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +N−1∑n=0

s[n] · e−iπkN (2N−n− 1

2 )

)

=1√2N

(N−1∑n=0

s[n] · e−iπkN (n+ 1

2 ) +N−1∑n=0

s[n] · e−i2πk︸ ︷︷ ︸1

· eiπkN (n+ 1

2 )

)

=1√2N

N−1∑n=0

s[n] ·(e−iπk

N (n+ 12 ) + eiπk

N (n+ 12 ))

︸ ︷︷ ︸2 cos(πk

N (n+ 12 ))

DFT of extended signal

u+[k] =

√2N·N−1∑n=0

s[n] · cos

Nk

(n +

12

))Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 28 / 50

Page 129: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Derivation of the Discrete Cosine Transform of Type II (DCT-II)

DFT of extended signal (2N real samples) has 2N real transform coefficients

k = 0, . . . , 2N − 1 : u+[k] =

√2N·N−1∑n=0

s[n] · cos

Nk

(n +

12

))

1 Signal s[n] is completely described by first N transform coefficients

k = 0, . . . , N − 1 : u+[k] =

√2N·N−1∑n=0

s[n] · cos

Nk

(n +

12

))2 Basis functions of derived transform are orthogonal to each other, but don’t have the same norm

Introduce factors αk so that transform matrix becomes orthogonal

k = 0, . . . , N − 1 : u[k] = αk ·N−1∑n=0

s[n] · cos

Nk

(n +

12

))

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 29 / 50

Page 130: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Derivation of the Discrete Cosine Transform of Type II (DCT-II)

DFT of extended signal (2N real samples) has 2N real transform coefficients

k = 0, . . . , 2N − 1 : u+[k] =

√2N·N−1∑n=0

s[n] · cos

Nk

(n +

12

))

1 Signal s[n] is completely described by first N transform coefficients

k = 0, . . . , N − 1 : u+[k] =

√2N·N−1∑n=0

s[n] · cos

Nk

(n +

12

))

2 Basis functions of derived transform are orthogonal to each other, but don’t have the same normIntroduce factors αk so that transform matrix becomes orthogonal

k = 0, . . . , N − 1 : u[k] = αk ·N−1∑n=0

s[n] · cos

Nk

(n +

12

))

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 29 / 50

Page 131: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Derivation of the Discrete Cosine Transform of Type II (DCT-II)

DFT of extended signal (2N real samples) has 2N real transform coefficients

k = 0, . . . , 2N − 1 : u+[k] =

√2N·N−1∑n=0

s[n] · cos

Nk

(n +

12

))

1 Signal s[n] is completely described by first N transform coefficients

k = 0, . . . , N − 1 : u+[k] =

√2N·N−1∑n=0

s[n] · cos

Nk

(n +

12

))2 Basis functions of derived transform are orthogonal to each other, but don’t have the same norm

Introduce factors αk so that transform matrix becomes orthogonal

k = 0, . . . , N − 1 : u[k] = αk ·N−1∑n=0

s[n] · cos

Nk

(n +

12

))

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 29 / 50

Page 132: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Derivation of the Discrete Cosine Transform of Type II (DCT-II)

DFT of extended signal (2N real samples) has 2N real transform coefficients

k = 0, . . . , 2N − 1 : u+[k] =

√2N·N−1∑n=0

s[n] · cos

Nk

(n +

12

))

1 Signal s[n] is completely described by first N transform coefficients

k = 0, . . . , N − 1 : u+[k] =

√2N·N−1∑n=0

s[n] · cos

Nk

(n +

12

))2 Basis functions of derived transform are orthogonal to each other, but don’t have the same norm

Introduce factors αk so that transform matrix becomes orthogonal

k = 0, . . . , N − 1 : u[k] = αk ·N−1∑n=0

s[n] · cos

Nk

(n +

12

))Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 29 / 50

Page 133: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Discrete Cosine Transform of Type II (DCT-II)

Specification of DCT-IIForward transform (DCT-II) and inverse transform (IDCT-II) are given by

u[k] = αk

N−1∑n=0

s[n] · cos

Nk

(n +

12

))and s[n] =

N−1∑k=0

αk · u[k] · cos

Nk

(n +

12

))

with scaling factors

αk =

{ √1/N : k = 0√2/N : k 6= 0

The orthogonal transform matrix A = {akn} has the elements

akn = αk · cos

Nk

(n +

12

))

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 30 / 50

Page 134: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Discrete Cosine Transform of Type II (DCT-II)

Specification of DCT-IIForward transform (DCT-II) and inverse transform (IDCT-II) are given by

u[k] = αk

N−1∑n=0

s[n] · cos

Nk

(n +

12

))and s[n] =

N−1∑k=0

αk · u[k] · cos

Nk

(n +

12

))

with scaling factors

αk =

{ √1/N : k = 0√2/N : k 6= 0

The orthogonal transform matrix A = {akn} has the elements

akn = αk · cos

Nk

(n +

12

))Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 30 / 50

Page 135: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Comparions of DFT and DCT-II Basis Functions (Example for N = 8)

DFT: bk [n] =1√N

ei 2πkN

n = rk [n] + i · ik [n] DCT-II: bk [n] = αk · cos

Nk

(n +

12

))

r0 r4

r1 i1

r2 i2

r3 i3

b0 b1

b2 b3

b4 b5

b6 b7

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 31 / 50

Page 136: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Image & Video Coding: 2D Transforms

Separable TransformsSuccessive 1D transforms of rows and columns of image block

Separable forward and inverse transforms

u = A · s · BT and s = AT · u · B

with s — N×M block of image samplesA — N×N transform matrix (typically DCT-II)B — M×M transform matrix (typically DCT-II)u — N×M block of transform coefficients

Great practical importance:Two matrix multiplications of size N×N instead ofone multiplication of a vector of size 1×N2 with a matrix of size N2×N2

Complexity reduction from O(N4) to O(N3) [ also fast algorithms for DCT-II ]

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 32 / 50

Page 137: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Image & Video Coding: 2D Transforms

Separable TransformsSuccessive 1D transforms of rows and columns of image blockSeparable forward and inverse transforms

u = A · s · BT and s = AT · u · B

with s — N×M block of image samplesA — N×N transform matrix (typically DCT-II)B — M×M transform matrix (typically DCT-II)u — N×M block of transform coefficients

Great practical importance:Two matrix multiplications of size N×N instead ofone multiplication of a vector of size 1×N2 with a matrix of size N2×N2

Complexity reduction from O(N4) to O(N3) [ also fast algorithms for DCT-II ]

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 32 / 50

Page 138: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Image & Video Coding: 2D Transforms

Separable TransformsSuccessive 1D transforms of rows and columns of image blockSeparable forward and inverse transforms

u = A · s · BT and s = AT · u · B

with s — N×M block of image samplesA — N×N transform matrix (typically DCT-II)B — M×M transform matrix (typically DCT-II)u — N×M block of transform coefficients

Great practical importance:Two matrix multiplications of size N×N instead ofone multiplication of a vector of size 1×N2 with a matrix of size N2×N2

Complexity reduction from O(N4) to O(N3) [ also fast algorithms for DCT-II ]

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 32 / 50

Page 139: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Example: Basis Images of Separable 8×8 DCT-II

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 33 / 50

Page 140: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Example: Separable DCT-II for 8×8 Image Block

Forward transform for 8× 8 block of samples: u = A · s · AT

original block

horizontalDCT

verticalDCT

after 2d DCT

Example calculation of 2d DCT-II:

1 Horizontal DCT of input block: u∗ = s · AT

2 Vertical DCT of intermediate result: u = A · u∗ = A · s · AT

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 34 / 50

Page 141: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Example: Separable DCT-II for 8×8 Image Block

Forward transform for 8× 8 block of samples: u = A · s · AT

original block

horizontalDCT

verticalDCT

after 2d DCT

Example calculation of 2d DCT-II:

1 Horizontal DCT of input block: u∗ = s · AT

2 Vertical DCT of intermediate result: u = A · u∗ = A · s · AT

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 34 / 50

Page 142: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Example: Separable DCT-II for 8×8 Image Block

Forward transform for 8× 8 block of samples: u = A · s · AT

original block

horizontalDCT

verticalDCT

after 2d DCT

Example calculation of 2d DCT-II:

1 Horizontal DCT of input block: u∗ = s · AT

2 Vertical DCT of intermediate result: u = A · u∗ = A · s · AT

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 34 / 50

Page 143: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Example: Separable DCT-II for 8×8 Image Block

Forward transform for 8× 8 block of samples: u = A · s · AT

original block

horizontalDCT

verticalDCT

after 2d DCT

Example calculation of 2d DCT-II:

1 Horizontal DCT of input block: u∗ = s · AT

2 Vertical DCT of intermediate result: u = A · u∗ = A · s · AT

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 34 / 50

Page 144: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Example: Separable DCT-II for 8×8 Image Block

Forward transform for 8× 8 block of samples: u = A · s · AT

original block

horizontalDCT

verticalDCT

after 2d DCT

Example calculation of 2d DCT-II:

1 Horizontal DCT of input block: u∗ = s · AT

2 Vertical DCT of intermediate result: u = A · u∗ = A · s · AT

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 34 / 50

Page 145: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Example: Separable DCT-II for 8×8 Image Block

Forward transform for 8× 8 block of samples: u = A · s · AT

original block

horizontalDCT

verticalDCT

after 2d DCT

Example calculation of 2d DCT-II:

1 Horizontal DCT of input block: u∗ = s · AT

2 Vertical DCT of intermediate result: u = A · u∗ = A · s · AT

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 34 / 50

Page 146: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Example: Separable DCT-II for 8×8 Image Block

Forward transform for 8× 8 block of samples: u = A · s · AT

original block

horizontalDCT

verticalDCT

after 2d DCT

Example calculation of 2d DCT-II:

1 Horizontal DCT of input block: u∗ = s · AT

2 Vertical DCT of intermediate result: u = A · u∗ = A · s · AT

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 34 / 50

Page 147: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Practical Importance of DCT-II

Justification for usage of DCT-IIRepresents signal as weighted sum of frequency components

Similar to KLT for highly correlated sources (%→ 1)Independent of source characteristicsFast algorithms for computing forward and inverse transform

DCT-II of size 8×8 is used in

Image coding standard: JPEGVideo coding standards: H.261, H.262/MPEG-2, H.263, MPEG-4 Visual

Integer approximation of DCT-II is used in

Video coding standard H.264/AVC (4×4 and 8×8)Video coding standard H.265/HEVC (4×4, 8×8, 16×16, 32×32)New standardization project H.266/VVC (from 4×4 to 64×64, including non-square blocks)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 35 / 50

Page 148: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Practical Importance of DCT-II

Justification for usage of DCT-IIRepresents signal as weighted sum of frequency componentsSimilar to KLT for highly correlated sources (%→ 1)

Independent of source characteristicsFast algorithms for computing forward and inverse transform

DCT-II of size 8×8 is used in

Image coding standard: JPEGVideo coding standards: H.261, H.262/MPEG-2, H.263, MPEG-4 Visual

Integer approximation of DCT-II is used in

Video coding standard H.264/AVC (4×4 and 8×8)Video coding standard H.265/HEVC (4×4, 8×8, 16×16, 32×32)New standardization project H.266/VVC (from 4×4 to 64×64, including non-square blocks)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 35 / 50

Page 149: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Practical Importance of DCT-II

Justification for usage of DCT-IIRepresents signal as weighted sum of frequency componentsSimilar to KLT for highly correlated sources (%→ 1)Independent of source characteristics

Fast algorithms for computing forward and inverse transform

DCT-II of size 8×8 is used in

Image coding standard: JPEGVideo coding standards: H.261, H.262/MPEG-2, H.263, MPEG-4 Visual

Integer approximation of DCT-II is used in

Video coding standard H.264/AVC (4×4 and 8×8)Video coding standard H.265/HEVC (4×4, 8×8, 16×16, 32×32)New standardization project H.266/VVC (from 4×4 to 64×64, including non-square blocks)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 35 / 50

Page 150: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Practical Importance of DCT-II

Justification for usage of DCT-IIRepresents signal as weighted sum of frequency componentsSimilar to KLT for highly correlated sources (%→ 1)Independent of source characteristicsFast algorithms for computing forward and inverse transform

DCT-II of size 8×8 is used in

Image coding standard: JPEGVideo coding standards: H.261, H.262/MPEG-2, H.263, MPEG-4 Visual

Integer approximation of DCT-II is used in

Video coding standard H.264/AVC (4×4 and 8×8)Video coding standard H.265/HEVC (4×4, 8×8, 16×16, 32×32)New standardization project H.266/VVC (from 4×4 to 64×64, including non-square blocks)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 35 / 50

Page 151: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Practical Importance of DCT-II

Justification for usage of DCT-IIRepresents signal as weighted sum of frequency componentsSimilar to KLT for highly correlated sources (%→ 1)Independent of source characteristicsFast algorithms for computing forward and inverse transform

DCT-II of size 8×8 is used inImage coding standard: JPEG

Video coding standards: H.261, H.262/MPEG-2, H.263, MPEG-4 Visual

Integer approximation of DCT-II is used in

Video coding standard H.264/AVC (4×4 and 8×8)Video coding standard H.265/HEVC (4×4, 8×8, 16×16, 32×32)New standardization project H.266/VVC (from 4×4 to 64×64, including non-square blocks)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 35 / 50

Page 152: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Practical Importance of DCT-II

Justification for usage of DCT-IIRepresents signal as weighted sum of frequency componentsSimilar to KLT for highly correlated sources (%→ 1)Independent of source characteristicsFast algorithms for computing forward and inverse transform

DCT-II of size 8×8 is used inImage coding standard: JPEGVideo coding standards: H.261, H.262/MPEG-2, H.263, MPEG-4 Visual

Integer approximation of DCT-II is used in

Video coding standard H.264/AVC (4×4 and 8×8)Video coding standard H.265/HEVC (4×4, 8×8, 16×16, 32×32)New standardization project H.266/VVC (from 4×4 to 64×64, including non-square blocks)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 35 / 50

Page 153: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Practical Importance of DCT-II

Justification for usage of DCT-IIRepresents signal as weighted sum of frequency componentsSimilar to KLT for highly correlated sources (%→ 1)Independent of source characteristicsFast algorithms for computing forward and inverse transform

DCT-II of size 8×8 is used inImage coding standard: JPEGVideo coding standards: H.261, H.262/MPEG-2, H.263, MPEG-4 Visual

Integer approximation of DCT-II is used inVideo coding standard H.264/AVC (4×4 and 8×8)

Video coding standard H.265/HEVC (4×4, 8×8, 16×16, 32×32)New standardization project H.266/VVC (from 4×4 to 64×64, including non-square blocks)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 35 / 50

Page 154: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Practical Importance of DCT-II

Justification for usage of DCT-IIRepresents signal as weighted sum of frequency componentsSimilar to KLT for highly correlated sources (%→ 1)Independent of source characteristicsFast algorithms for computing forward and inverse transform

DCT-II of size 8×8 is used inImage coding standard: JPEGVideo coding standards: H.261, H.262/MPEG-2, H.263, MPEG-4 Visual

Integer approximation of DCT-II is used inVideo coding standard H.264/AVC (4×4 and 8×8)Video coding standard H.265/HEVC (4×4, 8×8, 16×16, 32×32)

New standardization project H.266/VVC (from 4×4 to 64×64, including non-square blocks)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 35 / 50

Page 155: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Signal-Independent Unitary Transforms / Discrete Cosine Transform of Type II

Practical Importance of DCT-II

Justification for usage of DCT-IIRepresents signal as weighted sum of frequency componentsSimilar to KLT for highly correlated sources (%→ 1)Independent of source characteristicsFast algorithms for computing forward and inverse transform

DCT-II of size 8×8 is used inImage coding standard: JPEGVideo coding standards: H.261, H.262/MPEG-2, H.263, MPEG-4 Visual

Integer approximation of DCT-II is used inVideo coding standard H.264/AVC (4×4 and 8×8)Video coding standard H.265/HEVC (4×4, 8×8, 16×16, 32×32)New standardization project H.266/VVC (from 4×4 to 64×64, including non-square blocks)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 35 / 50

Page 156: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Typical Design

Transform Coding in Practice

Orthogonal TransformTypically: DCT-II or integer approximation thereof (separable transform for blocks)

Potential extension in H.266/VVC:Switched transform of DCT/DST families (DCT-II, DST-VII, ...)Non-separable transforms

Scalar Quantization

Uniform reconstruction quantizers (or very similar designs)Bit allocation by using same quantization step size for all coefficientsUsage of advanced quantization algorithms in encoderMay use quantization weighting matrices for perceptual optimization

Entropy Coding of Quantization Indexes

Zig-zag scan (or similar scan) for 2D transformsSimple: Run-level coding, run-level-last coding, or similar approachBetter coding efficiency: Adaptive arithmetic coding

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 36 / 50

Page 157: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Typical Design

Transform Coding in Practice

Orthogonal TransformTypically: DCT-II or integer approximation thereof (separable transform for blocks)Potential extension in H.266/VVC:

Switched transform of DCT/DST families (DCT-II, DST-VII, ...)Non-separable transforms

Scalar Quantization

Uniform reconstruction quantizers (or very similar designs)Bit allocation by using same quantization step size for all coefficientsUsage of advanced quantization algorithms in encoderMay use quantization weighting matrices for perceptual optimization

Entropy Coding of Quantization Indexes

Zig-zag scan (or similar scan) for 2D transformsSimple: Run-level coding, run-level-last coding, or similar approachBetter coding efficiency: Adaptive arithmetic coding

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 36 / 50

Page 158: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Typical Design

Transform Coding in Practice

Orthogonal TransformTypically: DCT-II or integer approximation thereof (separable transform for blocks)Potential extension in H.266/VVC:

Switched transform of DCT/DST families (DCT-II, DST-VII, ...)Non-separable transforms

Scalar QuantizationUniform reconstruction quantizers (or very similar designs)

Bit allocation by using same quantization step size for all coefficientsUsage of advanced quantization algorithms in encoderMay use quantization weighting matrices for perceptual optimization

Entropy Coding of Quantization Indexes

Zig-zag scan (or similar scan) for 2D transformsSimple: Run-level coding, run-level-last coding, or similar approachBetter coding efficiency: Adaptive arithmetic coding

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 36 / 50

Page 159: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Typical Design

Transform Coding in Practice

Orthogonal TransformTypically: DCT-II or integer approximation thereof (separable transform for blocks)Potential extension in H.266/VVC:

Switched transform of DCT/DST families (DCT-II, DST-VII, ...)Non-separable transforms

Scalar QuantizationUniform reconstruction quantizers (or very similar designs)Bit allocation by using same quantization step size for all coefficients

Usage of advanced quantization algorithms in encoderMay use quantization weighting matrices for perceptual optimization

Entropy Coding of Quantization Indexes

Zig-zag scan (or similar scan) for 2D transformsSimple: Run-level coding, run-level-last coding, or similar approachBetter coding efficiency: Adaptive arithmetic coding

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 36 / 50

Page 160: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Typical Design

Transform Coding in Practice

Orthogonal TransformTypically: DCT-II or integer approximation thereof (separable transform for blocks)Potential extension in H.266/VVC:

Switched transform of DCT/DST families (DCT-II, DST-VII, ...)Non-separable transforms

Scalar QuantizationUniform reconstruction quantizers (or very similar designs)Bit allocation by using same quantization step size for all coefficientsUsage of advanced quantization algorithms in encoder

May use quantization weighting matrices for perceptual optimization

Entropy Coding of Quantization Indexes

Zig-zag scan (or similar scan) for 2D transformsSimple: Run-level coding, run-level-last coding, or similar approachBetter coding efficiency: Adaptive arithmetic coding

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 36 / 50

Page 161: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Typical Design

Transform Coding in Practice

Orthogonal TransformTypically: DCT-II or integer approximation thereof (separable transform for blocks)Potential extension in H.266/VVC:

Switched transform of DCT/DST families (DCT-II, DST-VII, ...)Non-separable transforms

Scalar QuantizationUniform reconstruction quantizers (or very similar designs)Bit allocation by using same quantization step size for all coefficientsUsage of advanced quantization algorithms in encoderMay use quantization weighting matrices for perceptual optimization

Entropy Coding of Quantization Indexes

Zig-zag scan (or similar scan) for 2D transformsSimple: Run-level coding, run-level-last coding, or similar approachBetter coding efficiency: Adaptive arithmetic coding

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 36 / 50

Page 162: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Typical Design

Transform Coding in Practice

Orthogonal TransformTypically: DCT-II or integer approximation thereof (separable transform for blocks)Potential extension in H.266/VVC:

Switched transform of DCT/DST families (DCT-II, DST-VII, ...)Non-separable transforms

Scalar QuantizationUniform reconstruction quantizers (or very similar designs)Bit allocation by using same quantization step size for all coefficientsUsage of advanced quantization algorithms in encoderMay use quantization weighting matrices for perceptual optimization

Entropy Coding of Quantization IndexesZig-zag scan (or similar scan) for 2D transforms

Simple: Run-level coding, run-level-last coding, or similar approachBetter coding efficiency: Adaptive arithmetic coding

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 36 / 50

Page 163: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Typical Design

Transform Coding in Practice

Orthogonal TransformTypically: DCT-II or integer approximation thereof (separable transform for blocks)Potential extension in H.266/VVC:

Switched transform of DCT/DST families (DCT-II, DST-VII, ...)Non-separable transforms

Scalar QuantizationUniform reconstruction quantizers (or very similar designs)Bit allocation by using same quantization step size for all coefficientsUsage of advanced quantization algorithms in encoderMay use quantization weighting matrices for perceptual optimization

Entropy Coding of Quantization IndexesZig-zag scan (or similar scan) for 2D transformsSimple: Run-level coding, run-level-last coding, or similar approach

Better coding efficiency: Adaptive arithmetic coding

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 36 / 50

Page 164: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Typical Design

Transform Coding in Practice

Orthogonal TransformTypically: DCT-II or integer approximation thereof (separable transform for blocks)Potential extension in H.266/VVC:

Switched transform of DCT/DST families (DCT-II, DST-VII, ...)Non-separable transforms

Scalar QuantizationUniform reconstruction quantizers (or very similar designs)Bit allocation by using same quantization step size for all coefficientsUsage of advanced quantization algorithms in encoderMay use quantization weighting matrices for perceptual optimization

Entropy Coding of Quantization IndexesZig-zag scan (or similar scan) for 2D transformsSimple: Run-level coding, run-level-last coding, or similar approachBetter coding efficiency: Adaptive arithmetic coding

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 36 / 50

Page 165: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Typical Design

Bit Allocation in Practice (for Uniform Reconstruction Quantizers)

Remember: Optimal bit allocation: Pareto condition

∂Dk(Rk)

∂Rk= const

Pareto condition for high rates

Dk = ε2k · σ2k · 2−2Rk =⇒ Dk(Rk) = const

High rate distortion approximation for URQs

Dk =112

∆2k

Quantization step sizes for optimal bit allocation at high rates

Dk =112

∆2k = const =⇒ ∆k = const = ∆

In practice, (nearly) optimal bit allocation is typically achievedby using the same quantization step size ∆ for all transform coefficients

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 37 / 50

Page 166: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Typical Design

Bit Allocation in Practice (for Uniform Reconstruction Quantizers)

Remember: Optimal bit allocation: Pareto condition

∂Dk(Rk)

∂Rk= const

Pareto condition for high rates

Dk = ε2k · σ2k · 2−2Rk =⇒ Dk(Rk) = const

High rate distortion approximation for URQs

Dk =112

∆2k

Quantization step sizes for optimal bit allocation at high rates

Dk =112

∆2k = const =⇒ ∆k = const = ∆

In practice, (nearly) optimal bit allocation is typically achievedby using the same quantization step size ∆ for all transform coefficients

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 37 / 50

Page 167: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Typical Design

Bit Allocation in Practice (for Uniform Reconstruction Quantizers)

Remember: Optimal bit allocation: Pareto condition

∂Dk(Rk)

∂Rk= const

Pareto condition for high rates

Dk = ε2k · σ2k · 2−2Rk =⇒ Dk(Rk) = const

High rate distortion approximation for URQs

Dk =112

∆2k

Quantization step sizes for optimal bit allocation at high rates

Dk =112

∆2k = const =⇒ ∆k = const = ∆

In practice, (nearly) optimal bit allocation is typically achievedby using the same quantization step size ∆ for all transform coefficients

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 37 / 50

Page 168: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Typical Design

Bit Allocation in Practice (for Uniform Reconstruction Quantizers)

Remember: Optimal bit allocation: Pareto condition

∂Dk(Rk)

∂Rk= const

Pareto condition for high rates

Dk = ε2k · σ2k · 2−2Rk =⇒ Dk(Rk) = const

High rate distortion approximation for URQs

Dk =112

∆2k

Quantization step sizes for optimal bit allocation at high rates

Dk =112

∆2k = const =⇒ ∆k = const = ∆

In practice, (nearly) optimal bit allocation is typically achievedby using the same quantization step size ∆ for all transform coefficients

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 37 / 50

Page 169: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Typical Design

Bit Allocation in Practice (for Uniform Reconstruction Quantizers)

Remember: Optimal bit allocation: Pareto condition

∂Dk(Rk)

∂Rk= const

Pareto condition for high rates

Dk = ε2k · σ2k · 2−2Rk =⇒ Dk(Rk) = const

High rate distortion approximation for URQs

Dk =112

∆2k

Quantization step sizes for optimal bit allocation at high rates

Dk =112

∆2k = const =⇒ ∆k = const = ∆

In practice, (nearly) optimal bit allocation is typically achievedby using the same quantization step size ∆ for all transform coefficients

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 37 / 50

Page 170: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Color Transformation

Color Transform for Image & Video Coding

RGB

Color Transform for CompressionMany versions (also depends on RGB color space)

Example: RGB → YCbCr transform used in JPEGYCb−128Cr −128

=

0.2990 0.5870 0.1140−0.1687 −0.3313 0.5000

0.5000 −0.4187 −0.0813

·R

GB

R

GB

=

1 0 1.40201 −0.3441 −0.71411 1.7720 0

·Y

Cb−128Cr −128

Energy Compaction for Example Image

σ2R = 3862.28

σ2G = 4250.44

σ2B = 5869.39

σ2Y = 3099.67

σ2Cb = 83.94

σ2Cr = 70.10

YCbCr

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 38 / 50

Page 171: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Color Transformation

Color Transform for Image & Video Coding

RGB Color Transform for CompressionMany versions (also depends on RGB color space)

Example: RGB → YCbCr transform used in JPEGYCb−128Cr −128

=

0.2990 0.5870 0.1140−0.1687 −0.3313 0.5000

0.5000 −0.4187 −0.0813

·R

GB

R

GB

=

1 0 1.40201 −0.3441 −0.71411 1.7720 0

·Y

Cb−128Cr −128

Energy Compaction for Example Image

σ2R = 3862.28

σ2G = 4250.44

σ2B = 5869.39

σ2Y = 3099.67

σ2Cb = 83.94

σ2Cr = 70.10

YCbCr

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 38 / 50

Page 172: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Color Transformation

Color Transform for Image & Video Coding

RGB Color Transform for CompressionMany versions (also depends on RGB color space)Example: RGB → YCbCr transform used in JPEGYCb−128Cr −128

=

0.2990 0.5870 0.1140−0.1687 −0.3313 0.5000

0.5000 −0.4187 −0.0813

·R

GB

R

GB

=

1 0 1.40201 −0.3441 −0.71411 1.7720 0

·Y

Cb−128Cr −128

Energy Compaction for Example Image

σ2R = 3862.28

σ2G = 4250.44

σ2B = 5869.39

σ2Y = 3099.67

σ2Cb = 83.94

σ2Cr = 70.10

YCbCr

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 38 / 50

Page 173: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Color Transformation

Color Transform for Image & Video Coding

RGB Color Transform for CompressionMany versions (also depends on RGB color space)Example: RGB → YCbCr transform used in JPEGYCb−128Cr −128

=

0.2990 0.5870 0.1140−0.1687 −0.3313 0.5000

0.5000 −0.4187 −0.0813

·R

GB

R

GB

=

1 0 1.40201 −0.3441 −0.71411 1.7720 0

·Y

Cb−128Cr −128

Energy Compaction for Example Image

σ2R = 3862.28

σ2G = 4250.44

σ2B = 5869.39

σ2Y = 3099.67

σ2Cb = 83.94

σ2Cr = 70.10

YCbCr

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 38 / 50

Page 174: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Color Transformation

Color Transform for Image & Video Coding

RGB Color Transform for CompressionMany versions (also depends on RGB color space)Example: RGB → YCbCr transform used in JPEGYCb−128Cr −128

=

0.2990 0.5870 0.1140−0.1687 −0.3313 0.5000

0.5000 −0.4187 −0.0813

·R

GB

R

GB

=

1 0 1.40201 −0.3441 −0.71411 1.7720 0

·Y

Cb−128Cr −128

Energy Compaction for Example Image

σ2R = 3862.28

σ2G = 4250.44

σ2B = 5869.39

σ2Y = 3099.67

σ2Cb = 83.94

σ2Cr = 70.10

YCbCr

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 38 / 50

Page 175: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Color Transformation

The YCbCr Chroma Sampling Format

Human being are less sensitive to color differences (at same luminance)In most applications: Color difference components are downsampled

RGB

color transform

YCbCr 4:4:4

downsampling

YCbCr 4:2:0

most commonformat in

image coding

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 39 / 50

Page 176: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Color Transformation

The YCbCr Chroma Sampling Format

Human being are less sensitive to color differences (at same luminance)

In most applications: Color difference components are downsampled

RGB

color transform

YCbCr 4:4:4

downsampling

YCbCr 4:2:0

most commonformat in

image coding

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 39 / 50

Page 177: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Color Transformation

The YCbCr Chroma Sampling Format

Human being are less sensitive to color differences (at same luminance)In most applications: Color difference components are downsampled

RGB

color transform

YCbCr 4:4:4

downsampling

YCbCr 4:2:0

most commonformat in

image coding

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 39 / 50

Page 178: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Color Transformation

The YCbCr Chroma Sampling Format

Human being are less sensitive to color differences (at same luminance)In most applications: Color difference components are downsampled

RGB

color transform

YCbCr 4:4:4

downsampling

YCbCr 4:2:0

most commonformat in

image coding

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 39 / 50

Page 179: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

The Image Compression Standard JPEG

Partition color components (Y, Cb, Cr) into blocks of 8× 8 samples

Y Cb Cr

Transform coding of 8× 8 blocks of samples

2D

transform

scalar

quantization

entropy

coding

block of

samples

sequence

of bits

2D inverse

transform

decoder

mapping

entropy

decoding

reconstructed

block

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 40 / 50

Page 180: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

The Image Compression Standard JPEG

Partition color components (Y, Cb, Cr) into blocks of 8× 8 samples

Y Cb Cr

Transform coding of 8× 8 blocks of samples

2D

transform

scalar

quantization

entropy

coding

block of

samples

sequence

of bits

2D inverse

transform

decoder

mapping

entropy

decoding

reconstructed

block

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 40 / 50

Page 181: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG: Transform of Sample Blocks

Separable DCT-II of size 8×8 (fast implementation possible)

Forward transform (in encoder)

original block

horizontalDCT

verticalDCT

after 2d DCT

Inverse transform (in decoder)

reconstructed block

horizontalIDCT

verticalIDCT

rec. transform coeffs.

Effect of transform: Compaction of signal energy (for typical blocks)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 41 / 50

Page 182: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG: Transform of Sample Blocks

Separable DCT-II of size 8×8 (fast implementation possible)

Forward transform (in encoder)

original block

horizontalDCT

verticalDCT

after 2d DCT

Inverse transform (in decoder)

reconstructed block

horizontalIDCT

verticalIDCT

rec. transform coeffs.

Effect of transform: Compaction of signal energy (for typical blocks)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 41 / 50

Page 183: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG: Transform of Sample Blocks

Separable DCT-II of size 8×8 (fast implementation possible)

Forward transform (in encoder)

original block

horizontalDCT

verticalDCT

after 2d DCT

Inverse transform (in decoder)

reconstructed block

horizontalIDCT

verticalIDCT

rec. transform coeffs.

Effect of transform: Compaction of signal energy (for typical blocks)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 41 / 50

Page 184: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG: Transform of Sample Blocks

Separable DCT-II of size 8×8 (fast implementation possible)

Forward transform (in encoder)

original block

horizontalDCT

verticalDCT

after 2d DCT

Inverse transform (in decoder)

reconstructed block

horizontalIDCT

verticalIDCT

rec. transform coeffs.

Effect of transform: Compaction of signal energy (for typical blocks)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 41 / 50

Page 185: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG: Transform of Sample Blocks

Separable DCT-II of size 8×8 (fast implementation possible)

Forward transform (in encoder)

original block

horizontalDCT

verticalDCT

after 2d DCT

Inverse transform (in decoder)

reconstructed block

horizontalIDCT

verticalIDCT

rec. transform coeffs.

Effect of transform: Compaction of signal energy (for typical blocks)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 41 / 50

Page 186: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG: Transform of Sample Blocks

Separable DCT-II of size 8×8 (fast implementation possible)

Forward transform (in encoder)

original block

horizontalDCT

verticalDCT

after 2d DCT

Inverse transform (in decoder)

reconstructed block

horizontalIDCT

verticalIDCT

rec. transform coeffs.

Effect of transform: Compaction of signal energy (for typical blocks)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 41 / 50

Page 187: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG: Transform of Sample Blocks

Separable DCT-II of size 8×8 (fast implementation possible)

Forward transform (in encoder)

original block

horizontalDCT

verticalDCT

after 2d DCT

Inverse transform (in decoder)

reconstructed block

horizontalIDCT

verticalIDCT

rec. transform coeffs.

Effect of transform: Compaction of signal energy (for typical blocks)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 41 / 50

Page 188: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG: Transform of Sample Blocks

Separable DCT-II of size 8×8 (fast implementation possible)

Forward transform (in encoder)

original block

horizontalDCT

verticalDCT

after 2d DCT

Inverse transform (in decoder)

reconstructed block

horizontalIDCT

verticalIDCT

rec. transform coeffs.

Effect of transform: Compaction of signal energy (for typical blocks)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 41 / 50

Page 189: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG: Transform of Sample Blocks

Separable DCT-II of size 8×8 (fast implementation possible)

Forward transform (in encoder)

original block

horizontalDCT

verticalDCT

after 2d DCT

Inverse transform (in decoder)

reconstructed block

horizontalIDCT

verticalIDCT

rec. transform coeffs.

Effect of transform: Compaction of signal energy (for typical blocks)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 41 / 50

Page 190: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG: Transform of Sample Blocks

Separable DCT-II of size 8×8 (fast implementation possible)

Forward transform (in encoder)

original block

horizontalDCT

verticalDCT

after 2d DCT

Inverse transform (in decoder)

reconstructed block

horizontalIDCT

verticalIDCT

rec. transform coeffs.

Effect of transform: Compaction of signal energy (for typical blocks)Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 41 / 50

Page 191: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG: Quantization

s

u−4 u−3 u−2 u−1 u0 u1 u2 u3 u4 u5

∆ ∆

s ′−5 s ′−4 s ′−3 s ′−2 s ′−1 s ′0 s ′1 s ′2 s ′3 s ′4 s ′5

−5∆ −4∆ −3∆ −2∆ −1∆ 0 1∆ 2∆ 3∆ 4∆ 5∆

Uniform Reconstruction QuantizersEqually spaced reconstruction levels (indicated by step size ∆)Simple decoder mapping

t ′ = ∆ · q

Simplest (but not best) encoder:q = round(t/∆)

Better encoders use Lagrangian optimization (minimization of D + λR)

Quantization step size ∆ determines tradeoff between quality and bit rate

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 42 / 50

Page 192: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG: Quantization

s

u−4 u−3 u−2 u−1 u0 u1 u2 u3 u4 u5

∆ ∆

s ′−5 s ′−4 s ′−3 s ′−2 s ′−1 s ′0 s ′1 s ′2 s ′3 s ′4 s ′5

−5∆ −4∆ −3∆ −2∆ −1∆ 0 1∆ 2∆ 3∆ 4∆ 5∆

Uniform Reconstruction QuantizersEqually spaced reconstruction levels (indicated by step size ∆)Simple decoder mapping

t ′ = ∆ · q

Simplest (but not best) encoder:q = round(t/∆)

Better encoders use Lagrangian optimization (minimization of D + λR)

Quantization step size ∆ determines tradeoff between quality and bit rate

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 42 / 50

Page 193: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG: Quantization

s

u−4 u−3 u−2 u−1 u0 u1 u2 u3 u4 u5

∆ ∆

s ′−5 s ′−4 s ′−3 s ′−2 s ′−1 s ′0 s ′1 s ′2 s ′3 s ′4 s ′5

−5∆ −4∆ −3∆ −2∆ −1∆ 0 1∆ 2∆ 3∆ 4∆ 5∆

Uniform Reconstruction QuantizersEqually spaced reconstruction levels (indicated by step size ∆)Simple decoder mapping

t ′ = ∆ · q

Simplest (but not best) encoder:q = round(t/∆)

Better encoders use Lagrangian optimization (minimization of D + λR)

Quantization step size ∆ determines tradeoff between quality and bit rate

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 42 / 50

Page 194: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG: Quantization

s

u−4 u−3 u−2 u−1 u0 u1 u2 u3 u4 u5

∆ ∆

s ′−5 s ′−4 s ′−3 s ′−2 s ′−1 s ′0 s ′1 s ′2 s ′3 s ′4 s ′5

−5∆ −4∆ −3∆ −2∆ −1∆ 0 1∆ 2∆ 3∆ 4∆ 5∆

Uniform Reconstruction QuantizersEqually spaced reconstruction levels (indicated by step size ∆)Simple decoder mapping

t ′ = ∆ · q

Simplest (but not best) encoder:q = round(t/∆)

Better encoders use Lagrangian optimization (minimization of D + λR)

Quantization step size ∆ determines tradeoff between quality and bit rateHeiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 42 / 50

Page 195: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG: Entropy Coding

0.242 0.108 0.053 0.009

0.105 0.053 0.022 0.002

0.046 0.017 0.006 0.001

0.009 0.002 0.001 0.000

probabilities P(qk 6= 0) zig-zag scan (JPEG)

1 Scanning of Quantization indexesConvert matrix of quantization indexes into sequence

Traverse quantization indexes from low to high frequency positionsJPEG: Zig-zag scan

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 43 / 50

Page 196: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG: Entropy Coding

0.242 0.108 0.053 0.009

0.105 0.053 0.022 0.002

0.046 0.017 0.006 0.001

0.009 0.002 0.001 0.000

probabilities P(qk 6= 0)

zig-zag scan (JPEG)

1 Scanning of Quantization indexesConvert matrix of quantization indexes into sequenceTraverse quantization indexes from low to high frequency positions

JPEG: Zig-zag scan

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 43 / 50

Page 197: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG: Entropy Coding

0.242 0.108 0.053 0.009

0.105 0.053 0.022 0.002

0.046 0.017 0.006 0.001

0.009 0.002 0.001 0.000

probabilities P(qk 6= 0) zig-zag scan (JPEG)

1 Scanning of Quantization indexesConvert matrix of quantization indexes into sequenceTraverse quantization indexes from low to high frequency positionsJPEG: Zig-zag scan

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 43 / 50

Page 198: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG: Entropy Coding

2 Entropy Coding of Sequences of Quantization IndexesOften long sequences of zeros (in particular at end of sequence)

Entropy coding should exploit this property

JPEG: Run-Level Coding (V2V code)Map sequence a symbols (transform coefficients) into (run,level) pairs,including a special end-of-block (eob) symbol

level : value of next non-zero symbolrun : number of zero symbols that precede next non-zero symboleob : all following symbols are equal to zero (end-of-block)

Assign codewords to (run,level) pairs (including eob symbol)

Example: 64 symbols: 5 3 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 ...(run,level) pairs: (0,5) (0,3) (3,1) (1,1) (2,1) (eob)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 44 / 50

Page 199: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG: Entropy Coding

2 Entropy Coding of Sequences of Quantization IndexesOften long sequences of zeros (in particular at end of sequence)Entropy coding should exploit this property

JPEG: Run-Level Coding (V2V code)Map sequence a symbols (transform coefficients) into (run,level) pairs,including a special end-of-block (eob) symbol

level : value of next non-zero symbolrun : number of zero symbols that precede next non-zero symboleob : all following symbols are equal to zero (end-of-block)

Assign codewords to (run,level) pairs (including eob symbol)

Example: 64 symbols: 5 3 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 ...(run,level) pairs: (0,5) (0,3) (3,1) (1,1) (2,1) (eob)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 44 / 50

Page 200: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG: Entropy Coding

2 Entropy Coding of Sequences of Quantization IndexesOften long sequences of zeros (in particular at end of sequence)Entropy coding should exploit this property

JPEG: Run-Level Coding (V2V code)Map sequence a symbols (transform coefficients) into (run,level) pairs,including a special end-of-block (eob) symbol

level : value of next non-zero symbolrun : number of zero symbols that precede next non-zero symboleob : all following symbols are equal to zero (end-of-block)

Assign codewords to (run,level) pairs (including eob symbol)

Example: 64 symbols: 5 3 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 ...(run,level) pairs: (0,5) (0,3) (3,1) (1,1) (2,1) (eob)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 44 / 50

Page 201: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG: Entropy Coding

2 Entropy Coding of Sequences of Quantization IndexesOften long sequences of zeros (in particular at end of sequence)Entropy coding should exploit this property

JPEG: Run-Level Coding (V2V code)Map sequence a symbols (transform coefficients) into (run,level) pairs,including a special end-of-block (eob) symbol

level : value of next non-zero symbolrun : number of zero symbols that precede next non-zero symboleob : all following symbols are equal to zero (end-of-block)

Assign codewords to (run,level) pairs (including eob symbol)

Example: 64 symbols: 5 3 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 ...(run,level) pairs: (0,5) (0,3) (3,1) (1,1) (2,1) (eob)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 44 / 50

Page 202: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG: Entropy Coding

2 Entropy Coding of Sequences of Quantization IndexesOften long sequences of zeros (in particular at end of sequence)Entropy coding should exploit this property

JPEG: Run-Level Coding (V2V code)Map sequence a symbols (transform coefficients) into (run,level) pairs,including a special end-of-block (eob) symbol

level : value of next non-zero symbolrun : number of zero symbols that precede next non-zero symboleob : all following symbols are equal to zero (end-of-block)

Assign codewords to (run,level) pairs (including eob symbol)

Example: 64 symbols: 5 3 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 ...(run,level) pairs: (0,5) (0,3) (3,1) (1,1) (2,1) (eob)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 44 / 50

Page 203: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG Compression Example

100%

Original Image (960×720 image points, RGB: 2 MByte)Lossy Compressed: JPEG (Quality 94) 18.60%

5.4 : 1

Lossy Compressed: JPEG (Quality 66) 3.88%

25.8 : 1

Lossy Compressed: JPEG (Quality 27) 1.85%

54.0 : 1

Lossy Compressed: JPEG (Quality 6) 0.49%

204 : 1

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 45 / 50

Page 204: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG Compression Example

100%

Original Image (960×720 image points, RGB: 2 MByte)Lossy Compressed: JPEG (Quality 94) 18.60%

5.4 : 1

Lossy Compressed: JPEG (Quality 66) 3.88%

25.8 : 1

Lossy Compressed: JPEG (Quality 27) 1.85%

54.0 : 1

Lossy Compressed: JPEG (Quality 6) 0.49%

204 : 1

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 45 / 50

Page 205: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG Compression Example

100%

Original Image (960×720 image points, RGB: 2 MByte)Lossy Compressed: JPEG (Quality 94) 18.60%

5.4 : 1

Lossy Compressed: JPEG (Quality 66) 3.88%

25.8 : 1

Lossy Compressed: JPEG (Quality 27) 1.85%

54.0 : 1

Lossy Compressed: JPEG (Quality 6) 0.49%

204 : 1

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 45 / 50

Page 206: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG Compression Example

100%

Original Image (960×720 image points, RGB: 2 MByte)Lossy Compressed: JPEG (Quality 94) 18.60%

5.4 : 1

Lossy Compressed: JPEG (Quality 66) 3.88%

25.8 : 1

Lossy Compressed: JPEG (Quality 27) 1.85%

54.0 : 1

Lossy Compressed: JPEG (Quality 6) 0.49%

204 : 1

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 45 / 50

Page 207: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Image Compression Example: JPEG

JPEG Compression Example

100%

Original Image (960×720 image points, RGB: 2 MByte)Lossy Compressed: JPEG (Quality 94) 18.60%

5.4 : 1

Lossy Compressed: JPEG (Quality 66) 3.88%

25.8 : 1

Lossy Compressed: JPEG (Quality 27) 1.85%

54.0 : 1

Lossy Compressed: JPEG (Quality 6) 0.49%

204 : 1

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 45 / 50

Page 208: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Audio Compression Example: AAC

Audio Compression Example: MPEG-2 Advanced Audio Coding (AAC)

Main Component: Transform Coding of Sample BlocksTransform: Modified DCT for overlapping blocksQuantization: Scalar quantization with psycho-acoustic modelEntropy Coding: Variant of Huffman coding

Linear TransformAudio signal is coded based on overlapping blocks of samplesTransform: Modified discrete cosine transform (MDCT)

Quantization of Transform CoefficientsScalar quantization of transform coefficients (spectral coefficients)Utilization of psycho-acoustic models by noise shaping

Entropy Coding of Quantization IndexesGrouping and interleavingHuffman coding for tuples of n quantization indexes (n is variable)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 46 / 50

Page 209: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Audio Compression Example: AAC

Audio Compression Example: MPEG-2 Advanced Audio Coding (AAC)

Main Component: Transform Coding of Sample BlocksTransform: Modified DCT for overlapping blocksQuantization: Scalar quantization with psycho-acoustic modelEntropy Coding: Variant of Huffman coding

Linear TransformAudio signal is coded based on overlapping blocks of samplesTransform: Modified discrete cosine transform (MDCT)

Quantization of Transform CoefficientsScalar quantization of transform coefficients (spectral coefficients)Utilization of psycho-acoustic models by noise shaping

Entropy Coding of Quantization IndexesGrouping and interleavingHuffman coding for tuples of n quantization indexes (n is variable)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 46 / 50

Page 210: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Audio Compression Example: AAC

Audio Compression Example: MPEG-2 Advanced Audio Coding (AAC)

Main Component: Transform Coding of Sample BlocksTransform: Modified DCT for overlapping blocksQuantization: Scalar quantization with psycho-acoustic modelEntropy Coding: Variant of Huffman coding

Linear TransformAudio signal is coded based on overlapping blocks of samplesTransform: Modified discrete cosine transform (MDCT)

Quantization of Transform CoefficientsScalar quantization of transform coefficients (spectral coefficients)Utilization of psycho-acoustic models by noise shaping

Entropy Coding of Quantization IndexesGrouping and interleavingHuffman coding for tuples of n quantization indexes (n is variable)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 46 / 50

Page 211: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Audio Compression Example: AAC

Audio Compression Example: MPEG-2 Advanced Audio Coding (AAC)

Main Component: Transform Coding of Sample BlocksTransform: Modified DCT for overlapping blocksQuantization: Scalar quantization with psycho-acoustic modelEntropy Coding: Variant of Huffman coding

Linear TransformAudio signal is coded based on overlapping blocks of samplesTransform: Modified discrete cosine transform (MDCT)

Quantization of Transform CoefficientsScalar quantization of transform coefficients (spectral coefficients)Utilization of psycho-acoustic models by noise shaping

Entropy Coding of Quantization IndexesGrouping and interleavingHuffman coding for tuples of n quantization indexes (n is variable)

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 46 / 50

Page 212: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Audio Compression Example: AAC

Modified Discrete Cosine Transform (MDCT)

Forward Transform (MDCT)The forward transform maps 2N samples to N transform coefficients

u[k] =1√N

2N−1∑n=0

s[n] · cos

N

(n +

N + 12

)(k +

12

))

Inverse Transform (IMDCT)The inverse transform maps N transform coefficients to 2N samples

x [n] =1√N

N−1∑k=0

u[k] · cos

N

(n +

N + 12

)(k +

12

))

Perfect ReconstructionNeighboring blocks of samples s[n] overlap by 50% (at each side)Perfect reconstruction of s[n] is achieved by adding the inverse transformed blocks x [n]

Property of time-domain aliasing cancellation

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 47 / 50

Page 213: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Audio Compression Example: AAC

Modified Discrete Cosine Transform (MDCT)

Forward Transform (MDCT)The forward transform maps 2N samples to N transform coefficients

u[k] =1√N

2N−1∑n=0

s[n] · cos

N

(n +

N + 12

)(k +

12

))

Inverse Transform (IMDCT)The inverse transform maps N transform coefficients to 2N samples

x [n] =1√N

N−1∑k=0

u[k] · cos

N

(n +

N + 12

)(k +

12

))

Perfect ReconstructionNeighboring blocks of samples s[n] overlap by 50% (at each side)Perfect reconstruction of s[n] is achieved by adding the inverse transformed blocks x [n]

Property of time-domain aliasing cancellation

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 47 / 50

Page 214: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Transform Coding in Practice / Audio Compression Example: AAC

Modified Discrete Cosine Transform (MDCT)

Forward Transform (MDCT)The forward transform maps 2N samples to N transform coefficients

u[k] =1√N

2N−1∑n=0

s[n] · cos

N

(n +

N + 12

)(k +

12

))

Inverse Transform (IMDCT)The inverse transform maps N transform coefficients to 2N samples

x [n] =1√N

N−1∑k=0

u[k] · cos

N

(n +

N + 12

)(k +

12

))

Perfect ReconstructionNeighboring blocks of samples s[n] overlap by 50% (at each side)Perfect reconstruction of s[n] is achieved by adding the inverse transformed blocks x [n]

Property of time-domain aliasing cancellationHeiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 47 / 50

Page 215: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Summary

Summary of Lecture

Signal-Independent TransformsWalsh-Hadamard Transform (WHT): Perceptual disturbing artefactsDiscrete Fourier Transform (DFT): Problem due to implicit periodic signal extensionDiscrete Trigonometric Transforms: Family of Sine and Cosine transforms

Discrete Cosine Transform of Type II (DCT-II)DFT of mirrored signal with half-sample symmetry at both sidesReduced blocking artifacts compared to DFTGood approximation of KLT for highly-correlated signals

Transform Coding in PracticeColor transforms in image and video coding: RGB to YCbCr conversionJPEG image compression: 2D DCT-II + URQ + Run-level codingAAC audio compression: MDCT for overlapped blocks + scalar quantization + Huffman coding

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 48 / 50

Page 216: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Summary

Summary of Lecture

Signal-Independent TransformsWalsh-Hadamard Transform (WHT): Perceptual disturbing artefactsDiscrete Fourier Transform (DFT): Problem due to implicit periodic signal extensionDiscrete Trigonometric Transforms: Family of Sine and Cosine transforms

Discrete Cosine Transform of Type II (DCT-II)DFT of mirrored signal with half-sample symmetry at both sidesReduced blocking artifacts compared to DFTGood approximation of KLT for highly-correlated signals

Transform Coding in PracticeColor transforms in image and video coding: RGB to YCbCr conversionJPEG image compression: 2D DCT-II + URQ + Run-level codingAAC audio compression: MDCT for overlapped blocks + scalar quantization + Huffman coding

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 48 / 50

Page 217: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Summary

Summary of Lecture

Signal-Independent TransformsWalsh-Hadamard Transform (WHT): Perceptual disturbing artefactsDiscrete Fourier Transform (DFT): Problem due to implicit periodic signal extensionDiscrete Trigonometric Transforms: Family of Sine and Cosine transforms

Discrete Cosine Transform of Type II (DCT-II)DFT of mirrored signal with half-sample symmetry at both sidesReduced blocking artifacts compared to DFTGood approximation of KLT for highly-correlated signals

Transform Coding in PracticeColor transforms in image and video coding: RGB to YCbCr conversionJPEG image compression: 2D DCT-II + URQ + Run-level codingAAC audio compression: MDCT for overlapped blocks + scalar quantization + Huffman coding

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 48 / 50

Page 218: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Exercises

Exercise 1: Correlation of Transform Coefficients

Given is a zero-mean AR(1) sources with a variance σ2 and a correlation coefficient % = 0.9

Consider transform coding of blocks of 2 samples using the transform[uk,0uk,1

]=

1√2

[1 1−1 1

]·[

s2ks2k+1

],

where k represents the index of the transform block

Determine the following variances and covariances of the transform coefficients(inside a block and between neighbouring blocks):

E{U2k,0}

= ? E{Uk,0 Uk+1,0 } = ?

E{U2k,1}

= ? E{Uk,1 Uk+1,1 } = ?

E{Uk,0 Uk,1 } = ? E{Uk,0 Uk+1,1 } = ?

Is it worth to exploit the correlations between the transform coefficients of neighboring block(e.g., for typical correlation factors of % ≈ 0.9) ?

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 49 / 50

Page 219: Transform Coding in Practiceiphome.hhi.de/schwarz/assets/dc/14-TransformCodingPractice_pres.pdf · LastLecture LastLectures: OrthogonalBlockTransforms Transformmatrixhasproperty:

Exercises

Exercise 2: First Version of Lossy Image Codec (Implementation)

Implement a first lossy image codec for PPM images:

1 Use the source code of last weeks exercise as basis (see KVV)

2 Add some variant of entropy coding for the quantization indexes, for example:Simple Rice coding or Exp-Golomb coding (see lossless codec example in KVV)

Adaptive binary arithmetic coding using a unary binarization (see lossless coding example in KVV)

...

3 Implement an encoder that converts a PPM image into a bitstream file

4 Implement a corresponding decoder that converts a bitstream file into a PPM image

5 Test your encoder with some example images and multiple quantization step sizes

6 (Optional) Try to improve your codec by using the YCbCr color formatImplement an RBG-to-YCbCr transform before the actual encoding

Implement the inverse YCbCr-to-RGB transform after the actual decoding

Possible extension: Sub-sampling of chroma components

Heiko Schwarz (Freie Universität Berlin) — Data Compression: Transform Coding in Practice 50 / 50