pub struct RansDecoder<'a> { /* private fields */ }Expand description
Scalar rANS decoder.
Implementations§
Source§impl<'a> RansDecoder<'a>
impl<'a> RansDecoder<'a>
Sourcepub fn decode(&mut self, cdf: &[u32]) -> Result<usize>
pub fn decode(&mut self, cdf: &[u32]) -> Result<usize>
Decode a symbol using a CDF table.
rANS decoding:
- Extract slot = state % total (= state & (ANS_TOTAL - 1))
- Find symbol
swherecdf[s] <= slot < cdf[s+1] - Update state: x’ = freq * (x >> ANS_BITS) + (x & (ANS_TOTAL-1)) - c_lo
Sourcepub fn decode_pdf(&mut self, pdf: &[f64]) -> Result<usize>
pub fn decode_pdf(&mut self, pdf: &[f64]) -> Result<usize>
Decode a symbol given a PDF.
Auto Trait Implementations§
impl<'a> Freeze for RansDecoder<'a>
impl<'a> RefUnwindSafe for RansDecoder<'a>
impl<'a> Send for RansDecoder<'a>
impl<'a> Sync for RansDecoder<'a>
impl<'a> Unpin for RansDecoder<'a>
impl<'a> UnwindSafe for RansDecoder<'a>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more