Upload
blaze-berry
View
216
Download
2
Tags:
Embed Size (px)
Citation preview
Digital VideoSolutions to Midterm Exam 2012
Edited by Yang-Ting ChouConfirmed by Prof. Jar-Ferr Yang
LAB: 92923 R, TEL: ext. 621E-mail: [email protected]
Page of MPL: http://mediawww.ee.ncku.edu.tw
AVG: 120.806STDEV: 42.9794
MAX: 168MIN: 21
(a)
I
•These entropy encoders compress data by replacing each fixed-length input symbol by the corresponding variable-length prefix-free output codeword. The length of each codeword is approximately proportional to the negative logarithm of the probability. Therefore, the most common symbols use the shortest codes.•According to Shannon's source coding theorem, the optimal code length for a symbol is −logbP, where b is the number of symbols used to make output codes and P is the probability of the input symbol.•Two of the most common entropy encoding techniques are Huffman coding and arithmetic coding. If the approximate entropy characteristics of a data stream are known in advance, a simpler static code may be useful. These static codes include universal codes and Golomb codes.
(b)
(c)
(d)
(e)
(f)
II 2.1
Huffman code:A 0 (1) B 11 (00)C 100 (011)D 1011 (0100)E 10100 (01011)F 10101 (01010)
A 0.85B 0.05C 0.05D 0.02E 0.02
1
1
1
0
1
0
0
0
(a)
p(A) = 0.85, p(B) = 0.05, p(C) = 0.05, p(D) = 0.02, p(E) = 0.02p(F) = 1- p(A)- p(B)- p(C)- p(D)- p(E)=0.01
F 0.01
1
0
01
11
101100
1000
1001
10001
10000
10
10
Optimal symmetrical RVLCA 0B 11C 101 D 1001E 10001F 100001
(b)
100001
100000
01
11
101
001
0001
1001
10001
00001
01
01
Prefix conflict
Optimal asymmetrical RVLCA 0B 11C 101 D 1001E 10001F 100001
(c)
100001
000001
2.20 0
0
0
0 0 0
0 0
0 0
0
4
-1
3
1
RLC Skip SSSS Value Encoded
(1,4) 1 3 100 1111001 100
(0,-1) 0 1 0 00 0
(1,1) 1 1 1 1100 1
(3,3) 3 2 11 111110111 11
EOB 0 0 1010
(a) (b) (c)
題目沒給
2.3(a)
Entropy:
2ln
1*)1ln(*)1(log* H(p)i
2i
ii
i pppp
7219.0)8.01(log8.0)2.0
1(log2.0 22 H
(b)
64.08.08.0)p(A
16.02.08.0)p(A
16.08.02.0)p(A
04.02.02.0)p(A
22
12
21
11
A
A
A
A
Huffman code:A2A2 0 (1) A2A1 11 (00)A1A2 100 (011)A1A1 101 (010)
A2A2 0.64
A2A1 0.16A1A2 0.16A1A1 0.04 1
1
1
0
0
0
(c)
{A2A1A2A2}:{110} ({001})
Huffman code:A2A2 0 (1) A2A1 11 (00)A1A2 100 (011)A1A1 101 (010)
(d) Occurrence symbols: {A2A1A2A2}
0.0 1.00.2
0.20.36
1.0
0.2 0.36
0.232
0.360.2320.2576
0.2576<W<0.36
16
5
0101
2.4
]- 1 -[][],- -[][ 21
21
181
41
43
41
81
0 nhnh-2 -1 0 1 2
Synthesis Filter:
n
n
nhng
nhng
)1(][][
)1(][][
01
10
2~2
00 ]2[][]2[k
knxkhny
1~1
11 ]12[][]12[k
knxkhny
k
kngkynx ]2[]2[][ 000
k
kngkynx )]12([]12[][ 111
]- - - -[][], 1 [][ 81
41
43
41
81
121
21
0 ngng
n -3 -2 -1 0 1 2 3 4 5 6 7 8 9
x[n] 3 4 1 -3 1 4 3 2 -2 2 3 4 1
y0[2n] 0 -2.75 0 4.125 0 1 0 1
y1[2n+1] 0 0.5 0 0.5 0 0 0 -4 0 0
x0[n] -2.75 0.6875 4.125 2.5625 1 1
x1[n] -0.25 0.3125 -0.125 0.4375 1 -3
x’[n] -3 1 4 3 2 -2
The last row is the reconstructed synthesis data
2.5
1111
1111
1111
1111
T
0022
0220
0130
0012
X
(a)
1111
1111
1111
1111
TT T1-
(c) They are not unitary transforms.
以 quantization or scaling 來做補償 AA-1 = AAT ≠ I
(b)
1111
71159
1313
9315
TTXY T
003232
032320
016480
001632
YTTX T'
2.6p(A) = 0.7, p(B) =0.2, p(C) = 0.05, p(D)=p(E)=0.02, p(F)=0.01
Huffman code:A 0 (1) B 10 (01)C 110 (001)D 1111 (0000)E 11100 (00011)F 11101 (00010)
A 0.7B 0.2C 0.05D 0.02E 0.02F 0.01 1
1
1
1
1
0
0
0
0
0
(a)
RVL code:A 0 (1) B 101 (010)C 11011 (00100)D 1111111 (0000000)E 111000111 (000111000)F 111010111 (000101000)
(b)
01
11
101100
1000
1001
10001
10000
10
10
100001100000
Optimal symmetrical RVLCA 0B 11C 101 D 1001E 10001 F 100001
optimal symmetrical RVLC : 從後面長
(c)
01
11
101
001
0001
1001
10001
00001
01
01
Prefix conflict
Optimal asymmetrical RVLCA 0B 11C 101 D 1001E 10001 F 100001
100001 000001
optimal asymmetrical RVLC : 從前面長
2.7
Initialization:LIP: { (0,0)42, (0,1)17, (1,0)-19, (1,1)13 }LIS: { D(0,1), D(1,0), D(1,1) }LSP: {}
Significant Pass: 10 0 0 0 000Refinement Pass:LIP: { (0,0)42, (0,1)17, (1,0)-19, (1,1)13 }LIS: {D(0,1), D(1,0), D(1,1) }LSP: { (0,0)42 }
(a)
(b)
SPIHT
48
42 17
-19
6 -7
7 8
4 5
-4 -5
3 -4
0 0
13
322 42log0
2 T
485132 00 T.T
16MSB5:1
16MSB5:05
th
th
加減
n
Significant Pass: 10 11 0 000 Refinement Pass: 0LIP: { (0,1)17, (1,0)-19, (1,1) 13}LIS: {D(0,1), D(1,0), D(1,1) }LSP: {(0,0)42, (0,1)17, (1,0)-19}
Significant Pass: 10 0 1 0 0 0 10 0Refinement Pass: 1 0 0 up to 25 bits
Generated bitstream: 10 0 0 0 000 10 11 0 000 0 10 0 1 0 0 0 1
40
42 17
-19
6 -7
7 8
4 5
-4 -5
3 -4
0 0
13
245116 11 T.T
8MSB4:1
8MSB4:04
th
th
加減
n
12518 22 T.T
4MSB3:1
4MSB3:03
th
th
加減
n
(c)Generated bitstream: 10 0 0 0 000 10 11 0 000 0 10 0 1 0 0 0 1
48 0
0
0 0
0 0
0 0
0 0
0 0
0 0
0
40 24
-24
0 0
0 0
0 0
0 0
0 0
0 0
0
(1)
(2)
(3)
40 24
-24
0 0
0 0
0 0
0 0
0 0
0 0
12
Generated bitstream: 10 0 0 0 000 10 11 0 000 0 10 0 1 0 0 0 1
Generated bitstream: 10 0 0 0 000 10 11 0 000 0 10 0 1 0 0 0 1
4851
32
0
0
T.
T
16MSB5:1
16MSB5:05
th
th
加減
n
8MSB4:1
8MSB4:04
th
th
加減
n2451
16
1
1
T.
T
1251
8
2
2
T.
T
2.8
JPEG-LS Block Diagram(a)
(b)Fixed Predictor
sc zc
zc
zc
sc
zc zc
zc
zc sc
zc
zc
zc
zc
zc
zc
zc
zc
sc zc
zc
zc
zc
zc
zc
zc
zc
zc
sc
Significance Propagation Pass (Pass 1)
: Coefficient which is already significant
: Significance Propagation Pass (Pass 1)
ZC: Zero CodingSC: Sign Coding
(a)
zc
zc
zc
00
00
01
00
10
00
01
01
00
00
00
00
00
00
00
00
00
00
00
00
00
00
01
00
01
00
00
10
00
00
01
00
2.9
Magnitude Refinement Pass (Pass 2)
: Significance Propagation Pass (Pass 1)
(a)
: Magnitude Refinement Pass (Pass 2)
sc zc
zc
zc
sc
zc zc
zc
zc sc
zc
zc
zc
zc
zc
zc
zc
zc
sc zc
zc
zc
zc
zc
zc
zc
zc
zc
sc
zc
zc
zc
00
00
01
00
10
00
01
01
00
00
00
00
00
00
00
00
00
00
00
00
00
00
01
00
01
00
00
10
00
00
01
00
sc
zc zc
zc zc zc zc zc
zc
Clean-up Pass (Pass 3)(a)
: Pass 1
: Pass 2
: Pass 3 (ZC & SC)
: Pass 3 (RLC)
sc zc
zc
zc
sc
zc zc
zc
zc sc
zc
zc
zc
zc
zc
zc
zc
zc
sc zc
zc
zc
zc
zc
zc
zc
zc
zc
sc
zc
zc
zc
00
00
01
00
10
00
01
01
00
00
00
00
00
00
00
00
00
00
00
00
00
00
01
00
01
00
00
10
00
00
01
00
a: ZC, LL bandkh[j] = 1, kv[j] = 1, kd[j] = 0, ksig[j]=7
b: SCh[j] = 0, v[j] = 0, ksign[j] = 9
c: ZC, LL bandkh[j] = 1, kv[j] = 0, kd[j] = 0, ksig[j]=5
d: SC h[j] = 1, v[j] = 0, ksign[j] = 12
(b)
sc
zc zc
zc zc zc zc zc
zc
sc zc
zc
zc
sc
zc zc
zc
zc sc
zc
zc
zc
zc
zc
zc
zc
zc
sc zc
zc
zc
zc
zc
zc
zc
zc
zc
sc
zc
zc
zc
00
00
01
00
10
00
01
01
00
00
00
00
00
00
00
00
00
00
00
00
00
00
01
00
01
00
00
10
00
00
01
00
(a) (b)
(c)
(d)
(b)
sig[j]LL and LH blocks HL blocks HH blocks
h[j] v[j] d[j] h[j] v[j] d[j] d[j] h[j]+v[j]
8 2 x x x 2 x ≥3 x
7 1 ≥1 x ≥1 1 x 2 ≥1
6 1 0 ≥1 0 1 ≥1 2 0
5 1 0 0 0 0 0 1 ≥2
4 0 2 x 2 0 x 1 1
3 0 1 x 1 0 x 1 0
2 0 0 ≥2 0 0 ≥2 0 ≥2
1 0 0 1 0 0 1 0 1
0 0 0 0 0 0 0 0 0
Assignment of context labels for significant coding
“x” means “don’t care.”
(b)
h[j] v[j] sign flip
1 1 13 1
1 0 12 1
1 -1 11 1
0 1 10 1
0 0 9 1
0 -1 10 -1
-1 1 11 -1
-1 0 12 -1
-1 -1 13 -1
Assignment of context labels and flipping factor for sign coding
h[j] , v[j]: neighborhood sign status
-1: one or both negative.0: both insignificant or both significant but opposite sign.1: one or both positive.
][h j
Current sample
][v j
(b)
[j] sig [j] mag
0 0 14
0 >0 15
1 X 16
Assignment of context labels and flipping factor for magnitude refinement coding
[j]: remains zero until after the first magnitude refinement bit has been coded. For subsequent
refinement bits, [j] = 1.
sig[j]: context label for significant coding of sample j
2.10(a) Diamond Search
-2 -1 0 1 2 3 4 5 6 7
0-1-2-3
123456789
(-2, 3): 9+6+4 = 19 points
(2, -7): 9+6+5+5+4 = 29 points
-2 -1 0 1 2 3 4 5 6 7
0-1-2-3
123456789
(b) Four Step Search
-2 -1 0 1 2 3 4 5 6 7
0-1-2-3
123456789
(-2, 3): 9+5+8 = 22 points
-2 -1 0 1 2 3 4 5 6 7
0-1-2-3
123456789
(2, -7): 9+5+3+3+8 = 28 points
(c) Enhanced Hexagon Search
(-2, 3): 7+3+2 = 12 points
-2 -1 0 1 2 3 4 5 6 7
0-1-2-3
123456789
(2, -7): 7+3+3+3+2 = 18 points
-2 -1 0 1 2 3 4 5 6 7
0-1-2-3
123456789
2.11