Class PPMModel

Nested Relationships

Nested Types

Class Documentation

class PPMModel

the model of contexts of PPM, version C with exclusion, of order K on the symbols [ 0 , sigma )

Public Functions

PPMModel(int order, std::uint32_t sigma = 256)
Pre:

order >= 0, 1 <= sigma <= 2^16

inline int order(void) const
inline std::uint32_t sigma(void) const
std::map<std::uint32_t, std::uint64_t> counts(const std::vector<std::uint32_t> &ctx) const

the counts of the symbols seen after the context ctx (the oldest symbol first), empty if ctx was never seen

std::vector<Step> steps(std::uint32_t c) const

the steps that code c after the symbols seen: the escapes, then c

Pre:

c < sigma()

void encode(std::uint32_t c, RangeEncoder &e) const

codes c after the symbols seen

Pre:

c < sigma()

std::uint32_t decode(RangeDecoder &d) const

the symbol coded next in d, after the symbols seen

void update(std::uint32_t c)

adds c to the symbols seen

Pre:

c < sigma()

struct Step

a step of the code: the cumulative counts [ low , high ) of the symbol or of the escape, out of total

Public Members

std::uint64_t low
std::uint64_t high
std::uint64_t total

Friends

friend bool operator==(const Step &a, const Step &b) = default