Dictionary Coding
Dictionary Coding
Introduction to Image Compression Department of CSE, ISM Dhanbad August 22, 2019 1
Dictionary Coding
Construct a list of commonly occurring patterns and
encode these patterns by transmitting their index in
the list
In general, dictionary-based techniques works well for
highly correlated data (e.g. text), but less efficient for
data with low correlation (e.g. i.i.d. sources)
Introduction to Image Compression Department of CSE, ISM Dhanbad August 22, 2019 2
Motivation behind Dictionary Coding
Consider an ‘English’ source with 26 letters & six punctuation
marks
Single-symbol FLC, fixed-length encoding: 5 bps
Introduction to Image Compression Department of CSE, ISM Dhanbad August 22, 2019 3
Categorization of Dictionary-Based Coding
The heart of dictionary coding is the
formulation of the dictionary.
A successfully built dictionary results in data
compression; the opposite case may lead to
data expansion.
According to the ways in which dictionaries are
constructed, dictionary coding techniques can
be classified as static or adaptive.
Introduction to Image Compression Department of CSE, ISM Dhanbad August 22, 2019 16
LZ78 Algorithm
LZ78 are developed to maintain a dictionary that allow
patterns to remain as entries permanently during the
whole encoding process.
LZ78 Output:
Introduction to Image Compression Department of CSE, ISM Dhanbad August 22, 2019 17
Example: LZ78 Compression
Encode (i.e., compress) the string ABBCBCABABCAABCAAB
using the LZ78 algorithm.
ABBCBCABABCAABCAAB
Introduction to Image Compression Department of CSE, ISM Dhanbad August 22, 2019 18
Example: LZ78 Compression
Encode (i.e., compress) the string ABBCBCABABCAABCAAB
using the LZ78 algorithm.
ABBCBCABABCAABCAAB
Introduction to Image Compression Department of CSE, ISM Dhanbad August 22, 2019 19
Example: LZ78 Compression
Encode (i.e., compress) the string ABBCBCABABCAABCAAB
using the LZ78 algorithm.
ABBCBCABABCAABCAAB
B is in the Dictionary.
BC is not in the Dictionary; insert it.
Introduction to Image Compression Department of CSE, ISM Dhanbad August 22, 2019 20
Example: LZ78 Compression
Encode (i.e., compress) the string ABBCBCABABCAABCAAB
using the LZ78 algorithm.
ABBCBCABABCAABCAAB
Introduction to Image Compression Department of CSE, ISM Dhanbad August 22, 2019 22
LZ78 Decompression
Introduction to Image Compression Department of CSE, ISM Dhanbad August 22, 2019 25
Introduction to LZW
Introduction to Image Compression Department of CSE, ISM Dhanbad August 22, 2019 27
Example: Compression using LZW
BABAABAAA
BABAABAAA
BABAABAAA
BABAABAAA
Introduction to Image Compression Department of CSE, ISM Dhanbad August 22, 2019 35
Example: Decoding using LZW