VIII. Data Compression (B) - PowerPoint PPT Presentation

About This Presentation
Title:

VIII. Data Compression (B)

Description:

VIII. Data Compression (B) 8-A Lossless Coding Example: direct coding method Huffman coding – PowerPoint PPT presentation

Number of Views:137
Avg rating:3.0/5.0
Slides: 35
Provided by: DJJ9
Category:

less

Transcript and Presenter's Notes

Title: VIII. Data Compression (B)


1
VIII. Data Compression (B)
? 8-A Lossless Coding
?????????????????
Example
direct coding method Huffman coding Arithmetic
coding ShannonFano Coding, Golomb coding,
LempelZiv, .....
2
256
? 8-B Differential Coding for DC Terms,
Zigzag for AC Terms
?????? JPEG Huffman coding ?????
Differential Coding (????)
If the DC term of the (i, j)th block is denoted
by DCi, j, then
encode DCi, j DCi, j-1
Instead of DCi, j
(???? space domain ?????)
3
257
Zigzag scanning
? 2D ? 8x8 DCT outputs ?? 1D ???
??? zigzag ??? (??????????)
n 0, 1, 2, 3, 4, 5, 6, 7
m 0, 1, 2, 3,
4, 5, 6, 7
8x8 DCT output Cm, n m 0, 1, , 7 n 0, 1,
, 7
??
??
(???? frequency domain ?????)
4
258
? 8-C Lossless Coding Huffman Coding
? Huffman Coding ????? (Greedy Algorithm)
(1) ?????? Coding Tree ???,???????
(???????????) (2) ?????, code length ???????,
code length ?? (3)?? Sa ?? L ?? node,Sb?? L1 ??
node ? P(Sa) ? P(Sb)
???? ???????????
5
259
??????? ? data ? M ?????,?? k ?????, ??????????
floor(logkM) ? ceil(logkM) ? bits ???
floor ?????
ceil ?????
Example
?? 8 ?????,?2??????,?? 3 ? bits
?? 10 ?????,?3??????,?? 2 ?? 3 ? bits
6
260
Example
? ? ? ? ?
832700 801000 114000 7700 4390
? ? ? ? ?
3920 11700 11700 3130 36500
?? 3???Huffman Code ????
7
261
????????
1826740
0
1
2
59900
1747700
19140
2
0
1
0
1
2
2
0
1
36500
11700
11700
7050
832700
801000
114000
7700
4390
10
11
12
00
01
02
20
21
?
?
0
1
exchange
3920
3130
average code length 2.004
220
221
8
262
1826740
0
1
2
59900
934140
832700
?
2
0
1
2
0
1
2
19140
36500
11700
11700
801000
114000
01
02
10
11
12
?
0
1
2
7050
7700
4390
000
001
1
0
3920
3130
0020
0021
9
263
1826740
832700
801000
193040
?
?
59900
114000
19140
36500
11700
11700
7050
7700
4390
3920
3130
10
264
1826740
0
2
1
193040
801000
832700
1
2
?
?
0
2
1
36500
42540
114000
00
02
0
1
2
11700
11700
19140
012
011
2
0
1
average code length 1.143
7050
7700
4390
0100
0101
1
0
3920
3130
01020
01021
11
265
?? ????????????? ?????????????????
?????????????? ??? Huffman
coding ????????
12
266
? 8-D Entropy and Coding Length
? Entropy ??? (Information Theory)
??? log ? ln ? log10 ??
P probability
P(S0) 1, entropy 0 P(S0) P(S1)
0.5, entropy 0.6931 P(S0) P(S1) P(S2)
P(S3) P(S4) 1/5, entropy 1.6094 P(S0)
P(S1) P(S2) P(S3) 0.1, P(S4) 0.6, entropy
1.2275
???? 5 ???,???????,????
13
267
? Huffman Coding ?????
P(Sj) Sj ?????, L(Sj) Sj ?????
? Shannon ????
??? k ?????
? Huffman Coding ? total coding length
N data length
?? entropy ?????
14
268
Entropy ?? coding length ?????
15
269
? 8-E Arithmetic Coding
? Arithmetic Coding (????)
Huffman coding ??????????? Arithmetic coding
???????????,??????? Huffman coding
??,?????????????? arithmetic coding
K. Sayood, Introduction to Data Compression,
Chapter 4 Arithmetic coding, 3rd ed., Amsterdam,
Elsevier, 2006
16
270
??
? data X ? M ????? (Xi 1, 2, , or M),?? k
?????,?
???? data X ???,?? length(X) N
Algorithm for arithmetic encoding
initiation
for i 2 N
(continue)
end
17
271
Suppose that
where C and b are integers (b is as small as
possible), then the data X can be encoded by
where means that using k-ary (k ??) and
b bits to express C.
(? Arithmetic coding ?????????,?????????????
range encoding ???)
18
272
Example
???? X ????? (k 2) ??? ????????,Xi a ????
0.8, Xi b ???? 0.2 ?????????? X a a a b
a a
Initiation (X1 a)
When i 2 (X2 a)
When i 3 (X3 a)
When i 4 (X4 b)
When i 5 (X5 a)
When i 6 (X6 a)
19
273
??
0.4375
0.46875
????????
2 ??
5 ? bits
20
274
1
b
0.8
ab
0.64
aab
0.512
0.49152
aaab
0.475136
a
aa
aaaba
aaabaa
aaa
0.4096
aaaa
0
21
275
??
???????? Y, length(Y) b
?????,??? (see page 270) ??
Algorithm for arithmetic decoding
initiation
for i 1 N loop 1
check 1
while check 1 loop 2
if there exists an n such that lower
(upper-lower)Sn-1 ? lower 1 and lower
(upper-lower)Sn ? upper 1 are both
satisfied, then X(i) n
check 0
(continue).
22
276
else
j j1
end
end end of loop 2
end end of
loop 1
23
277
Coding Length for Arithmetic Coding
??
???? Xi n ???
????? Xi n ???
(????,? length(X) N, X ???? ? elements
?? n)
?
????
????,?? (from page 271)
???,???
24
278
??????????????,
Total coding length b ????
Arithmetic coding ? total coding length ????
Huffman coding ??
25
279
? 8-F MPEG
MPEG ??????????? ?? Moving Picture Experts
Group MPEG standard http//www.iso.org/iso/prod
s-services/popstds/mpeg.html MPEG ????
http//mpeg.chiariglione.org/
??????? 1/24 second
??????,??? 30?? 60???
26
?? Pepsi ??? Size 160 ? 120 Time
29 sec ?? 30 ??? ????? 160
? 120 ? 29 ? 30 ? 3 50112000 47.79 M bytes?
?? MPEG?? 1140740 1.09 M bytes?
????? 2.276?
27
281
? Flowchart of MPEG Compression
JPEG ???
I ??
MPEGfile
???
????
Video
P ??
????
????
B ??
JPEG ???
??
28
282
I ?? (Intra-coded picture) ??????? P ??
(Predictive-coded picture) ?????????? B ??
(Bi-directionally predictive-coded picture)
?????????????
??
P ??
I ??
??
??
I ??
B ??
I ?? or P ??
29
283
? ???????
??????,??? pixel ?????????? ???????
objects ?? motion vector
? ???? (Motion Compensation)
???????,?????????
frame n
frame n1
frame n2
30
284
Fm, n, t ??? t??? ??? Fm, n,
t, Fm, n, t? ??? Fm, n, t2?? (1)
???? Vx(m, n), Vy(m, n) (2) ??
Fm, n, t2? Fpm, n,
t2? Fm - Vx(m, n), n - Vx(m, n), t?
(3) ?? ?????? Em, n,
t2? Fm, n, t2? ? Fpm, n, t2?
????? Em, n, t2? ? DCT ??
31
285
? 8-G Data Compression ???????
Two important issues
  • Q1 How to further improve the compression rate
  • Q2 How to develop a compression algorithm whose
    compression rate is acceptable and the
    buffer size / hardware cost is limited

32
286
???????????????????
??????
?????
TP
FN
FP
TN
TP (true positive) ?????,???????????????
FN (false negative) ?????,???????????????
FP (false positive) ??????,??????????????
TN (true negative) ??????,?????????????????
33
287
??????,TP ???????????,FP??????????,FN
???????????,TN ???????????
??????,???????
recall ?,? precision ?
??????,???????
precision ?,? recall ?
34
288
Accuracy
Detection error rate
F-score
General form of the F-score
Write a Comment
User Comments (0)
About PowerShow.com