Block-independent compression
Block-independent compression encodes each block without requiring decoded history from preceding blocks.
LZ4 independent blocks can still share an external dictionary. Independence removes preceding-block history, not dictionary, boundary or size requirements. A raw block interface needs surrounding metadata to supply decoding bounds. [1] [2]
Random access also requires locating the requested block and deciding what integrity checks cover a partial read. A whole-frame content check cannot be completed from only one selected block. Reordering independently decodable blocks can change the restored object while each block checksum still passes. [3]
The liblz4 1.9.4 dictionary decompression API uses dictionary memory in place. Keep that buffer accessible throughout frame decoding; compression-side CDict creation instead copies the supplied content. This lifetime contract is separate from block independence and dictionary selection. The dictionary controls test supplied-byte identity, not use-after-free or parallel random access. [4] [3]
The raw LZ4 partial decoder returns a requested prefix, not proof of whole-block validity. In Hesela's liblz4 1.9.4 control, it restores all 96 expected bytes from a block with an extra trailing byte while full decoding rejects that input. A shortened literal sequence can instead return fewer bytes without an error. Keep prefix length, input boundaries and object identity separate. [5] [3]
By contrast, DEFLATE permits references into prior blocks; block-local Huffman coding does not establish history independence. [6]
Relations
Citations
- LZ4 Frame Format 1.6.4, pinned to v1.10.0: block independence, checksums and dictionaries
- LZ4 v1.9.4 block format: out-of-band metadata and decoding bounds
- Hesela: LZ4 frame checks, block order and completion
- LZ4 v1.9.4 frame API: compression dictionary copy and decoding buffer lifetime
- LZ4 v1.9.4 raw-block API: LZ4_decompress_safe_partial bounds and return contract
- RFC 1951: DEFLATE format, sections 2 and 3.2-3.3 (Informational, May 1996)