• Timothy B. Terriberry's avatar
    Entropy coder clean-up. · 30df6cf3
    Timothy B. Terriberry authored
    This simplifies a good bit of the error handling, and should make it
     impossible to overrun the buffer in the encoder or decoder, while
     still allowing tell() to operate correctly after a bust.
    The encoder now tries to keep the range coder data intact after a
     bust instead of corrupting it with extra bits data, though this is
     not a guarantee (too many extra bits may have already been flushed).
    It also now correctly reports errors when the bust occurs merging the
     last byte of range coder and extra bits.
    A number of abstraction barrier violations were cleaned up, as well.
    This patch also includes a number of minor performance improvements:
     ec_{enc|dec}_bits() in particular should be much faster.
    Finally, tf_select was changed to be coded with the range coder
     rather than extra bits, so that it is at the front of the packet
     (for unequal error protection robustness).
rangeenc.c 8.04 KB