Class RangeDecoder

Class Documentation

class RangeDecoder

the decoder of a RangeEncoder on w bits

Public Functions

explicit RangeDecoder(std::span<const std::uint8_t> bytes, int w = 32)

the decoder of the code bytes, which must outlive it

Pre:

2 <= w <= 32

inline std::uint64_t maxTotal(void) const

the largest total of the counts, M / 4

std::uint64_t target(std::uint64_t total) const

the cumulative count of the next symbol: it is the one whose counts [ low , high ) hold it

Pre:

0 < total <= maxTotal()

Post:

result < total

void consume(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, as the encoder did

Pre:

low < high <= total <= maxTotal()