forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 6828b152fbb3de7dbfdfdce189e9b72de86552f7Filtered to crates/ec-h265/src/lib.rsClear filter

2026-08-14

feat(h265): full-depth quadtree search, VA-API check, parse-side fuzzAhmet Kaan Gümüş · b19a281
feat(h265): full-depth quadtree search, VA-API check, parse-side fuzz

The search goes down to 8x8 by default because on real pictures that is
both better and no slower: measured on a 1080p camera frame at QP 22,
-27% bits and +1.5 dB against stopping at 16x16, at the same wall time.
The 16x16 floor stays available as a setting.

Two defects the earlier tests could not see, both found by pointing the
encoder at real footage:

- stopping the search early skipped split_cu_flag entirely, while the
  sequence still allowed a split. Every picture decoded to noise. The
  flag is written now whatever the search decides.
- a fuzzed SPS could name a 45-bit POC field and take ec-core's bit
  reader past its documented contract. Picture size, POC width and
  long-term set count are validated where they are parsed.

Also: VA-API decode of the encoder's own output is a test (radeonsi, real
GPU), progress counters are one per cache line - twelve workers polling
eight counters per line spend their time invalidating each other - and
waits back off to a sleep instead of spinning on a core someone needs.
feat(h265): wavefront-parallel intra IDR encoderAhmet Kaan Gümüş · fa29faa
feat(h265): wavefront-parallel intra IDR encoder

One encode_idr call uses every core: entropy_coding_sync (WPP) makes each
CTB row a substream, a worker starts a row once the row above is two CTBs
ahead, and the only shared mutable state is one atomic byte per boundary
sample plus a progress counter. No unsafe, no rayon, and the bitstream is
identical whatever the thread count - a test asserts that.

Deblocking and SAO are signalled off. An intra-only stream predicts from
its own reconstruction, so an in-loop filter changes what a decoder shows
without changing what either side predicts from; off, the encoder's
reconstruction is bit-identical to ffmpeg's decode, which the conformance
test checks at four picture shapes including 1916x1080.
feat(h265): intra prediction and coding-unit rate-distortion decisionsAhmet Kaan Gümüş · d43b87f
feat(h265): intra prediction and coding-unit rate-distortion decisions

All 35 modes with the spec's reference substitution, smoothing and
boundary filters, then a quadtree that minimises SSD + lambda * bits with
the bits measured rather than modelled.

Two things the trial machinery has to put back that are easy to miss: the
bytes a losing trial wrote over the winner's, and the z-scan availability
map a leaf trial marked. Either one left behind desynchronises the
decoder - a whole picture of noise, not a fraction of a dB.
feat(h265): integer transforms, quantiser and the CABAC coderAhmet Kaan Gümüş · 990d3ac
feat(h265): integer transforms, quantiser and the CABAC coder

The inverse transform and the dequantiser are the normative ones, so the
encoder's reconstruction is what a decoder produces. Only the first 16
columns of the 32x32 matrix are typed in; the rest follow from the
matrix's own symmetry, and tests check both the printed second half and
orthogonality, because a mistyped column is the classic defect here.

The CABAC coder can run in counting mode - identical context updates, no
bytes kept - which is how rate-distortion decisions are priced at the
rate they actually cost. A spec-derived decoder in the tests reads back
what the encoder writes.