Skip to main content

decode_chunk

Function decode_chunk 

Source
pub fn decode_chunk(
    bytes: &[u8],
    frames: u32,
    height: u32,
    width: u32,
    predictor: Predictor,
) -> Result<Vec<u8>, DecodeError>
Expand description

Decode one chunk payload outside any container.

This is the container’s own chunk path — one Zstandard frame holding frames × height × width bytes, frame-major and row-major within a frame, RAW or a PREVIOUS residual chain — applied to bytes that did not come out of a .xue index: an inner chunk of the Zarr store (docs/zarr-profile.md), whose only integrity check is the frame’s own content checksum, which is therefore mandatory here. Only the RAW and PREVIOUS predictors exist inside a chunk; the plane-level ANCHOR and ZERO of container v1 are refused.

Nothing is allocated before the shape is validated: a chunk is capped at MAX_PLANE_LENGTH bytes in total, the container’s own plane limit.