1. 1
Lih-Jen Kau
Signal Proc. & Intell. Electron. Group
National Taipei Univ. of Technology
1/20
Lecture 07
Nov. 03, 2022
Instructor:高立人
電子工程研究所
國立臺北科技大學
Lih-Jen Kau
Signal Proc. & Intell. Electron. Group
National Taipei Univ. of Technology
2/20
Arithmetic Code
Incremental Coding
November 3, 2022
2. 2
Lih-Jen Kau
Signal Proc. & Intell. Electron. Group
National Taipei Univ. of Technology
3/20
Incremental Coding
Incremental Coding: Further Analysis
Bits sent to output bit stream in the process of encoding.
For large N, we have u(n)=l(n) due to finite precision.
Observe
If u(n) = 0.b1b2…bk X X X
If l(n) = 0.b1b2…bk X X X
Do we have Tb = 0.b1b2…bk X X X ?
November 3, 2022
Lih-Jen Kau
Signal Proc. & Intell. Electron. Group
National Taipei Univ. of Technology
4/20
Incremental Coding
Incremental Coding: Further Analysis Cont.
Recall Arithmetic Coding:
A symbol sequence:
n
X
n
n
n
n
n
X
n
n
n
n
x
F
l
u
l
u
x
F
l
u
l
l 1
1
1
1
1
1
1
Y
N
x
x
x 2
1
1
1
Log
where
2
1
2
1
2
2
1
2
1
2
1
2
1
N
N
x
x
x
l
N
b
N
x
x
x
p
x
x
x
l
x
x
x
T
T
N
u
N
l
x
x
x
T
N
November 3, 2022
3. 3
Lih-Jen Kau
Signal Proc. & Intell. Electron. Group
National Taipei Univ. of Technology
5/20
Incremental Coding
Incremental Coding: Further Analysis Cont.
Scaling:
n
l
n
l
n
u
n
u
k
k
2
2
1
2
1
1
2
2
1
1
1
n
l
n
l
n
u
x
F
n
l
n
u
n
l
x
F
n
l
n
u
n
l
n
u
k
k
n
X
k
n
X
新的符號(第N+1個)編碼後,其Interval大小是未放大
前的2k倍!
November 3, 2022
Lih-Jen Kau
Signal Proc. & Intell. Electron. Group
National Taipei Univ. of Technology
6/20
Incremental Coding
Incremental Coding: Further Analysis Cont.
u’(n+1) = b1b2…bk . X X X
l’(n+1) = b1b2…bk . X X X
u(n+1) = 0.b1b2…bk X X X
l(n+1) = 0.b1b2…bk X X X
Advantages:
No need of b1b2…bk for update
No need keeping b1b2…bk in buffer of l and u
November 3, 2022
4. 4
Lih-Jen Kau
Signal Proc. & Intell. Electron. Group
National Taipei Univ. of Technology
7/20
Incremental Coding
Scaling: E1, E2 Mapping
E1(x)=2x (l, u < 0.5)
E2(x)=2x-1 (l, u 0.5)
E1: l(n), u(n) < 0.5
xxx
0
.
0
xxx
0
.
0
n
u
n
l
xxx
.
0
xxx
.
0
n
u
n
l
E1
Output 0
E2: l(n), u(n) 0.5
xxx
1
.
0
xxx
1
.
0
n
u
n
l
xxx
.
0
xxx
.
0
n
u
n
l
E2
Output 1
November 3, 2022
Lih-Jen Kau
Signal Proc. & Intell. Electron. Group
National Taipei Univ. of Technology
8/20
Incremental Coding
Scaling: E3 Mapping
Scaling the interval when the shrinking interval straddles
0.5.
E3 mapping can be applied when
4
3
2
1
4
1
n
u
n
l
0 0.25 0.5 0.75 1
November 3, 2022
5. 5
Lih-Jen Kau
Signal Proc. & Intell. Electron. Group
National Taipei Univ. of Technology
9/20
Incremental Coding
Scaling: E3 Mapping Cont.
Define:
2
1
2
1
2
1
2
4
1
2
1
3
3
y
y
E
x
y
x
x
x
E
Comments on E1, E2, and E3 Mapping
By applying E1, E2, and E3 mapping in the process of
encoding, the resulting interval length >1/4.
See next page for detailed analysis.
November 3, 2022
Lih-Jen Kau
Signal Proc. & Intell. Electron. Group
National Taipei Univ. of Technology
10/20
Incremental Coding
Cases that can not apply E1, E2, and E3 Mapping:
0.25 0.5
Case1:
0.25 0.5 0.75
Case2:
0.25 0.5 0.75
Case3:
最小的interval length是1/4.
November 3, 2022
6. 6
Lih-Jen Kau
Signal Proc. & Intell. Electron. Group
National Taipei Univ. of Technology
11/20
Incremental Coding
Cases that can not apply E1, E2, and E3 Mapping: Cont.
There are the following two conditions that the interval is
smallest without triggering a rescaling
When u(n) is right at midpoint of the interval and l(n) is just below
a quarter of the interval, i.e., case 1.(當u(n) 剛好等於0.5而且l(n)
恰好比0.25略小一點時,此時便無法做Scaling)
When l(n) is just below the midpoint of the interval and u(n) is at
three-quarters of the interval, i.e., case 3. (當u(n) 剛好等於0.75
而且l(n) 恰好比0.5略小一點時,此時亦無法做Scaling)
以上兩種情況已是最糟的狀況!下一個符號進來時一定
會觸發Rescaling!
November 3, 2022
Lih-Jen Kau
Signal Proc. & Intell. Electron. Group
National Taipei Univ. of Technology
12/20
Comments on E3 Mapping
How to encode using E3 Mapping:
n
u
n
l ,
1
,
1
n
u
n
l
update
n
u
n
l
,
1
,
1
n
u
n
l
update
3
E 1
3
E ? Ans: 3
E 1
3
E
2
1
2
1
2
1
2
1
2
1
2
2
1
2
n
u
n
u
n
l
n
l
n
u
n
u
n
l
n
l
November 3, 2022
7. 7
Lih-Jen Kau
Signal Proc. & Intell. Electron. Group
National Taipei Univ. of Technology
13/20
Comments on E3 Mapping
How are u’(n+1), l’(n+1) related to u(n+1), l(n+1) ?
Update using l’(n), u’(n)
1
1
1
1
1
n
n
x
F
n
l
n
u
n
l
n
u
x
F
n
l
n
u
n
l
n
l
By observing u’(n+1), we can find that
1
E
25
.
0
1
2
4
1
1
2
2
1
1
2
2
1
2
2
2
1
2
1
3
1
1
n
u
n
u
n
u
n
u
x
F
n
l
n
u
n
l
x
F
n
l
n
u
n
l
n
u
n
n
November 3, 2022
2
1
2
2
1
2
n
u
n
u
n
l
n
l
Lih-Jen Kau
Signal Proc. & Intell. Electron. Group
National Taipei Univ. of Technology
14/20
Comments on E3 Mapping
How are u’(n+1), l’(n+1) related to u(n+1), l(n+1) ?
A short summary
1
E
2
1
1
2
1
1
E
2
1
1
2
1
3
3
n
l
n
l
n
l
n
u
n
u
n
u
November 3, 2022
8. 8
Lih-Jen Kau
Signal Proc. & Intell. Electron. Group
National Taipei Univ. of Technology
15/20
Comments on E3 Mapping
How are u’(n+1), l’(n+1) related to u(n+1), l(n+1) ?
Case1: u’(n+1), l’(n+1) 0.5
xxx
1
.
0
1
xxx
1
.
0
1
n
l
n
u
2
1
1
2
1
1
2
1
1
2
1
1
n
l
n
l
n
u
n
u
xxx
10
.
0
xxx
0
.
1
2
1
1
xxx
10
.
0
xxx
0
.
1
2
1
1
n
l
n
u
So we output 10 for this case!
November 3, 2022
Lih-Jen Kau
Signal Proc. & Intell. Electron. Group
National Taipei Univ. of Technology
16/20
Comments on E3 Mapping
How are u’(n+1), l’(n+1) related to u(n+1), l(n+1) ?
Case2: u’(n+1), l’(n+1) < 0.5
xxx
0
.
0
1
xxx
0
.
0
1
n
l
n
u
2
1
1
2
1
1
2
1
1
2
1
1
n
l
n
l
n
u
n
u
xxx
01
.
0
xxx
1
.
0
2
1
1
xxx
01
.
0
xxx
1
.
0
2
1
1
n
l
n
u
So we output 01 for this case!
November 3, 2022
9. 9
Lih-Jen Kau
Signal Proc. & Intell. Electron. Group
National Taipei Univ. of Technology
17/20
How About Applying E3 Mapping Twice?
n
u
n
l ,
1
,
1
n
u
n
l
update
n
u
n
l
,
1
,
1
n
u
n
l
update
3
E 1
3
E 3
E 1
3
E
Comments on E3 Mapping
n
u
n
l
,
1
,
1
n
u
n
l
update
3
E 1
3
E 3
E 1
3
E
2
,
2
n
u
n
l
update
2
,
2
n
u
n
l
update
2
,
2
n
u
n
l
update
November 3, 2022
Lih-Jen Kau
Signal Proc. & Intell. Electron. Group
National Taipei Univ. of Technology
18/20
How About Applying E3 Mapping Twice? Cont.
Case1: u’’(n+1), l’’(n+1) 0.5
Comments on E3 Mapping
xxx
1
.
0
1
xxx
1
.
0
1
n
l
n
u
2
1
1
2
1
1
2
1
1
2
1
1
n
l
n
l
n
u
n
u
xxx
10
.
0
xxx
0
.
1
2
1
1
xxx
10
.
0
xxx
0
.
1
2
1
1
n
l
n
u
So we output 100 for this case!
2
1
1
2
1
1
2
1
1
2
1
1
n
l
n
l
n
u
n
u
xxx
100
.
0
xxx
00
.
1
2
1
1
xxx
100
.
0
xxx
00
.
1
2
1
1
n
l
n
u
November 3, 2022
10. 10
Lih-Jen Kau
Signal Proc. & Intell. Electron. Group
National Taipei Univ. of Technology
19/20
How About Applying E3 Mapping Twice? Cont.
Case2: u’’(n+1), l’’(n+1) < 0.5
Comments on E3 Mapping
xxx
0
.
0
1
xxx
0
.
0
1
n
l
n
u
2
1
1
2
1
1
2
1
1
2
1
1
n
l
n
l
n
u
n
u
xxx
01
.
0
xxx
1
.
0
2
1
1
xxx
01
.
0
xxx
1
.
0
2
1
1
n
l
n
u
So we output 011 for this case!
2
1
1
2
1
1
2
1
1
2
1
1
n
l
n
l
n
u
n
u
xxx
011
.
0
xxx
11
.
0
2
1
1
xxx
011
.
0
xxx
11
.
0
2
1
1
n
l
n
u
November 3, 2022
Lih-Jen Kau
Signal Proc. & Intell. Electron. Group
National Taipei Univ. of Technology
20/20
How About Applying E3 Mapping L Times?
Case1: E2 mapping happens after L E3 mappings
Just output 100…0(a 1 followed by L 0s)
Case2: E1 mapping happens after L E3 mappings
Just output 011…1(a 0 followed by L 1s)
Comments on E3 Mapping
November 3, 2022