Professional Documents
Culture Documents
Approaches
Lossless
Information preserving Low compression ratios
Lossy
Not information preserving High compression ratios
Data Information
Data and information are not synonymous terms!
Data is the means by which information is conveyed. Data compression aims to reduce the amount of data required to represent a given quantity of information while preserving as much information as possible.
Ex2:
Ex3:
compression
Compression ratio:
Coding Redundancy
Code: a list of symbols (letters, numbers, bits etc.) Code word: a sequence of symbols used to represent a piece of information or an event (e.g., gray levels). Code word length: number of symbols in each code word
E ( X ) xP ( X x )
x
Example:
Interpixel redundancy
Interpixel redundancy implies that any pixel value can be reasonably predicted by its neighbors (i.e., correlated).
f ( x) o g ( x)
f ( x) g ( x a)da
autocorrelation: f(x)=g(x)
Example:
original
Psychovisual redundancy
The human eye does not respond with equal sensitivity to all visual information. It is more sensitive to the lower frequencies than to the higher frequencies in the visual spectrum.
Idea: discard data that is perceptually insignificant!
C=8/4 = 2:1
Measuring Information
What is the information content of a message/image?
What is the minimum amount of data that is sufficient to describe completely an image without loss of information?
Modeling Information
We assume that information generation is a probabilistic process.
Idea: associate information with probability! A random event E with probability P(E) contains:
Suppose that gray level values are generated by a random variable, then rk contains:
units of information!
E I (rk ) Pr( rk )
k 0
L 1
using
Entropy:
Redundancy (revisited)
Redundancy:
where:
Entropy Estimation
It is not easy to estimate H reliably!
image
16
Better than before (i.e., H=1.81 for original image) An even better transformation could be found since:
Mapper: transforms input data in a way that facilitates reduction of interpixel redundancies.
Quantizer: reduces the accuracy of the mappers output in accordance with some pre-established fidelity criteria.
Symbol encoder: assigns the shortest code to the most frequently occurring output values.
Fidelity Criteria
to
Lossless Compression
Optimal code (i.e., minimizes the number of code symbols per source symbol).
Huffman Coding/Decoding
Coding/decoding can be implemented using a look-up table. Decoding can be done unambiguously.
We start with the interval [0, 1) ; as the number of symbols in the message increases, the interval used to represent it becomes smaller. Smaller intervals require more information units (i.e., bits) to be represented.
Example
Encode 1 2 3 3 4
Example (contd)
The message 1 2 3 3 4 is encoded using 3 decimal digits or 3/5 = 0.6 decimal digits per source symbol.
The entropy of this message is:
Arithmetic Decoding
1.0 0.8 0.72 0.592 0.5728
4
0.8 0.72 0.688 0.5856 0.57152
3
0.4 0.56 0.624 0.5728 056896
Decode 0.572
2
0.2 0.48 0.592 0.5664 0.56768
3 3 1 2 4
1
0.0 0.4 0.56 0.56 0.5664
LZW Coding
A codebook (or dictionary) needs to be constructed.
Initially, the first 256 entries of the dictionary are assigned to the gray levels 0,1,2,..,255 (i.e., assuming 8 bits/pixel)
Initial Dictionary
Consider a 4x4, 8 bit image 39 39 126 126 39 39 126 126 39 39 126 126 39 39 126 126
Dictionary Location
Entry
0 1 . 255 -
0 1 . 255 39-39
-
- Is 39 in the dictionary? Yes - What about 39-39? No * Add 39-39 at location 256
Example
39 39 39 39 39 39 39 39 126 126 126 126 126 126 126 126 Concatenated Sequence: CS = CR + P
(CR) (P)
Decoding LZW
e.g., (0,1)(1,1)(0,1)(1,0)(0,2)(1,4)(0,2)
Lossy Compression
Transform the image into a domain where compression can be performed more efficiently (i.e., reduce interpixel redundancies).
~ (N/n)2 subimages
Transform Selection
K << N
K-1 K-1
Inverse
if u=0 if u>0
if v=0 if v>0
DCT (contd)
Set of basis functions for a 4x4 image (i.e., cosines of different frequencies).
DCT (contd)
DFT
Using 8 x 8 subimages
WHT
DCT
1.78
1.13
DCT (contd)
DCT reduces "blocking artifacts" (i.e., boundaries between subimages do not become very visible).
DCT (contd)
DCT reduces "blocking artifacts" (i.e., boundaries between subimages do not become very visible).
DFT
i.e., n-point periodicity gives rise to discontinuities!
DCT
i.e., 2n-point periodicity prevents discontinuities!
DCT (contd)
original
2 x 2 subimages
4 x 4 subimages
8 x 8 subimages
JPEG Compression
Accepted as an international image compression standard in 1992. It uses DCT for handling interpixel redundancy.
Modes of operation:
(1) Sequential DCT-based encoding (2) Progressive DCT-based encoding (3) Lossless encoding (4) Hierarchical encoding
JPEG Compression
(Sequential DCT-based encoding)
Entropy encoder
Entropy decoder
JPEG Steps
1. Divide the image into 8x8 subimages;
For each subimage do: 2. Shift the gray-levels in the range [-128, 127]
- DCT requires range be centered around 0
Example
[-128, 127]
(non-centered spectrum)
JPEG Steps
4. Quantize the coefficients (i.e., reduce the amplitude of coefficients that do not contribute a lot).
Example
Quantization Table Q[i][j]
Example (contd)
Quantization
Example
DC
AC
end of block
SIZE: # bits for encoding the amplitude of coefficient RUN-LENGTH: run of zeros preceding coefficient
If RUN-LENGTH > 15, use symbol (15,0) , i.e., RUN-LENGTH=16
DC Coefficients Encoding
symbol_1 (SIZE) symbol_2 (AMPLITUDE)
predictive coding:
1 SIZE11 (4 bits)
[-211, 211-1]=[-2048, 2047] (12 bits)
AC Coefficients Encoding
Symbol_1
(Variable Length Code (VLC))
Symbol_2
(Variable Length Integer (VLI))
(1,4)(12) (111110110
VLC
1100)
VLI
Effect of Quality
(8k bytes)
lower quality,
highest compression
(21k bytes)
(58k bytes)
higher quality, lowest compression
Error
The standard employs a discrete wavelet transformbased algorithm (Wavelet/Scalar Quantization or WSQ).
Memory Requirements
FBI is digitizing fingerprints at 500 dots per inch with 8 bits of grayscale resolution. A single fingerprint card turns into about 10 MB of data!
The "white" spots in the middle of the black ridges are sweat pores Theyre admissible points of identification in court, as are the little black flesh islands in the grooves between the ridges
The fine details are pretty much history, and the whole image has this artificial blocky pattern superimposed on it.
The fine details are preserved better than they are with JPEG.
NO blocking artifacts!
WSQ Algorithm
This target bit rate is set via a knob on the WSQ algorithm.
i.e., similar to the "quality" parameter in JPEG compression
JPEG Modes
JPEG supports several different modes
Sequential Mode Progressive Mode Hierarchical Mode Lossless Mode
Progressive JPEG
The image is encoded in multiple scans, in order to produce a quick, rough decoded image when transmission time is long.
Sequential
Progressive
Example
Example
Example
after 0.9s after 1.6s
after 3.6s
after 7.0s
Hierarchical JPEG
Hierarchical mode encodes the image at different resolutions. Image is transmitted in multiple passes with increased resolution at each pass.
N/4 x N/4
N/2 x N/2
NxN