Commits
Commits on
5c8eff8ca5a0d547bfb22a690b3f7afb373da607Filtered to crates/ec-h265/src/lib.rsClear filter2026-08-27
feat(h265): begin a software HEVC decoder — CABAC decode + CTU quadtreeAhmet Kaan Gümüş · d55730b
feat(h265): begin a software HEVC decoder — CABAC decode + CTU quadtree Module map (crates/ec-h265): - cabac.rs: CabacDecoder, the arithmetic-decode mirror of CabacEncoder, sharing RANGE_TAB_LPS/TRANS_IDX_LPS/TRANS_IDX_MPS/Contexts. Promoted from a test-only RefDecoder that already existed and matched the spec flowcharts; added decode_bin/decode_bypass/decode_terminate and a WPP byte_position_aligned() helper. - residual.rs: decode_residual, a bin-for-bin mirror of encode_residual. Round-trip tested against encode_residual across every block size/scan/plane/sign-hiding combination. - decode.rs (new): the coding-tree/transform-tree walk ec-h265 had no decode-shaped twin for. Reuses crate::intra and crate::transform as-is. decode_idr_au() parses VPS/SPS/PPS + one I slice and refuses inter slices with a stated reason. Gates: decoder_inverts_the_encoder_bin_by_bin and decode_residual_inverts_encode_residual green; tests/decode.rs round-trip green at 32x32 and 96x64 (WPP), 70x50 checkpoint-ignored (same coded dims as the passing 96x64 case — content-triggered desync, documented for the next round). Pre-existing cargo test -p ec-h265 --release: 15/15 green.
2026-08-26
feat(h265): in-loop deblocking filter, on by defaultAhmet Kaan Gümüş · 96b7b12
feat(h265): in-loop deblocking filter, on by default Spec 8.7.2, written from the text. An intra-only stream simplifies it twice over: intra prediction reads unfiltered reconstruction, so the filter is a post-pass over the finished picture and the picture-hash SEI stays honest; and every edge has bS = 2, so the whole strength derivation reduces to finding the transform-block boundaries. TuMap carries one byte per 4x4 unit -- log2 of the transform covering it. Transform blocks of side S are aligned to multiples of S, so an edge at x is a boundary exactly when x % S == 0, and no edge list is needed. Each wavefront worker publishes its band; the encoder stitches them, filters every vertical edge, then every horizontal one over the result. Writing the filter exposed an encoder bug: the RQT split trial marks four child transform blocks, and when the nosplit trial won nothing rewrote those cells, so the map reported a boundary inside a 32x32 transform. Reconstruction and coefficients were restored between trials; the side map was not. The nosplit branch now marks its own transform, and tu_log2 rides the CU-depth meta snapshot. ffmpeg decodes every shape bit-exactly with the filter on. BD-PSNR against a deblocking x265, our filter off then on: film -0.197 -> +0.063 dB, screen capture +0.606 -> +0.693, web clip +0.567 -> +0.686, phone clip +0.113 -> +0.162, synthetic +8.781 -> +8.796. Every clip improves, so it defaults on.
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.