Struct cros_codecs::decoders::vp8::bool_decoder::BoolDecoder
source · [−]Expand description
The decoder state.
Fields
data: Cursor<T>
range: usize
value: usize
count: isize
Implementations
sourceimpl<T: AsRef<[u8]>> BoolDecoder<T>
impl<T: AsRef<[u8]>> BoolDecoder<T>
sourcefn fill(&mut self) -> Result<()>
fn fill(&mut self) -> Result<()>
Fills more bits from data
to value
. We shall keep at least 8 bits of
the current data
in value
.
sourcefn read_bit(&mut self, probability: u8) -> Result<bool>
fn read_bit(&mut self, probability: u8) -> Result<bool>
Reads the next bit from the coded stream. The probability of the bit to be one is probability / 256.
sourcefn read_literal(&mut self, nbits: usize) -> Result<i32>
fn read_literal(&mut self, nbits: usize) -> Result<i32>
Reads a “literal”, that is, a “num_bits”-wide unsigned value whose bits come high- to low-order, with each bit encoded at probability 1/2.
sourcepub fn read_bool(&mut self) -> Result<bool>
pub fn read_bool(&mut self) -> Result<bool>
Reads a boolean from the coded stream. Returns false if it has reached the end of data and failed to read the boolean. The probability of out to be true is probability / 256, e.g., when probability is 0x80, the chance is 1/2 (i.e., 0x80 / 256).
sourcepub fn read_bool_with_prob(&mut self, probability: u8) -> Result<bool>
pub fn read_bool_with_prob(&mut self, probability: u8) -> Result<bool>
Reads a boolean from the coded stream. Returns false if it has reached the end of data and failed to read the boolean. The probability of out to be true is probability / 256, e.g., when probability is 0x80, the chance is 1/2 (i.e., 0x80 / 256).
sourcepub fn read_uint<U: TryFrom<i32>>(&mut self, nbits: usize) -> Result<U>
pub fn read_uint<U: TryFrom<i32>>(&mut self, nbits: usize) -> Result<U>
Reads an unsigned literal from the coded stream.