|
ZXC 0.15.0
High-performance asymmetric lossless compression library
|
Compression / decompression context. More...
#include <zxc_internal.h>
Data Fields | |
| uint32_t * | hash_table |
| Hash table for LZ77 match positions (epoch|pos). | |
| uint8_t * | hash_tags |
| Split tag table for fast match rejection (8-bit tags). | |
| uint16_t * | chain_table |
| Chain table for collision resolution. | |
| void * | memory_block |
| Single allocation block owner. | |
| uint32_t | epoch |
| Current epoch for lazy hash table invalidation. | |
| uint32_t * | buf_sequences |
| Buffer for sequence records (packed: LL(8)|ML(8)|Offset(16)). | |
| uint8_t * | buf_tokens |
| Buffer for token sequences. | |
| uint16_t * | buf_offsets |
| Buffer for offsets. | |
| uint8_t * | buf_extras |
| Buffer for extra lengths (vbytes for LL/ML). | |
| uint8_t * | buf_split |
| Match-splitting scratch, one byte per sequence. | |
| zxc_glo_split_hist_t * | buf_split_hist |
| Match-splitting escape histograms. | |
| uint8_t * | literals |
| Buffer for literal bytes. | |
| uint8_t * | lit_buffer |
| Scratch buffer for literals (RLE / Huffman). | |
| size_t | lit_buffer_cap |
| Current capacity of the scratch buffer. | |
| uint8_t * | work_buf |
| Padded scratch buffer for buffer-API decompression. | |
| size_t | work_buf_cap |
| Capacity of the work buffer. | |
| uint8_t * | tok_buffer |
| Decode scratch for a Huffman-coded GLO token section (enc_tok == HUFFMAN); NULL on compress. | |
| size_t | tok_buffer_cap |
| Capacity of tok_buffer in bytes. | |
| uint8_t * | pivco_scratch |
| Level ping-pong scratch for PivCo decode. | |
| size_t | pivco_scratch_cap |
| Capacity of pivco_scratch in bytes. | |
| void * | entropy_block |
| Lazy allocation backing tok_buffer + pivco_scratch (heap decode contexts, first entropy block only). | |
| uint8_t * | opt_scratch |
| Optimal-parser DP scratch (level >= 6 only, lazy-allocated, packs dp/parent_len/parent_off/actions). | |
| size_t | opt_scratch_cap |
| Current capacity of opt_scratch in bytes. | |
| int | checksum_enabled |
| 1 if checksum calculation/verification is enabled. | |
| int | compression_level |
| Compression level. | |
| size_t | dict_size |
| Dictionary prefill size (0 = no dictionary). | |
| uint8_t * | dict_buffer |
| [dict | data] concat scratch carved from memory_block when dict_size > 0 (NULL otherwise). | |
| size_t | dict_buffer_cap |
| Capacity of dict_buffer in bytes (0 = none). | |
| zxc_dict_huf_state_t * | dict_huf |
| Tree-at-attach state (PivCo tree + codes + code lengths), carved from the workspace only when dict_size > 0 (NULL otherwise); built once by zxc_cctx_attach_dict_huf. | |
| int | dict_huf_tree_ok |
| 1 when *dict_huf is built and valid. | |
| uint32_t * | lit_freq_acc |
| Trainer hook: when non-NULL, the GLO encoder accumulates post-LZ literal byte frequencies here (256 entries). | |
| size_t | chunk_size |
| Effective block size in bytes. | |
| uint32_t | offset_bits |
| log2(chunk_size) - governs epoch_mark shift. | |
| uint32_t | offset_mask |
| (1U << offset_bits) - 1 | |
| uint32_t | max_epoch |
| 1U << (32 - offset_bits) | |
Compression / decompression context.
Holds the buffers reused across blocks to avoid repeated allocations.
Key fields:
hash_table: epoch-tagged positions (ZXC_LZ_HASH_SIZE * 4 bytes).hash_tags: 8-bit tags for fast match rejection (ZXC_LZ_HASH_SIZE * 1 byte).chain_table: collision chain storing the previous occurrence of a hash, forming a linked list per bucket and enabling history traversal.epoch: drives "lazy hash table invalidation". Instead of memset-ing the hash table for every block, we store (epoch << offset_bits) | offset; an entry whose stored epoch differs from ctx->epoch is treated as empty. Definition at line 1884 of file zxc_internal.h.
| uint8_t* zxc_cctx_t::buf_extras |
Buffer for extra lengths (vbytes for LL/ML).
Definition at line 1897 of file zxc_internal.h.
Referenced by zxc_cctx_free().
| uint16_t* zxc_cctx_t::buf_offsets |
| uint32_t* zxc_cctx_t::buf_sequences |
Buffer for sequence records (packed: LL(8)|ML(8)|Offset(16)).
Definition at line 1894 of file zxc_internal.h.
Referenced by zxc_cctx_free().
| uint8_t* zxc_cctx_t::buf_split |
Match-splitting scratch, one byte per sequence.
Definition at line 1898 of file zxc_internal.h.
Referenced by zxc_cctx_free().
| zxc_glo_split_hist_t* zxc_cctx_t::buf_split_hist |
Match-splitting escape histograms.
Definition at line 1899 of file zxc_internal.h.
Referenced by zxc_cctx_free().
| uint8_t* zxc_cctx_t::buf_tokens |
Buffer for token sequences.
Definition at line 1895 of file zxc_internal.h.
Referenced by zxc_cctx_free().
| uint16_t* zxc_cctx_t::chain_table |
Chain table for collision resolution.
Definition at line 1889 of file zxc_internal.h.
Referenced by zxc_cctx_free().
| int zxc_cctx_t::checksum_enabled |
1 if checksum calculation/verification is enabled.
Definition at line 1923 of file zxc_internal.h.
Referenced by zxc_seek_mt_worker(), zxc_static_decompress_block(), and zxc_stream_worker().
| size_t zxc_cctx_t::chunk_size |
Effective block size in bytes.
Definition at line 1939 of file zxc_internal.h.
Referenced by zxc_seek_mt_worker().
| int zxc_cctx_t::compression_level |
Compression level.
Definition at line 1924 of file zxc_internal.h.
Referenced by zxc_stream_worker().
| uint8_t* zxc_cctx_t::dict_buffer |
[dict | data] concat scratch carved from memory_block when dict_size > 0 (NULL otherwise).
Definition at line 1926 of file zxc_internal.h.
Referenced by zxc_cctx_free(), zxc_compress(), zxc_compress_cctx(), zxc_dctx_decode_frame(), zxc_decompress_block(), zxc_seek_mt_worker(), zxc_seek_use_dict(), zxc_stream_worker(), and zxc_train_dict_huf().
| size_t zxc_cctx_t::dict_buffer_cap |
Capacity of dict_buffer in bytes (0 = none).
Definition at line 1928 of file zxc_internal.h.
Referenced by zxc_cctx_free().
| zxc_dict_huf_state_t* zxc_cctx_t::dict_huf |
Tree-at-attach state (PivCo tree + codes + code lengths), carved from the workspace only when dict_size > 0 (NULL otherwise); built once by zxc_cctx_attach_dict_huf.
Valid iff dict_huf_tree_ok.
Definition at line 1929 of file zxc_internal.h.
Referenced by zxc_cctx_free(), and zxc_stream_worker().
| int zxc_cctx_t::dict_huf_tree_ok |
1 when *dict_huf is built and valid.
Definition at line 1933 of file zxc_internal.h.
Referenced by zxc_cctx_free().
| size_t zxc_cctx_t::dict_size |
Dictionary prefill size (0 = no dictionary).
Definition at line 1925 of file zxc_internal.h.
Referenced by zxc_cctx_free(), zxc_compress_cctx(), zxc_decompress_block(), zxc_seek_mt_worker(), zxc_seek_use_dict(), and zxc_static_decompress_block().
| void* zxc_cctx_t::entropy_block |
Lazy allocation backing tok_buffer + pivco_scratch (heap decode contexts, first entropy block only).
NULL on compress contexts and static workspaces. Freed by zxc_cctx_free.
Definition at line 1914 of file zxc_internal.h.
Referenced by zxc_cctx_alloc_entropy_scratch(), and zxc_cctx_free().
| uint32_t zxc_cctx_t::epoch |
Current epoch for lazy hash table invalidation.
Definition at line 1891 of file zxc_internal.h.
Referenced by zxc_cctx_free().
| uint32_t* zxc_cctx_t::hash_table |
Hash table for LZ77 match positions (epoch|pos).
Definition at line 1887 of file zxc_internal.h.
Referenced by zxc_cctx_free().
| uint8_t* zxc_cctx_t::hash_tags |
Split tag table for fast match rejection (8-bit tags).
Definition at line 1888 of file zxc_internal.h.
Referenced by zxc_cctx_free().
| uint8_t* zxc_cctx_t::lit_buffer |
Scratch buffer for literals (RLE / Huffman).
Definition at line 1903 of file zxc_internal.h.
Referenced by zxc_cctx_free().
| size_t zxc_cctx_t::lit_buffer_cap |
Current capacity of the scratch buffer.
Definition at line 1904 of file zxc_internal.h.
Referenced by zxc_cctx_free().
| uint32_t* zxc_cctx_t::lit_freq_acc |
Trainer hook: when non-NULL, the GLO encoder accumulates post-LZ literal byte frequencies here (256 entries).
NULL outside dictionary training.
Definition at line 1934 of file zxc_internal.h.
Referenced by zxc_cctx_free(), and zxc_train_dict_huf().
| uint8_t* zxc_cctx_t::literals |
Buffer for literal bytes.
Definition at line 1900 of file zxc_internal.h.
Referenced by zxc_cctx_free().
| uint32_t zxc_cctx_t::max_epoch |
1U << (32 - offset_bits)
Definition at line 1942 of file zxc_internal.h.
| void* zxc_cctx_t::memory_block |
Single allocation block owner.
Definition at line 1890 of file zxc_internal.h.
Referenced by zxc_cctx_free().
| uint32_t zxc_cctx_t::offset_bits |
log2(chunk_size) - governs epoch_mark shift.
Definition at line 1940 of file zxc_internal.h.
| uint32_t zxc_cctx_t::offset_mask |
(1U << offset_bits) - 1
Definition at line 1941 of file zxc_internal.h.
| uint8_t* zxc_cctx_t::opt_scratch |
Optimal-parser DP scratch (level >= 6 only, lazy-allocated, packs dp/parent_len/parent_off/actions).
Also the Huffman code-length builder's and nudge's scratch (ZXC_HUF_NUDGE_SCRATCH_SIZE).
Definition at line 1918 of file zxc_internal.h.
Referenced by zxc_cctx_free().
| size_t zxc_cctx_t::opt_scratch_cap |
Current capacity of opt_scratch in bytes.
Definition at line 1922 of file zxc_internal.h.
Referenced by zxc_cctx_free().
| uint8_t* zxc_cctx_t::pivco_scratch |
Level ping-pong scratch for PivCo decode.
Definition at line 1912 of file zxc_internal.h.
Referenced by zxc_cctx_alloc_entropy_scratch(), and zxc_cctx_free().
| size_t zxc_cctx_t::pivco_scratch_cap |
Capacity of pivco_scratch in bytes.
Definition at line 1913 of file zxc_internal.h.
Referenced by zxc_cctx_alloc_entropy_scratch(), and zxc_cctx_free().
| uint8_t* zxc_cctx_t::tok_buffer |
Decode scratch for a Huffman-coded GLO token section (enc_tok == HUFFMAN); NULL on compress.
Heap decode contexts defer it (with pivco_scratch) to the first entropy section, see entropy_block.
Definition at line 1907 of file zxc_internal.h.
Referenced by zxc_cctx_alloc_entropy_scratch(), and zxc_cctx_free().
| size_t zxc_cctx_t::tok_buffer_cap |
Capacity of tok_buffer in bytes.
Definition at line 1911 of file zxc_internal.h.
Referenced by zxc_cctx_alloc_entropy_scratch(), and zxc_cctx_free().
| uint8_t* zxc_cctx_t::work_buf |
Padded scratch buffer for buffer-API decompression.
Definition at line 1905 of file zxc_internal.h.
Referenced by zxc_cctx_free(), zxc_dctx_decode_frame(), and zxc_seek_mt_worker().
| size_t zxc_cctx_t::work_buf_cap |
Capacity of the work buffer.
Definition at line 1906 of file zxc_internal.h.
Referenced by zxc_cctx_alloc_entropy_scratch(), zxc_cctx_free(), and zxc_dctx_decode_frame().