Class RangeEncoder

Class Documentation

class RangeEncoder

the integer arithmetic encoder of Witten, Neal and Cleary on w bits

Public Functions

explicit RangeEncoder(int w = 32)
Pre:

2 <= w <= 32

inline std::uint64_t maxTotal(void) const

the largest total of the counts, M / 4

void encode(std::uint64_t low, std::uint64_t high, std::uint64_t total)

narrows the interval to the symbol of cumulative counts [ low , high ) out of total

Pre:

low < high <= total <= maxTotal()

std::vector<std::uint8_t> finish(void)

the bits that end the code, and the code

inline std::size_t bits(void) const

the number of bits emitted