pub struct Decoder { /* private fields */ }
Expand description
An entropy decoder.
Implementations§
Source§impl Decoder
impl Decoder
Sourcepub fn parse(bitstream: &mut Bitstream<'_>, num_dist: u32) -> Result<Self>
pub fn parse(bitstream: &mut Bitstream<'_>, num_dist: u32) -> Result<Self>
Create a decoder by reading symbol distribution, integer configurations and LZ77 configuration from the bitstream.
Sourcepub fn read_varint(
&mut self,
bitstream: &mut Bitstream<'_>,
ctx: u32,
) -> Result<u32>
pub fn read_varint( &mut self, bitstream: &mut Bitstream<'_>, ctx: u32, ) -> Result<u32>
Read an integer from the bitstream with the given context.
Sourcepub fn read_varint_with_multiplier(
&mut self,
bitstream: &mut Bitstream<'_>,
ctx: u32,
dist_multiplier: u32,
) -> Result<u32>
pub fn read_varint_with_multiplier( &mut self, bitstream: &mut Bitstream<'_>, ctx: u32, dist_multiplier: u32, ) -> Result<u32>
Read an integer from the bitstream with the given context and LZ77 distance multiplier.
Sourcepub fn read_varint_with_multiplier_clustered(
&mut self,
bitstream: &mut Bitstream<'_>,
cluster: u8,
dist_multiplier: u32,
) -> Result<u32>
pub fn read_varint_with_multiplier_clustered( &mut self, bitstream: &mut Bitstream<'_>, cluster: u8, dist_multiplier: u32, ) -> Result<u32>
Read an integer from the bitstream with the given cluster and LZ77 distance multiplier.
Contexts can be converted to clusters using the cluster map.
pub fn as_rle(&mut self) -> Option<DecoderRleMode<'_>>
pub fn as_with_lz77(&mut self) -> Option<DecoderWithLz77<'_>>
pub fn as_no_lz77(&mut self) -> Option<DecoderNoLz77<'_>>
pub fn single_token(&self, cluster: u8) -> Option<u32>
Sourcepub fn begin(&mut self, bitstream: &mut Bitstream<'_>) -> Result<()>
pub fn begin(&mut self, bitstream: &mut Bitstream<'_>) -> Result<()>
Explicitly start reading an entropy encoded stream.
This involves reading an initial state for the ANS stream. It’s okay to skip this method, as the state will be initialized on the first read.
Sourcepub fn finalize(&self) -> Result<()>
pub fn finalize(&self) -> Result<()>
Finalizes the stream, and check whether the stream was valid.
For prefix code stream, this method will always succeed. For ANS streams, this method checks if the final state matches expected state, which is specified in the specification.
Sourcepub fn cluster_map(&self) -> &[u8] ⓘ
pub fn cluster_map(&self) -> &[u8] ⓘ
Returns the cluster mapping of distributions.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Decoder
impl RefUnwindSafe for Decoder
impl Send for Decoder
impl Sync for Decoder
impl Unpin for Decoder
impl UnwindSafe for Decoder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)