Ch.
13 Transform Coding
My Coverage is Different from the Book
Overview
Transform the signal (e.g., via the DFT, etc.) into a new domain where compression can be done: (i) better and/or (ii) easier Often (but not always!) done on a block-by-block basis: Non-Overlapped Blocks (most common) Overlapped Blocks
Optional
Blocker
Block Diagram of Transform Coding Fig. A
Quantizers Scalar Vector Differential
Entropy Coders Huffmann Arithmethic Etc.
Transform as Linear Operator
Well view transforms as linear operators on a vector space (finite dimensional):
x1 x x= 2 xN 1 y1 y y= 2 y N 1
A x y y = Ax
A = Operator an NN Matrix
Because at the decoder we need to undo the effect of this operator we need matrix A to be invertible:
Binary Stream
Usefulness of Transform Coding
1.
Information Theory Advantages
Try to make y have uncorrelated elements Try to concentrate energy into just a few elements of y
2.
Perceptual Distortion Advantages
Transform domain is often better-suited for exploiting aspects of human perception: psychology of hearing and vision
3.
Efficient Implementation
Transform Coding framework provides simple way to achieve #1 & #2 Extra cost of transform is usually not prohibitively large
Need for ON Transforms
Using theory of quantization it is easy to assess transform-domain distortion:
1 d ( y, y ) = N
( yn yn )
n =0
N 1
But what is the resulting signal-domain distortion?? d ( x, x ) = ???
Fact: If transform A is ON then
d ( x, x ) = d ( y , y )
Simplifies understanding of impact of quantization choices in the transform domain Recall: The matrix A for an ON transform has:
Columns that are ON vectors: aT a = i j 1, i = j 0, i j
Inverse is the transpose: A 1 = A T
x = AT y
x = AT y
5
So if the transform is ON then the signal distortion is:
D = E (x x)
( x x )}
= E ( y y ) AA T ( y y )
T
=I
= E (y y)
( y y )}
N 1 2 = E ( yn yn ) n =0
= Dn
n =0
N 1
Distortion of nth Transform Coefficient
Big Picture Result: If ON transform, then Transform-Domain
distortions add to give total distortion in signal domain
6
Bit Allocation to TC Quantizers
In Fig. A we have N quantizers operating on the transform coefficients Q: How do we decide how many bits each of these should use? This is the so-called Bit Allocation Problem we have a constrained total # of bits how do we allocate them across the N quantizers? Q: Why not just allocate them evenly???
Bit Allocation Problem
RB = Total Rate Budget (Bit Budget) Ri = # of bits allocated to the ith quantizer Di(Ri) = Distortion of ith Total Bits Used: R =
N 1 i =0
R
i =0 i
N 1
quantizer when using Ri bits
Assume distortions are additive (true for ON transform): D =
Each quantizer has its own R-D curve depends on quantizer type and char. of the ith transform coefficient
D (R )
i
Goal: Allocate bits {Ri } i =0 to minimize
N 1 N 1 i =0 N 1 i =0
D = Di ( Ri )
constrained by R =
RB
(Alternate Goal: Minimize R subject to D DB)
Aspects of Bit Allocation
1. 2.
Theoretical View Algorithms
Average R-D Approach Operational R-D Approach
Theory Drives Algorithms
Bit Allocation Theory
Given known functions Di(Ri)
Models used here determine if we strive for Average R-D Solution Operational R-D Solution
(Based on some appropriate signal & quantizer models) Constrained Opt Lagrange Mult.
Solve the constrained optimization problem for the optimal allocation vector r = [R0 R1 RN-1] Interpret the result to understand general characteristics
Constrained Optimization: Lagrange Multiplier
x2 f (x1,x2) contours Equality Constraint: g(x1,x2) = C g(x1,x2) C = h(x1,x2) = 0
Ex. ax1 + bx2 c = 0 x2 = (a/b)x1 + c/b A Linear Constraint
h ( x1 , x2 ) x a 1 = h ( x1 , x2 ) = h ( x1 , x2 ) b x2
Unconstrained Minimum
x1 Constrained Max occurs when:
f ( x1 , x 2 ) = h ( x1 , x 2 ) f ( x1 , x 2 ) + h ( x1 , x 2 ) = 0
Ex. The grad vector has slope of b/a orthogonal to constraint line
x1 , x2 , f ( x1 , x2 ) + ( g ( x1 , x2 ) C ) = 0
10
Lagrange Multiplier Approach to Bit Allocation
See paper: Shoham & Gersho, Efficient Bit Allocation for an Arbitrary Set of Quantizers, IEEE Transactions on Acoustics, Speech and Signal Processing, Sept. 1988, pp. 1445 1453. (See especially Sect. III) Constrained Minimization:
min H ( B ) subject to R ( B ) Rc
BS
Theorem: For any 0, the solution B*() to the unconstrained problem
min {H ( B ) + R ( B )}
BS
is also the solution to the constrained problem with constraint
min H ( B ) subj. to R ( B ) R ( B* ( ) )
BS
= R* ( )
So for each 0 we find the -dependent solution to a -dependent unconstrained problem this solution solves a particular version of the constrained problem, where the constraint is -dependent
11
Proof: Since B*() is a solution to the unconstrained problem
H ( B * ( ) ) + R ( B * ( ) ) H ( B ) + R ( B ) B S
Re-arranging this gives:
H ( B * ( ) ) H ( B ) R ( B ) R ( B * ( ) )
Since this is true for BS it is true for BS* S such that R(B) R(B*())
S * = {B | R( B ) R( B* )}
Set of all allocations B that satisfy -dependent constraint R(B*()) Note: R(B) R(B*()) is negative for all BS*. Since is positive we have that H B* ( ) H ( B ) 0 H(B*()) is minimum over all B s.t. R(B) R(B*()) B*() solves the constrained problem with constraint R(B*())
<End of Proof>
12
H ( B * ( ) ) H ( B ) B S *
What does this theorem say?
To each 0 there is a constrained problem with: constraint R*() & solution B*()
Both depend on
the unconstrained problem min{H(B)+R(B)} also has the same solution Soif we can find closed-forms for B*() & R*() as functions of then we can adjust = c so that R*(c) = Rc So we get that B*(c) solves the constrained problem w/ our desired constraint
Our Actual Constraint
13
Applying the Theorem to TC Bit Allocation
We want to minimize D ( R ) =
D (R )
i =0 i i
N 1
constrained by R =
R
i =0
N 1
RB
The theorem says minimize: J = D ( R ) + R
N 1 i =0
for arbitrary fixed (get results in terms of )
J = Di ( Ri ) + Ri
i =0
N 1
J = 0 j To minimize we need to set: R j
J D j ( R j ) = + R j R j set = 0
D j ( R j ) R j
Aha!! Insight!!
All the quantizers must operate at an R-D point that has the same slope
Equal Slopes Requirement
14
Intuitive View of Equal Slopes
D1
Consider N = 2 case
D2
* D2
* 1
R1*
R1
* R2
R2
Intuitive Proof by Contradiction 1. Assume an optimal operating pt. (R1*, D1*) & (R2*, D2*) w/ non-equal slopes
Di S = Ri
* i
* with S1* S2
* WLOG : S1* = S2 w / > 0
* Ri = Ri
2. 3. 4.
* Because assumed optimal: R1* + R2 = RB i.e., meets budget
Now imagine small increase in R1 for quantizer #1: R1* R1* + , > 0 To keep the bit budget, must decrease rate R2 by same small amount:
* * R2 R2 , > 0 (same )
15
5.
Find new distortions due to these rate changes (Use Taylor series approximations valid because rate changes were small)
* D1* decreases to D1* + S1* = D1* + ( S2 ) * * * D2 increases to D2 S2
6.
Find new total distortion:
* * * DNew = D1* + ( S2 ) + D2 S2 * = D1* + D2 >0 D Old
DNew < DOld
Contradiction!!! We assumed we were optimal (but with non-equal slopes) Yet, we were able to reduce the distortion while meeting bit budget So that non-equal slope operating pt. wasnt optimal after all!!! So, equal slopes must occur at the optimal operating point!!!!
16
So We Need Equal Slopes But Which Slope?
Here are two cases, each with equal slopes Which should we use?
Note: Slope #1 gives a lower total rate than does Slope #2 Choose Slope that causes Total Rate = Budget Rate Recall: All slopes = Choose to make Total Rate = Budget Rate
Total Rate, R*()
Recall Theorem
Budget, Rc
Set so that the solution to the unconstrained solution also solves our constrained problem with our constraint
17
Find = c that gives R*(c) = Rc