RPNX::Compress
Self-contained C++20 compression and ZIP library
 
Loading...
Searching...
No Matches
rpnx::compression::xz_codec::lzma_model Struct Reference

Adaptive probability tables and state used by LZMA. More...

#include <xz.hpp>

Classes

struct  length_model
 Probability tables for the three LZMA match-length ranges. More...
 

Public Member Functions

void reset ()
 Reset the probability model and recent-match state.
 
void set_properties (std::uint8_t properties)
 Configures lc, lp, and pb from one LZMA properties byte.
 

Public Attributes

std::uint32_t rep0 = 0U
 Most recent repeated match distance minus one.
 
std::uint32_t rep1 = 0U
 Second most recent repeated distance minus one.
 
std::uint32_t rep2 = 0U
 Third most recent repeated distance minus one.
 
std::uint32_t rep3 = 0U
 Fourth most recent repeated distance minus one.
 
std::uint8_t state = 0U
 Current LZMA literal/match state.
 
std::uint8_t literal_context_bits = 3U
 Number of high previous-byte bits in a literal context.
 
std::uint8_t literal_position_bits = 0U
 Number of low position bits in a literal context.
 
std::uint8_t position_bits = 2U
 Number of low position bits selecting a position state.
 
std::array< std::array< std::uint16_t, position_state_count >, state_countis_match {}
 Literal-versus-match probabilities.
 
std::array< std::uint16_t, state_countis_rep {}
 New-versus-repeated match probabilities.
 
std::array< std::uint16_t, state_countis_rep0 {}
 Most-recent-distance probabilities.
 
std::array< std::uint16_t, state_countis_rep1 {}
 Second-distance probabilities.
 
std::array< std::uint16_t, state_countis_rep2 {}
 Third-versus-fourth distance probabilities.
 
std::array< std::array< std::uint16_t, position_state_count >, state_countis_rep0_long {}
 Short repeated-match probabilities.
 
std::array< std::array< std::uint16_t, 64U >, 4U > distance_slot {}
 Distance-slot trees by match-length state.
 
std::array< std::uint16_t, 114U > distance_special {}
 Probability trees for middle distance bits.
 
std::array< std::uint16_t, 16U > distance_align {}
 Reversed tree for low aligned distance bits.
 
length_model match_length
 Length model for new matches.
 
length_model repeated_length
 Length model for repeated matches.
 
std::array< std::array< std::uint16_t, literal_coder_size >, literal_coder_countliteral {}
 Literal probability trees by context.
 

Detailed Description

Adaptive probability tables and state used by LZMA.

Definition at line 51 of file xz.hpp.

Member Function Documentation

◆ reset()

void rpnx::compression::xz_codec::lzma_model::reset ( )
inline

Reset the probability model and recent-match state.

Definition at line 85 of file xz.hpp.

References rep0, rep1, rep2, rep3, and state.

Referenced by rpnx::compression::xz_codec::decompress(), and set_properties().

◆ set_properties()

void rpnx::compression::xz_codec::lzma_model::set_properties ( std::uint8_t properties)
inline

Configures lc, lp, and pb from one LZMA properties byte.

Parameters
propertiesEncoded LZMA lc/lp/pb value.
Exceptions
compression_errorIf the value or supported context sum is invalid.

Definition at line 100 of file xz.hpp.

References rpnx::compression::invalid_data, literal_context_bits, literal_position_bits, position_bits, reset(), and rpnx::compression::xz.

Referenced by rpnx::compression::xz_codec::compress(), and rpnx::compression::xz_codec::decompress().

Member Data Documentation

◆ distance_align

std::array< std::uint16_t, 16U > rpnx::compression::xz_codec::lzma_model::distance_align {}

Reversed tree for low aligned distance bits.

Definition at line 79 of file xz.hpp.

Referenced by rpnx::compression::xz_codec::decode_lzma_chunk().

◆ distance_slot

std::array< std::array< std::uint16_t, 64U >, 4U > rpnx::compression::xz_codec::lzma_model::distance_slot {}

Distance-slot trees by match-length state.

Definition at line 77 of file xz.hpp.

Referenced by rpnx::compression::xz_codec::decode_lzma_chunk().

◆ distance_special

std::array< std::uint16_t, 114U > rpnx::compression::xz_codec::lzma_model::distance_special {}

Probability trees for middle distance bits.

Definition at line 78 of file xz.hpp.

Referenced by rpnx::compression::xz_codec::decode_lzma_chunk().

◆ is_match

std::array< std::array< std::uint16_t, position_state_count >, state_count > rpnx::compression::xz_codec::lzma_model::is_match {}

Literal-versus-match probabilities.

Definition at line 71 of file xz.hpp.

Referenced by rpnx::compression::xz_codec::compress_lzma_literals(), and rpnx::compression::xz_codec::decode_lzma_chunk().

◆ is_rep

