Arithmetic Coding
Arithmetic Coding
Arithmetic coding
Encode 'c'
while there are still symbols to encode
currentrange = upperbound - lowerbound
current range = 0.3 - 0.0 = 0.3
upperbound = lowerbound + (currentrange
upper bound = 0.0 + (0.3 0.70) = 0.210upperboundofnewsymbol)
lowerbound = lowerbound + (currentrange
lowerboundofnewsymbol)
lower bound = 0.0 + (0.3 0.45) = 0.135
end while
Encode 'e'
current range = 0.210 - 0.135 = 0.075
upper bound = 0.135 + (0.075 1.00) = 0.210
lower bound = 0.135 + (0.075 0.80) = 0.195
The string "ace" may be encoded by any value within the probability
range [0.195, 0.210).
Decoding Strings
edvalue = encodedinput
hile
Example:
Using the probability ranges from Table 1 decode the three character
string encoded as 0.20.
encodedvalue = encodedinput
Decode first symbol
while string is not fully decoded
0.20 is within [0.00, 0.30)
identify the symbol containing encoded value within its range
0.20 encodes 'a'
Comparison Huffman/Arithmetic
coding
From implementation point of view,
Huffman coding is easier than arithmetic
coding.