+ + + + +
1
0
) ( ) (
L
k
k r k avg
r p r l L
Arithmetic Coding (non block codes)
+ + +
m m
l l l
m m
m
m
m
m
a g
m l a a g
g g g g code Gray
a a a scale gray bit m
One-dimensional run-length coding
common approaches
(1) specify the first run of each row.
(2) assume that each run begins with a white run,
whose run-length may in fact be zero.
The black and white run lengths may be coded separately
using variable-length coding based on statistics. The
approximate run-length entropy is
Where 'H
0
' is the entropy of black run-length source and 'H
1
'
is the entropy of white runs. The variables 'L
0
' and 'L
1
' denote
the average values of black and white run lengths
respectively.
Additional compression can be realized by variable
length coding the run lengths, The above equation provides
an estimate of the average number of bits per pixel required
to encode the run length.
1 0
1 0
L L
H H
H
RL
+
+
Two-dimensional run-length coding -RAC (Relative address
coding)
Track the binary transition that begin and end each black
and white run. Require the adoption for a convention for
determining run values.
Lossy Compresssion
Lossy encoding is based on the concept of compromising
the accuracy of the reconstructed image in exchange for
increased compression.
Lossy encoding is based on the concept of compromising
the accuracy of the reconstructed image in exchange for
increased compression.
Lossy Compression:
1. Spatial domain methods
2. Transform coding
Transform Coding
The goal of the transformation process is to decorrelate the
pixels of each sub-image, or to pack as much information as
possible into the smallest number of transform coefficients .
(1) Adaptive transform coding: adaptive to local content
(2) Non-adaptive transform coding: fixed for sub-image
Depend on the reconstruction error that can be tolerated and
the computational resources available,
Include Discrete and inverse discrete transform
Fourier
Walsh-Hadmard
Discrete cosine transform
Most transform coding systems are based on the DCT
for its information packing ability and computational
complexity.
Forward kernel is Separable if:
Forward kernel is Symmetric if:
1 , , 1 , 0 , ) , , , ( ) , ( ) , (
1 , , 1 , 0 , ) , , , ( ) , ( ) , (
1
0
1
0
1
0
1
0
N y x v u y x h v u T y x f
N v u v u y x g y x f v u T
N
u
N
v
N
u
N
v
) , ( ). , ( ) , , , (
2 1
v y g u x g v u y x g
) , ( ). , ( ) , , , (
1 1 2 1
v y g u x g v u y x g g g
N vy ux j
N vy ux j
e v u y x h
e
N
v u y x g
/ ) ( 2
/ ) ( 2
) , , , (
1
) , , , (
+
+
Walsh-Hadamard Transform (WHT):
Discrete Cosin Transform (DCT):
Steps Involved In Transform based Coding
1. Dividing the image into sub-images of size 8x8
2. Representing each sub-image using one of the transforms
3. Truncating 50% of the resulting coefficients
4. Taking the inverse Transform of the truncated coefficients
'
]
]
]
+
]
]
]
1 , , 2 , 1
2
0
1
) (
2
) 1 2 (
cos
2
) 1 2 (
cos ) ( ) (
) , , , ( ) , , , (
N u for
N
u for
N
u where
N
v y
N
u x
v u
v u y x h v u y x g
DFT
r mse=1.28
WHT
r mse=0.86
DCT
r mse=0.68
DCT Advantages:
1. Implemented in a single integrated circuit (IC)
2. Packing the most information into the fewest
coefficients
3. Minimizing the block-like appearance (blocking
artifact).
Sub-image size selection
Images are subdivided so that the correlation
between sub-image is reduced to some acceptable
level.
As sub-image size increase, the level of
compression and computational complexity increase.
Bit allocation
Reconstruction error depends on the number and
relative importance of the transformed coefficients
that are discarded, as well as the precision.
the process of truncating, quantizing, and coding the
coefficients of a transformed image:
Zonal coding: the retained coefficients are selected
based on maximum variance
Thresholding coding: based on maximum
magnitude
The bit allocation process includes truncating,
quantizing, and coding the coefficients of a transformed sub-
image.
(1) Zonal coding
* Fixed number of bits / coefficient
Coefficients are normalized by their standard deviations and
uniformly quantized.
*Fixed number of bits is distributed among the coefficients
unequally.
* A quantizer such as an optimal Lloyed-Max is designed for
each coeff.:
- DC coeff. Is modeled by Rayleigh density func.
- The remaining coeff. Are modeled by Laplcian
or Gaussian.
(2) Threshold coding
Single global threshold
Different threshold for each subimage (N-Largest coding)
Threshold can be varied as a function of the location of
each coeff.
Wavelet Coding
Figure: A Wavelet Coding System: (a) Encoder (b)
Decoder
Figure:2-D Wavelet transform (a)Analysis Filter Bank
Figure:2-D Wavelet transform (a)Analysis Filter Bank
Like transform coding, wavelets pack most of the
important visual information into a small number of
coefficients, the remaining coefficients can be quantized
coarsely or truncated to zero with little image distortion.
One or more of the lossless coding methods Huffman,
arithmetic and bit-plane coding can be,incorporated into the
final symbol coding step. Decoding is accomplished by
inverting the encoding operations with the exception of
quantization, which cannot be reversed exactly.
The principal difference between the wavelet-based
system and the transform coding system is the omission of
the transform encoder's subimage processing stages.
Because wavelet transforms are both computationally
efficient and inherently local.
Wavelet selection impact directly the computational
complexity of the transforms and the system's ability to
compress and reconstruct images of acceptable error. The
mostly widely used expansion functions for wavelet-based
compression are the Daubechies wavelets and biorthogonal
wavelets.
Decomposition level selection is the another factor
affecting wavelet coding computational complexity and
reconstruction error. Since a P-scale fast wavelet transform
involves 'P' filter bank iterations, the number of operations in
the computation of the forward and inverse transforms
increases with number of decomposition levels.
Wavelet Selection
Table: Wavelet transform filter taps and zeroed coefficients
when the wavelet transforms below 1.5
Decomposition Level Selection
Table:Decomposition Level impact on wavelet coding the
512x512 image.