forge
Explore
Log in

Don't you dare go Hollow

wip(av1): EC_WARP_DEBUG sample dump -- MAJOR REFRAME, mismatch predates warp

Browse files at this commit

3a8a953a92c3803cf1a95b02ddfad3e840cb8962Ahmet Kaan GümüşParent: fefaafb
lane-warp round 4, budget-capped stop.

DECISIVE INSTRUMENT (r3's planned next move): added EC_WARP_DEBUG-gated
printf at libaom's av1_find_projection call site (decodemv.c ~1546/1637,
local /tmp/libaom-src checkout, not this repo) dumping mi_row/mi_col,
findSamples' pts/pts_inref, and the resulting wmmat/alpha/beta/gamma/delta;
matching EC_WARP_DEBUG eprintln added here (decode.rs ~5579, in the leaf16
WARPED_CAUSAL arm) dumping our own find_samples/find_projection output at
the same call site. Rebuilt aomdec (decoder-debug preset), ran both sides
on the pinned warp-mismatch.obu fixture.

RESULT: the warp math itself is NOT provably at fault this round -- the
sample coordinates and even the resulting wmmat matched in shape (x/y
sample values identical: pts=(120,-136) both sides), consistent with r3's
line-audit finding warp.rs's arithmetic faithful.

MAJOR REFRAME: cross-referencing libaom's unconditional EC_TRACE
(decodemv.c:1717, fires every inter block, no env gate) against our own
EC_AV1_TRACE (decode.rs:5655, leaf16 only) for the WHOLE 24-frame stream
shows only two real (non-degenerate-skip) content frames exist in decode
order: frame index 1 (ref=LAST_FRAME) and a much later frame (ref=
GOLDEN_FRAME, where WARP_SELECTED_HITS actually fires). ffprobe confirms
this stream has NO reordering (pict_type P for all 23 inter frames, no
hidden altref) -- decode order IS display order, so "frame 1" in the
pinned test's mismatch report is the LAST_FRAME frame, NOT the GOLDEN/warp
frame several frames later. The warp block (mi_row=8,mi_col=0 in libaom's
real stream, motion_mode=2) fires on a frame that is never even reached
by the time the test's assert_eq fails at i=1.

Concretely, on frame index 1 (LAST_FRAME, all four 32x32 leaves):
  libaom: (0,0) skip=0 NEARESTMV mv=(0,0); (0,8) skip=1 NEARESTMV mv=(0,0)
    motion_mode=0 (SIMPLE_TRANSLATION, overlappable=1); (8,0) skip=1
    NEARESTMV mv=(0,0); (8,8) skip=1 NEWMV mv=(-32,0) motion_mode=1 (OBMC)
  ours:   (0,0) skip=0 mv=(0,0) is_new_mv=false [MATCHES]; (0,8) skip=1
    mv=(0,0) is_new_mv=false motion_mode_eligible=1 obmc_selected=1
    [DIVERGES -- we select OBMC, libaom does not]; (8,0) skip=0 mv=(24,0)
    is_new_mv=true [DIVERGES]; (8,8) skip=1 mv=(2,-2) ref=4 [DIVERGES,
    even ref_frame differs]

(0,0) matches on skip/mv/is_new_mv (mv=(0,0) is a trivial integer-pel
copy, so an interp-filter bug there is structurally inert regardless).
r3's ASCII diff mask ("small-magnitude errors, diagonal band, upper-left
half") is consistent with (0,0)'s own RESIDUAL/coefficient decode being
subtly off (skip=0, so real coefficients are coded) rather than any
motion-mode/OBMC/warp symbol bug -- a wrong coefficient desyncs the tile
exactly where we see it: (0,8)'s OBMC symbol reads a different value
than libaom's not because obmc_cdf/context is wrong, but because the bit
reader is already at the wrong position by the time it gets there.

NEXT ROUND'S FIRST MOVE: stop auditing warp.rs -- the fixture's frame-1
mismatch is provably upstream of any warp code. Verify (0,0)'s residual
path first: dump libaom's coefficient levels for this exact leaf (add an
EC_WARP_DEBUG-style printf in decodetxb.c/reconinter around the (0,0)
32x32 block's dequant+inverse-transform) vs our own dequant_and_inverse_
typed's existing EC_AV1_TRACE dequant printout (decode.rs ~1704,
"TRACE dequant plane=... levels=... residual=..."), same block. If levels
differ, it's a coefficient-context/EOB bug; if levels match but residual
differs, it's the inverse-transform/rounding chain. Once (0,0) round-trips
exactly, re-run the pinned test -- the warp block many frames later may
turn out to already be correct, or a fresh independent bug once the tile
is back in sync that far downstream.

Gate/test changes this round: none (only the env-gated debug eprintln in
leaf16's WARPED_CAUSAL arm, dead code on any non-diagnostic run). cargo
check -p ec-av1 --lib clean.

tmpfs: 65% at session start (not yet re-measured this round).
crates/ec-av1/src/decode.rsmodified+18 -0
@@ -5697,6 +5697,15 @@ fn decode_inter_block(
56975697 mi_rows as usize,
56985698 ref_frame,
56995699 );
5700+ if std::env::var_os("EC_WARP_DEBUG").is_some() {
5701+ eprintln!(
5702+ "EC_WARP_DEBUG findSamples mi_row={mi_row} mi_col={mi_col} bsize={side} num_proj_ref={}",
5703+ samples.len()
5704+ );
5705+ for (i, s) in samples.iter().enumerate() {
5706+ eprintln!("EC_WARP_DEBUG sample[{i}] pts={:?} pts_inref={:?}", s.pts1, s.pts2);
5707+ }
5708+ }
57005709 if samples.len() > 1 {
57015710 crate::warp::select_samples(mv, &mut samples, side as i32, side as i32);
57025711 }
@@ -5709,6 +5718,15 @@ fn decode_inter_block(
57095718 mi_row as i32,
57105719 mi_col as i32,
57115720 );
5721+ if std::env::var_os("EC_WARP_DEBUG").is_some() {
5722+ eprintln!(
5723+ "EC_WARP_DEBUG projection mi_row={mi_row} mi_col={mi_col} num_proj_ref(final)={} mv=({},{}) params={:?}",
5724+ samples.len(), mv.0, mv.1, warp_params
5725+ );
5726+ for (i, s) in samples.iter().enumerate() {
5727+ eprintln!("EC_WARP_DEBUG sample_used[{i}] pts={:?} pts_inref={:?}", s.pts1, s.pts2);
5728+ }
5729+ }
57125730 }
57135731 }
57145732 } else {