Native Zstandard frame, entropy-table, and sequence implementation. More...
#include <algorithm>#include <array>#include <bit>#include <cstddef>#include <cstdint>#include <iterator>#include <limits>#include <optional>#include <span>#include <type_traits>#include <utility>#include <vector>#include <rpnx/compression/implementation/io.hpp>Go to the source code of this file.
Classes | |
| struct | rpnx::compression::zstandard_codec::fse_entry |
| One state transition in an FSE decoding table. More... | |
| struct | rpnx::compression::zstandard_codec::fse_table |
| Native FSE decoding table indexed by the current decoder state. More... | |
| struct | rpnx::compression::zstandard_codec::normalized_probability_result |
| Parsed normalized FSE probabilities and their encoded byte length. More... | |
| struct | rpnx::compression::zstandard_codec::literals_result |
| Decoded literals and the number of compressed-block bytes they occupy. More... | |
| struct | rpnx::compression::zstandard_codec::huffman_node |
| One node in a native canonical Huffman decoding tree. More... | |
| struct | rpnx::compression::zstandard_codec::huffman_table |
| Canonical Huffman decoding tree retained for treeless literal blocks. More... | |
| struct | rpnx::compression::zstandard_codec::huffman_description_result |
| A parsed Huffman tree description and its encoded byte length. More... | |
| struct | rpnx::compression::zstandard_codec::decoder_state |
| Persistent entropy tables and repeat offsets shared by compressed blocks. More... | |
| struct | rpnx::compression::zstandard_codec::length_code_entry |
| Baseline and additional-bit count selected by a sequence length code. More... | |
| struct | rpnx::compression::zstandard_codec::encoded_length |
| Encoded sequence length code and its additional-bit payload. More... | |
| class | rpnx::compression::zstandard_codec::forward_bit_reader |
| Read a byte-aligned, forward, least-significant-bit-first bitstream. More... | |
| class | rpnx::compression::zstandard_codec::reverse_bit_reader |
| Read a Zstandard entropy bitstream from its end toward its beginning. More... | |
| class | rpnx::compression::zstandard_codec::xxhash64_accumulator |
| Incremental XXH64 accumulator for streamed Zstandard checksums. More... | |
Namespaces | |
| namespace | rpnx::compression |
| Facilities for creating and decoding supported compressed streams. | |
| namespace | rpnx::compression::zstandard_codec |
| Internal implementation of Zstandard compression and decompression. | |
Functions | |
| std::uint64_t | rpnx::compression::zstandard_codec::rotate_left (std::uint64_t value, std::uint8_t count) noexcept |
| Rotates a 64-bit value left without compiler-specific intrinsics. | |
| std::uint32_t | rpnx::compression::zstandard_codec::read_word32 (std::span< std::byte const > input, std::size_t offset) noexcept |
| Reads an unchecked little-endian 32-bit word. | |
| std::uint64_t | rpnx::compression::zstandard_codec::read_word64 (std::span< std::byte const > input, std::size_t offset) noexcept |
| Reads an unchecked little-endian 64-bit word. | |
| std::uint64_t | rpnx::compression::zstandard_codec::xxhash64 (std::span< std::byte const > input, std::uint64_t seed=0U) noexcept |
| Computes XXH64 as required by the Zstandard frame checksum. | |
| void | rpnx::compression::zstandard_codec::append_integer (std::vector< std::byte > &output, std::uint64_t value, std::uint8_t byte_count) |
| Appends a little-endian integer with a selected byte count. | |
| std::uint64_t | rpnx::compression::zstandard_codec::read_integer (std::span< std::byte const > input, std::size_t offset, std::uint8_t byte_count) |
| Reads a checked little-endian integer with a selected byte count. | |
| normalized_probability_result | rpnx::compression::zstandard_codec::parse_normalized_probabilities (std::span< std::byte const > input, std::uint8_t maximum_symbol, std::uint8_t maximum_accuracy_log) |
| Parses one forward-coded normalized FSE probability description. | |
| fse_table | rpnx::compression::zstandard_codec::build_fse_table (std::span< std::int16_t const > probabilities, std::uint8_t accuracy_log) |
| Constructs the FSE decoding table for normalized probabilities. | |
| fse_table | rpnx::compression::zstandard_codec::build_rle_fse_table (std::uint8_t symbol) |
| Constructs a one-symbol FSE table for RLE sequence mode. | |
| fse_table | rpnx::compression::zstandard_codec::build_predefined_literal_length_table () |
| Builds the format-defined predefined literal-length FSE table. | |
| fse_table | rpnx::compression::zstandard_codec::build_predefined_match_length_table () |
| Builds the format-defined predefined match-length FSE table. | |
| fse_table | rpnx::compression::zstandard_codec::build_predefined_offset_table () |
| Builds the format-defined predefined offset-code FSE table. | |
| std::vector< std::uint8_t > | rpnx::compression::zstandard_codec::decode_fse_weights (std::span< std::byte const > input) |
| Decodes the two-state FSE stream used for Huffman weights. | |
| huffman_table | rpnx::compression::zstandard_codec::build_huffman_table (std::span< std::uint8_t const > explicit_weights) |
| Builds the canonical Huffman tree implied by transmitted weights. | |
| huffman_description_result | rpnx::compression::zstandard_codec::parse_huffman_description (std::span< std::byte const > input) |
| Parses a direct or FSE-compressed Huffman tree description. | |
| std::vector< std::byte > | rpnx::compression::zstandard_codec::decode_huffman_stream (std::span< std::byte const > input, std::size_t regenerated_size, huffman_table const &table) |
| Decodes one backward Huffman literal stream to an exact byte count. | |
| literals_result | rpnx::compression::zstandard_codec::decode_literals (std::span< std::byte const > block, decoder_state &state) |
| Decodes the literals section at the front of a compressed block. | |
| void | rpnx::compression::zstandard_codec::decompress_compressed_block (std::span< std::byte const > block, std::size_t window_size, std::size_t maximum_output_size, decoder_state &state, std::vector< std::byte > &output) |
| Decodes one compressed block into frame output. | |
| template<std::size_t code_count> | |
| encoded_length | rpnx::compression::zstandard_codec::encode_length (std::size_t length, std::array< length_code_entry, code_count > const &codes) |
| Selects the sequence length code covering one exact length. | |
| std::optional< std::size_t > | rpnx::compression::zstandard_codec::find_repeating_period (std::span< std::byte const > block) |
| Finds a block prefix whose repetition regenerates the suffix. | |
| std::optional< std::vector< std::byte > > | rpnx::compression::zstandard_codec::compress_periodic_block (std::span< std::byte const > block) |
| Encodes a periodic block as raw literals plus one match sequence. | |
| template<std::input_iterator input_iterator, std::sentinel_for< input_iterator > sentinel, typename output_iterator> | |
| output_iterator | rpnx::compression::zstandard_codec::compress (input_iterator first, sentinel last, output_iterator output, compression_options const &options) |
| Compresses an iterator range as a Zstandard frame. | |
| template<std::input_iterator input_iterator, std::sentinel_for< input_iterator > sentinel, typename output_iterator> | |
| output_iterator | rpnx::compression::zstandard_codec::decompress (input_iterator first, sentinel last, output_iterator output, decompression_options const &options) |
| Decompresses one or more Zstandard or skippable frames. | |
Variables | |
| constexpr std::array< length_code_entry, 36U > | rpnx::compression::zstandard_codec::literal_length_codes {length_code_entry{0U, 0U}, {1U, 0U}, {2U, 0U}, {3U, 0U}, {4U, 0U}, {5U, 0U}, {6U, 0U}, {7U, 0U}, {8U, 0U}, {9U, 0U}, {10U, 0U}, {11U, 0U}, {12U, 0U}, {13U, 0U}, {14U, 0U}, {15U, 0U}, {16U, 1U}, {18U, 1U}, {20U, 1U}, {22U, 1U}, {24U, 2U}, {28U, 2U}, {32U, 3U}, {40U, 3U}, {48U, 4U}, {64U, 6U}, {128U, 7U}, {256U, 8U}, {512U, 9U}, {1024U, 10U}, {2048U, 11U}, {4096U, 12U}, {8192U, 13U}, {16384U, 14U}, {32768U, 15U}, {65536U, 16U}} |
| Literal-length code definitions from the Zstandard format. | |
| constexpr std::array< length_code_entry, 53U > | rpnx::compression::zstandard_codec::match_length_codes {length_code_entry{3U, 0U}, {4U, 0U}, {5U, 0U}, {6U, 0U}, {7U, 0U}, {8U, 0U}, {9U, 0U}, {10U, 0U}, {11U, 0U}, {12U, 0U}, {13U, 0U}, {14U, 0U}, {15U, 0U}, {16U, 0U}, {17U, 0U}, {18U, 0U}, {19U, 0U}, {20U, 0U}, {21U, 0U}, {22U, 0U}, {23U, 0U}, {24U, 0U}, {25U, 0U}, {26U, 0U}, {27U, 0U}, {28U, 0U}, {29U, 0U}, {30U, 0U}, {31U, 0U}, {32U, 0U}, {33U, 0U}, {34U, 0U}, {35U, 1U}, {37U, 1U}, {39U, 1U}, {41U, 1U}, {43U, 2U}, {47U, 2U}, {51U, 3U}, {59U, 3U}, {67U, 4U}, {83U, 4U}, {99U, 5U}, {131U, 7U}, {259U, 8U}, {515U, 9U}, {1027U, 10U}, {2051U, 11U}, {4099U, 12U}, {8195U, 13U}, {16387U, 14U}, {32771U, 15U}, {65539U, 16U}} |
| Match-length code definitions from the Zstandard format. | |
Native Zstandard frame, entropy-table, and sequence implementation.
Definition in file zstandard.hpp.