Expand description
The Xue container’s byte layout, shared by the decoder and the encoder.
docs/format.md is the normative spec. This module is the one place the
spec’s offsets and widths are written down: the decoder unpacks structures
through it and the native encoder packs them through it, so a field can
never drift between the two halves of the crate.
Everything here is pure byte conversion. It validates only what a field’s
own encoding demands — a magic number, a reserved word, an enum’s code —
and never allocates from a file value. Cross-section geometry, the
metadata grid, dependency chains and every other semantic rule stay in
crate::decode, which is what actually reads untrusted files.
Structs§
- Chunk
Entry - One 8-byte chunk entry. A chunk’s offset is not stored: the physical order is the spec’s and chunks are strictly adjacent, so an offset is the prefix sum of the lengths before it.
- Decode
Error - A file that cannot be read as Xue v1, at any layer: a malformed byte
layout here, or a violated structural rule in
crate::decode. - Fixed
Header - The 80-byte fixed header’s section geometry, plus the container version that says how to read the index below it.
- Frame
Request - One plane, addressed the way both the index and the callers address it.
- Group
Entry - One 4-byte group entry: a run of consecutive frames on the shared axis.
- Index
Header - The 16-byte index header. Its magic, entry size, version and reserved word
are fixed for v1, so
entry_countis the only field it carries. - Index
Header V2 - The 32-byte v2 index header: the tiling, the partition sizes and the one compression every chunk uses.
- Plane
Entry - One 40-byte index entry: where a plane’s payload is, how to undo its coding, and what the decoded bytes must check out as.
- Tile
Geometry - How a grid is cut into tiles: derived arithmetic over the metadata grid and the index header, stored nowhere.
- Tile
Rect - A rectangle of tiles, the unit a viewport asks for. Inclusive of both ends.
- Variable
Entry - One 4-byte variable entry: an id and the predictor every chunk of that variable is coded with.
Enums§
Constants§
- CHUNK_
ENTRY_ SIZE - ENTRY_
SIZE - FLAG_
ZSTD_ CHECKSUM - GROUP_
ENTRY_ SIZE - HEADER_
SIZE - HOUR_
SECONDS - The coarsest time-axis unit, and the only one schema versions 1 and 2 can describe. A schemaVersion 3 axis names its own unit, which must divide it.
- INDEX_
HEADER_ SIZE - INDEX_
HEADER_ SIZE_ V2 - INDEX_
MAGIC - INDEX_
MAGIC_ V2 - INDEX_
VERSION - INDEX_
VERSION_ V2 - MAGIC
- MAX_
PLANE_ LENGTH - Safety limit for one decoded plane: 64M points. A chunk is one tile of one group, so it is bounded by the same limit times the group length, and a group holds at most 255 frames.
- NO_
DEPENDENCY - VARIABLE_
ENTRY_ SIZE - VERSION
- The plane-major container. Still read; no longer written.
- VERSION_
V2 - The tiled container: a payload is a chunk — one tile of one temporal group for one variable — not a whole plane.