Multimedia Data Compression: 1 IT 3rd Year, Compiled by Waggari M
Multimedia Data Compression: 1 IT 3rd Year, Compiled by Waggari M
m m
M’ M
Uncompress Uncompress
M M’
• Dictionary-based coding
–The previous algorithms (both entropy and Huffman) require the
statistical knowledge which is often not available (e.g., live audio,
video).
–Dictionary based coding, such as Lempel-Ziv (LZ) compression
techniques do not require prior information to compress strings.
• Rather, replace symbols with a pointer to dictionary entries
• The resulting tree has a prob. of 1 in its root and symbols in its
leaf node. IT 3rd year, compiled by Waggari M 19
Example
• Consider a 7-symbol alphabet given in the following
table to construct the Huffman coding.
Symbol Probability
a 0.05
• The Huffman encoding
b 0.05
algorithm picks each time two
c 0.1
symbols (with the smallest
d 0.2 frequency) to combine
e 0.3
f 0.2
g 0.1
IT 3rd year, compiled by Waggari M 20
Huffman code tree
1
0 1
0.4 0.6
0
0 1 1
0.3 e
d f 0 1
0.2
0 1
g
0.1 c
0 1
a b
0 0 1 1 1
0 1 0 1 1
0 1
Symbol Coding
A 00
B 01
C 10
D 110
E 111 IT 3rd year, compiled by Waggari M 23
Lempel-Ziv compression
•The problem with Huffman coding is that it requires
knowledge about the data before encoding takes place.
–Huffman coding requires frequencies of symbol occurrence
before codeword is assigned to symbols
•Lempel-Ziv compression:
–Not rely on previous knowledge about the data
–Rather builds this knowledge in the course of data
transmission/data storage
–Lempel-Ziv algorithm (called LZ) uses a table of code-words
created during data transmission;
•each time it replaces strings of characters with a reference to a
previous occurrence of the string.
IT 3rd year, compiled by Waggari M 25
Lempel-Ziv Compression Algorithm
Lempel-Ziv Output: there are three options in assigning a
code to each symbol in the list
• If one-symbol pattern is not in dictionary, assign (0, symbol)
• If multi-symbol pattern is not in dictionary, assign
(dictionaryPrefixIndex, lastPatternSymbol)
• If the last input symbol or the last pattern is in the dictionary,
asign (dictionaryPrefixIndex, )
1. Aaababbbaaabaaaaaaabaabb
2. ABBCBCABABCAABCAAB
3. SATATASACITASA.