Skip to main content

encode_yuv

Function encode_yuv 

Source
pub fn encode_yuv(yuv: &Yuv, cfg: &EncodeConfig) -> Result<Vec<u8>, EncodeError>
Expand description

Encode pre-converted planar YCbCr directly, skipping the RGB→YCbCr step.

The Yuv carries its own chroma format and bit depth; cfg.chroma is ignored in favour of what is stored in the planes. This entry point is for callers that already hold YCbCr data (camera pipeline, decoder output, etc.). The visible width/height are read from the Yuv itself.

Images wider or taller than 512 px are encoded as a HEIF grid of 512×512 tiles automatically.

Plane dimensions must satisfy the chroma subsampling grid. Use Yuv::from_planes or [yuv::rgb_to_yuv] to produce a conformant Yuv; those functions validate plane sizes on construction.