pub struct Rans64Decoder<Sr>{ /* private fields */ }Expand description
Raw rANS decoder.
Implementations§
Source§impl<Sr> Rans64Decoder<Sr>
impl<Sr> Rans64Decoder<Sr>
pub fn new(source: Sr) -> Rans64Decoder<Sr>
pub fn source(&self) -> &Sr
pub fn source_mut(&mut self) -> &mut Sr
pub fn into_source(self) -> Sr
pub fn state(&self) -> u64
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 parameters are invalid. 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: &Rans64DecSymbol,
scale_bits: u32,
) -> bool
pub fn advance_symbol( &mut self, symbol: &Rans64DecSymbol, scale_bits: u32, ) -> bool
Advance using a prepared decoder symbol.
Trait Implementations§
Auto Trait Implementations§
impl<Sr> Freeze for Rans64Decoder<Sr>where
Sr: Freeze,
impl<Sr> RefUnwindSafe for Rans64Decoder<Sr>where
Sr: RefUnwindSafe,
impl<Sr> Send for Rans64Decoder<Sr>where
Sr: Send,
impl<Sr> Sync for Rans64Decoder<Sr>where
Sr: Sync,
impl<Sr> Unpin for Rans64Decoder<Sr>where
Sr: Unpin,
impl<Sr> UnsafeUnpin for Rans64Decoder<Sr>where
Sr: UnsafeUnpin,
impl<Sr> UnwindSafe for Rans64Decoder<Sr>where
Sr: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more