rusty_h265 0.8: HEVC Range Extensions, 4:2:2 and 4:4:4 in Pure Rust
rusty_h265 0.8 decodes 4:2:2 and 4:4:4 HEVC at up to 12 bits, checked against conformance streams and FFmpeg. What the work took, what it refuses, and the API change.

What do HEVC range extensions add to rusty_h265 0.8?
They add decoding of 4:2:2 and 4:4:4 chroma at 8, 10 and 12 bits, plus range-extension coding tools such as cross-component prediction and RDPCM. The project reports all 147 HEVC_v1 streams still bit-exact, and 30 of 35 in-scope RExt conformance streams bit-exact against FFmpeg, the other five matching published hashes.
rusty_h265 0.8.0 shipped on November 28, 2026, and it's the release that takes the pure-Rust decoder past phone video. HEVC range extensions are the part of H.265 that covers more colour: 4:2:2 and 4:4:4 chroma, and bit depths past 10. Version 0.8 decodes both of those chroma layouts at 8, 10 and 12 bits, plus the range-extension coding tools, and refuses the 16-bit pieces by name.
Everything below comes from pull request 19, the crate's README and the release notes. Every number is the project's own. We read them; we didn't rerun them. If you want the speed story first, the 0.7.0 campaign is the place, and the field note covers what the crate is.
Why HEVC Range Extensions Matter For Photos
Version 1 of the ITU-T H.265 spec gave us Main, Main 10 and Main Still Picture, all 4:2:0. That covers most video and most phone pictures. Cameras went further. Sony's α7 IV Help Guide offers a HEIF mode with half-width, full-height chroma, and those files come out as 10-bit .HIF. A 4:2:0-only decoder simply can't read them.
That was the trigger here. The photo app built on this stack has a file check, and it kept refusing Sony and Canon .HIF grids and 4:4:4 HEIC. So the work started with a census, not code. The author read the range-extension flags from real files with FFmpeg's header trace.
The finding is useful if you're scoping your own decoder. The Sony α7 IV sample, a 10-bit grid from the heic-rs test set, a Nokia 4:4:4 conformance file and 78 libx265 encodes switched on none of the range-extension coding tools. Real files needed the chroma formats, nothing else. Only the JCT-VC RExt conformance suite, 49 streams, exercises every tool.
The HEVC range extensions tools got implemented anyway, since most are small and the conformance streams gate them. The two that exist only for coding above 12 bits did not.
What rusty_h265 0.8 Implements
Here's the shape of the change, in the order a decoder meets the HEVC range extensions.
4:2:2 Means Two Square Chroma Blocks
In 4:2:2 the chroma planes are half width but full height, so a square luma block pairs with a tall chroma block. HEVC handles that by coding each chroma transform block as two squares. The lower square is intra-predicted from the reconstructed upper one.
That ripples. There's a second pair of chroma coded-block flags per transform-tree node, a 4x8 chroma area under four 4x4 luma blocks, a remapped intra mode table, and chroma deblocking on the 8x8 chroma grid with 4-line segments on vertical edges.
One find is worth knowing about. The 2014 edition's mode table maps mode 11 to 11 and 14 to 16. The HM 16 reference software and FFmpeg use 11 to 12 and 14 to 17, which restores the table's symmetry. The author caught it from one block whose FFmpeg prediction fitted angle -5 exactly.
4:4:4 And The Rules Both Formats Share
4:4:4 keeps chroma at full resolution. That brings chroma coded-block flags and residuals at 4x4, a chroma intra mode per NxN partition, reference smoothing on chroma, and the mode-dependent scan on 8x8 chroma.
Some rules change for both new formats. Chroma QP clamps at 51 for dequantisation and deblocking. Chroma motion vectors run at 1/8 sample on each axis. SAO, PCM and intra-availability geometry are computed per axis, and motion compensation handles 64x64 chroma blocks.
The Range-Extension Tools, And The Two Left Out
The tool list is long: transform-skip rotation and context, implicit and explicit RDPCM, cross-component prediction, persistent Rice adaptation, transform skip up to 32x32, chroma QP offset lists, high-precision weighted-prediction offsets, disabled intra smoothing, and the version-2 SAO offset scale. That last one matters at 12 bits, where the version-1 formula gives the wrong offsets.
Refused by name: bit depths above 12, extended_precision_processing_flag, cabac_bypass_alignment_enabled_flag and separate_colour_plane_flag. A stream that needs them gets an error, not a wrong picture. The README lists the 16-bit tools as roadmap.
How The Release Was Checked, And What It Costs
The gates are the reason to trust a decoder, so here they are.
Conformance Gates And A Third Reference
All 147 HEVC_v1 conformance streams still decode bit-exact, with every SEI picture hash clean. Against FFmpeg 9.1, 76 of 78 libx265 encodes in the new chroma formats are bit-exact, and all 78 match their in-band MD5 hashes. Of the 49 RExt conformance streams, 14 are refused by name and 35 are in scope; 30 of those are bit-exact against FFmpeg. The three target HEIF files come out byte-identical to FFmpeg.
The other five are the interesting part. Where FFmpeg and rusty_h265 disagreed, a third reference broke the tie, and the PR reports it sided with the Rust decoder every time. That covers two x265 12-bit streams at QP 51 from the libx265 set and, in the conformance set, two Sony streams with different luma and chroma depths and three Apple streams mixing tiles and wavefronts.
The 4:2:0 Path Stays On Version-1 Code
The first push cost ordinary 4:2:0 content a per-block dispatch. The fix makes the slice decoder generic over a const bool chosen once per slice, so a stream with no range-extension needs compiles every new branch out.
Callgrind counts against 0.7.4 now fall 0.16 to 0.69 percent across six streams. On the wall clock, HEIC photos and inter video sit inside the null arm. One all-intra 720p clip, ipred_x24, still reads about 1 percent slow while running fewer instructions. The author suspects code layout and says so instead of tuning alignment by trial. The companion rusty_h265-accel 0.8.0 adds dual-plane chroma interpolation kernels, a project-reported 4.5 percent fewer inter instructions.
Upgrading, And Where The Photo Side Lives
Bump to 0.8 and check one thing: Sps gains a rext field and Pps gains the remaining range-extension fields. Code that builds either with a struct literal will need edits. The README install snippet still says 0.6, so pin 0.8 yourself. The crate's crates.io page has the current version.
For photos, use rff-format-heif in remade_ffmpeg_rs. Its changelog adds the new chroma formats for HEIC in 0.9.8, and the container handles grids, rotation, alpha and colour. The app that asked for this, Freehold Photo, doesn't open HEIC in its current alpha; its live page on mata.network says so. The repo page and the HEVC comparison are next.
FAQ
Quick answers for builders evaluating this technology.
Which HEVC range-extension features does rusty_h265 still refuse?
Bit depths above 12 and the two tools that only serve them, extended_precision_processing_flag and cabac_bypass_alignment_enabled_flag, plus separate_colour_plane_flag. The decoder rejects them by name instead of guessing. The pull request notes FFmpeg implements neither 16-bit tool and no HEIF writer it surveyed uses them.
Is rusty_h265 0.8 a breaking change for my code?
Possibly. Sps gains a rext: SpsRangeExt field and Pps gains the remaining pps_range_extension() fields. Both structs have public fields, so code that builds them with a struct literal needs updating. intra::predict keeps its signature, and the filter-aware form is the new intra::predict_filtered.
Does 4:2:2 support slow down ordinary 4:2:0 HEVC decoding?
Barely, by the project's numbers. The slice decoder is generic over a const bool picked once per slice, so 4:2:0 runs the version-1 code. Callgrind counts fell 0.16 to 0.69 percent on six streams, but one all-intra 720p clip still reads about 1 percent slower on the wall clock, which the author reports rather than tunes away.
What happened when rusty_h265 and FFmpeg disagreed on a stream?
A third reference decided. On two x265 12-bit streams at QP 51, rusty_h265 matched x265's own MD5 picture hashes and FFmpeg did not. On two Sony mixed-bit-depth streams and three Apple tiles-plus-wavefront streams that FFmpeg does not decode correctly, it matched the published YUV MD5 and every SEI hash.
How do I decode a camera .HIF photo with rusty_h265?
Use rff-format-heif 0.9.8 or later from remade_ffmpeg_rs. It parses the HEIF container, decodes the HEVC items with rusty_h265, handles grids, rotation, alpha and colour, and returns planar YCbCr or 8-bit RGBA. Calling rusty_h265 directly gives you raw planes from an Annex-B stream, not a photo.