pub struct RansByteDecoder<Sr>{ /* private fields */ }Expand description
Raw rANS decoder.
Implementations§
Source§impl<Sr> RansByteDecoder<Sr>
impl<Sr> RansByteDecoder<Sr>
pub fn new(source: Sr) -> RansByteDecoder<Sr>
pub fn source(&self) -> &Sr
pub fn source_mut(&mut self) -> &mut Sr
pub fn into_source(self) -> Sr
pub fn state(&self) -> u32
pub fn check_eof(&self) -> bool
Sourcepub fn init(&mut self) -> bool
pub fn init(&mut self) -> bool
Initialize the decoder by reading the initial state from the source.
Sourcepub fn get(&self, scale_bits: u32) -> u32
pub fn get(&self, scale_bits: u32) -> u32
Get the next symbol frequency (low scale_bits of state).
Panics if scale_bits >= 32 (overflow at 1u32 << scale_bits).
Use try_get for a Result-returning checked variant.
Sourcepub fn try_get(&self, scale_bits: u32) -> Result<u32, RawRansError>
pub fn try_get(&self, scale_bits: u32) -> Result<u32, RawRansError>
Get the next symbol frequency with bounds checking.
Sourcepub fn advance(&mut self, start: u32, freq: u32, scale_bits: u32) -> bool
pub fn advance(&mut self, start: u32, freq: u32, scale_bits: u32) -> bool
Advance the decoder past a symbol (public checked wrapper).
Uses transactional state: computes into a local variable and only
assigns to self.state after renormalization succeeds.
Panics if scale_bits >= 32 (overflow at 1u32 << scale_bits).
Use try_advance for a Result-returning checked variant.
Equivalent to: RansDecoder::Advance(start, freq, scale_bits).
Sourcepub fn try_advance(
&mut self,
start: u32,
freq: u32,
scale_bits: u32,
) -> Result<bool, RawRansError>
pub fn try_advance( &mut self, start: u32, freq: u32, scale_bits: u32, ) -> Result<bool, RawRansError>
Advance the decoder with bounds checking on scale_bits.
Sourcepub fn advance_symbol(
&mut self,
symbol: &RansByteDecSymbol,
scale_bits: u32,
) -> bool
pub fn advance_symbol( &mut self, symbol: &RansByteDecSymbol, scale_bits: u32, ) -> bool
Advance using a prepared decoder symbol.