pub struct Decoder<M, R> where
    M: Model,
    R: BitRead
{ /* private fields */ }
Expand description

An arithmetic decoder

An arithmetic decoder converts a stream of bytes into a stream of some output symbol, using a predictive Model.

Implementations

Construct a new Decoder

The ‘precision’ of the encoder is maximised, based on the number of bits needed to represent the Model::denominator. ‘precision’ bits is equal to u32::BITS - Model::denominator bits.

Errors

This method can fail if the underlying BitRead cannot be read from.

Panics

The calculation of the number of bits used for ‘precision’ is subject to the following constraints:

If these constraints cannot be satisfied this method will panic in debug builds

Construct a new Decoder with a custom precision

Errors

This method can fail if the underlying BitRead cannot be read from.

Panics

The calculation of the number of bits used for ‘precision’ is subject to the following constraints:

If these constraints cannot be satisfied this method will panic in debug builds

Read the next symbol from the stream of bits

This method will return Ok(None) when EOF is reached.

Errors

This method can fail if the underlying BitRead cannot be read from.

Reuse the internal state of the Decoder with a new model.

Allows for chaining multiple sequences of symbols from a single stream of bits

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.