pub struct EntropyDecoder<S: RansParams> { /* private fields */ }Expand description
High-level entropy decoder using CDF tables for symbol lookup.
Generic over S: RansParams (RansByte or Rans64).
Implementations§
Source§impl<S: RansParams> EntropyDecoder<S>
impl<S: RansParams> EntropyDecoder<S>
Sourcepub fn initialize(
&mut self,
pmf_lengths: &[i32],
pmf_offsets: &[i32],
pmf_table: &[i32],
symbol_bits: u32,
bypass_bits: u32,
) -> Result<(), EntropyError>
pub fn initialize( &mut self, pmf_lengths: &[i32], pmf_offsets: &[i32], pmf_table: &[i32], symbol_bits: u32, bypass_bits: u32, ) -> Result<(), EntropyError>
Initialize the decoder with PMF distribution data.
pmf_lengths— number of symbols per distribution (including bypass sentinel)pmf_offsets— value offsets per distributionpmf_table— flat array of symbol frequencies for all distributionssymbol_bits— number of bits for symbol encoding (e.g. 16)bypass_bits— number of bits for bypass encoding (e.g. 4)
Sourcepub fn decode(
&self,
values: &mut [i32],
indices: &[i32],
data: &[u8],
) -> Result<(), EntropyError>
pub fn decode( &self, values: &mut [i32], indices: &[i32], data: &[u8], ) -> Result<(), EntropyError>
One-shot decode: decode from data into values.
values— output buffer (must be same length asindices)indices— distribution indices for each value to decodedata— encoded byte stream
Sourcepub fn decode_partial(
&self,
values: &mut [i32],
indices: &[i32],
data: &[u8],
) -> Result<usize, EntropyError>
pub fn decode_partial( &self, values: &mut [i32], indices: &[i32], data: &[u8], ) -> Result<usize, EntropyError>
Decode from a slice but do NOT require the source to be fully exhausted.
This is used when decoding from a RansDecoderStream where multiple encoded
segments are concatenated. The method decodes values/indices from the
beginning of data and returns the number of bytes consumed.
values— output buffer (must be same length asindices)indices— distribution indices for each value to decodedata— encoded byte stream (may contain extra trailing data)
Returns the number of bytes consumed from data on success.
Trait Implementations§
Source§impl<S: RansParams> Default for EntropyDecoder<S>
impl<S: RansParams> Default for EntropyDecoder<S>
Auto Trait Implementations§
impl<S> Freeze for EntropyDecoder<S>
impl<S> RefUnwindSafe for EntropyDecoder<S>where
S: RefUnwindSafe,
impl<S> Send for EntropyDecoder<S>where
S: Send,
impl<S> Sync for EntropyDecoder<S>where
S: Sync,
impl<S> Unpin for EntropyDecoder<S>where
S: Unpin,
impl<S> UnsafeUnpin for EntropyDecoder<S>
impl<S> UnwindSafe for EntropyDecoder<S>where
S: 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