Sie sind auf Seite 1von 42

IMAGE COMPRESSION AND PACKET VIDEO

Vector Quantization
Lecture Notes 8

IMAGE COMPRESSION AND PACKET VIDEO

Vector Quantization

■ Identify an input vector with a member of a


codebook based on a error measure criteria
■ Pattern matching procedure
– Index is sent to receiver
– Exact replica of codebook is used to recreate
the data.

2
IMAGE COMPRESSION AND PACKET VIDEO

Vector Quantization

■ Original image is decomposed into n-


dimensional image vectors
– vectors can be n = l × m block of pixel values
or a 3-dimensional vector formed from the
RGB color components.
■ Each vector is compared with a collection
of representative codevectors, Xˆ i , i = 1,K, N c
taken from a previously generated
codebook.
3

IMAGE COMPRESSION AND PACKET VIDEO

Vector Quantization

■ Best match codevector is chosen using a


minimum distortion rule
– Choose X̂ k such that d (X , Xˆ k ) ≤ d (X , Xˆ j ) for all
j = 1,K , N c where d (X , Xˆ ) denotes the distortion
incurred in replacing the original vector X with
the codevector X̂

4
IMAGE COMPRESSION AND PACKET VIDEO

Distance Measure
■ Ideally distance measure should be related to
perceived quality
– Utah state VQ uses Percent error due to science
application
– MSE is a common measure:
» square of the Euclidean distance between two vectors
d (X , Xˆ ) = ∑ (xi − xˆi )
1 n 2

n i =1
– Weighted MSE is also used:
d (X , Xˆ ) = ∑ wi (xi − xˆi )
1 n 2

n i =1 5

IMAGE COMPRESSION AND PACKET VIDEO

Other Distortion Metrics

■ MAE (Mean absolute


K
error)
1
d 2 ( x, xˆ i ) = ∑ x(m) − xˆi (m)
K m =1
■ ln holder norm 1
 K n n
d3 ( x , x$ i ) =  ∑ x (m) − x$i (m) 
 m =1 
[
d4 ( x , x$i ) = d3 ( x , x$i )]n

6
IMAGE COMPRESSION AND PACKET VIDEO

VQ Transmitter Diagram

Original
Image
X k
Form Image Minimize distortion Channel
Vectors d (X , Xˆ i )

Codebook
X i , i = 1,K , N c
ˆ

IMAGE COMPRESSION AND PACKET VIDEO

VQ Receiver Diagram

k Xk
Channel Table
Look-up

Codebook
Xˆ i , i = 1,K , N c

8
IMAGE COMPRESSION AND PACKET VIDEO

VQ and Clustering

■ VQ transforms the vectors of data into


indexes that represents clusters of vectors
Voroni Dia gra m
25 0

20 0

15 0

10 0

50

0
0 50 1 00 1 50 2 00 2 50
9

IMAGE COMPRESSION AND PACKET VIDEO

VQ Basics

■ After the minimum distortion codevector


has been found, the index k is transmitted
using log2Nc bits
■ VQ decoder uses a duplicate codebook and
a table lookup to reproduce the image
■ Compression is obtained by using a
codebook with relatively few codevectors
compared to the original image vectors.
10
IMAGE COMPRESSION AND PACKET VIDEO

VQ Basics

■ VQ can compress close to the rate distortion


curve for any bit rate
– Drawbacks include the need to increase the size
of the codebook for higher ratio’s of
compression and the extreme search time
required to find the minimal distortion code

11

IMAGE COMPRESSION AND PACKET VIDEO

Mathematics of Codebook Design


■ 8 bit image - Compressed to 1 bit per pixel
– If n = 4 (2x2 blocks), codebook should contain
only 16 vectors
– 16 vectors will represent 2564 possible image
vectors.
– If block size is increased to 4x4, the codebook
is 216 codevectors
– The total number of vectors is 25616
– Resulting mean-square quantization error
becomes smaller as the block size increases
» Number of codebook vectors increase
12
IMAGE COMPRESSION AND PACKET VIDEO

