Source Coding For Compression: Types of Data Compression
Source Coding For Compression: Types of Data Compression
Lec 16b.6-1
2/2/01
M1
Lossless “Entropy” Coding, e.g. “Huffman” Coding
Example – 4 possible messages, 2 bits uniquely specifies each
= 0 .5
if p( A ) ∆
= “0”
= 0.25 ∆
p(B) forms “comma-less”
= 1 1
= 0.125 ∆
p(C) code
= 1 0 0
= 0.125 ∆
p(D)
= 1 0 1
Example of comma-less message:
11 0 0 101 0 0 0 11 100 ← codeword grouping (unique)
Lec 16b.6-3
2/2/01
M3
Lossless Coding Format Options
MESSAGE CODED
non-uniform uniform
non-uniform non-uniform
Lec 16b.6-4
2/2/01
M4
Run-length Coding
Example:
...1 000
N 1111111
00
N 1111
N 000000000
11...
3 7 2 4 9 run-length coding
Arithmetic codes:
(e.g. see Feb. ’89, IEEE Trans. Comm., 37, 2, pp. 93-97)
Lec 16b.6-6
2/2/01
M6
Information-Lossy Source Codes
Lec 16b.6-7
2/2/01
N1
Transform Codes - DFT
Discrete Fourier Transform (DFT):
N−1
X(n) = ∑ x(k )e − jn2π(k N)
e.g
k =0
[n = 0, 1, …, N – 1]
1 N−1
x(k ) = ∑ X(n)e jn2π(k N) Inverse DFT “IDFT”
N n=0
n=0
n=1 n=2
0
sharp edges of window ⇒
“ringing” or “sidelobes in the
reconstructed decoded signal
Lec 16b.6-8
2/2/01
N2
Example of DCT Image Coding
Say 8 × 8 block: 8×8 Can sequence coefficients, stopping
real #’s when they are too small, e.g.:
D.C.
term
may stop here
1 1
2 2
3
4 3
0 0
central block
zeros, still lower sidelobes
Ref: Henrique S. Malvar and D.H. Staelin, “The LOT: Transform Coding
Without Blocking Effects,” IEEE Trans. on Acous., Speech, and Sign.
Proc., 37(4), (1989).
Lec 16b.6-12
2/2/01
N6
Karhounen-Loéve Transform (KLT)
Maximizes energy compaction within blocks for jointly gaussian processes
Average energy
D.C. DFT, DCT, DST
Example: term
0 j
Average pixel energy
n
0 0 j
Lec 16b.6-13 0 j
2/2/01
N7
Vector Quntization (“VQ”)
Value
Example: consider pairs of samples
as vectors. y = [a,b]
more
p(a,b)
general
Can Huffman code
cell numbers
a a
VQ is better because more probable cells are smaller and well packed.
Lec 16b.6-14
VQ is n-dimensional (n = 4 to 16 is typical). There is a
2/2/01
tradeoff between performance and computation cost P1
Reconstruction Errors
When such “block transforms” are truncated (high frequency
terms omitted) or quantized, their reconstructions tend to ring
⇒
t t
window functions
(blocks)
[original f(t)] Reconstructed signal from
truncated coefficients and
quantization errors
+ −1 +
s(x,y) + Q channel Q + ˆ y)
s(x,
+ -
PRN(x,y) PRN(x,y)
Lec 16b.6-16
2/2/01
P3
Smoothing with Pseudo-Random Noise (PRN)
+ −1 +
s(x,y) + Q channel Q + ˆ y)
s(x,
+ -
PRN(x,y) PRN(x,y)
s(x) s+PRN(x)
A p{prn} A
−1
Q [Q( s(x))] -A/2 0 A/2
PRN
0 x 0 x
s(x) ˆ )
s(x filtered sˆ (x)
A
d
A ˆ )=
s(x
= ŝ(x) ∗ h(x)
Q [ s(x )+PRN(x )]
A −PRN(x)
d x x x
0 0 0
Lec 16b.6-17
2/2/01
P4
Example of Predictive Coding
δ(t − ∆ ) δ(t −∆ )
t ~ s(t − 2∆ )
+ δ +
s(t) + code δ’s channel +
- +
ˆ − 2∆ )
s(t
decode δ’s decode δ’s δ(t − 2 ∆ )
2∆ delay
ˆ )
s(t predictor predictor ˆ )
s(t
(3∆) (3∆)
t - 2∆ t - 2∆
∆ = computation time
medium
medium priority +
protection + +
lowest degree
lowest priority
of protection
Given s(t), f(t), i(t), O(t), n1(t), and n2(t) [channel plus receiver
plus quantization noise], choose g(t), h(t) to minimize MSE.
Lec 16b.6-20
2/2/01
P7
Prefiltering and Postfiltering
g(t)
Typical solution: “Mexican-hat
function” g(t) h(t)
some
“sharpening” t t
0 0
s(f ) • G(f ) fo f
s(f ) G(f ) • H(f )
Solution: Net N2 (f )
+ aliasing
fo f f
fo
By boosting the weaker signals relative to the stronger ones prior to
adding aliasing and n2(t), better weak-signal (high-frequency) performance
follows. Prefilters and postfilters first boost and then attenuate weak
signal frequencies.
Lec 16b.6-21
2/2/01
(Ref: H. Malvar, MIT EECS PhD thesis, 1987) P8
Analog Communications
Double Sideband Synchronous Carrier “DSBSC”:
S(f)
2 kTR
2W n (t ) = • 4W
kT 2 N2
∆
= No
f
0 fc
Lec 16b.6-22
2/2/01
R1
DSBSC Receiver
[ A c s(t ) + nc (t)] cos ωc t − ns (t ) sin ωc t sig(f)
cos ωc t
f
0
SNRout = ? fc
∆
Let n(t) = nc (t) cos ωc t − ns (t)sin ωc t
slowly varying slowly varying
n (t ) (filtered out by
= s sin 2ωc t
Lec 16b.6-23
2/2/01 2 low-pass filter)
R2
DSBSC Carrier
So: n (t) = ⎡nc (t) + ns (t)⎤ 2 = nc = ns = 2No 2W
2 2 2 2 2
⎣ ⎦
y(t) = [ A c s(t) + nc (t)] cos ωc t − ns (t) sin ωc t cos ωc t
2
n (t ) (filtered out by
= s sin 2 ωc t
2 low-pass filter)
cos2 ωc t = 1 (1 + cos 2ωc t )
2
Therefore yLPF (t) = 1 [ A c s(t) + nc ( t)] (low-pass filtered)
2
(Synchronous carrier)
W Pc s2 (t)
Sout Nout =
2No W
f
0
-fc N
fc
Ps 2 watts
Lec 16b.6-25
2/2/01
R4