Skip to main content

Module chunks

Module chunks 

Source
Expand description

One codec per chunk type ([spec/03-chunks.md], [spec/09-layer-data.md], [spec/10-scene-chunks.md]).

Each codec deals in plaintext payload bytes: decryption and the zstd layer are the caller’s business, because whether a chunk carries a zstd frame is a property of its type (section 6.3) while whether it is sealed is a property of its descriptor.

Re-exports§

pub use extd::Extension;
pub use head::Head;
pub use lhas::LayerHashes;
pub use ltbl::LayerEntry;
pub use ltbl::LayerTable;
pub use preview::Preview;
pub use preview::PreviewRole;
pub use zdic::ZstdDictionary;

Modules§

extd
The EXTD chunk: vendor and future-standard extensions ([spec/10-scene-chunks.md] section 4.12).
head
The HEAD chunk: display dimensions, layer count and encoder identity ([spec/04-head.md] section 4.1).
json_chunks
The JSON chunks: META, PROF and LROV ([spec/05-meta.md], [spec/06-prof.md], [spec/08-print-control.md]).
layr
The LAYR chunk: one sector’s mask data for one group of layers, as a single zstd frame ([spec/09-layer-data.md] section 4.9).
lhas
The LHAS chunk: per-layer leaf hashes and a Merkle root ([spec/09-layer-data.md] section 4.10).
ltbl
The LTBL chunk: the layer table ([spec/09-layer-data.md] section 4.7).
preview
The PREV chunk: a PNG preview, with its role in the descriptor flags ([spec/08-print-control.md] section 4.6).
voxl
The VOXL chunk: an embedded scene, opaque to LUMEN ([spec/10-scene-chunks.md] section 4.11).
zdic
The ZDIC chunk: the zstd dictionary shared by every LAYR frame ([spec/09-layer-data.md] section 4.8).

Constants§

MAX_ZSTD_RATIO
The largest expansion zstd can produce for a chunk payload, used as a coarse guard before a bound specific to the chunk is available.

Functions§

allocation_bound
The decompressed-size bound a LAYR chunk’s frame may not exceed.
check_allocation
Reject a declared size above the bound the file’s own structure allows.
compress
Compress a chunk payload into a zstd frame, optionally against a dictionary.
decompress
Decompress a zstd frame, checking the result is exactly uncompressed_size.
decompress_frame
Decompress a LAYR frame, sizing its output from the frame’s own header and bounding it by bound.
decompress_within
Decompress a zstd frame, refusing a declared size above bound.
dictionary_id
The dictionary ID a raw dictionary reports.
frame_content_size
The decompressed length a frame’s own header declares.
frame_dict_id
The dictionary ID a frame reports, or 0 when the frame used no dictionary.
train_dictionary
Train a zstd dictionary from layer samples (section 6.2).