I've finished removing the last traces of Matt Timmerman's code from my re-implementation of a bijective arithmetic encoder, and took the time to heavilly comment the code, in addition to renaming numerous variables and backing various bits of math out to base principles. This has all made the code dramatically more readable, and in my opinion more understandable as well.
And it's really highlighted how simple range coding really is. You keep a list of integer probabilities, add the low sum to your working value, scale up the resulting range whenever it gets too small and count the bits of 'finished' data that creates, and push out bytes whenever you accumulate 8 bits of finished data. The only 'tricky' bit is dealing with the mismatched scales between the integer probabilities and the integer range associated with the working value, and trying to avoid the contant multiply-divide pairs straight-forward rescaling involves.
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment