Data Compression

SWE 423: Multimedia Systems
Chapter 7: Data Compression (4)
Outline
• Source Coding
– Predictive Coding
• Lossless
• Lossy
– DPCM
– DM
Predictive Coding
• Predictive coding simply means
transmitting differences
– Predict the next sample as being equal to the
current sample
• More complex prediction schemes can be used
– Instead of sending the current sample, send the
error involved in the previous assumption
Predictive Coding: Why?
• The idea of forming differences is to make
the histogram of sample values more
peaked.
– In this case, what happens to the entropy?
– As a result, which is better to compress?
Predictive Coding: Why?
Lossless Predictive Coding
• Formally, define the integer signal as the set of
values fn. Then, we predict values f^n and compute
the error en as follows:
t
fˆn   an  k f n k
k 1
en  f n  fˆn
– when t = 1, we get ...
– Usually, t is between 2 and 4 (in this case it is called a
linear predictor
– We might need to have a truncating or rounding operation
following the prediction computation
Lossless Predictive Coding
Lossless Predictive Coding: Example
• Consider the following predictor:
ˆf   1  f  f 
n
 2 n 1 n 2 
e  f  fˆ
n
n
n
Show how to code the following sequence
f1 , f 2 , f 3 , f 4 , f 5  21, 22, 27, 25, 22.
Lossless Predictive Coding
• Examples in the Image Compression Domain
– Differential Coding
– Lossless JPEG
Lossy Predictive Coding: DPCM
• DPCM = Differential Pulse Code
Modulation
– Form the prediction f ^n
– Form an error en
– Quantize the error
Lossy Predictive Coding: DPCM
• The distortion is the average squared error
– To illustrate the quality of a compression
scheme, diagrams of distortion vs. the number
of bit levels used are usually shown
– Quantization used
• Uniform
• Lloyd-Max
– Does better than “Uniform”
Lossy Predictive Coding: DPCM
Lossy Predictive Coding: DPCM
• Example


~ 
1 ~
fˆn   f n 1  f n  2 
2

e  f  fˆ
n
n
n
 255  en 
e~n  Q[en ]  16 * 
 256  8

 16 
Show how to code the following sequence
f1 , f 2 , f 3 , f 4 , f 5  130, 150, 140, 200, 230
Lossy Predictive Coding
• DM (Delta Modulation) is a simplified
version of DPCM that is used as a quick
analog-to-digital converter.
– Note that the prediction simply involves a delay