You are on page 1of 19



The coding techniques which operate directly on the

pixels of an image are the spatial domain methods.
The coding is known as waveform coding.
The coding techniques which are based on modifying
the transform of an image is known as transform
In transform coding a reversible linear transform is
used to map the image into a set of transform
coefficients which are then quantized and coded.

A Transform coding System

Important Steps in Transform Coding

Transform selection

The transform which packs most of the information in

the smallest number of transform coefficients is
selected to achieve the best compression.

Sub section selection

The sub section size which will reduce the

reconstruction error and the computational complexity
is selected.
For image data, sub image size of 8 or 16 is common.
Larger sub image sizes increases the blocking artifacts.
For speech data a block of 10 to 20msec is selected for

Important Steps in Transform Coding

Bit allocation:

The reconstruction error depends on the number and

relative importance of the transform coefficients that are
discarded and the precision used to represent the
retained coefficients.

The overall process of truncating, quantizing and coding

the coefficients of the transformed sub image is called
bit allocation.

Quantization and Coding of

Transform coefficients

If the amount of information conveyed by each

coefficient is different, it makes sense to assign
differing numbers of bits to the different coefficients.
There are two approaches to assign bits
One approach relies on the average properties of the
transform coefficients, while the other approach assigns
bits as needed by individual transform coefficients

Quantization and Coding of

Transform coefficients

In the first approach, we first obtain an

estimate of the variances of the transform

On the basis of maximum variance Zonal coding

On the basis of maximum magnitude Threshold coding

These estimates can be used by one of two

algorithms to assign the number of bits used
to quantize each of the coefficients

Zonal Coding
We assume that the relative variance of the coefficients
corresponds to the amount of information contained in each
Thus, coefficients with higher variance are assigned more bits
than coefficients with smaller variance.
Let us find an expression for the distortion, then find the bit
allocation that minimizes the distortion.
To perform the minimization we will use the method of

Zonal Coding

To find the number of bits to be allotted:

If the average number of bits per sample to be used

by the transform coding system is R, and the average
number of bits per sample used by the kth coefficient
is Rk then

M No: of transform coefficients.

Zonal Coding

The reconstruction error variance for the kth quantizer

rk2 is related to the kth quantizer input variance k2

k - factor that depends on the input distribution and the


The total reconstruction error is given by,

Zonal Coding

So we need to find Rk to minimize the error at

the same time keeping the average number of
bits to R. Assuming that k is a constant for all
k, we can set up the minimization problem in
terms of Lagrange multiplier as,

Zonal Coding

Taking the derivative of J with respect to R k and

setting it equal to zero we can obtain the
expression for Rk as

Substituting for Rk in equation (1), we get the

value of as,

Zonal Coding

Now substituting this expression for in the equation

for Rk, we obtain

The values obtained for Rk will not be positive

integers. So the standard approach is to set the
negative Rk s to zero. This will increase the average bit
rate above R. Therefore the non zero Rk s are
uniformly reduced until the average rate is equal to R.

Threshold Coding

The underlying principle is that for any sub image, the

transform coefficients of largest magnitude make the
most significant contribution to reconstructed sub image

After applying the threshold masks the resulting nxn

array is reordered in a zigzag fashion and is run length
encoded. And variable length coding is done to the
resulting sequence.

Threshold Coding

There are three ways to threshold the

transformed image,

A single global thresholding can be applied to all

sub images.
A different threshold can be applied for each sub
The threshold can be varied as a function of
location of each coefficient within the sub image.

Threshold Coding

Usually the third method is used, where the

thresholding and quantization is implemented using a
single equation,
T (u , v)

T (u, v) round


T (u , v) thresholde d and quantized approximat ion of T (u, v).
Z (u , v) element of the transform normalization array.

Threshold Coding