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
impl FSETable
sourcepub fn new(max_symbol: u8) -> FSETable
pub fn new(max_symbol: u8) -> FSETable
Initialize a new empty Finite State Entropy decoding table.
sourcepub fn reinit_from(&mut self, other: &Self)
pub fn reinit_from(&mut self, other: &Self)
Reset self
and update self
’s state to mirror the provided table.
sourcepub fn build_decoder(
&mut self,
source: &[u8],
max_log: u8,
) -> Result<usize, FSETableError>
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
sourcepub fn build_from_probabilities(
&mut self,
acc_log: u8,
probs: &[i32],
) -> Result<(), FSETableError>
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.