Linde-Buzo-Gray (LBG) Algorithm


■ Codebook is generated using a training set of
images
– Set is representative of the type of images that will
normally be compressed
■ Local Codebook:
– Data to be compressed is used for the training set
■ Disadvantages of Local Codebooks:
– For optimum results, need a codebook for every image
» Hard to do in real time
– Local Codebook must be transmitted to the receiver
» For 4x4 pixel blocks, 8 bit pixels, 1:8 compression, 210
codebook size, 512x512 image results in a 0.5 bit/pixel
overhead 13

IMAGE COMPRESSION AND PACKET VIDEO

Global Codebook Generation


■ Global Codebook can be generated using several
images as a training set.
■ The selection of the training set will dictate the
type of performance
– Where the type selection is not controlled well, need
to have a training set that has a wide selection.
■ The LBG algorithm is a generalization of the
Lloyd-Max algorithm.
■ The algorithm starts with a good initial codebook,
often found using other methods such as Pairwise
Nearest Neighbor (PNN). 14
IMAGE COMPRESSION AND PACKET VIDEO

LBG Algorithm

■ Start with:
– a set of training vectors
– initial codebook Xˆ i , i = 1,K, N c
– distortion measure d
– fractional distortion change threshold ε
■ Initialize:
– iteration counter l to 1
– average distortion over all training vectors, D(0)
to a very large number
15

IMAGE COMPRESSION AND PACKET VIDEO

LBG Algorithm

■ Minimum distortion rule defines the decision


region for each codevector Xˆ i(l ) , so that any
training vector enclosed by a particular decision
region is mapped to the corresponding Xˆ i(l ) .
■ Encode the training set by mapping each vector
in the training set to its nearest codevector.
■ Compute the average distortion D(l) resulting
from the encoding process
16
IMAGE COMPRESSION AND PACKET VIDEO

LBG Algorithm

■ If the fractional change in the average


distortion from the previous iteration is less
than or equal to the threshold
D (l −1) − D (l )
≤ε
D (l −1)
then the convergence has been achieved and
the algorithm terminates

17

IMAGE COMPRESSION AND PACKET VIDEO

LBG Algorithm

■ Update the codebook by replacing each


codevector X̂ i(l ) within a decision region by a
new codevector Xˆ i(l +1) that minimizes the
quantization error within that decision region.
■ For the MSE measure, the minimum distortion
vector is the average (centroid) of the training
vectors enclosed by that decision region

18
IMAGE COMPRESSION AND PACKET VIDEO

LBG Algorithm

■ Each component of the new codevector is


found by computing the mean of the
corresponding components of the training
vectors
■ set i=i+1 and go back to the previous step.
– While each iteration results in a nonincreasing
distortion, convergence may take many
iterations if ε is set too low.
– Terminate after maximum number of iterations
19

IMAGE COMPRESSION AND PACKET VIDEO

Distance Measures
■ Distance Measures can be of any form
■ Typical is the MSE:
k −1
d (x, xˆ ) = ∑ xi − xˆi
2

i =0

■ This can be improved by subtracting out the mean


of the block (zero mean data) and variance
■ All training vectors are compared against the
sample vector, and the smallest distortion vector is
selected
20
IMAGE COMPRESSION AND PACKET VIDEO

Centroid Calculation

■ The number of vectors that match the


training vector (come close) are counted,
and the matching vectors are added together
(for later averaging).
■ The average vectors replace the first guess
training vectors and the algorithm is rerun.
■ The min distortion for each block is
summed and divided by the number of
pixels
21

IMAGE COMPRESSION AND PACKET VIDEO

Centroid of an Image

■ A necessary condition for both fixing an


encoder and optimizing the decoder is the
centroid condition
■ Centroid is also called center of mass
■ The error is the smallest when the point is
the centroid of the object
1 1
m= ∑∑ m
N ( m ,n ) ∈R
n= ∑∑ n
N ( m ,n ) ∈R

22
IMAGE COMPRESSION AND PACKET VIDEO

Distortion Limit

■ The average distortion is compared against


the previous distortion, and if the delta limit
is found (less then minimum change),
algorithm stops.
■ If the limit is not reached, the old distortion
is replaced by the new distortion limit, and
the new distortion is recalculated.

23

IMAGE COMPRESSION AND PACKET VIDEO

Codebook Initialization

■ LBG algorithm relies on a good codebook


initialization
■ Can start with a smaller codebook and
recursively construct larger ones until the
desired size is reached
■ Methods:
– Random Codes (Gaussian or Laplacian)
– Splitting
– Pairwise Nearest Neighbor (PNN) clustering 24
IMAGE COMPRESSION AND PACKET VIDEO

Codebook Initialization

■ Random Codes
– Use a random initial codebook where the first Nc
vectors (or any widely spaced Nc vectors) of the
training set are chosen as the initial codebook.

25

IMAGE COMPRESSION AND PACKET VIDEO

Codebook Initialization

■ Splitting
– Centroid for the entire training set is found, and
this single codeword is then split (perturbed by
a small amount) to form two codewords
– LBG algorithm is applied to get an optimum
codebook of size 2
– design continues: optimum code of one stage is
split to form an initial code for the next stage
until Nc codevectors are generated.
26
IMAGE COMPRESSION AND PACKET VIDEO

Codebook Initialization

■ Pairwise Nearest Neighbor clustering


– Starting with N clusters, each containing one
training vector,
» the two closest vectors are merged to create the
optimal (N-1) cluster codebook
– Process is repeated until the number of clusters
equals Nc.
– Centroids of these clusters are then used as the
initial codebook
27

IMAGE COMPRESSION AND PACKET VIDEO

Pairwise Nearest Neighbor Design

■ Suppose the training sequence has L


vectors, each of which is considered to be a
separate cluster containing a single vector.
■ The goal will be to merge vectors together
into groups or clusters until the desired
number of vectors have been reached
■ The codebook will then contain the
centroids of these clusters
28
IMAGE COMPRESSION AND PACKET VIDEO

Pairwise Nearest Neighbor Design

■ NN Partition is computed as follows:


– First compute the distortion between all pairs of
vectors
– The two training vectors having the smallest
distortion are combined into a single cluster and
represented by their centroid
– Now have L-1 clusters, one containing two
vectors and the rest containing a single vector.
» Henceforth at each step clusters may have more than
one vector.
29

IMAGE COMPRESSION AND PACKET VIDEO

Pairwise Nearest Neighbor Design


■ Suppose now that we have K clusters with
N<K ≤ L-1 and we wish to merge two of the
clusters to get a good set of K-1 clusters.
■ Single Step Merging:
– For every pair of clusters drawn from the full
collection of K clusters, compute the increase in
average distortion resulting if the two centroids and
their clusters are replaced by the merged two clusters
and the corresponding centroid.
30
IMAGE COMPRESSION AND PACKET VIDEO

Pairwise Nearest Neighbor Design

■ Single Step Merging:


– Easier with squared error
– When the best pair of clusters for merging is
found, they are merged to form a codebook
with K-1 vectors.
– Continue this way until only N vectors remain.

31

IMAGE COMPRESSION AND PACKET VIDEO

Pairwise Nearest Neighbor Design

■ Each of K2 pairs of clusters consists of two


clusters of vectors Ri = {xi (l ); l = 1,2,K , Li }and
R j = {x j (l ); l = 1,2,K , L j }

■ The contribution of these two clusters to the


average distortion if they are not merged is:
Li Lj
∆ i , j = ∑ d ( xi (l ), cent ( Ri )) + ∑ d ( x j (l ), cent ( R j ))
l =1 l =1