std::array< std::uint16_t, state_count > rpnx::compression::xz_codec::lzma_model::is_rep {}

New-versus-repeated match probabilities.

Definition at line 72 of file xz.hpp.

Referenced by rpnx::compression::xz_codec::decode_lzma_chunk().

◆ is_rep0

std::array< std::uint16_t, state_count > rpnx::compression::xz_codec::lzma_model::is_rep0 {}

Most-recent-distance probabilities.

Definition at line 73 of file xz.hpp.

Referenced by rpnx::compression::xz_codec::decode_lzma_chunk().

◆ is_rep0_long

std::array< std::array< std::uint16_t, position_state_count >, state_count > rpnx::compression::xz_codec::lzma_model::is_rep0_long {}

Short repeated-match probabilities.

Definition at line 76 of file xz.hpp.

Referenced by rpnx::compression::xz_codec::decode_lzma_chunk().

◆ is_rep1

std::array< std::uint16_t, state_count > rpnx::compression::xz_codec::lzma_model::is_rep1 {}

Second-distance probabilities.

Definition at line 74 of file xz.hpp.

Referenced by rpnx::compression::xz_codec::decode_lzma_chunk().

◆ is_rep2

std::array< std::uint16_t, state_count > rpnx::compression::xz_codec::lzma_model::is_rep2 {}

Third-versus-fourth distance probabilities.

Definition at line 75 of file xz.hpp.

Referenced by rpnx::compression::xz_codec::decode_lzma_chunk().

◆ literal

std::array< std::array< std::uint16_t, literal_coder_size >, literal_coder_count > rpnx::compression::xz_codec::lzma_model::literal {}

Literal probability trees by context.

Definition at line 82 of file xz.hpp.

Referenced by rpnx::compression::xz_codec::compress_lzma_literals(), and rpnx::compression::xz_codec::decode_lzma_chunk().

◆ literal_context_bits

std::uint8_t rpnx::compression::xz_codec::lzma_model::literal_context_bits = 3U

Number of high previous-byte bits in a literal context.

Definition at line 68 of file xz.hpp.

Referenced by rpnx::compression::xz_codec::compress_lzma_literals(), rpnx::compression::xz_codec::decode_lzma_chunk(), and set_properties().

◆ literal_position_bits

std::uint8_t rpnx::compression::xz_codec::lzma_model::literal_position_bits = 0U

Number of low position bits in a literal context.

Definition at line 69 of file xz.hpp.

Referenced by rpnx::compression::xz_codec::compress_lzma_literals(), rpnx::compression::xz_codec::decode_lzma_chunk(), and set_properties().

◆ match_length

length_model rpnx::compression::xz_codec::lzma_model::match_length

Length model for new matches.

Definition at line 80 of file xz.hpp.

Referenced by rpnx::compression::xz_codec::decode_lzma_chunk().

◆ position_bits

std::uint8_t rpnx::compression::xz_codec::lzma_model::position_bits = 2U

Number of low position bits selecting a position state.

Definition at line 70 of file xz.hpp.

Referenced by rpnx::compression::xz_codec::compress_lzma_literals(), rpnx::compression::xz_codec::decode_lzma_chunk(), and set_properties().

◆ rep0

std::uint32_t rpnx::compression::xz_codec::lzma_model::rep0 = 0U

Most recent repeated match distance minus one.

Definition at line 63 of file xz.hpp.

Referenced by rpnx::compression::xz_codec::decode_lzma_chunk(), and reset().

◆ rep1

std::uint32_t rpnx::compression::xz_codec::lzma_model::rep1 = 0U

Second most recent repeated distance minus one.

Definition at line 64 of file xz.hpp.

Referenced by rpnx::compression::xz_codec::decode_lzma_chunk(), and reset().

◆ rep2

std::uint32_t rpnx::compression::xz_codec::lzma_model::rep2 = 0U

Third most recent repeated distance minus one.

Definition at line 65 of file xz.hpp.

Referenced by rpnx::compression::xz_codec::decode_lzma_chunk(), and reset().

◆ rep3

std::uint32_t rpnx::compression::xz_codec::lzma_model::rep3 = 0U

Fourth most recent repeated distance minus one.

Definition at line 66 of file xz.hpp.

Referenced by rpnx::compression::xz_codec::decode_lzma_chunk(), and reset().

◆ repeated_length

length_model rpnx::compression::xz_codec::lzma_model::repeated_length

Length model for repeated matches.

Definition at line 81 of file xz.hpp.

Referenced by rpnx::compression::xz_codec::decode_lzma_chunk().

◆ state

std::uint8_t rpnx::compression::xz_codec::lzma_model::state = 0U

Current LZMA literal/match state.

Definition at line 67 of file xz.hpp.

Referenced by rpnx::compression::xz_codec::compress_lzma_literals(), rpnx::compression::xz_codec::decode_lzma_chunk(), and reset().


The documentation for this struct was generated from the following file: