Repository navigation
How It Works
HarpePluie edited this page Oct 8, 2026
·
1 revision
photo.heic ──▶ container ──▶ HEVC bitstream ──▶ HEVC decoder ──▶ assembly ──▶ RGB(A)
(heifer-isobmff) per tile (heifer-hevc-dec) (heifer)
-
Container. A HEIF file is an ISOBMFF file, the same box structure as MP4.
-
heifer-isobmffparses the boxes into items: images, grids, overlays, EXIF, XMP. - Items have properties: size (
ispe), HEVC configuration (hvcC), colour (colr) and transforms. - Items are linked by references: tiles of a grid, alpha plane, thumbnail.
-
-
Bitstream. For each tile, heifer extracts the HEVC data and adds the parameter sets (VPS/SPS/PPS) from
hvcC. -
Decoding.
heifer-hevc-decimplements HEVC intra decoding, following ITU-T H.265:- NAL units and parameter sets;
- CABAC entropy decoding;
- intra prediction (35 modes);
- inverse transforms;
- deblocking and SAO filters. Grid tiles are independent, so they are decoded in parallel.
-
Assembly.
heiferthen turns the decoded tiles into the final image:- it stitches the tiles together;
- it attaches the alpha plane;
- it converts YCbCr to RGB;
- it applies crop, rotation and mirror.
| Crate | Role |
|---|---|
heifer |
public API: decode, read_metadata, image integration |
heifer-isobmff |
HEIF container parsing |
heifer-hevc-dec |
HEVC intra decoder |
heifer-hevc-enc |
HEVC encoder (work in progress) |
The lower-level crates can be used on their own, for example to extract the HEVC stream of a photo:
let file = heifer_isobmff::HeifFile::parse(&bytes)?;
let tiles = file.referenced_items(file.primary_id, b"dimg");
let hevc = file.hevc_bitstream(tiles[0])?; // Annex B, readable by heifer-hevc-dec or ffmpeg