MT Notes
MT Notes
MODULE 3
SYLLABUS
Introduction, Compression principles, text compression, image Compression.
3.1 Introduction
Compression is generally applied in multimedia communication to reduce the volume
of information to be transmitted or to reduce the bandwidth that is required for its
transmission.
Compression is applied to reduce the volume of information to be transmitted-text,
fax and images-or to reduce the bandwidth that is required for its transmission-speech,
audio and video.
3.2 Compression principles
Compression algorithms are based on the following compression principles:
Figure 3.1 Source encoder/ destination decoder alternatives: (a) software only; (b) special
processors/hardware.
Lossless compression is therefore said to be reversible.
An example application of lossless compression is for the transfer over the network of a text file since
no part of the source information is lost during either the compression or decompression operations.
The main aim of lossy compression algorithm, is normally not to reproduce the exact copy
of the source information after decompression but, a rather a version of it.
Example applications of lossy compression are for the transfer of digitized images and audio and
video streams
3.2.3 Entropy encoding
Entropy encoding is lossless and independent of the type of the information that is being compressed.
Examples of entropy encoding:
1. Run-length encoding and 2. Statistical encoding.
3.2.3.1 Run-Length Encoding
Typical applications of this type of encoding are when the source information comprises long
substrings of the same character or binary digit.
Instead of transmitting source string in the form of independent codewords or bits, it is transmitted in
the form of different set of codewords which indicate:
1. Particular character or bit being transmitted and
2. Number of characters/bits in the substring.
Destination knows the set of codewords being used; it simply interprets each codeword received and
outputs the appropriate number of characters or bits. For example, in an application that involves the
transmission of long strings of binary bits that comprise a limited number of substrings, each substring
can be assigned a separate codeword.
Figure 3.2 Transform coding: (a) example pixel patterns; (b) DCT transform
principles
An example of a Huffman code tree and tree derivation is shown in Figure 3.3(a) and
(b). This corresponds to the string of characters AAAABBCD.
As each branch divides, a binary value of 0 or 1 is assigned to each new branch: a
binary 0 for the left branch and a binary 1 for the right branch.
Figure 3.3 Huffman code tree construction: (a) final tree with codes; (b) tree derivation
3.3.2 Dynamic Huffman coding
The basic Huffman coding method requires both the transmitter and the receiver to
know the table of codewords relating to the data being transmitted.
With dynamic Huffman coding, the transmitter (encoder) and receiver (decoder) build
the Huffman tree and hence the codeword table dynamically as the characters are
being transmitted/received.
With this method, if the character to be transmitted is currently present in the tree its
codeword is determined and sent in the normal way.
Figure 3.4 Decoding of a received bit stream (a) Decoding algorithm (b) example
For each subsequent character, the encoder first checks whether the character is
already present in the tree.
If it is, then the encoder sends the current codeword for the character in the normal
way, the codeword being determined by its position in the tree followed by the
uncompressed codewords for the character.
The encoder and decoder proceed to update their copy of the tree based on the last
character that has been transmitted/received.
If it is a new character, the existing empty leaf node in the tree is replaced with a new
branch node.
Figure 3.5 LZW compression algorithm: (a) basic operation; (b) dynamically extending the
number of entries in the dictionary
Figure 3.6 GIF compression principles; (a) basic operational mode; (b) dynamic mode
using LZW coding
1 000111 1 010
62 00110011 62 000001100110
63 00110100 63 000001100111
Figure 3.8 ITU-T group 3 and 4 facsimile conversion codes: (a) termination-codes, (b) make-up codes.
Modified READ also known as 2D or two dimensional coding identifies black and white run-lengths
by comparing adjacent scan lines. READ stands for relative element address designate.
With MMR coding the run-lengths associated with a line are identified by comparing the line
contents, known as the coding line (CL), relative to the immediately preceding line, known as the
reference line (RL).
The run length associated with a coding line as one of three possibilities or modes relative to the
reference line as shown in Figure 3.9.
The three possibilities are :
Figure 3.9 Some examples run-length possibilities (a) pass mode (b) vertical mode (c)
horizontal mode
3.4.5 JPEG
Lossy sequential mode or baseline mode is intended for the compressor of both
monochromatic and color digitized pictures.
There are five main stages associated with this mode:
i. Image/block preparation
ii. Forward DCT
Figure 3.11 Image /block preparation: (a) image preparation, (b) block preparation
A number of points are considered from the above expression:
1. All 64 values in the input matrix P[x,y] contribute to each entry in the transformed
matrix F[i,j].
3.4.5.3. Quantization
The main source of information loss occurs during the quantization and entropy
encoding stages where the compression takes place.
The quantization process aims to reduce the size of the DC and AC coefficients so
that less bandwidth is required for their transmission.
The sensitivity of the eye varies with spatial frequency, which implies that the
amplitude threshold below which the eye will detect a particular spatial frequency
also varies.
Therefore, the threshold values used vary for each of the 64 DCT coefficients.
These are held in a two-dimensional matrix known as the quantization table.
The JPEG standard includes two default quantization table value-one for use with
the luminance coefficients and the other for use with the two sets of chrominance
coefficients.
The quantization table is shown in Figure 3.13.
A number of points from the values shown in the tables.
Figure 3.14 Vectoring using zigzag scan: (a) principle; (b) vector representation.
On receipt of the encoded bit stream the frame decoder first identifies the control
information and tables within the various headers.
It then loads the contents of each table into the related table and passes the control
information to the image builder.
It then starts to pass the compressed bit stream of the Huffman decoder which carries
out the corresponding decompression operation using either the default or the
preloaded table of codewords.
The two decompressed streams containing the DC and AC coefficients of each block
are then passed to the differential and run-length decoders respectively.
The resulting matrix of values is then dequantized using either the default or the
preloaded values in the quantization table.
Each resulting block of 8x8 spatial frequency coefficients is passed in turn to the
inverse DCT which transforms them back into their spatial form using the expression:
Finally, as with the GIF, it is also possible to encode and rebuild the image in a
progressive way by first sending an outline of the image and then progressively
adding more detail to it. This can be achieved in the following ways:
i. Progressive mode: In this mode, first the DC and low- frequency coefficients
of each block are sent and then the higher-frequency coefficients.
ii. Hierarchical mode: In this mode, the total image is first sent using a low
resolution then at a higher resolution.
Question bank
1. Explain the meaning of the following terms, relating to compression:
a. Lossless and lossy compression
b. Source and entropy encoding (Dec 2010 4M)
2. With a aid of a diagram, identify the five main stages of operation of JPEG and
explain each stage briefly. (Dec 2010 10M)
3. Code the given string “ABACADABACADABACABAB” using Huffman coding.
Derive Huffman code tree. Determine the savings in transmission bandwidth over
normal ASCII and binary coding (Dec 2010 6M, Jun 2012 6M)
4. Explain with a neat diagram JPEG encoder (Dec 2015 10M, jun 2011 10M,jan 2016
10M)
5. Encode the string went comprising characters with probability of e=0.3, n=0.3,
t=0.5,w=0.1, .=0.1 using arithmetic coding (Dec 2015 10M)
6. Explain clearly about image encoding and decoding methods with diagram (jun 2015
14M)
7. Explain Huffman coding procedure for encoding any given data. (jun 2015 6M)