Struct ruzstd::fse::FSETable

source ·
pub struct FSETable {
    pub decode: Vec<Entry>,
    pub accuracy_log: u8,
    pub symbol_probabilities: Vec<i32>,
    /* private fields */
}
Expand description

FSE decoding involves a decoding table that describes the probabilities of all literals from 0 to the highest present one

https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#fse-table-description

Fields§

§decode: Vec<Entry>

The actual table containing the decoded symbol and the compression data connected to that symbol.

§accuracy_log: u8

The size of the table is stored in logarithm base 2 format, with the size of the table being equal to (1 << accuracy_log). This value is used so that the decoder knows how many bits to read from the bitstream.

§symbol_probabilities: Vec<i32>

In this context, probability refers to the likelihood that a symbol occurs in the given data. Given this info, the encoder can assign shorter codes to symbols that appear more often, and longer codes that appear less often, then the decoder can use the probability to determine what code was assigned to what symbol.

The probability of a single symbol is a value representing the proportion of times the symbol would fall within the data.

If a symbol probability is set to -1, it means that the probability of a symbol occurring in the data is less than one.

Implementations§

source§

impl FSETable

source

pub fn new(max_symbol: u8) -> FSETable

Initialize a new empty Finite State Entropy decoding table.

source

pub fn reinit_from(&mut self, other: &Self)

Reset self and update self’s state to mirror the provided table.

source

pub fn reset(&mut self)

Empty the table and clear all internal state.

source

pub fn build_decoder( &mut self, source: &[u8], max_log: u8, ) -> Result<usize, FSETableError>

returns how many BYTEs (not bits) were read while building the decoder

source

pub fn build_from_probabilities( &mut self, acc_log: u8, probs: &[i32], ) -> Result<(), FSETableError>

Given the provided accuracy log, build a decoding table from that log.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.