lossy compression algorithms
TRANSCRIPT
-
7/29/2019 Lossy Compression Algorithms
1/18
Lossy Compression
AlgorithmsThe lossless compression algorithms like Huffmancoding, dictionary based coding, arithmetic coding etc
are mainly used to compress text
When it comes to a huge data arrangement like images,speech, video etc., these algorithms fail to provide
sufficient compression in the data
The term Lossy indicates that there is a loss of
information (mostly intentional) while encoding the data,which is mostly unnoticeable by the human eyes
-
7/29/2019 Lossy Compression Algorithms
2/18
Distortion Measure
A distortion measure is a mathematicalquantity that specifies how close is an
approximation to its original, using some
distortion criteria
Difference between original and
approximated data?
In Images Perceptual distortion is
important and not the numerical distortion
-
7/29/2019 Lossy Compression Algorithms
3/18
Numerical distortion measures
Mean Squared Error2 = (1/N) n=1
N (xn - yn)2
(Average Pixel Difference)
Signal to Noise RatioSNR = 10 log (x2 / 2)
(Size of error w.r.t the Input signal)
Peak Signal to Noise RatioPSNR = 10 log (xpeak
2 / 2)
(Size of error w.r.t peak value of input signal)
-
7/29/2019 Lossy Compression Algorithms
4/18
Rate Distortion theory
Lossy compression =
Trade off between
Rate and Distortion
R specifies the ratefor given distortion
When D = 0, the bit
rate is maximum and
follows lossless
compression
-
7/29/2019 Lossy Compression Algorithms
5/18
Quantization A Basic Lossy
scheme
Depending on whether the input is scalar
or vector, we have Scalar Quantization
(SQ) and Vector Quantization (VQ)
When input source is uniformly distributed,
an Uniform Quantizer (UQ) can be used
-
7/29/2019 Lossy Compression Algorithms
6/18
Non Uniform SQ
Here smaller step size is used where the
signal occurs predominantly and enlarged
step size is used where signal sparsely
occurs
Two common approaches Lloyd Max Quantizer
Companding
-
7/29/2019 Lossy Compression Algorithms
7/18
Lloyd-Max Quantizer
Begin
Choose initial level set (y0,y1)
i = 0;
RepeatCompute bi using its equation
i=i+1
Compute yi using its equationUntill |yi yi-1| <
End
-
7/29/2019 Lossy Compression Algorithms
8/18
Companding
In companded qunatization, input is
mapped by compressor function C(x)
Then it is quantized by an uniform
quantizer
After Transmission the quantized values
are mapped back using an expander
function C-1(x)
-
7/29/2019 Lossy Compression Algorithms
9/18
Vector Quantization
Encoding of frequently occurring words inEnglish like the or and etc. providebetter compression than encoding each
letters t h e a o etc The same concept can be extended to
speech, images as segments in speech ora collection of pixels in image and thesegroups of samples are called asVECTORS
-
7/29/2019 Lossy Compression Algorithms
10/18
Vector Quantization
A compression system performs better if itis operated in a group of vectors(collection of data)
VQ is same as SQ but extended to
multiple dimensions In VQ an n-component code vector
represents vectors that lie within a region
in n dimensional vector space. A collectionof these code vectors form the codebookfor the vector quantizer
-
7/29/2019 Lossy Compression Algorithms
11/18
Basic VQ procedure
-
7/29/2019 Lossy Compression Algorithms
12/18
Transform Coding
In case of data like speech and images, the
different bit encoding should not be done to
highly correlated samples. But however, majority
of the samples are correlated to each other! Eg in text : THINK and THING, THROUGH and
THOUGH, MIGHT and FIGHT
Transform coding helps in removal of these
correlation, so that effective encoding can be
done
-
7/29/2019 Lossy Compression Algorithms
13/18
Transform Coding
Let X =[x1,x2,x3..xk]T be vector of samples
X -> T{x} -> Y -> T-1{x} -> X
Y is the resultant of linear transformation of X
and vector Ys elements are made lesscorrelated, so that the encoding is done better
Less correlated = More Othogonal
Transform T itself doesnt compress the data, ithelps the compression algorithm to perform
better (Better compression ratio)
-
7/29/2019 Lossy Compression Algorithms
14/18
Discrete Cosine Transform
Definition (DFT?) In Fourier Analysis, any signal can be represented in
terms of its Sine and Cosine components at variousamplitudes and freqeucies
For instance if we take the signal as an electrical signal,the process of determining the amplitudes of AC and DCcomponents of the signal is called as Cosine Transformand in particular if the indices are integers, it is called asDCT
From definition if u=0, it gives the DC component andwhen u=1,2 it gives the first, second ACcomponents
The IDCT is reconstruction of original signal from theseDC and AC components
-
7/29/2019 Lossy Compression Algorithms
15/18
DCT (Continued)
For the 1D DCT defined, there will be a
set of 8 different basis functions and their
coefficent matrix is as shown
-
7/29/2019 Lossy Compression Algorithms
16/18
Characteristics of DCT
DCT produces frequency spectrum F(u) correspondingto the spatial signal f(i)
The first coefficient is the DC component of the signal,which gives the average magnitude of the signal
The other seven AC components (basis functions) havecharacteristics like the first component completes halfcycle, second completes one cycle, third completes oneand half seventh completes three and half cycles
DCT coefficients can also take negative values (Forimage DC component is always positive)
DCT is a linear Transformation
DCT (pA + qB) = p DCT(A) + q DCT(B)
-
7/29/2019 Lossy Compression Algorithms
17/18
Two Dimensional 8x8 DCT
-
7/29/2019 Lossy Compression Algorithms
18/18
Comparision between DCT and DFT
The DFT coefficients will be exponential
values
By using Eulers formula,
eix = cos x + isin x
We can guess that DCT is likely a
transform that forms the real part of DFT