Skip to main content

Module arithmetic

Module arithmetic 

Source
Expand description

Binary Arithmetic Coder — PAQ8-style, 12-bit precision, carry-free.

Encodes/decodes one bit at a time given a 12-bit probability of bit=1. Uses 32-bit range [low, high] with byte-wise normalization.

Probabilities must be in [1, 4095]. 0 and 4096 are forbidden.

Structs§

ArithmeticDecoder
Binary arithmetic decoder. Reads bits from compressed data.
ArithmeticEncoder
Binary arithmetic encoder. Accumulates compressed bytes.