forge
Explore
Log in

Don't you dare go Hollow

R2 report + handoff -- compound comp_list gm-fill root cause, gate fixture swap, probe grid

Browse files at this commit

01a37e561336f56b33088ba628da038a4b4f9dfdAhmet Kaan GümüşParent: e2010ef
  • docs
    • r2 report + handoff -- compound comp_list gm-fill root cause, gate fixture swap, probe grid
Show full message
docs(sbrect10): r2 report + handoff -- compound comp_list gm-fill root cause, gate fixture swap, probe grid
lanes/sbrect10-r2.handoff.mdadded+99 -0
@@ -0,0 +1,99 @@
1+# lane-sbrect10 r2 handoff
2+
3+Branch `lane-sbrect10`, tip `2b9709c` (worktree
4+`/home/user/Documents/Code/Rust/edith_codecs-sbrect10`).
5+Commits this round: `3a9e83e` (merge main 18bf7dc) + `2b9709c` (the fix + gate + instrumentation).
6+
7+## STATUS: root cause FOUND and FIXED; pinned stream now byte-exact on all 6 probe arms.
8+## Only thing outstanding: the full suite result (armed, was at 340 tests / 0 failures).
9+
10+## 1. Merge state (done, clean)
11+`git merge --no-commit main` (main = 18bf7dc: r14 a2e2e29 + sb128 5ea5ec8) auto-merged
12+decode.rs + stream.rs with no conflicts. Verified before committing:
13+- `git diff main -- crates/ec-av1/src/cdf.rs` EMPTY and `... refusal_inventory.rs` EMPTY, so the
14+ NZ_MAP / FILTER_INTRA rows and the refusal list are byte-identical to main.
15+- The only lines the merged tree removes vs main are the lane's own r1 hunks (4 `uv_mode_cfl`
16+ lines in decode.rs, the `[8u32]` arm + its comment in stream.rs). Main's deletions all kept.
17+
18+## 2. Gate fixture state (done)
19+`a_real_aomenc_inter_frame_with_a_64x64_intra_block_reads_the_no_cfl_uv_alphabet` (stream.rs)
20+now uses the half-random source in BOTH orientations:
21+
22+ horizontal: if(lt(X,128), 40+mod(floor((Y+N*sp)/32)*90,200), mod((X*7+Y*13+N*97)*31,256))
23+ vertical: if(lt(Y,64), 40+mod(floor((X+N*sp)/32)*90,200), mod((X*7+Y*13+N*97)*31,256))
24+
25+r1's flat `200` half made aomenc code the right-hand superblocks skip, so the 8-bit arm saw 0
26+intra-above-32x32 blocks (probed cq 45/52/58/61/63). Grid `[58, 52, 45, 61]` x 2 orientations x
27+2 motion steps x 2 depths unchanged; counters are read on decoded+compared attempts only, every
28+decode-order frame is compared on Y/U/V, a mismatch fails and never SKIPs.
29+
30+## 3. The 10-bit defect: root cause, libaom line, fix
31+Pinned stream `$HOME/.cache/sbrect10/b58.obu`, sha256 hashed TWICE identical
32+`00b9253b308201118e27f348c67932a0006e3077ba7a9a401854c2ee7eb1dcd2`
33+(192x128, 6 frames, 10-bit cq58, `--sb-size=64 --min-partition-size=32 --max-partition-size=64
34+--enable-rect-partitions=1 --enable-1to4-partitions=1 --lag-in-frames=0 --cpu-used=0`;
35+regenerate with `bash $HOME/.cache/sbrect10/probe.sh "<geq>" 58 10`).
36+
37+How it was localised (each step ruled a layer out):
38+- First mismatch DECODE-ORDER frame 2, plane Y only (U/V exact), 8252 samples; per-64x64-SB map
39+ row0 `[0,0,4092]`, row1 `[0,64,4096]` = the whole RIGHT superblock column + deblock bleed.
40+- NOT an entropy desync: our `EC_TRACE_COEFF` all_zero ladder vs instrumented aomdec's is
41+ identical for all 180 TUs of the whole stream (`diff` empty), and blocks decoded AFTER the
42+ wrong ones (mi(16,0)) are pixel-exact.
43+- NOT a clamp: an `EC_DBG_CLAMP` probe on the dequant clamp `+-(1 << (7 + bd))` and on every
44+ `clamp_range` in transform.rs fired ZERO times on this stream.
45+- `EC_TRACE_MODE` mv diff, decode-order frame 2: aomdec mi(0,32) mode=24 ref0=1 ref1=4
46+ mv0=(128,-16) / ours (-1,2); mi(0,40), mi(8,32), mi(8,40), mi(16,40) all (128,-16) vs (-1,2);
47+ mi(16,32) (-176,256) vs (-241,264); mi(24,32) (-128,56) vs (-193,64). The
48+ NEAREST_NEARESTMV blocks take stack[0] directly, so libaom's stack[0].this_mv is (128,-16)
49+ where ours is (0,0), and the NEWMV blocks are off by the same predictor delta.
50+- Our stack for mi(0,32) = two entries `this=(0,0) comp=(0,0) w=2` -- the signature of the
51+ compound EXTENSION pass appending comp_list[0] and comp_list[1] into an empty stack.
52+- Frame 2's temporal field really is empty and that is CORRECT (new `EC_TPL_FIELD` occupancy
53+ dump under EC_TRACE_TPL: oh=1,2 all `.`, oh=3,4,5 all `#`; frame 2's LAST projection is
54+ suppressed by `is_lst_overlay` and its LAST2 is the key frame). So the candidate is spatial.
55+
56+ROOT CAUSE: `combine_compound_candidates` (crates/ec-av1/src/mvstack.rs:1482) filled the
57+`comp_list` tail slots -- the ones left after `ref_id` then `ref_diff` -- with `(0, 0)`.
58+libaom fills them with that side's GLOBAL MOTION vector, `setup_ref_mv_list`,
59+`av1/common/mvref_common.c:729`:
60+
61+ for (; comp_idx < MAX_MV_REF_CANDIDATES; ++comp_idx)
62+ comp_list[comp_idx][idx] = gm_mv_candidates[idx];
63+
64+Zero-filling was right only under IDENTITY global motion (the module doc's original reduction);
65+aomenc has `--enable-global-motion` ON by default. A compound block with no usable neighbour
66+pair (frame top row -> no above, 64x64 INTRA block to its left, empty temporal field) therefore
67+took a `(0,0)` predictor where libaom took the frame's translation.
68+
69+FIX: `combine_compound_candidates` takes `gm_mv_candidates: [(i32,i32); 2]` and uses it as the
70+per-side fill; the call site passes `[gm_mv(gm, ref_frame.0), gm_mv(gm, ref_frame.1)]`.
71+
72+SIBLING SWEEP (same shape): every `gm_mv_candidates` use in mvref_common.c was walked. The
73+single-ref tail fill (`:787-788`) is already ported as `gm_fallback` at mvstack.rs:1099-1100;
74+the `is_gm_block` substitutions (`:92`, `:117`) already take `gm` through `scan_*_compound`; the
75+add_tpl_ref_mv GLOBALMV_OFFSET compares (`:379-410`) already use `gm_mv(gm, ...)` on both sides.
76+This was the only zero-filled site in the crate.
77+
78+## 4. Is the pinned stream exact now? YES
79+`probe.sh "<half-random geq>" <cq> <depth>` after the fix, pixel diffs vs
80+`ffmpeg -pix_fmt yuv420p10le` / `yuv420p`, and `>32` intra-in-inter hit counts:
81+
82+| depth | cq 52 | cq 58 | cq 61 |
83+|---|---|---|---|
84+| 8-bit | 5 hits, 0 diffs | 2 hits, 0 diffs | 3 hits, 0 diffs |
85+| 10-bit | 6 hits, 0 diffs | 7 hits, 0 diffs | 7 hits, 0 diffs |
86+
87+Before the fix the 10-bit arms were 32890 (cq58) and 39907 (cq61) wrong samples.
88+
89+## 5. NEXT STEP (the only thing left)
90+Read `$HOME/.cache/sbrect10-suite-r2.log` -- the suite is armed as a user systemd unit
91+(`sbrect10-suite-r2-1788325070.service`, MemoryMax=10G, `cargo test -p ec-av1 --lib -j3`,
92+EC_AV1_REQUIRE_AOMENC=1, CARGO_TARGET_DIR=$HOME/.cache/cargo-target-sbrect10). At handoff it had
93+reached 340 tests with no FAILED line. Check with a single
94+`grep -E "^test result|FAILED" $HOME/.cache/sbrect10-suite-r2.log`; if a gate is red, re-run that
95+gate alone before touching code (another lane rebuilding the shared aomdec shows up as
96+"Os code 13 PermissionDenied"). Then fill the N/0 totals into `lanes/sbrect10-r2.report.md`
97+(section 4 is otherwise complete) and the lane is done.
98+
99+Nothing else is in flight; the worktree is clean at 2b9709c.