Mmultimedia 3
Mmultimedia 3
Multimedia
Information
Systems (MMIS)
Daniel T.
@DanTeklu
INSY4111 [email protected]
.
Chapter 3
Multimedia Data
compression
INSY4111
The Need for Compression
m m
M M’
Uncompress Uncompress
M M’
⚫Lossless Compression
– Lossless compression can recover exact original data
after compression.
– It is used mainly for compressing database records,
spreadsheets, texts, executable programs, etc., where
exact replication of the original data is essential &
changing even a single bit cannot be tolerated.
– Examples: Run Length Encoding, Lempel Ziv (LZ),
Huffman Coding.
⚫Lossy Compression
– Result in a certain loss of accuracy in exchange for a
substantial increase in compression.
– For visual & audio data, some loss of quality can be
tolerated without losing the essential nature of the
data where losses outside visual or aural perception
can be tolerated.
⚫ By taking advantage of the limitations of the human sensory
system, a great deal of space can be saved while producing an
output which is nearly indistinguishable from the original.
⚫ In audio compression, for instance, non-audible (or less
audible) components of the signal are removed.
⚫Lossy Compression
–A sound file in WAV format, converted to a MP3 file
will lose much data
– MP3 employs a lossy compression; resulting in a file
much smaller so that several dozen MP3 files can fit
on a single storage device, vs. a handful of WAV files.
– However, the sound quality of the MP3 file will be
slightly lower than the original WAV
⚫Example:
WWWWWWWWWWBWWWWWWWW
WBBBWWWWWWWWWWWW
⚫If we apply the run-length encoding (RLE) data
compression algorithm, the compressed code is :
– 10W1B9W3B12W (Interpreted as ten W's, one B, nine
W's, three B's, …)
⚫It
is used in fax machines (combined with
Modified Huffman coding).
ASCII Code
18
How do you Write “Æ ¥” in your
keyboard ?
⚫Statistical methods:
– Itrequires prior information about the occurrence of
symbols
– Estimate probabilities of symbols,
⚫ code one symbol at a time,
⚫ shorter codes for symbols with high probabilities
– Requires two passes:
⚫ One pass to compute probabilities (or frequencies) and
determine the mapping,
⚫ A second pass to encode.
– E.g. Huffman coding and Shannon-Fano coding
⚫Dictionary-based coding
– Do not require prior information to compress strings.
– Don't require a first pass over the data to calculate a
probability model
– All of the adaptive methods are one-pass methods;
only one scan of the message is required.
– Rather, replace symbols with a pointer to dictionary
entries
– Example: Lempel-Ziv (LZ) & Adaptive Huffman
Coding compression techniques
• Fixed Length
• Variable length
0 1 Code of:
D4 D1 = 000
0 1
D2 = 001
1 D3 D3 = 01
0
D4 = 1
D1 D2
26 MMIS (Comp. by Daniel T.)
Huffman coding
⚫ Consider
the following table to construct the
Huffman coding.
VWVWWXYZYZXYZYZYXZYW
⚫ Given text:
– ABRACADABRA
– MISSISSIPPI
– Construct the Variable Length Huffman coding?
⚫Solution:
Symbol A B C D E
Count 15 7 6 6 5
0 0 1 1 1
0 1 0 1 1
0 1
A 15 00 30
B 7 01 14
C 6 10 12
D 6 110 18
E 5 111 15
89
Frequency: 16 5 12 17 10 25
A. Using Shannon-Fano coding scheme
B. Using the Huffman algorithm/coding
37 MMIS (Comp. by Daniel T.)
Lempel-Ziv (LZ) compression
– Aaababbbaaabaaaaaaabaabb
– SATATASACITASA.