Professional Documents
Culture Documents
1
Last Time: Sampling
2
Last Time: Sampling Theory
Sampling
x(t) → x[n] = x(nT )
Impulse Reconstruction
LPF
Impulse xp (t) =
x[n] xr (t)
Reconstruction
P
x[n]δ(t − nT )
2π
Bandlimited Reconstruction ωs =
T
LPF
Impulse xp (t) = T
x[n] ω xr (t)
Reconstruction − ω2s ωs
P
x[n]δ(t − nT ) 2
ωs
Sampling Theorem: If X(jω) = 0 ∀ |ω| > then xr (t) = x(t).
2
3
Aliasing
−ωs ωs
Frequencies outside the range <ω< alias.
2 2
X(jω)
1
ω
P (jω)
2π
T
ω
−ωs ωs
1 (X(j · ) ∗ P (j · ))(ω)
Xp (jω) = 2π
1
T
ω
− ω2s ωs
2
4
Anti-Aliasing Filter
Anti-aliasing Reconstruction
Filter Filter
1 xp (t) T
x(t) ω × ω xr (t)
− ω2s ωs
2 − ω2s ωs
2
p(t)
5
Anti-Aliasing
−ωs ωs
Remove frequencies outside the range <ω< before sampling
2 2
to avoid aliasing.
Anti-aliased X(jω)
P (jω)
2π
T
ω
−ωs ωs
1 (X(j · ) ∗ P (j · ))(ω)
Xp (jω) = 2π
1
T
ω
− ω2s ωs
2
6
Today
7
Quantization
10
0 01
1 00
1 0 1 1 0 1 1 0 1
Input voltage Input voltage Input voltage
1
0 0.5 1 0 0.5 1 0 0.5 1
Time (second) Time (second) Time (second)
8
Check Yourself
1. 5 bits
2. 10 bits
3. 20 bits
4. 30 bits
5. 40 bits
9
Check Yourself
bits range
1
2
2
4
3
8
4
16
5
32
6
64
7
128
8
256
9
512
10
1, 024
11
2, 048
12
4, 096
13
8, 192
14
16, 384
15
32, 768
16
65, 536
17
131, 072
18
262, 144
19
524, 288
20
1, 048, 576
10
Check Yourself
1. 5 bits
2. 10 bits
3. 20 bits
4. 30 bits
5. 40 bits
11
Quantization Demonstration
Quantizing Music
• 16 bits/sample
• 8 bits/sample
• 6 bits/sample
• 4 bits/sample
• 3 bits/sample
• 2 bit/sample
12
Quantization
10
0 01
1 00
1 0 1 1 0 1 1 0 1
Input voltage Input voltage Input voltage
1
0 0.5 1 0 0.5 1 0 0.5 1
Time (second) Time (second) Time (second)
Example: audio CD
This image has 280 × 280 pixels, with brightness quantized to 8 bits.
14
Quantizing Images
15
Quantizing Images
16
Quantizing Images
17
Quantizing Images
18
Quantizing Images
19
Quantizing Images
20
Quantizing Images
21
Check Yourself
22
Dithering
Since the noise is different for each pixel in the band, the noise
causes some of the pixels to quantize to a higher value and some to
a lower. But the average value of the brightness is preserved.
23
Quantizing Images with Dither
24
Quantizing Images with Dither
25
Quantizing Images with Dither
26
Quantizing Images with Dither
27
Quantizing Images with Dither
28
Quantizing Images with Dither
29
Quantizing Images with Dither
30
Check Yourself
31
Check Yourself
32
Quantization Schemes
Quantization: y = Q(x)
33
Check Yourself
34
Quantization Schemes
Quantization: y = Q(x)
35
Quantizing Images with Robert’s Method
36
Quantizing Images with Robert’s Method
37
Quantizing Images with Robert’s Method
38
Quantizing Images with Robert’s Method
39
Quantizing Images with Robert’s Method
40
Quantizing Images with Robert’s Method
41
Quantizing Images with Robert’s Method
42
Quantizing Images: 3 bits
8 bits 3 bits
dither Robert’s
43
Quantizing Images: 2 bits
8 bits 2 bits
dither Robert’s
44
Quantizing Images: 1 bit
8 bits 1 bit
dither Robert’s
45
Progressive Refinement
46
Discrete-Time Sampling (Resampling)
x[n] × xp [n]
P
p[n] = k δ[n − kN ]
x[n]
n
0
p[n]
n
0
xp [n]
n
0
47
Discrete-Time Sampling
x[n] × xp [n]
P
p[n] = k δ[n − kN ]
X(ejΩ )
1
Ω
−2π 0 2π
P (ejΩ )
2π
3
Ω
−2π −4π −2π 0 2π 4π 2π
3 3 jΩ 3 3
Xp (e )
1
3
Ω
−2π −4π −2π 0 2π 4π 2π
3 3 3 3
48
Discrete-Time Sampling
x[n]
n
0
xp [n]
n
0
xb [n]
n
0
X(ejΩ )
1
Ω
−2π 0 2π
Xp (ejΩ )
1
3
Ω
−2π 0 2π
Xb (ejΩ ) = Xp (ejΩ/3 )
1
3
Ω
−2π −4π −2π 0 2π 4π 2π
3 3 3 3
50
Discrete-Time Sampling
51
Discrete-Time Sampling
52
Discrete-Time Sampling
53
Discrete-Time Sampling
54
Discrete-Time Sampling
55
Discrete-Time Sampling
56
Discrete-Time Sampling
57
Discrete-Time Sampling
x[n]
n
0
xp [n]
n
0
xb [n]
n
0
X(ejΩ )
1
Ω
−2π 0 2π
Xp (ejΩ )
1
3
Ω
−2π 0 2π
Xb (ejΩ ) = Xp (ejΩ/3 )
1
3
Ω
−2π −4π −2π 0 2π 4π 2π
3 3 3 3
59
Discrete-Time Sampling: Progressive Refinement
60
Discrete-Time Sampling: Progressive Refinement
61
Discrete-Time Sampling: Progressive Refinement
62
Discrete-Time Sampling: Progressive Refinement
63
Discrete-Time Sampling: Progressive Refinement
64
Discrete-Time Sampling
65
Perceptual Coding
66
JPEG
• color encoding
• DCT (discrete cosine transform): a kind of Fourier series
• quantization to achieve perceptual compression (lossy)
• Huffman encoding: lossless information theoretic coding
67
JPEG
68
JPEG
x[n] = x[n + 8]
n
0 8
69
JPEG
n
0 16
70
Check Yourself
x[n] = x[n + 8]
n
0 8
y[n] = y[n + 16]
n
0 16
71
Check Yourself
The first signal, x[n], has discontinuous amplitude. The second sig
nal, y[n] is not discontinuous, but has discontinuous slope.
x[n] = x[n + 8]
n
0 8
y[n] = y[n + 16]
n
0 16
72
Check Yourself
x[n] = x[n + 8]
n
0 8
y[n] = y[n + 16]
n
0 16
73
JPEG
function even when the “block” was taken from a smooth image.
original row
n
0
8 pixel ”block”
n
0
x[n] = x[n + 8]
n
0 8
74
JPEG
original row
n
0
8 pixel ”block”
n
0
y[n] = y[n + 16]
n
0 16
75
JPEG
n
0 16
7 � � ��
X πk 1
bk = y[n] cos n+
N 2
n=0
76
JPEG
|ak | bk
m m
77
JPEG
q[m, n] m →
16 11 10 16 24 40 51 61
12 12 14 19 26 58 60 55
14 13 16 24 40 57 69 56
n 14 17 22 29 51 87 80 62
↓ 18 22 37 56 68 109 103 77
24 35 55 64 81 104 113 92
49 64 78 87 103 121 120 101
72 92 95 98 112 100 103 99
78
Check Yourself
q[m, n] m →
16 11 10 16 24 40 51 61
12 12 14 19 26 58 60 55
14 13 16 24 40 57 69 56
n 14 17 22 29 51 87 80 62
↓ 18 22 37 56 68 109 103 77
24 35 55 64 81 104 113 92
49 64 78 87 103 121 120 101
72 92 95 98 112 100 103 99
q[m, n] m →
32 22 20 32 48 80 102 122
24 24 28 38 52 116 120 110
28 26 32 48 80 114 139 112
n 28 34 44 58 102 174 160 124
↓ 36 44 74 112 136 218 206 154
48 70 110 128 162 208 226 194
98 128 156 174 206 256 240 202
144 184 190 196 224 200 206 198
79
Check Yourself
q[m, n] m →
16 11 10 16 24 40 51 61
12 12 14 19 26 58 60 55
14 13 16 24 40 57 69 56
n 14 17 22 29 51 87 80 62
↓ 18 22 37 56 68 109 103 77
24 35 55 64 81 104 113 92
49 64 78 87 103 121 120 101
72 92 95 98 112 100 103 99
q[m, n] m →
32 22 20 32 48 80 102 122
24 24 28 38 52 116 120 110
28 26 32 48 80 114 139 112
n 28 34 44 58 102 174 160 124
↓ 36 44 74 112 136 218 206 154
48 70 110 128 162 208 226 194
98 128 156 174 206 256 240 202
144 184 190 196 224 200 206 198
80
JPEG
Finally, encode the DCT coefficients for each block using “run
length” encoding followed by an information theoretic (lossless)
“Huffman” scheme, in which frequently occuring patterns are
represented by short codes.
81
JPEG: Results
10994 bytes
82
MIT OpenCourseWare
http://ocw.mit.edu
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.