Skip to main content

Module format

Module format 

Source
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§

ChunkEntry
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.
DecodeError
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.
FixedHeader
The 80-byte fixed header’s section geometry, plus the container version that says how to read the index below it.
FrameRequest
One plane, addressed the way both the index and the callers address it.
GroupEntry
One 4-byte group entry: a run of consecutive frames on the shared axis.
IndexHeader
The 16-byte index header. Its magic, entry size, version and reserved word are fixed for v1, so entry_count is the only field it carries.
IndexHeaderV2
The 32-byte v2 index header: the tiling, the partition sizes and the one compression every chunk uses.
PlaneEntry
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.
TileGeometry
How a grid is cut into tiles: derived arithmetic over the metadata grid and the index header, stored nowhere.
TileRect
A rectangle of tiles, the unit a viewport asks for. Inclusive of both ends.
VariableEntry
One 4-byte variable entry: an id and the predictor every chunk of that variable is coded with.

Enums§

Compression
Predictor

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.

Functions§

align8
The next multiple of 8 at or above value, or None on overflow.
crc32
gcd
Greatest common divisor, used on both sides to reduce a time axis to the coarsest unit that expresses every offset exactly.