Multimedia Data Compression
Multimedia Data Compression
Chapter TWO
Multimedia Data Compression
1
2.1 LOSSLESS AND LOSSY COMPRESSION
• Compression: the process of coding that will effectively reduce the
total number of bits needed to represent certain information.
H (S ) pi log 2 1
i1 pi
n
pi log2 pi
i1
1
• log2 pi – indicates the amount of information contained in si, which
corresponds to the number of bits needed to encode si.
• The definition of entropy is aimed at identifying often-occurring
symbols in the datastream as good candidates for short codewords in
the compressed bitstream.
• We use a variable-length coding scheme for entropy coding—
frequently occurring symbols are given codes that are quickly
transmitted, while infrequently occurring ones are given longer codes.
• For example, E occurs frequently in English, so we should give it a
shorter code than Q, say.
• If we use to denote the average length (measured in bits) of the
codewords produced by the encoder, the Shannon Coding Theorem
states that the entropy is the best we can do (under certain
conditions):
5. Remove these two minimum frequencies from Q and add the sum
into the list of frequencies (* denote the internal nodes in the figure
above).
6. Insert node z into the tree.
7. REPEAT STEPS 3 TO 5 FOR ALL THE CHARACTERS.
(a) (b)
8. FOR EACH NON-LEAF NODE, ASSIGN 0 TO THE
LEFT EDGE AND 1 TO THE RIGHT EDGE.
• For sending the above string over a network, we have to send the
tree as well as the above compressed-code. The total size is given by
the table below.
• Without encoding, the total size of the string was 120 bits. After
encoding the size is reduced to 32+15+28 = 75 bits.
Decoding the code
•For decoding the code, we can take the code and traverse through the
tree to find the character.
•Let 101 is to be decoded, we can traverse from the root as in the figure
below.
2.4 ADAPTIVE CODING
31