32
IMAGE COMPRESSION AND PACKET VIDEO

Pairwise Nearest Neighbor Design

■ while the contribution if they are merged is

Li Lj
∆′i , j = ∑ d ( xi (l ), cent ( Ri ∪ R j )) + ∑ d ( x j (l ), cent ( Ri ∪ R j )) ≥ ∆ i , j
l =1 l =1

■ The pair of clusters Ri, Rj for which ∆’i,j-∆i,j


is the smallest is merged.

33

IMAGE COMPRESSION AND PACKET VIDEO

Example From Rao and Hwang

■ Codebook design starting with uniform


quantizer
– K=2 (Vector Dimension)
– M=4 (Codebook Size)
– N=12 (Number of Vectors in the training
sequence

34
IMAGE COMPRESSION AND PACKET VIDEO

Training Vectors
x1 = (-0.37, 0.99) x7 = (-0.6, 0.18)
x2 = (-0.64, -0.12) x8 = (0.14, 1.76)
x3 = (-0.83, 0.61) x9 = (0.71, -0.35)
x4 = (-0.71, -1.22) x10 = (0.3, 0.8)
x5 = (-0.29, -0.95) x11 = (0.3, 1.07)
x6 = (1.1, 0.52) x12 = (0.38, -0.33)

$0
Start with a uniform quantizer codebook A

S   S   S   S 
( x$1 , x$2 , x$3 , x$4 ) =  1  ,  2  ,  3  ,  4  ,
 2,2  2,−2  − 2,2  − 2,−2
35

IMAGE COMPRESSION AND PACKET VIDEO

Goal

■ Find P ( A$0 ) = [ S1 , S2 , S3 , S4 ] , where P ( A$0 ) is


the minimum distortion partition of the
training sequence corresponding to A$0 .
■ The distortion metric defined by MSE is
used.

36
IMAGE COMPRESSION AND PACKET VIDEO

LBG Example

x j ∈ Si , if d ( x j , x$i ) ≤ d ( x j , x$m )
for all m ≠ i
S1 = [ x6 , x8 , x10 , x11]
S2 = [ x2 , x9 ]
S3 = [ x1, x3 , x7 ]
S4 = [ x4 , x5 , x12 ]
Choose ε = 0.001
When [( Dm −1 − Dm ) / Dm ] ≤ ε , halt the iterative process.
Dm is the average distortion at stage m. 37

IMAGE COMPRESSION AND PACKET VIDEO

Starting Point of Algorithm


Set D−1 → ∞, m = 0, P ( A$0 ) = [ S1, S2 , S3 , S4 ]
(A) - Start m=0
of
1 12
algorithm The distortion D0 = ∑ min d ( x j , x$)
12 j =1 x$ ∈A$0
= 2.0172
[( D−1 − D0 ) / D0 ] > ε ; continue the process.
Find the optimal reproduction code.

38
IMAGE COMPRESSION AND PACKET VIDEO

New Codebook
x$( S1) = [( x6 + x8 + x10 + x11) / 4] = (0.46,104
. )
x$( S2 ) = [( x2 + x9 ) / 2] = (0.67,−0.23)
x$( S3 ) = [( x1 + x3 + x7 ) / 3] = ( −0.6,0.59)
x$( S4 ) = [( x4 + x5 + x12 ) / 3] = ( −0.46,−0.83)
This is the new codebook A$1.
If any Si = 0, just use the old codeword .
m=1
Find P ( A$1), this leads to P( A$1) = P ( A$0 ), go to begining
of process ( A)
39

IMAGE COMPRESSION AND PACKET VIDEO

Codebook Iteration

No changes in partition.
Compute D1 , the total distortion.
1 12
D1 = ∑ min d ( x j , xˆ ) = 0.1
12 j =1 xˆ∈Aˆ1
 2.02 − 0.1 
[( D0 − D1 ) / D1 ] =   = 19 > ε
 0 .1 
Set m = 2. Repeat the process from ( A).

40
IMAGE COMPRESSION AND PACKET VIDEO

Codebook Iteration

Find ( A$2 ), A$2 = xP


$ ( A$1) = A$1.
D2 = D1, [( D1 − D2 ) / D2 ] = 0 < ε
Halt . Final quantizer is described by [ A$1, P ( A$1)].
Codebook :
(0.46,1.04),(0.67,−0.23),( −0.6,0.59),( −0.46,−0.83)

41

IMAGE COMPRESSION AND PACKET VIDEO


Codebook Design - Tree Structured
Codebooks
■ Full search for the optimum codevector can be
performed at a cost of Ο(nN c )
■ The associated storage cost is nNc
■ This limits the size of the codebook due to
CPU constraints.

42
IMAGE COMPRESSION AND PACKET VIDEO
Codebook Design - Tree Structured
Codebooks

■ A tree structure can be imposed to improve


the search
– Each node has m branches and there are
p=logmNc levels to the tree.
– Reduces the computational cost to: Ο(nm log m N c )
since only certain branches of the tree are
examined.
– Storage cost rises to nm(Nc-1)/(m-1) since
vectors must be stored for every level.
43

IMAGE COMPRESSION AND PACKET VIDEO

Binary VQ Tree for Nc=8


Image Vector X

Intermediate Codevectors
ˆ (1) ˆ (1)
X (Level 1)
X 1
2

Intermediate
ˆ (2) ˆ (2) ˆ (2) ˆ (2) Codevectors
X
X 1
X 2 X 3
4
(Level 2)

ˆ (3)
X ˆ (3)
X ˆ (3)
X ˆ (3)
X ˆ (3)
X ˆ (3) ˆ (3)
X ˆ (3)
X
1 2 3 4 5 X 6 7 8

Final Codevectors
(Level 3)
44
IMAGE COMPRESSION AND PACKET VIDEO

Tree Structured Codebooks


■ Tree-structured codebooks can never perform
better than a single-level full search codebook
– Tree structure effectively limits the possible
codevectors once a particular branch has been
selected.
– Increasing the number of branches at each node,
performance can be improved and storage
requirements can be reduced.

45

IMAGE COMPRESSION AND PACKET VIDEO

Tree Structured Codebooks

Branches Number
Technique per node of nodes Computations Storage
Bi-tree 2 6 O(12n) 126n
Quad-tree 4 3 O(12n) 84n
Oct-tree 8 2 O(16n) 72n
Full Search 64 1 O(64n) 64n

46
IMAGE COMPRESSION AND PACKET VIDEO

VQ Tree Structures

■ VQ tree structures can also be designed


with a nonuniform number of branches at
each node
– Tapered Trees: Number of branches per node is
increased as one moves down the tree.
– Pruned Trees: A large initial tree is pruned by
removing codevectors so that the final tree
achieves a given average length with minimum
average distortion.
47

IMAGE COMPRESSION AND PACKET VIDEO

Codebook Product Codes

■ Codebooks based on product codes


(formed as the Cartesian product of several
smaller codebooks)
■ If a vector can be characterized by certain
independent features (such as magnitude
and orientation) then a separate codebook
can be devised to encode each feature.

48
IMAGE COMPRESSION AND PACKET VIDEO

Codebook Product Codes

■ The final codeword is the concatenation of


all the different encoder outputs
■ For two separate codebooks N1 and N2 for
orientation and magnitude
– Nc=N1N2 (effective size)
– Actual size = N1+N2

49

IMAGE COMPRESSION AND PACKET VIDEO

Mean/Residual VQ (M/RVQ)
■ M/RVQ represents a prediction type of compressor
■ Prediction is made for the original image from a
limited set of data
■ Residual image is formed by taking the difference
between the predicted and original image
■ Data used for the prediction is encoded using a
scalar quantizer
■ residual image is encoded using a Vector Quantizer
– Many image vectors exhibit similar variations about
different mean levels
50
IMAGE COMPRESSION AND PACKET VIDEO

Mean/Residual VQ (M/RVQ)

■ Original image is divided into nonoverlapping


blocks of size n (eg. n=4x4=16)
– mean is computed for each block
■ Block means are quantized using a scalar
quantizer (eg. 8 bits) and transmitted to the
receiver
– DPCM is also used to reduce the bit rate

51

IMAGE COMPRESSION AND PACKET VIDEO

Mean/Residual VQ (M/RVQ)

■ Quantized means are subtracted from the


corresponding image vectors to yield a
residual vector with zero mean
■ Residual vectors are quantized with VQ,
indices are transmitted
■ Reconstruction is performed by adding the
means to the decoded residual vectors

52
IMAGE COMPRESSION AND PACKET VIDEO

Mean/Residual VQ (M/RVQ)

Residual VQ address
+
Form Σ VQ
Vector
-
Mean Value
Mean

53

IMAGE COMPRESSION AND PACKET VIDEO

Interpolative/Residual VQ (I/RVQ)

■ Prediction image is formed by subsampling


and interpolating the original image
■ Similar to M/RVQ except subsampled
values are used instead of the mean values,
and interpolation (bilinear) is used rather
than replication.
■ I/RVQ reduces the blocking artifacts
■ I/RVQ gives somewhat better reconstructed
image quality
54
IMAGE COMPRESSION AND PACKET VIDEO

Interpolative/Residual VQ (I/RVQ)

■ Original image is subsampled by l (l=8) in each


dimension
– Subsampled value is quantized and transmitted to the
receiver
■ An approximation of the original image is
generated at both the receiver and transmitter by
expanding the quantized image back to the
original size.
– Residual image is formed
55

IMAGE COMPRESSION AND PACKET VIDEO

Interpolative/Residual VQ (I/RVQ)

■ The residual image is segmented into non-


overlapping blocks of size n (n=4x4=16) to
form vectors
■ Vectors are quantized using VQ and indices
are sent
■ Reconstruction is performed by adding the
residual vectors to the
subsampled/interpolated prediction image
56
IMAGE COMPRESSION AND PACKET VIDEO

Utah State MRVQ


■ Utah State approach is a Hybrid encoder
– Standard VQ with Lossless encoding of the residual
error
– Produce statistically lossless result
■ Can set the amount of error based on a criteria
– Utah State uses Percent Error in codebook design and
in error measurement
– Ideal for scientific data
■ High speed VLSI implementation designed
■ Partial tree search for high speed implementation
57

IMAGE COMPRESSION AND PACKET VIDEO

Utah State MRVQ

x -x x (m,n)
x (m,n) Lossy Lossless
Encoder
x
Σ Encoder
Data MUX

58
IMAGE COMPRESSION AND PACKET VIDEO

Utah State MRVQ-Lossless Encoder

Threshold, T Buffer
Threshold Level
Curve
Constant
FIFO Rate
Threshold Entropy
Encoder Buffer
Variable
Rate

59

IMAGE COMPRESSION AND PACKET VIDEO

Utah State MRVQ - Lossy Encoder

- Residual
+
Form Σ log VQ VQ-1 Σ
Vector
- VQ address
Mean
Mean Value

60
IMAGE COMPRESSION AND PACKET VIDEO

VQ Codebook 4x4x256

cod e b oo k

Codebook created by lbg.m (lab 7) - Training Set Lena.tif


61

IMAGE COMPRESSION AND PACKET VIDEO


VQ Source and Reconstructed Image
(4x4x256)

VQ S o urce Ima g e Ima ge VQ Re cons truct Ima g e

• Original Image also used as training set


• Gain/Shape VQ

62
IMAGE COMPRESSION AND PACKET VIDEO

8:1 VQ Reconstructed Image


Training Image VQ Reconstructed Image

RMS Error = 1.448439 Max Percent Error = 88.235295


Min Abs Error = 0 Ave Percent Error = 3.713866
Max Abs Error =20 Pixel Entropy in difference Image = 2.334410
63

IMAGE COMPRESSION AND PACKET VIDEO

VQ Example

■ Training Image

NITF13 Test Image (Scaled 0.5) 64


IMAGE COMPRESSION AND PACKET VIDEO

VQ Codebooks

Codebook - PNN Codebook LBG

Codebook based on 4x4 vector

65

IMAGE COMPRESSION AND PACKET VIDEO

8:1 VQ Reconstructed Image


Training Image VQ Reconstructed Image

RMS Error = 6.655984


Entropy of Original Image = 5.313548 bits/pixel
66
IMAGE COMPRESSION AND PACKET VIDEO

8:1 VQ Different Training Set


Original Image Reconstructed Image

RMS Error is 6.373438


Entropy of Original Image = 5.88991 bits/pixel
67

IMAGE COMPRESSION AND PACKET VIDEO

Gain/Shape VQ (G/S VQ)


■ Shape is the original image vector normalized
by the removal of the gain factor
– gain factor is the energy or variance of the
codevector
■ Image is divided into non-overlapping blocks
■ Unit energy shape codevector Yj is chosen to
match the image vector by maximizing the
inner product over all codevectors in the shape
codebook
68
IMAGE COMPRESSION AND PACKET VIDEO

Gain/Shape VQ (G/S VQ)

■ Given the shape codevector, a scalar gain


codeword σi is selected so as to minimize
the distortion between the image vector X
and the reproduction vector Xˆ = σ iY j
■ Indices of shape and gain codevectors are
sent to the receiver.
■ Reconstruction is performed by multiplying
the decoded shape and gain Xˆ = σ iY j
69

IMAGE COMPRESSION AND PACKET VIDEO

Classified VQ (CVQ)
■ A number of different codebooks are developed
– Each are designed to encode blocks of pixels that
contain a specific type of feature
■ The codebook used to encode a particular block is
determined by a classifier capable of
differentiating between different types of features
■ Assumption is made that numerous small code
books, each tuned to a particular class of vectors
can produce comparable quality to a single large
codebook
70
IMAGE COMPRESSION AND PACKET VIDEO

Classified VQ (CVQ)

■ Image is divided into non-overlapping


blocks
■ Each block is classified into one of M
classes using an edge oriented classifier.

71

IMAGE COMPRESSION AND PACKET VIDEO

Classified VQ (CVQ)

■ Example Classes:
– Shade Blocks (no significant gradient)
– Midrange Blocks (moderate gradient, no
definite edge)
– Horizontal edge blocks
– Vertical edge blocks
– 45 degree or 135 degree edge blocks
– Mixed Blocks (no discernible orientation)

72
IMAGE COMPRESSION AND PACKET VIDEO

Classified VQ (CVQ)

■ Each classified block is encoded using the


appropriate codebook
– Codebooks can be of different sizes
■ Index of the chosen codevector is sent to the
receiver and is used as an entry to a look-up
table.
– Each code is unique, no need to code each class
separately.

73

IMAGE COMPRESSION AND PACKET VIDEO

Finite-State VQ (FSVQ)
■ VQ with memory
■ Each state represents a separate codebook
■ Similar to CVQ
– Codebook selection is based on the next state function
rather than a block classifier
■ Next state function is a mapping of the current state
to another state with a new codebook
■ Adjacent blocks of pixels are often similar, and we
can use the correlation to pick the next codebook.
■ FSVQ works for small block sizes.
74
IMAGE COMPRESSION AND PACKET VIDEO

Finite-State VQ (FSVQ)

■ Image is divided into non-overlapping blocks


■ Given the inital state s0 and its associated
codebook Cs , encode the first image vector in
0

the sequence X0, by choosing an output


codevector Xˆ 0 ∈ Cs 0

– Transmit the index to the receiver


■ Use the next state function f(•), to determine the
next state, s1, based on the previous state and
output codevector s1 = f (s0 , Xˆ 0 )
75

IMAGE COMPRESSION AND PACKET VIDEO

Finite-State VQ (FSVQ)

■ Encode the next image vector X1, using the


codebook associated with state s1 and
transmit the index of the codevector
■ Encode the remaining image vectors in the
sequence by updating the state for each
vector and using the associated codebook

76
IMAGE COMPRESSION AND PACKET VIDEO

Finite-State VQ (FSVQ)

■ Since the next state is a function of the


previous state and the output codevector, it
is possible for the receiver to track the
changes of the codebooks without overhead
data.
■ Channel errors can cause problems
– Incorrect state information will be propagated
– Periodically need to reset the set
» Perceived as a overhead issue
77

IMAGE COMPRESSION AND PACKET VIDEO


JPEG-2000
Trellis Coded Quantization (TCQ)

■ Computationally efficient form of vector


quantization
■ Theoretical advantage is approximately 0.25
bits/pixel at high quality levels
■ Perceptual advantage often higher
■ Based on ideas of trellis coded modulation
■ Can be thought of as a time-varying scalar
quantizer.

78
IMAGE COMPRESSION AND PACKET VIDEO

Trellis Codes
■ Goal:
– Lossily compress data vectors of length n
– Desired compression Rate is R codebits per data sample
– k is a positive integer such that N = 2 kR is an integer
– n is a multiple of k
– m is a integer m = n
k
– S is a positive integer
– Pick any trellis with S states, m stages, and N outgoing
branches per state.
– Attach to each of the N outgoing branches from each state a
kR-bit address so that N branches have distinct labels.
79

IMAGE COMPRESSION AND PACKET VIDEO

Trellis Code Quantization


■ Each possible left-to-right path through the trellis
yields a possible vector into which the given
datavector can be quantized:
– One concatenates together the vector labels along the path
– To find a path yielding a quantization vector loses to X,
partition the datavector X into m datablocks of length k.
– For i=1,2,...,m, label each of the branches in the ith stage of
the trellis with a weight equal to the square of the distance
between the vector labelling that branch and the ith
datablock in X.
– Use Viterbi algorithm to find a left to right path through
the trellis. 80
IMAGE COMPRESSION AND PACKET VIDEO

Trellis Code Encoding and Decoding

■ The vector X̂ is encoded into the binary codeword


obtained by concatenating together the kR-bit
addresses along the optimal path
– One also has to attach to this codeword a log2S bit long
prefix telling the decoder the state where the optimal
path starts.
■ Decoding: From the codeword, the decoder
recovers the optimal path, and from this path the
decoder recovers X̂.

81

IMAGE COMPRESSION AND PACKET VIDEO


JPEG-2000
Trellis Coded Quantization (TCQ)

■ Each sample can be quantized using one of four


separate scalar quantizers.
– The allowable way of choosing among the scalar
quantizer for each sample is specified in the form of a
trellis.
■ Legal sequences of quantizers are specified by
walks through the trellis form left to right
– Some of the legal quantizer sequences of length two
(the ones starting from the upper left corner of the
trellis) are:
» D0,D0; D0, D2; D2, D1; D2,D3
82
IMAGE COMPRESSION AND PACKET VIDEO
JPEG-2000
Trellis Coded Quantization (TCQ)

83

IMAGE COMPRESSION AND PACKET VIDEO


JPEG-2000
Trellis Coded Quantization (TCQ)

■ The trellis depicts the codewords (or output


points) of the four scalar quantizers,
– named D0, D1, D2, D3
– Each point labeled by Di belongs to quantizer Di
■ The quantizer are chosen in the interlaced fashion
shown and satisfy a set of heuristic design rules.

84

Das könnte Ihnen auch gefallen