Transform Coding Mei-Chen Yeh 12/04/2009
Jan 02, 2016
Introduction To compact most of the information into a few
elementsThe weight-height example:
68°
Transform Discard y (2D->1D) and inverse transform
Transform Coding Three steps
Divide a data sequence into blocks of size N and transform each block using a reversible mapping
Quantize the transformed sequence Encode the quantized values
Transform Quantization Binary coding
The Transform Forward transform
Inverse transform
Orthonormal transforms A-1 = AT
Linearity: x is represented as a linear combination of “basis vectors”
Parseval’s Theorem holds: the total energy is preserved
or
or
N-dimensional vectorN-dimensional vector
NxN matrix
Transformx θ
11
101
01
000
1
0
1101
1000
1
0
b
b
b
b
bb
bb
x
x
Two-dimensional transform Separable transforms
Take the transform along one dimension, then repeat the operation along the other direction
Ex: rows -> columns, or columns -> rows Forward transform
Backward transform
NxN matrix
NxN matrix
NxN matrix
Transforms of interest Data-dependent
Discrete Karhunen Lòeve transform (KLT) Data-independent
Discrete cosine transform (DCT)
KLT Also known as Principal Component Analysis
(PCA), or the Hotelling transform Transforms correlated variables into
uncorrelated variables Basis vectors are eigenvectors of the
covariance matrix of the input signal Achieves optimum energy concentration Disadvantages
Dependent on signal statistics Not separable
DCT (1) Part of many standards (JPEG, MPEG, H.261,
…) The transform matrix C
Visualize the rows of C
The frequency increases as we go from top to bottom!
Quantization and coding of transform coefficients (1)
The bit-rate allocation problem Divide bit-rate R among transform coefficients
such that resulting distortion D is minimized
Transform Quantization Binary coding
Quantization and coding (2) The optimal bit allocation
The zonal sampling Compute σ2
θk for each coefficient Set Rk = 0 for all k Sort {σ2
θk}. Suppose σ2θ1 is the max.
Increment R1 by 1, divide σ2θ1 by 2.
Decrement Rb by 1. If Rb=0, stop; Otherwise, go to step 3
variance of the transformcoefficient θk
Rb = 72 bits
Discarded!
Quantization and coding (3) The threshold coding
Transform coefficients that fall below a threshold are discarded
Example: a 8x8 blockSample quantization tableThe zigzag scan
DC component
AC components
Horizontal frequency →
vertical frequency →
noisy
Example: Encode
Remove mean,DCT
Quantize
Quantization table
Zigzag scan
-26 -3 0 -3 -2 -6 2 -4 1 -4 1 1 5 1 2 -1 1 -1 2 0 0 −1 1 −1 2 0 0 0 0 0 −1 −1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-26 -3 0 -3 -2 -6 2 -4 1 -4 1 1 5 1 2 -1 1 -1 2 0 0 −1 1 −1 2 0 0 0 0 0 −1 −1 EOF
Add EOF
Entropy coding
010001010000101110000011101010011000101111100000……………
Example: Decode
-26 -3 0 -3 -2 -6 2 -4 1 -4 1 1 5 1 2 -1 1 -1 2 0 0 −1 1 −1 2 0 0 0 0 0 −1 −1 EOF
010001010000101110000011101010011000101111100000……………
Entropy decoding
Put into a block
Q-1
Quantization table
Inverse DCT,Add mean
Original block
Reconstructed block