12.07.2015 Views

Data Compression: The Complete Reference

Data Compression: The Complete Reference

Data Compression: The Complete Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2.19 Context-Tree Weighting 1611b 3 b 4 b 5 b 6 b 710b 3 b 6 b 1 b 4 b 2 b 50100b 3 b 60b 7b 7b 3 b 6b 1 b 2b 1 b 410b 2 b 51b 7b 1 b 4 b 2 b 5(a)(4,3) P w=7/2048(2,1)1/16(2,2)9/128(1,0) 1/2 (1,1) 1/8 (2,0) 5/16 (0,2)3/8(1,0)1/2(1,1) (1,0)1/8 1/2(b)(1,0)1/2(0,2)3/8Figure 2.81: (a) A Context Tree. (b) A Weighted Context Tree.<strong>The</strong> last step that needs to be described is the way the context tree is updatedwhen the next bit is input. Suppose that we have already input and encoded the stringb 1 b 2 ...b t−1 . Thus, we have already constructed a context tree of depth d for this string,we have used Eqs. (2.12) and (2.13) to calculate weighted probabilities for the entiretree, and the root of the tree already contains a certain weighted probability. We nowinput the next bit b t and examine it. Depending on what it is, we need to update thecontext tree for the string b 1 b 2 ...b t−1 b t . <strong>The</strong> weighted probability at the root of thenew tree will then be sent to the arithmetic encoder, together with bit b t , and will beused to encode b t .If b t = 0, then updating the tree is done by (1) incrementing the a s counts for allnodes s, (2) updating the estimated probabilities P e (a s ,b s ) for all the nodes, and (3)updating the weighted probabilities P w (a s ,b s ) for all the nodes. If b t = 1, then all the b sshould be incremented, followed by updating the estimated and weighted probabilitiesas above. Figure 2.82a shows how the context tree of Figure 2.81b is updated whenb t =0.Figure 2.82b shows how the context tree of Figure 2.81b is updated when b t =1.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!