Lane-t900 r11 handoff -- frame-edge mv clamp root cause, 4K head prefix exact, chroma-only KB wall localised
Browse files at this commit810d4fcc90dc6efb157950ee336e1b5fabcf54d3Parent: 3bd2894- docs
- lane-t900 r11 handoff -- frame-edge mv clamp root cause, 4K head prefix exact, chroma-only KB wall localised
1 changed file +111 -0
- lanes/t900-r11.handoff.md +111 -0
lanes/t900-r11.handoff.mdadded+111 -0
| @@ -0,0 +1,111 @@ | |||
| 1 | +# lane-t900 r11 handoff -- target A was NOT loop restoration: it was the mv-stack frame-edge clamp, computed in `usize` | ||
| 2 | + | ||
| 3 | +Tip: `2b56599b` on `lane-t900` (r10 tip `2aa87a34`, merged to main as `99692ed0`; main | ||
| 4 | +fast-forwarded into the lane before any edit). | ||
| 5 | + | ||
| 6 | +## Target A -- 4K decode frame 88, 221 bytes: ROOT CAUSE FOUND, FIXED, gated | ||
| 7 | + | ||
| 8 | +**The charter premise (self-guided restoration last stripe) is DEAD.** The stage | ||
| 9 | +bisection killed it in two runs: the 221-byte mismatch is already present in the | ||
| 10 | +PRE-loop-filter dump, so no filter stage is involved. | ||
| 11 | + | ||
| 12 | +* post-deblock dump (`EC_AV1_POSTDEBLOCK_DUMP16` both decoders): rows 1594..1605 differ. | ||
| 13 | +* pre-filter dump (`EC_AV1_PREFILT_DUMP16` both decoders): Y rows 1600,1601,1602, | ||
| 14 | + x 1472..1535 -- exactly one 64x64 block -- plus 4 chroma samples. | ||
| 15 | + | ||
| 16 | +Ladder: `EC_TRACE_MODE` both decoders at decode frame 88 (ours labels frames with | ||
| 17 | +`EC_PICT idx=`, aomdec does not -- locate its lines by matching our `rng`): | ||
| 18 | + | ||
| 19 | + aomdec EC_MODE mi_row=400 mi_col=368 rng=32962 | ||
| 20 | + EC_MODE_MV mode=16 mv0=(32,568) rng=42514 | ||
| 21 | + EC_STACK ref=1 i=0 this=(192,-320) w=2 | ||
| 22 | + ours EC_MODE mi_row=400 mi_col=368 rng=32962 is_inter=1 skip=1 side=64 | ||
| 23 | + EC_STACK ref=1 i=0 this=(384,-320) w=2 | ||
| 24 | + EC_MODE_VAL mode=16 mv0=(224,568) rng=42514 | ||
| 25 | + | ||
| 26 | +Identical range at both rungs -- the entropy stream never diverged, only the | ||
| 27 | +reconstructed MV. `EC_TRACE_TPL` on both showed every temporal candidate at that | ||
| 28 | +block is `mfmv0=(0,0)`, so the stack entry is not temporal-projection related. | ||
| 29 | + | ||
| 30 | +Root cause (`crates/ec-av1/src/mvstack.rs:807` `clamp_mv_ref`): libaom's | ||
| 31 | +`mb_to_right_edge`/`mb_to_bottom_edge` (`set_mi_row_col`, av1_common_int.h) are | ||
| 32 | +SIGNED and a block overhanging the frame's right/bottom edge keeps its full | ||
| 33 | +`bw4`/`bh4`. Frame height 1608 -> `mi_rows == 402`, so the 64x64 block at | ||
| 34 | +mi_row 400 has `mb_to_bottom_edge = (402-16-400)*4*8 = -448` and the window top is | ||
| 35 | +`-448 + 512 + 128 = 192`. We computed that with `usize::saturating_sub` -> 0, window | ||
| 36 | +`640`, so 384 passed through unclamped. Full-pel MV, so the block is a straight copy: | ||
| 37 | +with row 224 (28 px) every source row was past 1607 and our MC replicated the last | ||
| 38 | +reference row; libaom with row 32 (4 px) reads real reference rows 1604..1606 of | ||
| 39 | +decode-order frame 83 (verified by patch search: `f88[1600:1603,1472:1536]` occurs | ||
| 40 | +exactly once in the reference set, at frame 83 row 1604 col 1543 = mv (4 px, 71 px)). | ||
| 41 | + | ||
| 42 | +Fix `2b56599b`: both edge terms computed in `i32`; new counter | ||
| 43 | +`mvstack::mv_clamp_edge_overhang_hits` (printed by `decode_probe`). | ||
| 44 | + | ||
| 45 | +Measured effect: | ||
| 46 | + | ||
| 47 | +| stream | before | after | | ||
| 48 | +|---|---|---| | ||
| 49 | +| 4K head, 148-OBU / 100-frame prefix (`~/.cache/t900-tmp/hgw_a.obu`) | 1 frame differs (f88, 221 B) | **0 of 100** | | ||
| 50 | +| 4K head, full 10 s (`~/.cache/hg-0-10s.obu`, 241 f) | not measured before | 66 differ, first **161**, worst 199 B (f188) | | ||
| 51 | +| 1080p @900 s cut (267 f) | 36 differ, first 41, worst 13 B | unchanged (36 / 41 / 13) | | ||
| 52 | +| 1080p @5400 s cut (275 f) | 134 differ, first 61, f113=1942 B | unchanged (134 / 61 / f113=1942, worst 2410 @ f244) | | ||
| 53 | +| 1080p head 0-10 s (241 f) | 78 differ, first 86 | unchanged (78 / 86, worst 5214 @ f188) | | ||
| 54 | +| 1080p 16-frame head cut `t900_h.obu` | exact | exact | | ||
| 55 | + | ||
| 56 | +Gates (both PASS, `cargo test -p ec-av1 --lib -- frame_edge_mv_clamping clamp_mv_ref_window` | ||
| 57 | +-> 2 passed, 0 failed, 179.96 s): | ||
| 58 | + | ||
| 59 | +* `stream::tests::a_10bit_film_frames_with_frame_edge_mv_clamping_decode_pixel_exact` -- | ||
| 60 | + new fixture `crates/ec-av1/fixtures/reelb_head_mvclamp_witness.obu`, 72158 bytes, sha256 | ||
| 61 | + `451a9b138995e636f22308847a123b5c8621d4908cd93772cf5bbf2b37df39d7` (truncated twice, | ||
| 62 | + identical hashes), 80 frame-carrying OBUs = 55 decode / 52 shown frames of the 4K head. | ||
| 63 | + SMALLEST prefix that fires the counter (N=79 -> 0, N=80 -> 5). All 55 decode-order | ||
| 64 | + frames byte-identical to aomdec; the gate compares the 52 shown frames on all planes | ||
| 65 | + vs ffmpeg and hard-asserts `mv_clamp_edge_overhang > 0`. | ||
| 66 | + CAVEAT, stated plainly: this fixture stops before frame 88, so it is a REGRESSION guard, | ||
| 67 | + not a reproducer of the 221-byte defect. The defect witness is the unit test: | ||
| 68 | +* `mvstack::tests::clamp_mv_ref_window_is_signed_at_the_frame_bottom_edge` -- the ladder's | ||
| 69 | + exact numbers (`clamp_mv_ref((384,-320), 400, 368, 16, 16, 960, 402) == (192,-320)`), | ||
| 70 | + which the pre-r11 code fails. | ||
| 71 | + | ||
| 72 | +No existing fixture in the repo fires the counter (all 12 `crates/ec-av1/fixtures/*.obu` | ||
| 73 | +and `fixtures/*.obu` measured at 0), which is why a new one was needed. | ||
| 74 | + | ||
| 75 | +## Target B -- 1080p bottom-edge chroma MC clamp: NOT fixed, and NOT the same class | ||
| 76 | + | ||
| 77 | +Unchanged by A (cut_900 still 36 frames, first bad f41 = 1 byte). The r8 localisation | ||
| 78 | +still stands (skip 32x32 mi(192,176) mv0=(-4,14) SMOOTH, chroma vertical taps at the | ||
| 79 | +last chroma row). Note for the next round: that block DOES overhang (mi_rows=198, | ||
| 80 | +bh4=8, 192+8=200), but its MV is far inside the clamp window, so the r11 fix cannot | ||
| 81 | +touch it -- the charter's "reference plane replicates from the aligned rather than the | ||
| 82 | +cropped height" premise is still UNTESTED. For 1920x792 the chroma crop height (396) | ||
| 83 | +and the mi-aligned chroma height (396) are EQUAL, so a crop-vs-aligned difference cannot | ||
| 84 | +be the explanation there; measure the actual tap rows instead (`EC_PRED`/MC rung on both | ||
| 85 | +decoders at chroma (353,395), frame 41 of `~/.cache/t900-tmp/cut_900.obu`). | ||
| 86 | + | ||
| 87 | +## Target C -- the KB walls: localised, not diagnosed | ||
| 88 | + | ||
| 89 | +`@5400` decode frame 113 (1942 B) via `python3 sb.py d_r11_cut_5400 113 64`: | ||
| 90 | +**CHROMA ONLY, luma bit-exact.** Deltas +-1..2, concentrated in | ||
| 91 | +SB(0,6)..SB(0,8)/SB(1,7)/SB(1,8) -- chroma x 220..260, y 16..32 (luma x 440..520, | ||
| 92 | +y 32..64) plus a 11-sample tail at SB(8,13). Every block in that region is INTRA | ||
| 93 | +inside an inter frame (`EC_TRACE_MODE`, frame 113: mi(8..16, 112..128) all | ||
| 94 | +`is_inter=0 side=16`). So the wall is a chroma intra path (CfL / chroma angular / | ||
| 95 | +chroma TX), not MC and not entropy-visible at the mode layer. | ||
| 96 | +1080p head f130 (1143 B) and the true worst f188 (5214 B) NOT measured this round. | ||
| 97 | + | ||
| 98 | +## Exact next steps | ||
| 99 | + | ||
| 100 | +1. Target C: run `EC_PRED` on BOTH decoders for cut_5400 frame 113 restricted to | ||
| 101 | + plane=1/2 at mi(8,112) (ours prints pixel origin x=224 y=16; aomdec prints | ||
| 102 | + mi_row/mi_col/plane/row_off/col_off + `ft=`), and compare `sum=`/`row0=`/`col0=`: | ||
| 103 | + that separates chroma prediction from chroma residual in one run. | ||
| 104 | +2. Target A residue: the 4K frontier moved from frame 88 to **frame 161** of | ||
| 105 | + `~/.cache/hg-0-10s.obu` (dumps kept in `~/.cache/t900-tmp/d_r11_reelb10/`); start there | ||
| 106 | + with `px4k.py d_r11_reelb10 161 3840 1608`. | ||
| 107 | +3. Target B as above. | ||
| 108 | + | ||
| 109 | +Tooling notes for the successor: `px4k.py <dumpdir> <frame> 3840 1608` (new this round, | ||
| 110 | +`~/.cache/t900-tmp/`) is the 4K twin of `px.py`; `~/.cache/reelckf-work/trunc.py <in> <N> | ||
| 111 | +<out>` keeps N frame-carrying OBUs; `cmp.sh <name> <obu>` writes `d_<name>/`. | ||