forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 8dbd683068d7f87f21dcc4ed1dfdca786d82c52bFiltered to crates/ec-av1/src/mc.rsClear filter

2026-08-28

feat(av1): compound CONV_BUF blend + distance-weight assign, not wired yetAhmet Kaan Gümüş · 181a784
feat(av1): compound CONV_BUF blend + distance-weight assign, not wired yet

mc.rs: predict_compound_intermediate (round_1=7, no clip, mirrors libaom's
COMPOUND_ROUND1_BITS path) and combine_compound (spec 7.11.3.15 weighted
average, shift = InterPostRound + DIST_PRECISION_BITS) -- pinned against a
whole-pel identity case that round-trips exactly through both stages.

compound.rs (new): dist_wtd_comp_weight_assign, a pure port of libaom's
av1_dist_wtd_comp_weight_assign (quant_dist_weight/quant_dist_lookup_table
search), tested standalone against hand-worked order-hint cases.

Neither is wired into decode.rs yet -- comp_group_idx/compound_idx reads,
Neighbours compound_idx tracking, and the reconstruction call sites are
still open (see HANDOFF).

2026-08-27

feat(av1): interpolation filters beyond REGULAR, incl. per-block SWITCHABLEAhmet Kaan Gümüş · 10f24e6
feat(av1): interpolation filters beyond REGULAR, incl. per-block SWITCHABLE

The ~13% decodes-but-wrong inter flake was a whole missing filter
family: motion compensation always used the REGULAR subpel tables,
while real encoders pick SMOOTH/SHARP per frame -- or SWITCHABLE,
reading a per-block filter symbol pair this decoder never read (the
silently-unread class again; our own encoder writes one fixed filter).
All four table sets land in mc.rs with an aomdec-pinned unit test, the
switchable_interp CDFs and neighbour context follow libaom's
read_mb_interp_filter, and the filter threads from the frame header
through both inter block paths. The forwarding gate ran 10/10 with
zero pixel mismatches and no vacuous skips.
fix(av1): filter-intra was already correct -- gate against a real aomenc streamAhmet Kaan Gümüş · 2adf290
fix(av1): filter-intra was already correct -- gate against a real aomenc stream

The straddling-boundary mismatch against ffmpeg's decode was never the
filter-intra predictor: it's a real AV1 deblocking-filter artifact, and
this decoder has no in-loop deblocking at all. `--loopfilter-control=0`
on the aomenc fixture makes the two decodes byte-exact with zero source
changes to intra.rs/decode.rs's prediction math.

Adds a permanent gate (crates/ec-av1/src/stream.rs) that shells out to a
real standalone aomenc build (ffmpeg's own libaom-av1 wrapper on this box
doesn't expose enable-tx-size-search/loopfilter-control through
-aom-params), asserts the use_filter_intra symbol actually fired via a new
process-global counter (decode::filter_intra_hits), and checks pixel-exact
luma/U/V against ffmpeg's own decode of the identical bytes. The
encoder's screen-content-tools decision is a real internal PSNR trial,
occasionally flips even with palette/intrabc off; the test skips (not
fails) the still-unsupported-gap runs the same way the existing CDEF gate
test does.
fix(av1): 4-tap subpel filters for blocks 4 wide or tallAhmet Kaan Gümüş · aad8b59
fix(av1): 4-tap subpel filters for blocks 4 wide or tall

Spec 7.11.3.4 selects the filter table per axis: an output dimension of 4
or less reads Subpel_Filters' narrow counterpart (av1_sub_pel_filters_4),
whose outer two taps on each side are zero. We fed every block the 8-tap
table, so 4:2:0 chroma under an 8x8 luma leaf -- the common chroma shape,
not a corner -- reached 3 samples past its edge with nonzero weights and
came out +-1 against the reference decoder wherever the extra taps
mattered. Found by diffing libaom's dec_calc_subpel_params against ours:
the phase matched, the tap table did not.

Closes the 640x360 inter straddle sequence's frame-2 U-plane desync; the
whole sequence now round-trips through ffmpeg pixel-exact.
perf(av1): bypass sub-pel filtering for whole-pel motion predictionAhmet Kaan Gümüş · ef383d9
perf(av1): bypass sub-pel filtering for whole-pel motion prediction

Profiled the inter path (stage_timing_breakdown_inter, 720p GOP): 403 of a
408ms motion-search bucket was crate::mc::predict, almost entirely from the
search's own whole-pel log/diamond stage. SUBPEL_FILTERS[0] is the identity
tap and both rounding shifts are exactly that filter's gain, so the two
8-tap passes reproduce the reference sample byte-for-byte at zero fraction
(integer_mv_is_identity already pinned this) -- a clamped direct copy is
bit-identical, not an approximation. Motion search bucket 408.55ms ->
181.85ms, frame total 818.88ms -> 585.24ms, same 997 output bytes.
perf(av1): stop repricing an inter block's chroma trial 13 times overAhmet Kaan Gümüş · cc09bf2
perf(av1): stop repricing an inter block's chroma trial 13 times over

An inter frame's intra-candidate loop in search_inter_block always coded
both chroma planes as DC_PRED, independent of which of the 13 luma modes
the loop was on -- so the identical transform/quantize/coeff_bits call
ran twelve times for nothing on every inter block. Hoist it out of the
loop and clone the one result in (bit-identical: same call, same inputs,
same output, verified by the full 129-test suite and an equal output
byte count on the stage_timing_breakdown_inter probe, 1356 bytes before
and after).

Also add stage_timing_breakdown_inter, an #[ignore]d probe that breaks
one inter frame's time into motion search / mc::predict / transform+
quantize / coeff_bits buckets, which is how this was found: transform+
quantize was the largest bucket (454.78ms of 980.36ms), not motion
search (267.26ms, of which 257.01ms is genuine sub-pel interpolation
work already spent inside the diamond search).

1280x720 inter frame: 980.36ms -> 772.05ms (-21%).
fix(av1): clamp inter MC reads to the reference's true extent, not its coding strideAhmet Kaan Gümüş · 8d520ef
fix(av1): clamp inter MC reads to the reference's true extent, not its coding stride

sequence_round_trips_at_a_non_multiple_size (160x96) failed on inter-frame
chroma/luma content: a spec decoder's reference buffer holds exactly
FrameWidth x FrameHeight (mi_cols*4 x mi_rows*4) -- a superblock's partition
stops early at has_cols/has_rows and never codes syntax for padding
columns/rows beyond the true edge, so those samples are never part of the
decoded picture. MC's Clip3 (spec 7.11.3.4) must clamp reference reads to
that true extent, replicating the true edge, not to this crate's own
padded-to-SUPERBLOCK coding surface.

`mc::sample`/`mc::predict` used one width/height pair for both the buffer's
row stride and the Clip3 clamp bound, conflating the two; split into a
`stride` param (the buffer's real row length, unchanged) plus
`true_width`/`true_height` (the clamp bound, now `Plane::true_width`/
`true_height` at the call site) threaded through `motion::search` and
`encode::mc_trial`.

Gate: 126 passed/1 failed/4 ignored -> 127 passed/0 failed/4 ignored.

2026-08-26

feat(av1): sub-pel motion compensation (spec 7.11.3, EIGHTTAP regular)Ahmet Kaan Gümüş · 082d993
feat(av1): sub-pel motion compensation (spec 7.11.3, EIGHTTAP regular)

Two-stage separable 8-tap filter, InterRound0=3/InterRound1=11 for
8-bit non-compound per spec 7.11.3.2, edge samples clamped rather than
read out of range. Not yet wired into encode.rs (later lane).