diff --git a/lanes/interp3-r3.handoff.md b/lanes/interp3-r3.handoff.md new file mode 100644 index 00000000..08835a2d --- /dev/null +++ b/lanes/interp3-r3.handoff.md @@ -0,0 +1,87 @@ +# lane-interp3 r3 HANDOFF (turn cap) -- root cause FOUND and FIXED, suite still running + +Tip: `f36be26` on branch `lane-interp3` (fix) + this handoff/report commit. + +## Suite state +- r2 suite (unit `interp3-suite-r2-1788327820.service`, log `$HOME/.cache/interp3-suite-r2.log`), + armed at the r2 commit, FINISHED: + `test result: ok. 378 passed; 0 failed; 34 ignored; 0 measured; 0 filtered out; finished in 742.50s` +- r3 suite armed at f36be26: unit `interp3-suite-r3-1788328778.service`, + log `$HOME/.cache/interp3-suite-r3.log`. At the cap it had 258 `... ok`, ZERO + `FAILED`/`panicked`, no `test result:` line yet. READ THAT LINE, do not re-run + blindly, then paste it into `lanes/interp3-r3.report.md` where + `EVIDENCE: SUITE_LINE_PLACEHOLDER` sits. + +## Stage attribution of the frame-7 residue (done FIRST, as chartered) +`EC_AV1_PREFILT_DUMP` on both decoders over the pinned 16-frame stream +(`.../scratchpad/mm.obu`), byte compare per decode-order frame: +frames 0-6 identical, frame 7 = 35 differing luma bytes, 8..15 grow to 224. +=> PRE-FILTER, i.e. prediction/reconstruction, never the loop filter/CDEF/LR. +All 35 sit in luma rows 42-47, cols 16-23, i.e. the block at mi (10,4); +rows 40-41 of that same block are EXACT and the error grows downward. + +## What the OBMC comparison actually said (emitter built, class swept, CLEAN) +Before writing the emitter, the hand comparison against libaom found NO mismatch: +`overlappable_above`/`overlappable_left` stepping and `max_neighbor_obmc` +(`{0,1,2,3,4,4}`, 8x8 -> 1 per pass) match `obmc.h:20-55`; overlap sizes +(4 luma rows above / 4 luma cols left at 8x8, chroma 2) match +`build_obmc_inter_pred_{above,left}`; `av1_skip_u4x4_pred_in_obmc` chroma-above +skip matches; `obmc_mask_1/2/4/8/16/32` are byte-identical to +`reconinter.c:752-765`; OBMC never warps (`if (!build_for_obmc) av1_init_warp_params`). +One real divergence candidate was left un-ported and is still a documented +corner-cut, not a defect on this content: `obmc.h`'s `mi_step == 1` 4-wide pair +merge, and libaom's `op_mi_size = AOMMIN(xd->width, mi_step)` which can exceed +the remaining span while ours clips with `.min(end_col - col)` (only reachable +for a 2nd neighbour with a wide step). + +Emitter: `decode.rs:15806` `ec_obmc_bsize()` + `decode.rs:15828` `ec_obmc_trace()`, +called at both passes in `obmc_blend`. Format is aomdec's own bytes: +`EC_OBMC above|left mi=(r,c) wh=(WxH) rel=N op=N nbmv=(y,x) nbref=N nbbsize=N filt=N` +(`filt` = packed `interp_filters.as_int` = `y | (x << 16)`). +`diff` of the 325 oracle lines vs our 325: EMPTY. OBMC is exonerated. + +Also added `decode.rs:14682` + `:22658` `EC_PICT idx=` (decode-order frame +marker under `EC_OBMC`/`EC_TRACE_MODE`). REQUIRED: the marker prints AFTER the +frame's own trace lines, so `awk` must count markers seen, not read the value on +the preceding line -- attributing by the preceding `EC_PICT` value is off by one +and cost part of this round. + +## Hypotheses ruled out (each by measurement) +- OBMC neighbour fields / masks / overlap: 325/325 identical lines (above). +- Frame 7 has NO OBMC block at mi (10,4) at all -- it is COMPOUND + (SIMPLE_TRANSLATION), so the r2 handoff's "OBMC over a compound neighbour" + suspect could not have been it. +- Residual/entropy: r2's range ladder is exact end to end; `EC_MCDUMP` (a + temporary rung, removed before commit) showed aom_recon - our_residual + reproduces our PREDICTION in rows 40-41 and diverges below => prediction. +- Wrong dual-filter x/y assignment: a swap would err in every row, not only the + lower ones. + +## Root cause (FIXED, gate GREEN) +`decode_inter_block8`'s COMPOUND arm predicted BOTH taps translationally. +libaom applies `allow_warp`'s GLOBAL branch to every `is_global_mv_block` +reference slot -- compound included, independent of `motion_mode` +(`av1_init_warp_params` inside `build_inter_predictors_8x8_and_bigger`'s per-`ref` +loop; `reconinter.c:33-55`). `decode_inter_block`'s compound arm has done this +since lane-cwarp r1 (`decode.rs:16691`). Third twin-functions-drift instance in +this lane. Frame 7 mi (10,4): GLOBAL_GLOBALMV, ref0=GOLDEN mv (0,0), +ref1=ALTREF mv (-3,4), comp_group_idx=1. +Fix: `decode.rs:19513` (`leaf_compound_warp`, `warp0_c`/`warp1_c`), +`decode.rs:19596`/`:19618` (`warp_affine_compound` per luma tap; chroma is 4x4, +below `av1_init_warp_params`'s 8px per-plane bound, so it stays translational). +Counter `COMPOUND_WARP_HITS_8` / `compound_warp_hits_8()` at `decode.rs:1786`. +After the fix ALL 16 decode-order frames are byte-identical pre-filter. + +## Gate +`a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact` +(`stream.rs:6332`) is UN-IGNORED and GREEN with four hard asserts (compound-8x8 +filter read, differing dual-filter directions, 8x8 OBMC blend, 8x8 compound +GLOBAL warp). `$HOME/.cache/interp3-gate-r3.log`: `1 passed; 0 failed`. + +## EXACT NEXT STEP +1. Read the r3 suite `test result:` line, fill the placeholder in the report, + commit. If any test failed, it is a sibling of the warp change: re-run it + alone and bisect against f36be26^. +2. Then the lane's open residue is only the two deferrals in the report + (10-bit arm blocked by lane-inter8's 10-bit 8x8-leaf desync; `--tile-columns=1` + arm blocked by the SB-level rect-partition refusal). diff --git a/lanes/interp3-r3.report.md b/lanes/interp3-r3.report.md new file mode 100644 index 00000000..b0eaf72a --- /dev/null +++ b/lanes/interp3-r3.report.md @@ -0,0 +1,106 @@ +# lane-interp3 r3 -- the 8x8 COMPOUND leaf never applied the per-ref GLOBAL warp; gate is GREEN and un-ignored + +Base: d06d93f (r2 handoff, already merged with main). + +## Root cause (one line) + +`decode_inter_block8`'s COMPOUND arm predicted **both** reference taps +translationally, while libaom applies `allow_warp`'s GLOBAL branch to every +`is_global_mv_block` reference slot -- compound included and independently of +`motion_mode` (`av1_init_warp_params` is called inside +`build_inter_predictors_8x8_and_bigger`'s per-`ref` loop, `reconinter.c:33-55` +for `allow_warp` itself). The 16x16+ compound arm has done this since +lane-cwarp r1 (`decode.rs:16691`); the 8x8 leaf is its twin and drifted. +Third instance in this lane of the class **twin functions drift**. + +Effect on the pinned stream: the GLOBAL_GLOBALMV compound 8x8 leaf at +mi (10,4) of decode-order frame 7 (ref0=GOLDEN mv (0,0), ref1=ALTREF mv +(-3,4), `comp_group_idx=1` masked compound) was predicted with a pure +translation, so its prediction error was 0 at the block's top rows and grew +downward to |delta| 5 -- then propagated through every later frame. + +## It was NOT the OBMC blend (the r2 handoff's first suspect, disproved) + +An `EC_OBMC` emitter was added to both OBMC passes in `decode.rs`, printing the +instrumented aomdec's own byte format +(`EC_OBMC above|left mi=() wh=() rel= op= nbmv=() nbref= nbbsize= filt=`, +`decodeframe.c` `dec_build_prediction_by_{above,left}_pred`). The two decoders +emit **325 identical lines** on the pinned 16-frame stream -- neighbour +position, span, mv, reference, bsize and packed dual-filter pair all agree at +every OBMC call. The class sweep the charter asked for (neighbour-side fields +used by OBMC: filter, ref, mv, scale) is therefore CLEAN by measurement, not by +inspection; `obmc_mask_1/2/4/8/16/32` were also byte-compared against +`reconinter.c:752-765` and match. + +Frame 7 has no OBMC block at mi (10,4) at all: it is a compound block, and +compound blocks take SIMPLE_TRANSLATION. + +## Changed (path:line, this commit) + +- `crates/ec-av1/src/decode.rs:19513` -- `leaf_compound_warp` + + `warp0_c`/`warp1_c`, the leaf's per-slot copy of `decode_inter_block`'s + `compound_warp` (`force_integer_mv` short-circuit, `gm.invalid` guard). +- `crates/ec-av1/src/decode.rs:19596,19618` -- `warp::warp_affine_compound` + replaces each luma tap's translational intermediate, exactly as the 16x16+ + arm does at 17130/17155. Chroma is 4x4 at an 8x8 leaf, below + `av1_init_warp_params`'s own per-plane 8px bound, so chroma stays + translational (same rule the leaf's single-ref arm already applied). +- `crates/ec-av1/src/decode.rs:1786` -- `COMPOUND_WARP_HITS_8` + + `compound_warp_hits_8()`: the gate's proof that the warp fired at an 8x8 + LEAF specifically (`COMPOUND_WARP_HITS` alone cannot tell it from a 16x16+). +- `crates/ec-av1/src/decode.rs:15806` (`ec_obmc_bsize`) and `15828` + (`ec_obmc_trace`) + the two call sites in `obmc_blend` -- the `EC_OBMC` rung. +- `crates/ec-av1/src/decode.rs:14682,22658` -- `EC_PICT idx=` decode-order + frame marker (printed under `EC_OBMC`/`EC_TRACE_MODE`), so a trace line can be + attributed to the frame whose `EC_AV1_PREFILT_DUMP` file mismatched. Without + it the r2 hunt mis-attributed every trace line by one frame. +- `crates/ec-av1/src/stream.rs:6332` -- the gate's `#[ignore]` removed, doc + comment carries this round's measurement, and a third hard assert + (`compound_warp_hits_8() > before`) added. + +## Class sweep + +Both inter block decoders are the only prediction sites +(`decode_inter_block` 16309, `decode_inter_block8` 19032); all 12 +`predict_compound_intermediate` calls were audited. Warp coverage is now: +16x16+ single-ref (18235-18253), 16x16+ compound y/u/v x 2 refs +(17130-17300), 8x8 leaf single-ref (20238-20253), 8x8 leaf compound luma x 2 +refs (19596/19618, chroma correctly excluded). No third twin exists. + +## Gate: GREEN, un-ignored + +`a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact` +(`--enable-dual-filter=1 --enable-obmc=1 --enable-warped-motion=1 +--enable-onesided-comp=1`, `--min-partition-size=8 --enable-ab-partitions=0 +--enable-1to4-partitions=0`, 64x64, 16 frames). Four hard asserts now: +compound 8x8 leaf reading its own switchable filter, a block whose two +dual-filter directions DIFFER, an 8x8 OBMC blend, and an 8x8 compound leaf +predicted through the per-ref GLOBAL warp. + +Command: +`EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-interp3 cargo test -p ec-av1 --lib a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact` +Result: `test result: ok. 1 passed; 0 failed` (log `$HOME/.cache/interp3-gate-r3.log`). + +## Refusals + +None lifted. The r1 refusal `an OBMC neighbour whose interp filter was never +recorded` stays (it does not fire on this stream); `refusal_inventory.rs` and +`gate_coverage.rs` unchanged. + +## EVIDENCE + +EVIDENCE: /tmp/claude-1000/-home-user-Documents-Code-Rust-edith-codecs/b6d8a07f-96a4-4bbb-b378-af9ae25cf7c9/scratchpad/{aom.obmc,ours.obmc} | `EC_OBMC=1 aomdec --rawvideo -o /dev/null mm.obu` vs `EC_OBMC=1 decode_probe mm.obu`, `diff` of every EC_OBMC line | 325 vs 325 lines, diff EMPTY -- OBMC neighbour selection/mv/ref/bsize/filter exonerated +EVIDENCE: same dir, pf_a/f.f0..15 vs pf_o/f.f0..15 | `EC_AV1_PREFILT_DUMP` on both decoders, byte compare per decode-order frame BEFORE the fix | frames 0-6 identical, frame 7 35 bytes differ (all inside luma rows 42-47, cols 16-23 = the 8x8 leaf at mi (10,4)), growing to 224 at frame 15 +EVIDENCE: same dir, pf_a vs pf_o2 | identical command AFTER the fix | all 16 decode-order frames byte-identical pre-filter (0 differing bytes) +EVIDENCE: $HOME/.cache/interp3-gate-r3.log | `cargo test -p ec-av1 --lib a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact -- --nocapture` | `test result: ok. 1 passed; 0 failed` with all four counter asserts live (the run would panic if `compound_warp_hits_8` had not moved) +EVIDENCE: SUITE_LINE_PLACEHOLDER + +## Residue + +- deferred(lane-inter8's 10-bit 8x8-leaf desync) -- a 10-bit twin of this gate. + Its sibling `a_real_aomenc_10bit_inter_sequence_with_an_8x8_leaf_split_...` + is still `#[ignore]`d on an unrelated 10-bit desync (lane-inter8 r2), so a + 10-bit arm of this recipe would go RED on that, not on interp3's own path. +- deferred(needs a multi-tile recipe that reaches an 8x8 leaf) -- a + `--tile-columns=1` arm. lane-inter8 r3 measured that the 128x64 multi-tile + recipe stops at the SB-level rect-partition refusal before any 8x8 leaf.