算術編碼

程式最多可以對6個符號(以數字1, 2, 3, 4, 5, 6代表)進行算術編碼 (Arithmetic coding)。

程式編寫日期: 2006年7月13日

程式需要在 SD 模式下執行,因此在輸入程式前請先按 Mode Mode 1 進入SD模式。

注意: 藍色的英文字為統計模式中的變數(n 按 shift 1 3 ,x為平均x 按 shift 2 1)

程式 (176 bytes)

Stat clear: Pol( 1, 0: ?→A: ?→B: A ; B DT:

B=1 => Goto 0: ?→A: A=1 => Goto 0: ?→B:

B=1 => Goto 0: ?→C: C-1 => ?→X:

Lbl 0: ?→M: X - Y→D: M=1 =>Y + xD→X:

M=2 => Y + nD→X => Y + xD→Y:

M=3 => Y + AD→X => Y + nD→Y:

M=4 => Y + BD→X => Y + AD→Y:

M=5 => Y + CD→X => Y + BD→Y:

M=6 => Y + CD→Y: M => Goto 0: Y◢ X

 

Example:

The following are the probability and range of each symbol

Symbol Probability Range
1 0.2 0 - 0.2
2 0.4 0.2 - 0.6
3 0.1 0.6 - 0.7
4 0.2 0.7 - 0.9
5 0.1 0.9 - 1

What is the codeword of arithmetic coding for the sequence of 1 2 3 2 2 4 1 5 2 4?

 

Press Prog 1  0.2 EXE 0.6 EXE 0.7 EXE 0.9 EXE 1 EXE

1 EXE 2 EXE 3 EXE 2 EXE 2 EXE 4 EXE 1 EXE 5 EXE 2 EXE 4 EXE

0 EXE (0 represent end of input, read-out: 0.091184537)

EXE (read-out: 0.091184947)

The codeword is between 0.091184537 and 0.091184947

 

返回 fx-3650P及SC-185程式集

 

Free Web Hosting